ftp.nice.ch/pub/next/developer/languages/eiffel/SmallEiffel.0.91.N.bs.tar.gz#/SmallEiffel/bin_c/compile2.c

This is compile2.c in view mode; [Download] [Up]

/* ANSI C code generated by SmallEiffel. */
/*
-- SmallEiffel  -- Release (- 0.91)    --      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 "compile.h"
/*BOOLEAN*/int rT6_ix111114(T6 C,int a1){
int R=0;
R=(C)||(a1);
return R;
}
/*BOOLEAN*/int rT6_px110111116(T6 C){
int R=0;
/*IF*/if (C) {
}
else {
R=1;
}
/*FI*/return R;
}
/*INTEGER*/char rT2digit(T2 C){
char R=0;
R=rT7item(ms1_2,(C)+(1));
return R;
}
/*INTEGER*/void rT2append_in(T2 C,T0* a1){
int _i=0;
int _val=0;
/*IF*/if ((C)==(0)) {
rT7extend((T7*)a1,'0');
}
else {
/*IF*/if ((C)<(0)) {
rT7extend((T7*)a1,'\55');
rT2append_in(-(C),a1);
}
else {
_i=(((T7*)a1)->_count)+(1);
_val=C;
while (!((_val)==(0))) {
rT7extend((T7*)a1,rT2digit((_val)%(10)));
_val=(_val)/(10);
}
_val=((T7*)a1)->_count;
while (!((_i)>=(_val))) {
rT7swap((T7*)a1,_i,_val);
_val=(_val)-(1);
_i=(_i)+(1);
}
}
/*FI*/}
/*FI*/}T0*oRBC26tmp_string;
/*COMPILE*/T0* rT26get_environment_variable(/*C*/T0* a1){
T0* R=NULL;
void * _p=0;
_p=rT7to_external((T7*)a1);
_p=((void*)getenv((char*)_p));
/*IF*/if (((int)_p)) {
R=(T0*)e2s((char*)_p);
}
/*FI*/return R;
}
int ofBC27x_suffix=0;
T0*oRBC27x_suffix;
/*COMPILE*/T0* rT26x_suffix(/*C*/void){
if (ofBC27x_suffix==0){
T0* R=NULL;
ofBC27x_suffix=1;
/*IF*/if (((T0 *)(T0 *)ms15_27)==((T0 *)rT26system_name())) {
R=(T0 *)ms28_27;
}
 else if (((T0 *)(T0 *)ms16_27)==((T0 *)rT26system_name())) {
R=(T0 *)ms29_27;
}
else {
R=(T0 *)ms30_27;
}
/*FI*/oRBC27x_suffix=R;}
return oRBC27x_suffix;}
/*COMPILE*/void rT26automat(T26 *C){
T0* _a=NULL;
int _arg=0;
int _state=0;
_arg=1;
while (!(((_arg)>(/*(IRF4*/((T34*)oRBC1command_arguments)->_upper/*)*/))||((_state)>(2)))) {
_a=rT26argument(_arg);
/*IF*/if (rT7is_equal(ms15_26,_a)) {
C->_c_code=1;
}
else {
rT7extend((T7*)oRBC26tmp_string,'\40');
rT7append((T7*)oRBC26tmp_string,_a);
{int iv1=_state;
if (0 == iv1) goto l2;
goto l3;
 l2: ;
/*IF*/if ((rT7item((T7*)_a,1))!=('\55')) {
/*IF*/if (rT7has_suffix((T7*)_a,(T0 *)ms27_27)) {
}
 else if (rT7has_suffix((T7*)_a,(T0 *)ms25_27)) {
}
 else if (!((C)->_root)) {
C->_root=rT26to_bcn(_a);
rT7to_lower((T7*)(C)->_root);
_state=2;
}
/*FI*/}
 else if (rT7is_equal(ms16_26,_a)) {
_state=1;
}
/*FI*/goto l1;
 l3: ;
if (1 == iv1) goto l4;
goto l5;
 l4: ;
_state=0;
goto l1;
 l5: ;
if (2 == iv1) goto l6;
goto l7;
 l6: ;
_state=0;
goto l1;
 l7: ;
 l1: ;
}
}
/*FI*/_arg=(_arg)+(1);
}
}/*COMPILE*/T0* rT26to_bcn(/*C*/T0* a1){
T0* R=NULL;
char _c=0;
int _i=0;
R=rT7twin((T7*)a1);
/*IF*/if (rT7has_suffix((T7*)R,(T0 *)ms24_27)) {
rT7remove_last((T7*)R,2);
}
/*FI*/_i=((T7*)R)->_count;
while (!((_i)==(0))) {
_c=rT7item((T7*)R,_i);
/*IF*/if (rT3is_letter(_c)) {
_i=(_i)-(1);
}
 else if ((_c)==('\137')) {
_i=(_i)-(1);
}
 else if (rT3is_digit(_c)) {
_i=(_i)-(1);
}
else {
rT7remove_first((T7*)R,_i);
_i=0;
}
/*FI*/}
rT7to_upper((T7*)R);
return R;
}
int ofBC27directory_separator=0;
T3 oRBC27directory_separator;
/*COMPILE*/char rT26directory_separator(/*C*/void){
if (ofBC27directory_separator==0){
char R=0;
ofBC27directory_separator=1;
R=rT7last((T7*)rT26small_eiffel_directory());
oRBC27directory_separator=R;}
return oRBC27directory_separator;}
/*COMPILE*/void rT26die_with_code(/*C*/int a1){
exit(a1);
}/*COMPILE*/void rT26remove_file(/*C*/T0* a1){
void * _p=0;
_p=rT7to_external((T7*)a1);
remove(((char*)_p));
}T0*oRBC27hlp_file_name;
/*COMPILE*/void rT26add_directory(/*C*/T0* a1,T0* a2){
rT7append((T7*)a1,a2);
rT7extend((T7*)a1,rT26directory_separator());
}/*COMPILE*/void rT26print_hlp(/*C*/T0* a1){
rT7copy((T7*)oRBC27hlp_file_name,rT26small_eiffel_directory());
rT26add_directory(oRBC27hlp_file_name,(T0 *)ms2_27);
rT7append((T7*)oRBC27hlp_file_name,a1);
/*IF*/if (!(rT7has_suffix((T7*)oRBC27hlp_file_name,(T0 *)ms35_27))) {
rT7append((T7*)oRBC27hlp_file_name,(T0 *)ms35_27);
}
/*FI*//*IF*/if (!(rT26file_exists(oRBC27hlp_file_name))) {
rT38put_string((T38*)oRBC1std_error,(T0 *)ms3_27);
rT38put_string((T38*)oRBC1std_error,oRBC27hlp_file_name);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms4_27);
rT26die_with_code(1);
}
/*FI*/rT42append_file((T42*)oRBC1std_output,oRBC27hlp_file_name);
}T0*oRBC1command_arguments;
/*COMPILE*/void rT26open_read(/*C*/T0* a1,T0* a2){
rT43connect_to((T43*)a1,a2);
/*IF*/if (!(rT43is_connected((T43*)a1))) {
rT38put_string((T38*)oRBC1std_error,(T0 *)ms7_27);
rT38put_string((T38*)oRBC1std_error,a2);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms8_27);
rT26die_with_code(1);
}
/*FI*/}T0*oRBC27tmp_file_read;
/*COMPILE*/void rT26system(/*C*/T0* a1){
void * _p=0;
_p=rT7to_external((T7*)a1);
system(((char*)_p));
}T0*oRBC27system_list;
int ofBC27system_name=0;
T0*oRBC27system_name;
/*COMPILE*/T0* rT26system_name(/*C*/void){
if (ofBC27system_name==0){
T0* R=NULL;
int _i=0;
T0* _path=NULL;
ofBC27system_name=1;
_path=rT7twin((T7*)rT26small_eiffel_directory());
rT26add_directory(_path,(T0 *)ms18_27);
rT7append((T7*)_path,(T0 *)ms19_27);
/*IF*/if (!(rT26file_exists(_path))) {
rT38put_string((T38*)oRBC1std_error,(T0 *)ms20_27);
rT38put_string((T38*)oRBC1std_error,_path);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms21_27);
rT26die_with_code(1);
}
/*FI*/rT26open_read(oRBC27tmp_file_read,_path);
rT43read_word((T43*)oRBC27tmp_file_read);
R=oRBC43last_string;
_i=rT44index_of((T44*)oRBC27system_list,R);
rT43disconnect((T43*)oRBC27tmp_file_read);
/*IF*/if ((_i)>(((T44*)oRBC27system_list)->_upper)) {
rT38put_string((T38*)oRBC1std_error,(T0 *)ms22_27);
rT38put_string((T38*)oRBC1std_error,_path);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms23_27);
_i=1;
while (!((_i)>(((T44*)oRBC27system_list)->_upper))) {
rT38put_string((T38*)oRBC1std_error,rT44item((T44*)oRBC27system_list,_i));
rT38put_character((T38*)oRBC1std_error,'\12');
_i=(_i)+(1);
}
}
else {
R=rT44item((T44*)oRBC27system_list,_i);
}
/*FI*/oRBC27system_name=R;}
return oRBC27system_name;}
T0*oRBC1std_output;
int ofBC27small_eiffel_directory=0;
T0*oRBC27small_eiffel_directory;
/*COMPILE*/T0* rT26small_eiffel_directory(/*C*/void){
if (ofBC27small_eiffel_directory==0){
T0* R=NULL;
char _slash=0;
int _i=0;
ofBC27small_eiffel_directory=1;
R=rT26get_environment_variable((T0 *)ms124_27);
/*IF*/if (!(R)) {
R=rT7twin((T7*)(T0 *)ms124_27);
rT7to_upper((T7*)R);
R=rT26get_environment_variable(R);
/*IF*/if (((int)R)) {
rT7to_upper((T7*)(T0 *)ms124_27);
}
/*FI*/}
/*FI*//*IF*/if (!(R)) {
R=(T0 *)ms1_27;
}
/*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;}
/*COMPILE*/T0* rT26argument(/*C*/int a1){
T0* R=NULL;
R=rT34item((T34*)oRBC1command_arguments,a1);
return R;
}
T0*oRBC26make_file;
int ofBC27make_suffix=0;
T0*oRBC27make_suffix;
/*COMPILE*/T0* rT26make_suffix(/*C*/void){
if (ofBC27make_suffix==0){
T0* R=NULL;
ofBC27make_suffix=1;
/*IF*/if (((T0 *)(T0 *)ms15_27)==((T0 *)rT26system_name())) {
R=(T0 *)ms31_27;
}
 else if (((T0 *)(T0 *)ms16_27)==((T0 *)rT26system_name())) {
R=(T0 *)ms32_27;
}
else {
R=(T0 *)ms33_27;
}
/*FI*/oRBC27make_suffix=R;}
return oRBC27make_suffix;}
/*COMPILE*/void rT26echo_remove_file(/*C*/T0* a1){
/*IF*/if (rT26file_exists(a1)) {
rT42put_string((T42*)oRBC1std_output,(T0 *)ms127_27);
rT42put_string((T42*)oRBC1std_output,a1);
rT42put_string((T42*)oRBC1std_output,(T0 *)ms128_27);
rT26remove_file(a1);
}
/*FI*/}/*COMPILE*/void rT26make(T26 *C){
int _i=0;
T0* _str=NULL;
/*IF*/if ((/*(IRF4*/((T34*)oRBC1command_arguments)->_upper/*)*/)<(2)) {
rT38put_string((T38*)oRBC1std_error,(T0 *)ms1_26);
rT26print_hlp((T0 *)ms2_26);
rT26die_with_code(1);
}
/*FI*/rT7copy((T7*)oRBC26tmp_string,rT26small_eiffel_directory());
rT26add_directory(oRBC26tmp_string,(T0 *)ms3_26);
rT7append((T7*)oRBC26tmp_string,(T0 *)ms4_26);
rT7append((T7*)oRBC26tmp_string,rT26x_suffix());
/*IF*/if (!(rT26file_exists(oRBC26tmp_string))) {
rT38put_string((T38*)oRBC1std_error,(T0 *)ms5_26);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms6_26);
rT38put_string((T38*)oRBC1std_error,oRBC26tmp_string);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms7_26);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms124_27);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms8_26);
rT26die_with_code(1);
}
/*FI*/rT26automat(C);
_str=rT7twin((T7*)(C)->_root);
rT7append((T7*)_str,rT26make_suffix());
rT26echo_remove_file(_str);
/*[IRF3:echo_system*/rT42put_string((T42*)oRBC1std_output,oRBC26tmp_string);
rT42put_character((T42*)oRBC1std_output,'\12');
rT26system(oRBC26tmp_string);
/*]*/
/*IF*/if (!(rT26file_exists(_str))) {
rT38put_string((T38*)oRBC1std_error,(T0 *)ms9_26);
rT38put_string((T38*)oRBC1std_error,_str);
rT38put_string((T38*)oRBC1std_error,(T0 *)ms10_26);
rT26die_with_code(1);
}
/*FI*/rT42put_string((T42*)oRBC1std_output,(T0 *)ms11_26);
rT42put_string((T42*)oRBC1std_output,_str);
rT42put_string((T42*)oRBC1std_output,(T0 *)ms12_26);
rT26open_read(oRBC26make_file,_str);
rT43read_line((T43*)oRBC26make_file);
while (!(rT43end_of_input((T43*)oRBC26make_file))) {
rT7copy((T7*)oRBC26tmp_string,oRBC43last_string);
/*[IRF3:echo_system*/rT42put_string((T42*)oRBC1std_output,oRBC26tmp_string);
rT42put_character((T42*)oRBC1std_output,'\12');
rT26system(oRBC26tmp_string);
/*]*/
rT43read_line((T43*)oRBC26make_file);
}
rT43disconnect((T43*)oRBC26make_file);
/*IF*/if ((C)->_c_code) {
rT42put_string((T42*)oRBC1std_output,(T0 *)ms13_26);
}
else {
_i=1;
while (!((_i)==(0))) {
/*[IRF3:clear*//*AW*/((T7*)oRBC26tmp_string)->_count=(0);/*]*/
rT7append((T7*)oRBC26tmp_string,(C)->_root);
rT2append_in(_i,oRBC26tmp_string);
rT7append((T7*)oRBC26tmp_string,(T0 *)ms25_27);
/*IF*/if (rT26file_exists(oRBC26tmp_string)) {
rT26echo_remove_file(oRBC26tmp_string);
rT7remove_suffix((T7*)oRBC26tmp_string,(T0 *)ms25_27);
rT7append((T7*)oRBC26tmp_string,(T0 *)ms27_27);
rT26echo_remove_file(oRBC26tmp_string);
_i=(_i)+(1);
}
else {
_i=0;
}
/*FI*/}
rT7copy((T7*)oRBC26tmp_string,(C)->_root);
rT7append((T7*)oRBC26tmp_string,(T0 *)ms26_27);
rT26echo_remove_file(oRBC26tmp_string);
rT7copy((T7*)oRBC26tmp_string,(C)->_root);
rT7append((T7*)oRBC26tmp_string,rT26make_suffix());
rT26echo_remove_file(oRBC26tmp_string);
}
/*FI*/rT42put_string((T42*)oRBC1std_output,(T0 *)ms14_26);
}/*COMPILE*/int rT26file_exists(/*C*/T0* a1){
int R=0;
void * _p=0;
_p=rT7to_external((T7*)a1);
{FILE *f=fopen(((char*)_p),"r");
R=(f != NULL);
if (R) fclose(f);}
return R;
}
/*STD_OUTPUT*/void rT42die_with_code(/*C*/int a1){
exit(a1);
}/*STD_OUTPUT*/void rT42put_string(T42 *C,T0* a1){
int _i=0;
_i=1;
while (!((_i)>(((T7*)a1)->_count))) {
rT42put_character(C,rT7item((T7*)a1,_i));
_i=(_i)+(1);
}
}/*STD_OUTPUT*/void rT42append_file(T42 *C,T0* a1){
char _c=0;
rT43connect_to((T43*)oRBC39tmp_file_read,a1);
rT43read_character((T43*)oRBC39tmp_file_read);
while (!(rT43end_of_input((T43*)oRBC39tmp_file_read))) {
_c=rT43last_character((T43*)oRBC39tmp_file_read);
rT42put_character(C,_c);
rT43read_character((T43*)oRBC39tmp_file_read);
}
rT43disconnect((T43*)oRBC39tmp_file_read);
}T0*oRBC39tmp_file_read;
/*STD_OUTPUT*/void rT42put_character(T42 *C,char a1){
char _err=0;
_err=fputc(a1,(C)->_output_stream);
/*IF*/if ((_err)!=(a1)) {
rT38put_string((T38*)oRBC1std_error,(T0 *)ms2_39);
/*[IRF3:crash*/rsp();
rT42die_with_code(1);
/*]*/
}
/*FI*/}/*STD_OUTPUT*/void rT42make(T42 *C){
C->_output_stream=stdout;
}/*ARRAY[STRING]*/T0* rT44item(T44 *C,int a1){
T0* R=NULL;
R=(((T0**)(C->_storage))[a1-(C->_lower)]);
return R;
}
/*ARRAY[STRING]*/int rT44equal_like(/*C*/T0* a1,T0* a2){
int R=0;
/*IF*//*AF*//*AF*/if (((T0 *)a1)==((T0 *)a2)) {
R=1;
}
 else if ((!(a1))||(!(a2))) {
}
else {
R=rT7is_equal((T7*)a1,a2);
}
/*FI*/return R;
}
/*ARRAY[STRING]*/int rT44index_of(T44 *C,T0* a1){
int R=0;
R=(C)->_lower;
while (!(((R)>((C)->_upper))||(rT44equal_like(a1,rT44item(C,R))))) {
R=(R)+(1);
}
return R;
}
/*CHARACTER*/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;
}
/*CHARACTER*/int rT3is_digit(T3 C){
int R=0;
{int iv1=C;
if ((48<=iv1)&&(iv1<=57)) goto l9;
goto l10;
 l9: ;
R=1;
goto l8;
 l10: ;
 l8: ;
}
return R;
}
/*CHARACTER*/int rT3is_letter(T3 C){
int R=0;
{int iv1=C;
if ((65<=iv1)&&(iv1<=90)) goto l12;
if ((97<=iv1)&&(iv1<=122)) goto l12;
goto l13;
 l12: ;
R=1;
goto l11;
 l13: ;
 l11: ;
}
return R;
}
/*CHARACTER*/int rT3is_separator(T3 C){
int R=0;
{int iv1=C;
if (0 == iv1) goto l15;
if ((9<=iv1)&&(iv1<=10)) goto l15;
if (13 == iv1) goto l15;
if (32 == iv1) goto l15;
goto l16;
 l15: ;
R=1;
goto l14;
 l16: ;
 l14: ;
}
return R;
}
/*CHARACTER*/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;
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.