#include "cdefs.h"
#include "mem.h"
extern cptr object_methods[meth_max];
#include "cint.h"
extern cptr strpool_methods[meth_max];
extern cptr selector_methods[meth_max];
extern cptr string_methods[meth_max];
extern cptr sstring_methods[meth_max];
extern cptr pstring_methods[meth_max];
#include "cstring.h"
extern cptr integer_methods[meth_max];

extern cint strpool_str_16;

cint abstract_counter;

cptr abstract_methods[meth_max];

cint abstract_alloc(cint abstract_self){
  cint abstract_result;
  cint t1, t2, t3;
  t2 = object_alloc((cint)abstract_self);
  abstract_result = t2;
  ((cptr)abstract_self)[4] /* class_of*/ = strpool_str_16;
  ((cptr)abstract_self)[2] /* hashval*/ = abstract_counter;
  t3 = abstract_counter + 1;
  abstract_counter = t3;
  t1 = abstract_result;
  goto t1_label;
  t1_label: return t1;
}

cint abstract_reclaim(cint abstract_self){
  cint t4;
  object_reclaim((cint)abstract_self);
  t4_label: return t4;
}

cint abstract_Mkstr(cint abstract_self){
  cint abstract_result;
  cint t5, t6, t7;
  t6 = mem_malloc(40); ((cptr)t6)[0] = sstring_methods;
  t7 = sstring_alloc((cint)t6, (cint)cstring_int2str((cint)((cptr)abstract_self)[2] /* hashval*/));
  abstract_result = t7;
  object_Dec_ref(abstract_self);
  t5 = abstract_result;
  goto t5_label;
  t5_label: return t5;
}

cint abstract_Set_attribute(cint abstract_self, cint abstract_aname, cint abstract_aval){
  cint abstract_result;
  cint t8, t9, t10, t11, t12;
  ((cptr)abstract_self)[1] += 1;
  t9 = ((cptr)(((cptr)abstract_aname)[0]))[73];
  t10 = ((f0)t9)((cint)abstract_aname, (cint)abstract_self); /* Make_selector*/
  t12 = (cptr)(((cptr)(((cptr)t10)[0]))[96]); /* OpAssign*/
  ((f0)t12)((cint)t10, (cint)abstract_aval, (cint)0);
  t8 = abstract_self;
  goto t8_label;
  t8_label: return t8;
}

void init_abstract(){
  copy_meth_table(abstract_methods, object_methods);
  abstract_methods[0] = 28;
  abstract_methods[3] = abstract_alloc;
  abstract_methods[4] = abstract_reclaim;
  abstract_methods[88] = abstract_Mkstr;
  abstract_methods[101] = abstract_Set_attribute;
  abstract_counter = 1;
}
