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

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.63    ! paf         6:        $Id: core.C,v 1.62 2001/03/12 18:13:49 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.50      paf        14: #include "pa_request.h"
                     15: 
1.58      paf        16: #define GLOBAL_STRING(name, value)  name=new(pool) String(pool); name->APPEND_CONST(value)
                     17: #define LOCAL_STRING(name, value)  String name(pool); name.APPEND_CONST(value)
                     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.56      paf        25: String *main_class_name;
1.52      paf        26: String *root_class_name;
                     27: String *env_class_name;
1.60      paf        28: String *table_class_name;
1.52      paf        29: 
1.60      paf        30: Hash *untaint_lang_name2enum;
1.58      paf        31: 
                     32: 
1.23      paf        33: void core() {
1.25      paf        34:        Pool pool;
1.52      paf        35:        
                     36:        // names
1.62      paf        37:        GLOBAL_STRING(unnamed_name, UNNAMED_NAME);
1.50      paf        38:        empty_string=new(pool) String(pool); 
1.52      paf        39: 
1.58      paf        40:        GLOBAL_STRING(auto_method_name, AUTO_METHOD_NAME);
                     41:        GLOBAL_STRING(main_method_name, MAIN_METHOD_NAME);
1.52      paf        42:        
1.58      paf        43:        GLOBAL_STRING(main_class_name, MAIN_CLASS_NAME);
                     44:        GLOBAL_STRING(root_class_name, ROOT_CLASS_NAME);
                     45:        GLOBAL_STRING(env_class_name, ENV_CLASS_NAME);  
1.60      paf        46:        GLOBAL_STRING(table_class_name, TABLE_CLASS_NAME);
1.58      paf        47: 
                     48:        // hashes
1.60      paf        49:        untaint_lang_name2enum=new(pool) Hash(pool);
1.58      paf        50:        LOCAL_STRING(as_is, "as-is");  
1.63    ! paf        51:        untaint_lang_name2enum->put(as_is, (int)String::Untaint_lang::AS_IS);
1.61      paf        52:        LOCAL_STRING(table, "table");
1.63    ! paf        53:        untaint_lang_name2enum->put(table, (int)String::Untaint_lang::TABLE);
1.58      paf        54:        LOCAL_STRING(sql, "sql");
1.63    ! paf        55:        untaint_lang_name2enum->put(sql, (int)String::Untaint_lang::SQL);
1.58      paf        56:        LOCAL_STRING(js, "js");
1.63    ! paf        57:        untaint_lang_name2enum->put(js, (int)String::Untaint_lang::JS);
1.58      paf        58:        LOCAL_STRING(html, "html");
1.63    ! paf        59:        untaint_lang_name2enum->put(html, (int)String::Untaint_lang::HTML);
1.58      paf        60:        LOCAL_STRING(html_typo, "html-typo");
1.63    ! paf        61:        untaint_lang_name2enum->put(html_typo, (int)String::Untaint_lang::HTML_TYPO);
1.50      paf        62: 
1.60      paf        63:        // read-only classes
                     64:        initialize_string_class(pool, *(string_class=new(pool) VClass(pool)));  string_class->freeze();
                     65:        initialize_double_class(pool, *(double_class=new(pool) VClass(pool)));  double_class->freeze();
                     66:        initialize_int_class(pool, *(int_class=new(pool) VClass(pool)));  int_class->freeze();
                     67:        initialize_table_class(pool, *(table_class=new(pool) VClass(pool)));  table_class->freeze();
1.52      paf        68: 
                     69:        // request
1.24      paf        70:        Request request(pool);
                     71:        request.core();
1.23      paf        72: }
                     73: 

E-mail: