# 1 "gen-include.cc"
 

# 1 "gen-include.h" 1
 





extern "C" {


# 1 "../types/str.h" 1
 




# 1 "../runtime/obj.h" 1



 




typedef int null;
typedef float real;
typedef struct string_s *string;
typedef struct any_s *any;
typedef struct dv_s *DV;
typedef DV *obj;
typedef struct type_s *type;
typedef struct info_s *info;
typedef struct core_s *core;


# 6 "../types/str.h" 2

# 1 "../runtime/except.h" 1




# 1 "../types/str.h" 1
 

# 143 "../types/str.h"

# 5 "../runtime/except.h" 2

# 1 "../types/vec.h" 1
 




# 1 "../types/type_def.h" 1
 






typedef struct instn_s *instn;
typedef struct class_s *class_;
typedef struct class_instn_s *class_instn;
typedef struct param_s *param;
typedef struct ptype_s *ptype;
typedef struct pclass_s *pclass;
typedef struct method_s *method;
typedef struct objtype_s *objtype;


# 6 "../types/vec.h" 2

# 1 "../types/vec_def.h" 1
 




typedef struct vec_s *vec;
typedef struct vecE_s *vecE;


# 7 "../types/vec.h" 2

# 1 "../runtime/value.h" 1



# 1 "../common/basic.h" 1
 



# 1 "../config/vdefs/NDEBUG.h" 1






# 5 "../common/basic.h" 2

# 1 "../common/truefalse.h" 1



 
















# 6 "../common/basic.h" 2


# 1 "/usr/include/assert.h" 1 3
 

















 



# 32 "/usr/include/assert.h" 3



# 1 "/usr/include/features.h" 1 3
 





















 















































 













 





 



 







 
# 117 "/usr/include/features.h" 3


 









 



















































 








 












 

# 1 "/usr/include/sys/cdefs.h" 1 3
 




















# 1 "/usr/include/features.h" 1 3
 

















# 222 "/usr/include/features.h" 3

# 22 "/usr/include/sys/cdefs.h" 2 3


 







# 54 "/usr/include/sys/cdefs.h" 3


 







 



# 86 "/usr/include/sys/cdefs.h" 3



 








 







# 205 "/usr/include/features.h" 2 3



 

 








# 1 "/usr/include/gnu/stubs.h" 1 3
 





























# 219 "/usr/include/features.h" 2 3




# 35 "/usr/include/assert.h" 2 3


 




# 56 "/usr/include/assert.h" 3


extern "C" { 

 
extern void __assert_fail  (__const char *__assertion,
				__const char *__file,
				unsigned int __line,
				__const char *__function)  
     __attribute__ ((__noreturn__));

 
extern void __assert_perror_fail  (int __errnum,
				       __const char *__file,
				       unsigned int __line,
				       __const char *__function)  
     __attribute__ ((__noreturn__));

} 













 











# 8 "../common/basic.h" 2

 


 

 


# 1 "/usr/include/_G_config.h" 1 3
 





 

# 1 "/usr/include/gnu/types.h" 1 3
 






















 
typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;

typedef unsigned long long int __u_quad_t;
typedef long long int __quad_t;
# 41 "/usr/include/gnu/types.h" 3

typedef __quad_t *__qaddr_t;

typedef __u_quad_t __dev_t;		 
typedef __u_int __uid_t;		 
typedef __u_int __gid_t;		 
typedef __u_long __ino_t;		 
typedef __u_int __mode_t;		 
typedef __u_int __nlink_t; 		 
typedef long int __off_t;		 
typedef __quad_t __loff_t;		 
typedef int __pid_t;			 
typedef int __ssize_t;			 

typedef struct
  {
    int __val[2];
  } __fsid_t;				 

 
typedef int __daddr_t;			 
typedef char *__caddr_t;
typedef long int __time_t;
typedef long int __swblk_t;		 

typedef long int __clock_t;

 
typedef unsigned long int __fd_mask;

 


 




 
typedef struct
  {
     
    __fd_mask fds_bits[1024  / (8 * sizeof (__fd_mask)) ];
  } __fd_set;


typedef int __key_t;

typedef unsigned short int __ipc_pid_t;


# 9 "/usr/include/_G_config.h" 2 3




# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3






 


# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3



 


 





 


# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3


 





 


















 





 

 

# 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3


 

 
































typedef unsigned int size_t;


















 




 

# 258 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3









typedef unsigned int  wint_t;




 

# 302 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3




 





















# 13 "/usr/include/_G_config.h" 2 3

















typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));




 










 




 














# 17 "../common/basic.h" 2


 




typedef unsigned char bool_t ;


# 4 "../runtime/value.h" 2

# 1 "../common/slot.h" 1
 









# 1 "../common/bits.h" 1
 














typedef unsigned int  Uint;

typedef unsigned char  Ubits8;
typedef unsigned short Ubits16;
typedef unsigned int   Ubits32;

typedef char  Bits8;
typedef short Bits16;
typedef int   Bits32;






# 40 "../common/bits.h"












 




# 1 "../common/ubits64.h" 1



  







typedef unsigned long long int Ubits64;

# 22 "../common/ubits64.h"



# 57 "../common/bits.h" 2








# 11 "../common/slot.h" 2






 
typedef Ubits32  or_slot;
typedef Ubits32  fe_slot;






# 5 "../runtime/value.h" 2



typedef union {
    any a;
    bool_t  b;
    char c;
    int i;
    obj o;
    real r;
    string s;
    char pad[sizeof(fe_slot)];
} fevalue;


# 8 "../types/vec.h" 2

# 1 "../runtime/pval.h" 1





typedef obj pval;
 





 






 






# 9 "../types/vec.h" 2

# 1 "../common/iter.h" 1



typedef void (*ifunc)(void *env, ...);

 








struct closure {
    ifunc f;
    void *env;
};


# 10 "../types/vec.h" 2



extern "C" {


 







extern pclass Vec;
extern void init_Vec();

struct vec_pblock_s {
        type t;
        };
typedef struct vec_pblock_s *vec_pblock;

 




vec vecE_from_iter(vecE, struct closure els);
 







vec vecE_empty(vecE);
 





vec vecE_fill(vecE, int length, pval item);
 






extern pval vec_fetch(vec v, int i);
 




extern void vec_store(vec v, int i, pval e);
 





extern int vec_length(vec v);
 




extern void vec_elements(vec v, struct closure cl);
 




extern vec vec_copy(vec v);
 



extern vec vec_new(obj dummy, class_instn vci, int size);

DV *vec_dhs(class_instn, vec);


}




# 6 "../runtime/except.h" 2

# 1 "../runtime/alloc.h" 1



# 1 "../config/vdefs/WATCH_ALLOC.h" 1







# 4 "../runtime/alloc.h" 2

# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3






 







 

 




 


 





 


# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3


 





 


















 





 

 





















typedef int ptrdiff_t;









 




 

 


# 182 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3





 




 



























 



















































 

# 302 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3




 













 







# 5 "../runtime/alloc.h" 2



# 1 "../common/th_assert.h" 1
 










# 1 "/usr/include/assert.h" 1 3
 

















 

















 




# 56 "/usr/include/assert.h" 3


extern "C" { 

 
extern void __assert_fail  (__const char *__assertion,
				__const char *__file,
				unsigned int __line,
				__const char *__function)  
     __attribute__ ((__noreturn__));

 
extern void __assert_perror_fail  (int __errnum,
				       __const char *__file,
				       unsigned int __line,
				       __const char *__function)  
     __attribute__ ((__noreturn__));

} 













 











# 12 "../common/th_assert.h" 2


 





































# 1 "../common/fail.h" 1
 











extern "C" {


extern void fail(char const* format, ...);
     






extern void warn(char const* format, ...);
     





extern void sysfail(char const* msg);
     





extern void syswarn(char const* msg);
     




     







# 60 "../common/fail.h"


}



# 52 "../common/th_assert.h" 2



extern "C" {






 
























# 103 "../common/th_assert.h"









}



# 8 "../runtime/alloc.h" 2



extern "C" {


    obj cache_oalloc(size_t);


}


 






 













 












 














 




extern int meta_size_alloc;











 




extern bool_t  normal_heap;
extern bool_t  allow_meta;

 







 














 









# 7 "../runtime/except.h" 2


# 1 "/usr/include/setjmp.h" 1 3
 

















 








extern "C" { 

 
# 1 "/usr/include/jmp_buf.h" 1 3
 











typedef int __jmp_buf[6];


 



# 31 "/usr/include/setjmp.h" 2 3

# 1 "/usr/include/sigset.h" 1 3
 





















typedef int __sig_atomic_t;

 


typedef struct
  {
    unsigned long int __val[(1024 / (8 * sizeof (unsigned long int))) ];
  } __sigset_t;




 





# 123 "/usr/include/sigset.h" 3

# 32 "/usr/include/setjmp.h" 2 3


 
typedef struct __jmp_buf_tag	 
  {
     


    __jmp_buf __jmpbuf;		 
    int __mask_was_saved;	 
    __sigset_t __saved_mask;	 
  } jmp_buf[1];


 


extern int __sigsetjmp  (jmp_buf __env, int __savemask)  ;


 










 





 

extern void longjmp  (jmp_buf __env, int __val)  
     __attribute__ ((__noreturn__));

 


extern void _longjmp  (jmp_buf __env, int __val)  
     __attribute__ ((__noreturn__));


 
extern void __longjmp  (__jmp_buf __env, int __val)  
     __attribute__ ((__noreturn__));

 



extern int __sigjmp_save  (jmp_buf __env, int __savemask)  ;



 


typedef jmp_buf sigjmp_buf;

 



 



extern void siglongjmp  (sigjmp_buf __env, int __val)  
     __attribute__ ((__noreturn__));


} 


# 9 "../runtime/except.h" 2



extern "C" {

    
 




struct exception_s {string name; vec vals;};

typedef struct exception_s *exception;

 













extern void initialize_exceptions();
extern bool_t  wellknown_exception(string nm);

extern exception exc;
extern void *exc_value;

extern exception exception_new(string nm, vec vals);


 







 
extern struct exception_s exc_break;
extern struct exception_s exc_not_found;
extern struct exception_s exc_duplicate;
extern struct exception_s exc_empty;
extern struct exception_s exc_bounds;
extern struct exception_s exc_not_possible;
extern struct exception_s exc_not_a_tag;
extern struct exception_s exc_missing_tag;
extern struct exception_s exc_type_error;
extern struct exception_s exc_type_failure;
extern struct exception_s exc_unsupported;
extern struct exception_s exc_failure;
extern struct exception_s exc_abort;
extern struct exception_s exc_illegal_char;
extern struct exception_s exc_negative_exponent;
extern struct exception_s exc_negative_size;
extern struct exception_s exc_overflow;
extern struct exception_s exc_zero_divide;
extern struct exception_s exc_underflow;
extern struct exception_s exc_wrong_tag;
extern struct exception_s exc_wrong_type;

extern void signal_failure_no_return_values();


 


































 







 








typedef struct jmp_entry_s *jmp_entry;

struct jmp_entry_s {
    jmp_buf buf;
    jmp_entry prev;
};

extern jmp_entry failure_jmp;
extern jmp_buf abort_jmp;
extern struct jmp_entry_s top_failure;






     






 















 













 






    

extern void signal_failure(string s);
 










 



 







 



    

 






}


# 7 "../types/str.h" 2





extern "C" {


 




extern struct exception_s exc_bounds;

 

string string_concat(string s1, string s2);

void string_chars(string s1, struct closure cl);
 


int string_length(string s);
 


char string_fetch(string s, int index);
 



char string_fetch_(string s, int index);
 



bool_t  string_equal(string s1, string s2);
 

bool_t  string_empty_(string s);
 

bool_t  string_lt(string x, string y);
 
 

bool_t  string_gt(string x, string y);
 
 

bool_t  string_le(string x, string y);
 
 

bool_t  string_ge(string x, string y);
 
 

bool_t  string_similar(string s1, string s2);
 


 

string string_empty();
 

string string_ctos(char c);
 


string string_new(char const s[]);
 



string string_newn(char const s[], int len);
 



string string_copy(string s);
 

string string_first(string s, int n);
 
 

string string_rest(string s, int n);
 
 

string string_append(string s, char c);
 

string string_extract(string s, int at, int count);
 
 
 

void delete_string(string s);
 



string string_unparse(string s);
 





string string_unparse_fancy(string s);
 





char *string_charp(string s);
 







extern void initString();
 


}



# 10 "gen-include.h" 2



string gen_def_inc(objtype t);
string gen_spec_inc(objtype t);
string gen_meth_inc(objtype t);
string gen_mkr_spec_inc(method m);
string gen_class_inc(class_ c, class_ c2);
string gen_rtn_spec_inc(method m);

 




string gen_class_impl(class_ c);
 



void make_includes(objtype t, objtype t2);
 




void make_rtn_includes(method m);
 



void make_mkr_includes(method m);
 



void make_include(string filename, string contents);
 


  

}



# 3 "gen-include.cc" 2

# 1 "../runtime/surr.h" 1




extern "C" {


 




















# 1 "../runtime/surr_def.h" 1



 




typedef obj surr;

 








# 1 "../config/vdefs/EDGE_MARKING.h" 1







# 20 "../runtime/surr_def.h" 2



# 29 "../runtime/surr.h" 2

# 1 "../runtime/obj_class.h" 1



 










extern "C" {


# 1 "../config/vdefs/LRU.h" 1







# 18 "../runtime/obj_class.h" 2



# 1 "../common/obj_bitfield.h" 1
 











extern "C" {




typedef Bits32  Obj_bitfield;

 






















 


































}



# 21 "../runtime/obj_class.h" 2

# 1 "../common/xref.h" 1
 









extern "C" {



# 1 "../common/oref.h" 1
 











extern "C" {



# 1 "../common/hashfuncs.h" 1
 








inline int hash_int(int x) {
   




  return (int) ((((unsigned int) x) * 1737350767) & 0x7fffffff);
}
inline unsigned hash_unsigned(unsigned x) {
   
  return (unsigned) (x * 1737350767); 
}







extern "C" {


extern int hash_ubits64(Ubits64);
extern int hash_string(char const*);

bool_t  comp_int(int, int);


}



# 17 "../common/oref.h" 2


typedef Ubits32  Oref;











extern void sort_orefs(Oref* list, int n);
 





}



# 15 "../common/xref.h" 2

# 1 "../common/or_num.h" 1
 








typedef Ubits32  OR_num;

 




# 16 "../common/xref.h" 2


# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3
# 327 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3

# 18 "../common/xref.h" 2


typedef struct {
    OR_num or;
    Oref oref;
} Xref;













}



# 22 "../runtime/obj_class.h" 2



# 1 "../runtime/surr.h" 1
# 92 "../runtime/surr.h"

# 25 "../runtime/obj_class.h" 2


# 1 "../runtime/stats.h" 1




# 1 "../config/vdefs/COLLECT_STATS.h" 1







# 5 "../runtime/stats.h" 2


 












# 80 "../runtime/stats.h"



# 27 "../runtime/obj_class.h" 2

# 1 "../runtime/stamps.h" 1





 











 



 




 










 















# 28 "../runtime/obj_class.h" 2

# 1 "../cache/cache_fetch.h" 1




extern "C" {





struct prefetch_hint;

 




obj cache_fetch (surr s, struct prefetch_hint* h);
     







obj cache_fetch_pointer (obj s, struct prefetch_hint* h);
     





}



# 29 "../runtime/obj_class.h" 2

# 1 "../client/handle_def.h" 1
 




typedef int handle;
typedef int future;


# 30 "../runtime/obj_class.h" 2

# 1 "../runtime/discover_fix.h" 1





# 1 "../runtime/obj_class.h" 1
# 371 "../runtime/obj_class.h"

# 6 "../runtime/discover_fix.h" 2


 











































































































 
















 

























 




















 




















# 31 "../runtime/obj_class.h" 2

# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3
# 327 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3

# 32 "../runtime/obj_class.h" 2


 




 



typedef void *(*ofunc)(obj, ...);

 





typedef union {
    ofunc f;
    obj eobj;
} dtentry;

 





















































struct dv_s {
    int boffset;
    int offset;
    int foffset;
    objtype t;
    class_ c;
    obj (*get_address)(obj);
    class_ (*get_class)(obj);
     
};

 






















struct core_s {
    DV methods;
    Xref xref;
    int stamp;   
    handle handle_;
    int size;
    Obj_bitfield bitfields;
     
};

 




 


 



 







 





 







 





 






 







 







 





 



extern void init_obj_hdr(obj ostart, class_ c);
 





extern void init_obj_hdr_prim(core ostart, int size, Obj_bitfield, DV methods);
 






extern obj get_address(obj o);
 





extern obj normal_get_address(obj o);
 





extern class_ normal_get_class(obj o);
 





extern class_ get_obj_class(obj o);
 









extern bool_t  same_obj(obj o1, obj o2);
 


				   
 


 














 












 









 











extern void mark_obj_as_read(core o);
 




extern core mark_obj_as_written(core o);
 







 









 





extern bool_t  is_persistent_object(obj o);
 



}



# 30 "../runtime/surr.h" 2




 




 


 


 


 


 




extern bool_t  is_marked_pointer(obj x);  


extern obj mark_pointer(obj x);   


extern obj unmark_pointer(obj x);  




 


 






 


 


extern void surr_fill(surr s, obj x);

 



 }



# 4 "gen-include.cc" 2


# 1 "../types/type_meth.h" 1
 








typedef struct methoddv_s {
    struct dv_s super;
    void (*args)(method, struct closure);
    void (*sigs)(method, struct closure);
    void (*returns)(method, struct closure);
    bool_t  (*isIter)(method);
    string (*name)(method);
    string (*unparse)(method);
    int (*index)(method);
    type (*self_type)(method);
} *methoddv;

extern struct methoddv_s method_methods;

typedef struct typedv_s {
    struct dv_s super;
    bool_t  (*equal)(type, type);
    void (*supertypes)(type, struct closure);
    bool_t  (*subtype)(type, type);
    void (*methods)(type, struct closure);
    string (*name)(type);
    string (*unparse)(type);
    int (*kind)(type);
} *typedv;

struct type_s {
    typedv methods;
};

extern struct typedv_s type_methods_dv;

# 6 "gen-include.cc" 2

# 1 "../types/string_class.h" 1
 








extern "C" {


typedef struct stringdv_s {
    struct dv_s super;
    int (*length)(string);
    string (*concat)(string, string);
    bool_t  (*equal)(string, string);
    void (*chars)(string, struct closure);
    char (*fetch)(string, int);
    string (*unparse)(string);
    bool_t  (*empty)(string);
    string (*first) (string, int);
    string (*rest) (string, int);
    string (*append) (string, char);
    string (*extract) (string, int, int);
    bool_t  (*lt) (string, string);
    bool_t  (*gt) (string, string);
    bool_t  (*le) (string, string);
    bool_t  (*ge) (string, string);
    bool_t  (*similar) (string, string);
    string (*copy) (string);
} *stringdv;

extern struct stringdv_s string_methods;

struct string_s {
    union {
        struct core_s inh;
	stringdv methods;
    } hdr;
    int size;
    char chars[1];
};

 








}



# 7 "gen-include.cc" 2

# 1 "../types/textwr.h" 1
 




# 1 "../types/wr.h" 1
 






 

typedef struct wr_s *wr;


extern "C" {

    
void wr_putChar(wr w, char c);
void wr_putString(wr w, string s);
void wr_seek(wr w, int posn);
int wr_length(wr w);
int wr_index(wr w);
void wr_flush(wr w);
void wr_close(wr w);


extern void wr_putChars(wr w, char const *c);
 


}



# 6 "../types/textwr.h" 2



extern "C" {


 


     
typedef struct textwr_s *textwr;

textwr textwr_new();

wr textwr_as_wr(textwr tw);

string textwr_toString(textwr tw);

void initTextWr();


}



# 8 "gen-include.cc" 2


# 1 "../types/vec_class.h" 1
 








extern "C" {


typedef struct vec_dv_s {
    struct dv_s super;
    pval (*fetch)(vec, int);
    void (*store)(vec, int, obj);
    int (*length)(vec);
    void (*elements)(vec, struct closure cl);
    type t;
    vecE ext;
} *vecdv;
 


struct vec_s {
    union {
	struct core_s inh;
	struct vec_dv_s *methods;
    } hdr;
    pval items[1];  
};

pval *vec_items(vec v);
 







vec make_vec_copy(type t, int length, void *address);
 





vec make_vec_prim(bool_t  primitive, int length);
 











extern pval vec_fetch_(vec v, int i);
extern void vec_store_(vec v, int i, pval e);
extern int vec_length_(vec v);
extern void vec_elements_(vec v, struct closure);
 




}



# 10 "gen-include.cc" 2

# 1 "../types/class.h" 1
 





extern "C" {





extern class_ Class;

extern type class_as_type(class_);
 




static inline objtype class_as_objtype(class_ c) { return (objtype)c; }


extern class_ objtype_as_class(objtype);
extern class_ type_as_class(type);
 




extern void class_fields(class_, struct closure);

 






extern class_ class_superclass(class_);
 




# 76 "../types/class.h"



}



# 11 "gen-include.cc" 2

# 1 "../types/pclass.h" 1
 




# 1 "../types/ptype.h" 1
 







# 1 "../types/ptype_def.h" 1
 






typedef struct paramBinding_s *paramBinding;


# 9 "../types/ptype.h" 2



extern "C" {


extern class_ PType;
extern void init_PType();

 











instn ptype_instantiate(ptype pt, vec args);
 













instn ptype_instantiate2(ptype pt, vec args);
 





void ptype_parameters(ptype, struct closure);
 







string ptype_name(ptype);
 



void ptype_supertypes(ptype, struct closure);
 






string ptype_unparse(ptype);
 



void ptype_methods(ptype, struct closure);
 







void ptype_wheres(ptype, struct closure);
 








 

extern void init_instn_name(ptype pt, objtype t, vec pargs);
 






}




# 6 "../types/pclass.h" 2



extern "C" {


extern class_ PClass;
 




 
 



pclass ptype_as_pclass(ptype t);
 




void pclass_fields(pclass, struct closure);
 



class_ pclass_superclass(pclass);
 


extern class_instn pclass_instantiate_(pclass pc, vec args);
 




extern string typenm2cnm(type t);
 




extern string typeExtNm2IntNm(string tname);
 




extern string typeExtNm2SimpleNm(string tname);
 




# 82 "../types/pclass.h"



}





static ptype pclass_as_ptype(pclass pc) { return (ptype)pc; }


void init_PClass();
 



# 12 "gen-include.cc" 2

# 1 "../types/class_class.h" 1
 






# 1 "../types/objtype_class.h" 1
 





# 1 "../types/type.h" 1
 





extern "C" {





# 1 "../types/dict.h" 1
 




# 1 "../types/dict_def.h" 1
 




typedef struct dict_s *dict;


# 6 "../types/dict.h" 2



# 1 "../types/type.h" 1
 

# 182 "../types/type.h"

# 9 "../types/dict.h" 2

# 1 "../types/any.h" 1
 










extern "C" {


 




struct any_s {
    struct core_s hdr;
};

pval any_get_obj(any a);
 





obj any_as_obj(any a);
 





fevalue any_get_value(any a);
 


     
class_ get_any_class(any a);
 



any int_as_any(int);
any bool_as_any(bool_t );
any char_as_any(char);
any null_as_any(int);
any real_as_any(real);
 


 
any obj_as_any(obj o);
 




bool_t  any_equal(obj dummy, any a1, any a2);
 




any make_any(type t, fevalue v);
 



extern class_ IntAny, BoolAny, CharAny, RealAny, NullAny;
extern void initAnys();


}



# 10 "../types/dict.h" 2



extern "C" {



 

extern type Dict;

 

dict dict_new();

 

void dict_add(dict d, string key, any val);
 



any dict_remove(dict d, string key);
 



bool_t  dict_contains(dict d, string key);

any dict_fetch(dict d, string key);
 



void dict_keys(dict d, struct closure cl);
 




void delete_dict(dict d);


}

    

# 13 "../types/type.h" 2





extern objtype Any;
 

extern type List, IList, Wr;
 

extern type Type;
 

extern class_ ObjType, Method, String, TextWr, FullList, FullIntList, EmptyList, EmptyIntList, ExceptionC;
 

extern class_ Instn, Param, Class, ClassInstn, Type_class, PClass,
              PType;

extern class_ Int, Char, Bool, Null, Real;
















 

extern class_ VecOfAny;

 





































bool_t  isSubtype(type t1, type t2);

bool_t  type_equal(type t1, type t2);
 



void type_methods(type t, struct closure);
 





string type_name(type);
 

string type_unparse(type);
 

void type_supertypes(type, struct closure);
 

int type_kind(type);








 

















extern char *kind_name(int kind);
  





static inline obj type_as_obj(type t) { return (obj)t; }





static inline type objtype_as_type(objtype ot) { return (type)ot; }


extern type obj_as_type(obj);
 




extern type obj_as_type2(obj);
 




extern void getTypeMethod(type t, fevalue *__retvals, string name);
 







}



# 7 "../types/objtype_class.h" 2



# 1 "../types/objtype.h" 1
 

 













extern "C" {


void objtype_get_method(objtype, fevalue *__retvals, string name);
 







void getMethod(objtype, fevalue *__retvals, string name);
 



void objtype_get_method_index(objtype t, fevalue *__retvals, int index);
 







void objtype_all_methods_(type t_, struct closure cl);


}

 

# 10 "../types/objtype_class.h" 2



extern "C" {


typedef struct objtypedv_s {
    struct typedv_s super;
    void (*get_method)(objtype, fevalue *, string);
} *objtypedv;

typedef vec dh_template;  

 












typedef vec dv_template;  
 














struct objtype_s {
    union {
	struct core_s inh;
	objtypedv methods;
    } hdr;

    string name;
    vec supertypes_;
    vec methods_;
    int kind;
    int hdr_size;
    dh_template dht;
    DV *surr_DH;
    DV *full_surr_DH;
    DV *unswizzled_DH;
    string overview;
};

 



















 






extern dh_template get_dh_template(objtype t);
 




 
struct method_s {
    struct core_s hdr;
    string name;
    vec arguments;  
    vec signals;    
    vec returns;    
    vec extra_args; 
    bool_t  iter;
    bool_t  parameterized;
    int index;
    string spec;
    type self_type;
    type def_type;
    bool_t  mkr;
};









method new_method();
 


typedef struct formal_s {
    struct core_s hdr;
    string name;
    type t;
} *formal;

typedef struct signal_s {
    struct core_s hdr;
    string name;
    vec returns;
} *signal_;

extern bool_t  isa_objtype(obj o);
 




extern bool_t  isa_class(obj o);
 


extern objtype new_objtype();
extern signal_ new_signal();
extern formal new_formal();

extern class_ Formal, Signal;

extern struct dv_s formal_methods;

void init_type(objtype t);
 





extern void init_ObjType();
 



extern method getClass_method;
 




 


extern bool_t  objtype_equal_(type t1, type t2);
extern void objtype_methods_(type t, struct closure);
extern bool_t  objtype_isSubtype_(type t1, type t2);
extern string objtype_name_(type);
extern string objtype_unparse_(type);
extern void objtype_supertypes_(type, struct closure);
extern bool_t  objtype_isPrimitive_(type);
extern void objtype_get_method_(objtype, fevalue *__retvals, string name);
extern int objtype_kind_(type);





 
static inline objtype type_as_objtype(type t)
{

    class_ tc = get_obj_class(type_as_obj(t));
    ((void) (( tc == ObjType || tc == Instn || tc == Class ||
    tc == ClassInstn || tc == PClass || tc == PType ) ? 0 :	(__assert_fail ("tc == ObjType || tc == Instn || tc == Class || tc == ClassInstn || tc == PClass || tc == PType" ,	"../types/objtype_class.h", 203, __PRETTY_FUNCTION__ ), 0))) ;

    return (objtype)((( objtype )((char *)  t  + (((DV)  (DV)t->methods )->offset))) );
}



}



# 8 "../types/class_class.h" 2



extern "C" {


 







extern struct classdv_s {
    struct objtypedv_s super;
    void (*fields)(class_, struct closure);
    class_ (*superclass)(class_);





    objtype (*create_simple_object)(class_);
} class_methods;

 









struct class_s {
    union {
	struct objtype_s inh;
	struct classdv_s *methods;
    } hdr;
    vec fields;  
    vec superclass;  




    vec bitfields;
    int slots;
    int dhsize;
    bool_t  visible;
    bool_t  special;
    string specialText;
    vec slottypes;  
    DV *dh;
};









 





extern class_ new_class();
 

extern void init_class(class_);
 

extern void computeBitfields(class_);
 


extern vec no_slottypes;



extern objtype *initSlottypes (class_, int, Obj_bitfield );
 


void field_offsets(class_, struct closure);
 











extern void initClass();
 

# 123 "../types/class_class.h"

   
 
extern void class_fields_(class_, struct closure);
extern class_ class_superclass_(class_ );
extern obj class_get_object_(class_);
extern class_ class_extension_class_(class_);
extern objtype class_extension_type_(class_);

struct rtn_s {
    union {
	struct objtype_s inh;
    } hdr;
};

typedef struct rtn_s *rtn_;


}



# 13 "gen-include.cc" 2


# 1 "../common/openhashset.h" 1
 


























# 1 "/usr/include/assert.h" 1 3
 

















 

















 




# 56 "/usr/include/assert.h" 3


extern "C" { 

 
extern void __assert_fail  (__const char *__assertion,
				__const char *__file,
				unsigned int __line,
				__const char *__function)  
     __attribute__ ((__noreturn__));

 
extern void __assert_perror_fail  (int __errnum,
				       __const char *__file,
				       unsigned int __line,
				       __const char *__function)  
     __attribute__ ((__noreturn__));

} 













 











# 28 "../common/openhashset.h" 2

# 1 "/usr/include/stdio.h" 1 3
 



















 







# 1 "/usr/include/libio.h" 1 3
 























 



















 

# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stdarg.h" 1 3
 





























































 






typedef void *__gnuc_va_list;



 

# 116 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stdarg.h" 3



















# 202 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stdarg.h" 3




# 47 "/usr/include/libio.h" 2 3







# 64 "/usr/include/libio.h" 3


 


















# 96 "/usr/include/libio.h" 3











 
























 



















struct _IO_jump_t;  struct _IO_FILE;

 



typedef void _IO_lock_t;



 

struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;
   

   
  int _pos;
# 180 "/usr/include/libio.h" 3

};

struct _IO_FILE {
  int _flags;		 


   
   
  char* _IO_read_ptr;	 
  char* _IO_read_end;	 
  char* _IO_read_base;	 
  char* _IO_write_base;	 
  char* _IO_write_ptr;	 
  char* _IO_write_end;	 
  char* _IO_buf_base;	 
  char* _IO_buf_end;	 
   
  char *_IO_save_base;  
  char *_IO_backup_base;   
  char *_IO_save_end;  

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;
  int _blksize;
  __off_t   _offset;


   
  unsigned short _cur_column;
  char _unused;
  char _shortbuf[1];

   

  _IO_lock_t *_lock;
};





struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;





 
typedef struct
{
  __ssize_t   (*read)  (struct _IO_FILE *, void *, __ssize_t  )  ;
  __ssize_t   (*write)  (struct _IO_FILE *, const void *, __ssize_t  )  ;
  __off_t   (*seek)  (struct _IO_FILE *, __off_t  , int)  ;
  int (*close)  (struct _IO_FILE *)  ;
} _IO_cookie_io_functions_t;

 
struct _IO_cookie_file {
  struct _IO_FILE file;
  const void *vtable;
  void *cookie;
  _IO_cookie_io_functions_t io_functions;
};



extern "C" {


extern int __underflow  (_IO_FILE*)  ;
extern int __uflow  (_IO_FILE*)  ;
extern int __overflow  (_IO_FILE*, int)  ;

















extern int _IO_getc  (_IO_FILE *__fp)  ;
extern int _IO_putc  (int __c, _IO_FILE *__fp)  ;
extern int _IO_feof  (_IO_FILE *__fp)  ;
extern int _IO_ferror  (_IO_FILE *__fp)  ;

extern int _IO_peekc_locked  (_IO_FILE *__fp)  ;

 



extern void _IO_flockfile  (_IO_FILE *)  ;
extern void _IO_funlockfile  (_IO_FILE *)  ;
extern int _IO_ftrylockfile  (_IO_FILE *)  ;









 
















extern int _IO_vfscanf  (_IO_FILE*, const char*, __gnuc_va_list , int*)  ;
extern int _IO_vfprintf  (_IO_FILE*, const char*, __gnuc_va_list )  ;
extern __ssize_t   _IO_padn  (_IO_FILE *, int, __ssize_t  )  ;
extern size_t   _IO_sgetn  (_IO_FILE *, void*, size_t  )  ;

extern __off_t   _IO_seekoff  (_IO_FILE*, __off_t  , int, int)  ;
extern __off_t   _IO_seekpos  (_IO_FILE*, __off_t  , int)  ;

extern void _IO_free_backup_area  (_IO_FILE*)  ;


}



# 29 "/usr/include/stdio.h" 2 3

























  
# 69 "/usr/include/stdio.h" 3


typedef struct _IO_FILE FILE;
typedef __off_t   fpos_t;

# 1 "/usr/include/stdio_lim.h" 1 3

















# 74 "/usr/include/stdio.h" 2 3



 



 
extern FILE *stdin, *stdout, *stderr;  






extern "C" {










extern void clearerr  (FILE*)  ;
extern int fclose  (FILE*)  ;
extern int feof  (FILE*)  ;
extern int ferror  (FILE*)  ;
extern int fflush  (FILE*)  ;
extern int fgetc  (FILE *)  ;
extern int fgetpos  (FILE* fp, fpos_t *pos)  ;
extern char* fgets  (char*, int, FILE*)  ;
extern FILE* fopen  (__const char*, __const char*)  ;
extern FILE* fopencookie  (void *cookie, __const char *mode,
			       _IO_cookie_io_functions_t io_functions)  ;
extern int fprintf  (FILE*, __const char* format, ...)  ;
extern int fputc  (int, FILE*)  ;
extern int fputs  (__const char *str, FILE *fp)  ;
extern size_t fread  (void*, size_t, size_t, FILE*)  ;
extern FILE* freopen  (__const char*, __const char*, FILE*)  ;
extern int fscanf  (FILE *fp, __const char* format, ...)  ;
extern int fseek  (FILE* fp, long int offset, int whence)  ;
extern int fsetpos  (FILE* fp, __const fpos_t *pos)  ;
extern long int ftell  (FILE* fp)  ;
extern size_t fwrite  (__const void*, size_t, size_t, FILE*)  ;
extern int getc  (FILE *)  ;
extern int getchar  (void)  ;
extern char* gets  (char*)  ;
extern void perror  (__const char *)  ;
extern int printf  (__const char* format, ...)  ;
extern int putc  (int, FILE *)  ;
extern int putchar  (int)  ;
extern int puts  (__const char *str)  ;
extern int remove  (__const char*)  ;
extern int rename  (__const char* _old, __const char* _new)  ;
extern void rewind  (FILE*)  ;
extern int scanf  (__const char* format, ...)  ;
extern void setbuf  (FILE*, char*)  ;
extern void setlinebuf  (FILE*)  ;
extern void setbuffer  (FILE*, char*, int)  ;
extern int setvbuf  (FILE*, char*, int mode, size_t size)  ;
extern int sprintf  (char*, __const char* format, ...)  ;
extern int sscanf  (__const char* string, __const char* format, ...)  ;
extern FILE* tmpfile  (void)  ;
extern char* tmpnam  (char*)  ;

extern char* tmpnam_r  (char*)  ;


extern char *tempnam  (__const char *__dir, __const char *__pfx)  ;

extern char *__stdio_gen_tempname  (char *__buf, size_t bufsize,
					__const char *dir, __const char *pfx,
					int dir_search, size_t *lenptr,
					FILE **streamptr)  ;
extern int ungetc  (int c, FILE* fp)  ;
extern int vfprintf  (FILE *fp, char __const *fmt0, __gnuc_va_list )  ;
extern int vprintf  (char __const *fmt, __gnuc_va_list )  ;
extern int vsprintf  (char* string, __const char* format, __gnuc_va_list )  ;
extern void __libc_fatal  (__const char *__message)  
     __attribute__ ((__noreturn__));


extern int dprintf  (int, __const char *, ...)  ;
extern int vdprintf  (int, __const char *, __gnuc_va_list )  ;
extern int vfscanf  (FILE*, __const char *, __gnuc_va_list )  ;
extern int __vfscanf  (FILE*, __const char *, __gnuc_va_list )  ;
extern int vscanf  (__const char *, __gnuc_va_list )  ;
extern int vsscanf  (__const char *, __const char *, __gnuc_va_list )  ;
extern int __vsscanf  (__const char *, __const char *, __gnuc_va_list )  ;


# 177 "/usr/include/stdio.h" 3



extern FILE *fdopen  (int, __const char *)  ;
extern int fileno  (FILE*)  ;
extern FILE* popen  (__const char*, __const char*)  ;
extern int pclose  (FILE*)  ;




 
extern char *ctermid  (char *__buf)  ;

 
extern char *cuserid  (char * __buf)  ;



extern int snprintf  (char *, size_t, __const char *, ...)  ;
extern int __snprintf  (char *, size_t, __const char *, ...)  ;
extern int vsnprintf  (char *, size_t, __const char *, __gnuc_va_list )  ;
extern int __vsnprintf  (char *, size_t, __const char *, __gnuc_va_list )  ;


# 214 "/usr/include/stdio.h" 3


extern int __underflow  (struct _IO_FILE*)  ;
extern int __overflow  (struct _IO_FILE*, int)  ;


extern int sys_nerr;
extern const char *const sys_errlist[];






 

extern void clearerr_locked  (FILE *)  ;
extern void clearerr_unlocked  (FILE *)  ;
extern int feof_locked  (FILE *)  ;
extern int feof_unlocked  (FILE *)  ;
extern int ferror_locked  (FILE*)  ;
extern int ferror_unlocked  (FILE*)  ;
extern int fileno_locked  (FILE *)  ;
extern int fileno_unlocked  (FILE *)  ;
extern int fclose_unlocked  (FILE *)  ;
extern int fflush_locked  (FILE *)  ;
extern int fflush_unlocked  (FILE *)  ;
extern size_t fread_unlocked  (void *, size_t, size_t, FILE *)  ;
extern size_t fwrite_unlocked  (const void *, size_t, size_t, FILE *)  ;

extern int fputc_locked  (int, FILE*)  ;
extern int fputc_unlocked  (int, FILE*)  ;
extern int getc_locked  (FILE *)  ;
extern int getchar_locked  (void)  ;
extern int putc_locked  (int, FILE *)  ;
extern int putchar_locked  (int)  ;









 
extern void flockfile  (FILE *)  ;
extern void funlockfile  (FILE *)  ;
extern int ftrylockfile  (FILE *)  ;

extern int getc_unlocked  (FILE *)  ;
extern int getchar_unlocked  (void)  ;
extern int putc_unlocked  (int, FILE *)  ;
extern int putchar_unlocked  (int)  ;
















}





# 29 "../common/openhashset.h" 2







# 304 "../common/openhashset.h"

# 524 "../common/openhashset.h"

# 15 "gen-include.cc" 2


# 1 "/usr/include/unistd.h" 1 3
 

















 








