//// NewLang CODE ////
class twoint
{
var first : int32;
var second : uint32;
}
extern func dump( v : int32 );
extern func dump( v : float64 );
static var gval : int32 = 1;
func _test( a : int32 ) : int32
{
var v : int8 = -5;
while( v < 0 )
{
dump( v + a );
v += 1;
break 1;
}
return 0s8 + a + v;
}
func main()
{
var ii : twoint;
ii.first = 5;
dump( ii.first );
gval += 123;
gval += 456;
dump( gval );
dump( sizeof( uint16 ) );
dump( sizeof( 0s8 ) );
var dbl : float64;
dump( sizeof( dbl ) );
dump( _test( 1 ) );
dump( 1.2 );
}
//// C CODE ////
#include <inttypes.h>
typedef uint8_t Ibool;
typedef int8_t Iint8;
typedef uint8_t Iuint8;
typedef int16_t Iint16;
typedef uint16_t Iuint16;
typedef int32_t Iint32;
typedef uint32_t Iuint32;
typedef int64_t Iint64;
typedef uint64_t Iuint64;
typedef float Ifloat32;
typedef double Ifloat64;
typedef struct Itwoint
{
Iint32 Ifirst;
Iuint32 Isecond;
}
Itwoint;
Iint32 Igval = 1;
extern void Idump_IPint32( Iint32 Iv );
extern void Idump_IPfloat64( Ifloat64 Iv );
Iint32 _Itest_IPint32( Iint32 Ia );
void Imain();
Iint32 _Itest_IPint32( Iint32 Ia )
{
Iint8 Iv;
const Iuint8 I0 = 5;
Iint32 I1 = -I0;
Iv = I1;
lbl_0:;
const Iuint8 I2 = 0;
Ibool I3 = Iv < I2;
if( !I3 ) goto lbl_1;
Iint32 I4 = Iv + Ia;
Idump_IPint32( I4 );
const Iuint8 I5 = 1;
Iv = Iv + I5;
Iv = Iv;
goto lbl_1;
goto lbl_0;
lbl_1:;
const Iint8 I6 = 0;
Iint32 I7 = I6 + Ia;
Iint32 I8 = I7 + Iv;
return I8;
}
void Imain()
{
Ifloat64 Idbl;
Itwoint Iii;
const Iuint32 I0 = 0;
char* I1 = (char*) &Iii;
char* I2 = I1 + I0;
const Iuint8 I3 = 5;
*(Iint32*) I2 = I3;
const Iuint32 I4 = 0;
char* I5 = (char*) &Iii;
char* I6 = I5 + I4;
Iint32 I7 = *I6;
Idump_IPint32( I7 );
const Iuint8 I8 = 123;
Iint32 I9 = Igval;
Iint32 I10 = I9 + I8;
Igval = I10;
const Iuint16 I11 = 456;
Iint32 I12 = Igval;
Iint32 I13 = I12 + I11;
Igval = I13;
Iint32 I14 = Igval;
Idump_IPint32( I14 );
const Iint32 I15 = 2;
Idump_IPint32( I15 );
const Iint8 I16 = 0;
const Iint32 I17 = 1;
Idump_IPint32( I17 );
const Iint32 I18 = 8;
Idump_IPint32( I18 );
const Iuint8 I19 = 1;
Iint32 I20 = _Itest_IPint32( I19 );
Idump_IPint32( I20 );
const Ifloat64 I21 = 1.2;
Idump_IPfloat64( I21 );
}
int main()
{
Imain();
return 0;
}
//// OUTPUT ////
int32 (5)
int32 (580)
int32 (2)
int32 (1)
int32 (8)
int32 (-4)
int32 (-3)
float64 (1.2)
Comments