Share

gnuplot development

Tracker: Patches

5 Refactor lf_push() - ID: 2889923
Last Update: Comment added ( sfeam )

This patch mangles several related changes. If only some of these changes
are accepted I will be happy to prepare a respective patch. They are
mangled because they are not quite commutative. :-(

The following things are changed:
* The if_depth is saved within lf_state_struct. This is actually a bug fix
for nested loads and evals.
* The call feature is largely factored out of load_file() into seperate
functions to clean the structure of load_file().
* The common code of eval_command() and load_command() is factored out into
lf_push() and lf_pop().
* The recursion detection for the eval command is reworked to check for the
same command string within the respective stack.
* The history_command() uses do_string() now that there is a recursion
detection.

Juergen


Juergen Wieferink ( wieferink ) - 2009-10-31 11:22

5

Closed

Accepted

Nobody/Anonymous

None

None

Public


Comments ( 6 )




Date: 2009-12-20 21:35
Sender: sfeamProject Admin

Thanks. I've applied this to 4.5. If no problems crop up it can probably
go into the 4.4 series also.


Date: 2009-12-20 10:26
Sender: wieferink

PS: Sorry for the inconvenience.

Juergen



Date: 2009-12-20 10:24
Sender: wieferink

Yes it is. Honestly, I have updated the patches within my own repository
long since (which is simple compared to publishing it...). The updated
patch is attached.

Juergen



Date: 2009-12-20 05:08
Sender: sfeamProject Admin

This patchset no longer applies cleanly, because in the interim there was a
change in the token accounting, with num_tokens being replaced by
(num_tokens+1) in several places.

2009-11-16 Juergen Wieferink <wieferink@freenet.de>
* src/command.c (do_string_and_free) src/misc.c (load_file): Fix
memory
issues of patch 2009-10-30 (SF Patch #2898455 and Bug #2895620).

I can apply the patch anyway after manual fix-up,
but I am wondering if the same s/num_tokens/(num_tokens+1)/ change is
needed by the code in the patch itself. Is it?


Date: 2009-11-04 13:22
Sender: wieferink

The new patch is divided into several sections each of which copes with one
of the above mentioned changes.



Date: 2009-10-31 14:57
Sender: wieferink

Come to think of it, there could be done even more. lf_push() gathers a
whole lot of scattered global variables. Some of the values (in current
CVS only one: FILE *fp) belongs to the current recursion level, the others
to the last. I think that these values could be better organized. Either
keep all these values in a "current" lf_state_struct or at least organize
them in substructs...

Juergen



Log in to comment.




Attached Files ( 3 )

Filename Description Download
jw-refactor-2009-12-20.patch Patch updated for 2009-11-16 Download
jw-refactor-2009-10-31.patch Patch Download
jw-refactor-2009-11-04.patch New (demangled) patch Download

Changes ( 6 )

Field Old Value Date By
close_date - 2009-12-20 21:35 sfeam
resolution_id None 2009-12-20 21:35 sfeam
status_id Open 2009-12-20 21:35 sfeam
File Added 355861: jw-refactor-2009-12-20.patch 2009-12-20 10:26 wieferink
File Added 349510: jw-refactor-2009-11-04.patch 2009-11-04 13:21 wieferink
File Added 348965: jw-refactor-2009-10-31.patch 2009-10-31 11:22 wieferink