|
|
@ -103,24 +103,16 @@ jb_record *jbs= NULL; |
|
|
|
assert(jbs == &jbrec); \ |
|
|
|
jbs= jbrec.next |
|
|
|
|
|
|
|
// this is the global scope |
|
|
|
oop globals= 0; |
|
|
|
|
|
|
|
oop program= 0; |
|
|
|
|
|
|
|
oop prog_last= 0; |
|
|
|
|
|
|
|
oop prog_objects= 0; |
|
|
|
oop objects_elements= 0; |
|
|
|
oop objects_last= 0; |
|
|
|
|
|
|
|
oop prog_enums= 0; |
|
|
|
oop prog_structs= 0; |
|
|
|
oop prog_unions= 0; |
|
|
|
|
|
|
|
oop enum_last= 0; |
|
|
|
oop struct_last= 0; |
|
|
|
oop union_last= 0; |
|
|
|
// this is the global scope and other global variable for parsimony lang |
|
|
|
oop globals = 0; |
|
|
|
oop program = 0; |
|
|
|
oop prog_last = 0; |
|
|
|
oop prog_unions = 0; |
|
|
|
oop prog_enums = 0; |
|
|
|
oop prog_structs = 0; |
|
|
|
oop union_last = 0; |
|
|
|
oop enum_last = 0; |
|
|
|
oop struct_last = 0; |
|
|
|
|
|
|
|
#define DO_SYMBOLS() \ |
|
|
|
DO_PROTOS() _DO(__proto__) _DO(__name__) _DO(__default__) _DO(__arguments__) \ |
|
|
@ -1482,8 +1474,11 @@ start = m:metaCatch { yylval= m } |
|
|
|
|
|
|
|
error = EOL* < (!EOL .)* EOL* (!EOL .)* > &{ error(yytext), 1 } |
|
|
|
|
|
|
|
### A.1.3 Identifiers |
|
|
|
# Identifiers rules |
|
|
|
|
|
|
|
# 6.4.2.1 |
|
|
|
|
|
|
|
idOpt = id | {$$=newNullObject()} |
|
|
|
|
|
|
|
id = <ID> { $$= new_C_id(yytext) } - |
|
|
@ -1505,22 +1500,28 @@ IDREST = IDFIRST | [0-9] |
|
|
|
|
|
|
|
digit = [0-9] |
|
|
|
|
|
|
|
# universalCharacterName |
|
|
|
### A.1.4 Universal character names |
|
|
|
# universalCharacterName rule |
|
|
|
|
|
|
|
# 6.4.3 |
|
|
|
|
|
|
|
universalCharacterName = "\\u" hexQuad |
|
|
|
| "\\U" hexQuad hexQuad |
|
|
|
|
|
|
|
hexQuad = hexadecimalDigit hexadecimalDigit hexadecimalDigit hexadecimalDigit |
|
|
|
|
|
|
|
### A.1.5 Constants |
|
|
|
# constant rule |
|
|
|
|
|
|
|
# 6.4.4 |
|
|
|
|
|
|
|
constant = characterConstant |
|
|
|
| floatingConstant |
|
|
|
| integerConstant |
|
|
|
| META_AT m:mvalue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 6.4.4.1 |
|
|
|
# integerConstant rule |
|
|
|
|
|
|
|
integerConstant = < ( hexadecimalConstant |
|
|
@ -1549,6 +1550,7 @@ integerSuffix = ( [uU][lL]?[lL]? | [lL][lL]?[uU]? ) ( imaginarySuffix &{gn |
|
|
|
|
|
|
|
imaginarySuffix = [ij] |
|
|
|
|
|
|
|
# 6.4.4.2 |
|
|
|
# floatingConstant rule |
|
|
|
|
|
|
|
floatingConstant = <( decimalFloatingConstant | hexadecimalFloatingConstant )> { $$= new_C_float(yytext); } - |
|
|
@ -1577,6 +1579,7 @@ hexadecimalDigitSequence = hexadecimalDigit+ |
|
|
|
floatingSuffix = [fFlL] imaginarySuffix? |
|
|
|
|
|
|
|
# 6.4.4.4 |
|
|
|
# characterConstant rule |
|
|
|
|
|
|
|
characterConstant = < "'" cCharSequence "'" > { $$= new_C_char(yytext) } - |
|
|
|
| < "L'" cCharSequence "'" > { $$= new_C_char(yytext) } - |
|
|
@ -1597,8 +1600,11 @@ octalEscapeSequence = '\\' octalDigit octalDigit? octalDigit? |
|
|
|
|
|
|
|
hexadecimalEscapeSequence = '\\x' hexadecimalDigit+ |
|
|
|
|
|
|
|
### A.1.6 String literals |
|
|
|
# stringLiteral rule |
|
|
|
|
|
|
|
# 6.4.5 |
|
|
|
|
|
|
|
stringLiteral = { listBegin(); } |
|
|
|
( s:stringLiteralPart { listAppend(s) } |
|
|
|
| META_AT META_AT META_LPAREN m:meta_exp META_RPAREN { listAppend(m) } |
|
|
@ -1609,8 +1615,11 @@ stringLiteralPart = < '"' sCharSequence '"' > { $$= new_C_string(y |
|
|
|
|
|
|
|
sCharSequence = ( escapeSequence | !EOL [^\"\\] )* #" |
|
|
|
|
|
|
|
### A.2.1 Expressions |
|
|
|
# primaryExpression rule |
|
|
|
|
|
|
|
# 6.5.1 |
|
|
|
|
|
|
|
primaryExpression = META_AT ( META_LCB mstmts |
|
|
|
#| < [a-zA-Z][a-zA-Z0-9]* > @{ printf("<%s>\n", yytext); exit(0) } |
|
|
|
| mvalue |
|
|
@ -1619,6 +1628,7 @@ primaryExpression = META_AT ( META_LCB mstmts |
|
|
|
| l:LPAREN x:expression r:RPAREN { $$= new_C_subexpr(l, x, r) } |
|
|
|
| l:LPAREN x:compoundStatement r:RPAREN &{gnu} { $$= new_C_subexpr(l, x, r) } |
|
|
|
|
|
|
|
# 6.5.2 |
|
|
|
# postfixExpression rule |
|
|
|
|
|
|
|
postfixExpression = o:LPAREN l:typeName p:RPAREN |
|
|
@ -1638,6 +1648,7 @@ argumentExpressionList = { listBegin() } |
|
|
|
)* |
|
|
|
)? { $$= listEnd() } |
|
|
|
|
|
|
|
# 6.5.3 |
|
|
|
# unaryExpression rule |
|
|
|
|
|
|
|
unaryExpression = o:INC x:unaryExpression { $$= new_C_prefix(o, x) } |
|
|
@ -1657,11 +1668,13 @@ unaryOperator = BAND | STAR | PLUS | MINUS | BNOT | LNOT |
|
|
|
| REAL &{gnu} |
|
|
|
| IMAG &{gnu} |
|
|
|
|
|
|
|
# 6.5.4 |
|
|
|
# castExpression rule |
|
|
|
|
|
|
|
castExpression = l:LPAREN t:typeName r:RPAREN x:castExpression { $$= new_C_cast(l, t, r, x) } |
|
|
|
| unaryExpression |
|
|
|
|
|
|
|
# 6.5.5 |
|
|
|
# multiplicativeExpression rule |
|
|
|
|
|
|
|
multiplicativeExpression = l:castExpression |
|
|
@ -1670,6 +1683,7 @@ multiplicativeExpression = l:castExpression |
|
|
|
|
|
|
|
multiplicativeOperator = STAR | DIV | MOD |
|
|
|
|
|
|
|
# 6.5.6 |
|
|
|
# additiveExpression rule |
|
|
|
|
|
|
|
additiveExpression = l:multiplicativeExpression |
|
|
@ -1678,6 +1692,7 @@ additiveExpression = l:multiplicativeExpression |
|
|
|
|
|
|
|
additiveOperator = PLUS | MINUS |
|
|
|
|
|
|
|
# 6.5.7 |
|
|
|
# shiftExpression rule |
|
|
|
|
|
|
|
shiftExpression = l:additiveExpression |
|
|
@ -1686,6 +1701,7 @@ shiftExpression = l:additiveExpression |
|
|
|
|
|
|
|
shiftOperator = LSHIFT | RSHIFT |
|
|
|
|
|
|
|
# 6.5.8 |
|
|
|
# relationalExpression rule |
|
|
|
|
|
|
|
relationalExpression = l:shiftExpression |
|
|
@ -1694,6 +1710,7 @@ relationalExpression = l:shiftExpression |
|
|
|
|
|
|
|
relationalOperator = LT | LTE | GT | GTE |
|
|
|
|
|
|
|
# 6.5.9 |
|
|
|
# equalityExpression rule |
|
|
|
|
|
|
|
equalityExpression = l:relationalExpression |
|
|
@ -1702,36 +1719,42 @@ equalityExpression = l:relationalExpression |
|
|
|
|
|
|
|
equalityOperator = EQUAL | NOT_EQUAL |
|
|
|
|
|
|
|
# 6.5.10 |
|
|
|
# andExpression rule |
|
|
|
|
|
|
|
andExpression = l:equalityExpression |
|
|
|
( o:BAND r:equalityExpression { l= new_C_binary(l, o, r) } |
|
|
|
)* { $$= l } |
|
|
|
|
|
|
|
# 6.5.11 |
|
|
|
# exclusiveOrExpression rule |
|
|
|
|
|
|
|
exclusiveOrExpression = l:andExpression |
|
|
|
( o:BXOR r:andExpression { l= new_C_binary(l, o, r) } |
|
|
|
)* { $$= l } |
|
|
|
|
|
|
|
# 6.5.12 |
|
|
|
# inclusiveOrExpression rule |
|
|
|
|
|
|
|
inclusiveOrExpression = l:exclusiveOrExpression |
|
|
|
( o:BOR r:exclusiveOrExpression { l= new_C_binary(l, o, r) } |
|
|
|
)* { $$= l } |
|
|
|
|
|
|
|
# 6.5.13 |
|
|
|
# logicalAndExpression rule |
|
|
|
|
|
|
|
logicalAndExpression = l:inclusiveOrExpression |
|
|
|
( o:LAND r:inclusiveOrExpression { l= new_C_binary(l, o, r) } |
|
|
|
)* { $$= l } |
|
|
|
|
|
|
|
# 6.5.14 |
|
|
|
# logicalOrExpression rule |
|
|
|
|
|
|
|
logicalOrExpression = l:logicalAndExpression |
|
|
|
( o:LOR r:logicalAndExpression { l= new_C_binary(l, o, r) } |
|
|
|
)* { $$= l } |
|
|
|
|
|
|
|
# 6.5.15 |
|
|
|
# conditionalExpression rule |
|
|
|
|
|
|
|
conditionalExpression = l:logicalOrExpression |
|
|
@ -1740,6 +1763,7 @@ conditionalExpression = l:logicalOrExpression |
|
|
|
| { $$= l } |
|
|
|
) |
|
|
|
|
|
|
|
# 6.5.16 |
|
|
|
# assignmentExpressionOpt rule |
|
|
|
|
|
|
|
assignmentExpressionOpt = assignmentExpression | {$$=newNullObject()} |
|
|
@ -1751,6 +1775,7 @@ assignmentOperator = ASSIGN |
|
|
|
| STAR_ASSIGN | DIV_ASSIGN | MOD_ASSIGN | PLUS_ASSIGN | MINUS_ASSIGN |
|
|
|
| LSHIFT_ASSIGN | RSHIFT_ASSIGN | BAND_ASSIGN | BXOR_ASSIGN | BOR_ASSIGN |
|
|
|
|
|
|
|
# 6.5.17 |
|
|
|
# expression rule |
|
|
|
|
|
|
|
expression = l:assignmentExpression |
|
|
@ -1761,8 +1786,11 @@ expressionOpt = expression | { $$= newNullObject() } |
|
|
|
|
|
|
|
constantExpression = conditionalExpression |
|
|
|
|
|
|
|
### A.2.2 Declarations |
|
|
|
# declaration rule |
|
|
|
|
|
|
|
# 6.7 |
|
|
|
|
|
|
|
declaration = @{ C_declarationBegin() } |
|
|
|
( s:declarationSpecifiers |
|
|
|
d:initDeclaratorListOpt |
|
|
@ -1793,6 +1821,7 @@ initDeclarator = d:declarator |
|
|
|
( a:ASSIGN i:initializer &{ !typedeffing } { d= new_C_binary(d, a, i) } |
|
|
|
)? { $$= d } |
|
|
|
|
|
|
|
# 6.7.1 |
|
|
|
# storageClassSpecifier rule |
|
|
|
|
|
|
|
storageClassSpecifier = TYPEDEF @{ declarationTypedef() } |
|
|
@ -1804,6 +1833,7 @@ parameterStorageClassSpecifier = REGISTER |
|
|
|
|
|
|
|
functionStorageClassSpecifier = EXTERN | STATIC |
|
|
|
|
|
|
|
# 6.7.2 |
|
|
|
# typeSpecifier rule |
|
|
|
|
|
|
|
typeSpecifier = VOID | CHAR | SHORT | INT | LONG | FLOAT | DOUBLE | SIGNED | UNSIGNED | BOOL | COMPLEX |
|
|
@ -1811,6 +1841,7 @@ typeSpecifier = VOID | CHAR | SHORT | INT | LONG | FLOAT | DOUBLE | SIGNED | U |
|
|
|
| structOrUnionSpecifier |
|
|
|
| enumSpecifier |
|
|
|
|
|
|
|
# 6.7.2.1 |
|
|
|
# structOrUnionSpecifier rule |
|
|
|
|
|
|
|
structOrUnionSpecifier = s:structOrUnion |
|
|
@ -1859,6 +1890,7 @@ structDeclarator = ( c:COLON e:constantExpression |
|
|
|
( a:attributeSpecifiers { d= new_C_attribution(d, a) } |
|
|
|
)? { $$= d } |
|
|
|
|
|
|
|
# 6.7.2.2 |
|
|
|
# enumSpecifier rule |
|
|
|
|
|
|
|
enumSpecifier = e:ENUM |
|
|
@ -1879,16 +1911,19 @@ enumerator = i:id |
|
|
|
)* |
|
|
|
( a:ASSIGN e:constantExpression | {a=e=newNullObject()} ) { $$= new_C_enumerator(i, a, e) } |
|
|
|
|
|
|
|
# 6.7.3 |
|
|
|
# typeQualifier rule |
|
|
|
|
|
|
|
typeQualifier = CONST | RESTRICT | VOLATILE |
|
|
|
| __RESTRICT |
|
|
|
|
|
|
|
# 6.7.4 |
|
|
|
# functionSpecifier rule |
|
|
|
|
|
|
|
functionSpecifier = INLINE |
|
|
|
| __INLINE |
|
|
|
|
|
|
|
# 6.7.5 |
|
|
|
# declarator rule |
|
|
|
|
|
|
|
declarator = # An attribute specifier list may appear immediately before a declarator |
|
|
@ -1959,6 +1994,7 @@ identifierList = i:id { listWith(i) } |
|
|
|
( c:COMMA i:id { listAppend2(c, i) } |
|
|
|
)* { $$= listEnd() } |
|
|
|
|
|
|
|
# 6.7.6 |
|
|
|
# typeName rule |
|
|
|
|
|
|
|
typeName = s:specifierQualifierList d:abstractDeclaratorOpt { $$= new_C_declaration(s, d, newNullObject()) } |
|
|
@ -1982,6 +2018,7 @@ directAbstractDeclarator = @{int nonEmpty= 0} |
|
|
|
) r:RBRACKET @{++nonEmpty} { d= new_C_array(d, l, s, q, t, e, r) } |
|
|
|
)* &{nonEmpty} { $$= d } |
|
|
|
|
|
|
|
# 6.7.7 |
|
|
|
# typedefName rule |
|
|
|
|
|
|
|
typedefName = <ID> &{ isTypedefName(yytext) } { $$= new_C_id(yytext) } - |
|
|
@ -1990,6 +2027,7 @@ typedefName = &{ isTypedefName(yytext) } { $$= new_C_id(yytext) } - |
|
|
|
| x:typeName r:RPAREN { $$= new_C_typeOf(t, l, x, newNullObject(), r) } |
|
|
|
) &{gnu} |
|
|
|
|
|
|
|
# 6.7.8 |
|
|
|
# initializer rule |
|
|
|
|
|
|
|
initializer = l:LCURLY i:initializerList ( c:COMMA | {c=newNullObject()} ) r:RCURLY { $$= new_C_initializer(l, i, c, r) } |
|
|
@ -2014,8 +2052,11 @@ designatorList = { listB |
|
|
|
| l:DOT x:id { listAppend(new_C_binary(newNullObject(), l, x)) } |
|
|
|
)+ { $$= listEnd() } |
|
|
|
|
|
|
|
### A.2.3 Statements |
|
|
|
# statement rule |
|
|
|
|
|
|
|
# 6.8 |
|
|
|
|
|
|
|
statement = expressionStatement |
|
|
|
| labeledStatement |
|
|
|
| compoundStatement |
|
|
@ -2023,6 +2064,7 @@ statement = expressionStatement |
|
|
|
| iterationStatement |
|
|
|
| jumpStatement |
|
|
|
|
|
|
|
# 6.8.1 |
|
|
|
# labeledStatement rule |
|
|
|
|
|
|
|
labeledStatement = i:id c:COLON |
|
|
@ -2034,6 +2076,7 @@ labeledStatement = i:id c:COLON |
|
|
|
| c:CASE x:constantRange d:COLON s:statement &{gnu} { $$= new_C_case(c, x, d, s) } |
|
|
|
| d:DEFAULT c:COLON s:statement { $$= new_C_default(d, c, s) } |
|
|
|
|
|
|
|
# 6.8.2 |
|
|
|
# compoundStatement rule |
|
|
|
|
|
|
|
compoundStatement = @{ C_scopeBegin() } |
|
|
@ -2049,17 +2092,20 @@ compoundStatement = @{ C_scopeBegin() } |
|
|
|
@{ C_scopeEnd() } |
|
|
|
| &{ C_scopeAbort() } |
|
|
|
|
|
|
|
# 6.8.3 |
|
|
|
# expressionStatement rule |
|
|
|
|
|
|
|
expressionStatement = SEMI |
|
|
|
| x:expression s:SEMI { $$= new_C_exprStatement(x, s) } |
|
|
|
|
|
|
|
# 6.8.4 |
|
|
|
# selectionStatement rule |
|
|
|
|
|
|
|
selectionStatement = i:IF l:LPAREN x:expression r:RPAREN s:statement |
|
|
|
( e:ELSE t:statement | {e=t=newNullObject()} ) { $$= new_C_if(i, l, x, r, s, e, t) } |
|
|
|
| s:SWITCH l:LPAREN x:expression r:RPAREN t:statement { $$= new_C_switch(s, l, x, r, t) } |
|
|
|
|
|
|
|
# 6.8.5 |
|
|
|
# iterationStatement rule |
|
|
|
|
|
|
|
iterationStatement = w:WHILE l:LPAREN x:expression r:RPAREN s:statement { $$= new_C_while(w, l, x, r, s) } |
|
|
@ -2069,6 +2115,7 @@ iterationStatement = w:WHILE l:LPAREN x:expression r:RPAREN s:statement |
|
|
|
| f:FOR l:LPAREN a:declaration b:expressionOpt u:SEMI |
|
|
|
c:expressionOpt r:RPAREN s:statement { $$= new_C_for(f, l, a, newNullObject(), b, u, c, r, s) } |
|
|
|
|
|
|
|
# 6.8.6 |
|
|
|
# jumpStatement rule |
|
|
|
|
|
|
|
jumpStatement = g:GOTO i:id t:SEMI { $$= new_C_goto(g, newNullObject(), i, t) } |
|
|
@ -2077,8 +2124,11 @@ jumpStatement = g:GOTO i:id t:SEMI { $$= new_C_goto(g, |
|
|
|
| r:RETURN x:expressionOpt t:SEMI { $$= new_C_return(r, x, t) } |
|
|
|
| g:GOTO s:STAR x:expression t:SEMI &{gnu} { $$= new_C_goto(g, s, x, t) } |
|
|
|
|
|
|
|
### A.2.4 External definitions |
|
|
|
# externalDeclaration rule |
|
|
|
|
|
|
|
# 6.9 |
|
|
|
|
|
|
|
## translationUnit = externalDeclaration+ |
|
|
|
|
|
|
|
externalDeclaration = <Space+> { $$= newComment(yytext); } |
|
|
@ -3603,15 +3653,6 @@ oop prim_keys(oop scope, oop params) |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
oop prim_all_keys(oop scope, oop params) |
|
|
|
{ |
|
|
|
if (map_hasIntegerKey(params, 0)) { |
|
|
|
oop arg= get(params, Map, elements)[0].value; |
|
|
|
if (is(Map, arg)) return map_allKeys(arg); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
oop prim_values(oop scope, oop params) |
|
|
|
{ |
|
|
|
if (map_hasIntegerKey(params, 0)) { |
|
|
@ -4843,7 +4884,7 @@ void printTree(oop element, language id) { |
|
|
|
|
|
|
|
void init() |
|
|
|
{ |
|
|
|
# if (USE_GC) |
|
|
|
# if (USE_GC) |
|
|
|
GC_INIT(); |
|
|
|
# endif |
|
|
|
|
|
|
@ -4853,7 +4894,6 @@ void init() |
|
|
|
|
|
|
|
map_set(globals, intern("exit" ), makeFunction(prim_exit, intern("exit" ), null, null, globals, null)); |
|
|
|
map_set(globals, intern("keys" ), makeFunction(prim_keys, intern("keys" ), null, null, globals, null)); |
|
|
|
map_set(globals, intern("_keys" ), makeFunction(prim_all_keys, intern("_keys" ), null, null, globals, null)); |
|
|
|
map_set(globals, intern("values" ), makeFunction(prim_values, intern("values" ), null, null, globals, null)); |
|
|
|
map_set(globals, intern("length" ), makeFunction(prim_length, intern("length" ), null, null, globals, null)); |
|
|
|
map_set(globals, intern("print" ), makeFunction(prim_print, intern("print" ), null, null, globals, null)); |
|
|
@ -4889,22 +4929,28 @@ void init() |
|
|
|
DO_PROTOS() |
|
|
|
#undef _DO |
|
|
|
|
|
|
|
program = makeMap(); |
|
|
|
prog_enums = makeMap(); |
|
|
|
prog_structs = makeMap(); |
|
|
|
prog_unions = makeMap(); |
|
|
|
prog_last = makeMap(); |
|
|
|
enum_last = makeMap(); |
|
|
|
struct_last = makeMap(); |
|
|
|
union_last = makeMap(); |
|
|
|
|
|
|
|
map_set(prog_enums , intern("last" ), enum_last ); |
|
|
|
map_set(prog_structs , intern("last" ), struct_last ); |
|
|
|
map_set(prog_unions , intern("last" ), union_last ); |
|
|
|
map_set(program , intern("structs" ), prog_structs ); |
|
|
|
map_set(program , intern("unions" ), prog_unions ); |
|
|
|
map_set(program , intern("enums" ), prog_enums ); |
|
|
|
map_set(globals , intern("program" ), program ); |
|
|
|
|
|
|
|
// Initialisation of parsimony global variable |
|
|
|
program = makeMap(); |
|
|
|
prog_enums = makeMap(); |
|
|
|
prog_structs = makeMap(); |
|
|
|
prog_unions = makeMap(); |
|
|
|
prog_last = makeMap(); |
|
|
|
enum_last = makeMap(); |
|
|
|
struct_last = makeMap(); |
|
|
|
union_last = makeMap(); |
|
|
|
|
|
|
|
map_set(globals , intern("program"), program ); |
|
|
|
|
|
|
|
map_set(program , intern("structs"), prog_structs); |
|
|
|
map_set(prog_structs, intern("last" ), struct_last ); |
|
|
|
|
|
|
|
map_set(program , intern("unions" ), prog_unions ); |
|
|
|
map_set(prog_unions , intern("last" ), union_last ); |
|
|
|
|
|
|
|
map_set(program , intern("enums" ), prog_enums ); |
|
|
|
map_set(prog_enums , intern("last" ), enum_last ); |
|
|
|
|
|
|
|
|
|
|
|
fixScope(globals); |
|
|
|
|
|
|
@ -4945,10 +4991,10 @@ int main(int argc, char **argv) |
|
|
|
} |
|
|
|
|
|
|
|
if (opt_g) { |
|
|
|
if (nalloc < 1024) printf("[GC: %lli bytes allocated]\n", nalloc ); |
|
|
|
else if (nalloc < 1024*1024) printf("[GC: %lli kB allocated]\n", nalloc / 1024 ); |
|
|
|
else if (nalloc < 1024*1024*1024) printf("[GC: %.2f MB allocated]\n", (double)nalloc / ( 1024*1024)); |
|
|
|
else printf("[GC: %.2f GB allocated]\n", (double)nalloc / (1024*1024*1024)); |
|
|
|
if (nalloc < 1024) printf("[GC: %lli bytes allocated]\n", nalloc ); |
|
|
|
else if (nalloc < 1024*1024) printf("[GC: %lli kB allocated]\n", nalloc / 1024 ); |
|
|
|
else if (nalloc < 1024*1024*1024) printf("[GC: %.2f MB allocated]\n", (double)nalloc / ( 1024*1024)); |
|
|
|
else printf("[GC: %.2f GB allocated]\n", (double)nalloc / (1024*1024*1024)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -4961,4 +5007,4 @@ int main(int argc, char **argv) |
|
|
|
|
|
|
|
// Local Variables: |
|
|
|
// indent-tabs-mode: nil |
|
|
|
// End:- |
|
|
|
// End: |