Annotation of researchv10no/cmd/cfront/optcfront/tree_copy.h, revision 1.1

1.1     ! root        1: /* ident "@(#)ctrans:src/tree_copy.h   1.2" */
        !             2: /* -*- Mode: C -*- begin include file tree_copy.H 
        !             3:    argument class for copying trees. */
        !             4: 
        !             5: #include "hash.h"
        !             6: #include "tree_walk.h"
        !             7: 
        !             8: /* The copier procedure expects one of these as its 
        !             9:     info pointer */
        !            10: 
        !            11: class tree_copy_info {
        !            12:   public:
        !            13: /* If non-zero, this procedure is called at each node.
        !            14:    it returns an action. It cannot currently return
        !            15:    a node of a different class and also return an
        !            16:    action other than tna_stop, since the walker won't
        !            17:    notice that the rug has been removed from beneath its feet. 
        !            18:    The procedure must set the last argument to indicate whether
        !            19:    or not to register the node in the hash table and use the
        !            20:    replacement every future time it is encountered.
        !            21: */
        !            22: 
        !            23:     void (* node_hook) (void * info, Pnode&, node_class, tree_node_action&,
        !            24:                        int&);
        !            25: 
        !            26:     /* if this is nonzero it is used to allocate space for
        !            27:        the copies. We don't run constructors since we always
        !            28:        bit copy over the new copy. */
        !            29:     char * (* malloc_hook) (void * info, size_t);
        !            30:     void * hook_info;
        !            31:     tree_copy_info ()
        !            32:        {
        !            33:            hook_info = 0;
        !            34:            node_hook = 0;
        !            35:            malloc_hook = 0;
        !            36:        }; 
        !            37:     char * malloc (size_t s) {
        !            38:        return malloc_hook ? malloc_hook(hook_info, s) : ::malloc (s);
        !            39:     };
        !            40:     void check_node (Pnode& n,
        !            41:                     node_class cl, 
        !            42:                     tree_node_action& action, 
        !            43:                     int& never_see_again) {
        !            44:        if(node_hook)
        !            45:            node_hook(hook_info, n, cl, action, never_see_again);
        !            46:     };
        !            47: };
        !            48: 
        !            49: void copy_tree (Pnode& n, tree_copy_info& tci, Hash * cht = 0);
        !            50: 
        !            51: /* End tree_copy.H */
        !            52: 

unix.superglobalmegacorp.com

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