extern "C" { 

 


 



 




 



 



 



 



 


 


 




 


 


 




 
























































# 1 "/usr/include/posix_opt.h" 1 3
 





















 


 


 


 


 


 


 


 


 


 


 


 


 



 


 


 


 



 


 
 


# 137 "/usr/include/unistd.h" 2 3



 





 




typedef __ssize_t ssize_t;





# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3






 


# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3



 


 





 


# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3


 





 


















 





 

 


# 126 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3


 




 

 


# 182 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3





 




 


# 256 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
















 

# 302 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3




 













 







# 157 "/usr/include/unistd.h" 2 3



 






 
extern int __access  (__const char *__name, int __type)  ;
extern int access  (__const char *__name, int __type)  ;









 







 






 




extern __off_t __lseek  (int __fd, __off_t __offset, int __whence)  ;
extern __off_t lseek  (int __fd, __off_t __offset, int __whence)  ;

 
extern int __close  (int __fd)  ;
extern int close  (int __fd)  ;

 

extern ssize_t  __read  (int __fd, void *  __buf, size_t __nbytes)  ;
extern ssize_t  read  (int __fd, void *  __buf, size_t __nbytes)  ;

 
extern ssize_t  __write  (int __fd, __const void *  __buf, size_t __n)  ;
extern ssize_t  write  (int __fd, __const void *  __buf, size_t __n)  ;


 



extern int __pipe  (int __pipedes[2])  ;
extern int pipe  (int __pipedes[2])  ;

 






extern unsigned int alarm  (unsigned int __seconds)  ;

 






extern unsigned int sleep  (unsigned int __seconds)  ;


 



extern unsigned int ualarm  (unsigned int __value,
				 unsigned int __interval)  ;

 

extern void usleep  (unsigned int __useconds)  ;



 

extern int pause  (void)  ;


 
extern int __chown  (__const char *__file,
			 __uid_t __owner, __gid_t __group)  ;
extern int chown  (__const char *__file,
		       __uid_t __owner, __gid_t __group)  ;


 
extern int __fchown  (int __fd,
			  __uid_t __owner, __gid_t __group)  ;
extern int fchown  (int __fd,
			__uid_t __owner, __gid_t __group)  ;


 

extern int __lchown  (__const char *__file, __uid_t __owner,
			  __gid_t __group)  ;
extern int lchown  (__const char *__file, __uid_t __owner,
			__gid_t __group)  ;



 
extern int __chdir  (__const char *__path)  ;
extern int chdir  (__const char *__path)  ;


 
extern int fchdir  (int __fd)  ;


 






extern char *__getcwd  (char *__buf, size_t __size)  ;
extern char *getcwd  (char *__buf, size_t __size)  ;

# 317 "/usr/include/unistd.h" 3



 


extern char *getwd  (char *__buf)  ;



 
extern int __dup  (int __fd)  ;
extern int dup  (int __fd)  ;

 
extern int __dup2  (int __fd, int __fd2)  ;
extern int dup2  (int __fd, int __fd2)  ;

 
extern char **__environ;





 

extern int __execve  (__const char *__path, char *__const __argv[],
			  char *__const __envp[])  ;
extern int execve  (__const char *__path, char *__const __argv[],
			char *__const __envp[])  ;










 
extern int execv  (__const char *__path, char *__const __argv[])  ;

 

extern int execle  (__const char *__path, __const char *__arg, ...)  ;

 

extern int execl  (__const char *__path, __const char *__arg, ...)  ;

 

extern int execvp  (__const char *__file, char *__const __argv[])  ;

 


extern int execlp  (__const char *__file, __const char *__arg, ...)  ;



 
extern int nice  (int __inc)  ;



 
extern void _exit  (int __status)   __attribute__ ((__noreturn__));


 


# 1 "/usr/include/confname.h" 1 3
 


















 
enum
  {
    _PC_LINK_MAX,

    _PC_MAX_CANON,

    _PC_MAX_INPUT,

    _PC_NAME_MAX,

    _PC_PATH_MAX,

    _PC_PIPE_BUF,

    _PC_CHOWN_RESTRICTED,

    _PC_NO_TRUNC,

    _PC_VDISABLE,

    _PC_SYNC_IO,

    _PC_ASYNC_IO,

    _PC_PRIO_IO,

    _PC_SOCK_MAXBUF

  };

 
enum
  {
    _SC_ARG_MAX,

    _SC_CHILD_MAX,

    _SC_CLK_TCK,

    _SC_NGROUPS_MAX,

    _SC_OPEN_MAX,

    _SC_STREAM_MAX,

    _SC_TZNAME_MAX,

    _SC_JOB_CONTROL,

    _SC_SAVED_IDS,

    _SC_REALTIME_SIGNALS,

    _SC_PRIORITY_SCHEDULING,

    _SC_TIMERS,

    _SC_ASYNCHRONOUS_IO,

    _SC_PRIORITIZED_IO,

    _SC_SYNCHRONIZED_IO,

    _SC_FSYNC,

    _SC_MAPPED_FILES,

    _SC_MEMLOCK,

    _SC_MEMLOCK_RANGE,

    _SC_MEMORY_PROTECTION,

    _SC_MESSAGE_PASSING,

    _SC_SEMAPHORES,

    _SC_SHARED_MEMORY_OBJECTS,

    _SC_AIO_LISTIO_MAX,

    _SC_AIO_MAX,

    _SC_AIO_PRIO_DELTA_MAX,

    _SC_DELAYTIMER_MAX,

    _SC_MQ_OPEN_MAX,

    _SC_MQ_PRIO_MAX,

    _SC_VERSION,

    _SC_PAGESIZE,


    _SC_RTSIG_MAX,

    _SC_SEM_NSEMS_MAX,

    _SC_SEM_VALUE_MAX,

    _SC_SIGQUEUE_MAX,

    _SC_TIMER_MAX,


     

    _SC_BC_BASE_MAX,

    _SC_BC_DIM_MAX,

    _SC_BC_SCALE_MAX,

    _SC_BC_STRING_MAX,

    _SC_COLL_WEIGHTS_MAX,

    _SC_EQUIV_CLASS_MAX,

    _SC_EXPR_NEST_MAX,

    _SC_LINE_MAX,

    _SC_RE_DUP_MAX,

    _SC_CHARCLASS_NAME_MAX,


    _SC_2_VERSION,

    _SC_2_C_BIND,

    _SC_2_C_DEV,

    _SC_2_FORT_DEV,

    _SC_2_FORT_RUN,

    _SC_2_SW_DEV,

    _SC_2_LOCALEDEF,


    _SC_PII,

    _SC_PII_XTI,

    _SC_PII_SOCKET,

    _SC_PII_INTERNET,

    _SC_PII_OSI,

    _SC_POLL,

    _SC_SELECT,

    _SC_UIO_MAXIOV,

    _SC_PII_INTERNET_STREAM,

    _SC_PII_INTERNET_DGRAM,

    _SC_PII_OSI_COTS,

    _SC_PII_OSI_CLTS,

    _SC_PII_OSI_M,

    _SC_T_IOV_MAX,


     
    _SC_THREADS,

    _SC_THREAD_SAFE_FUNCTIONS,

    _SC_GETGR_R_SIZE_MAX,

    _SC_GETPW_R_SIZE_MAX,

    _SC_LOGIN_NAME_MAX,

    _SC_TTY_NAME_MAX,

    _SC_THREAD_DESTRUCTOR_ITERATIONS,

    _SC_THREAD_KEYS_MAX,

    _SC_THREAD_STACK_MIN,

    _SC_THREAD_THREADS_MAX,

    _SC_THREAD_ATTR_STACKADDR,

    _SC_THREAD_ATTR_STACKSIZE,

    _SC_THREAD_PRIORITY_SCHEDULING,

    _SC_THREAD_PRIO_INHERIT,

    _SC_THREAD_PRIO_PROTECT,

    _SC_THREAD_PROCESS_SHARED,


    _SC_NPROCESSORS_CONF,

    _SC_NPROCESSORS_ONLN,

    _SC_PHYS_PAGES,

    _SC_AVPHYS_PAGES,

    _SC_ATEXIT_MAX,

    _SC_PASS_MAX,


    _SC_XOPEN_VERSION,

    _SC_XOPEN_XCU_VERSION,

    _SC_XOPEN_UNIX,

    _SC_XOPEN_CRYPT,

    _SC_XOPEN_ENH_I18N,

    _SC_XOPEN_SHM,


    _SC_2_CHAR_TERM,

    _SC_2_C_VERSION,

    _SC_2_UPE,


    _SC_XOPEN_XPG2,

    _SC_XOPEN_XPG3,

    _SC_XOPEN_XPG4,


    _SC_CHAR_BIT,

    _SC_CHAR_MAX,

    _SC_CHAR_MIN,

    _SC_INT_MAX,

    _SC_INT_MIN,

    _SC_LONG_BIT,

    _SC_WORD_BIT,

    _SC_MB_LEN_MAX,

    _SC_NZERO,

    _SC_SSIZE_MAX,

    _SC_SCHAR_MAX,

    _SC_SCHAR_MIN,

    _SC_SHRT_MAX,

    _SC_SHRT_MIN,

    _SC_UCHAR_MAX,

    _SC_UINT_MAX,

    _SC_ULONG_MAX,

    _SC_USHRT_MAX,


    _SC_NL_ARGMAX,

    _SC_NL_LANGMAX,

    _SC_NL_MSGMAX,

    _SC_NL_NMAX,

    _SC_NL_SETMAX,

    _SC_NL_TEXTMAX

  };


 
enum
  {
    _CS_PATH			 

  };

# 392 "/usr/include/unistd.h" 2 3


 
extern long int __pathconf  (__const char *__path, int __name)  ;
extern long int pathconf  (__const char *__path, int __name)  ;

 
extern long int __fpathconf  (int __fd, int __name)  ;
extern long int fpathconf  (int __fd, int __name)  ;

 
extern long int __sysconf  (int __name)  ;
extern long int sysconf  (int __name)  ;


 
extern size_t confstr  (int __name, char *__buf, size_t __len)  ;



 
extern __pid_t __getpid  (void)  ;
extern __pid_t getpid  (void)  ;

 
extern __pid_t __getppid  (void)  ;
extern __pid_t getppid  (void)  ;

 
extern __pid_t getpgrp  (void)  ;

 


extern int setpgid  (__pid_t __pid, __pid_t __pgid)  ;

 
extern __pid_t __getpgid  (__pid_t __pid)  ;





 











 

extern int setpgrp  (void)  ;









 


extern __pid_t __setsid  (void)  ;
extern __pid_t setsid  (void)  ;






 
extern __uid_t __getuid  (void)  ;
extern __uid_t getuid  (void)  ;

 
extern __uid_t __geteuid  (void)  ;
extern __uid_t geteuid  (void)  ;

 
extern __gid_t __getgid  (void)  ;
extern __gid_t getgid  (void)  ;

 
extern __gid_t __getegid  (void)  ;
extern __gid_t getegid  (void)  ;

 


extern int __getgroups  (int __size, __gid_t __list[])  ;
extern int getgroups  (int __size, __gid_t __list[])  ;







 



extern int __setuid  (__uid_t __uid)  ;
extern int setuid  (__uid_t __uid)  ;


 

extern int __setreuid  (__uid_t __ruid, __uid_t __euid)  ;
extern int setreuid  (__uid_t __ruid, __uid_t __euid)  ;



 
extern int seteuid  (__uid_t __uid)  ;


 



extern int __setgid  (__gid_t __gid)  ;
extern int setgid  (__gid_t __gid)  ;


 

extern int __setregid  (__gid_t __rgid, __gid_t __egid)  ;
extern int setregid  (__gid_t __rgid, __gid_t __egid)  ;



 
extern int setegid  (__gid_t __gid)  ;



 


extern __pid_t __fork  (void)  ;
extern __pid_t fork  (void)  ;


 



extern __pid_t __vfork  (void)  ;
extern __pid_t vfork  (void)  ;



 

extern char *ttyname  (int __fd)  ;

 

extern int __ttyname_r  (int __fd, char *__buf, size_t __buflen)  ;
extern int ttyname_r  (int __fd, char *__buf, size_t __buflen)  ;

 

extern int __isatty  (int __fd)  ;
extern int isatty  (int __fd)  ;


 

extern int ttyslot  (void)  ;



 
extern int __link  (__const char *__from, __const char *__to)  ;
extern int link  (__const char *__from, __const char *__to)  ;


 
extern int __symlink  (__const char *__from, __const char *__to)  ;
extern int symlink  (__const char *__from, __const char *__to)  ;

 


extern int __readlink  (__const char *__path, char *__buf, size_t __len)  ;
extern int readlink  (__const char *__path, char *__buf, size_t __len)  ;


 
extern int __unlink  (__const char *__name)  ;
extern int unlink  (__const char *__name)  ;

 
extern int __rmdir  (__const char *__path)  ;
extern int rmdir  (__const char *__path)  ;


 
extern __pid_t tcgetpgrp  (int __fd)  ;

 
extern int tcsetpgrp  (int __fd, __pid_t __pgrp_id)  ;


 
extern char *getlogin  (void)  ;








 
extern int setlogin  (__const char *__name)  ;




 
























extern int getopt  (int __argc, char *__const * __argv,
			__const char *__opts)  ;
extern int opterr;
extern int optind;
extern int optopt;
extern char *optarg;





 


extern int __gethostname  (char *__name, size_t __len)  ;
extern int gethostname  (char *__name, size_t __len)  ;

 

extern int sethostname  (__const char *__name, size_t __len)  ;

 

extern int sethostid  (long int __id)  ;


 


extern int getdomainname  (char *__name, size_t __len)  ;
extern int setdomainname  (__const char *__name, size_t __len)  ;


 
extern int fsync  (int __fd)  ;


 


extern int vhangup  (void)  ;

 
extern int revoke  (__const char *__file)  ;


 




extern int profil  (unsigned short int *__sample_buffer, size_t __size,
			size_t __offset, unsigned int __scale)  ;


 


extern int acct  (__const char *__name)  ;

 

extern int chroot  (__const char *__path)  ;


 
extern char *getusershell  (void)  ;
extern void endusershell  (void)  ;  
extern void setusershell  (void)  ;  


 

extern char *getpass  (__const char *__prompt)  ;

 


extern int daemon  (int __nochdir, int __noclose)  ;






 
extern long int gethostid  (void)  ;

 
extern int sync  (void)  ;


 

extern int __getpagesize  (void)  ;
extern int getpagesize  (void)  ;


 
extern int truncate  (__const char *__file, __off_t __length)  ;

 
extern int ftruncate  (int __fd, __off_t __length)  ;


 

extern int __getdtablesize  (void)  ;
extern int getdtablesize  (void)  ;






 

extern int __brk  (void *  __addr)  ;
extern int brk  (void *  __addr)  ;


# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 1 3






 


# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3



 


 





 


# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3


 





 


















 





 

 


# 126 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3


 




 

 


# 182 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3





 




 


# 256 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3
















 

# 302 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.27/include/stddef.h" 3




 













 







# 768 "/usr/include/unistd.h" 2 3


 



extern void *  __sbrk  (ptrdiff_t __delta)  ;
extern void *  sbrk  (ptrdiff_t __delta)  ;




 









extern long int syscall  (long int __sysno, ...)  ;






 



 








extern int lockf  (int __fd, int __cmd, __off_t __len)  ;



# 833 "/usr/include/unistd.h" 3



 

extern int fdatasync  (int __fildes)  ;



 

# 861 "/usr/include/unistd.h" 3


} 


