Permalink
Browse files

Added fx* to support factorial example.

  • Loading branch information...
1 parent 1431f80 commit 9cba588076c7a9f3c57b9a46f095783553bb11fc @gnuvince gnuvince committed May 22, 2012
Showing with 20 additions and 0 deletions.
  1. +9 −0 gsc/target_js.scm
  2. +11 −0 gsc/target_php.scm
View
@@ -76,6 +76,15 @@ function lbl1_fx_3c_() { // fx<
glo["fx<"] = lbl1_fx_3c_;
+function lbl1_fx_2a_() { // fx*
+ if (nargs !== 2) throw "wrong number of arguments";
+ reg[1] = reg[1] * reg[2];
+ return reg[0];
+}
+
+glo["fx*"] = lbl1_fx_2a_;
+
+
function lbl1_fx_2b_() { // fx+
if (nargs !== 2) throw "wrong number of arguments";
reg[1] = reg[1] + reg[2];
View
@@ -92,6 +92,17 @@ return $reg[0];
};
$glo["fx+"] = 'lbl1_fx_2b_';
+function lbl1_fx_2a_() { // fx*
+global $reg;
+global $stack;
+global $sp;
+global $nargs;
+if ($nargs !== 2) die("wrong number of arguments");
+$reg[1] = $reg[1] * $reg[2];
+return $reg[0];
+};
+$glo["fx*"] = 'lbl1_fx_2a_';
+
function lbl1_fx_2d_() {
global $reg;
global $stack;

0 comments on commit 9cba588

Please sign in to comment.