/* SccsId = "@(#)sys_incl.h 4.3 (TU-Delft) 07/27/92" */
/**********************************************************

Name/Version      : sls_mkdb/4.3

Language          : C
Operating system  : UNIX SYSTEM V
Host machine      : HP9000

Author(s)         : A.C. de Graaf
Creation date     : 10-Jul-1986
Modified by       : S. de Graaf
Modification date : 10-Jul-1986


        Delft University of Technology
        Department of Electrical Engineering
        Network Theory Section
        Mekelweg 4 - P.O.Box 5031
        2600 GA DELFT
        The Netherlands

        Phone : 015 - 786234

        COPYRIGHT (C) 1986 , All rights reserved
**********************************************************/
#ifndef NOSYSINCL
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#ifdef SYSV
#include <fcntl.h>
#else
#include <sys/file.h>
#endif
#include "dmincl.h"
#ifndef NCF_RELEASE
#define NCF_RELEASE 300
#endif
#endif

#line 1 "bifunc.cls"
/* <<cpre-2/8/82>> */ static char * SccsId = "@(#)bifunc.cls 4.2 (TU-Delft) 06/11/91" ; 
#line 1 "./sys_incl.h"

#line 41 "./sys_incl.h"

#line 28 "bifunc.cls"

#line 1 "./class.h"

#line 1 "./odb.h"

#line 31 "./class.h"
typedef struct datum 
{ 
char * dptr ; 
int dsize ; 
} datum ; 

typedef struct db_files { 
char * dbname ; 
int DbRdOnly ; 
int DirF , dir_b , dir_t ; 
int PagF , pag_b , pag_t ; 

long bitno ; 
long maxbno ; 
long blkno ; 
long hmask ; 

char pagbuf [ 1024 ] ; 
char dirbuf [ 1024 ] ; 
} DbAcces ; 

DbAcces * dbOpen ( ) ; 
datum dbfetch ( ) ; 
datum makdatum ( ) ; 
datum firstkey ( ) ; 
datum nextkey ( ) ; 
datum firsthash ( ) ; 
long calchash ( ) ; 
long hashinc ( ) ; 
#line 28 "./class.h"

#line 1 "./stack.h"

#line 27 "./stack.h"
struct stack { char * * min ;
char * * top ;
char * * max ;
} ;
extern int _1stack_new ( /* short */ ) ;
extern int _2stack_delete ( ) ;
extern int _13stack_empty ( /* ? */ ) ;
extern int _14stack_push ( /* char * */ ) ;
extern char * _15stack_pop ( ) ;
extern char * _16stack_access ( /* int */ ) ;
extern int _17stack_print ( ) ;
extern int _18stack_reset ( ) ;
extern struct stack * _19stack_copy ( ) ;
extern char * * _20stack_base ( ) ;
extern char * * _21stack_limit ( ) ;
extern int _22stack_length ( ) ;

#line 44 "./stack.h"
; 
#line 29 "./class.h"

#line 1 "./queue.h"

#line 27 "./queue.h"
struct link { struct link * next ;
char type ;
} ;

#line 31 "./queue.h"
;

#line 33 "./queue.h"
struct queue { struct link _Bqueue ;
struct link * tail ;
short n ;
} ;
extern int _1queue_new ( /* char */ ) ;
extern int _2queue_delete ( ) ;
extern int _12queue_reset ( ) ;
extern struct link * _13queue_get ( ) ;
extern int _14queue_put ( /* struct link * */ ) ;
extern short _15queue_length ( ) ;
extern int _16queue_print ( ) ;
extern int _17queue_empty ( ) ;
extern struct link * _18queue_access ( /* int */ ) ;
extern struct link * _19queue_first_elem ( ) ;
extern struct link * _20queue_next_elem ( /* struct link * */ ) ;
extern struct link * _21queue_last_elem ( ) ;
extern int _22queue_append ( /* struct queue * */ ) ;

#line 51 "./queue.h"
; 
#line 30 "./class.h"

#line 1 "./dict.h"

#line 27 "./dict.h"
struct dictionary { struct db_files * db ;
struct datum key ;
struct datum data ;
} ;
extern int _1dictionary_new ( ) ;
extern int _2dictionary_delete ( ) ;
extern int _13dictionary_store ( /* char * , char * */ ) ;
extern char * _14dictionary_fetch ( /* char * */ ) ;
extern int _15dictionary_print ( /* ? */ ) ;

#line 37 "./dict.h"
; 
#line 31 "./class.h"

typedef struct dictionary Dictionary ; 
typedef struct stack Stack ; 
typedef struct queue Queue ; 
typedef struct link Link ; 
#line 1 "./ntwdefs.h"

#line 27 "./ntwdefs.h"
struct ntwdef { int inst_gen_cnt ;
int net_gen_cnt ;
char * ntw_name ;
int local ;
struct queue * termq ;
struct queue * orig_termq ;
struct queue * mcq ;
struct queue * netq ;
} ;
extern int _1ntwdef_new ( /* char * */ ) ;
extern int _2ntwdef_delete ( ) ;
extern char * _12ntwdef_genname ( /* char */ ) ;

#line 40 "./ntwdefs.h"
;

#line 42 "./ntwdefs.h"
struct instancestruct { char * inst_name ;
struct stack * inst_construct ;
int termCnt ;
struct netMember * nmem ;
} ;
extern int _1instancestruct_new ( /* char * , struct stack * */ ) ;
extern int _2instancestruct_delete ( ) ;

#line 50 "./ntwdefs.h"
;

#line 52 "./ntwdefs.h"
struct ntwinst { struct link _Bntwinst ;
struct ntwdef * ntw ;
struct stack * ntw_attr ;
struct instancestruct * inst_struct ;
} ;
extern int _1ntwinst_new ( /* struct ntwdef * , struct stack * */ ) ;
extern int _2ntwinst_delete ( ) ;
extern int _13ntwinst_to_db ( ) ;

#line 60 "./ntwdefs.h"
; 


typedef struct ntwdef Network ; 
typedef struct ntwinst NetworkInstance ; 
typedef struct instancestruct InstanceStruct ; 
#line 38 "./class.h"

#line 1 "./xelem.h"

#line 27 "./xelem.h"
struct xelem { short left_bound ;
short right_bound ;
} ;
extern int _1xelem_new ( /* short , short */ ) ;
extern int _2xelem_delete ( ) ;
extern int _12xelem_print ( /* ? */ ) ;

#line 34 "./xelem.h"
; 
#line 39 "./class.h"

#line 1 "./netelem.h"

#line 31 "./netelem.h"
struct simpleNet { struct netMember * nmem ;
struct simpleNet * next ;
struct simpleNet * prev ;
} ;

#line 36 "./netelem.h"
;

#line 49 "./ntwdefs.h"
struct netMember { struct ntwinst * inst ;
struct netelem * net ;
struct netMember * next ;
struct simpleNet * snet ;
} ;

#line 44 "./netelem.h"
;

#line 41 "./netelem.h"
struct netelem { struct link _Bnetelem ;
char * name ;
int type ;
struct stack * xs ;
struct queue * eqv ;
struct netMember * nmem ;
} ;
extern int _1netelem_new ( /* char * , struct stack * , char */ ) ;
extern int _2netelem_delete ( ) ;
extern int _15netelem_print ( /* ? */ ) ;
extern int _16netelem_to_db ( /* ? */ ) ;

#line 57 "./netelem.h"
;

#line 59 "./netelem.h"
struct net_ref { struct link _Bnet_ref ;
struct netelem * net ;
struct stack * net_xs ;
struct ntwinst * inst ;
struct stack * inst_xs ;
struct stack * ref_xs ;
} ;
extern int _1net_ref_new ( /* struct netelem * , struct stack * */ ) ;
extern int _2net_ref_delete ( ) ;

#line 68 "./netelem.h"
; 

typedef struct netMember Nmem ; 
#line 40 "./class.h"

typedef struct xelem Xelem ; 
typedef struct netelem Netelem ; 
typedef struct net_ref NetReference ; 
#line 30 "bifunc.cls"

#line 1 "./mkdbdefs.h"

#line 1 "./slserr.h"

#line 30 "./mkdbdefs.h"

#line 31 "bifunc.cls"

#line 32 "bifunc.cls"
struct built_in_func { char * name ;
struct ntwdef * ntw ;
} ;

#line 36 "bifunc.cls"
; 

typedef struct built_in_func Bifunc ; 

Bifunc * bifunc ; 

int bif_nbr ; 

