/usr/include/falcon/symtab.h is in falconpl-dev 0.9.6.9-git20120606-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | /*
FALCON - The Falcon Programming Language.
FILE: flc_symtab.h
Symbol table definition
-------------------------------------------------------------------
Author: Giancarlo Niccolai
Begin: mar ago 3 2004
-------------------------------------------------------------------
(C) Copyright 2004: the FALCON developers (see list in AUTHORS file)
See LICENSE file for licensing details.
*/
#ifndef FLC_SYMBOLTABLE_H
#define FLC_SYMBOLTABLE_H
#include <falcon/setup.h>
#include <falcon/common.h>
#include <falcon/string.h>
#include <falcon/genericvector.h>
#include <falcon/genericmap.h>
#include <falcon/basealloc.h>
namespace Falcon {
class Symbol;
class Stream;
class Module;
class FALCON_DYN_CLASS SymbolTable: public BaseAlloc
{
/** Internal symbol map.
(const String *, Symbol * )
*/
Map m_map;
public:
/** Constructs the symbol table.
The symbol table is built with owndership of the symbols.
*/
SymbolTable();
/** Adds a symbol.
The name of the symbol is used as the key in the symbol table.
\param sym the symbol to be added.
\return true if the symbol can be added, false if it were already present.
*/
bool add( Symbol *sym );
/** Seek a symbol given its name.
If the symbol with the given name can't be found in the symbol
table, the function returns null.
\note it is possible also to call this function with static C strings from
code.
\param name the name of the symbol to be found.
\return a pointer to the symbol if it's found, or 0 otherwise.
*/
Symbol *findByName( const String &name ) const
{
Symbol **ptrsym = (Symbol **) m_map.find( &name );
if ( ptrsym == 0 )
return 0;
return *ptrsym;
}
/** Exports all the undefined symbols.
Used by the compiler if the module being compiled asked for complete export.
*/
void exportUndefined();
/** Remove a symbol given it's name.
If the SymbolTable has the ownership of the symbols, then the symbol is
destroyed. The symbol name is never destroyed though.
\param name the name of the symbol to be destroyed.
\return true if the name can be found, false otherwise.
*/
bool remove( const String &name );
/** Return the number of symbols stored in this table.
\return the number of symbols stored in this table.
*/
int size() const {
return m_map.size();
}
/** Save the symbol table on a stream.
The serialization of the table involves only saving the ID of the strings
and of the symbols that are in the table.
\param out the stream where the table must be saved.
\return true if the operation has success, false otherwise.
*/
bool save( Stream *out ) const;
/** Load the symbol table from a stream.
If the symbol table owns the symbols, then the symbols are serialized on the
stream too; otherwise, only the ID are saved.
The deserialization may return false if the function detects some problem,
i.e. an invald format.
\param owner the module for which the symbols are created.
\param in the input stream where the table must be loaded from.
\return true if the operation has success, false otherwise.
*/
bool load( const Module *owner, Stream *in );
const Map &map() const { return m_map; }
};
class FALCON_DYN_CLASS SymbolVector: public GenericVector
{
public:
SymbolVector();
~SymbolVector();
Symbol *symbolAt( uint32 pos ) const { return *(Symbol **) at( pos ); }
bool save( Stream *out ) const;
bool load( Module *owner, Stream *in );
};
}
#endif
/* end of flc_symtab.h */
|