# 17 "gen-include.cc" 2

# 1 "/usr/include/string.h" 1 3
 

















 



# 250 "/usr/include/string.h" 3

# 18 "gen-include.cc" 2

# 1 "/usr/include/ctype.h" 1 3
 

















 








extern "C" { 


 







# 1 "/usr/include/endian.h" 1 3
 





















 









 
# 1 "/usr/include/bytesex.h" 1 3
 


# 34 "/usr/include/endian.h" 2 3










# 39 "/usr/include/ctype.h" 2 3







enum
{
  _ISupper = ( 0  < 8 ? ((1 <<  0 ) << 8) : ((1 <<  0 ) >> 8)) ,	 
  _ISlower = ( 1  < 8 ? ((1 <<  1 ) << 8) : ((1 <<  1 ) >> 8)) ,	 
  _ISalpha = ( 2  < 8 ? ((1 <<  2 ) << 8) : ((1 <<  2 ) >> 8)) ,	 
  _ISdigit = ( 3  < 8 ? ((1 <<  3 ) << 8) : ((1 <<  3 ) >> 8)) ,	 
  _ISxdigit = ( 4  < 8 ? ((1 <<  4 ) << 8) : ((1 <<  4 ) >> 8)) ,	 
  _ISspace = ( 5  < 8 ? ((1 <<  5 ) << 8) : ((1 <<  5 ) >> 8)) ,	 
  _ISprint = ( 6  < 8 ? ((1 <<  6 ) << 8) : ((1 <<  6 ) >> 8)) ,	 
  _ISgraph = ( 7  < 8 ? ((1 <<  7 ) << 8) : ((1 <<  7 ) >> 8)) ,	 
  _ISblank = ( 8  < 8 ? ((1 <<  8 ) << 8) : ((1 <<  8 ) >> 8)) ,	 
  _IScntrl = ( 9  < 8 ? ((1 <<  9 ) << 8) : ((1 <<  9 ) >> 8)) ,	 
  _ISpunct = ( 10  < 8 ? ((1 <<  10 ) << 8) : ((1 <<  10 ) >> 8)) ,	 
  _ISalnum = ( 11  < 8 ? ((1 <<  11 ) << 8) : ((1 <<  11 ) >> 8)) 	 
};


 










extern __const unsigned short int *__ctype_b;	 
extern __const int *__ctype_tolower;  
extern __const int *__ctype_toupper;  












 



extern int  isalnum   (int)   ;
extern int  isalpha   (int)   ;
extern int  iscntrl   (int)   ;
extern int  isdigit   (int)   ;
extern int  islower   (int)   ;
extern int  isgraph   (int)   ;
extern int  isprint   (int)   ;
extern int  ispunct   (int)   ;
extern int  isspace   (int)   ;
extern int  isupper   (int)   ;
extern int  isxdigit   (int)   ;






 
extern int tolower  (int __c)  ;

 
extern int toupper  (int __c)  ;




 

extern int isascii  (int __c)  ;

 

extern int toascii  (int __c)  ;




 
extern int  _toupper   (int)   ;
extern int  _tolower   (int)   ;





























} 


# 19 "gen-include.cc" 2



 




 



