Annotation of parser3/src/main/core.C, revision 1.67

1.18      paf         1: /*
1.53      paf         2:        Parser
                      3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.57      paf         4:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.53      paf         5: 
1.67    ! paf         6:        $Id: core.C,v 1.66 2001/03/13 17:54:13 paf Exp $
1.18      paf         7: */
                      8: 
1.50      paf         9: #include "core.h"
1.55      paf        10: #include "_string.h"
                     11: #include "_double.h"
                     12: #include "_int.h"
1.60      paf        13: #include "_table.h"
1.65      paf        14: #include "_form.h"
1.66      paf        15: #include "_env.h"
1.50      paf        16: 
1.67    ! paf        17: String *exception_method_name;
1.58      paf        18: 
1.50      paf        19: String *unnamed_name;
                     20: String *empty_string;
1.52      paf        21: 
1.51      paf        22: String *auto_method_name;
                     23: String *main_method_name;
1.23      paf        24: 
1.65      paf        25: String *root_class_name;
1.56      paf        26: String *main_class_name;
1.52      paf        27: String *env_class_name;
1.60      paf        28: String *table_class_name;
1.65      paf        29: String *form_class_name;
1.52      paf        30: 
1.60      paf        31: Hash *untaint_lang_name2enum;
1.58      paf        32: 
                     33: 
1.66      paf        34: void core(Pool& pool) {
1.67    ! paf        35:        #define NEW_STRING(name, value)  name=new(pool) String(pool); name->APPEND_CONST(value)
        !            36:        #define LOCAL_STRING(name, value)  String name(pool); name.APPEND_CONST(value)
        !            37: 
1.52      paf        38:        // names
1.67    ! paf        39:        NEW_STRING(exception_method_name, EXCEPTION_METHOD_NAME);
        !            40: 
1.65      paf        41:        NEW_STRING(unnamed_name, UNNAMED_NAME);
1.50      paf        42:        empty_string=new(pool) String(pool); 
1.52      paf        43: 
1.65      paf        44:        NEW_STRING(auto_method_name, AUTO_METHOD_NAME);
                     45:        NEW_STRING(main_method_name, MAIN_METHOD_NAME);
                     46: 
                     47:        NEW_STRING(root_class_name, ROOT_CLASS_NAME);
                     48:        NEW_STRING(main_class_name, MAIN_CLASS_NAME);
                     49:        NEW_STRING(table_class_name, TABLE_CLASS_NAME);
                     50:        NEW_STRING(env_class_name, ENV_CLASS_NAME);     
                     51:        NEW_STRING(form_class_name, FORM_CLASS_NAME);   
1.58      paf        52: 
                     53:        // hashes
1.60      paf        54:        untaint_lang_name2enum=new(pool) Hash(pool);
1.58      paf        55:        LOCAL_STRING(as_is, "as-is");  
1.63      paf        56:        untaint_lang_name2enum->put(as_is, (int)String::Untaint_lang::AS_IS);
1.61      paf        57:        LOCAL_STRING(table, "table");
1.63      paf        58:        untaint_lang_name2enum->put(table, (int)String::Untaint_lang::TABLE);
1.58      paf        59:        LOCAL_STRING(sql, "sql");
1.63      paf        60:        untaint_lang_name2enum->put(sql, (int)String::Untaint_lang::SQL);
1.58      paf        61:        LOCAL_STRING(js, "js");
1.63      paf        62:        untaint_lang_name2enum->put(js, (int)String::Untaint_lang::JS);
1.58      paf        63:        LOCAL_STRING(html, "html");
1.63      paf        64:        untaint_lang_name2enum->put(html, (int)String::Untaint_lang::HTML);
1.58      paf        65:        LOCAL_STRING(html_typo, "html-typo");
1.63      paf        66:        untaint_lang_name2enum->put(html_typo, (int)String::Untaint_lang::HTML_TYPO);
1.50      paf        67: 
1.64      paf        68:        // read-only stateless classes
                     69:        initialize_string_class(pool, *(string_class=new(pool) VStateless_class(pool)));  string_class->freeze();
                     70:        initialize_double_class(pool, *(double_class=new(pool) VStateless_class(pool)));  double_class->freeze();
                     71:        initialize_int_class(pool, *(int_class=new(pool) VStateless_class(pool)));  int_class->freeze();
                     72:        initialize_table_class(pool, *(table_class=new(pool) VStateless_class(pool)));  table_class->freeze();
1.65      paf        73: 
                     74:        // read-only stateless base classes
                     75:        initialize_env_base_class(pool, *(env_base_class=new(pool) VStateless_class(pool)));  env_base_class->freeze();
                     76:        initialize_form_base_class(pool, *(form_base_class=new(pool) VStateless_class(pool)));  form_base_class->freeze();
1.23      paf        77: }

E-mail: