Menu

#141 common blocks are displayed in HELP even though not declared.

closed
nobody
None
3
2018-04-19
2015-04-20
GregJung
No

The routine loadct declares a common block that would presumably be used only
by certain routines. The common block's existence, though, is revealed by the HELP routine and so it clutters the HELP output:

  GDL - GNU Data Language, Version 0.9.5+ 2015.03.20 {gvj}/f/gdl/+ (f77 fix)

- For basic information type HELP,/INFO
- Please report bugs, feature or help requests and patches at:
  http://sourceforge.net/projects/gnudatalanguage/

% Compiled module: PATH_SEP.
GDL> loadct,12
% Compiled module: LOADCT.
% LOADCT: Loading table 16 LEVEL
GDL> help
% At $MAIN$
B_CURR (COLORS) BYTE      = Array[256]
B_ORIG (COLORS) BYTE      = Array[256]
GDLLIB          STRING    = 'D:/programs/gnudatalanguage/lib'
G_CURR (COLORS) BYTE      = Array[256]
G_ORIG (COLORS) BYTE      = Array[256]
O               ULONG     =            1
R_CURR (COLORS) BYTE      = Array[256]
R_ORIG (COLORS) BYTE      = Array[256]
TSTLIB          LONG      =           31
Compiled Procedures:
$MAIN$ LOADCT

Compiled Functions:
PATH_SEP
GDL> #help
Internal PROCEDURE : HELP,[inf. Args],ALL_KEYS,BRIEF,CALLS,DEVICE,FUNCTIONS,HELP,INFO,
INTERNAL_LIB_GDL,KEYS,LAST_MESSAGE,LIB,MEMORY,NAMES,OUTPUT,PATH_CACHE,PREFERENCES,
PROCEDURES,RECALL_COMMANDS,ROUTINES,SOURCE_FILES,STRUCTURES,SYSTEM_VARIABLES,TRACEBACK
GDL> print,r_orig[40]
% Variable is undefined: R_ORIG
% Execution halted at: $MAIN$
GDL>

Nevertheless it would be useful to see common blocks that have been created, so a
HELP,/COMMON option would be interesting.

Discussion

  • GregJung

    GregJung - 2015-05-01

    I've implemented "HELP,/COMMON" as an option alongside the no-parameter
    call. See next post for the implementation.

     

    Last edit: GregJung 2015-05-10
  • GregJung

    GregJung - 2015-05-10

    I've now implemented /COMMON, /FULL, and /NAMES in help,
    as well as .RNEW fro $MAIN$
    and command DELVAR. Expect these to be in CVS soon after today. (May 10).
    I don't have an IDL to compare behaviors with, so please comment on any divergences.

    Demo session:

    In this session I've just started up and ran test_tv, which (via loadct) initiates the
    COLORS common block - although not visible to the $MAIN$ until declared.
    /common is a new keyword to help the user find the internals he/she has compiled.

    GDL> help,/common
    % At $MAIN$
     Common block COLORS
    R_ORIG (COLORS) BYTE      = Array[256]
    G_ORIG (COLORS) BYTE      = Array[256]
    B_ORIG (COLORS) BYTE      = Array[256]
    R_CURR (COLORS) BYTE      = Array[256]
    G_CURR (COLORS) BYTE      = Array[256]
    B_CURR (COLORS) BYTE      = Array[256]
    

    Normally the help will not list these variable because they are not defined in the subroutine. What you see as variables were created in my startup routine:

    GDL> help
    % At $MAIN$
    GDLLIB          STRING    = 'D:/programs/gnudatalanguage/lib'
    TSTLIB          LONG      =           31
    Compiled Procedures:
    $MAIN$ LOADCT MY_WINDOW TEST_TV TEST_TV_DAMIER
     TEST_TV_DAMIER_COLOR TEST_TV_OVER_BOX TVSCL
    
    Compiled Functions:
    DIST TITLE4TEST_TV
    

    When a common block is declared in $MAIN$ then help will report it along with the other variables, in alphabetical order

    GDL> common colors,ro,go,bo,rc,gc,bc
    GDL> help
    % At $MAIN$
    BC (COLORS)     BYTE      = Array[256]
    BO (COLORS)     BYTE      = Array[256]
    GC (COLORS)     BYTE      = Array[256]
    GDLLIB          STRING    = 'D:/programs/gnudatalanguage/lib'
    GO (COLORS)     BYTE      = Array[256]
    RC (COLORS)     BYTE      = Array[256]
    RO (COLORS)     BYTE      = Array[256]
    TSTLIB          LONG      =           31
    Compiled Procedures:
    $MAIN$ LOADCT MY_WINDOW TEST_TV TEST_TV_DAMIER
     TEST_TV_DAMIER_COLOR TEST_TV_OVER_BOX TVSCL
    
    Compiled Functions:
    DIST TITLE4TEST_TV
    

    ; Multiple main programs may have been created with multiple name choices in the same
    common block. Therefore RNEW will remove these references also as well as the un-attached variables.

    GDL> .rnew
    Common block {COLORS} Hidden
    Interactive RUN not implemented yet.
    GDL> help
    % At $MAIN$
    Compiled Procedures:
    $MAIN$ LOADCT MY_WINDOW TEST_TV TEST_TV_DAMIER
     TEST_TV_DAMIER_COLOR TEST_TV_OVER_BOX TVSCL
    
    Compiled Functions:
    DIST TITLE4TEST_TV
    ; Bring the common block back with (new) names:
    GDL>  common colors,ro,go,bo,rc,gc,bc
    GDL> help
    % At $MAIN$
    BC (COLORS)     BYTE      = Array[256]
    BO (COLORS)     BYTE      = Array[256]
    GC (COLORS)     BYTE      = Array[256]
    GO (COLORS)     BYTE      = Array[256]
    RC (COLORS)     BYTE      = Array[256]
    RO (COLORS)     BYTE      = Array[256]
    Compiled Procedures:
    $MAIN$ LOADCT MY_WINDOW TEST_TV TEST_TV_DAMIER
    TEST_TV_DAMIER_COLOR TEST_TV_OVER_BOX TVSCL
    
    Compiled Functions:
    DIST TITLE4TEST_TV
    ; The /common keyword still refers to the original
    ;    global common list:
    GDL> help,/common
    % At $MAIN$
     Common block COLORS
    R_ORIG (COLORS) BYTE      = Array[256]
    G_ORIG (COLORS) BYTE      = Array[256]
    B_ORIG (COLORS) BYTE      = Array[256]
    R_CURR (COLORS) BYTE      = Array[256]
    G_CURR (COLORS) BYTE      = Array[256]
    B_CURR (COLORS) BYTE      = Array[256]
    
     

    Last edit: GregJung 2015-05-10
  • Sylwester Arabas

    • status: open --> closed
     
  • Sylwester Arabas

    Closing as this is addressed here: https://github.com/gnudatalanguage/gdl/pull/160

     

Log in to post a comment.