Permalink
Browse files

Fill in and correct the code in pmc_func for size.

  • Loading branch information...
1 parent 09730b8 commit 4a4fee1eb8c7ebcc2900420172d153cd022bf443 @atrodo committed Nov 26, 2010
Showing with 12 additions and 3 deletions.
  1. +12 −3 pmc_func.c
View
15 pmc_func.c
@@ -5,10 +5,19 @@
#include "pmc_func.h"
#include "interp.h"
+void lorito_pmc_func(Lorito_Interp *interp, Lorito_Ctx *ctx, Lorito_Str *func)
+{
+ if (func == lorito_string(interp, 0, "size"))
+ {
+ lorito_pmc_func_size(interp, ctx);
+ }
+}
+
void
lorito_pmc_func_size(Lorito_Interp *interp, Lorito_Ctx *ctx)
{
- Lorito_PMC *source = lorito_pop_arg(ctx);
- lorito_clr_arg(ctx);
- lorit_push_arg(interp, ctx, source->size);
+ Lorito_PMC *source = lorito_pop_arg(interp, ctx);
+ lorito_clr_arg(interp, ctx);
+ Lorito_PMC *size = lorito_box_int_new(interp, source->size);
+ lorito_push_arg(interp, ctx, size);
}

0 comments on commit 4a4fee1

Please sign in to comment.