int init_bifs ( ) { int * _that ; 
Stack * pxs ; 
Queue * bif_termq ; 
Network * ntw ; 
Netelem * fterm ; 
Xelem * pxelem ; 

 bif_termq = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct queue ) ) , _1queue_new ( ( struct queue * ) _that , ( char ) ( 0x01 ) ) , ( struct queue * ) _that ) ; 
 pxs = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct stack ) ) , _1stack_new ( ( struct stack * ) _that , ( short ) ( 1 ) ) , ( struct stack * ) _that ) ; 
 pxelem = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct xelem ) ) , _1xelem_new ( ( struct xelem * ) _that , ( short ) 0 , ( short ) 0 ) , ( struct xelem * ) _that ) ; 
 _14stack_push ( ( struct stack * ) pxs , ( char * ) ( ( char * ) pxelem ) ) ; 
 fterm = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct netelem ) ) , _1netelem_new ( ( struct netelem * ) _that , ( char * ) ( "i" ) , ( struct stack * ) 0 , ( char ) ( 0x04 ) ) , ( struct netelem * ) _that ) ; 
 fterm -> xs = ( struct stack * ) ( pxs ) ; 
 _14queue_put ( ( struct queue * ) bif_termq , ( struct link * ) ( ( struct link * ) fterm ) ) ; 
 fterm = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct netelem ) ) , _1netelem_new ( ( struct netelem * ) _that , ( char * ) ( "o" ) , ( struct stack * ) 0 , ( char ) ( 0x04 ) ) , ( struct netelem * ) _that ) ; 
 _14queue_put ( ( struct queue * ) bif_termq , ( struct link * ) ( ( struct link * ) fterm ) ) ; 

 bifunc = ( struct built_in_func * ) calloc ( ( unsigned ) ( 6 ) , sizeof ( struct built_in_func ) ) ; 
bif_nbr = 6 ; 

 bifunc [ 0 ] . name = "and" ; 
 bifunc [ 1 ] . name = "exor" ; 
 bifunc [ 2 ] . name = "nand" ; 
 bifunc [ 3 ] . name = "nor" ; 
 bifunc [ 4 ] . name = "or" ; 
 bifunc [ 5 ] . name = "invert" ; 

 bifunc [ 0 ] . ntw = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct ntwdef ) ) , _1ntwdef_new ( ( struct ntwdef * ) _that , ( char * ) ( "and" ) ) , ( struct ntwdef * ) _that ) ; 
 bifunc [ 1 ] . ntw = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct ntwdef ) ) , _1ntwdef_new ( ( struct ntwdef * ) _that , ( char * ) ( "exor" ) ) , ( struct ntwdef * ) _that ) ; 
 bifunc [ 2 ] . ntw = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct ntwdef ) ) , _1ntwdef_new ( ( struct ntwdef * ) _that , ( char * ) ( "nand" ) ) , ( struct ntwdef * ) _that ) ; 
 bifunc [ 3 ] . ntw = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct ntwdef ) ) , _1ntwdef_new ( ( struct ntwdef * ) _that , ( char * ) ( "nor" ) ) , ( struct ntwdef * ) _that ) ; 
 bifunc [ 4 ] . ntw = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct ntwdef ) ) , _1ntwdef_new ( ( struct ntwdef * ) _that , ( char * ) ( "or" ) ) , ( struct ntwdef * ) _that ) ; 
 bifunc [ 5 ] . ntw = ( _that = ( int * ) calloc ( ( unsigned ) 1 , sizeof ( struct ntwdef ) ) , _1ntwdef_new ( ( struct ntwdef * ) _that , ( char * ) ( "invert" ) ) , ( struct ntwdef * ) _that ) ; 

 bifunc [ 0 ] . ntw -> termq = ( struct queue * ) ( bif_termq ) ; 
 bifunc [ 1 ] . ntw -> termq = ( struct queue * ) ( bif_termq ) ; 
 bifunc [ 2 ] . ntw -> termq = ( struct queue * ) ( bif_termq ) ; 
 bifunc [ 3 ] . ntw -> termq = ( struct queue * ) ( bif_termq ) ; 
 bifunc [ 4 ] . ntw -> termq = ( struct queue * ) ( bif_termq ) ; 
 bifunc [ 5 ] . ntw -> termq = ( struct queue * ) ( bif_termq ) ; } /* init_bifs */ 


Network * is_bifunc ( name ) char * name ; 

{ int * _that ; struct ntwdef * _result ; 
int i ; 
int strcmp ( ) ; 
Bifunc * pbif = bifunc ; 

for ( i = 0 ; i < bif_nbr ; i ++ ) 
{ 
if ( strcmp ( name , pbif -> name ) == 0 ) { _result = 
 ( pbif -> ntw ) ; goto _return ; } 
 pbif ++ ; } { _result = 


 ( 0 ) ; goto _return ; } _return : return _result ; } /* is_bifunc */ 
