Changeset 8319 for trunk

Show
Ignore:
Timestamp:
21/12/11 12:04:21 (5 months ago)
Author:
westram
Message:
  • ignored PERL2ARB interface as referrer (to detect functions that are only used from perl)
    • moved several functions to static scope or removed them
    • for some functions it's ok to be only used from perl (e.g. macro support functions). Added comments there!
  • there is still some dead code in there, e.g.
    • read-security is implemented, but unused (and unwanted)
Location:
trunk
Files:
21 modified

Legend:

Unmodified
Added
Removed
  • trunk/ARBDB/adTest.cxx

    r8258 r8319  
    210210} 
    211211 
    212 void GB_dump(GBDATA *gbd) { 
     212NOT4PERL void GB_dump(GBDATA *gbd) { 
    213213    int max_lines = 2500; 
    214214    GB_dump_internal(gbd, &max_lines); 
     
    219219} 
    220220 
    221 void GB_dump_no_limit(GBDATA *gbd) { 
     221NOT4PERL void GB_dump_no_limit(GBDATA *gbd) { 
    222222    GB_dump_internal(gbd, 0); 
    223223} 
  • trunk/ARBDB/ad_core.cxx

    r8309 r8319  
    321321    gb_write_index_key(GB_FATHER(gbd), gbd->index, new_index); 
    322322} 
    323  
    324 void gb_rename_entry(GBCONTAINER *gbc, const char *new_key) { 
    325     GBCONTAINER  *gb_father = GB_FATHER(gbc); 
    326     GB_MAIN_TYPE *Main      = GBCONTAINER_MAIN(gb_father); 
    327     GBQUARK       new_keyq; 
    328     long          new_gbm_index; 
    329  
    330     gb_unlink_entry((GBDATA*)gbc); 
    331  
    332     new_keyq          = gb_key_2_quark(Main, new_key); 
    333     new_gbm_index     = GB_QUARK_2_GBMINDEX(Main, new_keyq); 
    334     GB_GBM_INDEX(gbc) = new_gbm_index; 
    335  
    336     gb_link_entry(gb_father, (GBDATA*)gbc, -1); 
    337     gb_write_key((GBDATA*)gbc, new_key); 
    338 } 
    339  
    340323 
    341324GBDATA *gb_make_entry(GBCONTAINER * father, const char *key, long index_pos, GBQUARK keyq, GB_TYPES type) { 
  • trunk/ARBDB/ad_load.cxx

    r8309 r8319  
    13491349} 
    13501350 
    1351 GBDATA *GB_login(const char *cpath, const char *opent, const char *user) { 
     1351static GBDATA *GB_login(const char *cpath, const char *opent, const char *user) { 
    13521352    /*! open an ARB database 
    13531353     * 
  • trunk/ARBDB/ad_prot.h

    r8317 r8319  
    6767const char *GB_get_db_path(GBDATA *gbd); 
    6868void GB_dump_db_path(GBDATA *gbd); 
    69 void GB_dump(GBDATA *gbd); 
    70 void GB_dump_no_limit(GBDATA *gbd); 
     69NOT4PERL void GB_dump(GBDATA *gbd); 
     70NOT4PERL void GB_dump_no_limit(GBDATA *gbd); 
    7171GB_ERROR GB_fix_database(GBDATA *gb_main); 
    7272 
     
    7474void GB_set_verbose(void); 
    7575void GB_set_next_main_idx(long idx); 
    76 GBDATA *GB_login(const char *cpath, const char *opent, const char *user); 
    7776GBDATA *GB_open(const char *path, const char *opent); 
    7877 
    7978/* ad_save_load.cxx */ 
    8079GB_ERROR GB_save(GBDATA *gb, const char *path, const char *savetype); 
    81 GB_ERROR GB_create_parent_directory(const char *path); 
    8280GB_ERROR GB_create_directory(const char *path); 
    8381GB_ERROR GB_save_in_arbprop(GBDATA *gb, const char *path, const char *savetype); 
     
    9795long GB_read_clients(GBDATA *gbd); 
    9896bool GB_is_server(GBDATA *gbd); 
    99 bool GB_is_client(GBDATA *gbd); 
    10097GBDATA *GBCMC_find(GBDATA *gbd, const char *key, GB_TYPES type, const char *str, GB_CASE case_sens, GB_SEARCH_TYPE gbs); 
    10198GB_ERROR GB_tell_server_dont_wait(GBDATA *gbd); 
     
    110107char *GB_find_all_files(const char *dir, const char *mask, bool filename_only); 
    111108char *GB_find_latest_file(const char *dir, const char *mask); 
    112 const char *GB_existing_file(const char *file, bool warn_when_not_found); 
    113109char *GB_lib_file(bool warn_when_not_found, const char *libprefix, const char *filename); 
    114110char *GB_property_file(bool warn_when_not_found, const char *filename); 
     
    160156/* adlang1.cxx */ 
    161157NOT4PERL void GB_set_export_sequence_hook(gb_export_sequence_cb escb); 
    162 void GB_set_ACISRT_trace(int enable); 
    163158int GB_get_ACISRT_trace(void); 
    164159 
     
    191186/* admath.cxx */ 
    192187double GB_log_fak(int n); 
    193 double GB_frandom(void); 
    194188int GB_random(int range); 
    195189 
     
    201195 
    202196/* adquery.cxx */ 
    203 const char *GB_get_GBDATA_path(GBDATA *gbd); 
    204197GBDATA *GB_find_sub_by_quark(GBDATA *father, GBQUARK key_quark, GBDATA *after, size_t skip_over); 
    205198GBDATA *GB_find(GBDATA *gbd, const char *key, GB_SEARCH_TYPE gbs); 
     
    234227GB_ULONG GB_last_saved_time(GBDATA *gb_main); 
    235228GB_ERROR GB_textprint(const char *path) __ATTR__USERESULT; 
    236 GB_ERROR GB_xterm(void) __ATTR__USERESULT; 
    237 GB_ERROR GB_xcmd(const char *cmd, bool background, bool wait_only_if_error) __ATTR__USERESULT_TODO; 
    238229char *GB_executable(GB_CSTR exe_name); 
    239 void GB_setenv(const char *var, const char *value); 
    240 GB_CSTR GB_getenvARB_XTERM(void); 
    241 GB_CSTR GB_getenvARB_XCMD(void); 
    242230GB_CSTR GB_getenvUSER(void); 
    243 GB_CSTR GB_getenvHOME(void); 
    244231GB_CSTR GB_getenvARBHOME(void); 
    245232GB_CSTR GB_getenvARBMACRO(void); 
    246233GB_CSTR GB_getenvARBMACROHOME(void); 
    247 GB_CSTR GB_getenvARBCONFIG(void); 
    248 GB_CSTR GB_getenvPATH(void); 
    249234GB_CSTR GB_getenvARB_GS(void); 
    250235GB_CSTR GB_getenvARB_PDFVIEW(void); 
     
    256241bool GB_host_is_local(const char *hostname); 
    257242GB_ULONG GB_get_physical_memory(void); 
     243GB_ERROR GB_xterm(void) __ATTR__USERESULT; 
     244GB_ERROR GB_xcmd(const char *cmd, bool background, bool wait_only_if_error) __ATTR__USERESULT_TODO; 
    258245GB_CSTR GB_append_suffix(const char *name, const char *suffix); 
    259246GB_CSTR GB_canonical_path(const char *anypath); 
     
    272259 
    273260/* adstring.cxx */ 
    274 void GB_raise_critical_error(const char *msg) __ATTR__NORETURN; 
    275261char *GBS_string_2_key(const char *str); 
    276262char *GB_memdup(const char *source, size_t len); 
     
    327313GB_BUFFER GB_give_other_buffer(GB_CBUFFER buffer, long size); 
    328314void GB_atexit(void (*exitfun)()); 
    329 void GB_exit_gb(void); 
    330315void GB_init_gb(void); 
    331316int GB_open_DBs(void); 
     
    343328long GB_read_string_count(GBDATA *gbd); 
    344329GB_CSTR GB_read_link_pntr(GBDATA *gbd); 
    345 char *GB_read_link(GBDATA *gbd); 
    346 long GB_read_link_count(GBDATA *gbd); 
    347330long GB_read_bits_count(GBDATA *gbd); 
    348331GB_CSTR GB_read_bits_pntr(GBDATA *gbd, char c_0, char c_1); 
     
    355338GB_UINT4 *GB_read_ints(GBDATA *gbd); 
    356339GB_CFLOAT *GB_read_floats_pntr(GBDATA *gbd); 
    357 long GB_read_floats_count(GBDATA *gbd); 
    358340char *GB_read_as_string(GBDATA *gbd); 
    359341long GB_read_from_ints(GBDATA *gbd, long index); 
     
    374356int GB_read_security_read(GBDATA *gbd); 
    375357int GB_read_security_delete(GBDATA *gbd); 
    376 int GB_get_my_security(GBDATA *gbd); 
    377358GB_ERROR GB_write_security_write(GBDATA *gbd, unsigned long level); 
    378359GB_ERROR GB_write_security_read(GBDATA *gbd, unsigned long level); 
     
    394375GBDATA *GB_get_root(GBDATA *gbd); 
    395376bool GB_check_father(GBDATA *gbd, GBDATA *gb_maybefather); 
    396 int GB_rename(GBDATA *gbc, const char *new_key); 
    397377GBDATA *GB_create(GBDATA *father, const char *key, GB_TYPES type); 
    398378GBDATA *GB_create_container(GBDATA *father, const char *key); 
     
    406386bool GB_is_temporary(GBDATA *gbd); 
    407387bool GB_in_temporary_branch(GBDATA *gbd); 
    408 GB_ERROR GB_push_local_transaction(GBDATA *gbd); 
    409 GB_ERROR GB_pop_local_transaction(GBDATA *gbd); 
    410388GB_ERROR GB_push_transaction(GBDATA *gbd); 
    411389GB_ERROR GB_pop_transaction(GBDATA *gbd); 
     
    427405void GB_remove_all_callbacks_to(GBDATA *gbd, GB_CB_TYPE type, GB_CB func); 
    428406GB_ERROR GB_ensure_callback(GBDATA *gbd, GB_CB_TYPE type, GB_CB func, int *clientdata); 
    429 GB_ERROR GB_release(GBDATA *gbd); 
    430 int GB_testlocal(GBDATA *gbd); 
    431407int GB_nsons(GBDATA *gbd); 
    432408void GB_disable_quicksave(GBDATA *gbd, const char *reason); 
    433409GB_ERROR GB_resort_data_base(GBDATA *gb_main, GBDATA **new_order_list, long listsize); 
    434410GB_ERROR GB_resort_system_folder_to_top(GBDATA *gb_main); 
    435 GB_ERROR GB_write_usr_public(GBDATA *gbd, long flags); 
    436 long GB_read_usr_public(GBDATA *gbd); 
    437411long GB_read_usr_private(GBDATA *gbd); 
    438412GB_ERROR GB_write_usr_private(GBDATA *gbd, long ref); 
  • trunk/ARBDB/ad_save_load.cxx

    r8309 r8319  
    850850} 
    851851 
    852 GB_ERROR GB_create_parent_directory(const char *path) { 
     852static GB_ERROR GB_create_parent_directory(const char *path) { 
    853853    GB_ERROR error = NULL; 
    854854    char *parent; 
  • trunk/ARBDB/ad_t_prot.h

    r8309 r8319  
    4747long GBT_get_alignment_len(GBDATA *gb_main, const char *aliname); 
    4848GB_ERROR GBT_set_alignment_len(GBDATA *gb_main, const char *aliname, long new_len); 
    49 int GBT_get_alignment_aligned(GBDATA *gb_main, const char *aliname); 
    5049char *GBT_get_alignment_type_string(GBDATA *gb_main, const char *aliname); 
    5150GB_alignment_type GBT_get_alignment_type(GBDATA *gb_main, const char *aliname); 
     
    6463GBDATA *GBT_find_or_create_SAI(GBDATA *gb_main, const char *name); 
    6564GBDATA *GBT_find_item_rel_item_data(GBDATA *gb_item_data, const char *id_field, const char *id_value); 
    66 GBDATA *GBT_expect_item_rel_item_data(GBDATA *gb_item_data, const char *id_field, const char *id_value); 
    6765GBDATA *GBT_get_species_data(GBDATA *gb_main); 
    6866GBDATA *GBT_first_marked_species_rel_species_data(GBDATA *gb_species_data); 
     
    7674GBDATA *GBT_expect_species(GBDATA *gb_main, const char *name); 
    7775GBDATA *GBT_get_SAI_data(GBDATA *gb_main); 
    78 GBDATA *GBT_first_marked_SAI_rel_SAI_data(GBDATA *gb_sai_data); 
    79 GBDATA *GBT_next_marked_SAI(GBDATA *gb_sai); 
    8076GBDATA *GBT_first_SAI_rel_SAI_data(GBDATA *gb_sai_data); 
    8177GBDATA *GBT_first_SAI(GBDATA *gb_main); 
     
    8480GBDATA *GBT_find_SAI(GBDATA *gb_main, const char *name); 
    8581GBDATA *GBT_expect_SAI(GBDATA *gb_main, const char *name); 
    86 long GBT_get_item_count(GBDATA *gb_parent_of_container, const char *item_container_name); 
    8782long GBT_get_species_count(GBDATA *gb_main); 
    8883long GBT_get_SAI_count(GBDATA *gb_main); 
    89 char *GBT_create_unique_item_identifier(GBDATA *gb_item_container, const char *id_field, const char *default_id); 
    9084char *GBT_create_unique_species_name(GBDATA *gb_main, const char *default_name); 
    9185void GBT_mark_all(GBDATA *gb_main, int flag); 
     
    115109GBDATA *GBT_next_table(GBDATA *gb_table); 
    116110GBDATA *GBT_first_table_entry(GBDATA *gb_table); 
    117 GBDATA *GBT_first_marked_table_entry(GBDATA *gb_table); 
    118111GBDATA *GBT_next_table_entry(GBDATA *gb_table_entry); 
    119 GBDATA *GBT_next_marked_table_entry(GBDATA *gb_table_entry); 
    120 GBDATA *GBT_find_table_entry(GBDATA *gb_table, const char *id); 
    121 GBDATA *GBT_open_table_entry(GBDATA *gb_table, const char *id); 
    122112GBDATA *GBT_first_table_field(GBDATA *gb_table); 
    123 GBDATA *GBT_first_marked_table_field(GBDATA *gb_table); 
    124113GBDATA *GBT_next_table_field(GBDATA *gb_table_field); 
    125 GBDATA *GBT_next_marked_table_field(GBDATA *gb_table_field); 
    126114GBDATA *GBT_find_table_field(GBDATA *gb_table, const char *id); 
    127 GB_TYPES GBT_get_type_of_table_entry_field(GBDATA *gb_table, const char *fieldname); 
    128 GB_ERROR GBT_savely_write_table_entry_field(GBDATA *gb_table, GBDATA *gb_entry, const char *fieldname, const char *value_in_ascii_format); 
    129115GBDATA *GBT_open_table_field(GBDATA *gb_table, const char *fieldname, GB_TYPES type_of_field); 
    130116 
     
    151137GB_ERROR GBT_write_byte(GBDATA *gb_container, const char *fieldpath, unsigned char content); 
    152138GB_ERROR GBT_write_float(GBDATA *gb_container, const char *fieldpath, double content); 
    153 GBDATA *GB_test_link_follower(GBDATA *gb_main, GBDATA *gb_link, const char *link); 
    154139GBDATA *GBT_open(const char *path, const char *opent); 
    155140GB_ERROR GBT_remote_action(GBDATA *gb_main, const char *application, const char *action_name); 
    156141GB_ERROR GBT_remote_awar(GBDATA *gb_main, const char *application, const char *awar_name, const char *value); 
    157142GB_ERROR GBT_remote_read_awar(GBDATA *gb_main, const char *application, const char *awar_name); 
    158 const char *GBT_remote_touch_awar(GBDATA *gb_main, const char *application, const char *awar_name); 
    159143char *GB_generate_notification(GBDATA *gb_main, void (*cb)(const char *message, void *client_data), const char *message, void *client_data); 
    160144GB_ERROR GB_remove_last_notification(GBDATA *gb_main); 
  • trunk/ARBDB/adali.cxx

    r8309 r8319  
    734734} 
    735735 
    736 int GBT_get_alignment_aligned(GBDATA *gb_main, const char *aliname) { 
    737     GBDATA *gb_alignment = GBT_get_alignment(gb_main, aliname); 
    738     return gb_alignment ? *GBT_read_int(gb_alignment, "aligned") : -1; 
    739 } 
    740  
    741736char *GBT_get_alignment_type_string(GBDATA *gb_main, const char *aliname) { 
    742737    char   *result       = NULL; 
  • trunk/ARBDB/adcomm.cxx

    r8309 r8319  
    16551655    return Main->local_mode; 
    16561656} 
    1657 bool GB_is_client(GBDATA *gbd) { 
    1658     return !GB_is_server(gbd); 
    1659 } 
    1660  
    16611657static GB_ERROR gbcmc_unfold_list(int socket, GBDATA * gbd) 
    16621658{ 
  • trunk/ARBDB/adfile.cxx

    r8309 r8319  
    195195} 
    196196 
    197 const char *GB_existing_file(const char *file, bool warn_when_not_found) { 
     197static const char *GB_existing_file(const char *file, bool warn_when_not_found) { 
    198198    // return 'file' if it's an existing readable file 
    199199    // return NULL otherwise 
  • trunk/ARBDB/aditem.cxx

    r7337 r8319  
    8585} 
    8686 
    87 GBDATA *GBT_expect_item_rel_item_data(GBDATA *gb_item_data, const char *id_field, const char *id_value) { 
     87static GBDATA *GBT_expect_item_rel_item_data(GBDATA *gb_item_data, const char *id_field, const char *id_value) { 
    8888    //! like GBT_find_item_rel_item_data(), but also exports an error if the item is not present 
    8989 
     
    150150} 
    151151 
    152 GBDATA *GBT_first_marked_SAI_rel_SAI_data(GBDATA *gb_sai_data) { 
    153     return GB_first_marked(gb_sai_data, "extended"); 
    154 } 
    155  
    156 GBDATA *GBT_next_marked_SAI(GBDATA *gb_sai) { 
    157     gb_assert(GB_has_key(gb_sai, "extended")); 
    158     return GB_next_marked(gb_sai, "extended"); 
    159 } 
    160  
    161152// Search SAIs 
    162153GBDATA *GBT_first_SAI_rel_SAI_data(GBDATA *gb_sai_data) { 
     
    192183//      count items 
    193184 
    194 long GBT_get_item_count(GBDATA *gb_parent_of_container, const char *item_container_name) { 
     185static long GBT_get_item_count(GBDATA *gb_parent_of_container, const char *item_container_name) { 
    195186    // returns elements stored in a container 
    196187 
     
    216207// -------------------------------------------------------------------------------- 
    217208 
    218 char *GBT_create_unique_item_identifier(GBDATA *gb_item_container, const char *id_field, const char *default_id) { 
     209static char *GBT_create_unique_item_identifier(GBDATA *gb_item_container, const char *id_field, const char *default_id) { 
    219210    // returns an identifier not used by items in 'gb_item_container' 
    220211    // 'id_field' is the entry that is used as identifier (e.g. 'name' for species) 
  • trunk/ARBDB/adlang1.cxx

    r8103 r8319  
    3636static int trace = 0; 
    3737 
    38 void GB_set_ACISRT_trace(int enable) { trace = enable; } 
     38static void GB_set_ACISRT_trace(int enable) { trace = enable; } 
    3939int GB_get_ACISRT_trace() { return trace; } 
    4040 
  • trunk/ARBDB/admath.cxx

    r6385 r8319  
    4040static int randomSeeded = 0; 
    4141 
    42 double GB_frandom() { 
    43     // produces a random number in range [0.0 .. 1.0] 
    44     if (!randomSeeded) { 
    45         srand(time(0)); 
    46         randomSeeded = 1; 
    47     } 
    48     return ((double)rand())/RAND_MAX; 
    49 } 
    50  
    5142int GB_random(int range) { 
    5243    // produces a random number in range [0 .. range-1] 
  • trunk/ARBDB/adquery.cxx

    r8309 r8319  
    4242#define BUFFERSIZE 1024 
    4343 
    44 const char *GB_get_GBDATA_path(GBDATA *gbd) { 
     44static const char *GB_get_GBDATA_path(GBDATA *gbd) { 
    4545    static char *orgbuffer = NULL; 
    4646    char        *buffer; 
  • trunk/ARBDB/adsocket.cxx

    r8309 r8319  
    517517} 
    518518 
    519 GB_ERROR GB_xterm() { 
    520     // goes to header: __ATTR__USERESULT 
    521     const char *xt      = GB_getenvARB_XTERM(); 
    522     const char *command = GBS_global_string("%s &", xt); 
    523     return GBK_system(command); 
    524 } 
    525  
    526 GB_ERROR GB_xcmd(const char *cmd, bool background, bool wait_only_if_error) { 
    527     // goes to header: __ATTR__USERESULT_TODO 
    528  
    529     // runs a command in an xterm 
    530     // if 'background' is true -> run asynchronous 
    531     // if 'wait_only_if_error' is true -> asynchronous does wait for keypress only if cmd fails 
    532  
    533     GBS_strstruct *strstruct = GBS_stropen(1024); 
    534     const char    *xcmd      = GB_getenvARB_XCMD(); 
    535  
    536     GBS_strcat(strstruct, "("); 
    537     GBS_strcat(strstruct, xcmd); 
    538     GBS_strcat(strstruct, " bash -c 'LD_LIBRARY_PATH=\""); 
    539     GBS_strcat(strstruct, GB_getenv("LD_LIBRARY_PATH")); 
    540     GBS_strcat(strstruct, "\";export LD_LIBRARY_PATH; ("); 
    541     GBS_strcat(strstruct, cmd); 
    542  
    543     if (background) { 
    544         if (wait_only_if_error) { 
    545             GBS_strcat(strstruct, ") || (echo; echo Press RETURN to close Window; read a)' ) &"); 
     519// -------------------------------------------------------------------------------- 
     520 
     521static GB_CSTR getenv_ignore_empty(GB_CSTR envvar) { 
     522    GB_CSTR result = getenv(envvar); 
     523    return (result && result[0]) ? result : 0; 
     524} 
     525 
     526static GB_CSTR GB_getenvPATH() { 
     527    static const char *path = 0; 
     528    if (!path) { 
     529        path = getenv_ignore_empty("PATH"); 
     530        if (!path) { 
     531            path = GBS_eval_env("/bin:/usr/bin:$(ARBHOME)/bin"); 
     532            GB_informationf("Your PATH variable is empty - using '%s' as search path.", path); 
    546533        } 
    547534        else { 
    548             GBS_strcat(strstruct, "; echo; echo Press RETURN to close Window; read a)' ) &"); 
    549         } 
    550     } 
    551     else { 
    552         if (wait_only_if_error) { 
    553             GBS_strcat(strstruct, ") || (echo; echo Press RETURN to close Window; read a)' )"); 
    554         } 
    555         else { // no wait 
    556             GBS_strcat(strstruct, " )' ) "); 
    557         } 
    558     } 
    559  
    560     GB_ERROR error = GBK_system(GBS_mempntr(strstruct)); 
    561     GBS_strforget(strstruct); 
    562  
    563     return error; 
     535            char *arbbin = GBS_eval_env("$(ARBHOME)/bin"); 
     536            if (strstr(path, arbbin) == 0) { 
     537                GB_warningf("Your PATH variable does not contain '%s'. Things may not work as expected.", arbbin); 
     538            } 
     539            free(arbbin); 
     540        } 
     541    } 
     542    return path; 
    564543} 
    565544 
     
    635614// Functions to access the environment variables used by ARB: 
    636615 
    637 static GB_CSTR getenv_ignore_empty(GB_CSTR envvar) { 
    638     GB_CSTR result = getenv(envvar); 
    639     return (result && result[0]) ? result : 0; 
    640 } 
    641  
    642616static char *getenv_executable(GB_CSTR envvar) { 
    643617    // get full path of executable defined by 'envvar' 
     
    680654} 
    681655 
    682 void GB_setenv(const char *var, const char *value) { 
     656static void GB_setenv(const char *var, const char *value) { 
    683657    if (setenv(var, value, 1) != 0) { 
    684658        GB_warningf("Could not set environment variable '%s'. This might cause problems in subprocesses.\n" 
     
    687661} 
    688662 
    689 GB_CSTR GB_getenvARB_XTERM() { 
     663static GB_CSTR GB_getenvARB_XTERM() { 
    690664    static const char *xterm = 0; 
    691665    if (!xterm) { 
     
    696670} 
    697671 
    698 GB_CSTR GB_getenvARB_XCMD() { 
     672static GB_CSTR GB_getenvARB_XCMD() { 
    699673    static const char *xcmd = 0; 
    700674    if (!xcmd) { 
     
    727701 
    728702 
    729 GB_CSTR GB_getenvHOME() { 
     703static GB_CSTR GB_getenvHOME() { 
    730704    static SmartCharPtr Home; 
    731705    if (Home.isNull()) { 
     
    787761} 
    788762 
    789 GB_CSTR GB_getenvARBCONFIG() { 
     763static GB_CSTR GB_getenvARBCONFIG() { 
    790764    static const char *ac = 0; 
    791765    if (!ac) ac = getenv_autodirectory("ARBCONFIG", GB_path_in_arbprop("cfgSave")); // doc in ../HELP_SOURCE/oldhelp/arb_envar.hlp@ARBCONFIG 
    792766    return ac; 
    793 } 
    794  
    795 GB_CSTR GB_getenvPATH() { 
    796     static const char *path = 0; 
    797     if (!path) { 
    798         path = getenv_ignore_empty("PATH"); 
    799         if (!path) { 
    800             path = GBS_eval_env("/bin:/usr/bin:$(ARBHOME)/bin"); 
    801             GB_informationf("Your PATH variable is empty - using '%s' as search path.", path); 
    802         } 
    803         else { 
    804             char *arbbin = GBS_eval_env("$(ARBHOME)/bin"); 
    805             if (strstr(path, arbbin) == 0) { 
    806                 GB_warningf("Your PATH variable does not contain '%s'. Things may not work as expected.", arbbin); 
    807             } 
    808             free(arbbin); 
    809         } 
    810     } 
    811     return path; 
    812767} 
    813768 
     
    988943} 
    989944 
     945// --------------------------- 
     946//      external commands 
     947 
     948GB_ERROR GB_xterm() { 
     949    // goes to header: __ATTR__USERESULT 
     950    const char *xt      = GB_getenvARB_XTERM(); 
     951    const char *command = GBS_global_string("%s &", xt); 
     952    return GBK_system(command); 
     953} 
     954 
     955GB_ERROR GB_xcmd(const char *cmd, bool background, bool wait_only_if_error) { 
     956    // goes to header: __ATTR__USERESULT_TODO 
     957 
     958    // runs a command in an xterm 
     959    // if 'background' is true -> run asynchronous 
     960    // if 'wait_only_if_error' is true -> asynchronous does wait for keypress only if cmd fails 
     961 
     962    GBS_strstruct *strstruct = GBS_stropen(1024); 
     963    const char    *xcmd      = GB_getenvARB_XCMD(); 
     964 
     965    GBS_strcat(strstruct, "("); 
     966    GBS_strcat(strstruct, xcmd); 
     967    GBS_strcat(strstruct, " bash -c 'LD_LIBRARY_PATH=\""); 
     968    GBS_strcat(strstruct, GB_getenv("LD_LIBRARY_PATH")); 
     969    GBS_strcat(strstruct, "\";export LD_LIBRARY_PATH; ("); 
     970    GBS_strcat(strstruct, cmd); 
     971 
     972    if (background) { 
     973        if (wait_only_if_error) { 
     974            GBS_strcat(strstruct, ") || (echo; echo Press RETURN to close Window; read a)' ) &"); 
     975        } 
     976        else { 
     977            GBS_strcat(strstruct, "; echo; echo Press RETURN to close Window; read a)' ) &"); 
     978        } 
     979    } 
     980    else { 
     981        if (wait_only_if_error) { 
     982            GBS_strcat(strstruct, ") || (echo; echo Press RETURN to close Window; read a)' )"); 
     983        } 
     984        else { // no wait 
     985            GBS_strcat(strstruct, " )' ) "); 
     986        } 
     987    } 
     988 
     989    GB_ERROR error = GBK_system(GBS_mempntr(strstruct)); 
     990    GBS_strforget(strstruct); 
     991 
     992    return error; 
     993} 
     994 
    990995// --------------------------------------------- 
    991996// path completion (parts former located in AWT) 
  • trunk/ARBDB/adstring.cxx

    r8313 r8319  
    2626 
    2727#include <valgrind.h> 
    28  
    29 // ----------------------- 
    30 //      error handling 
    31  
    32 void GB_raise_critical_error(const char *msg) { 
    33     // goes to header: __ATTR__NORETURN 
    34     fprintf(stderr, "------------------------------------------------------------\n"); 
    35     fprintf(stderr, "A critical error occurred in ARB\nError-Message: %s\n", msg); 
    36 #if defined(DEBUG) 
    37     fprintf(stderr, "Run the debugger to find the location where the error was raised.\n"); 
    38 #endif // DEBUG 
    39     fprintf(stderr, "------------------------------------------------------------\n"); 
    40     gb_assert(0); 
    41     exit(-1); 
    42 } 
    43  
    44 // -------------------------------------------------------------------------------- 
    45  
    4628 
    4729static char *GBS_string_2_key_with_exclusions(const char *str, const char *additional) { 
  • trunk/ARBDB/adtables.cxx

    r8309 r8319  
    4040 *      } 
    4141 */ 
     42 
     43static GBDATA *GBT_find_table_entry(GBDATA *gb_table, const char *id) { 
     44    GBDATA *gb_entries = GB_entry(gb_table, "entries"); 
     45    GBDATA *gb_entry_name = GB_find_string(gb_entries, "name", id, GB_IGNORE_CASE, SEARCH_GRANDCHILD); 
     46    if (!gb_entry_name) return NULL; 
     47    return GB_get_father(gb_entry_name); 
     48} 
    4249 
    4350static GBDATA *gbt_table_link_follower(GBDATA *gb_main, GBDATA */*gb_link*/, const char *link) { 
     
    140147} 
    141148 
    142 GBDATA *GBT_first_marked_table_entry(GBDATA *gb_table) { 
    143     GBDATA *gb_entries = GB_entry(gb_table, "entries"); 
    144     return GB_first_marked(gb_entries, "entry"); 
    145 } 
    146  
    147149GBDATA *GBT_next_table_entry(GBDATA *gb_table_entry) { 
    148150    gb_assert(GB_has_key(gb_table_entry, "entry")); 
    149151    return GB_nextEntry(gb_table_entry); 
    150 } 
    151  
    152 GBDATA *GBT_next_marked_table_entry(GBDATA *gb_table_entry) { 
    153     return GB_next_marked(gb_table_entry, "entry"); 
    154 } 
    155  
    156 GBDATA *GBT_find_table_entry(GBDATA *gb_table, const char *id) { 
    157     GBDATA *gb_entries = GB_entry(gb_table, "entries"); 
    158     GBDATA *gb_entry_name = GB_find_string(gb_entries, "name", id, GB_IGNORE_CASE, SEARCH_GRANDCHILD); 
    159     if (!gb_entry_name) return NULL; 
    160     return GB_get_father(gb_entry_name); 
    161 } 
    162  
    163 GBDATA *GBT_open_table_entry(GBDATA *gb_table, const char *id) { 
    164     GBDATA *gb_entries = GB_entry(gb_table, "entries"); 
    165     GBDATA *gb_entry_name = GB_find_string(gb_entries, "name", id, GB_IGNORE_CASE, SEARCH_GRANDCHILD); 
    166     GBDATA *gb_entry; 
    167     if (gb_entry_name) GB_get_father(gb_entry_name); 
    168     gb_entry = GB_create_container(gb_entries, "entry"); 
    169     gb_entry_name = GB_create(gb_entry, "name", GB_STRING); 
    170     GB_write_string(gb_entry_name, id); 
    171     return gb_entry; 
    172152} 
    173153 
     
    177157} 
    178158 
    179 GBDATA *GBT_first_marked_table_field(GBDATA *gb_table) { 
    180     GBDATA *gb_fields = GB_entry(gb_table, "fields"); 
    181     return GB_first_marked(gb_fields, "field"); 
    182 } 
    183159GBDATA *GBT_next_table_field(GBDATA *gb_table_field) { 
    184160    gb_assert(GB_has_key(gb_table_field, "field")); 
    185161    return GB_nextEntry(gb_table_field); 
    186 } 
    187  
    188 GBDATA *GBT_next_marked_table_field(GBDATA *gb_table_field) { 
    189     return GB_next_marked(gb_table_field, "field"); 
    190162} 
    191163 
     
    195167    if (!gb_field_name) return NULL; 
    196168    return GB_get_father(gb_field_name); 
    197 } 
    198  
    199 GB_TYPES GBT_get_type_of_table_entry_field(GBDATA *gb_table, const char *fieldname) { 
    200     GBDATA *gb_fields = GB_entry(gb_table, "fields"); 
    201     GBDATA *gb_field_name = GB_find_string(gb_fields, "name", fieldname, GB_IGNORE_CASE, SEARCH_GRANDCHILD); 
    202     GBDATA *gb_field_type; 
    203     if (!gb_field_name) return GB_NONE; 
    204     gb_field_type = GB_entry(gb_field_name, "type"); 
    205     return (GB_TYPES) GB_read_int(gb_field_type); 
    206 } 
    207  
    208 GB_ERROR GBT_savely_write_table_entry_field(GBDATA *gb_table, GBDATA *gb_entry, const char *fieldname, const char *value_in_ascii_format) { 
    209     GBDATA *gb_entry_field; 
    210     GB_TYPES type = GBT_get_type_of_table_entry_field(gb_table, fieldname); 
    211     if (type == GB_NONE) { 
    212         return GB_export_errorf("There is no field description '%s' for your table", fieldname); 
    213     } 
    214     gb_entry_field = GB_search(gb_entry, "fieldname", type); 
    215     return GB_write_as_string(gb_entry_field, value_in_ascii_format); 
    216169} 
    217170 
  • trunk/ARBDB/adtools.cxx

    r8037 r8319  
    515515 
    516516 
    517 GBDATA *GB_test_link_follower(GBDATA *gb_main, GBDATA *gb_link, const char *link) { 
     517static GBDATA *GB_test_link_follower(GBDATA *gb_main, GBDATA *gb_link, const char *link) { 
    518518    GBDATA *linktarget = GB_search(gb_main, "tmp/link/string", GB_STRING); 
    519519    // GBUSE(gb_link); 
     
    589589 * - BIO::remote_action         (use of GBT_remote_action) 
    590590 * - BIO::remote_awar           (use of GBT_remote_awar) 
    591  * - BIO::remote_read_awar      (use of GBT_remote_read_awar - seems unused) 
    592  * - BIO::remote_touch_awar     (use of GBT_remote_touch_awar - seems unused) 
     591 * - BIO::remote_read_awar      (use of GBT_remote_read_awar) 
    593592 */ 
    594593 
     
    658657 
    659658GB_ERROR GBT_remote_action(GBDATA *gb_main, const char *application, const char *action_name) { 
     659    // needs to be public (needed by perl-macros) 
     660 
    660661    remote_awars  awars; 
    661662    GBDATA       *gb_action; 
     
    674675 
    675676GB_ERROR GBT_remote_awar(GBDATA *gb_main, const char *application, const char *awar_name, const char *value) { 
     677    // needs to be public (needed by perl-macros) 
     678 
    676679    remote_awars  awars; 
    677680    GBDATA       *gb_awar; 
     
    692695 
    693696GB_ERROR GBT_remote_read_awar(GBDATA *gb_main, const char *application, const char *awar_name) { 
     697    // needs to be public (needed by perl-macros) 
     698 
    694699    remote_awars  awars; 
    695700    GBDATA       *gb_awar; 
     
    707712    return error; 
    708713} 
    709  
    710 const char *GBT_remote_touch_awar(GBDATA *gb_main, const char *application, const char *awar_name) { 
    711     remote_awars  awars; 
    712     GBDATA       *gb_awar; 
    713     GB_ERROR      error = NULL; 
    714  
    715     gbt_build_remote_awars(&awars, application); 
    716     gb_awar = gbt_remote_search_awar(gb_main, awars.awar_awar); 
    717  
    718     error             = GB_begin_transaction(gb_main); 
    719     if (!error) error = GB_write_string(gb_awar, awar_name); 
    720     if (!error) error = GBT_write_string(gb_main, awars.awar_action, "AWAR_REMOTE_TOUCH"); 
    721     error             = GB_end_transaction(gb_main, error); 
    722  
    723     if (!error) error = gbt_wait_for_remote_action(gb_main, gb_awar, awars.awar_result); 
    724     return error; 
    725 } 
    726  
    727714 
    728715// --------------------------- 
  • trunk/ARBDB/arbdb.cxx

    r8313 r8319  
    392392} 
    393393 
    394 void GB_exit_gb() { 
     394static void GB_exit_gb() { 
    395395    GB_shell::ensure_inside(); 
    396396 
     
    803803} 
    804804 
    805 char *GB_read_link(GBDATA *gbd) 
     805static char *GB_read_link(GBDATA *gbd) 
    806806{ 
    807807    const char *d; 
     
    811811    return GB_memdup(d, GB_GETSIZE(gbd)+1); 
    812812} 
    813  
    814 long GB_read_link_count(GBDATA *gbd) 
    815 { 
    816     GB_TEST_READ(gbd, GB_LINK, "GB_read_link_pntr"); 
    817     return GB_GETSIZE(gbd); 
    818 } 
    819  
    820813 
    821814long GB_read_bits_count(GBDATA *gbd) 
     
    902895} 
    903896 
    904 long GB_read_ints_count(GBDATA *gbd) 
    905 { 
     897long GB_read_ints_count(GBDATA *gbd) { // used by ../PERL_SCRIPTS/SAI/SAI.pm@read_ints_count 
    906898    GB_TEST_READ(gbd, GB_INTS, "GB_read_ints_count"); 
    907899    return GB_GETSIZE(gbd); 
     
    947939} 
    948940 
    949 long GB_read_floats_count(GBDATA *gbd) 
     941static long GB_read_floats_count(GBDATA *gbd) 
    950942{ 
    951943    GB_TEST_READ(gbd, GB_FLOATS, "GB_read_floats_count"); 
     
    980972//      array type access functions (intended for perl use) 
    981973 
    982 long GB_read_from_ints(GBDATA *gbd, long index) { 
     974long GB_read_from_ints(GBDATA *gbd, long index) { // used by ../PERL_SCRIPTS/SAI/SAI.pm@read_from_ints 
    983975    static GBDATA    *last_gbd = 0; 
    984976    static long       count    = 0; 
     
    13301322    return GB_GET_SECURITY_DELETE(gbd); 
    13311323} 
    1332 int GB_get_my_security(GBDATA *gbd) { 
    1333     return GB_MAIN(gbd)->security_level; 
    1334 } 
    1335  
    13361324GB_ERROR GB_write_security_write(GBDATA *gbd, unsigned long level) 
    13371325{ 
     
    13471335    return 0; 
    13481336} 
    1349 GB_ERROR GB_write_security_read(GBDATA *gbd, unsigned long level) 
     1337GB_ERROR GB_write_security_read(GBDATA *gbd, unsigned long level) // @@@ unused  
    13501338{ 
    13511339    GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
     
    13591347    return 0; 
    13601348} 
    1361  
    13621349GB_ERROR GB_write_security_delete(GBDATA *gbd, unsigned long level) 
    13631350{ 
     
    14721459    // 
    14731460    // Other uses (maybe just to pass GB_MAIN_TYPE instead of GBDATA as GB_key_2_quark likes): 
    1474     // - gb_rename_entry 
    14751461    // - gb_make_entry 
    14761462    // - compress_sequence_tree 
     
    15681554    gb_touch_entry((GBDATA *)gbd, GB_CREATED); 
    15691555    return (GBDATA *)gbd; 
    1570 } 
    1571  
    1572 static void gb_rename(GBCONTAINER *gbc, const char *new_key) { 
    1573     gb_rename_entry(gbc, new_key); 
    1574 } 
    1575  
    1576 int GB_rename(GBDATA *gbc, const char *new_key) { 
    1577     /*! User accessible rename, check everything 
    1578      * returns 0 if successful! 
    1579      */ 
    1580     GBCONTAINER *old_father, *new_father; 
    1581     if (GB_check_key(new_key)) { 
    1582         GB_print_error(); 
    1583         return -1; 
    1584     } 
    1585  
    1586     GB_test_transaction(gbc); 
    1587     old_father = GB_FATHER(gbc); 
    1588  
    1589     if (GB_TYPE(gbc) != GB_DB) { 
    1590         GB_internal_error("GB_rename has to be called with container"); 
    1591         return -1; 
    1592     } 
    1593  
    1594     gb_rename((GBCONTAINER*)gbc, new_key); 
    1595  
    1596     new_father = GB_FATHER(gbc); 
    1597     if (old_father != new_father) { 
    1598         GB_internal_error("father changed during rename"); 
    1599         return -1; 
    1600     } 
    1601  
    1602     gb_touch_header(new_father); 
    1603     gb_touch_entry(gbc, GB_NORMAL_CHANGE); 
    1604  
    1605     return 0; 
    16061556} 
    16071557 
     
    19841934} 
    19851935 
    1986 GB_ERROR GB_clear_temporary(GBDATA *gbd) { 
     1936GB_ERROR GB_clear_temporary(GBDATA *gbd) { // @@@ used in ptpan branch - do not remove 
    19871937    //! undo effect of GB_set_temporary() 
    19881938 
     
    19991949} 
    20001950 
    2001 bool GB_in_temporary_branch(GBDATA *gbd) { 
     1951bool GB_in_temporary_branch(GBDATA *gbd) { // @@@ used in ptpan branch - do not remove 
    20021952    /*! @return true, if 'gbd' is member of a temporary subtree, 
    20031953     * i.e. if GB_is_temporary(itself or any parent) 
     
    20151965//      transactions 
    20161966 
    2017  
    2018 GB_ERROR GB_push_local_transaction(GBDATA *gbd) { 
    2019     /*! Starts a read only transaction. 
    2020      * Be sure that all data is cached. Be extremely careful! 
    2021      */ 
    2022     GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
    2023     if (Main->transaction>0) { 
    2024         return GB_push_transaction(gbd); 
    2025     } 
    2026     Main->transaction --; 
    2027     return 0; 
    2028 } 
    2029  
    2030 GB_ERROR GB_pop_local_transaction(GBDATA *gbd) { 
    2031     /*! Stops a read only transaction. 
    2032      * Be sure that all data is cached! 
    2033      */ 
    2034  
    2035     GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
    2036     if (Main->transaction>0) { 
    2037         return GB_pop_transaction(gbd); 
    2038     } 
    2039     Main->transaction ++; 
    2040     return 0; 
    2041 } 
    20421967 
    20431968GB_ERROR GB_push_transaction(GBDATA *gbd) { 
     
    26292554} 
    26302555 
    2631 GB_ERROR GB_release(GBDATA *gbd) { 
    2632     /*! free cached data in client. 
    2633      * 
    2634      * Warning: pointers into the freed region(s) will get invalid! 
    2635      */ 
    2636     GBCONTAINER  *gbc; 
    2637     GBDATA       *gb; 
    2638     int           index; 
    2639     GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
    2640  
    2641     GB_test_transaction(gbd); 
    2642     if (Main->local_mode) return 0; 
    2643     if (GB_ARRAY_FLAGS(gbd).changed && !gbd->flags2.update_in_server) { 
    2644         GB_update_server(gbd); 
    2645     } 
    2646     if (GB_TYPE(gbd) != GB_DB) { 
    2647         GB_ERROR error = GB_export_errorf("You cannot release non container (%s)", 
    2648                                           GB_read_key_pntr(gbd)); 
    2649         GB_internal_error(error); 
    2650         return error; 
    2651     } 
    2652     if (gbd->flags2.folded_container) return 0; 
    2653     gbc = (GBCONTAINER *)gbd; 
    2654  
    2655     for (index = 0; index < gbc->d.nheader; index++) { 
    2656         if ((gb = GBCONTAINER_ELEM(gbc, index))) { 
    2657             gb_delete_entry(&gb); 
    2658         } 
    2659     } 
    2660  
    2661     gbc->flags2.folded_container = 1; 
    2662     gb_do_callback_list(Main);       // do all callbacks 
    2663     return 0; 
    2664 } 
    2665  
    2666 int GB_testlocal(GBDATA *gbd) { 
    2667     /*! test whether data is available as local data 
    2668      * 
    2669      * @return 1 if data is available 
    2670      * 
    2671      * important for callbacks, because only testlocal tested data is available 
    2672      */ 
    2673     if (GB_TYPE(gbd) != GB_DB) return 1;            // all non-containers are available 
    2674     if (GB_MAIN(gbd)->local_mode) return 1;         // everything is available in server 
    2675     if (gbd->flags2.folded_container) return 0; 
    2676     return 1; 
    2677 } 
    2678  
    26792556int GB_nsons(GBDATA *gbd) { 
    26802557    /*! return number of child entries 
     
    27652642    free(new_order_list); 
    27662643    return error; 
    2767 } 
    2768  
    2769 // ------------------- 
    2770 //      user flags 
    2771  
    2772 GB_ERROR GB_write_usr_public(GBDATA *gbd, long flags) { 
    2773     GB_test_transaction(gbd); 
    2774     if (GB_GET_SECURITY_WRITE(gbd) > GB_MAIN(gbd)->security_level) 
    2775         return gb_security_error(gbd); 
    2776     gbd->flags.user_flags = flags; 
    2777     gb_touch_entry(gbd, GB_NORMAL_CHANGE); 
    2778     return 0; 
    2779 } 
    2780  
    2781 long GB_read_usr_public(GBDATA *gbd) 
    2782 { 
    2783     GB_test_transaction(gbd); 
    2784     return (long)gbd->flags.user_flags; 
    27852644} 
    27862645 
  • trunk/ARBDB/gb_prot.h

    r8309 r8319  
    2424char *gb_destroy_main(GB_MAIN_TYPE *Main); 
    2525GBDATA *gb_make_pre_defined_entry(GBCONTAINER *father, GBDATA *gbd, long index_pos, GBQUARK keyq); 
    26 void gb_rename_entry(GBCONTAINER *gbc, const char *new_key); 
    2726GBDATA *gb_make_entry(GBCONTAINER *father, const char *key, long index_pos, GBQUARK keyq, GB_TYPES type); 
    2827GBCONTAINER *gb_make_pre_defined_container(GBCONTAINER *father, GBCONTAINER *gbd, long index_pos, GBQUARK keyq); 
  • trunk/PERL_SCRIPTS/test/Makefile

    r8318 r8319  
    1212 
    1313help: 
    14         test            test all perl scripts for syntax 
     14        @echo "test      tests all perl scripts for syntax" 
    1515 
    1616test: test.stamp 
  • trunk/SOURCE_TOOLS/deadcode.pl

    r8308 r8319  
    1111                      ); 
    1212 
    13 my $reg_file_exclude = qr/\/(GDE|EISPACK|READSEQ)\//; 
     13my $reg_file_exclude = qr/\/(GDE|EISPACK|READSEQ|PERL2ARB)\//; 
    1414 
    1515