FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
June 01, 1992

C Packages

(Page 2 of 4)
June 1992/C Packages/Listing 1

Listing 1 Ada Symbol Table Package

package SYM_UTIL is
                         -- Global debug switch.
    SYM_UTIL_DEBUG: BOOLEAN := FALSE ;
                         -- Add symbol to table.
    procedure SYM_ADD (NAME: STRING, VALUE: INTEGER)
                      -- Delete symbol from table.
    procedure SYM_DELETE (NAME: STRING) ;
                          -- Lookup a symbol.
    function SYM_LOOKUP (NAME: STRING) return INTEGER ;
 end SYM_UTIL ;
 
 package body SYM_UTIL is
                          -- Internal variables.
    type SYMBOL NODE is record
       ...
    end record ;
    SYMBOL_LIST: access SYMBOL_NODE := null ;
                          -- Public functions.
    procedure SYM_ADD (NAME: STRING, VALUE: INTEGER) is
    begin
       ... adds NAME/VALUE pair to the symbol table ...
    end SYM_ADD ;

    procedure SYM_DELETE (NAME: STRING) is
    begin
       ... deletes NAME from the symbol table ...
    end SYM_DELETE ;

    function SYM_LOOKUP (NAME: STRING) return INTEGER is
    begin
       ... returns NAME's value from the symbol table ...
    end SYM_LOOKUP ;
                       -- Internal function called
                        -- by the other functions.
    function SYM_LOCATE (NAME: STRING)
       return access SYMBOL_NODE is
    begin
       ... locates NAME's node in the symbol list ...
    end SYM_LOCATE ;

 end SYM_UTIL ;
/* End of File */
Previous Page | 1 | 2 | 3 | 4 Next Page
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK