| home | contents | previous | next page | send comment | send link | add bookmark |

symtab.h

/*
**  symtab.h
**
**  binary tree symbol table class declarations
**
**  By: Stephen R. Schmitt
*/

#ifndef SYMTAB_H
#define SYMTAB_H

#include <fstream.h>
#include <iomanip.h>
#include <string.h>

struct instance
{
    struct instance *next;
    int              line;
};

struct node
{
    struct node     *right;
    struct node     *left;
    char            *name;
    struct node     *files;
    struct instance *lines;
};

class symtab
{
public:
    node *Symbol_root;

    symtab() { Symbol_root = NULL; }

    node *search( char *, node * );
    node *enter( char *, node ** );
    void  add_instance( int, instance ** );
    void  output();

private:
    ofstream outf;

    void  print( node * );
    void  print_file( node * );
    void  print_instances( instance * );
};

#endif

| home | contents | previous | next page | send comment | send link | add bookmark |

Copyright © 2004, Stephen R. Schmitt