Annotation of researchv10no/cmd/cfront/ooptcfront/tree_walk.H, revision 1.1.1.1

1.1       root        1: /* -*- Mode: C -*- Begin include file tree_walk.H */
                      2: /*
                      3:        $Source: /usr3/lang/benson/work/stripped_cfront/RCS/tree_walk.H,v $ $RCSfile: tree_walk.H,v $
                      4:        $Revision: 1.1 $                $Date: 89/11/20 08:51:05 $
                      5:        $Author: benson $               $Locker:  $
                      6:        $State: Exp $
                      7: */
                      8: 
                      9: #ifndef _TREE_WALK
                     10: #define _TREE_WALK
                     11: 
                     12: #include "cfront.h"
                     13: #include "node_classes.H"
                     14: #include <iostream.h>
                     15: #include "ios_printf.H"
                     16: #include <hash.H>
                     17: 
                     18: enum tree_node_action {
                     19:     tna_continue = 0,          /* plain vanilla */
                     20:     tna_stop = 1,              /* don't proceed */
                     21:     tna_error = 2,             /* stop entire walk now. */
                     22: };
                     23: 
                     24: /* procedural interface to indirect via a pointer. */
                     25: typedef int (*tree_fetch_proc) (void * info,
                     26:                                void * pointer,
                     27:                                unsigned long length,
                     28:                                int zero_stop,  /* for character strings.*/
                     29:                                void * target);
                     30: 
                     31: 
                     32: const tree_fetch_proc null_tfp = (tree_fetch_proc) 0;
                     33: 
                     34: class tree_walk_tree {
                     35:   public:
                     36:     tree_walk_tree * parent;
                     37:     char storage[1];           /* variable amt, specified by caller. */
                     38: };
                     39: 
                     40: /* The trailing int here controls whether to remember the
                     41:    node in the hash table to short-circuit meeting it again */
                     42: 
                     43: typedef void (*tree_pre_action)
                     44:     (Pnode&, node_class, void *, tree_node_action&, int, Pnode, 
                     45:      tree_walk_tree&, int&);
                     46: 
                     47: 
                     48: typedef void (*tree_post_action)
                     49:     (Pnode&, node_class, void *, tree_node_action&, int, Pnode, 
                     50:      tree_walk_tree&);
                     51: 
                     52: typedef void (*errorp) (char, const char *);
                     53: 
                     54: class tree_walk_control {
                     55:   public:
                     56:     int version;
                     57:     void * callback_info;
                     58:     tree_fetch_proc fetcher;
                     59:     tree_pre_action action_proc;
                     60:     tree_post_action post_action_proc;
                     61:     int (*i_error) (int, const char *); /* usually part of cfront */
                     62:     int call_i_error;          /* if 0, just use the following */
                     63:     ostream * error_stream;
                     64:     Hash * nodes_seen_hash;    /* allows this to be global over
                     65:                                 more than one call to the walker. */
                     66:     int resolve_by_name;
                     67:     int alloc_stack_bytes;
                     68:     /* if on, n_list and s_list are ignored for the very top node. 
                     69:        this is for the benefit of the printer. */
                     70:     int dont_chase_lists_top;
                     71:     tree_walk_control () {
                     72:        version = 1;
                     73:        callback_info = 0;
                     74:        fetcher = null_tfp;
                     75:        call_i_error = 0;
                     76:        error_stream = &cerr;
                     77:        nodes_seen_hash = 0;
                     78:        resolve_by_name = 1;    /* the dumper turns this off */
                     79:        alloc_stack_bytes = 0;
                     80:        post_action_proc = 0;
                     81:        dont_chase_lists_top = 0;
                     82:     }
                     83: };
                     84: 
                     85: tree_node_action walk_tree (tree_walk_control& c, Pnode& n);
                     86: 
                     87: #endif
                     88: 
                     89: /*
                     90:    $Log:       tree_walk.H,v $
                     91: Revision 1.1  89/11/20  08:51:05  benson
                     92: Initial revision
                     93: 
                     94: Revision 1.11  89/10/20  14:38:11  benson
                     95: control flag to avoid walking list peers of the top node.
                     96: 
                     97: Revision 1.10  89/09/02  22:08:01  benson
                     98: keep things out of the hash table, optionally.
                     99: 
                    100: Revision 1.9  89/08/24  10:01:55  benson
                    101: move table of node classes to its own include file.
                    102: 
                    103: Revision 1.9  89/08/08  13:03:09  benson
                    104: Various fixes
                    105: 
                    106: Revision 1.8  89/08/01  14:53:50  benson
                    107: *** empty log message ***
                    108: 
                    109: Revision 1.3  89/08/01  14:39:21  benson
                    110: *** empty log message ***
                    111: 
                    112: 
                    113: 
                    114:    end_log
                    115: */
                    116: 
                    117: /* End include file tree_walk.H */
                    118: 
                    119:                  

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.