/*
-- ANSI C code generated by :
-- SmallEiffel The GNU Eiffel Compiler -- Release (- 0.79)      --
-- Copyright (C), 1994-98 - LORIA - UHP - CRIN - INRIA - FRANCE --
-- Dominique COLNET and Suzanne COLLIN -    colnet@loria.fr     --
--                 http://www.loria.fr/SmallEiffel              --
*/
#include "pretty.h"


void r236check_created_type(T236* C,T0* a1){
T0* _rt=NULL;
_rt=X62run_type(a1);
/*[IF*/
if(((T42*)(oBC11small_eiffel))->_short_flag/*0*/){
}
 else if(((T41*)(X62base_class(_rt)))->_is_deferred/*16*/){
r37add_type(_rt,((T0*)ms233_11858));
r236warning((C)->_start_position/*4*/,((T0*)ms233_30996));
}
/*FI]*/
/*[IF*/
if(X62is_formal_generic(a1)){
r37add_position((C)->_start_position/*4*/);
/*[IRF3.6append*/{T0* b1=((T0*)ms233_77140);
r7append((T7*)(oBC37explanation),b1);
}/*]*/
r37add_type(a1,((T0*)ms233_180));
r37print_as_fatal_error((T37*)(oBC11eh));
}
/*FI]*/
r313set_at_run_time((T313*)(X62run_class(_rt)));
}


T0* r236to_runnable(T236* C,T0* a1){
T0* R=NULL;
T0* _t=NULL;
/*[IF*/
if(((C)->_current_type/*12*/)==((void*)(NULL))){
r236check_writable(C,a1);
_t=X89result_type((C)->_writable/*8*/);
r236check_created_type(C,_t);
r236check_creation_clause(C,_t);
R=(T0*)C;
}
else{
{T236*n=malloc(sizeof(*n));
*n=M236;
r236make(n,(C)->_start_position/*4*/,(C)->_writable/*8*/,(C)->_call/*20*/);
R=(T0*)n;
}
R=r236to_runnable(((T236*)R),a1);
}
/*FI]*/
return R;
}


void r236warning(T0* a1,T0* a2){
r37add_position(a1);
r37warning((T37*)(oBC11eh),a2);
}
/*No:CREATION_CALL_3.current_type*/
/*No:CREATION_CALL_3.writable*/
/*No:CREATION_CALL_3.fz_03*/
/*No:CREATION_CALL_3.fz_dot*/
/*No:CREATION_CALL_3.call*/


void r236error(T0* a1,T0* a2){
r37add_position(a1);
r37error((T37*)(oBC11eh),a2);
}
/*No:CREATION_CALL_3.run_feature*/
/*No:CREATION_CALL_3.end_mark_comment*/


void r236make(T236* C,T0* a1,T0* a2,T0* a3){
C->_start_position=a1;
C->_writable=a2;
C->_call=a3;
}


void r236pretty_print(T236* C){
r310put_string((T310*)(oBC11fmt),((T0*)ms236_138));
X145pretty_print((C)->_call/*20*/);
}


void r236cp_not_found(T236* C,T0* a1){
r37add_position(X65start_position(/*X145feature_name*/((T0*)((T148*)((C)->_call/*20*/))->_feature_name/*8*/)));
r37add_position(X65start_position(a1));
/*[IRF3.6fatal_error*/{T0* b1=((T0*)ms237_53476);
r37fatal_error((T37*)(oBC11eh),b1);
}/*]*/
}


void r236check_writable(T236* C,T0* a1){
T0* _w=NULL;
C->_current_type=a1;
_w=X89to_runnable((C)->_writable/*8*/,a1);
/*[IF*/
if((_w)==((void*)(NULL))){
r37add_position(X89start_position((C)->_writable/*8*/));
/*[IRF3.6fatal_error*/{T0* b1=((T0*)ms233_64251);
r37fatal_error((T37*)(oBC11eh),b1);
}/*]*/
}
else{
C->_writable=_w;
}
/*FI]*/
}


void r236check_creation_clause(T236* C,T0* a1){
T0* _args=NULL;
T0* _top=NULL;
T0* _bottom=NULL;
T0* _fn=NULL;
T0* _ct=NULL;
_fn=/*X145feature_name*/((T0*)((T148*)((C)->_call/*20*/))->_feature_name/*8*/);
_top=r39base_class((T39*)(X65start_position(_fn)));
_bottom=X62base_class(a1);
/*[IF*/
if(X62is_like_current(a1)){
_fn=r41new_name_of(((T41*)_bottom),_top,_fn);
/*[IF*/
if((_fn)==((void*)(NULL))){
_fn=/*X145feature_name*/((T0*)((T148*)((C)->_call/*20*/))->_feature_name/*8*/);
r37add_position(X65start_position(_fn));
/*[IRF3.6append*/{T0* b1=((T0*)ms12_7398);
r7append((T7*)(oBC37explanation),b1);
}/*]*/
/*[IRF3.6append*/{T0* b1=X65to_string(_fn);
r7append((T7*)(oBC37explanation),b1);
}/*]*/
/*[IRF3.6append*/{T0* b1=((T0*)ms237_25652);
r7append((T7*)(oBC37explanation),b1);
}/*]*/
/*[IRF3.6append*/{T0* b1=X62run_time_mark(a1);
r7append((T7*)(oBC37explanation),b1);
}/*]*/
/*[IRF3.6fatal_error*/{T0* b1=((T0*)ms12_166);
r37fatal_error((T37*)(oBC11eh),b1);
}/*]*/
}
/*FI]*/
}
/*FI]*/
C->_run_feature=r313get_feature((T313*)(X62run_class(a1)),_fn);
/*[IF*/
if(((C)->_run_feature/*16*/)==((void*)(NULL))){
r236cp_not_found(C,_fn);
}
/*FI]*/
/*[IF*/
if(((T42*)(oBC11small_eiffel))->_short_flag/*0*/){
}
 else if(!(X62has_creation(a1,_fn))){
r37add_position(X65start_position(/*X145feature_name*/((T0*)((T148*)((C)->_call/*20*/))->_feature_name/*8*/)));
r37add_position(X65start_position(_fn));
/*[IRF3.6append*/{T0* b1=X65to_string(_fn);
r7append((T7*)(oBC37explanation),b1);
}/*]*/
/*[IRF3.6append*/{T0* b1=((T0*)ms237_45856);
r7append((T7*)(oBC37explanation),b1);
}/*]*/
r37add_type(a1,((T0*)ms12_47));
r37print_as_fatal_error((T37*)(oBC11eh));
}
/*FI]*/
X312add_client((C)->_run_feature/*16*/,X62run_class((C)->_current_type/*12*/));
/*[IF*/
if((X312result_type((C)->_run_feature/*16*/))!=((void*)(NULL))){
r37add_position(X312start_position((C)->_run_feature/*16*/));
r37add_position(X65start_position(_fn));
/*[IRF3.6fatal_error*/{T0* b1=((T0*)ms237_67122);
r37fatal_error((T37*)(oBC11eh),b1);
}/*]*/
}
/*FI]*/
/*[IF*/
if(((r236arg_count(C))==(0))&&((X312arguments((C)->_run_feature/*16*/))!=((void*)(NULL)))){
r37add_position(X312start_position((C)->_run_feature/*16*/));
r37add_position((C)->_start_position/*4*/);
/*[IRF3.6fatal_error*/{T0* b1=((T0*)ms237_63744);
r37fatal_error((T37*)(oBC11eh),b1);
}/*]*/
}
/*FI]*/
/*[IF*/
if((r236arg_count(C))>(0)){
_ct=/*X312current_type*/((T0*)((T325*)(r42top_rf((T42*)(oBC11small_eiffel))))->_current_type/*4*/);
_args=r132to_runnable((T132*)(X145arguments((C)->_call/*20*/)),_ct);
/*[IF*/
if((_args)==((void*)(NULL))){
r236error(r132start_position((T132*)(X145arguments((C)->_call/*20*/))),((T0*)ms12_14714));
}
else{
r132match_with(((T132*)_args),(C)->_run_feature/*16*/,_ct);
}
/*FI]*/
}
/*FI]*/
C->_call=X145make_runnable((C)->_call/*20*/,(C)->_writable/*8*/,_args,(C)->_run_feature/*16*/);
}
/*No:CREATION_CALL_3.fz_bad_arguments*/
/*No:CREATION_CALL_3.fz_09*/


T2 r236arg_count(T236* C){
T2 R=0;
/*[IF*/
if(((C)->_call/*20*/)!=((void*)(NULL))){
R=X145arg_count((C)->_call/*20*/);
}
/*FI]*/
return R;
}
/*No:CREATION_CALL_3.fatal_error*/

