[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jan 11 12:06:35 1994 
Subject:Clearing Memory Without Quitting Pop11 
From:Steve Knight 
Volume-ID:940112.02 

Tim asks:
> When you first start up Pop11 and compile a program, the compiler produces a
> list of the global variables it is declaring for you.
>
> Now if you recompile the program, as the variables have already been declared,
> you don't get the warning messages again.
>
> Is there a way to remove the existing global variable declarations without
> quitting Pop11?.

The procedure responsible for declaring the top-level variables is
-sysdeclare-.  It is user-defineable (after being unprotected).
According to REF VMCODE its default value is approximately this

             define vars sysdeclare(word);
                lvars word;
                sys_autoload(word) -> ;
                unless isdefined(word) then
                    ident_declare(word, 0, false);
                    prwarning(word)
                endunless
             enddefine;

I used to run with the following default value

             define vars sysdeclare(word);
                lvars word;
                sys_autoload(word) -> ;
                unless isdefined(word) then
                    mishap( ';;; CANNOT AUTOLOAD VARIABLE', [ ^word ] )
                endunless
             enddefine;

Since this version mishapped (and so never declared the variable)
repeated compilations would also provoke the same mishap.  If this is
too violent then one could write

             vars my_declarations_list = [];

             define vars sysdeclare(word);
                lvars word;
                sys_autoload(word) -> ;
                unless isdefined(word) then
                    ident_declare(word, 0, false);
                    prwarning(word);
                    { ^current_section ^word } :: my_declarations_list
                        -> my_declarations_list
                endunless
             enddefine;

And then trash the declarations by running

            define global trash_declarations();
                dlocal current_section;
                lvars i;
                for i in my_declarations_list do
                    i(1) -> current_section;
                    syscancel( i(2) );
                endfor;
            enddefine;

Hope this helps ...

Steve