Skip to content

Instantly share code, notes, and snippets.

@ousado
Created April 20, 2013 09:21
Show Gist options
  • Save ousado/3f1427bbe973002ea38d to your computer and use it in GitHub Desktop.
Save ousado/3f1427bbe973002ea38d to your computer and use it in GitHub Desktop.
/*
**
** The C code is generated by ATS/Anairiats
** The compilation time is: 2013-4-20: 9h:18m
**
*/
/* include some .h files */
#ifndef _ATS_HEADER_NONE
#include "ats_config.h"
#include "ats_basics.h"
#include "ats_types.h"
#include "ats_exception.h"
#include "ats_memory.h"
#endif /* _ATS_HEADER_NONE */
/* include some .cats files */
#ifndef _ATS_PRELUDE_NONE
#include "prelude/CATS/basics.cats"
#include "prelude/CATS/bool.cats"
#include "prelude/CATS/byte.cats"
#include "prelude/CATS/char.cats"
#include "prelude/CATS/float.cats"
#include "prelude/CATS/integer.cats"
#include "prelude/CATS/integer_fixed.cats"
#include "prelude/CATS/integer_ptr.cats"
#include "prelude/CATS/lazy.cats"
#include "prelude/CATS/lazy_vt.cats"
#include "prelude/CATS/pointer.cats"
#include "prelude/CATS/printf.cats"
#include "prelude/CATS/reference.cats"
#include "prelude/CATS/sizetype.cats"
#include "prelude/CATS/string.cats"
#include "prelude/CATS/array.cats"
#include "prelude/CATS/list.cats"
#include "prelude/CATS/matrix.cats"
#include "prelude/CATS/option.cats"
#endif /* _ATS_PRELUDE_NONE */
/* prologues from statically loaded files */
/* external codes at top */
/* type definitions */
/* external typedefs */
/* external dynamic constructor declarations */
/* external dynamic constant declarations */
ATSextern_fun(ats_int_type, atspre_add_int_int) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_int_type, atspre_sub_int_int) (ats_int_type, ats_int_type) ;
ATSextern_fun(ats_bool_type, atspre_eq_int_int) (ats_int_type, ats_int_type) ;
/* external dynamic terminating constant declarations */
#ifdef _ATS_PROOFCHECK
#endif /* _ATS_PROOFCHECK */
/* assuming abstract types */
/* sum constructor declarations */
/* exn constructor declarations */
/* global dynamic (non-functional) constant declarations */
/* internal function declarations */
static
ats_int_type ack_0 (ats_int_type arg0, ats_int_type arg1) ;
/* partial value template declarations */
/* static temporary variable declarations */
/* external value variable declarations */
/* function implementations */
/*
// /mirror/clean/ocaml/epoints/usage/ack.dats: 7(line=3, offs=5) -- 123(line=6, offs=25)
*/
ATSstaticdec()
ats_int_type
ack_0 (ats_int_type arg0, ats_int_type arg1) {
/* local vardec */
ATSlocal (ats_int_type, tmp0) ;
ATSlocal (ats_bool_type, tmp1) ;
ATSlocal (ats_bool_type, tmp2) ;
ATSlocal (ats_int_type, tmp3) ;
ATSlocal (ats_int_type, tmp4) ;
ATSlocal (ats_int_type, tmp5) ;
ATSlocal (ats_int_type, tmp6) ;
__ats_lab_ack_0:
tmp1 = atspre_eq_int_int (arg0, 0) ;
if (tmp1) {
tmp0 = atspre_add_int_int (arg1, 1) ;
} else {
tmp2 = atspre_eq_int_int (arg1, 0) ;
if (tmp2) {
tmp3 = atspre_sub_int_int (arg0, 1) ;
arg0 = tmp3 ;
arg1 = 1 ;
goto __ats_lab_ack_0 ; // tail call
} else {
tmp4 = atspre_sub_int_int (arg0, 1) ;
tmp6 = atspre_sub_int_int (arg1, 1) ;
tmp5 = ack_0 (arg0, tmp6) ;
arg0 = tmp4 ;
arg1 = tmp5 ;
goto __ats_lab_ack_0 ; // tail call
} /* end of [if] */
} /* end of [if] */
return (tmp0) ;
} /* end of [ack_0] */
/*
// /mirror/clean/ocaml/epoints/usage/ack.dats: 140(line=8, offs=16) -- 179(line=10, offs=2)
*/
ATSglobaldec()
ats_void_type
mainats () {
/* local vardec */
// ATSlocal_void (tmp7) ;
ATSlocal (ats_int_type, tmp8) ;
__ats_lab_mainats:
tmp8 = ack_0 (4, 1) ;
return /* (tmp7) */ ;
} /* end of [mainats] */
/* static load function */
ats_void_type
_2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__staload () {
static int _2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__staload_flag = 0 ;
if (_2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__staload_flag) return ;
_2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__staload_flag = 1 ;
return ;
} /* staload function */
/* dynamic load function */
// dynload flag declaration
// extern ats_int_type _2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__dynload_flag ;
ats_void_type
_2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__dynload () {
// _2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__dynload_flag = 1 ;
_2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__staload () ;
#ifdef _ATS_PROOFCHECK
#endif /* _ATS_PROOFCHECK */
/* marking static variables for GC */
/* marking external values for GC */
/* code for dynamic loading */
return ;
} /* end of [dynload function] */
int main (int argc, char *argv[]) {
ATS_GC_INIT() ;
mainats_prelude() ;
_2mirror_2clean_2ocaml_2epoints_2usage_2ack_2edats__dynload() ;
mainats((ats_int_type)argc, (ats_ptr_type)argv) ;
return (0) ;
} /* end of main */
/* external codes at mid */
/* external codes at bot */
/* ****** ****** */
/* end of [ack_dats.c] */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment