[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Nov 27 00:00:21 1992 
Subject:Re: Accessing rc_start (from RC_GRAPHIC) within a section 
From:Aaron Sloman 
Volume-ID:921127.02 

lpb@cs.bham.ac.uk (Luc Beaudoin) writes:

> Organization: School of Computer Science, University of Birmingham, UK
> Date: Thu, 26 Nov 1992 23:26:04 GMT
>
> I guess I still don't have the hang of sections and rc_graphic. I'm not sure
> why when I define the following bit of code which loads up rc_graphic in the
> section, Foo, and then calls rc_start (which is defined in rc_graphic),
> rc_start is not defined! Before I add some comments, here's the code and the
> error produced during compilation of the section:
>
>     section $-Foo =>foo;
>     lib popxlib;
>     lib rc_graphic;
>
>     rc_start();
>
>     endsection;
>
> ;;; MISHAP - enp: EXECUTING NON-PROCEDURE
> ;;; INVOLVING:  <undef rc_start>

I haven't checked, but I assume this is because lib rc_graphic
is compiled inside the top level section, i.e. it's code probably
has
    section;
        ... main contents of file
    endsection;


This means that only things defined as global in that procedure will
automatically be imported into subsections, e.g. your section $-Foo.

If the library had said

    define global rc_start ....

then rc_start would be imported to your section.

You can fix this by predefining rc_start (and other things you want
to use) as global before or after you compile lib rc_graphic.

e.g. this should work.

    section;
    global vars rc_start;   ;;; see HELP GLOBAL
    endsection;

    section $-Foo =>foo;
    lib popxlib;
    lib rc_graphic;

    rc_start();

    endsection;

An alternative would be to *import* rc_start and other required
procedures into the lower level section, e.g.

    lib popxlib;
    lib rc_graphic;

    section $-Foo rc_start, rc_drawto, rc_jumpto => foo;

    rc_start();

    endsection;

Etc.

There is, unfortunately, no way to import a section (and all its
sub-sections) onto another section except by importing individual
identifiers or making them global in the highest common ancestor
section.

Aaron
-- 
Aaron Sloman, School of Computer Science,
The University of Birmingham, B15 2TT, England
EMAIL   A.Sloman@cs.bham.ac.uk  OR A.Sloman@bham.ac.uk
Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281