Created
January 2, 2021 07:52
-
-
Save miura1729/f73748a3cadc4ada266668def9272d0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mruby.h> | |
#include <mruby/value.h> | |
#include <mruby/array.h> | |
#include <mruby/hash.h> | |
#include <mruby/throw.h> | |
#include <mruby/proc.h> | |
#include <mruby/string.h> | |
#include <mruby/range.h> | |
#include <mruby/error.h> | |
#include <mruby/variable.h> | |
#include <mruby/throw.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#undef mrb_int | |
typedef mrb_float mrb_float2; | |
#define mrb_float_value2(n) ({\ | |
mrb_value rc; \ | |
rc.f = n; \ | |
rc; \ | |
}) | |
#define mmc_boxing_array(src, size, boxing_func) ({ \ | |
mrb_value ary; \ | |
ary = mrb_ary_new_capa(mrb, (size)); \ | |
for (int i = 0; i < (size); i++) { \ | |
mrb_ary_push(mrb, ary, (boxing_func)(mrb, (src)[i])); \ | |
} \ | |
ary; \ | |
}) | |
typedef void *gproc; | |
struct gctab { | |
int size; | |
int csize; | |
int osize; | |
struct gctab *prev; | |
mrb_value **complex; | |
mrb_value **object; | |
void *caller_alloc; | |
int ret_status; | |
mrb_value *single[0]; | |
}; | |
void mrb_mark_local(mrb_state *mrb) | |
{ | |
struct gctab *curtab = (struct gctab *)mrb->ud; | |
while (curtab) { | |
for (int i = curtab->size; i--;) { | |
if (!mrb_immediate_p(*curtab->single[i])) { | |
mrb_gc_mark(mrb, mrb_basic_ptr(*curtab->single[i])); | |
} | |
} | |
for (int i = curtab->osize; i--;) { | |
if (!mrb_immediate_p(*curtab->object[i])) { | |
mrb_gc_mark(mrb, mrb_basic_ptr(*curtab->object[i])); | |
} | |
} | |
for (int i = curtab->csize; i--;) { | |
mrb_value *cptr = curtab->complex[i]; | |
for (int j = 0; cptr[j].value.ttt != MRB_TT_FREE; j++) { | |
if (!mrb_immediate_p(cptr[i])) { | |
mrb_gc_mark(mrb, mrb_basic_ptr(cptr[j])); | |
} | |
} | |
} | |
curtab = curtab->prev; | |
} | |
} | |
struct env3 { | |
struct env0 *prev; | |
}; | |
struct cls0_5 { | |
}; | |
struct cls3_5 { | |
}; | |
struct proc1 { | |
int id; | |
void *code[0]; | |
struct cls3_5 * self; | |
}; | |
static mrb_int main_Object_0(mrb_state *, mrb_value self,struct gctab *); | |
static mrb_int days__Fixnum__3(mrb_state *, mrb_int self,struct gctab *); | |
int main(int argc, char **argv) | |
{ | |
mrb_state *mrb = mrb_open(); | |
struct mrb_jmpbuf c_jmp; | |
MRB_TRY(&c_jmp) { | |
mrb->jmp = &c_jmp; | |
main_Object_0(mrb, mrb_top_self(mrb), NULL); | |
} | |
MRB_CATCH(&c_jmp) { | |
mrb_p(mrb, mrb_obj_value(mrb->exc)); | |
return 1; | |
} | |
MRB_END_EXC(&c_jmp); | |
return 0; | |
} | |
static mrb_int main_Object_0(mrb_state *mrb, mrb_value self, struct gctab *prevgctab) { | |
struct proc1 v27; | |
mrb_int v18; | |
struct gctab *gctab = prevgctab; | |
L0:; | |
struct cls3_5 * f14(){ | |
struct cls3_5 * self; | |
L1:; | |
v27.id = 1; | |
v27.self = self; | |
return self; | |
} | |
f14(); | |
v18 = days__Fixnum__3(mrb, 2, gctab); | |
return v18; | |
} | |
static mrb_int days__Fixnum__3(mrb_state *mrb, mrb_int self, struct gctab *prevgctab) { | |
struct env3 env; | |
struct REnv *venv = NULL; | |
struct gctab *gctab = prevgctab; | |
L5:; | |
return (((self * 60) * 60) * 24); | |
} | |
/* | |
Class Object | |
Instance variables | |
methodes | |
Class Fixnum | |
Instance variables | |
methodes | |
days (Fixnum e=false, NilClass e=false l=0 var=0) -> Fixnum e=false pos =false | |
Class #<Class:Object> | |
Instance variables | |
methodes | |
Class #<Class:Fixnum> | |
Instance variables | |
methodes | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment