Skip to content

Instantly share code, notes, and snippets.

@jduey
Last active February 27, 2019 14:22
Show Gist options
  • Select an option

  • Save jduey/47a4829ee84afee9cd3a36ca0a87d241 to your computer and use it in GitHub Desktop.

Select an option

Save jduey/47a4829ee84afee9cd3a36ca0a87d241 to your computer and use it in GitHub Desktop.

Revisions

  1. jduey revised this gist Feb 27, 2019. 1 changed file with 7 additions and 6 deletions.
    13 changes: 7 additions & 6 deletions loop.c
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ Value *g_loop_3950(List *closures, Value *tmp_0, Value *n_1) {

    // static-fixed
    // #line 4 "recur-test.toc"
    Value *rslt5 = g_inc_1140(empty_list, tmp_0);
    Value *rslt5 = g_add_numbers_131(empty_list, numPtr5, tmp_0);

    // static-fixed
    // #line 4 "recur-test.toc"
    @@ -39,27 +39,28 @@ Value *g_loop_3950(List *closures, Value *tmp_0, Value *n_1) {
    if(arity7 != (FnArity *)0 && !arity7->variadic) { FnType2 *fn9 = (FnType2 *)arity7->fn;


    // dynamic fn type
    // dynamic fn type
    // #line 4 "recur-test.toc"
    rslt10 = fn9(arity7->closures, rslt5, rslt6);
    } else if(arity7 != (FnArity *)0 && arity7->variadic) { FnType1 *fn9 = (FnType1 *)arity7->fn;
    List *dynArgs8 = empty_list;
    dynArgs8 = (List *)listCons(rslt6, dynArgs8);
    dynArgs8 = (List *)listCons(rslt5, dynArgs8);

    // dynamic fn type
    // dynamic fn type
    // #line 4 "recur-test.toc"
    rslt10 = fn9(arity7->closures, (Value *)dynArgs8);
    } else {
    fprintf(stderr, "\n*** no arity found for '%s' at: %s, %d.\n", ((Function *)g_loop_3949)->name, "recur-test.toc", 4);
    abort();
    }
    dec_and_free(g_loop_3949, 1);

    // static-fixed
    // #line 4 "recur-test.toc"
    Value *rslt11 = g_inc_1140(empty_list, rslt10);
    Value *rslt11 = g_add_numbers_131(empty_list, numPtr5, rslt10);
    return(rslt11);
    }

    };};
    };
    };
    Value *g_loop_3949 = (Value *)&g_loop_3953;
  2. jduey created this gist Feb 27, 2019.
    65 changes: 65 additions & 0 deletions loop.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,65 @@
    Value *g_loop_3949;
    Value *g_loop_3950(List *closures, Value *tmp_0, Value *n_1) {
    while (1) {
    incRef(tmp_0, 1);
    incRef(n_1, 1);
    Value *andRslt2;

    // static-fixed
    // #line 3 "recur-test.toc"
    Value *rslt3 = g__LT__806(empty_list, n_1, numPtr0);
    andRslt2 = rslt3;
    if (isNothing(andRslt2,"",0)) {
    dec_and_free(tmp_0, 1);
    } else {
    dec_and_free(andRslt2, 1);

    // call-maybe
    // #line 3 "recur-test.toc"
    Value *maybe4 = (Value *)maybe((List *)0, (Value *)0, tmp_0);
    andRslt2 = maybe4;
    }
    if (!isNothing(andRslt2,"",0)) {
    Value *rslt12 = maybeExtract(andRslt2);
    dec_and_free(tmp_0, 1);
    dec_and_free(n_1, 1);
    return(rslt12);
    } else {
    dec_and_free(andRslt2, 1);

    // static-fixed
    // #line 4 "recur-test.toc"
    Value *rslt5 = g_inc_1140(empty_list, tmp_0);

    // static-fixed
    // #line 4 "recur-test.toc"
    Value *rslt6 = g_dec_1158(empty_list, n_1);
    Value *rslt10;
    FnArity *arity7 = findFnArity(g_loop_3949, 2);
    if(arity7 != (FnArity *)0 && !arity7->variadic) { FnType2 *fn9 = (FnType2 *)arity7->fn;


    // dynamic fn type
    // #line 4 "recur-test.toc"
    rslt10 = fn9(arity7->closures, rslt5, rslt6);
    } else if(arity7 != (FnArity *)0 && arity7->variadic) { FnType1 *fn9 = (FnType1 *)arity7->fn;
    List *dynArgs8 = empty_list;
    dynArgs8 = (List *)listCons(rslt6, dynArgs8);
    dynArgs8 = (List *)listCons(rslt5, dynArgs8);

    // dynamic fn type
    // #line 4 "recur-test.toc"
    rslt10 = fn9(arity7->closures, (Value *)dynArgs8);
    } else {
    fprintf(stderr, "\n*** no arity found for '%s' at: %s, %d.\n", ((Function *)g_loop_3949)->name, "recur-test.toc", 4);
    abort();
    }
    dec_and_free(g_loop_3949, 1);
    // static-fixed
    // #line 4 "recur-test.toc"
    Value *rslt11 = g_inc_1140(empty_list, rslt10);
    return(rslt11);
    }

    };};
    Value *g_loop_3949 = (Value *)&g_loop_3953;