home *** CD-ROM | disk | FTP | other *** search
- /* ANSI C code generated by SmallEiffel. */
- /*
- -- SmallEiffel -- Release (- 0.97) -- FRANCE
- -- Copyright (C), 1994 - Dominique COLNET and Suzanne COLLIN
- -- University Henri Poincare' - Nancy 1 - email colnet@loria.fr
- -- CRIN (Centre de Recherche en Informatique de Nancy)
- -- FRANCE
- */
- #include "finder.h"
- T0 *new(int id){
- int sz=s[id];
- T0 *n=malloc(sz);
- memset(n,0,sz);
- n->id=id;
- return n;
- }
- T0* rT26get_environment_variable(T26 *C,T0* a1){
- T0* R=NULL;
- rT7extend((T7*)a1,'\0');
- R=((T0 *)getenv(((T7 *)a1)->_storage));
- if (R) R=((T0 *)e2s((char *)R));
- rT7remove_last((T7*)a1,1);
- return R;
- }
- int ofBC27directory_separator=0;
- T3 oRBC27directory_separator;
- char rT26directory_separator(T26 *C){
- char R='\0';
- if (ofBC27directory_separator==0){
- ofBC27directory_separator=1;
- R=rT7last((T7*)rT26small_eiffel_directory(C));
- oRBC27directory_separator=R;}
- return oRBC27directory_separator;}
- void rT26die_with_code(T26 *C,int a1){
- exit(a1);
- }
- T0*oRBC27hlp_file_name;
- void rT26add_directory(T26 *C,T0* a1,T0* a2){
- rT7append((T7*)a1,a2);
- rT7extend((T7*)a1,rT26directory_separator(C));
- }
- void rT26print_hlp(T26 *C,T0* a1){
- rT7copy((T7*)oRBC27hlp_file_name,rT26small_eiffel_directory(C));
- rT26add_directory(C,oRBC27hlp_file_name,(T0 *)ms21);
- rT7append((T7*)oRBC27hlp_file_name,a1);
- /*IF*/if (!(rT7has_suffix((T7*)oRBC27hlp_file_name,(T0 *)ms22))) {
- rT7append((T7*)oRBC27hlp_file_name,(T0 *)ms22);
- }
- /*FI*//*IF*/if (!(rT26file_exists(C,oRBC27hlp_file_name))) {
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms24);
- rT32put_string((T32*)oRBC1std_error,oRBC27hlp_file_name);
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms25);
- rT26die_with_code(C,1);
- }
- /*FI*/rT38append_file((T38*)oRBC1std_output,oRBC27hlp_file_name);
- }
- T0*oRBC1std_error;
- T0* rT26clone(T26 *C,T0* a1){
- T0* R=NULL;
- /*IF*/if (((int)a1)) {
- R=(T0 *)new(a1->id);
- AF_1
- XrT28copy(R,a1);
- AF_0
- }
- /*FI*/return R;
- }
- T0*oRBC27small_eiffel;
- T0*oRBC1std_output;
- int ofBC27small_eiffel_directory=0;
- T0*oRBC27small_eiffel_directory;
- T0* rT26small_eiffel_directory(T26 *C){
- T0* R=NULL;
- char _slash='\0';
- int _i=0;
- if (ofBC27small_eiffel_directory==0){
- ofBC27small_eiffel_directory=1;
- R=rT26get_environment_variable(C,(T0 *)ms14);
- /*IF*/if (!(R)) {
- R=rT26clone(C,(T0 *)ms14);
- rT7to_upper((T7*)R);
- R=rT26get_environment_variable(C,R);
- /*IF*/if (((int)R)) {
- rT7to_upper((T7*)(T0 *)ms14);
- }
- /*FI*/}
- /*FI*//*IF*/if (!(R)) {
- R=(T0 *)ms20;
- }
- /*FI*/_i=((T7*)R)->_count;
- while (!((_i)<(0))) {
- _slash=rT7item((T7*)R,_i);
- /*IF*/if ((rT3is_letter(_slash))||(rT3is_digit(_slash))) {
- _i=(_i)-(1);
- }
- else {
- _i=-(1);
- }
- /*FI*/}
- /*IF*/if ((_i)==(0)) {
- rT7extend((T7*)R,'\57');
- }
- else if (!((rT7last((T7*)R))==(_slash))) {
- rT7extend((T7*)R,_slash);
- }
- /*FI*/oRBC27small_eiffel_directory=R;}
- return oRBC27small_eiffel_directory;}
- void rT26copy(T26 *C,T0 * a1){
- /*IF*//*AF*//*AE*/
- memcpy(C,a1,s[C->id]);
- /*FI*/}
- void rT26make(T26 *C){
- T0* _file_name=NULL;
- T0* _class_name=NULL;
- /*IF*/if ((argument_count)!=(1)) {
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms5);
- rT26print_hlp(C,(T0 *)ms28);
- rT26die_with_code(C,1);
- }
- /*FI*/_class_name=argument[1];
- _file_name=rT40find_path_for((T40*)oRBC27small_eiffel,_class_name);
- /*IF*/if (!(_file_name)) {
- rT38put_string((T38*)oRBC1std_output,_class_name);
- rT38put_string((T38*)oRBC1std_output,(T0 *)ms61);
- rT26die_with_code(C,1);
- }
- else {
- rT38put_string((T38*)oRBC1std_output,_file_name);
- rT38put_character((T38*)oRBC1std_output,'\12');
- }
- /*FI*/}
- int rT26file_exists(T26 *C,T0* a1){
- int R=0;
- rT7extend((T7*)a1,'\0');
- {FILE *f=fopen(((T7 *)a1)->_storage,"r");
- R=(f != NULL);
- fclose(f);}
- rT7remove_last((T7*)a1,1);
- return R;
- }
- void rT45resize(T45 *C,int a1){
- int _p=0;
- int _n=0;
- int _i=0;
- T0* _new_buc=NULL;
- int _hash=0;
- {T46 *n=((T46*)new(46));
- rT46make(n,0,(a1)-(1));
- _new_buc=(T0 *)n;}
- _i=0;
- while (!((_i)>=((C)->_modulus))) {
- _n=rT46item((T46*)(C)->_buckets,_i);
- while (!((_n)==(0))) {
- _p=rT46item((T46*)(C)->_chain,_n);
- _hash=(rT7hash_code((T7*)rT43item((T43*)(C)->_keys,_n)))%(a1);
- rT46put((T46*)(C)->_chain,rT46item((T46*)_new_buc,_hash),_n);
- rT46put((T46*)_new_buc,_n,_hash);
- _n=_p;
- }
- _i=(_i)+(1);
- }
- C->_buckets=_new_buc;
- C->_modulus=a1;
- C->_item_mem=0;
- }
- T0* rT45clone(T45 *C,T0* a1){
- T0* R=NULL;
- /*IF*/if (((int)a1)) {
- R=(T0 *)new(a1->id);
- AF_1
- XrT28copy(R,a1);
- AF_0
- }
- /*FI*/return R;
- }
- T0* rT45at(T45 *C,T0* a1){
- T0* R=NULL;
- int _foo=0;
- _foo=rT45has(C,a1);
- R=rT43item((T43*)(C)->_store,(C)->_has_mem);
- return R;
- }
- void rT45put(T45 *C,T0* a1,T0* a2){
- int _hash=0;
- _hash=(rT7hash_code((T7*)a2))%((C)->_modulus);
- /*IF*/if ((((C)->_has_mem)==(0))||(!(rT7is_equal((T7*)a2,rT43item((T43*)(C)->_keys,(C)->_has_mem))))) {
- C->_has_mem=rT46item((T46*)(C)->_buckets,_hash);
- while (!((((C)->_has_mem)==(0))||(rT7is_equal((T7*)a2,rT43item((T43*)(C)->_keys,(C)->_has_mem))))) {
- C->_has_mem=rT46item((T46*)(C)->_chain,(C)->_has_mem);
- }
- /*IF*/if (((C)->_has_mem)==(0)) {
- /*IF*/if (((C)->_count)>=(rT43count((T43*)(C)->_store))) {
- rT45expand(C);
- }
- /*FI*/rT43put((T43*)(C)->_keys,a2,(C)->_free);
- rT43put((T43*)(C)->_store,a1,(C)->_free);
- C->_has_mem=(C)->_free;
- C->_free=rT46item((T46*)(C)->_chain,(C)->_free);
- rT46put((T46*)(C)->_chain,rT46item((T46*)(C)->_buckets,_hash),(C)->_has_mem);
- rT46put((T46*)(C)->_buckets,(C)->_has_mem,_hash);
- C->_count=((C)->_count)+(1);
- /*IF*/if (((C)->_count)>(((C)->_modulus)*(2))) {
- rT45resize(C,(2)*((C)->_modulus));
- }
- /*FI*/}
- /*FI*/}
- else {
- rT43put((T43*)(C)->_store,a1,(C)->_has_mem);
- }
- /*FI*/C->_item_mem=0;
- }
- void rT45standard_copy(T45 *C,T0 * a1){
- memcpy(C,a1,s[a1->id]);
- }
- void rT45copy(T45 *C,T0 * a1){
- rT45standard_copy(C,a1);
- C->_keys=rT45clone(C,((T45*)a1)->_keys);
- C->_store=rT45clone(C,((T45*)a1)->_store);
- C->_buckets=rT45clone(C,((T45*)a1)->_buckets);
- C->_chain=rT45clone(C,((T45*)a1)->_chain);
- }
- void rT45expand(T45 *C){
- int _old_size=0;
- int _i=0;
- C->_item_mem=0;
- _old_size=rT43count((T43*)(C)->_store);
- rT46resize((T46*)(C)->_chain,1,(2)*(_old_size));
- rT43resize((T43*)(C)->_keys,1,(2)*(_old_size));
- rT43resize((T43*)(C)->_store,1,(2)*(_old_size));
- _i=(_old_size)+(1);
- while (!((_i)==(rT46count((T46*)(C)->_chain)))) {
- rT46put((T46*)(C)->_chain,(_i)+(1),_i);
- _i=(_i)+(1);
- }
- rT46put((T46*)(C)->_chain,(C)->_free,_i);
- C->_free=(_old_size)+(1);
- }
- int rT45has(T45 *C,T0* a1){
- int R=0;
- /*IF*/if ((((C)->_has_mem)==(0))||(!(rT7is_equal((T7*)a1,rT43item((T43*)(C)->_keys,(C)->_has_mem))))) {
- C->_has_mem=rT46item((T46*)(C)->_buckets,(rT7hash_code((T7*)a1))%((C)->_modulus));
- while (!((((C)->_has_mem)==(0))||(rT7is_equal((T7*)a1,rT43item((T43*)(C)->_keys,(C)->_has_mem))))) {
- C->_has_mem=rT46item((T46*)(C)->_chain,(C)->_has_mem);
- }
- }
- /*FI*/R=((C)->_has_mem)!=(0);
- return R;
- }
- void rT45make(T45 *C){
- int _i=0;
- C->_modulus=32;
- C->_count=0;
- C->_free=1;
- C->_has_mem=0;
- C->_item_mem=0;
- {T46 *n=((T46*)new(46));
- rT46make(n,0,((C)->_modulus)-(1));
- C->_buckets=(T0 *)n;}
- {T46 *n=((T46*)new(46));
- rT46make(n,1,16);
- C->_chain=(T0 *)n;}
- {T43 *n=((T43*)new(43));
- rT43make(n,1,16);
- C->_store=(T0 *)n;}
- {T43 *n=((T43*)new(43));
- rT43make(n,1,16);
- C->_keys=(T0 *)n;}
- _i=1;
- while (!((_i)==(rT46count((T46*)(C)->_chain)))) {
- rT46put((T46*)(C)->_chain,(_i)+(1),_i);
- _i=(_i)+(1);
- }
- rT46put((T46*)(C)->_chain,0,_i);
- _i=0;
- while (!((_i)>=((C)->_modulus))) {
- rT46put((T46*)(C)->_buckets,0,_i);
- _i=(_i)+(1);
- }
- }
- void rT32die_with_code(T32 *C,int a1){
- exit(a1);
- }
- void rT32put_string(T32 *C,T0* a1){
- int _i=0;
- _i=1;
- while (!((_i)>(((T7*)a1)->_count))) {
- rT32put_character(C,rT7_ix64((T7*)a1,_i));
- _i=(_i)+(1);
- }
- }
- void rT32crash(T32 *C){
- rsp();
- rT32die_with_code(C,1);
- }
- void rT32copy(T32 *C,T0 * a1){
- /*IF*//*AF*//*AE*/
- memcpy(C,a1,s[C->id]);
- /*FI*/}
- void rT32put_character(T32 *C,char a1){
- char _err='\0';
- _err=fputc(a1,(C)->_output_stream);
- /*IF*/if ((_err)!=(a1)) {
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms1);
- rT32crash(C);
- }
- /*FI*/}
- void rT32make(T32 *C){
- C->_output_stream=stderr;
- }
- int rT39end_of_input(T39 *C){
- int R=0;
- R=feof((FILE *)(C)->_input_stream);
- return R;
- }
- int rT39is_connected(T39 *C){
- int R=0;
- R=((int)(C)->_path);
- return R;
- }
- void rT39disconnect(T39 *C){
- int _err=0;
- _err=fclose((C)->_input_stream);
- C->_path=NULL;
- }
- T0*oRBC39last_string;
- char rT39last_character(T39 *C){
- char R='\0';
- R=(C)->_last_character_memory;
- return R;
- }
- void rT39connect_to(T39 *C,T0* a1){
- /*(IRF3*/((C)->_mode)=((T0 *)ms26);
- /*)*/C->_input_stream=rT39fopen(C,a1,(C)->_mode);
- /*IF*/{/*AT*/C->_path=a1;
- }
- /*FI*/}
- void rT39skip_separators(T39 *C){
- while (!((rT39end_of_input(C))||(!(rT3is_separator(rT39last_character(C)))))) {
- rT39read_character(C);
- }
- }
- void * rT39fopen(T39 *C,T0* a1,T0* a2){
- void * R=NULL;
- rT7extend((T7*)a1,'\0');
- rT7extend((T7*)a2,'\0');
- R=(T0 *)fopen(((Tstring *)a1)->_storage,((Tstring *)a2)->_storage);
- rT7remove_last((T7*)a1,1);
- rT7remove_last((T7*)a2,1);
- return R;
- }
- void rT39copy(T39 *C,T0 * a1){
- /*IF*//*AF*//*AE*/
- memcpy(C,a1,s[C->id]);
- /*FI*/}
- void rT39read_word(T39 *C){
- rT39skip_separators(C);
- /*(IRF3*/(((T7*)oRBC39last_string)->_count)=(0);
- /*)*/while (!((rT39end_of_input(C))||(rT3is_separator(rT39last_character(C))))) {
- rT7extend((T7*)oRBC39last_string,rT39last_character(C));
- rT39read_character(C);
- }
- }
- void rT39read_line_in(T39 *C,T0* a1){
- /*(IRF3*/(((T7*)a1)->_count)=(0);
- /*)*/rT39read_character(C);
- while (!((rT39end_of_input(C))||((rT39last_character(C))==('\12')))) {
- rT7extend((T7*)a1,rT39last_character(C));
- rT39read_character(C);
- }
- }
- void rT39read_line(T39 *C){
- rT39read_line_in(C,oRBC39last_string);
- }
- void rT39read_character(T39 *C){
- C->_last_character_memory=fgetc((C)->_input_stream);
- }
- char rT7_ix64(T7 *C,int a1){
- char R='\0';
- R=(C->_storage)[a1-1];
- return R;
- }
- int rT7hash_code(T7 *C){
- int R=0;
- int _i=0;
- _i=(C)->_count;
- /*IF*/if ((_i)>(5)) {
- _i=5;
- }
- /*FI*/while (!((_i)==(0))) {
- R=(R)+(((unsigned char)rT7item(C,_i)));
- _i=(_i)-(1);
- }
- return R;
- }
- void rT7extend(T7 *C,char a1){
- C->_count=((C)->_count)+(1);
- /*IF*/if (((C)->_capacity)<((C)->_count)) {
- /*IF*/if (((C)->_capacity)==(0)) {
- C->_capacity=16;
- C->_storage=(char *)malloc((size_t)C->_capacity);
- }
- else {
- C->_capacity=((C)->_capacity)+(16);
- C->_storage=(char *)realloc(C->_storage,(size_t)C->_capacity);
- }
- /*FI*/}
- /*FI*/rT7put(C,a1,(C)->_count);
- }
- void rT7to_upper(T7 *C){
- int _i=0;
- _i=(C)->_count;
- while (!((_i)==(0))) {
- rT7put(C,rT3to_upper(rT7item(C,_i)),_i);
- _i=(_i)-(1);
- }
- }
- void rT7remove_last(T7 *C,int a1){
- C->_count=((C)->_count)-(a1);
- }
- int rT7has_suffix(T7 *C,T0* a1){
- int R=0;
- int _i2=0;
- int _i1=0;
- /*IF*/if ((((T7*)a1)->_count)<=((C)->_count)) {
- _i1=(((C)->_count)-(((T7*)a1)->_count))+(1);
- _i2=1;
- while (!((((_i1)>((C)->_count))||((_i2)>(((T7*)a1)->_count)))||((rT7item(C,_i1))!=(rT7item((T7*)a1,_i2))))) {
- _i1=(_i1)+(1);
- _i2=(_i2)+(1);
- }
- R=(_i1)>((C)->_count);
- }
- /*FI*/return R;
- }
- int rT7empty(T7 *C){
- int R=0;
- R=((C)->_count)==(0);
- return R;
- }
- char rT7item(T7 *C,int a1){
- char R='\0';
- R=(C->_storage)[a1-1];
- return R;
- }
- int rT7is_equal(T7 *C,T0* a1){
- int R=0;
- int _i=0;
- /*IF*/if (((T0 *)C)==((T0 *)a1)) {
- R=1;
- }
- else {
- _i=(C)->_count;
- R=(_i)==(((T7*)a1)->_count);
- while (!((!(R))||((_i)==(0)))) {
- R=(rT7item(C,_i))==(rT7item((T7*)a1,_i));
- _i=(_i)-(1);
- }
- }
- /*FI*/return R;
- }
- void rT7append(T7 *C,T0* a1){
- int _i=0;
- _i=1;
- while (!((_i)>(((T7*)a1)->_count))) {
- rT7extend(C,rT7_ix64((T7*)a1,_i));
- _i=(_i)+(1);
- }
- }
- char rT7last(T7 *C){
- char R='\0';
- R=rT7item(C,(C)->_count);
- return R;
- }
- void rT7put(T7 *C,char a1,int a2){
- (C->_storage)[a2-1]=a1;
- }
- void rT7copy(T7 *C,T0* a1){
- int _i=0;
- _i=((T7*)a1)->_count;
- C->_count=_i;
- /*IF*/if ((_i)>(0)) {
- /*IF*/if (((C)->_capacity)<(_i)) {
- /*IF*/if (((C)->_capacity)==(0)) {
- C->_storage=(char *)malloc((size_t)_i);
- }
- else {
- C->_storage=(char *)realloc(C->_storage,(size_t)_i);
- }
- /*FI*/C->_capacity=_i;
- }
- /*FI*/while (!((_i)==(0))) {
- rT7put(C,rT7item((T7*)a1,_i),_i);
- _i=(_i)-(1);
- }
- }
- /*FI*/}
- void rT7prepend(T7 *C,T0* a1){
- int _old_count=0;
- int _i=0;
- _old_count=(C)->_count;
- _i=((T7*)a1)->_count;
- while (!((_i)==(0))) {
- rT7extend(C,'\40');
- _i=(_i)-(1);
- }
- _i=(C)->_count;
- while (!((_old_count)==(0))) {
- rT7put(C,rT7item(C,_old_count),_i);
- _i=(_i)-(1);
- _old_count=(_old_count)-(1);
- }
- _i=((T7*)a1)->_count;
- while (!((_i)==(0))) {
- rT7put(C,rT7_ix64((T7*)a1,_i),_i);
- _i=(_i)-(1);
- }
- }
- void rT7to_lower(T7 *C){
- int _i=0;
- _i=(C)->_count;
- while (!((_i)==(0))) {
- rT7put(C,rT3to_lower(rT7item(C,_i)),_i);
- _i=(_i)-(1);
- }
- }
- void rT7make(T7 *C,int a1){
- C->_count=0;
- /*IF*/if ((a1)>(0)) {
- /*IF*/if (((C)->_capacity)<(a1)) {
- /*IF*/if (((C)->_capacity)==(0)) {
- C->_storage=(char *)malloc((size_t)a1);
- }
- else {
- C->_storage=(char *)realloc(C->_storage,(size_t)a1);
- }
- /*FI*/C->_capacity=a1;
- }
- /*FI*/}
- /*FI*/}
- int rT2min(T2 C,int a1){
- int R=0;
- /*IF*/if ((C)<(a1)) {
- R=C;
- }
- else {
- R=a1;
- }
- /*FI*/return R;
- }
- int rT2max(T2 C,int a1){
- int R=0;
- /*IF*/if ((a1)<(C)) {
- R=C;
- }
- else {
- R=a1;
- }
- /*FI*/return R;
- }
- T0* rT40find_path_for(T40 *C,T0* a1){
- T0* R=NULL;
- int _i=0;
- rT7copy((T7*)(T0 *)ms29,a1);
- rT7to_lower((T7*)(T0 *)ms29);
- /*IF*/if (!(rT7has_suffix((T7*)(T0 *)ms29,(T0 *)ms30))) {
- rT7append((T7*)(T0 *)ms29,(T0 *)ms30);
- }
- /*FI*//*IF*/if (rT40file_exists(C,(T0 *)ms29)) {
- R=rT40clone(C,(T0 *)ms29);
- }
- else {
- _i=((T43*)rT40loading_path(C))->_lower;
- while (!(((_i)>(((T43*)rT40loading_path(C))->_upper))||(((int)R)))) {
- rT7copy((T7*)(T0 *)ms43,rT43item((T43*)rT40loading_path(C),_i));
- rT7append((T7*)(T0 *)ms43,(T0 *)ms29);
- /*IF*/if (rT40file_exists(C,(T0 *)ms43)) {
- R=rT40clone(C,(T0 *)ms43);
- }
- /*FI*/_i=(_i)+(1);
- }
- }
- /*FI*//*IF*/if ((!(R))&&(rT45has((T45*)rT40rename_dictionary(C),(T0 *)ms29))) {
- rT7copy((T7*)(T0 *)ms43,rT45at((T45*)rT40rename_dictionary(C),(T0 *)ms29));
- /*IF*/if (rT40file_exists(C,(T0 *)ms43)) {
- R=(T0 *)ms43;
- }
- else {
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms51);
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms43);
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms52);
- rT40die_with_code(C,1);
- }
- /*FI*/}
- /*FI*//*IF*/if (!(R)) {
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms53);
- rT32put_string((T32*)oRBC1std_error,a1);
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms54);
- /*(IRF3*/(((T7*)(T0 *)ms43)->_count)=(0);
- /*)*/rT40append_loading_path_in(C,(T0 *)ms43);
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms43);
- }
- /*FI*/return R;
- }
- T0* rT40get_environment_variable(T40 *C,T0* a1){
- T0* R=NULL;
- rT7extend((T7*)a1,'\0');
- R=((T0 *)getenv(((T7 *)a1)->_storage));
- if (R) R=((T0 *)e2s((char *)R));
- rT7remove_last((T7*)a1,1);
- return R;
- }
- char rT40directory_separator(T40 *C){
- char R='\0';
- if (ofBC27directory_separator==0){
- ofBC27directory_separator=1;
- R=rT7last((T7*)rT40small_eiffel_directory(C));
- oRBC27directory_separator=R;}
- return oRBC27directory_separator;}
- void rT40die_with_code(T40 *C,int a1){
- exit(a1);
- }
- int ofBC40loading_path=0;
- T0*oRBC40loading_path;
- T0* rT40loading_path(T40 *C){
- T0* R=NULL;
- T0 * _file=NULL;
- T0* _defaults=NULL;
- char _slash='\0';
- int _i=0;
- T0* _path=NULL;
- if (ofBC40loading_path==0){
- ofBC40loading_path=1;
- _path=(T0 *)ms31;
- {T43 *n=((T43*)new(43));
- rT43make(n,1,10);
- R=(T0 *)n;}
- rT43clear((T43*)R);
- _slash=rT40directory_separator(C);
- /*IF*/if (rT40file_exists(C,_path)) {
- {T39 *n=((T39*)new(39));
- /*(IRF3*/((n)->_mode)=((T0 *)ms26);
- /*)*/_file=(T0 *)n;}
- rT40open_read(C,_file,_path);
- while (!(rT39end_of_input((T39*)_file))) {
- rT39read_line((T39*)_file);
- _path=rT40clone(C,oRBC39last_string);
- /*IF*/if (!(rT7empty((T7*)_path))) {
- /*IF*/if ((rT7last((T7*)_path))!=(_slash)) {
- rT7extend((T7*)_path,_slash);
- }
- /*FI*/rT43add_last((T43*)R,_path);
- }
- /*FI*/}
- rT39disconnect((T39*)_file);
- }
- /*FI*/_defaults=ma(43,0,3,ms39,ms40,ms41);
- _i=1;
- while (!((_i)>(((T43*)_defaults)->_upper))) {
- _path=rT43item((T43*)_defaults,_i);
- rT7prepend((T7*)_path,rT40small_eiffel_directory(C));
- rT7extend((T7*)_path,_slash);
- rT43add_last((T43*)R,_path);
- _i=(_i)+(1);
- }
- oRBC40loading_path=R;}
- return oRBC40loading_path;}
- void rT40open_read(T40 *C,T0 * a1,T0* a2){
- rT39connect_to((T39*)a1,a2);
- /*IF*/if (!(rT39is_connected((T39*)a1))) {
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms35);
- rT32put_string((T32*)oRBC1std_error,a2);
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms36);
- rT40die_with_code(C,1);
- }
- /*FI*/}
- T0* rT40clone(T40 *C,T0* a1){
- T0* R=NULL;
- /*IF*/if (((int)a1)) {
- R=(T0 *)new(a1->id);
- AF_1
- XrT28copy(R,a1);
- AF_0
- }
- /*FI*/return R;
- }
- int ofBC40rename_dictionary=0;
- T0*oRBC40rename_dictionary;
- T0 * rT40rename_dictionary(T40 *C){
- T0 * R=NULL;
- T0* _short_name=NULL;
- T0* _full_name=NULL;
- int _i=0;
- if (ofBC40rename_dictionary==0){
- ofBC40rename_dictionary=1;
- {T45 *n=((T45*)new(45));
- rT45make(n);
- R=(T0 *)n;}
- _i=1;
- while (!((_i)>(((T43*)rT40loading_path(C))->_upper))) {
- rT7copy((T7*)(T0 *)ms43,rT43item((T43*)rT40loading_path(C),_i));
- rT7append((T7*)(T0 *)ms43,(T0 *)ms44);
- /*IF*/if (rT40file_exists(C,(T0 *)ms43)) {
- rT40open_read(C,rT40tmp_file_read(),(T0 *)ms43);
- while (!(rT39end_of_input((T39*)rT40tmp_file_read()))) {
- rT39read_word((T39*)rT40tmp_file_read());
- _full_name=rT40clone(C,oRBC39last_string);
- rT39read_word((T39*)rT40tmp_file_read());
- _short_name=rT40clone(C,oRBC39last_string);
- rT7prepend((T7*)_short_name,rT43item((T43*)rT40loading_path(C),_i));
- /*IF*/if (rT45has((T45*)R,_full_name)) {
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms45);
- rT32put_string((T32*)oRBC1std_error,_full_name);
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms46);
- rT32put_string((T32*)oRBC1std_error,_short_name);
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms47);
- rT32put_string((T32*)oRBC1std_error,rT45at((T45*)R,_full_name));
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms48);
- rT40die_with_code(C,1);
- }
- /*FI*/rT45put((T45*)R,_short_name,_full_name);
- rT39skip_separators((T39*)rT40tmp_file_read());
- }
- rT39disconnect((T39*)rT40tmp_file_read());
- }
- /*FI*/_i=(_i)+(1);
- }
- oRBC40rename_dictionary=R;}
- return oRBC40rename_dictionary;}
- void rT40append_loading_path_in(T40 *C,T0* a1){
- T0* _sed=NULL;
- int _i=0;
- rT7append((T7*)a1,(T0 *)ms55);
- _i=((T43*)rT40loading_path(C))->_lower;
- while (!((_i)>(((T43*)rT40loading_path(C))->_upper))) {
- rT7extend((T7*)a1,'\42');
- rT7append((T7*)a1,rT43item((T43*)rT40loading_path(C),_i));
- rT7extend((T7*)a1,'\42');
- rT7extend((T7*)a1,'\12');
- _i=(_i)+(1);
- }
- rT7append((T7*)a1,(T0 *)ms56);
- rT7append((T7*)a1,(T0 *)ms14);
- _sed=rT40get_environment_variable(C,(T0 *)ms14);
- rT7append((T7*)a1,(T0 *)ms57);
- /*IF*/if (!(_sed)) {
- rT7append((T7*)a1,(T0 *)ms58);
- }
- else {
- rT7append((T7*)a1,(T0 *)ms59);
- rT7append((T7*)a1,_sed);
- rT7append((T7*)a1,(T0 *)ms60);
- }
- /*FI*/rT7extend((T7*)a1,'\12');
- }
- int ofBC27tmp_file_read=0;
- T0*oRBC27tmp_file_read;
- T0 * rT40tmp_file_read(/*C*/void){
- T0 * R=NULL;
- if (ofBC27tmp_file_read==0){
- ofBC27tmp_file_read=1;
- {T39 *n=((T39*)new(39));
- /*(IRF3*/((n)->_mode)=((T0 *)ms26);
- /*)*/R=(T0 *)n;}
- oRBC27tmp_file_read=R;}
- return oRBC27tmp_file_read;}
- T0* rT40small_eiffel_directory(T40 *C){
- T0* R=NULL;
- char _slash='\0';
- int _i=0;
- if (ofBC27small_eiffel_directory==0){
- ofBC27small_eiffel_directory=1;
- R=rT40get_environment_variable(C,(T0 *)ms14);
- /*IF*/if (!(R)) {
- R=rT40clone(C,(T0 *)ms14);
- rT7to_upper((T7*)R);
- R=rT40get_environment_variable(C,R);
- /*IF*/if (((int)R)) {
- rT7to_upper((T7*)(T0 *)ms14);
- }
- /*FI*/}
- /*FI*//*IF*/if (!(R)) {
- R=(T0 *)ms20;
- }
- /*FI*/_i=((T7*)R)->_count;
- while (!((_i)<(0))) {
- _slash=rT7item((T7*)R,_i);
- /*IF*/if ((rT3is_letter(_slash))||(rT3is_digit(_slash))) {
- _i=(_i)-(1);
- }
- else {
- _i=-(1);
- }
- /*FI*/}
- /*IF*/if ((_i)==(0)) {
- rT7extend((T7*)R,'\57');
- }
- else if (!((rT7last((T7*)R))==(_slash))) {
- rT7extend((T7*)R,_slash);
- }
- /*FI*/oRBC27small_eiffel_directory=R;}
- return oRBC27small_eiffel_directory;}
- void rT40copy(T40 *C,T0 * a1){
- /*IF*//*AF*//*AE*/
- memcpy(C,a1,s[C->id]);
- /*FI*/}
- int rT40file_exists(T40 *C,T0* a1){
- int R=0;
- rT7extend((T7*)a1,'\0');
- {FILE *f=fopen(((T7 *)a1)->_storage,"r");
- R=(f != NULL);
- fclose(f);}
- rT7remove_last((T7*)a1,1);
- return R;
- }
- void rT38die_with_code(T38 *C,int a1){
- exit(a1);
- }
- void rT38put_string(T38 *C,T0* a1){
- int _i=0;
- _i=1;
- while (!((_i)>(((T7*)a1)->_count))) {
- rT38put_character(C,rT7_ix64((T7*)a1,_i));
- _i=(_i)+(1);
- }
- }
- void rT38crash(T38 *C){
- rsp();
- rT38die_with_code(C,1);
- }
- void rT38append_file(T38 *C,T0* a1){
- char _c='\0';
- rT39connect_to((T39*)rT38tmp_file_read(),a1);
- rT39read_character((T39*)rT38tmp_file_read());
- while (!(rT39end_of_input((T39*)rT38tmp_file_read()))) {
- _c=rT39last_character((T39*)rT38tmp_file_read());
- rT38put_character(C,_c);
- rT39read_character((T39*)rT38tmp_file_read());
- }
- rT39disconnect((T39*)rT38tmp_file_read());
- }
- int ofBC33tmp_file_read=0;
- T0*oRBC33tmp_file_read;
- T0 * rT38tmp_file_read(/*C*/void){
- T0 * R=NULL;
- if (ofBC33tmp_file_read==0){
- ofBC33tmp_file_read=1;
- {T39 *n=((T39*)new(39));
- /*(IRF3*/((n)->_mode)=((T0 *)ms26);
- /*)*/R=(T0 *)n;}
- oRBC33tmp_file_read=R;}
- return oRBC33tmp_file_read;}
- void rT38copy(T38 *C,T0 * a1){
- /*IF*//*AF*//*AE*/
- memcpy(C,a1,s[C->id]);
- /*FI*/}
- void rT38put_character(T38 *C,char a1){
- char _err='\0';
- _err=fputc(a1,(C)->_output_stream);
- /*IF*/if ((_err)!=(a1)) {
- rT32put_string((T32*)oRBC1std_error,(T0 *)ms1);
- rT38crash(C);
- }
- /*FI*/}
- void rT38make(T38 *C){
- C->_output_stream=stdout;
- }
- void rT46clear_all(T46 *C){
- int _value=0;
- rT46set_all_with(C,_value);
- }
- int rT46count(T46 *C){
- int R=0;
- R=(((C)->_upper)-((C)->_lower))+(1);
- return R;
- }
- void rT46set_all_with(T46 *C,int a1){
- int _i=0;
- _i=(C)->_upper;
- while (!((_i)<((C)->_lower))) {
- rT46put(C,a1,_i);
- _i=(_i)-(1);
- }
- }
- void rT46resize(T46 *C,int a1,int a2){
- int _up=0;
- int _i=0;
- T0* _other=NULL;
- {T46 *n=((T46*)new(46));
- rT46make(n,a1,a2);
- _other=(T0 *)n;}
- _i=rT2max((C)->_lower,((T46*)_other)->_lower);
- _up=rT2min((C)->_upper,((T46*)_other)->_upper);
- while (!((_i)>(_up))) {
- rT46put((T46*)_other,rT46item(C,_i),_i);
- _i=(_i)+(1);
- }
- /*IF*/{/*AT*/free(C->_storage);
- }
- /*FI*/memcpy(C,_other,sizeof(*C));free(_other);
- }
- int rT46item(T46 *C,int a1){
- int R=0;
- R=(C->_storage)[a1-(C->_lower)];
- return R;
- }
- void rT46put(T46 *C,int a1,int a2){
- (C->_storage)[a2-(C->_lower)]=a1;
- }
- void rT46copy(T46 *C,T0* a1){
- int _i=0;
- C->_upper=((C)->_lower)-(1);
- /*IF*/if (((C)->_capacity)==(0)) {
- rT46make(C,((T46*)a1)->_lower,((T46*)a1)->_upper);
- }
- else {
- rT46resize(C,((T46*)a1)->_lower,((T46*)a1)->_upper);
- }
- /*FI*/_i=(C)->_lower;
- while (!((_i)>((C)->_upper))) {
- rT46put(C,rT46item((T46*)a1,_i),_i);
- _i=(_i)+(1);
- }
- }
- void rT46make(T46 *C,int a1,int a2){
- /*IF*/{/*AT*/free(C->_storage);
- }
- /*FI*/C->_lower=a1;
- C->_upper=a2;
- C->_capacity=(((C)->_upper)-((C)->_lower))+(1);
- C->_storage=NULL;
- /*IF*/if (((C)->_capacity)>(0)) {
- C->_capacity=((C)->_capacity)+(16);
- C->_storage=malloc((size_t)((C->_capacity)*sizeof(*(C->_storage))));
- rT46clear_all(C);
- }
- /*FI*/}
- void rT43clear(T43 *C){
- C->_upper=((C)->_lower)-(1);
- }
- void rT43clear_all(T43 *C){
- T0* _value=NULL;
- rT43set_all_with(C,_value);
- }
- int rT43count(T43 *C){
- int R=0;
- R=(((C)->_upper)-((C)->_lower))+(1);
- return R;
- }
- void rT43set_all_with(T43 *C,T0* a1){
- int _i=0;
- _i=(C)->_upper;
- while (!((_i)<((C)->_lower))) {
- rT43put(C,a1,_i);
- _i=(_i)-(1);
- }
- }
- void rT43resize(T43 *C,int a1,int a2){
- int _up=0;
- int _i=0;
- T0* _other=NULL;
- {T43 *n=((T43*)new(43));
- rT43make(n,a1,a2);
- _other=(T0 *)n;}
- _i=rT2max((C)->_lower,((T43*)_other)->_lower);
- _up=rT2min((C)->_upper,((T43*)_other)->_upper);
- while (!((_i)>(_up))) {
- rT43put((T43*)_other,rT43item(C,_i),_i);
- _i=(_i)+(1);
- }
- /*IF*/{/*AT*/free(C->_storage);
- }
- /*FI*/memcpy(C,_other,sizeof(*C));free(_other);
- }
- T0* rT43item(T43 *C,int a1){
- T0* R=NULL;
- R=(C->_storage)[a1-(C->_lower)];
- return R;
- }
- void rT43add_last(T43 *C,T0* a1){
- /*IF*/if (((C)->_capacity)<((rT43count(C))+(1))) {
- C->_capacity=((C)->_capacity)+(16);
- /*IF*/if (((C)->_capacity)==(16)) {
- C->_storage=malloc(16*sizeof(*(C->_storage)));
- }
- else {
- C->_storage=realloc(C->_storage,((C->_capacity)*sizeof(*(C->_storage))));
- }
- /*FI*/}
- /*FI*/C->_upper=((C)->_upper)+(1);
- rT43put(C,a1,(C)->_upper);
- }
- void rT43put(T43 *C,T0* a1,int a2){
- (C->_storage)[a2-(C->_lower)]=a1;
- }
- void rT43copy(T43 *C,T0* a1){
- int _i=0;
- C->_upper=((C)->_lower)-(1);
- /*IF*/if (((C)->_capacity)==(0)) {
- rT43make(C,((T43*)a1)->_lower,((T43*)a1)->_upper);
- }
- else {
- rT43resize(C,((T43*)a1)->_lower,((T43*)a1)->_upper);
- }
- /*FI*/_i=(C)->_lower;
- while (!((_i)>((C)->_upper))) {
- rT43put(C,rT43item((T43*)a1,_i),_i);
- _i=(_i)+(1);
- }
- }
- void rT43make(T43 *C,int a1,int a2){
- /*IF*/{/*AT*/free(C->_storage);
- }
- /*FI*/C->_lower=a1;
- C->_upper=a2;
- C->_capacity=(((C)->_upper)-((C)->_lower))+(1);
- C->_storage=NULL;
- /*IF*/if (((C)->_capacity)>(0)) {
- C->_capacity=((C)->_capacity)+(16);
- C->_storage=malloc((size_t)((C->_capacity)*sizeof(*(C->_storage))));
- rT43clear_all(C);
- }
- /*FI*/}
- char rT3to_upper(T3 C){
- char R='\0';
- /*IF*/if ((((unsigned char)C))<(97)) {
- R=C;
- }
- else if ((((unsigned char)C))>(122)) {
- R=C;
- }
- else {
- R=(((unsigned char)C))-(32);
- }
- /*FI*/return R;
- }
- int rT3is_digit(T3 C){
- int R=0;
- {int iv1=C;
- if ((48 <= iv1) && (iv1<= 57)) goto l2;
- goto l3;
- l2: ;
- R=1;
- goto l1;
- l3: ;
- l1: ;
- }
- return R;
- }
- int rT3is_letter(T3 C){
- int R=0;
- {int iv1=C;
- if ((65 <= iv1) && (iv1<= 90)) goto l5;
- if ((97 <= iv1) && (iv1<= 122)) goto l5;
- goto l6;
- l5: ;
- R=1;
- goto l4;
- l6: ;
- l4: ;
- }
- return R;
- }
- int rT3is_separator(T3 C){
- int R=0;
- {int iv1=C;
- if (0 == iv1) goto l8;
- if ((9 <= iv1) && (iv1<= 10)) goto l8;
- if (13 == iv1) goto l8;
- if (32 == iv1) goto l8;
- goto l9;
- l8: ;
- R=1;
- goto l7;
- l9: ;
- l7: ;
- }
- return R;
- }
- char rT3to_lower(T3 C){
- char R='\0';
- /*IF*/if ((((unsigned char)C))<(65)) {
- R=C;
- }
- else if ((((unsigned char)C))>(90)) {
- R=C;
- }
- else {
- R=(((unsigned char)C))+(32);
- }
- /*FI*/return R;
- }
- int argument_count;
- T0 **argument;
- void main(int argc, char *argv[]) {initialize();{T26 *n=((T26*)new(26));
- int i;
- argument_count = argc - 1;
- argument = (T0 **)malloc(sizeof(Tstring *)*argc);
- for (i = 0; i < argc ; i++)
- argument[i] = (T0 *)e2s(argv[i]);
- signal(SIGINT,sigrsp);
- signal(SIGQUIT,sigrsp);
- signal(SIGKILL,sigrsp);
- ms1=e2s("Error while writing character.");
- ms5=e2s("Bad use of command `finder\'.\n");
- ms14=e2s("SmallEiffel");
- ms17=e2s("C=a1;");
- ms18=e2s("memcpy(C,a1,s[C->id]);");
- ms20=e2s("/usr/local/logiciel/SmallEiffel");
- ms21=e2s("man");
- ms22=e2s(".hlp");
- ms24=e2s("Unable to find help file \"");
- ms25=e2s("\".\n");
- ms26=e2s("r");
- ms28=e2s("finder");
- ms29=e2s(" ");
- ms30=e2s(".e");
- ms31=e2s("loadpath.se");
- ms35=e2s("Cannot read file \"");
- ms36=e2s("\".\n");
- ms39=e2s("lib_std");
- ms40=e2s("lib_show");
- ms41=e2s("lib_test");
- ms43=e2s(" ");
- ms44=e2s("rename.se");
- ms45=e2s("Multiple entry for \"");
- ms46=e2s("\" in \"rename.se\" files.\nClash for \n\"");
- ms47=e2s("\" and \n\"");
- ms48=e2s(".\n");
- ms51=e2s("Bad \"rename.se\" file.\nCannot open \"");
- ms52=e2s("\".");
- ms53=e2s("Unable to find file for class \"");
- ms54=e2s("\". ");
- ms55=e2s("\nLoading path is :\n");
- ms56=e2s("Environment Variable \"");
- ms57=e2s("\" is\n");
- ms58=e2s("not set. ");
- ms59=e2s("set to \"");
- ms60=e2s("\". ");
- ms61=e2s(": not found.\n");
- {T0 *R;
- {T32 *n=((T32*)new(32));
- rT32make(n);
- R=(T0 *)n;}
- oRBC1std_error=R;}/*PCO*/
- {T0 *R;
- {T7 *n=((T7*)new(7));
- rT7make(n,256);
- R=(T0 *)n;}
- oRBC39last_string=R;}/*PCO*/
- {T0 *R;
- {T38 *n=((T38*)new(38));
- rT38make(n);
- R=(T0 *)n;}
- oRBC1std_output=R;}/*PCO*/
- {T0 *R;
- {T40 *n=((T40*)new(40));
- /*(IRF3*//*)*/R=(T0 *)n;}
- oRBC27small_eiffel=R;}/*PCO*/
- {T0 *R;
- {T7 *n=((T7*)new(7));
- rT7make(n,256);
- R=(T0 *)n;}
- oRBC27hlp_file_name=R;}/*PCO*/
- rT26make(n);
- exit(0);}}
- char *s2e(Tstring *s){
- char *e = (char *)malloc((s->_count)+1);
- memcpy(e,s->_storage,s->_count);
- e[s->_count] = '\0';
- return e;
- }
- Tstring *e2s(char *e){
- Tstring *s = (Tstring *)new(stringId);
- if (e != NULL) {
- s->_capacity = strlen(e) + 1;
- s->_count = (s->_capacity) - 1;
- s->_storage = (char *)malloc(sizeof(char)*s->_capacity);
- strcpy(s->_storage,e);}
- return s;
- }
- T0 *ma(int aid,int eid,int argc,...){
- va_list pa;
- Tarray *a=((Tarray *)new(aid));
- char *store=0;
- a->_capacity=argc;
- a->_lower=1;
- a->_upper=argc;
- a->_storage=0;
- if (argc) {va_start(pa,argc);
- if (eid) store=(char *)malloc(argc*(s[eid]));
- else store=(char *)malloc(argc*(sizeof(T0*)));
- a->_storage=(T0 **)store;
- switch (eid){
- case 0:
- while (argc--){*((T0 **)store)=va_arg(pa,T0 *);
- store+=sizeof(T0 *);}break;
- case 2:case 6:
- while (argc--){*((int *)store)=va_arg(pa,int);
- store+=sizeof(int);}break;
- case 3:
- while (argc--){*((char *)store)=((char)va_arg(pa,int));
- store+=sizeof(char);}break;
- case 4:
- while (argc--){*((float *)store)=va_arg(pa,double);
- store+=sizeof(float);}break;
- case 5:
- while (argc--){*((double *)store)=va_arg(pa,double);
- store+=sizeof(double);}break;
- while (argc--){
- memcpy(*((T0 **)va_arg(pa,T0 *)),store,s[eid]);
- store+=s[eid];}}
- va_end(pa);}
- return (T0 *)a;
- }
- Tstring *ms1;
- Tstring *ms5;
- Tstring *ms14;
- Tstring *ms17;
- Tstring *ms18;
- Tstring *ms20;
- Tstring *ms21;
- Tstring *ms22;
- Tstring *ms24;
- Tstring *ms25;
- Tstring *ms26;
- Tstring *ms28;
- Tstring *ms29;
- Tstring *ms30;
- Tstring *ms31;
- Tstring *ms35;
- Tstring *ms36;
- Tstring *ms39;
- Tstring *ms40;
- Tstring *ms41;
- Tstring *ms43;
- Tstring *ms44;
- Tstring *ms45;
- Tstring *ms46;
- Tstring *ms47;
- Tstring *ms48;
- Tstring *ms51;
- Tstring *ms52;
- Tstring *ms53;
- Tstring *ms54;
- Tstring *ms55;
- Tstring *ms56;
- Tstring *ms57;
- Tstring *ms58;
- Tstring *ms59;
- Tstring *ms60;
- Tstring *ms61;
- void rsp(void){
- printf("Eiffel program crash at run time.\n");
- printf("No trace when using option \"-boost\"\n");
- exit(1);
- }
- void sigrsp(int sig){
- printf("Received signal %d (man signal).\n",sig);
- rsp();
- exit(1);
- }
- void XrT28copy(void *C,T0* a1){
- int id=((T0 *)C)->id;
- if (id <= 39) {
- if (id <= 32) {
- if (id <= 26) {
- if (id <= 7) {
- rT7copy((T7 *)C,a1);
- } else {
- rT26copy((T26 *)C,a1);
- }} else {
- rT32copy((T32 *)C,a1);
- }} else {
- if (id <= 38) {
- rT38copy((T38 *)C,a1);
- } else {
- rT39copy((T39 *)C,a1);
- }}} else {
- if (id <= 43) {
- if (id <= 40) {
- rT40copy((T40 *)C,a1);
- } else {
- rT43copy((T43 *)C,a1);
- }} else {
- if (id <= 45) {
- rT45copy((T45 *)C,a1);
- } else {
- rT46copy((T46 *)C,a1);
- }}}}
- size_t s[47];
- Tstring * gt[47];
- Tstring * g[47];
- char * p[47];
- void initialize(void){
- s[26]=sizeof(T26);
- s[8]=sizeof(T8);
- s[45]=sizeof(T45);
- s[32]=sizeof(T32);
- s[39]=sizeof(T39);
- s[7]=sizeof(T7);
- s[6]=sizeof(T6);
- s[2]=sizeof(T2);
- s[40]=sizeof(T40);
- s[38]=sizeof(T38);
- s[46]=sizeof(T46);
- s[43]=sizeof(T43);
- s[3]=sizeof(T3);
- }
-