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

extern cint strpool_str_34;


cptr idstring_methods[meth_max];

cint idstring_alloc(cint idstring_self, cint idstring_strbuf){
  cint idstring_result, idstring_strln;
  cint t1, t2;
  idstring_strln = cstring_strlen((cint)idstring_strbuf);
  t2 = string_alloc((cint)idstring_self);
  idstring_result = t2;
  ((cptr)idstring_result)[5] /* representation*/ = strpool_str_34;
  ((cptr)idstring_result)[2] /* hashval*/ = cstring_strsum((cint)idstring_strbuf);
  ((cptr)idstring_result)[3] /* len*/ = idstring_strln;
  ((cptr)idstring_result)[8] /* buf*/ = idstring_strbuf;
  ((cptr)idstring_result)[9] /* elem*/ = 0;
  t1 = idstring_result;
  goto t1_label;
  t1_label: return t1;
}

cint idstring_reclaim(cint idstring_self){
  cint t3, t4;
  t4 = ((cptr)idstring_self)[9] /* elem*/ != 0;
  if (t4){
    object_Dec_ref(((cptr)idstring_self)[9] /* elem*/);
  };
  string_reclaim((cint)idstring_self);
  t3_label: return t3;
}

void init_idstring(){
  copy_meth_table(idstring_methods, sstring_methods);
  idstring_methods[0] = 40;
  idstring_methods[3] = idstring_alloc;
  idstring_methods[4] = idstring_reclaim;
}
