C:/Users/Dennis/src/lang/russell.orig/src/pass3/decl_pairs.c

Go to the documentation of this file.
00001 # include "parm.h"
00002 
00003 # include "stree/ststructs.mh"
00004 
00005 # include "decl_pairs.h"
00006 
00007 /*
00008  * Routines to manipulate decl_list, the list of declaration pairs
00009  * used in expression comparisons and substitutions of various kinds.
00010  */
00011 
00012 /*
00013  * Return TRUE iff p and q are corresponding declarations
00014  */
00015 boolean
00016 dl_match(p,q)
00017 NODE * p;
00018 NODE * q;
00019 {
00020         struct p_pair * hd;
00021         ConsNode * tl;
00022 
00023         for(tl = decl_list; tl != NIL; tl = cn_tail(tl)) {
00024                 hd = (struct p_pair *) cn_head(tl);
00025                 if (hd -> pp_1 -> pre_num == p -> pre_num
00026                     && hd -> pp_2 -> pre_num == q -> pre_num) {
00027                     return(TRUE);
00028                 }
00029         }
00030         return(FALSE);
00031 }
00032 
00033 /*
00034  * Return the second element of the pair whose first element is the
00035  * declaration for the identifier p.
00036  * Return the declaration for p if no such pair exists.
00037  */
00038 NODE *
00039 dl_new_decl(p)
00040 NODE * p;
00041 {
00042         struct p_pair * hd;
00043         ConsNode * tl;
00044 
00045 #       ifdef DEBUG
00046           if (p -> kind != LETTERID) {
00047             dbgmsg("dl_new_decl: bad arg\n");
00048           }
00049 #       endif
00050         for(tl = decl_list; tl != NIL; tl = cn_tail(tl)) {
00051                 hd = (struct p_pair *) cn_head(tl);
00052                 if (is_declared_by(p, hd -> pp_1)) return(hd -> pp_2);
00053         }
00054         return(p -> id_last_definition);
00055 }

Generated on Fri Jan 25 10:39:46 2008 for russell by  doxygen 1.5.4