Show
Ignore:
Timestamp:
21/05/10 19:44:17 (2 years ago)
Author:
westram
Message:
  • AW_root
    • ctor initializes AWAR subsystem
    • made more clear that AW_root is a singleton
    • call dtor atexit; unlink AWARs from prop-DB and free memory (AW_window instances and releated mem still remain)
    • close properties DB
    • renamed some functions
  • AW_awar
    • added dtor
  • added AWT_create_root (necessary to add properties DB to DB-browser)
  • removed AWT_open_properties (done inside AW_root-ctor now)
  • EDIT properties
    • detect existing properties before constructing AW_root
  • removed AW_config_struct
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/WETC/WETC_main.cxx

    r6490 r6666  
    1616 
    1717int main(int argc, char **argv) { 
    18     if (argc <1) { 
    19         GB_export_error("Syntax: arb_wetc [-fileedit]"); 
    20         GB_print_error(); 
    21         exit(-1); 
     18    GB_ERROR error = NULL; 
     19 
     20    if (argc != 3) { 
     21        error = "Missing arguments"; 
     22    } 
     23    else { 
     24        const char *com  = argv[1]; 
     25        const char *file = argv[2]; 
     26 
     27        if (strcmp(com, "-fileedit") != 0) { 
     28            error = GBS_global_string("Unexpected parameter '%s'", com); 
     29        } 
     30        else { 
     31            AW_root *aw_root = AWT_create_root(".arb_prop/ntree.arb", "ARB_WETC"); 
     32 
     33            AWT_show_file(aw_root, file); 
     34            aw_root->window_hide(); 
     35            AWT_install_cb_guards(); 
     36            aw_root->main_loop(); 
     37 
     38        } 
    2239    } 
    2340 
    24     const char *com        = argv[1]; 
    25     AW_root    *aw_root    = new AW_root; 
    26     AW_default  aw_default = AWT_open_properties(aw_root, ".arb_prop/ntree.arb"); 
    27      
    28     aw_root->init_variables(aw_default); 
    29     aw_root->init_root("ARB_WETC", false); 
    30  
    31     if (!strcmp(com, "-fileedit")) { 
    32         AWT_show_file(aw_root, argv[2]); 
     41    if (error) { 
     42        fprintf(stderr, 
     43                "Syntax: arb_wetc -fileedit filename\n" 
     44                "Error: %s\n", 
     45                error); 
     46        return EXIT_FAILURE; 
    3347    } 
    34     else { 
    35         GB_export_error("wrong parameter, allowed: [-fileedit] file"); 
    36         GB_print_error(); 
    37         exit(-1); 
    38     } 
    39     aw_root->window_hide(); 
    40     AWT_install_cb_guards(); 
    41     aw_root->main_loop(); 
    42     return 0; 
     48    return EXIT_SUCCESS; 
    4349} 
    4450