Exemple #1
0
struct Cyc_APQ_T * Cyc_APQ_fromAP(struct Cyc_AP_T * n,struct Cyc_AP_T * d) {
    int _T0;
    struct Cyc_Invalid_argument_exn_struct * _T1;
    void * _T2;
    void * _T3;
    struct Cyc_APQ_T * _T4;
    struct Cyc_APQ_T * _T5;
    struct Cyc_APQ_T * _T6;
    _T0 = Cyc_AP_cmp(d,Cyc_AP_zero);
    if (_T0 != 0) {
        goto _TL4;
    }
    {   struct Cyc_Invalid_argument_exn_struct * _T7 = _cycalloc(sizeof(struct Cyc_Invalid_argument_exn_struct));
        _T7->tag = Cyc_Invalid_argument;
        _T7->f1 = _tag_fat("APQ_fromAP: divide by zero",sizeof(char),27U);
        _T1 = (struct Cyc_Invalid_argument_exn_struct *)_T7;
    }
    _T2 = (void *)_T1;
    _throw(_T2);
    goto _TL5;
_TL4:
_TL5:
    _T3 = _cycalloc(sizeof(struct Cyc_APQ_T));
    {   struct Cyc_APQ_T * q = (struct Cyc_APQ_T *)_T3;
        _T4 = q;
        _T4->n = n;
        _T5 = q;
        _T5->d = d;
        _T6 = Cyc_reduce(q);
        return _T6;
    }
}
Exemple #2
0
struct Cyc_APQ_T*Cyc_APQ_fromstr(struct _fat_ptr str,int base){void*_T0;struct _fat_ptr _T1;unsigned char*_T2;const char*_T3;char _T4;int _T5;struct _fat_ptr _T6;unsigned char*_T7;const char*_T8;char _T9;int _TA;struct _fat_ptr*_TB;struct Cyc_APQ_T*_TC;struct _fat_ptr _TD;unsigned char*_TE;const char*_TF;int _T10;struct _fat_ptr _T11;unsigned char*_T12;const char*_T13;char _T14;int _T15;struct _fat_ptr _T16;struct _fat_ptr _T17;unsigned char*_T18;const char*_T19;int _T1A;int _T1B;struct Cyc_APQ_T*_T1C;struct Cyc_Invalid_argument_exn_struct*_T1D;void*_T1E;struct Cyc_APQ_T*_T1F;struct Cyc_APQ_T*_T20;_T0=_cycalloc(sizeof(struct Cyc_APQ_T));{
struct Cyc_APQ_T*q=(struct Cyc_APQ_T*)_T0;
struct _fat_ptr s=str;
_TL6: _T1=s;_T2=_check_fat_subscript(_T1,sizeof(char),0U);_T3=(const char*)_T2;_T4=*_T3;_T5=(int)_T4;if(_T5)goto _TL9;else{goto _TL8;}_TL9: _T6=s;_T7=_T6.curr;_T8=(const char*)_T7;_T9=*_T8;_TA=(int)_T9;if(_TA!=47)goto _TL7;else{goto _TL8;}_TL7: _TB=& s;_fat_ptr_inplace_plus(_TB,sizeof(char),1);goto _TL6;_TL8: _TC=q;_TD=str;_TE=_untag_fat_ptr_check_bound(_TD,sizeof(char),1U);_TF=(const char*)_TE;_T10=base;
_TC->n=Cyc_AP_fromstr(_TF,_T10);_T11=s;_T12=_T11.curr;_T13=(const char*)_T12;_T14=*_T13;_T15=(int)_T14;
if(!_T15)goto _TLA;_T16=s;_T17=
_fat_ptr_plus(_T16,sizeof(char),1);_T18=_untag_fat_ptr_check_bound(_T17,sizeof(char),1U);_T19=(const char*)_T18;_T1A=base;{struct Cyc_AP_T*d=Cyc_AP_fromstr(_T19,_T1A);_T1B=
Cyc_AP_cmp(d,Cyc_AP_zero);if(!_T1B)goto _TLC;_T1C=q;
_T1C->d=d;goto _TLD;
_TLC:{struct Cyc_Invalid_argument_exn_struct*_T21=_cycalloc(sizeof(struct Cyc_Invalid_argument_exn_struct));_T21->tag=Cyc_Invalid_argument;_T21->f1=_tag_fat("APQ_fromstr: malformed string",sizeof(char),30U);_T1D=(struct Cyc_Invalid_argument_exn_struct*)_T21;}_T1E=(void*)_T1D;_throw(_T1E);_TLD:;}goto _TLB;
# 54
_TLA: _T1F=q;_T1F->d=Cyc_AP_one;_TLB: _T20=
Cyc_reduce(q);return _T20;}}