HP Forums
self modifying code - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: self modifying code (/thread-12737.html)

self modifying code - Wes Loewer - 04-04-2019 06:40 PM

It occurred to me today that self modifying code is easily done in PPL. Save the following program as HiBye and run it a few times from Home.

 LOCAL source;
 IF INSTRING(source,"He"+"llo") THEN
 RETURN "Hello";

hee hee.

RE: self modifying code - Carlos295pz - 04-04-2019 10:43 PM

Editing programs with Programs("name") is wonderful until you hit the limit of 65,535 characters for the string type.

RE: self modifying code - Wes Loewer - 04-05-2019 12:14 PM

With Programs():=string, is the program compiled at save time or upon first run time?

RE: self modifying code - Carlos295pz - 04-05-2019 01:02 PM

Programs():=string compiles during execution, that is why you can even abort the execution if you find a difference relevant to the previous code. This instruction it returns 1 if compiled correctly and 0 if there are syntax errors.