44/* $Id: alg.h,v 1.4 1997/01/21 19:17:11 dar Exp $ */
55
66/************************************************************************
7- ** Module: Algorithm
8- ** Description: This module implements the Algorithm abstraction. An
9- ** algorithm can be a procedure, a function, or a rule. It consists
10- ** of a name, a return type (for functions and rules), a list of
11- ** formal parameters, and a list of statements (body).
7+ ** Module: Algorithm
8+ ** Description: This module implements the Algorithm abstraction. An
9+ ** algorithm can be a procedure, a function, or a rule. It consists
10+ ** of a name, a return type (for functions and rules), a list of
11+ ** formal parameters, and a list of statements (body).
1212** Constants:
13- ** ALGORITHM_NULL - the null algorithm
13+ ** ALGORITHM_NULL - the null algorithm
1414**
1515************************************************************************/
1616
4343/* packages used */
4444/*****************/
4545
46- #include "expbasic.h" /* get basic definitions */
46+ #include "expbasic.h" /* get basic definitions */
4747#include "symbol.h"
4848#include "scope.h"
4949#include "type.h"
5252/* typedefs */
5353/************/
5454
55- typedef struct Scope_ * Procedure ;
56- typedef struct Scope_ * Function ;
57- typedef struct Scope_ * Rule ;
58- typedef struct Where_ * Where ;
55+ typedef struct Scope_ * Procedure ;
56+ typedef struct Scope_ * Function ;
57+ typedef struct Scope_ * Rule ;
58+ typedef struct Where_ * Where ;
5959
6060/***************************/
6161/* hidden type definitions */
@@ -64,46 +64,46 @@ typedef struct Where_ *Where;
6464/* each formal tag has one of these structs allocated to it */
6565/* As each (real) call is resolved, the tag->type is temporarily borrowed */
6666struct tag {
67- char * name ;
68- Type type ;
67+ char * name ;
68+ Type type ;
6969};
7070
7171/* location of fulltext of algorithm in source file */
7272struct FullText {
73- char * filename ;
73+ char * filename ;
7474 short start , end ;
7575};
7676
7777/* 'parameters' are lists of lists of (type) expressions */
7878struct Procedure_ {
79- int pcount ; /* # of parameters */
80- int tag_count ; /* # of different parameter tags */
81- Linked_List parameters ;
82- Linked_List body ;
83- struct FullText text ;
84- int builtin ; /* builtin if true */
79+ int pcount ; /* # of parameters */
80+ int tag_count ; /* # of different parameter tags */
81+ Linked_List parameters ;
82+ Linked_List body ;
83+ struct FullText text ;
84+ int builtin ; /* builtin if true */
8585};
8686
8787struct Function_ {
88- int pcount ; /* # of parameters */
89- int tag_count ; /* # of different parameter/return value tags */
90- Linked_List parameters ;
91- Linked_List body ;
92- Type return_type ;
93- struct FullText text ;
94- int builtin ; /* builtin if true */
88+ int pcount ; /* # of parameters */
89+ int tag_count ; /* # of different parameter/return value tags */
90+ Linked_List parameters ;
91+ Linked_List body ;
92+ Type return_type ;
93+ struct FullText text ;
94+ int builtin ; /* builtin if true */
9595};
9696
9797struct Rule_ {
98- Linked_List parameters ;
99- Linked_List body ;
100- struct FullText text ;
98+ Linked_List parameters ;
99+ Linked_List body ;
100+ struct FullText text ;
101101};
102102
103103/* define a where clause */
104104struct Where_ {
105- Symbol * label ;
106- Expression expr ;
105+ Symbol * label ;
106+ Expression expr ;
107107};
108108
109109/********************/
@@ -120,53 +120,53 @@ extern struct freelist_head WHERE_fl;
120120/* macro function definitions */
121121/******************************/
122122
123- #define ALG_new () (struct Algorithm *)MEM_new(&ALG_fl);
124- #define ALG_destroy (x ) MEM_destroy(&ALG_fl,(Freelist *)(Generic)x)
125- #define FUNC_new () (struct Function_ *)MEM_new(&FUNC_fl)
126- #define FUNC_destroy (x ) MEM_destroy(&FUNC_fl,(Freelist *)(Generic)x)
127- #define RULE_new () (struct Rule_ *)MEM_new(&RULE_fl)
128- #define RULE_destroy (x ) MEM_destroy(&RULE_fl,(Freelist *)(Generic)x)
129- #define PROC_new () (struct Procedure_ *)MEM_new(&PROC_fl)
130- #define PROC_destroy (x ) MEM_destroy(&PROC_fl,(Freelist *)(Generic)x)
131- #define WHERE_new () (struct Where_ *)MEM_new(&WHERE_fl)
123+ #define ALG_new () (struct Algorithm *)MEM_new(&ALG_fl);
124+ #define ALG_destroy (x ) MEM_destroy(&ALG_fl,(Freelist *)(Generic)x)
125+ #define FUNC_new () (struct Function_ *)MEM_new(&FUNC_fl)
126+ #define FUNC_destroy (x ) MEM_destroy(&FUNC_fl,(Freelist *)(Generic)x)
127+ #define RULE_new () (struct Rule_ *)MEM_new(&RULE_fl)
128+ #define RULE_destroy (x ) MEM_destroy(&RULE_fl,(Freelist *)(Generic)x)
129+ #define PROC_new () (struct Procedure_ *)MEM_new(&PROC_fl)
130+ #define PROC_destroy (x ) MEM_destroy(&PROC_fl,(Freelist *)(Generic)x)
131+ #define WHERE_new () (struct Where_ *)MEM_new(&WHERE_fl)
132132#define WHERE_destroy (x ) MEM_destroy(&WHERE_fl,(Freelist *)(Generic)x)
133133
134- #define ALGput_name (algorithm , name ) SCOPEput_name(algorithm,name)
135- #define ALGget_name (algorithm ) SCOPEget_name(algorithm)
136- #define ALGget_symbol (a ) SCOPEget_symbol(a)
137- #define FUNCget_name (f ) SCOPEget_name(f)
138- #define PROCget_name (p ) SCOPEget_name(p)
139- #define RULEget_name (r ) SCOPEget_name(r)
140- #define FUNCput_name (f ) SCOPEput_name(f,n)
141- #define PROCput_name (p ) SCOPEput_name(p,n)
142- #define RULEput_name (r ) SCOPEput_name(r,n)
143- #define FUNCget_symbol (f ) SCOPEget_symbol(f)
144- #define PROCget_symbol (r ) SCOPEget_symbol(p)
145- #define RULEget_symbol (r ) SCOPEget_symbol(r)
146- #define FUNCget_parameters (f ) ((f)->u.func->parameters)
147- #define PROCget_parameters (p ) ((p)->u.proc->parameters)
148- #define RULEget_parameters (r ) ((r)->u.rule->parameters)
149- #define FUNCget_body (f ) ((f)->u.func->body)
150- #define PROCget_body (p ) ((p)->u.proc->body)
151- #define RULEget_body (r ) ((r)->u.rule->body)
152- #define FUNCput_body (f ,b ) ((f)->u.func->body = b)
153- #define PROCput_body (p ,b ) ((p)->u.proc->body = b)
154- #define RULEput_body (r ,b ) ((r)->u.rule->body = b)
155- #define FUNCget_return_type (f ) ((f)->u.func->return_type)
156- #define RULEget_where (r ) ((r)->where)
157- #define RULEput_where (r ,w ) ((r)->where = (w))
134+ #define ALGput_name (algorithm , name ) SCOPEput_name(algorithm,name)
135+ #define ALGget_name (algorithm ) SCOPEget_name(algorithm)
136+ #define ALGget_symbol (a ) SCOPEget_symbol(a)
137+ #define FUNCget_name (f ) SCOPEget_name(f)
138+ #define PROCget_name (p ) SCOPEget_name(p)
139+ #define RULEget_name (r ) SCOPEget_name(r)
140+ #define FUNCput_name (f ) SCOPEput_name(f,n)
141+ #define PROCput_name (p ) SCOPEput_name(p,n)
142+ #define RULEput_name (r ) SCOPEput_name(r,n)
143+ #define FUNCget_symbol (f ) SCOPEget_symbol(f)
144+ #define PROCget_symbol (r ) SCOPEget_symbol(p)
145+ #define RULEget_symbol (r ) SCOPEget_symbol(r)
146+ #define FUNCget_parameters (f ) ((f)->u.func->parameters)
147+ #define PROCget_parameters (p ) ((p)->u.proc->parameters)
148+ #define RULEget_parameters (r ) ((r)->u.rule->parameters)
149+ #define FUNCget_body (f ) ((f)->u.func->body)
150+ #define PROCget_body (p ) ((p)->u.proc->body)
151+ #define RULEget_body (r ) ((r)->u.rule->body)
152+ #define FUNCput_body (f ,b ) ((f)->u.func->body = b)
153+ #define PROCput_body (p ,b ) ((p)->u.proc->body = b)
154+ #define RULEput_body (r ,b ) ((r)->u.rule->body = b)
155+ #define FUNCget_return_type (f ) ((f)->u.func->return_type)
156+ #define RULEget_where (r ) ((r)->where)
157+ #define RULEput_where (r ,w ) ((r)->where = (w))
158158/*
159- #define RULEget_where_clause(r) ((r)->u.rule->where)
159+ #define RULEget_where_clause(r) ((r)->u.rule->where)
160160*/
161- #define WHEREget_label (w ) ((w)->label)
162- #define WHEREget_expression (w ) ((w)->expr)
161+ #define WHEREget_label (w ) ((w)->label)
162+ #define WHEREget_expression (w ) ((w)->expr)
163163
164164/***********************/
165165/* function prototypes */
166166/***********************/
167167
168- extern Scope ALGcreate PROTO (( char ) );
169- extern void ALGinitialize PROTO (( void ) );
170- extern void ALGput_full_text PROTO (( Scope , int , int ) );
168+ extern Scope ALGcreate PROTO ( ( char ) );
169+ extern void ALGinitialize PROTO ( ( void ) );
170+ extern void ALGput_full_text PROTO ( ( Scope , int , int ) );
171171
172172#endif /* ALGORITHM_H */
0 commit comments