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
4747/* packages used */
4848/*****************/
4949
50- #include "expbasic.h" /* get basic definitions */
50+ #include "expbasic.h" /* get basic definitions */
5151#include "symbol.h"
5252#include "scope.h"
5353#include "type.h"
5656/* typedefs */
5757/************/
5858
59- typedef struct Scope_ * Procedure ;
60- typedef struct Scope_ * Function ;
61- typedef struct Scope_ * Rule ;
62- typedef struct Where_ * Where ;
59+ typedef struct Scope_ * Procedure ;
60+ typedef struct Scope_ * Function ;
61+ typedef struct Scope_ * Rule ;
62+ typedef struct Where_ * Where ;
6363
6464/****************/
6565/* modules used */
@@ -72,50 +72,50 @@ typedef struct Where_ *Where;
7272/* each formal tag has one of these structs allocated to it */
7373/* As each (real) call is resolved, the tag->type is temporarily borrowed */
7474struct tag {
75- char * name ;
76- Type type ;
75+ char * name ;
76+ Type type ;
7777};
7878
7979/* location of fulltext of algorithm in source file */
8080struct FullText {
81- char * filename ;
81+ char * filename ;
8282 unsigned int start , end ;
8383};
8484
8585/* 'parameters' are lists of lists of (type) expressions */
8686struct Procedure_ {
87- int pcount ; /* # of parameters */
88- int tag_count ; /* # of different parameter tags */
89- Linked_List parameters ;
90- Linked_List body ;
91- struct FullText text ;
92- int builtin ; /* builtin if true */
87+ int pcount ; /* # of parameters */
88+ int tag_count ; /* # of different parameter tags */
89+ Linked_List parameters ;
90+ Linked_List body ;
91+ struct FullText text ;
92+ int builtin ; /* builtin if true */
9393};
9494
9595struct Function_ {
96- int pcount ; /* # of parameters */
97- int tag_count ; /* # of different parameter/return value tags */
98- Linked_List parameters ;
99- Linked_List body ;
100- Type return_type ;
101- struct FullText text ;
102- int builtin ; /* builtin if true */
96+ int pcount ; /* # of parameters */
97+ int tag_count ; /* # of different parameter/return value tags */
98+ Linked_List parameters ;
99+ Linked_List body ;
100+ Type return_type ;
101+ struct FullText text ;
102+ int builtin ; /* builtin if true */
103103};
104104
105105struct Rule_ {
106- Linked_List parameters ;
107- Linked_List body ;
108- struct FullText text ;
109- /*
110- Linked_List where;
111- moved to Scope - DEL 22-Jul-1993
112- */
106+ Linked_List parameters ;
107+ Linked_List body ;
108+ struct FullText text ;
109+ /*
110+ Linked_List where;
111+ moved to Scope - DEL 22-Jul-1993
112+ */
113113};
114114
115115/* define a where clause */
116116struct Where_ {
117- Symbol * label ;
118- Expression expr ;
117+ Symbol * label ;
118+ Expression expr ;
119119};
120120
121121/********************/
@@ -140,61 +140,61 @@ GLOBAL struct freelist_head WHERE_fl;
140140/* macro function definitions */
141141/******************************/
142142
143- #define ALG_new () (struct Algorithm *)MEM_new(&ALG_fl);
144- #define ALG_destroy (x ) MEM_destroy(&ALG_fl,(Freelist *)(Generic)x)
145- #define FUNC_new () (struct Function_ *)MEM_new(&FUNC_fl)
146- #define FUNC_destroy (x ) MEM_destroy(&FUNC_fl,(Freelist *)(Generic)x)
147- #define RULE_new () (struct Rule_ *)MEM_new(&RULE_fl)
148- #define RULE_destroy (x ) MEM_destroy(&RULE_fl,(Freelist *)(Generic)x)
149- #define PROC_new () (struct Procedure_ *)MEM_new(&PROC_fl)
150- #define PROC_destroy (x ) MEM_destroy(&PROC_fl,(Freelist *)(Generic)x)
151- #define WHERE_new () (struct Where_ *)MEM_new(&WHERE_fl)
143+ #define ALG_new () (struct Algorithm *)MEM_new(&ALG_fl);
144+ #define ALG_destroy (x ) MEM_destroy(&ALG_fl,(Freelist *)(Generic)x)
145+ #define FUNC_new () (struct Function_ *)MEM_new(&FUNC_fl)
146+ #define FUNC_destroy (x ) MEM_destroy(&FUNC_fl,(Freelist *)(Generic)x)
147+ #define RULE_new () (struct Rule_ *)MEM_new(&RULE_fl)
148+ #define RULE_destroy (x ) MEM_destroy(&RULE_fl,(Freelist *)(Generic)x)
149+ #define PROC_new () (struct Procedure_ *)MEM_new(&PROC_fl)
150+ #define PROC_destroy (x ) MEM_destroy(&PROC_fl,(Freelist *)(Generic)x)
151+ #define WHERE_new () (struct Where_ *)MEM_new(&WHERE_fl)
152152#define WHERE_destroy (x ) MEM_destroy(&WHERE_fl,(Freelist *)(Generic)x)
153153
154- #define ALGput_name (algorithm , name ) SCOPEput_name(algorithm,name)
155- #define ALGget_name (algorithm ) SCOPEget_name(algorithm)
156- #define ALGget_symbol (a ) SCOPEget_symbol(a)
157- #define FUNCget_name (f ) SCOPEget_name(f)
158- #define PROCget_name (p ) SCOPEget_name(p)
159- #define RULEget_name (r ) SCOPEget_name(r)
160- #define FUNCput_name (f ) SCOPEput_name(f,n)
161- #define PROCput_name (p ) SCOPEput_name(p,n)
162- #define RULEput_name (r ) SCOPEput_name(r,n)
163- #define FUNCget_symbol (f ) SCOPEget_symbol(f)
164- #define PROCget_symbol (r ) SCOPEget_symbol(p)
165- #define RULEget_symbol (r ) SCOPEget_symbol(r)
166- #define FUNCget_parameters (f ) ((f)->u.func->parameters)
167- #define PROCget_parameters (p ) ((p)->u.proc->parameters)
168- #define RULEget_parameters (r ) ((r)->u.rule->parameters)
169- #define FUNCget_body (f ) ((f)->u.func->body)
170- #define PROCget_body (p ) ((p)->u.proc->body)
171- #define RULEget_body (r ) ((r)->u.rule->body)
172- #define FUNCput_body (f ,b ) ((f)->u.func->body = b)
173- #define PROCput_body (p ,b ) ((p)->u.proc->body = b)
174- #define RULEput_body (r ,b ) ((r)->u.rule->body = b)
175- #define FUNCget_return_type (f ) ((f)->u.func->return_type)
176- #define RULEget_where (r ) ((r)->where)
177- #define RULEput_where (r ,w ) ((r)->where = (w))
154+ #define ALGput_name (algorithm , name ) SCOPEput_name(algorithm,name)
155+ #define ALGget_name (algorithm ) SCOPEget_name(algorithm)
156+ #define ALGget_symbol (a ) SCOPEget_symbol(a)
157+ #define FUNCget_name (f ) SCOPEget_name(f)
158+ #define PROCget_name (p ) SCOPEget_name(p)
159+ #define RULEget_name (r ) SCOPEget_name(r)
160+ #define FUNCput_name (f ) SCOPEput_name(f,n)
161+ #define PROCput_name (p ) SCOPEput_name(p,n)
162+ #define RULEput_name (r ) SCOPEput_name(r,n)
163+ #define FUNCget_symbol (f ) SCOPEget_symbol(f)
164+ #define PROCget_symbol (r ) SCOPEget_symbol(p)
165+ #define RULEget_symbol (r ) SCOPEget_symbol(r)
166+ #define FUNCget_parameters (f ) ((f)->u.func->parameters)
167+ #define PROCget_parameters (p ) ((p)->u.proc->parameters)
168+ #define RULEget_parameters (r ) ((r)->u.rule->parameters)
169+ #define FUNCget_body (f ) ((f)->u.func->body)
170+ #define PROCget_body (p ) ((p)->u.proc->body)
171+ #define RULEget_body (r ) ((r)->u.rule->body)
172+ #define FUNCput_body (f ,b ) ((f)->u.func->body = b)
173+ #define PROCput_body (p ,b ) ((p)->u.proc->body = b)
174+ #define RULEput_body (r ,b ) ((r)->u.rule->body = b)
175+ #define FUNCget_return_type (f ) ((f)->u.func->return_type)
176+ #define RULEget_where (r ) ((r)->where)
177+ #define RULEput_where (r ,w ) ((r)->where = (w))
178178/*
179- #define RULEget_where_clause(r) ((r)->u.rule->where)
179+ #define RULEget_where_clause(r) ((r)->u.rule->where)
180180*/
181- #define WHEREget_label (w ) ((w)->label)
182- #define WHEREget_expression (w ) ((w)->expr)
181+ #define WHEREget_label (w ) ((w)->label)
182+ #define WHEREget_expression (w ) ((w)->expr)
183183
184184#if 0
185- extern void ALGput_parameters PROTO (( Algorithm , Linked_List ));
186- extern void ALGput_body PROTO (( Algorithm , Linked_List ));
187- extern void FUNCput_return_type PROTO (( Algorithm , Type ) );
188- extern void RULEput_where_clause PROTO (( Algorithm ,Linked_List ) );
185+ extern void ALGput_parameters PROTO ( ( Algorithm , Linked_List ) );
186+ extern void ALGput_body PROTO ( ( Algorithm , Linked_List ) );
187+ extern void FUNCput_return_type PROTO ( ( Algorithm , Type ) );
188+ extern void RULEput_where_clause PROTO ( ( Algorithm , Linked_List ) );
189189#endif
190190
191191/***********************/
192192/* function prototypes */
193193/***********************/
194194
195- extern Scope ALGcreate PROTO (( char ) );
196- extern void ALGinitialize PROTO (( void ) );
197- extern void ALGput_full_text PROTO (( Scope , int , int ) );
195+ extern Scope ALGcreate PROTO ( ( char ) );
196+ extern void ALGinitialize PROTO ( ( void ) );
197+ extern void ALGput_full_text PROTO ( ( Scope , int , int ) );
198198
199199/********************/
200200/* inline functions */
0 commit comments