I have made a number of tweaks to the treatment of pointers and objects stemming from major
modifications to the LIST and HASH procedures. The GDL code can be converted from current CVS
code using the files uploaded here. Two stages are involved, stage0 and stage1. The files replace existing
CVS code sing a script which first verifies that the "old" code is what is expected, preserving those files in
the gdl/src directory.
stage0.targz and stage1.targz are to be unpacked in the directory holding gdl (gnudatalanguage/ as it comes from the CVS tarball) and the shell scripts stage0.sh, and stage1.sh run, in that order.
~~~~
$ gdltest
GDL - GNU Data Language, Version 0.9.7 CVS
% Compiled module: PATH_SEP.
GDL> #help
Internal PROCEDURE : HELP,[inf.Args],ALL_KEYS,BRIEF,FULL,CALLS,COMMON,DEBUG,DEVICE,FUNCTIONS,HEAP_VARIABLES,HELP,INFO,FILES,INTERNAL_LIB_GDL,KEYS,LAST_MESSAGE,LIB,MEMORY,NAMES,OBJECTS,OUTPUT,PATH_CACHE,PREFERENCES,PROCEDURES,RECALL_COMMANDS,ROUTINES,SOURCE_FILES,STRUCTURES,SYSTEM_VARIABLES,TRACEBACK
GDL> help,/lib,names="PTR"
Library procedures (1):
PTR_FREE,[inf. Args]
Library functions (3):
res=PTRARR([8 Args],NOZERO,ALLOCATE_HEAP)
res=PTR_NEW([1 Arg],NO_COPY,ALLOCATE_HEAP)
res=PTR_VALID([1 Arg],CAST,COUNT,GET_HEAP_IDENTIFIER)
% At $MAIN$
GDL> help,/lib,names="HEAP",output=ostr & nstr=n_elements(ostr)
GDL> for k=0,nstr-1 do print,ostr[k]
Library procedures (2):
HEAP_FREE,[1 Arg],PTR,OBJ,VERBOSE
HEAP_GC,PTR,OBJ,VERBOSE
Library functions (1):
res=HEAP_REFCOUNT([1 Arg],DISABLE,ENABLE,IS_ENABLED)
% At $MAIN$
GDL> #array_equal
Internal FUNCTION : res=ARRAY_EQUAL([2 Args],NO_TYPECONV,NOT_EQUAL,QUIET)
GDL> ; from bug report #721:
GDL> struct={array7:[3,3,7,7,7,5,5],z:ptr_new(/allocate_heap)}
GDL>
GDL> zval=findgen(12)
GDL>
GDL> pointer=ptr_new(struct,/no_copy)
GDL>
GDL> (*pointer).z=zval
GDL>
GDL> help,/heap
Heap Variables:
# Pointer: 2
# Object : 0
~~~~
After Stage0 is installed the resultant GDL will behave exactly as CVS (as of 2017-Oct-14)
Next patch will be stage1, which will include many of the new procedures.
Stage1 brings in the new gdlhelp, DELVAR (from $MAIN level only), HEAP_GC, HEAP_FREE, etc.
Still, object programming will not go very far but primitive examples can be created using the LIST() and HASH() routines which are still as found in current 0.9.7 CVS.
I encourage all to dowload and build, run this patch and see if you can "fool the code".
Mix up pointer creation, structures, pointer reassignment, etc. and also the DELVAR routine
and the use of comomon variables.
I do not have access to an IDL interpreter and so compliance testing is needed.
.RNEW is activated as an isolated command, i.e. the file usually invoked by the command will not be
seen but the reset will occur. Check how common variables are treated here, and does it comply with what IDL does. The HELP,/COMMON (GDL only) will help here.
Last edit: GregJung 2017-10-15
I forgot to mention the thrid stage, called stage2. Note that as CVS continues and files are changed,
some manual intervention wil lbe needed to get these patches in using the scripts provided. I anticipate
stage0 to be incorportated in the next GDL version (0.9.8) and stage1 soon thereafter in CVS. When that happens I will provide stage2.
Greg, could you confirm if this SF ticket can be cloased - I believe all the relevant changes are now within the PRs you crated on github - right? Thanks!
Yes the gdlhelp_fin branch has everything for help,/heap. And mostly
all of stage1 is in. But what is going on with these test crashes?
For gdlhelp it is only test: test_angles.pro that goes wrong.
File_etc branch fails in about 8 tests on travis, but those relevant to
the changed code are ok in Linux.
Some stage2 changes are deep internal, so I'd like to see these errors get
figured out before they go in
On Mon, Apr 16, 2018 at 12:04 AM, Sylwester Arabas slayoo@users.sourceforge.net wrote:
Related
Bugs:
#725