Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-12 - 43,50552/sym6r.def
There are no other files named sym6r.def in the archive.
    {------------------------------------------------------------------------}
    {--------------------------------------/                            \----}
    {----                              ----!  definitions   for    the  !----}
    {----     S Y M T A B . D E F      ----!  symbol-table version 3.2  !----}
    {----                              ----!  (6  character id option)  !----}
    {--------------------------------------\  ("no-shit" version)       /----}
    {------------------------------------------------------------------------}

CONST
    table_max		= 10000		{ max. hash table size (objects) };
    cluster_size	= 3		{ size of property clusters };
    err_max		= 299		{ highest SYMTAB error code };
    no_error		= 0		{ indicates no errors };

    schar_min		= 00b		{ lowest SIXBIT character };
    schar_max		= 77b		{ highest SIXBIT character };
    name_length		= 6		{ identifier (name) length };

TYPE

    large		= 1..50000		{ some "large" subrange };

    name_type           = PACKED ARRAY [1..name_length] OF schar_min..schar_max;
    char_name		= PACKED ARRAY [1..name_length] OF char;

    err_type            = -1..err_max		{ possible error codes };
    table_index		= 0..table_max;

    word		= integer;
    thing               = ARRAY [1..cluster_size] OF word { property element cluster };

    prop_kind		= (p_scalar, p_boolean,
			   p_sequence, p_stack, p_queue,
			   p_set,
			   p_array);

    table_list	= ^r_table_list;
    hash_table	= ^h_table;
    object	= ^r_object;
    property	= ^r_property;
    cluster	= ^r_cluster;
    list	= ^r_list;
    arrayptr	= ^r_array;

    order		= (s_lt, s_eq, s_gt);

    r_list    = RECORD		     { "scalar" list }
		    data : word;
		    link : PACKED RECORD
				      last,
				      next : list;
				  END;
		END;

    r_array   = ARRAY [large] OF word { some large array };

    r_cluster = RECORD               { property cluster }
		    data : thing;
		    link : PACKED RECORD
				      last,
				      next : cluster;
				  END;
		END;

    r_table_list= PACKED RECORD		{ list of hash tables }
		      table	  : hash_table;
		      next	  : table_list;
		  END;

    table_entry = object		{ entries in the hash table };

    vector	= ARRAY [0..table_max] OF table_entry;

    h_table	= RECORD
		      name        : name_type		{ the table's name };
		      level				{ scope level },
		      maxdepth				{ max. search depth },
		      nhash				{ # hashes },
		      nrehash	  : integer		{ # rehashes };
		      nused				{ symbols used },
		      size        : 0..table_max	{ the table's size };
		      write_enabled,
		      sorted      : boolean;
		      next        : hash_table		{ the next table };
		      table       : ^vector		{ the table itself };
		  END;

    r_property = RECORD					{ property header }
		     name : name_type;
		     obj  : object	{ "parent" object };
		     previous,
		     next : property    { bi-linked list for properties };
		     CASE kind : prop_kind OF
			 p_boolean	: ();
			 p_scalar	: (wvalue : word);
			 p_array	: (avalue : arrayptr;
					   asize : integer);
			 p_sequence	: (current,
					   first,
					   last : PACKED RECORD
							     main : cluster;
							     index : 0..cluster_size;
							 END;
					  );
			p_queue		: (head,
					   tail : list;
					  );
			p_stack		: (top,
					   bottom : list;
					  );
			p_set		: (e_first,
					   e_last,
					   e_current : list;
					   cardinality : integer;
					  );
		 END;

    r_object = RECORD					{ definition of objects }
		   name		  : name_type		{ the object's name };
		   table	  : hash_table		{ "parent" hash table };
		   index	  : -1..table_max;	{ points back to hash table }
		   kind,
		   value          : integer		{ so-called "immediate properties" };
		   properties     : property		{ header to list of properties };
		   next           : object		{ linked list for "free" objects };
	       END;


	{>>>>    Initialization & error reporting procedures    <<<<}

    PROCEDURE SymIni;						EXTERN;
    FUNCTION  SymErr				  : err_type;	EXTERN;
    FUNCTION  SymLErr				  : err_type;	EXTERN;
    PROCEDURE SymPErr	(VAR out   : text;
			     code  : err_type);			EXTERN;

	{>>>>    General purpose conversion procedures    <<<<}

    FUNCTION  StProp	(    thing : word)	  : property;	EXTERN;
    FUNCTION  SfProp	(    prop  : property)	  : word;	EXTERN;
    FUNCTION  StObj	(    thing : word)	  : object;	EXTERN;
    FUNCTION  SfObj	(    obj   : object)	  : word;	EXTERN;
    FUNCTION  StTab	(    thing : word)	  : hash_table;	EXTERN;
    FUNCTION  SfTab	(    tab   : hash_table)  : word;	EXTERN;

    FUNCTION  StInt	(    thing : word)	  : integer;	EXTERN;
    FUNCTION  SfInt	(    int   : integer)	  : word;	EXTERN;
    FUNCTION  StReal	(    thing : word)	  : real;	EXTERN;
    FUNCTION  SfReal	(    r     : real)	  : word;	EXTERN;
    FUNCTION  StChar	(    thing : word)	  : char;	EXTERN;
    FUNCTION  SfChar	(    c     : char)	  : word;	EXTERN;
    FUNCTION  StBool	(    thing : word)	  : boolean;	EXTERN;
    FUNCTION  SfBool	(    b     : boolean)	  : word;	EXTERN;
    PROCEDURE StPtr	(VAR ptr   : pointer;
			     int   : word);			EXTERN;
    PROCEDURE SfPtr	(    ptr   : pointer;
			 VAR int   : word);			EXTERN;

	{>>>>    Name manipulation procedures    <<<<}

    PROCEDURE Sf6Name	(    name  : name_type;
			 VAR extnm : char_name);		EXTERN;
    PROCEDURE St6Name	(VAR name  : name_type;
			     extnm : char_name);		EXTERN;
    PROCEDURE Sf7Name	(    name  : name_type;
			 VAR extnm : char_name);		EXTERN;
    PROCEDURE St7name	(VAR name  : name_type;
			     extnm : char_name);		EXTERN;
    FUNCTION  SeqNames	(    name1,
			     name2 : name_type) : boolean;	EXTERN;
    FUNCTION  ScmNames	(    name1,
			     name2 : name_type) : order;	EXTERN;
    PROCEDURE S2Cases	(    on    : boolean);			EXTERN;

	{>>>>    Hash table manipulation procedures    <<<<}

    FUNCTION  TLookup	(    name  : name_type)   : hash_table;	EXTERN;
    FUNCTION  TCreate	(    name  : name_type;
			     size  : table_index) : hash_table;	EXTERN;
    FUNCTION  TShove	(    name  : name_type;
			     size  : table_index) : hash_table;	EXTERN;

    PROCEDURE TKill	(    table : hash_table);  		EXTERN;
    PROCEDURE TWipe	(    table : hash_table);  		EXTERN;

    FUNCTION  TBegin	(    table : hash_table;
			     size  : table_index) : hash_table;	EXTERN;
    FUNCTION  TEnd	(    table : hash_table)  : hash_table;	EXTERN;

    FUNCTION  TLink	(    tab1,
			     tab2  : hash_table)  : hash_table;	EXTERN;
    FUNCTION  TUnLink	(    table : hash_table)  : hash_table;	EXTERN;

    PROCEDURE TSearch	(    table : hash_table;
			     depth : integer);			EXTERN;

    FUNCTION  TWrite	(    table : hash_table;
			     on    : boolean)	  : boolean;	EXTERN;
    PROCEDURE TSort	(    table : hash_table;
			     up    : boolean);			EXTERN;

    PROCEDURE TName	(    table : hash_table;
			 VAR name  : name_type);		EXTERN;
    FUNCTION  TSize	(    table : hash_table)  : table_index;EXTERN;
    FUNCTION  TLevel	(    table : hash_table)  : integer;	EXTERN;
    FUNCTION  TUsed	(    table : hash_table)  : integer;	EXTERN;
    FUNCTION  TnHash	(    table : hash_table)  : integer;	EXTERN;
    FUNCTION  TnReHash	(    table : hash_table)  : integer;	EXTERN;

	{>>>>    Object manipulation procedures    <<<<}

    FUNCTION  OLookup	(    table : hash_table;
			     name  : name_type)   : object;	EXTERN;
    FUNCTION  OCreate	(    table : hash_table;
			     name  : name_type)   : object;	EXTERN;
    FUNCTION  OShove	(    table : hash_table;
			     name  : name_type)   : object;	EXTERN;
    FUNCTION  OFind	(    table : hash_table;
			     name  : name_type)   : object;	EXTERN;

    FUNCTION  OFirst	(    table : hash_table)  : object;	EXTERN;
    FUNCTION  ONext	(    obj   : object)      : object;	EXTERN;

    PROCEDURE OKill	(    obj   : object);			EXTERN;
    PROCEDURE OWipe	(    obj   : object);			EXTERN;

    PROCEDURE OWhat	(    obj   : object;
			 VAR name  : name_type;
			 VAR kind  : word;
			 VAR value : word);			EXTERN;
    FUNCTION  OTable	(    obj   : object)      : hash_table;	EXTERN;
    PROCEDURE OName	(    obj   : object;
			 VAR name  : name_type);		EXTERN;
    FUNCTION  OKind	(    obj   : object)      : word;	EXTERN;
    FUNCTION  OValue	(    obj   : object)      : word;	EXTERN;
    PROCEDURE OChange	(    obj   : object;
			     kind  : word;
			     value : word);			EXTERN;

	{>>>>    Property manipulation procedures    <<<<}

    FUNCTION  PLookup	(    obj  : object;
			     name : name_type)    : property;	EXTERN;
    FUNCTION  PCreate	(    obj  : object;
			     name : name_type;
			     shove: boolean;
			     kind : prop_kind)    : property;	EXTERN;
    FUNCTION  PArray	(    obj  : object;
			     name : name_type;
			     shove: boolean;
			     size : integer)      : property;	EXTERN;

    PROCEDURE PKill	(    prop : property);			EXTERN;
    PROCEDURE PWipe	(    prop : property);			EXTERN;

    FUNCTION  PKind	(    prop : property)     : prop_kind;	EXTERN;
    FUNCTION  PObject	(    prop : property)     : object;	EXTERN;
    PROCEDURE PName	(    prop : property;
			 VAR name : name_type);			EXTERN;
    FUNCTION  PFirst	(    obj  : object)       : property;	EXTERN;
    FUNCTION  PNext	(    prop : property)     : property;	EXTERN;

    FUNCTION  PValue	(    prop : property)     : word;	EXTERN;
    PROCEDURE PAssign	(    prop : property;
			     val  : word);			EXTERN;
    FUNCTION  PEmpty	(    prop : property)     : boolean;	EXTERN;

	{>>>>    `p_sequence' specific group    <<<<}

    PROCEDURE PReset	(    prop : property);			EXTERN;
    PROCEDURE PAppend	(    prop : property);			EXTERN;

    FUNCTION  PEnd	(    prop : property)     : boolean;	EXTERN;
    PROCEDURE PGet	(    prop : property);			EXTERN;
    PROCEDURE PPut	(    prop : property);			EXTERN;
    PROCEDURE PRead	(    prop : property;
			 VAR val  : word);			EXTERN;
    PROCEDURE PWrite	(    prop : property;
			     val  : word);			EXTERN;

	{>>>>    `p_stack' specific group    <<<<}

    PROCEDURE PPush	(    prop : property;
			     val  : word); 			EXTERN;
    FUNCTION  PPop	(    prop : property)     : word;	EXTERN;
    FUNCTION  PTop	(    prop : property)     : word;	EXTERN;

	{>>>>    `p_queue' specific group    <<<<}

    PROCEDURE PQueue	(    prop : property;
			     val  : word); 			EXTERN;
    FUNCTION  PunQueue	(    prop : property)     : word;	EXTERN;

	{>>>>    `p_set' specific group    <<<<}

    FUNCTION  PIn	(    prop : property;
			     val  : word)         : boolean;	EXTERN;
    PROCEDURE PAdd	(    prop : property;
			     val  : word);			EXTERN;
    PROCEDURE PRemove	(    prop : property;
			     val  : word);			EXTERN;
    FUNCTION  PCard	(    prop : property)	  : integer;	EXTERN;
    FUNCTION  PFElement	(    prop : property)     : word;	EXTERN;
    FUNCTION  PNElement	(    prop : property)     : word;	EXTERN;

	{>>>>    `p_array' specific group    <<<<}

    PROCEDURE PStore	(    prop : property;
			     index: integer;
			     val  : word);			EXTERN;
    FUNCTION  PRecall	(    prop : property;
			     index: integer)      : word;	EXTERN;
    PROCEDURE PZero	(    prop : property);			EXTERN;
    FUNCTION  PSize	(    prop : property)     : integer;	EXTERN.