class  TypeNmSet  {	public:	 TypeNmSet ();	 TypeNmSet (int predict_count);	~ TypeNmSet ();	int size() const;	bool_t  contains(  const char *  k) const;	bool_t  retrieve(  const char *  k,   const char *  *e) const;	void replace(  const char *  k); void insert(  const char *  k);	void remove(  const char *  k);	void clear();	void check();	void report_stats(char const* msg) const;	class Elements {	public:	Elements( TypeNmSet  const* table);	bool_t  ok() const;	  const char *   get() const;	void next();	private:	 TypeNmSet  const* table;	int index;	void skip_empty();	};	private:	friend class Elements;	enum { empty = 0, occupied = 1, obsolete = 2 };	typedef unsigned char Typ;	int  count;	int  deletecount;	int  tsize;	int  mask;	int  slotBits;	  const char * * elt;	Typ* typ;	int  accesses, collisions;	enum { empty_fraction = 2 };	void init(int s);	void resize();	int find_index(  const char *  k) const;	static int hash2(int x);	static const int prime_table[13];	};	inline  TypeNmSet :: TypeNmSet () {	accesses = collisions = 0;	init(1);	}	inline  TypeNmSet ::~ TypeNmSet () {	delete [] elt;	delete [] typ;	}	inline int  TypeNmSet ::size() const {	return count;	}	inline bool_t   TypeNmSet ::contains(  const char *  k) const {	int i = find_index(k);	return (typ[i] == occupied);	}	inline bool_t   TypeNmSet ::retrieve(  const char *  k,   const char *  *e) const {	int i = find_index(k);	if (typ[i] == occupied)	{ *e = elt[i];	return 1 ; } return 0 ; } inline void  TypeNmSet ::replace(  const char *  k) { int i = find_index(k); if (typ[i] == occupied) elt[i] = k; else insert(k); } inline void  TypeNmSet ::insert(  const char *  k) {	int i = find_index(k);	if (typ[i] != occupied) {	count++;	typ[i] = occupied;	elt[i] = k;	int used = count+deletecount;	if ((tsize <= used) || (tsize < (empty_fraction*used))) {	resize();	}	}	}	inline void  TypeNmSet ::remove(  const char *  k) {	int i = find_index(k);	if (typ[i] == occupied) {	count--;	deletecount++;	typ[i] = obsolete;	if (tsize > 4*empty_fraction*count) {	resize();	}	}	}	inline void  TypeNmSet ::clear() {	delete [] elt;	delete [] typ;	init(1);	}	inline int  TypeNmSet ::hash2(int x) {	return prime_table[x % 13];	}	inline  TypeNmSet ::Elements::Elements( TypeNmSet  const* t) {	table = t;	index = 0;	skip_empty();	}	inline bool_t   TypeNmSet ::Elements::ok() const {	return (index < table->tsize);	}	inline   const char *   TypeNmSet ::Elements::get() const {	return table->elt[index];	}	inline void  TypeNmSet ::Elements::next() {	index++;	skip_empty();	} 
 TypeNmSet :: TypeNmSet (int c) {	accesses = collisions = 0;	int power = 1;	while ((power <= c) || (power < empty_fraction*c)) {	power = power << 1;	}	init(power);	}	void  TypeNmSet ::init(int s) {	count = 0;	deletecount = 0;	tsize = s;	mask = s-1;	slotBits = 0;	int x = s;	while (x > 1) {	x >>= 1;	slotBits++;	}	elt = new   const char * [s];	typ = new Typ[s];	for (int i = 0; i < s; i++) {	typ[i] = empty;	}	}	const int  TypeNmSet ::prime_table[13] = {	3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43	};	void  TypeNmSet ::resize() {	int new_size = 1;	while ((new_size <= count) || (new_size < empty_fraction*count)) {	new_size = new_size << 1;	}	Typ* old_typ = typ;	  const char * * old_elt = elt;	int  old_size = tsize;	init(new_size);	for (int i = 0; i < old_size; i++) {	if (old_typ[i] == occupied) {	insert(old_elt[i]);	}	}	delete [] old_elt;	delete [] old_typ;	}	int  TypeNmSet ::find_index(  const char *  k) const {	(( TypeNmSet *) this)->accesses++;	int h1 =   hash_string (k);	int first = (h1 & ((1 << ((sizeof(int) << 3) - 2) ) - 1) ) >> (((sizeof(int) << 3) - 2)  - slotBits); Typ t = typ[first];	if ((t == empty) || ((t == occupied) && (  (!strcmp( elt[first] ,  k )) ))) { return first;	}	int h2 = hash2(h1);	int i = (first + h2) & mask;	int xcount = 1;	while (1) {	t = typ[i];	if ((t == empty) || ((t == occupied) && (  (!strcmp( elt[i] ,  k )) ))) { (( TypeNmSet *) this)->collisions += xcount;	return i;	}	i = (i + h2) & mask;	xcount++;	if (xcount > tsize) {	fprintf(((_IO_FILE*)(&_IO_stderr_))  , "hash loop\n");	fprintf(((_IO_FILE*)(&_IO_stderr_))  , "   h1 = %d\n", h1);	fprintf(((_IO_FILE*)(&_IO_stderr_))  , "   h2 = %d\n", h2);	fprintf(((_IO_FILE*)(&_IO_stderr_))  , "   sz = %d\n", tsize);	fprintf(((_IO_FILE*)(&_IO_stderr_))  , "   ct = %d\n", count);	((void) (( 0 ) ? 0 :	(__assert_fail ("0" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	}	}	}	void  TypeNmSet ::report_stats(char const* msg) const {	if (accesses == 0) return;	fprintf(((_IO_FILE*)(&_IO_stderr_))  , "%s: %8d accesses, %6.3f collisions per access\n",	msg, accesses,	((double) collisions) / ((double) accesses));	}	void  TypeNmSet ::check() {	int i, j;	for (i = 0; i < tsize; i++) {	if (typ[i] != occupied) continue;	for (j = i+1; j < tsize; j++) {	if (typ[j] == occupied) {	((void) (( !   (!strcmp( elt[i] ,   elt[j] ))  ) ? 0 :	(__assert_fail ("! (!strcmp(elt[i], elt[j]))" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	}	}	}	for (i = 0; i < tsize; i++) {	if (typ[i] != occupied) continue;	bool_t * marked = new bool_t [tsize];	for (j = 0; j < tsize; j++) {	marked[j] = 0 ;	}	int h1 =   hash_string (elt[i]);	int h2 = hash2(h1);	int first = (h1 & ((1 << ((sizeof(int) << 3) - 2) ) - 1) ) >> (((sizeof(int) << 3) - 2)  - slotBits); for (j = 0; j < tsize; j++) {	int index = (first + h2*j) & mask;	((void) (( ! marked[index] ) ? 0 :	(__assert_fail ("! marked[index]" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	marked[index] = 1 ;	}	delete [] marked;	}	for (i = 0; i < tsize; i++) {	if (typ[i] != occupied) continue;	int h1 =   hash_string (elt[i]);	int h2 = hash2(h1);	int first = (h1 & ((1 << ((sizeof(int) << 3) - 2) ) - 1) ) >> (((sizeof(int) << 3) - 2)  - slotBits); for (j = 0; j < tsize; j++) {	int index = (first + h2*j) & mask;	((void) (( typ[index] != empty ) ? 0 :	(__assert_fail ("typ[index] != empty" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	if (index == i) break;	}	}	j = 0;	for (i = 0; i < tsize; i++) {	if (typ[i] == occupied) j++;	}	((void) (( count == j ) ? 0 :	(__assert_fail ("count == j" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	j = 0;	for (i = 0; i < tsize; i++) {	if (typ[i] == obsolete) j++;	}	((void) (( deletecount == j ) ? 0 :	(__assert_fail ("deletecount == j" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	i = 1;	while (i < tsize) {	i = i << 1;	}	((void) (( i == tsize ) ? 0 :	(__assert_fail ("i == tsize" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	((void) (( tsize > count+deletecount ) ? 0 :	(__assert_fail ("tsize > count+deletecount" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	((void) (( mask == (tsize - 1) ) ? 0 :	(__assert_fail ("mask == (tsize - 1)" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	((void) (( tsize == (1 << slotBits) ) ? 0 :	(__assert_fail ("tsize == (1 << slotBits)" ,	"gen-include.cc", 32, __PRETTY_FUNCTION__ ), 0))) ;	}	void  TypeNmSet ::Elements::skip_empty() {	while ((index < table->tsize) && (table->typ[index] != occupied)) {	index++;	}	} 

void method_Cname(wr w, objtype t, method m, bool_t  meth);
void gen_meth_inc_inc(wr w, objtype objt, objtype st);

static void structName(wr w, objtype t)
{
    wr_putChars(w, "struct ");
    wr_putString(w, t->name);
    wr_putChars(w, "_s ");
}

static void dvName(wr w, objtype t)
{
    wr_putChars(w, "struct ");
    wr_putString(w, t->name);
    wr_putChars(w, "dv_s ");
}

void make_include(string filename, string contents)
{
    char const *fn = string_charp(filename);
    string filename2 = string_concat(filename, string_new("-th"));
    if (0 == access(string_charp(filename2), 0 )) {
	string bakfile = string_concat(filename2, string_new("~"));
	if (0>rename(string_charp(filename2),
		     string_charp(bakfile))) {
	    perror(string_charp(filename2));

	};
    }
    FILE *f = fopen(string_charp(filename2), "w");
    string ifdef_name;
    {
	textwr tw = textwr_new();
	wr w = textwr_as_wr(tw);
	char const *end = fn + strlen(fn) - 1;
	while (end > fn && *end != '/') end--;
	wr_putChar(w, '_');
	while (*end) {
	    if (*end != '.')
	      wr_putChar(w, ((int) __ctype_toupper[(int) (  *end  )])  );
	    else
	      wr_putChar(w, '_');
	    end++;
	}
	ifdef_name = textwr_toString(tw);
    }
    fprintf(f, "#ifndef %s\n#define %s\n\n",
	    string_charp(ifdef_name),
	    string_charp(ifdef_name));
    fputs(string_charp(contents), f);
    fprintf(f, "\n#endif /* %s */\n", string_charp(ifdef_name));
    fclose(f);
}

void make_rtn_includes(method m)
{
   string contents = gen_rtn_spec_inc(m);
   make_include(string_concat(m->name, string_new(".h")),
		contents);
}

void make_mkr_includes(method m)
{
   string contents = gen_mkr_spec_inc(m);
   make_include(string_concat(m->name, string_new(".h")),
		contents);
}


 
void make_includes(objtype t, objtype t2)
{
    string contents = gen_def_inc(t);
    make_include(string_concat(t->name, string_new("_def.h")),
		 contents);
    contents = gen_spec_inc(t);
    make_include(string_concat(t->name, string_new(".h")),
		 contents);
    contents = gen_meth_inc(t);
    make_include(string_concat(t->name, string_new("_meth.h")),
		 contents);

    class_ c = objtype_as_class(t);
    if (exc) {
	exc = 0 ;
	return;
    }
    class_ c2 = objtype_as_class(t2);
    contents = gen_class_inc(c, c2);
    make_include(string_concat(t->name, string_new("_class.h")),
		 contents);
}

string gen_def_inc(objtype t)
{
    textwr tw = textwr_new();
    wr w = textwr_as_wr(tw);
    wr_putChars(w, "typedef ");
    structName(w, t);
    wr_putChar(w, '*');
    wr_putString(w, t->name);
    wr_putChars(w, "_C;\n");
    wr_putChars(w, "typedef ");
    dvName(w, t);
    wr_putChars(w, "**");
    wr_putString(w, t->name);
    wr_putChars(w, ";\n");
    return textwr_toString(tw);
}

void type_Cname(wr w, type t)
{
    if (t == (type)Null)
	wr_putChars(w, "null");
    else if (t == (type)Real)
	wr_putChars(w, "real");
    else if (t == (type)Type)
	wr_putChars(w, "type");
    else if (t == (type)Class)
	wr_putChars(w, "class_");
    else wr_putString(w, type_name(t));
}

void type_Cname_short(wr w, type t)
{
    if (t == (type)Null)
	wr_putChars(w, "null");
    else if (type_kind(t) == 5 )
	wr_putChars(w, "pval");
    else if (t == (type)Real)
	wr_putChars(w, "real");
    else if (t == (type)Type)
	wr_putChars(w, "type");
    else if (t == (type)Class)
	wr_putChars(w, "class_");
    else {
	    string cname = type_name(t);
	    const char *cnm = string_charp(cname);
	    char *cptr = index(cnm, '[');
	    if (cptr) cname = string_newn(cnm, cptr-cnm);
	    wr_putString(w, cname);
	 }
}

void method_Cname(wr w, objtype t, method m, bool_t  meth)
{
    int l = string_length(m->name);
    bool_t  ends_bang = string_fetch(m->name, l - 1) == '!';

    if (!meth && t) {
	wr_putString(w, t->name);
	wr_putChar(w, '_');
    }
    if (ends_bang) {
	wr_putChars(w, "change_");
	l--;
    }
    int i;
    for (i=0; i<l; i++) {
	char c = string_fetch(m->name, i);
	wr_putChar(w, c);
    }
}

void gen_spec_arg(wr w, formal f)
{
 
    wr_putChars(w, ", ");
    type_Cname_short(w, f->t);
    wr_putChar(w, ' ');
    wr_putString(w, f->name);
}

void gen_spec_method_args(wr w, method m)
{
    int num_args = vec_length(m->arguments);
    formal *args = (formal *)vec_items(m->arguments);
    int i;
    for (i=0; i<num_args; i++) {
	gen_spec_arg(w, args[i]);
    }
    if (vec_length(m->extra_args)) {
	wr_putChars(w, ", ...");
    }
}

void gen_spec_C_args(wr w, method m, objtype t)
 
{
     
     
     
    if (t != (objtype)0) {
	type_Cname_short(w, objtype_as_type(t));
	wr_putChars(w, " self");
    } else {
	wr_putChars(w, "obj null_dummy");
    }
    int num_rets = vec_length(m->returns);
    if (num_rets > 1) {
	wr_putChars(w, ", fevalue *__retvals");
    }
    if (m->iter) {
	wr_putChars(w, ", struct closure");
    }
    gen_spec_method_args(w, m);
}

void gen_spec_method(wr w, method m, objtype t, bool_t  meth)
{
    if (!meth) wr_putChars(w, "extern ");
    else wr_putChars(w, "  ");
    int num_rets = vec_length(m->returns);
    switch (num_rets) {
      case 0:
	wr_putChars(w, "void ");
	break;
      default:
	objtype t = (( objtype )(  vec_fetch(m->returns, 0) )) ;
	type_Cname_short(w, objtype_as_type(t));
	wr_putChar(w, ' ');
    }
    if (meth) wr_putChars(w, "(*");
    method_Cname(w, t, m, meth);
    if (meth) wr_putChars(w, ")");
    wr_putChar(w, '(');
    gen_spec_C_args(w, m, t);
    wr_putChars(w, ");\n");
    if (!meth) {
	wr_putChars(w, "/*\n");
	wr_putString(w, m->spec);
	wr_putChars(w, "\n*/\n");
    }
}

void gen_spec_mkr(wr w, method m)
{
    wr_putChars(w, "extern ");
    wr_putChars(w, "void ");


    method_Cname(w, 0, m, 0 );
    wr_putChar(w, '(');

    objtype t = (( objtype )(  vec_fetch(m->returns, 0) )) ;
 





    gen_spec_C_args(w, m, t);
    wr_putChars(w, ");\n");
}

void gen_spec_method_(wr w, method m, objtype t, bool_t  meth)
{
    if (!meth) wr_putChars(w, "extern ");
    else wr_putChars(w, "  ");
    int num_rets = vec_length(m->returns);
    switch (num_rets) {
      case 0:
	wr_putChars(w, "void ");
	break;
      default:
	objtype t = (( objtype )(  vec_fetch(m->returns, 0) )) ;
	type_Cname_short(w, objtype_as_type(t));
	wr_putChar(w, ' ');
    }
    if (meth) wr_putChars(w, "(*");
    method_Cname(w, t, m, meth);
    wr_putChars(w, "_");
    if (meth) wr_putChars(w, ")");
    wr_putChar(w, '(');
    gen_spec_C_args(w, m, t);
    wr_putChars(w, ");\n");
    if (!meth) {
	wr_putChars(w, "/*\n");
	wr_putString(w, m->spec);
	wr_putChars(w, "\n*/\n");
    }
}

string gen_spec_inc(objtype t)
{
    textwr tw = textwr_new();
    wr w = textwr_as_wr(tw);
    wr_putChars(w, "#include \"");
    wr_putString(w, t->name);
    wr_putChars(w, "_def.h\"\n\n");
     
     
    int nst = vec_length(t->supertypes_);
    objtype st;
    if (nst) st = (( objtype )(  vec_fetch(t->supertypes_, 0) )) ;
    else st = 0;
    if (st && st != Any) {
      wr_putChars(w, "#include \"");
      wr_putString(w, st->name);
      wr_putChars(w, "_meth.h\"\n");
      wr_putChars(w, "#include \"");
      wr_putString(w, st->name);
      wr_putChars(w, ".h\"\n");
    }
    gen_meth_inc_inc(w, t, st);
    wr_putChars(w, "extern ");
    exc = 0 ;
    class_ c = objtype_as_class(t);
    if (exc) wr_putChars(w, "type ");
    else wr_putChars(w, "class_ ");
    exc = 0 ;
    wr_putString(w, t->name);
    wr_putChars(w, "V;\n");
    int num_methods = vec_length(t->methods_);
    method *m = (method *)vec_items(t->methods_);
    wr_putChars(w, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
    wr_putChars(w, "/*\n");
    wr_putString(w, t->overview);
    wr_putChars(w, "\n*/\n");
    int i;
    for (i = 0; i < num_methods; i++) {
	gen_spec_method(w, m[i], t, 0 );
    }
    wr_putChars(w, "\nextern void init");
    wr_putString(w, t->name);
    wr_putChars(w, "();\n");
    wr_putChars(w, "\n#ifdef __cplusplus\n}\n#endif\n");
    return textwr_toString(tw);
}

void gen_meth_inc_inc(wr w, objtype objt, objtype st)
{
    TypeNmSet types_used;
    int i, j, k;

    int num_methods = vec_length(objt->methods_);
    method *mp = (method *)vec_items(objt->methods_);
    for (i = 0; i < num_methods; i++) {
      method m = mp[i];
      if (vec_length(m->arguments)) {
	for (j = 0; j < vec_length(m->arguments); j++) {
		formal f = (( formal )(  vec_fetch(m->arguments, j) )) ;
		objtype ot = type_as_objtype(f->t);
		if (ot == objt || ot == st) continue;
	        types_used.insert(string_charp(typeExtNm2SimpleNm(
			type_name(f->t))));
		}
	}
      if (vec_length(m->returns)) {
	for (j = 0; j < vec_length(m->returns); j++) {
		type t = (( type )(  vec_fetch(m->returns, j) )) ;
		objtype ot = type_as_objtype(t);
		if (ot == objt || ot == st) continue;
	        types_used.insert(string_charp(typeExtNm2SimpleNm(
			type_name(t))));
		}
	}
      if (vec_length(m->signals)) {
	for (j = 0; j < vec_length(m->signals); j++) {
		signal_ s = (( signal_ )(  vec_fetch(m->signals, j) )) ;
		if (vec_length(s->returns)) {
			for (k = 0; k < vec_length(s->returns); k++) {
				type t = (( type )(  vec_fetch(s->returns, k) )) ;
				objtype ot = type_as_objtype(t);
				if (ot == objt || ot == st) continue;
	        		types_used.insert(string_charp(
					typeExtNm2SimpleNm( type_name(t))));
				}
			}
		}
	}
    }
    for (TypeNmSet::Elements each(&types_used); each.ok(); each.next()) {
	const char *included_tnm = each.get();
	wr_putChars(w, "#include \"");
	wr_putChars(w, included_tnm);
	wr_putChars(w, ".h\"\n");
	}
}

string gen_meth_inc(objtype t)
{
    textwr tw = textwr_new();
    wr w = textwr_as_wr(tw);
    int nst = vec_length(t->supertypes_);
    objtype st;
    if (nst) st = (( objtype )(  vec_fetch(t->supertypes_, 0) )) ;
    else st = 0;
     



    if (st && st != Any) {
      wr_putChars(w, "#include \"");
      wr_putString(w, st->name);
      wr_putChars(w, "_meth.h\"\n");
    }
    wr_putChars(w, "#include \"");
    wr_putString(w, t->name);
    wr_putChars(w, ".h\"\n");
    gen_meth_inc_inc(w, t, st);
    wr_putChars(w, "#include \"runtime/obj_class.h\"\n\n");
    wr_putChars(w, "struct ");
    wr_putString(w, t->name);
    wr_putChars(w, "dv_s {\n");
    wr_putChars(w, "  struct ");
    if (st && st != Any) {
      wr_putString(w, st->name);
    }
    wr_putChars(w, "dv_s super;\n");
    int num_methods = vec_length(t->methods_);
    method *m = (method *)vec_items(t->methods_);
    int i;
    for (i = 0; i < num_methods; i++) {
      gen_spec_method(w, m[i], t, 1 );
    }
    wr_putChars(w, "};\n");

    num_methods = vec_length(t->methods_);
    m = (method *)vec_items(t->methods_);
    wr_putChars(w, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");

    return textwr_toString(tw);
}

string gen_class_inc(class_ c, class_ c2)
{
    {  ; if (((*( (obj)( c ) ))->t != 0) )  c  = (  class_ )get_address((obj)( c )); } ;
    textwr tw = textwr_new();
    objtype t = class_as_objtype(c);
    wr w = textwr_as_wr(tw);
    wr_putChars(w, "#include \"");
    wr_putString(w, t->name);
    wr_putChars(w, "_meth.h\"\n");
    class_ sc = class_superclass(c);
    if (exc) {
	sc = 0;
	exc = 0 ;
    } else {
	{  ; if (((*( (obj)( sc ) ))->t != 0) )  sc  = (  class_ )get_address((obj)( sc )); } ;
    }
    if (sc) {
      wr_putChars(w, "#include \"");
      wr_putString(w, sc->hdr.inh.name);
      wr_putChars(w, "_class.h\"\n\n");
    }

    if (!c->special) {
	formal *fields = (formal *)vec_items(c->fields);
	int l = vec_length(c->fields);
	int i;
	TypeNmSet types_used;
	for (i = 0; i < l; i++) {
	    formal f = fields[i];
	    types_used.insert(string_charp(typeExtNm2SimpleNm(type_name(f->t))));
	}
        for (TypeNmSet::Elements each(&types_used); each.ok(); each.next()) {
            const char *included_tnm = each.get();
            wr_putChars(w, "#include \"");
	    wr_putChars(w, included_tnm);
            wr_putChars(w, ".h\"\n");
        }
    }

    structName(w, t);
    wr_putChars(w, "{\n");

    wr_putChars(w, "  union {\n");

    if (sc) {
	wr_putChars(w, "    ");
	structName(w, class_as_objtype(sc));
	wr_putChars(w, " inh;\n");
    } else {
	wr_putChars(w, "    struct core_s inh;\n");
    }
    wr_putChars(w, "    struct ");
    wr_putString(w, t->name);
    wr_putChars(w, "dv_s *methods;\n");
    wr_putChars(w, "  } hdr;\n");
    if (c->special) {
	wr_putString(w, c->specialText);
    } else {
	int l = vec_length(c->fields);
	int i;
	int skip;
	if (sc) {
	    skip = vec_length(sc->fields);
	} else {
	    skip = 0;
	}
	formal *fields = (formal *)vec_items(c->fields);
	for (i = skip; i < l; i++) {
	    formal f = fields[i];
	    wr_putChars(w, "  ");
	    type_Cname_short(w, f->t);
	    wr_putChar(w, ' ');
	    wr_putString(w, f->name);
	    wr_putChars(w, ";\n");
	}
    }
    wr_putChars(w, "};\n\n");

 







    wr_putChars(w, "extern struct ");
    wr_putString(w, t->name);
    wr_putChars(w, "dv_s ");
    wr_putString(w, t->name);
    wr_putChars(w, "_methods;\n\n");

    t = class_as_objtype(c2);
    int num_methods = vec_length(t->methods_);
    method *m = (method *)vec_items(t->methods_);
    int i;
    for (i = 0; i < num_methods; i++) {
        gen_spec_method_(w, m[i], t, 0 );
	}

    return textwr_toString(tw);
}

string gen_rtn_spec_inc(method m)
{
    textwr tw = textwr_new();
    wr w = textwr_as_wr(tw);
    wr_putChars(w, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
    gen_spec_method(w, m, 0, 0 );
    wr_putChars(w, "extern ");
    wr_putChars(w, "class_ ");
    wr_putString(w, m->name);       
    wr_putChars(w, "_rtn_classV;\n");
    wr_putChars(w, "extern void init");
    wr_putString(w, m->name);       
    wr_putChars(w, "_rtn_class();\n");
    wr_putChars(w, "\n#ifdef __cplusplus\n}\n#endif\n");
    return textwr_toString(tw);
}

string gen_mkr_spec_inc(method m)
{
    textwr tw = textwr_new();
    wr w = textwr_as_wr(tw);
    wr_putChars(w, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
    gen_spec_mkr(w, m);
    wr_putChars(w, "\n#ifdef __cplusplus\n}\n#endif\n");
    return textwr_toString(tw);
}
