home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************
- File: DEFINE.CPP Copyright 1989 by John M. Dlugosz
- deal with definitions once they are parsed
- *****************************************************/
-
- #include "usual.hpp"
- #include <stream.hpp>
- #include "atom.hpp"
- #include "node.hpp"
- #include "define.hpp"
-
- bool local_level= FALSE;
-
- def_node_list global_stuff;
- struct p_list_struct {
- def_node_list* l;
- p_list_struct* next;
- };
- static p_list_struct *p_list;
- def_node_list* completed_def_list;
-
- /* /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ */
-
- void store_thing (type_node* t, atom name, int storage_class, int param)
- {
- /* 'param' is passed through from the grammar. If 1, this is a declaration
- for a local or global object. If 2, this is part of a parameter list */
- def_node* n= new def_node (name, storage_class, t);
-
- // file it away somewhere
- switch (param) {
- case 1:
- if (name == -1) {
- // >> I need to get a standard error reporter
- cout << "abstract declarator ignored\n";
- }
- global_stuff.add (n);
- break;
- case 2:
- // >> check it over
- p_list->l->add(n);
- break;
- }
- }
-
- /* /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ */
-
- void parameter_list (int x)
- {
- p_list_struct* p;
- if (x) {
- p= new p_list_struct;
- p->next= p_list;
- p->l= new def_node_list;
- p_list= p;
- }
- else {
- p= p_list;
- p_list= p_list->next;
- completed_def_list= p->l;
- delete p;
- }
- }
-
- /* /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ */
- /* /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ */
- /* /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ */
- /* /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ */
- /* /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ */
-