diff --git a/README.md b/README.md index e7ac8d5..3980493 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,11 @@ C compiler with embedded metalanguage. 3. [Usage](#usage) 4. [Help](#help) - [Peg/Leg](#pegleg) +5. [Authors](#authors) ##
Architecture
-![alt text](http://git.piumarta.com/piumarta/ccmeta/raw/branch/develop/media/ccmeta.drawio.png) +![alt text](http://git.piumarta.com/piumarta/ccmeta/raw/branch/develop/src/images/ccmeta.drawio.png) ### [Go to the table of contents](#toc) ##
Build the project
@@ -72,4 +73,19 @@ $ ./ccmeta file ``` shell $ man peg ``` -### [Go to the table of contents](#toc) \ No newline at end of file +### [Go to the table of contents](#toc) + +##
Authors
+#### Ian Piumarta (2016-) +- infrastructure +- parsing framework +- C grammar, C AST +- object system design and implementation +- metalanguage design and implementation + +#### Mahe Tardy (2020) +- object system implementation +- metalanguage implementation + +#### Nathan Razafimanantsoa, Kumar Mahadayya (2021) +- C AST \ No newline at end of file diff --git a/parsimonyLibrary/fake-static-classes.mc b/parsimonyLibrary/fake-static-classes.mc deleted file mode 100644 index 844396c..0000000 --- a/parsimonyLibrary/fake-static-classes.mc +++ /dev/null @@ -1,161 +0,0 @@ -@import("parsimonyLibrary/boot.mc") - -@{ - - // allows you to retrieve the type if it is pre-existing or created during compilation - checkIdorDecl(x) { - (x.identifier == null) ? x.declarators.identifier : x.identifier; - } - - // allows you to retrieve the type if it is pre-existing or created during compilation - checkIdorText(x) { - (x.identifier == null) ? x.text : x.identifier; - } - - program.objects = null; - - // Initialisation of the object - beginObject(objectName, typeName) { - program.objects = {}; - program.objects.elements = {}; - program.objects.last = null; - objectName == null ? objectName = "oop" : objectName; - typeName == null ? typeName = "type_t" : typeName; - program.objects.elements[length(program.objects.elements)] = objectName; - program.objects.last = objectName; - l = {}; - enum = `declaration typedef enum {_} type_t;; - enum.declarators[0].identifier = typeName; - enum.semicolon.comment = newComment(" "); - program.objects.enum = treeCopy(enum); - append(l, program.objects.enum); - obj = `declaration union object;; - obj.semicolon.comment = newComment(" "); - append(l, treeCopy(obj)); - type_obj = `declaration typedef union object *oop;; - type_obj.declarators[0].declarators.identifier = objectName; - type_obj.semicolon.comment = newComment("\n\n"); - append(l, treeCopy(type_obj)); - l; - } - - // Function to add dynamically an object - addObject() { - structName = treeCopy(newEnum(program.last.name.identifier)); - l = length(program.enums.last.enumList); - if (string(program.objects.enum.specifiers[1].enumList[0].name.identifier) == "_" && l == 1) { - program.objects.enum.specifiers[1].enumList[0] = structName; - } else { - append(program.objects.enum.specifiers[1].enumList, newComma()); - append(program.objects.enum.specifiers[1].enumList, structName); - } - for (i=length(program.last.declarationL); i>0; i--) { - program.last.declarationL[i] = program.last.declarationL[i-1]; - }; - newType = `declaration int type;; - newType.specifiers[0].text = program.objects.enum.declarators[0].identifier; - newType.semicolon.comment = newComment("\n "); - program.last.declarationL[0] = treeCopy(newType); - nil; - } - - // Function triggered each time we met a struct - everyExternalDeclaration(s) { - if (program.objects) { - addObject() - } - s; - } - - // Functions to get the macro - getObjectMacro() { - macro = `ed #define get(PTR, TYPE, FIELD) (_checkType(PTR, TYPE, __FILE__, __LINE__)->TYPE.FIELD) -; - macro; - } - - // Functions to get the macro - setObjectMacro() { - macro = `ed #define set(PTR, TYPE, FIELD, VALUE) (_checkType(PTR, TYPE, __FILE__, __LINE__)->TYPE.FIELD = VALUE) -; - macro.text = macro.text + "\n"; - macro; - } - - getGeneralObject(x) { - func = `fun int getfoo(int obj) { - if (!isFoo(obj)) { - fprintf(stderr, "\ngetFoo call on non-foo\n"); - exit(1); - } - return get(obj, foo, foo); -} -; - id = program.structs[x].declarationL[1].specifiers[0].identifier; - star = program.structs[x].declarationL[1].declarators[0].declarators.star; - if (id != null) { - program.structs[x].declarationL[1].specifiers[0].text = program.structs[x].declarationL[1].specifiers[0].identifier - } - if (star != null) { - func.specifiers[0].text = string(checkIdorText(program.structs[x].declarationL[1].specifiers[0])) + " *"; - func.specifiers[0].comment = ""; - } else { - func.specifiers[0].text = string(checkIdorText(program.structs[x].declarationL[1].specifiers[0])); - } - func.declarators.declarators.identifier = "get" + string(x); - func.compoundS.expression[0].condition.expression.declarators.identifier = "is" + string(x); - func.compoundS.expression[0].consequent.expression[0].expression.paramTypeL[2].text[0].value = "\"\\nget" + string(x) + " call on non-" + string(x) + "\\n\""; - func.compoundS.expression[1].expression.paramTypeL[2].identifier = string(x); - func.compoundS.expression[1].expression.paramTypeL[4].identifier = checkIdorDecl(program.structs[x].declarationL[length(program.structs[x].declarationL)-1].declarators[0].declarators); - func.declarators.paramTypeL[0].specifiers[0].text = program.objects.last; - treeCopy(func); - } - - // Function to set up element useful to the programmer - endObject() { - l = {}; - objectUnion = `declaration union object { int type; };; - objectUnion = treeCopy(objectUnion); - objectUnion.specifiers[0].declarationL[0].specifiers[0].text = program.objects.enum.declarators[0].identifier; - objectUnion.semicolon.comment = newComment("\n"); - obj = select(notToken, program.objects.enum.specifiers[1].enumList); - elt = treeCopy(`declaration struct nil nil;); - for (i in obj) { - len = length(objectUnion.specifiers[0].declarationL); - elt.specifiers[0].name.identifier = elt.declarators[0].identifier = obj[i].name.identifier; - objectUnion.specifiers[0].declarationL[len] = treeCopy(elt); - objectUnion.specifiers[0].declarationL[len].semicolon.comment = newComment(" "); - } - append(l, objectUnion); - isDef = `declaration int is(int type, int obj);; - isDef.declarators[0].paramTypeL[0].specifiers[0].text = program.objects.enum.declarators[0].identifier; - isDef.declarators[0].paramTypeL[2].specifiers[0].text = program.objects.last; - isDef.semicolon.comment = newComment("\n"); - append(l, isDef); - func = `fun int isFoo(int obj) { return is(foo, obj); }; - func.declarators.paramTypeL[0].specifiers[0].text = program.objects.last; - func.compoundS.rightCurly.comment = newComment("\n"); - for (i in obj) { - func.declarators.declarators.identifier = "is" + string(obj[i].name.identifier); - func.compoundS.expression[0].expression.paramTypeL[0].identifier = obj[i].name.identifier; - append(l, treeCopy(func)); - } - func = `fun int getType(int ptr) { assert(ptr); return ptr->type; }; - func.specifiers[0].text = program.objects.enum.declarators[0].identifier; - func.declarators.paramTypeL[0].specifiers[0].text = program.objects.last; - func.compoundS.rightCurly.comment = newComment("\n"); - append(l, treeCopy(func)); - func = `fun int is(int type, int obj) { return type == getType(obj); }; - func.declarators.paramTypeL[0].specifiers[0].text = program.objects.enum.declarators[0].identifier; - func.declarators.paramTypeL[2].specifiers[0].text = program.objects.last; - func.compoundS.rightCurly.comment = newComment("\n"); - append(l, treeCopy(func)); - append(l, treeCopy(getObjectMacro())); - append(l, treeCopy(setObjectMacro())); - program.objects = null; - l; - } - - nil; -} - diff --git a/Makefile b/src/Makefile similarity index 98% rename from Makefile rename to src/Makefile index 1064f7e..92e36e4 100644 --- a/Makefile +++ b/src/Makefile @@ -40,6 +40,7 @@ clean : .FORCE rm -f $(MAIN) $(MAIN).c rm -f *~ $(MAIN)-output.out rm -rf */*.out + rm -rf ccmeta.dSYM tidy : .FORCE rm -f *~ $(MAIN)-tree.out diff --git a/buffer.h b/src/buffer.h similarity index 100% rename from buffer.h rename to src/buffer.h diff --git a/ccmeta-input.txt b/src/ccmeta-input.txt similarity index 100% rename from ccmeta-input.txt rename to src/ccmeta-input.txt diff --git a/ccmeta.leg b/src/ccmeta.leg similarity index 98% rename from ccmeta.leg rename to src/ccmeta.leg index 3eba844..b65ca9e 100644 --- a/ccmeta.leg +++ b/src/ccmeta.leg @@ -94,13 +94,13 @@ typedef struct jb_record jb_record *jbs= NULL; -#define jbRecPush() \ - struct jb_record jbrec; \ +#define jbRecPush() \ + struct jb_record jbrec; \ jbrec.next= jbs; \ jbs= &jbrec -#define jbRecPop() \ - assert(jbs == &jbrec); \ +#define jbRecPop() \ + assert(jbs == &jbrec); \ jbs= jbrec.next // this is the global scope @@ -902,6 +902,7 @@ oop new_C_enumerator(oop id, oop attributeSpecifier, oop expression) { return object; } +//TODO #define YY_INPUT(buf, result, max_size) \ { \ int yyc= feof(inputStack->file) ? EOF : getc(inputStack->file); \ @@ -1453,9 +1454,7 @@ start = m:metaCatch { yylval= m } error = EOL* < (!EOL .)* EOL* (!EOL .)* > &{ error(yytext), 1 } -### A.1.3 Identifiers - -# 6.4.2.1 +# Identifiers rules idOpt = id | {$$=newNullObject()} @@ -1478,29 +1477,23 @@ IDREST = IDFIRST | [0-9] digit = [0-9] -### A.1.4 Universal character names - -# 6.4.3 +# universalCharacterName universalCharacterName = "\\u" hexQuad | "\\U" hexQuad hexQuad hexQuad = hexadecimalDigit hexadecimalDigit hexadecimalDigit hexadecimalDigit -### - -### A.1.5 Constants - -# 6.4.4 +# constant rule constant = characterConstant | floatingConstant | integerConstant - | META_AT m:mvalue + | META_AT m:mvalue -# 6.4.4.1 +# integerConstant rule integerConstant = < ( hexadecimalConstant | octalConstant @@ -1528,7 +1521,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); } - @@ -1576,9 +1569,7 @@ octalEscapeSequence = '\\' octalDigit octalDigit? octalDigit? hexadecimalEscapeSequence = '\\x' hexadecimalDigit+ -### A.1.6 String literals - -# 6.4.5 +# stringLiteral rule stringLiteral = { listBegin(); } ( s:stringLiteralPart { listAppend(s) } @@ -1590,18 +1581,16 @@ stringLiteralPart = < '"' sCharSequence '"' > { $$= new_C_string(y sCharSequence = ( escapeSequence | !EOL [^\"\\] )* #" -### A.2.1 Expressions - -# 6.5.1 +# primaryExpression rule primaryExpression = stringLiteral | constant | id | META_AT ( META_LCB x:mstmts - | x:mvalue + | x:mvalue ) | 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 a:LCURLY r:initializerList ( c:COMMA | {c=newNullObject()} ) b:RCURLY { $$= new_C_aggregate(o, l, p, a, r, c, b) } @@ -1620,7 +1609,7 @@ argumentExpressionList = { listBegin() } )* )? { $$= listEnd() } -# 6.5.3 +# unaryExpression rule unaryExpression = o:INC x:unaryExpression { $$= new_C_prefix(o, x) } | o:DEC x:unaryExpression { $$= new_C_prefix(o, x) } @@ -1639,12 +1628,12 @@ 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 ( o:multiplicativeOperator r:castExpression { l= new_C_binary(l, o, r) } @@ -1652,7 +1641,7 @@ multiplicativeExpression = l:castExpression multiplicativeOperator = STAR | DIV | MOD -# 6.5.6 +# additiveExpression rule additiveExpression = l:multiplicativeExpression ( o:additiveOperator r:multiplicativeExpression { l= new_C_binary(l, o, r) } @@ -1660,7 +1649,7 @@ additiveExpression = l:multiplicativeExpression additiveOperator = PLUS | MINUS -# 6.5.7 +# shiftExpression rule shiftExpression = l:additiveExpression ( o:shiftOperator r:additiveExpression { l= new_C_binary(l, o, r) } @@ -1668,7 +1657,7 @@ shiftExpression = l:additiveExpression shiftOperator = LSHIFT | RSHIFT -# 6.5.8 +# relationalExpression rule relationalExpression = l:shiftExpression ( o:relationalOperator r:shiftExpression { l= new_C_binary(l, o, r) } @@ -1676,7 +1665,7 @@ relationalExpression = l:shiftExpression relationalOperator = LT | LTE | GT | GTE -# 6.5.9 +# equalityExpression rule equalityExpression = l:relationalExpression ( o:equalityOperator r:relationalExpression { l= new_C_binary(l, o, r) } @@ -1684,37 +1673,37 @@ 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 ( q:QUESTION m:expression c:COLON r:conditionalExpression { $$= new_C_conditional(l, q, m, c, r) } @@ -1722,7 +1711,7 @@ conditionalExpression = l:logicalOrExpression | { $$= l } ) -# 6.5.16 +# assignmentExpressionOpt rule assignmentExpressionOpt = assignmentExpression | {$$=newNullObject()} @@ -1733,7 +1722,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 ( o:COMMA r:assignmentExpression { l= new_C_binary(l, o, r) } @@ -1743,9 +1732,7 @@ expressionOpt = expression | { $$= newNullObject() } constantExpression = conditionalExpression -### A.2.2 Declarations - -# 6.7 +# declaration rule declaration = @{ C_declarationBegin() } ( s:declarationSpecifiers @@ -1777,7 +1764,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() } | AUTO @@ -1788,14 +1775,14 @@ parameterStorageClassSpecifier = REGISTER functionStorageClassSpecifier = EXTERN | STATIC -# 6.7.2 +# typeSpecifier rule typeSpecifier = VOID | CHAR | SHORT | INT | LONG | FLOAT | DOUBLE | SIGNED | UNSIGNED | BOOL | COMPLEX | ( BUILTIN_VA_LIST | _FLOAT128 ) | structOrUnionSpecifier | enumSpecifier -# 6.7.2.1 +# structOrUnionSpecifier rule structOrUnionSpecifier = s:structOrUnion # An attribute specifier list may appear as part of a struct, union or enum specifier. It may go @@ -1843,7 +1830,7 @@ structDeclarator = ( c:COLON e:constantExpression ( a:attributeSpecifiers { d= new_C_attribution(d, a) } )? { $$= d } -# 6.7.2.2 +# enumSpecifier rule enumSpecifier = e:ENUM ( i:idOpt l:LCURLY m:enumeratorList r:RCURLY { $$= new_C_enumSpec(e, i, l, m, r) } @@ -1863,17 +1850,17 @@ 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 a:attributeSpecifier d:declarator &{gnu} { $$= new_C_attribution(a, d) } @@ -1943,7 +1930,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()) } @@ -1966,7 +1953,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 = &{ isTypedefName(yytext) } { $$= new_C_id(yytext) } - | t:TYPEOF l:LPAREN @@ -1974,11 +1961,10 @@ 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) } | assignmentExpression - | META_AT m:mvalue initializerList = { listBegin() } ( d:designation { listAppend(d) } @@ -1999,9 +1985,7 @@ designatorList = { listB | l:DOT x:id { listAppend(new_C_binary(newNullObject(), l, x)) } )+ { $$= listEnd() } -### A.2.3 Statements - -# 6.8 +# statement rule statement = expressionStatement | labeledStatement @@ -2010,7 +1994,7 @@ statement = expressionStatement | iterationStatement | jumpStatement -# 6.8.1 +# labeledStatement rule labeledStatement = i:id c:COLON # an attribute specifier list may appear after @@ -2021,7 +2005,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() } l:LCURLY { listBegin() } @@ -2036,18 +2020,18 @@ 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) } | d:DO s:statement w:WHILE l:LPAREN x:expression r:RPAREN t:SEMI { $$= new_C_do(d, s, w, l, x, r, t) } @@ -2056,7 +2040,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) } | c:CONTINUE t:SEMI { $$= new_C_continue(c, t) } @@ -2064,9 +2048,7 @@ 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 - -# 6.9 +# externalDeclaration rule ## translationUnit = externalDeclaration+ @@ -2306,15 +2288,15 @@ _FLOAT128 = '_Float128' !IDREST &{gnu} { $$= newToken("_Float128" # input buffer from moving past it before redirecting input from the imported file metaCatch = META_AT ( META_IMPORT s:META_STRING ";" { inputStackPush(get(s, String, value)) ; $$= 0 } - | m:mvalue { map_append(outputProgram, m) ; $$= null } - | META_LCB s:mstmts { map_append(outputProgram, s) ; $$= null } + | m:mvalue { $$= m } + | META_LCB s:mstmts { $$= s } ) mvalue = ( i:META_IDENT { i= newGetVariable(i) } ( a:meta_argumentList { oop k = map_pop(a); i = newCall(i, a, k) } # call a function with argument - | { i = is(Function, eval(globals, i)) == 1 ? newCall(i, makeMap(), null) : i } # without + | { i = is(Function, eval(globals, i)) ? newCall(i, makeMap(), null) : i } # without ) | META_LPAREN ( i:meta_exp ) META_RPAREN - ) { $$= eval(globals, i) } + ) { $$= eval(globals, i) } mstmts = ( s:eval_stmt )* META_RCB { $$= s } # return the last stmt @@ -2533,26 +2515,22 @@ META_FLOAT = < [-+]* [0-9]+ '.' [0-9]* ('e'[-+]*[0-9]+)? > { $$= make #--------------------------------------------- Meta operator ----------------------------------------------# -MO_OPERATION = META_BACKTICK ( MO_INITIALIZER i:initializer { $$= newUnary(Quasiquote_proto, i) } - | MO_CONSTANT c:constant { $$= newUnary(Quasiquote_proto, c) } - | MO_STATEMENT s:statement { $$= newUnary(Quasiquote_proto, s) } - | MO_INTEGER i:integerConstant { $$= newUnary(Quasiquote_proto, i) } - | MO_DECLARATION d:declaration { $$= newUnary(Quasiquote_proto, d) } +MO_OPERATION = META_BACKTICK ( MO_CONSTANT c:constant { $$= newUnary(Quasiquote_proto, c) } | MO_STRING s:stringLiteral { $$= newUnary(Quasiquote_proto, s) } + | MO_EXPRESSION e:expression { $$= newUnary(Quasiquote_proto, e) } | MO_FUN f:functionDefinition { $$= newUnary(Quasiquote_proto, f) } + | MO_DECLARATION d:declaration { $$= newUnary(Quasiquote_proto, d) } + | MO_STATEMENT s:statement { $$= newUnary(Quasiquote_proto, s) } | MO_ED e:externalDeclaration { $$= newUnary(Quasiquote_proto, e) } - | MO_EXPRESSION e:expression { $$= newUnary(Quasiquote_proto, e) } ) -MO_INITIALIZER = 'initializer' ![(a-zA-Z0-9_] -- MO_CONSTANT = 'constant' ![(a-zA-Z0-9_] -- -MO_STATEMENT = 'statement' ![(a-zA-Z0-9_] -- -MO_INTEGER = 'integer' ![(a-zA-Z0-9_] -- -MO_DECLARATION = 'declaration' ![(a-zA-Z0-9_] -- MO_STRING = 'string' ![(a-zA-Z0-9_] -- +MO_EXPRESSION = 'expression' ![(a-zA-Z0-9_] -- MO_FUN = 'fun' ![(a-zA-Z0-9_] -- +MO_DECLARATION = 'declaration' ![(a-zA-Z0-9_] -- +MO_STATEMENT = 'statement' ![(a-zA-Z0-9_] -- MO_ED = 'ed' ![(a-zA-Z0-9_] -- -MO_EXPRESSION = 'expression' ![(a-zA-Z0-9_] -- #--------------------------------------------- Meta rules ----------------------------------------------# @@ -3238,7 +3216,11 @@ oop eval(oop scope, oop ast) if (keys != null && map_size(keys) > 0) { oop newArgs = makeMap(); for (int i = 0; i oop prim_microseconds(oop scope, oop params) @@ -3785,6 +3790,7 @@ void outputText(char *text) void outputNode(oop node) { + if (!node) return; switch (getType(node)) { case Undefined: @@ -4215,6 +4221,9 @@ void outputTree(oop node, int depth) CASE(stringLiteral) OUT(text); break; + CASE(string) + OUT(value); + break; CASE(char) OUT(value); break; @@ -4763,6 +4772,7 @@ void outputTree(oop node, int depth) /** Unknown node */ default: printf("I cannot print a node with proto_number %i\n", proto_number); + println(node); exit(0); } #undef PRINT @@ -4803,10 +4813,9 @@ int main(int argc, char **argv) map_set(globals, intern("treeCopy" ), makeFunction(prim_treeCopy, intern("treeCopy" ), null, null, globals, null)); map_set(globals, intern("import" ), makeFunction(prim_import, intern("import" ), null, null, globals, null)); map_set(globals, intern("microseconds"), makeFunction(prim_microseconds, intern("microseconds"), null, null, globals, null)); - map_set(globals, intern("string" ), makeFunction(prim_String , intern("string" ), null, null, globals, null)); - - + map_set(globals, intern("string" ), makeFunction(prim_String, intern("string" ), null, null, globals, null)); map_set(globals, intern("scope" ), makeFunction(prim_scope, intern("scope" ), null, null, globals, null)); + map_set(globals, intern("parseFrom" ), makeFunction(prim_parseFrom, intern("parseFrom" ), null, null, globals, null)); #define _DO(NAME) NAME##_symbol=intern(#NAME); DO_SYMBOLS() diff --git a/debug.c b/src/debug.c similarity index 100% rename from debug.c rename to src/debug.c diff --git a/dotest b/src/dotest similarity index 58% rename from dotest rename to src/dotest index a52f1ef..6d6a44c 100755 --- a/dotest +++ b/src/dotest @@ -1,5 +1,7 @@ #!/bin/sh +make + if test $# -gt 0; then run="$@" else @@ -12,28 +14,37 @@ die() exit 1 } -for i in tests-std/*.c; do +for i in tests/tests-parsimony/*.c; do + echo $i + j="${i%.c}.out" + k="tests/tests-parsimony/tmp.out" + $run $i > $k + cmp $k $j || die $k $j +done +rm tests/tests-parsimony/tmp.out + +for i in tests/tests-std/*.c; do echo $i j="${i%.c}.out" $run < $i > $j cmp $i $j || die $i $j done -for i in tests-gnu/*.c; do +for i in tests/tests-gnu/*.c; do echo $i j="${i%.c}.out" $run < $i > $j cmp $i $j || die $i $j done -for i in tests-err/*.c; do +for i in tests/tests-err/*.c; do echo $i j="${i%.c}.out" $run < $i > $j cmp -s $i $j || echo failed done -for i in tests-c/*.c; do +for i in tests/tests-c/*.c; do echo $i j="${i%.c}.out" $run < $i > $j diff --git a/media/ccmeta.drawio.png b/src/images/ccmeta.drawio.png similarity index 100% rename from media/ccmeta.drawio.png rename to src/images/ccmeta.drawio.png diff --git a/object.c b/src/object.c similarity index 99% rename from object.c rename to src/object.c index 7bb1ba0..22211f4 100644 --- a/object.c +++ b/src/object.c @@ -546,6 +546,12 @@ oop map_append(oop map, oop value) return map_set(map, makeInteger(map_size(map)), value); } +oop map_appendNonNil(oop map, oop value) +{ + if (value != null) map_set(map, makeInteger(map_size(map)), value); + return value; +} + oop map_pop(oop map) { assert(map_isArray(map)); size_t size = get(map, Map, size); diff --git a/parsimonyLibrary/boot.mc b/src/parsimonyLibrary/boot.mc similarity index 89% rename from parsimonyLibrary/boot.mc rename to src/parsimonyLibrary/boot.mc index f4c75ae..dc6dbc2 100644 --- a/parsimonyLibrary/boot.mc +++ b/src/parsimonyLibrary/boot.mc @@ -1,20 +1,6 @@ @{ println(x) { print(x, "\n"); } - // now in C - // treeCopy(x) { - // l = {}; - // k = _keys(x); - // if (k == null) { - // return clone(x); - // } else { - // for (i in k) { - // l[k[i]] = clone(treeCopy(x[k[i]])); - // } - // return clone(l); - // } - // } - //------------ creation C structure ------------// newId(x, comm) { @@ -55,10 +41,6 @@ } // TO FIX } - newDeclarators() {} - - //--- TO FIX ---// - newEnum(x) { { attributeL: null, expression: null, name: newId(x), __proto__: C_enum }; } newFunction() {} @@ -114,7 +96,6 @@ append(s1, s2[i]); } return s1; - // return treeCopy(s1); } // If g then we add a filter on the application of the function f to each element of seq diff --git a/parsimonyLibrary/dynamicObject.c b/src/parsimonyLibrary/dynamicObject.c similarity index 100% rename from parsimonyLibrary/dynamicObject.c rename to src/parsimonyLibrary/dynamicObject.c diff --git a/parsimonyLibrary/dynamicObject.mc b/src/parsimonyLibrary/dynamicObjectExtDecl.mc similarity index 97% rename from parsimonyLibrary/dynamicObject.mc rename to src/parsimonyLibrary/dynamicObjectExtDecl.mc index 84af6cd..3b1f8ba 100644 --- a/parsimonyLibrary/dynamicObject.mc +++ b/src/parsimonyLibrary/dynamicObjectExtDecl.mc @@ -19,8 +19,6 @@ struct Symbol *newSymbol(char *name) struct Symbol **symbols = 0; int nSymbols = 0; - - struct Symbol *intern(char *name) { int lo = 0; @@ -112,10 +110,15 @@ typedef struct __oop *oop; x; } - makeln(x, tabs) { + makeln(x, tabs, newLine) { x.semicolon.comment = newComment("\n"); nbTabs = 0; + nbLn = 1; if (tabs != null) { nbTabs = tabs; } + if (newLine != null) { nbLn = newLine; } + for (i = 1; i +#include +#include + +struct Symbol { + char *name; + int class, selector; +}; + +struct Symbol *newSymbol(char *name) +{ + struct Symbol *symbol = malloc(sizeof(*symbol)); + symbol->name = strdup(name); + symbol->class = 0; + symbol->selector = 0; + return symbol; +} + +struct Symbol **symbols = 0; +int nSymbols = 0; + + + +struct Symbol *intern(char *name) +{ + int lo = 0; + int hi = nSymbols - 1; + while (lo <= hi ) { + int mid = (lo+hi)/2; + int cmp = strcmp(name, symbols[mid]->name); + if (cmp > 0) lo = mid + 1; + else if (cmp < 0) hi = mid - 1; + else return symbols[mid]; + } + symbols = realloc(symbols, sizeof(*symbols) * ++nSymbols); + memmove(symbols + lo + 1, symbols + lo, sizeof(*symbols)*(nSymbols - lo - 1)); + return symbols[lo] = newSymbol(name); +} + +typedef void *(*method_t)(); + +void *method_dnu() +{ + printf("method not found\n"); + exit(1); + return 0; +} + +method_t **methods = 0; +int nClasses = 0; +int nSelectors = 0; + +int ensureClass(struct Symbol *symbol) +{ + if (symbol->class == 0) { + if (nClasses == 0) nClasses++; + symbol->class = nClasses++; + methods = realloc(methods, sizeof(*methods)*nClasses); + methods[symbol->class] = malloc(sizeof(*methods)*nSelectors); + for (int i = 0; iclass][i] = method_dnu; + } + return symbol->class; +} + +int ensureSelector(struct Symbol *symbol) +{ + if (symbol->selector == 0) { + if (nSelectors == 0) nSelectors++; + symbol->selector = nSelectors++; + for (int i = 0; iselector; +} + +int findClass(char *class) +{ + return ensureClass(intern(class)); +} + +int findSelector(char *selector) +{ + return ensureSelector(intern(selector)); +} + +void addMethod(int class, int selector, method_t method) +{ + methods[class][selector] = method; +} + +#define lookup(C, S) (methods[C][S]) + +struct Object { + int class; +}; + +#define send(R, M, ...) ({ struct Object *__ = (struct Object *)(R); lookup(__->class, _selector_##M)(__, ##__VA_ARGS__); }) + +struct __oop { int class; }; + +typedef struct __oop *oop; + +@import("parsimonyLibrary/boot.mc") + +@{ + + rmSemi(x) { + x.semicolon = null; + x; + } + + makeln(x, tabs, newLine) { + x.semicolon.comment = newComment("\n"); + nbTabs = 0; + nbLn = 1; + if (tabs != null) { nbTabs = tabs; } + if (newLine != null) { nbLn = newLine; } + for (i = 1; i0; i--) { + exp.specifiers[0].declarationL[i] = exp.specifiers[0].declarationL[i-1]; + }; + exp.specifiers[0].declarationL[0] = treeCopy(`declaration int class; ); + exp; + } + + method(object_name) + { + program.objects.currentClassName = object_name; + program.objects.function = "method"; + nil; + } + + constructor(object_name) { + program.objects.currentClassName = object_name; + program.objects.function = "constructor"; + nil; + } + + send(object, method) + { + treeCopy(rmSemi(`declaration send(@@(newText(object)), @@(newText(method)));)); + } + + everyExternalDeclaration(s) + { +/*********** Class function ************/ + if (program.objects.function == "class") { + program.objects.class[program.last.name.identifier] = {}; + for (i=length(program.last.declarationL); i>0; i--) { + program.last.declarationL[i] = program.last.declarationL[i-1]; + }; + program.last.declarationL[0] = treeCopy(`declaration int class; ); + program.objects.function = "none"; + return s; + } +/*********** Method function ************/ + if (program.objects.function == "method") { + intern(program.objects.methods, program.last.declarators.declarators.identifier); + for (i in program.objects.class) { + if (string(i) == program.objects.currentClassName) intern(program.objects.class[i], program.last.declarators.declarators.identifier); + } + program.last.declarators.declarators.identifier = program.objects.currentClassName + "_" + string(program.last.declarators.declarators.identifier); + param = rmSemi(`declaration struct __oop *__self;); + if (length(s.declarators.paramTypeL) > 0) { + append(s.declarators.paramTypeL, newComma()); + append(s.declarators.paramTypeL, treeCopy(param)); + } else { + s.declarators.paramTypeL = {}; + s.declarators.paramTypeL[0] = treeCopy(param); + } + tmp = {}; + tmp[0] = makeln(`declaration struct @@(newId(program.objects.currentClassName, " ")) *self = (struct @@(newId(program.objects.currentClassName, " ")) *) __self;, 1); + s.compoundS.expression = treeCopy(fusion(tmp, s.compoundS.expression)); + program.objects.function = "none"; + return s; + } +/*********** Constructor function ************/ + if (program.objects.function == "constructor") { + rawDeclaration = makeln(`declaration class = findClass(@@(newText("\"" + program.objects.currentClassName + "\"")));, 1); + t = {}; + append(t, treeCopy(makeln(`declaration struct @@(newId(program.objects.currentClassName, " ")) *self = calloc(1, sizeof *self);, 1))); + // take the structure of self->foo + lhs = treeCopy(s.compoundS.expression[0].expression.lhs); + lhs.rhs = newId("class", " "); + // Change foo to Class + rawDeclaration.declarators[0].lhs = lhs; + // prepare the right object to return + append(s.compoundS.expression, rawDeclaration); + append(s.compoundS.expression, makeln(`statement return (struct __oop *) self;)); + s.compoundS.expression = fusion(t, s.compoundS.expression); + program.objects.function = "none"; + return s; + } +/*********** Main function ************/ + if (s.declarators != null && s.declarators.declarators != null && string(s.declarators.declarators.identifier) == "main") { + t = {}; + for(i in program.objects.methods) { + methodName = string(program.objects.methods[i]); + append(t, treeCopy(makeln(`declaration int @@(newId("_selector_" + methodName)) = findSelector(@@(newId("\"" + methodName + "\"")));, 1))); + } + for (i in program.objects.class) { + className = string(i); // can't work other way + append(t, treeCopy(makeln(`declaration int @@(newId("_class_" + className)) = findClass(@@(newId("\"" + className + "\"")));, 1))); + for (k in program.objects.class[i]) { + linkedMethod = string(program.objects.class[i][k]); + castMethod = "(method_t) " + className + "_" + linkedMethod; + append(t, treeCopy(makeln(`declaration addMethod(@@(newId("_class_" + className)), @@(newId("_selector_" + linkedMethod)), @@(newId(castMethod)));, 1))); + } + } + s.compoundS.expression = fusion(t, s.compoundS.expression); + return s; + } + s; + } + + nil; +} \ No newline at end of file diff --git a/protoNumber.txt b/src/protoNumber.txt similarity index 98% rename from protoNumber.txt rename to src/protoNumber.txt index e5bed06..5c0417d 100644 --- a/protoNumber.txt +++ b/src/protoNumber.txt @@ -61,6 +61,7 @@ _DO(Continue) _DO(Throw) _DO(Try) _DO(Quote) +_DO(Quasiquote) _DO(Comment) _DO(Token) _DO(C_declaration) diff --git a/scope.c b/src/scope.c similarity index 100% rename from scope.c rename to src/scope.c diff --git a/tests-c/00001.c b/src/tests/tests-c/00001.c similarity index 100% rename from tests-c/00001.c rename to src/tests/tests-c/00001.c diff --git a/src/tests/tests-c/00001.out b/src/tests/tests-c/00001.out new file mode 100644 index 0000000..3a6dc7e --- /dev/null +++ b/src/tests/tests-c/00001.out @@ -0,0 +1,5 @@ +int +main() +{ + return 0; +} diff --git a/tests-c/00002.c b/src/tests/tests-c/00002.c similarity index 100% rename from tests-c/00002.c rename to src/tests/tests-c/00002.c diff --git a/src/tests/tests-c/00002.out b/src/tests/tests-c/00002.out new file mode 100644 index 0000000..40b2f51 --- /dev/null +++ b/src/tests/tests-c/00002.out @@ -0,0 +1,5 @@ +int +main() +{ + return 3-3; +} diff --git a/tests-c/00003.c b/src/tests/tests-c/00003.c similarity index 100% rename from tests-c/00003.c rename to src/tests/tests-c/00003.c diff --git a/src/tests/tests-c/00003.out b/src/tests/tests-c/00003.out new file mode 100644 index 0000000..f957c29 --- /dev/null +++ b/src/tests/tests-c/00003.out @@ -0,0 +1,8 @@ +int +main() +{ + int x; + + x = 4; + return x - 4; +} diff --git a/tests-c/00004.c b/src/tests/tests-c/00004.c similarity index 100% rename from tests-c/00004.c rename to src/tests/tests-c/00004.c diff --git a/src/tests/tests-c/00004.out b/src/tests/tests-c/00004.out new file mode 100644 index 0000000..e983f1b --- /dev/null +++ b/src/tests/tests-c/00004.out @@ -0,0 +1,12 @@ +int +main() +{ + int x; + int *p; + + x = 4; + p = &x; + *p = 0; + + return *p; +} diff --git a/tests-c/00005.c b/src/tests/tests-c/00005.c similarity index 100% rename from tests-c/00005.c rename to src/tests/tests-c/00005.c diff --git a/src/tests/tests-c/00005.out b/src/tests/tests-c/00005.out new file mode 100644 index 0000000..abcaa05 --- /dev/null +++ b/src/tests/tests-c/00005.out @@ -0,0 +1,23 @@ +int +main() +{ + int x; + int *p; + int **pp; + + x = 0; + p = &x; + pp = &p; + + if(*p) + return 1; + if(**pp) + return 1; + else + **pp = 1; + + if(x) + return 0; + else + return 1; +} diff --git a/tests-c/00006.c b/src/tests/tests-c/00006.c similarity index 100% rename from tests-c/00006.c rename to src/tests/tests-c/00006.c diff --git a/src/tests/tests-c/00006.out b/src/tests/tests-c/00006.out new file mode 100644 index 0000000..d3a1377 --- /dev/null +++ b/src/tests/tests-c/00006.out @@ -0,0 +1,10 @@ +int +main() +{ + int x; + + x = 50; + while (x) + x = x - 1; + return x; +} diff --git a/tests-c/00007.c b/src/tests/tests-c/00007.c similarity index 100% rename from tests-c/00007.c rename to src/tests/tests-c/00007.c diff --git a/src/tests/tests-c/00007.out b/src/tests/tests-c/00007.out new file mode 100644 index 0000000..acdc901 --- /dev/null +++ b/src/tests/tests-c/00007.out @@ -0,0 +1,15 @@ +int +main() +{ + int x; + + x = 1; + for(x = 10; x; x = x - 1) + ; + if(x) + return 1; + x = 10; + for (;x;) + x = x - 1; + return x; +} diff --git a/tests-c/00008.c b/src/tests/tests-c/00008.c similarity index 100% rename from tests-c/00008.c rename to src/tests/tests-c/00008.c diff --git a/src/tests/tests-c/00008.out b/src/tests/tests-c/00008.out new file mode 100644 index 0000000..115b8b9 --- /dev/null +++ b/src/tests/tests-c/00008.out @@ -0,0 +1,11 @@ +int +main() +{ + int x; + + x = 50; + do + x = x - 1; + while(x); + return x; +} diff --git a/tests-c/00009.c b/src/tests/tests-c/00009.c similarity index 100% rename from tests-c/00009.c rename to src/tests/tests-c/00009.c diff --git a/src/tests/tests-c/00009.out b/src/tests/tests-c/00009.out new file mode 100644 index 0000000..3defb01 --- /dev/null +++ b/src/tests/tests-c/00009.out @@ -0,0 +1,11 @@ +int +main() +{ + int x; + + x = 1; + x = x * 10; + x = x / 2; + x = x % 3; + return x - 2; +} diff --git a/tests-c/00010.c b/src/tests/tests-c/00010.c similarity index 100% rename from tests-c/00010.c rename to src/tests/tests-c/00010.c diff --git a/src/tests/tests-c/00010.out b/src/tests/tests-c/00010.out new file mode 100644 index 0000000..d5bfbbf --- /dev/null +++ b/src/tests/tests-c/00010.out @@ -0,0 +1,13 @@ +int +main() +{ + start: + goto next; + return 1; + success: + return 0; + next: + foo: + goto success; + return 1; +} diff --git a/tests-c/00011.c b/src/tests/tests-c/00011.c similarity index 100% rename from tests-c/00011.c rename to src/tests/tests-c/00011.c diff --git a/src/tests/tests-c/00011.out b/src/tests/tests-c/00011.out new file mode 100644 index 0000000..aa29782 --- /dev/null +++ b/src/tests/tests-c/00011.out @@ -0,0 +1,8 @@ +int +main() +{ + int x; + int y; + x = y = 0; + return x; +} diff --git a/tests-c/00012.c b/src/tests/tests-c/00012.c similarity index 100% rename from tests-c/00012.c rename to src/tests/tests-c/00012.c diff --git a/src/tests/tests-c/00012.out b/src/tests/tests-c/00012.out new file mode 100644 index 0000000..c2bf7d0 --- /dev/null +++ b/src/tests/tests-c/00012.out @@ -0,0 +1,5 @@ +int +main() +{ + return (2 + 2) * 2 - 8; +} diff --git a/tests-c/00013.c b/src/tests/tests-c/00013.c similarity index 100% rename from tests-c/00013.c rename to src/tests/tests-c/00013.c diff --git a/src/tests/tests-c/00013.out b/src/tests/tests-c/00013.out new file mode 100644 index 0000000..87a9b5c --- /dev/null +++ b/src/tests/tests-c/00013.out @@ -0,0 +1,10 @@ +int +main() +{ + int x; + int *p; + + x = 0; + p = &x; + return p[0]; +} diff --git a/tests-c/00014.c b/src/tests/tests-c/00014.c similarity index 100% rename from tests-c/00014.c rename to src/tests/tests-c/00014.c diff --git a/src/tests/tests-c/00014.out b/src/tests/tests-c/00014.out new file mode 100644 index 0000000..487b3de --- /dev/null +++ b/src/tests/tests-c/00014.out @@ -0,0 +1,11 @@ +int +main() +{ + int x; + int *p; + + x = 1; + p = &x; + p[0] = 0; + return x; +} diff --git a/tests-c/00015.c b/src/tests/tests-c/00015.c similarity index 100% rename from tests-c/00015.c rename to src/tests/tests-c/00015.c diff --git a/src/tests/tests-c/00015.out b/src/tests/tests-c/00015.out new file mode 100644 index 0000000..829f2e4 --- /dev/null +++ b/src/tests/tests-c/00015.out @@ -0,0 +1,10 @@ +int +main() +{ + int arr[2]; + + arr[0] = 1; + arr[1] = 2; + + return arr[0] + arr[1] - 3; +} diff --git a/tests-c/00016.c b/src/tests/tests-c/00016.c similarity index 100% rename from tests-c/00016.c rename to src/tests/tests-c/00016.c diff --git a/src/tests/tests-c/00016.out b/src/tests/tests-c/00016.out new file mode 100644 index 0000000..9db7edb --- /dev/null +++ b/src/tests/tests-c/00016.out @@ -0,0 +1,10 @@ +int +main() +{ + int arr[2]; + int *p; + + p = &arr[1]; + *p = 0; + return arr[1]; +} diff --git a/tests-c/00017.c b/src/tests/tests-c/00017.c similarity index 100% rename from tests-c/00017.c rename to src/tests/tests-c/00017.c diff --git a/src/tests/tests-c/00017.out b/src/tests/tests-c/00017.out new file mode 100644 index 0000000..af4e2c2 --- /dev/null +++ b/src/tests/tests-c/00017.out @@ -0,0 +1,9 @@ +int +main() +{ + struct { int x; int y; } s; + + s.x = 3; + s.y = 5; + return s.y - s.x - 2; +} diff --git a/tests-c/00018.c b/src/tests/tests-c/00018.c similarity index 100% rename from tests-c/00018.c rename to src/tests/tests-c/00018.c diff --git a/src/tests/tests-c/00018.out b/src/tests/tests-c/00018.out new file mode 100644 index 0000000..6777a7c --- /dev/null +++ b/src/tests/tests-c/00018.out @@ -0,0 +1,13 @@ +int +main() +{ + + struct S { int x; int y; } s; + struct S *p; + + p = &s; + s.x = 1; + p->y = 2; + return p->y + p->x - 3; +} + diff --git a/tests-c/00019.c b/src/tests/tests-c/00019.c similarity index 100% rename from tests-c/00019.c rename to src/tests/tests-c/00019.c diff --git a/src/tests/tests-c/00019.out b/src/tests/tests-c/00019.out new file mode 100644 index 0000000..9383c2f --- /dev/null +++ b/src/tests/tests-c/00019.out @@ -0,0 +1,10 @@ +int +main() +{ + struct S { struct S *p; int x; } s; + + s.x = 0; + s.p = &s; + return s.p->p->p->p->p->x; +} + diff --git a/tests-c/00020.c b/src/tests/tests-c/00020.c similarity index 100% rename from tests-c/00020.c rename to src/tests/tests-c/00020.c diff --git a/src/tests/tests-c/00020.out b/src/tests/tests-c/00020.out new file mode 100644 index 0000000..a7e5bee --- /dev/null +++ b/src/tests/tests-c/00020.out @@ -0,0 +1,10 @@ +int +main() +{ + int x, *p, **pp; + + x = 0; + p = &x; + pp = &p; + return **pp; +} diff --git a/tests-c/00021.c b/src/tests/tests-c/00021.c similarity index 100% rename from tests-c/00021.c rename to src/tests/tests-c/00021.c diff --git a/src/tests/tests-c/00021.out b/src/tests/tests-c/00021.out new file mode 100644 index 0000000..a49cd78 --- /dev/null +++ b/src/tests/tests-c/00021.out @@ -0,0 +1,12 @@ +int +foo(int a, int b) +{ + return 2 + a - b; +} + +int +main() +{ + return foo(1, 3); +} + diff --git a/tests-c/00022.c b/src/tests/tests-c/00022.c similarity index 100% rename from tests-c/00022.c rename to src/tests/tests-c/00022.c diff --git a/src/tests/tests-c/00022.out b/src/tests/tests-c/00022.out new file mode 100644 index 0000000..5ecca98 --- /dev/null +++ b/src/tests/tests-c/00022.out @@ -0,0 +1,10 @@ +typedef int x; + +int +main() +{ + x v; + v = 0; + return v; +} + diff --git a/tests-c/00023.c b/src/tests/tests-c/00023.c similarity index 100% rename from tests-c/00023.c rename to src/tests/tests-c/00023.c diff --git a/src/tests/tests-c/00023.out b/src/tests/tests-c/00023.out new file mode 100644 index 0000000..0fadbd8 --- /dev/null +++ b/src/tests/tests-c/00023.out @@ -0,0 +1,9 @@ +int x; + +int +main() +{ + x = 0; + return x; +} + diff --git a/tests-c/00024.c b/src/tests/tests-c/00024.c similarity index 100% rename from tests-c/00024.c rename to src/tests/tests-c/00024.c diff --git a/src/tests/tests-c/00024.out b/src/tests/tests-c/00024.out new file mode 100644 index 0000000..405ea86 --- /dev/null +++ b/src/tests/tests-c/00024.out @@ -0,0 +1,12 @@ +typedef struct { int x; int y; } s; + +s v; + +int +main() +{ + v.x = 1; + v.y = 2; + return 3 - v.x - v.y; +} + diff --git a/tests-c/00025.c b/src/tests/tests-c/00025.c similarity index 100% rename from tests-c/00025.c rename to src/tests/tests-c/00025.c diff --git a/src/tests/tests-c/00025.out b/src/tests/tests-c/00025.out new file mode 100644 index 0000000..cee08c5 --- /dev/null +++ b/src/tests/tests-c/00025.out @@ -0,0 +1,10 @@ +int strlen(char *); + +int +main() +{ + char *p; + + p = "hello"; + return strlen(p) - 5; +} diff --git a/tests-c/00026.c b/src/tests/tests-c/00026.c similarity index 100% rename from tests-c/00026.c rename to src/tests/tests-c/00026.c diff --git a/src/tests/tests-c/00026.out b/src/tests/tests-c/00026.out new file mode 100644 index 0000000..62c747e --- /dev/null +++ b/src/tests/tests-c/00026.out @@ -0,0 +1,8 @@ +int +main() +{ + char *p; + + p = "hello"; + return p[0] - 104; +} diff --git a/tests-c/00027.c b/src/tests/tests-c/00027.c similarity index 100% rename from tests-c/00027.c rename to src/tests/tests-c/00027.c diff --git a/src/tests/tests-c/00027.out b/src/tests/tests-c/00027.out new file mode 100644 index 0000000..3ee7bfe --- /dev/null +++ b/src/tests/tests-c/00027.out @@ -0,0 +1,10 @@ +int +main() +{ + int x; + + x = 1; + x = x | 4; + return x - 5; +} + diff --git a/tests-c/00028.c b/src/tests/tests-c/00028.c similarity index 100% rename from tests-c/00028.c rename to src/tests/tests-c/00028.c diff --git a/src/tests/tests-c/00028.out b/src/tests/tests-c/00028.out new file mode 100644 index 0000000..cb10630 --- /dev/null +++ b/src/tests/tests-c/00028.out @@ -0,0 +1,10 @@ +int +main() +{ + int x; + + x = 1; + x = x & 3; + return x - 1; +} + diff --git a/tests-c/00029.c b/src/tests/tests-c/00029.c similarity index 100% rename from tests-c/00029.c rename to src/tests/tests-c/00029.c diff --git a/src/tests/tests-c/00029.out b/src/tests/tests-c/00029.out new file mode 100644 index 0000000..74180cb --- /dev/null +++ b/src/tests/tests-c/00029.out @@ -0,0 +1,10 @@ +int +main() +{ + int x; + + x = 1; + x = x ^ 3; + return x - 2; +} + diff --git a/tests-c/00030.c b/src/tests/tests-c/00030.c similarity index 100% rename from tests-c/00030.c rename to src/tests/tests-c/00030.c diff --git a/src/tests/tests-c/00030.out b/src/tests/tests-c/00030.out new file mode 100644 index 0000000..5b4001f --- /dev/null +++ b/src/tests/tests-c/00030.out @@ -0,0 +1,24 @@ +int +f() +{ + return 100; +} + +int +main() +{ + if (f() > 1000) + return 1; + if (f() >= 1000) + return 1; + if (1000 < f()) + return 1; + if (1000 <= f()) + return 1; + if (1000 == f()) + return 1; + if (100 != f()) + return 1; + return 0; +} + diff --git a/tests-c/00031.c b/src/tests/tests-c/00031.c similarity index 100% rename from tests-c/00031.c rename to src/tests/tests-c/00031.c diff --git a/src/tests/tests-c/00031.out b/src/tests/tests-c/00031.out new file mode 100644 index 0000000..09b43ce --- /dev/null +++ b/src/tests/tests-c/00031.out @@ -0,0 +1,48 @@ +int +zero() +{ + return 0; +} + +int +one() +{ + return 1; +} + +int +main() +{ + int x; + int y; + + x = zero(); + y = ++x; + if (x != 1) + return 1; + if (y != 1) + return 1; + + x = one(); + y = --x; + if (x != 0) + return 1; + if (y != 0) + return 1; + + x = zero(); + y = x++; + if (x != 1) + return 1; + if (y != 0) + return 1; + + x = one(); + y = x--; + if (x != 0) + return 1; + if (y != 1) + return 1; + + return 0; +} diff --git a/tests-c/00032.c b/src/tests/tests-c/00032.c similarity index 100% rename from tests-c/00032.c rename to src/tests/tests-c/00032.c diff --git a/src/tests/tests-c/00032.out b/src/tests/tests-c/00032.out new file mode 100644 index 0000000..bc606ad --- /dev/null +++ b/src/tests/tests-c/00032.out @@ -0,0 +1,30 @@ +int +main() +{ + int arr[2]; + int *p; + + arr[0] = 2; + arr[1] = 3; + p = &arr[0]; + if(*(p++) != 2) + return 1; + if(*(p++) != 3) + return 2; + + p = &arr[1]; + if(*(p--) != 3) + return 1; + if(*(p--) != 2) + return 2; + + p = &arr[0]; + if(*(++p) != 3) + return 1; + + p = &arr[1]; + if(*(--p) != 2) + return 1; + + return 0; +} diff --git a/tests-c/00033.c b/src/tests/tests-c/00033.c similarity index 100% rename from tests-c/00033.c rename to src/tests/tests-c/00033.c diff --git a/src/tests/tests-c/00033.out b/src/tests/tests-c/00033.out new file mode 100644 index 0000000..cfc26f6 --- /dev/null +++ b/src/tests/tests-c/00033.out @@ -0,0 +1,45 @@ +int g; + +int +effect() +{ + g = 1; + return 1; +} + +int +main() +{ + int x; + + g = 0; + x = 0; + if(x && effect()) + return 1; + if(g) + return 2; + x = 1; + if(x && effect()) { + if(g != 1) + return 3; + } else { + return 4; + } + g = 0; + x = 1; + if(x || effect()) { + if(g) + return 5; + } else { + return 6; + } + x = 0; + if(x || effect()) { + if(g != 1) + return 7; + } else { + return 8; + } + return 0; +} + diff --git a/tests-c/00034.c b/src/tests/tests-c/00034.c similarity index 100% rename from tests-c/00034.c rename to src/tests/tests-c/00034.c diff --git a/src/tests/tests-c/00034.out b/src/tests/tests-c/00034.out new file mode 100644 index 0000000..891d5f8 --- /dev/null +++ b/src/tests/tests-c/00034.out @@ -0,0 +1,32 @@ +int +main() +{ + int x; + + x = 0; + while(1) + break; + while(1) { + if (x == 5) { + break; + } + x = x + 1; + continue; + } + for (;;) { + if (x == 10) { + break; + } + x = x + 1; + continue; + } + do { + if (x == 15) { + break; + } + x = x + 1; + continue; + } while(1); + return x - 15; +} + diff --git a/tests-c/00035.c b/src/tests/tests-c/00035.c similarity index 100% rename from tests-c/00035.c rename to src/tests/tests-c/00035.c diff --git a/src/tests/tests-c/00035.out b/src/tests/tests-c/00035.out new file mode 100644 index 0000000..e8bf709 --- /dev/null +++ b/src/tests/tests-c/00035.out @@ -0,0 +1,15 @@ +int +main() +{ + int x; + + x = 4; + if(!x != 0) + return 1; + if(!!x != 1) + return 1; + if(-x != 0 - 4) + return 1; + return 0; +} + diff --git a/tests-c/00036.c b/src/tests/tests-c/00036.c similarity index 100% rename from tests-c/00036.c rename to src/tests/tests-c/00036.c diff --git a/src/tests/tests-c/00036.out b/src/tests/tests-c/00036.out new file mode 100644 index 0000000..f0f4583 --- /dev/null +++ b/src/tests/tests-c/00036.out @@ -0,0 +1,19 @@ +int +main() +{ + int x; + + x = 0; + x += 2; + x += 2; + if (x != 4) + return 1; + x -= 1; + if (x != 3) + return 2; + x *= 2; + if (x != 6) + return 3; + + return 0; +} diff --git a/tests-c/00037.c b/src/tests/tests-c/00037.c similarity index 100% rename from tests-c/00037.c rename to src/tests/tests-c/00037.c diff --git a/src/tests/tests-c/00037.out b/src/tests/tests-c/00037.out new file mode 100644 index 0000000..a353946 --- /dev/null +++ b/src/tests/tests-c/00037.out @@ -0,0 +1,17 @@ +int +main() +{ + int x[2]; + int *p; + + x[1] = 7; + p = &x[0]; + p = p + 1; + + if(*p != 7) + return 1; + if(&x[1] - &x[0] != 1) + return 1; + + return 0; +} diff --git a/tests-c/00038.c b/src/tests/tests-c/00038.c similarity index 100% rename from tests-c/00038.c rename to src/tests/tests-c/00038.c diff --git a/src/tests/tests-c/00038.out b/src/tests/tests-c/00038.out new file mode 100644 index 0000000..35b23f4 --- /dev/null +++ b/src/tests/tests-c/00038.out @@ -0,0 +1,17 @@ +int +main() +{ + int x, *p; + + if (sizeof(0) < 2) + return 1; + if (sizeof 0 < 2) + return 1; + if (sizeof(char) < 1) + return 1; + if (sizeof(int) - 2 < 0) + return 1; + if (sizeof(&x) != sizeof p) + return 1; + return 0; +} diff --git a/tests-c/00039.c b/src/tests/tests-c/00039.c similarity index 100% rename from tests-c/00039.c rename to src/tests/tests-c/00039.c diff --git a/src/tests/tests-c/00039.out b/src/tests/tests-c/00039.out new file mode 100644 index 0000000..cc6b2e6 --- /dev/null +++ b/src/tests/tests-c/00039.out @@ -0,0 +1,13 @@ +int +main() +{ + void *p; + int x; + + x = 2; + p = &x; + + if(*((int*)p) != 2) + return 1; + return 0; +} diff --git a/tests-c/00040.c b/src/tests/tests-c/00040.c similarity index 100% rename from tests-c/00040.c rename to src/tests/tests-c/00040.c diff --git a/src/tests/tests-c/00040.out b/src/tests/tests-c/00040.out new file mode 100644 index 0000000..819dc9c --- /dev/null +++ b/src/tests/tests-c/00040.out @@ -0,0 +1,55 @@ +#include + +int N; +int *t; + +int +chk(int x, int y) +{ + int i; + int r; + + for (r=i=0; i<8; i++) { + r = r + t[x + 8*i]; + r = r + t[i + 8*y]; + if (x+i < 8 & y+i < 8) + r = r + t[x+i + 8*(y+i)]; + if (x+i < 8 & y-i >= 0) + r = r + t[x+i + 8*(y-i)]; + if (x-i >= 0 & y+i < 8) + r = r + t[x-i + 8*(y+i)]; + if (x-i >= 0 & y-i >= 0) + r = r + t[x-i + 8*(y-i)]; + } + return r; +} + +int +go(int n, int x, int y) +{ + if (n == 8) { + N++; + return 0; + } + for (; y<8; y++) { + for (; x<8; x++) + if (chk(x, y) == 0) { + t[x + 8*y]++; + go(n+1, x, y); + t[x + 8*y]--; + } + x = 0; + } + return 0; +} + +int +main() +{ + t = calloc(64, sizeof(int)); + go(0, 0, 0); + if(N != 92) + return 1; + return 0; +} + diff --git a/tests-c/00041.c b/src/tests/tests-c/00041.c similarity index 100% rename from tests-c/00041.c rename to src/tests/tests-c/00041.c diff --git a/src/tests/tests-c/00041.out b/src/tests/tests-c/00041.out new file mode 100644 index 0000000..d240d10 --- /dev/null +++ b/src/tests/tests-c/00041.out @@ -0,0 +1,26 @@ +int +main() { + int n; + int t; + int c; + int p; + + c = 0; + n = 2; + while (n < 5000) { + t = 2; + p = 1; + while (t*t <= n) { + if (n % t == 0) + p = 0; + t++; + } + n++; + if (p) + c++; + } + if (c != 669) + return 1; + return 0; +} + diff --git a/tests-c/00042.c b/src/tests/tests-c/00042.c similarity index 100% rename from tests-c/00042.c rename to src/tests/tests-c/00042.c diff --git a/src/tests/tests-c/00042.out b/src/tests/tests-c/00042.out new file mode 100644 index 0000000..8b2b209 --- /dev/null +++ b/src/tests/tests-c/00042.out @@ -0,0 +1,11 @@ +int +main() +{ + union { int a; int b; } u; + u.a = 1; + u.b = 3; + + if (u.a != 3 || u.b != 3) + return 1; + return 0; +} diff --git a/tests-c/00043.c b/src/tests/tests-c/00043.c similarity index 100% rename from tests-c/00043.c rename to src/tests/tests-c/00043.c diff --git a/src/tests/tests-c/00043.out b/src/tests/tests-c/00043.out new file mode 100644 index 0000000..895e55b --- /dev/null +++ b/src/tests/tests-c/00043.out @@ -0,0 +1,19 @@ +struct s { + int x; + struct { + int y; + int z; + } nest; +}; + +int +main() { + struct s v; + v.x = 1; + v.nest.y = 2; + v.nest.z = 3; + if (v.x + v.nest.y + v.nest.z != 6) + return 1; + return 0; +} + diff --git a/tests-c/00044.c b/src/tests/tests-c/00044.c similarity index 100% rename from tests-c/00044.c rename to src/tests/tests-c/00044.c diff --git a/src/tests/tests-c/00044.out b/src/tests/tests-c/00044.out new file mode 100644 index 0000000..418a4a1 --- /dev/null +++ b/src/tests/tests-c/00044.out @@ -0,0 +1,16 @@ +struct T; + +struct T { + int x; +}; + +int +main() +{ + struct T v; + { struct T { int z; }; } + v.x = 2; + if(v.x != 2) + return 1; + return 0; +} diff --git a/tests-c/00045.c b/src/tests/tests-c/00045.c similarity index 100% rename from tests-c/00045.c rename to src/tests/tests-c/00045.c diff --git a/src/tests/tests-c/00045.out b/src/tests/tests-c/00045.out new file mode 100644 index 0000000..d6a8d99 --- /dev/null +++ b/src/tests/tests-c/00045.out @@ -0,0 +1,16 @@ +int x = 5; +long y = 6; +int *p = &x; + +int +main() +{ + if (x != 5) + return 1; + if (y != 6) + return 2; + if (*p != 5) + return 3; + return 0; +} + diff --git a/tests-c/00046.c b/src/tests/tests-c/00046.c similarity index 100% rename from tests-c/00046.c rename to src/tests/tests-c/00046.c diff --git a/src/tests/tests-c/00046.out b/src/tests/tests-c/00046.out new file mode 100644 index 0000000..9ebf52a --- /dev/null +++ b/src/tests/tests-c/00046.out @@ -0,0 +1,33 @@ +typedef struct { + int a; + union { + int b1; + int b2; + }; + struct { union { struct { int c; }; }; }; + struct { + int d; + }; +} s; + +int +main() +{ + s v; + + v.a = 1; + v.b1 = 2; + v.c = 3; + v.d = 4; + + if (v.a != 1) + return 1; + if (v.b1 != 2 && v.b2 != 2) + return 2; + if (v.c != 3) + return 3; + if (v.d != 4) + return 4; + + return 0; +} diff --git a/tests-c/00047.c b/src/tests/tests-c/00047.c similarity index 100% rename from tests-c/00047.c rename to src/tests/tests-c/00047.c diff --git a/src/tests/tests-c/00047.out b/src/tests/tests-c/00047.out new file mode 100644 index 0000000..56d8e8d --- /dev/null +++ b/src/tests/tests-c/00047.out @@ -0,0 +1,14 @@ +struct { int a; int b; int c; } s = {1, 2, 3}; + +int +main() +{ + if (s.a != 1) + return 1; + if (s.b != 2) + return 2; + if (s.c != 3) + return 3; + + return 0; +} diff --git a/tests-c/00048.c b/src/tests/tests-c/00048.c similarity index 100% rename from tests-c/00048.c rename to src/tests/tests-c/00048.c diff --git a/src/tests/tests-c/00048.out b/src/tests/tests-c/00048.out new file mode 100644 index 0000000..d9f36d7 --- /dev/null +++ b/src/tests/tests-c/00048.out @@ -0,0 +1,12 @@ +struct S {int a; int b;}; +struct S s = { .b = 2, .a = 1}; + +int +main() +{ + if(s.a != 1) + return 1; + if(s.b != 2) + return 2; + return 0; +} diff --git a/tests-c/00049.c b/src/tests/tests-c/00049.c similarity index 100% rename from tests-c/00049.c rename to src/tests/tests-c/00049.c diff --git a/src/tests/tests-c/00049.out b/src/tests/tests-c/00049.out new file mode 100644 index 0000000..432c721 --- /dev/null +++ b/src/tests/tests-c/00049.out @@ -0,0 +1,14 @@ +int x = 10; + +struct S {int a; int *p;}; +struct S s = { .p = &x, .a = 1}; + +int +main() +{ + if(s.a != 1) + return 1; + if(*s.p != 10) + return 2; + return 0; +} diff --git a/tests-c/00050.c b/src/tests/tests-c/00050.c similarity index 100% rename from tests-c/00050.c rename to src/tests/tests-c/00050.c diff --git a/src/tests/tests-c/00050.out b/src/tests/tests-c/00050.out new file mode 100644 index 0000000..42591a1 --- /dev/null +++ b/src/tests/tests-c/00050.out @@ -0,0 +1,33 @@ +struct S1 { + int a; + int b; +}; + +struct S2 { + int a; + int b; + union { + int c; + int d; + }; + struct S1 s; +}; + +struct S2 v = {1, 2, 3, {4, 5}}; + +int +main() +{ + if(v.a != 1) + return 1; + if(v.b != 2) + return 2; + if(v.c != 3 || v.d != 3) + return 3; + if(v.s.a != 4) + return 4; + if(v.s.b != 5) + return 5; + + return 0; +} diff --git a/tests-c/00051.c b/src/tests/tests-c/00051.c similarity index 100% rename from tests-c/00051.c rename to src/tests/tests-c/00051.c diff --git a/src/tests/tests-c/00051.out b/src/tests/tests-c/00051.out new file mode 100644 index 0000000..8168ab4 --- /dev/null +++ b/src/tests/tests-c/00051.out @@ -0,0 +1,38 @@ +int x = 0; + +int +main() +{ + switch(x) + case 0: + ; + switch(x) + case 0: + switch(x) { + case 0: + goto next; + default: + return 1; + } + return 1; + next: + switch(x) + case 1: + return 1; + switch(x) { + { + x = 1 + 1; + foo: + case 1: + return 1; + } + } + switch(x) { + case 0: + return x; + case 1: + return 1; + default: + return 1; + } +} diff --git a/tests-c/00052.c b/src/tests/tests-c/00052.c similarity index 100% rename from tests-c/00052.c rename to src/tests/tests-c/00052.c diff --git a/src/tests/tests-c/00052.out b/src/tests/tests-c/00052.out new file mode 100644 index 0000000..960fbb0 --- /dev/null +++ b/src/tests/tests-c/00052.out @@ -0,0 +1,10 @@ +int +main() +{ + struct T { int x; }; + { + struct T s; + s.x = 0; + return s.x; + } +} diff --git a/tests-c/00053.c b/src/tests/tests-c/00053.c similarity index 100% rename from tests-c/00053.c rename to src/tests/tests-c/00053.c diff --git a/src/tests/tests-c/00053.out b/src/tests/tests-c/00053.out new file mode 100644 index 0000000..995209c --- /dev/null +++ b/src/tests/tests-c/00053.out @@ -0,0 +1,13 @@ +int +main() +{ + struct T { int x; } s1; + s1.x = 1; + { + struct T { int y; } s2; + s2.y = 1; + if (s1.x - s2.y != 0) + return 1; + } + return 0; +} diff --git a/tests-c/00054.c b/src/tests/tests-c/00054.c similarity index 100% rename from tests-c/00054.c rename to src/tests/tests-c/00054.c diff --git a/src/tests/tests-c/00054.out b/src/tests/tests-c/00054.out new file mode 100644 index 0000000..d9e76e4 --- /dev/null +++ b/src/tests/tests-c/00054.out @@ -0,0 +1,22 @@ +enum E { + x, + y, + z, +}; + +int +main() +{ + enum E e; + + if(x != 0) + return 1; + if(y != 1) + return 2; + if(z != 2) + return 3; + + e = x; + return e; +} + diff --git a/tests-c/00055.c b/src/tests/tests-c/00055.c similarity index 100% rename from tests-c/00055.c rename to src/tests/tests-c/00055.c diff --git a/src/tests/tests-c/00055.out b/src/tests/tests-c/00055.out new file mode 100644 index 0000000..0292124 --- /dev/null +++ b/src/tests/tests-c/00055.out @@ -0,0 +1,22 @@ +enum E { + x, + y = 2, + z, +}; + +int +main() +{ + enum E e; + + if(x != 0) + return 1; + if(y != 2) + return 2; + if(z != 3) + return 3; + + e = x; + return e; +} + diff --git a/tests-c/00056.c b/src/tests/tests-c/00056.c similarity index 100% rename from tests-c/00056.c rename to src/tests/tests-c/00056.c diff --git a/src/tests/tests-c/00056.out b/src/tests/tests-c/00056.out new file mode 100644 index 0000000..c96109f --- /dev/null +++ b/src/tests/tests-c/00056.out @@ -0,0 +1,18 @@ +#include + +int main() +{ + int a; + a = 42; + printf("%d\n", a); + + int b = 64; + printf("%d\n", b); + + int c = 12, d = 34; + printf("%d, %d\n", c, d); + + return 0; +} + +// vim: set expandtab ts=4 sw=3 sts=3 tw=80 : diff --git a/tests-c/00057.c b/src/tests/tests-c/00057.c similarity index 100% rename from tests-c/00057.c rename to src/tests/tests-c/00057.c diff --git a/src/tests/tests-c/00057.out b/src/tests/tests-c/00057.out new file mode 100644 index 0000000..e3dfef2 --- /dev/null +++ b/src/tests/tests-c/00057.out @@ -0,0 +1,9 @@ +int +main() +{ + char a[16], b[16]; + + if(sizeof(a) != sizeof(b)) + return 1; + return 0; +} diff --git a/tests-c/00058.c b/src/tests/tests-c/00058.c similarity index 100% rename from tests-c/00058.c rename to src/tests/tests-c/00058.c diff --git a/src/tests/tests-c/00058.out b/src/tests/tests-c/00058.out new file mode 100644 index 0000000..59077df --- /dev/null +++ b/src/tests/tests-c/00058.out @@ -0,0 +1,15 @@ +int main() +{ + char * s; + + s = "abc" "def"; + if(s[0] != 'a') return 1; + if(s[1] != 'b') return 2; + if(s[2] != 'c') return 3; + if(s[3] != 'd') return 4; + if(s[4] != 'e') return 5; + if(s[5] != 'f') return 6; + if(s[6] != 0) return 7; + + return 0; +} diff --git a/tests-c/00059.c b/src/tests/tests-c/00059.c similarity index 100% rename from tests-c/00059.c rename to src/tests/tests-c/00059.c diff --git a/src/tests/tests-c/00059.out b/src/tests/tests-c/00059.out new file mode 100644 index 0000000..d1f7f34 --- /dev/null +++ b/src/tests/tests-c/00059.out @@ -0,0 +1,8 @@ +int +main() +{ + if ('a' != 97) + return 1; + + return 0; +} diff --git a/tests-c/00060.c b/src/tests/tests-c/00060.c similarity index 100% rename from tests-c/00060.c rename to src/tests/tests-c/00060.c diff --git a/src/tests/tests-c/00060.out b/src/tests/tests-c/00060.out new file mode 100644 index 0000000..d2f5060 --- /dev/null +++ b/src/tests/tests-c/00060.out @@ -0,0 +1,11 @@ +// line comment + +int +main() +{ + /* + multiline + comment + */ + return 0; +} diff --git a/tests-c/00061.c b/src/tests/tests-c/00061.c similarity index 100% rename from tests-c/00061.c rename to src/tests/tests-c/00061.c diff --git a/src/tests/tests-c/00061.out b/src/tests/tests-c/00061.out new file mode 100644 index 0000000..c3abf01 --- /dev/null +++ b/src/tests/tests-c/00061.out @@ -0,0 +1,7 @@ +#define FOO 0 + +int main() +{ + return FOO; +} + diff --git a/tests-c/00062.c b/src/tests/tests-c/00062.c similarity index 100% rename from tests-c/00062.c rename to src/tests/tests-c/00062.c diff --git a/src/tests/tests-c/00062.out b/src/tests/tests-c/00062.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-c/00063.c b/src/tests/tests-c/00063.c similarity index 100% rename from tests-c/00063.c rename to src/tests/tests-c/00063.c diff --git a/tests-c/00064.c b/src/tests/tests-c/00064.c similarity index 100% rename from tests-c/00064.c rename to src/tests/tests-c/00064.c diff --git a/tests-c/00065.c b/src/tests/tests-c/00065.c similarity index 100% rename from tests-c/00065.c rename to src/tests/tests-c/00065.c diff --git a/tests-c/00066.c b/src/tests/tests-c/00066.c similarity index 100% rename from tests-c/00066.c rename to src/tests/tests-c/00066.c diff --git a/tests-c/00067.c b/src/tests/tests-c/00067.c similarity index 100% rename from tests-c/00067.c rename to src/tests/tests-c/00067.c diff --git a/tests-c/00068.c b/src/tests/tests-c/00068.c similarity index 100% rename from tests-c/00068.c rename to src/tests/tests-c/00068.c diff --git a/tests-c/00069.c b/src/tests/tests-c/00069.c similarity index 100% rename from tests-c/00069.c rename to src/tests/tests-c/00069.c diff --git a/tests-c/00070.c b/src/tests/tests-c/00070.c similarity index 100% rename from tests-c/00070.c rename to src/tests/tests-c/00070.c diff --git a/tests-c/00071.c b/src/tests/tests-c/00071.c similarity index 100% rename from tests-c/00071.c rename to src/tests/tests-c/00071.c diff --git a/tests-c/00072.c b/src/tests/tests-c/00072.c similarity index 100% rename from tests-c/00072.c rename to src/tests/tests-c/00072.c diff --git a/tests-c/00073.c b/src/tests/tests-c/00073.c similarity index 100% rename from tests-c/00073.c rename to src/tests/tests-c/00073.c diff --git a/tests-c/00074.c b/src/tests/tests-c/00074.c similarity index 100% rename from tests-c/00074.c rename to src/tests/tests-c/00074.c diff --git a/tests-c/00075.c b/src/tests/tests-c/00075.c similarity index 100% rename from tests-c/00075.c rename to src/tests/tests-c/00075.c diff --git a/tests-c/00076.c b/src/tests/tests-c/00076.c similarity index 100% rename from tests-c/00076.c rename to src/tests/tests-c/00076.c diff --git a/tests-c/00077.c b/src/tests/tests-c/00077.c similarity index 100% rename from tests-c/00077.c rename to src/tests/tests-c/00077.c diff --git a/tests-c/00078.c b/src/tests/tests-c/00078.c similarity index 100% rename from tests-c/00078.c rename to src/tests/tests-c/00078.c diff --git a/tests-c/00079.c b/src/tests/tests-c/00079.c similarity index 100% rename from tests-c/00079.c rename to src/tests/tests-c/00079.c diff --git a/tests-c/00080.c b/src/tests/tests-c/00080.c similarity index 100% rename from tests-c/00080.c rename to src/tests/tests-c/00080.c diff --git a/tests-c/00081.c b/src/tests/tests-c/00081.c similarity index 100% rename from tests-c/00081.c rename to src/tests/tests-c/00081.c diff --git a/tests-c/00082.c b/src/tests/tests-c/00082.c similarity index 100% rename from tests-c/00082.c rename to src/tests/tests-c/00082.c diff --git a/tests-c/00083.c b/src/tests/tests-c/00083.c similarity index 100% rename from tests-c/00083.c rename to src/tests/tests-c/00083.c diff --git a/tests-c/00084.c b/src/tests/tests-c/00084.c similarity index 100% rename from tests-c/00084.c rename to src/tests/tests-c/00084.c diff --git a/tests-c/00085.c b/src/tests/tests-c/00085.c similarity index 100% rename from tests-c/00085.c rename to src/tests/tests-c/00085.c diff --git a/tests-c/00086.c b/src/tests/tests-c/00086.c similarity index 100% rename from tests-c/00086.c rename to src/tests/tests-c/00086.c diff --git a/tests-c/00087.c b/src/tests/tests-c/00087.c similarity index 100% rename from tests-c/00087.c rename to src/tests/tests-c/00087.c diff --git a/tests-c/00088.c b/src/tests/tests-c/00088.c similarity index 100% rename from tests-c/00088.c rename to src/tests/tests-c/00088.c diff --git a/tests-c/00089.c b/src/tests/tests-c/00089.c similarity index 100% rename from tests-c/00089.c rename to src/tests/tests-c/00089.c diff --git a/tests-c/00090.c b/src/tests/tests-c/00090.c similarity index 100% rename from tests-c/00090.c rename to src/tests/tests-c/00090.c diff --git a/tests-c/00091.c b/src/tests/tests-c/00091.c similarity index 100% rename from tests-c/00091.c rename to src/tests/tests-c/00091.c diff --git a/tests-c/00092.c b/src/tests/tests-c/00092.c similarity index 100% rename from tests-c/00092.c rename to src/tests/tests-c/00092.c diff --git a/tests-c/00093.c b/src/tests/tests-c/00093.c similarity index 100% rename from tests-c/00093.c rename to src/tests/tests-c/00093.c diff --git a/tests-c/00094.c b/src/tests/tests-c/00094.c similarity index 100% rename from tests-c/00094.c rename to src/tests/tests-c/00094.c diff --git a/tests-c/00095.c b/src/tests/tests-c/00095.c similarity index 100% rename from tests-c/00095.c rename to src/tests/tests-c/00095.c diff --git a/tests-c/00096.c b/src/tests/tests-c/00096.c similarity index 100% rename from tests-c/00096.c rename to src/tests/tests-c/00096.c diff --git a/tests-c/00097.c b/src/tests/tests-c/00097.c similarity index 100% rename from tests-c/00097.c rename to src/tests/tests-c/00097.c diff --git a/tests-c/00098.c b/src/tests/tests-c/00098.c similarity index 100% rename from tests-c/00098.c rename to src/tests/tests-c/00098.c diff --git a/tests-c/00099.c b/src/tests/tests-c/00099.c similarity index 100% rename from tests-c/00099.c rename to src/tests/tests-c/00099.c diff --git a/tests-c/00100.c b/src/tests/tests-c/00100.c similarity index 100% rename from tests-c/00100.c rename to src/tests/tests-c/00100.c diff --git a/tests-c/00101.c b/src/tests/tests-c/00101.c similarity index 100% rename from tests-c/00101.c rename to src/tests/tests-c/00101.c diff --git a/tests-c/00102.c b/src/tests/tests-c/00102.c similarity index 100% rename from tests-c/00102.c rename to src/tests/tests-c/00102.c diff --git a/tests-c/00103.c b/src/tests/tests-c/00103.c similarity index 100% rename from tests-c/00103.c rename to src/tests/tests-c/00103.c diff --git a/tests-c/00104.c b/src/tests/tests-c/00104.c similarity index 100% rename from tests-c/00104.c rename to src/tests/tests-c/00104.c diff --git a/tests-c/00105.c b/src/tests/tests-c/00105.c similarity index 100% rename from tests-c/00105.c rename to src/tests/tests-c/00105.c diff --git a/tests-c/00106.c b/src/tests/tests-c/00106.c similarity index 100% rename from tests-c/00106.c rename to src/tests/tests-c/00106.c diff --git a/tests-c/00107.c b/src/tests/tests-c/00107.c similarity index 100% rename from tests-c/00107.c rename to src/tests/tests-c/00107.c diff --git a/tests-c/00108.c b/src/tests/tests-c/00108.c similarity index 100% rename from tests-c/00108.c rename to src/tests/tests-c/00108.c diff --git a/tests-c/00109.c b/src/tests/tests-c/00109.c similarity index 100% rename from tests-c/00109.c rename to src/tests/tests-c/00109.c diff --git a/tests-c/00110.c b/src/tests/tests-c/00110.c similarity index 100% rename from tests-c/00110.c rename to src/tests/tests-c/00110.c diff --git a/tests-c/00111.c b/src/tests/tests-c/00111.c similarity index 100% rename from tests-c/00111.c rename to src/tests/tests-c/00111.c diff --git a/tests-c/00112.c b/src/tests/tests-c/00112.c similarity index 100% rename from tests-c/00112.c rename to src/tests/tests-c/00112.c diff --git a/tests-c/00113.c b/src/tests/tests-c/00113.c similarity index 100% rename from tests-c/00113.c rename to src/tests/tests-c/00113.c diff --git a/tests-c/00114.c b/src/tests/tests-c/00114.c similarity index 100% rename from tests-c/00114.c rename to src/tests/tests-c/00114.c diff --git a/tests-c/00115.c b/src/tests/tests-c/00115.c similarity index 100% rename from tests-c/00115.c rename to src/tests/tests-c/00115.c diff --git a/tests-c/00116.c b/src/tests/tests-c/00116.c similarity index 100% rename from tests-c/00116.c rename to src/tests/tests-c/00116.c diff --git a/tests-c/00117.c b/src/tests/tests-c/00117.c similarity index 100% rename from tests-c/00117.c rename to src/tests/tests-c/00117.c diff --git a/tests-c/00118.c b/src/tests/tests-c/00118.c similarity index 100% rename from tests-c/00118.c rename to src/tests/tests-c/00118.c diff --git a/tests-c/00119.c b/src/tests/tests-c/00119.c similarity index 100% rename from tests-c/00119.c rename to src/tests/tests-c/00119.c diff --git a/tests-c/00120.c b/src/tests/tests-c/00120.c similarity index 100% rename from tests-c/00120.c rename to src/tests/tests-c/00120.c diff --git a/tests-c/00121.c b/src/tests/tests-c/00121.c similarity index 100% rename from tests-c/00121.c rename to src/tests/tests-c/00121.c diff --git a/tests-c/00122.c b/src/tests/tests-c/00122.c similarity index 100% rename from tests-c/00122.c rename to src/tests/tests-c/00122.c diff --git a/tests-c/00123.c b/src/tests/tests-c/00123.c similarity index 100% rename from tests-c/00123.c rename to src/tests/tests-c/00123.c diff --git a/tests-c/00124.c b/src/tests/tests-c/00124.c similarity index 100% rename from tests-c/00124.c rename to src/tests/tests-c/00124.c diff --git a/tests-c/00125.c b/src/tests/tests-c/00125.c similarity index 100% rename from tests-c/00125.c rename to src/tests/tests-c/00125.c diff --git a/tests-c/00126.c b/src/tests/tests-c/00126.c similarity index 100% rename from tests-c/00126.c rename to src/tests/tests-c/00126.c diff --git a/tests-c/00127.c b/src/tests/tests-c/00127.c similarity index 100% rename from tests-c/00127.c rename to src/tests/tests-c/00127.c diff --git a/tests-c/00128.c b/src/tests/tests-c/00128.c similarity index 100% rename from tests-c/00128.c rename to src/tests/tests-c/00128.c diff --git a/tests-c/00129.c b/src/tests/tests-c/00129.c similarity index 100% rename from tests-c/00129.c rename to src/tests/tests-c/00129.c diff --git a/tests-c/00130.c b/src/tests/tests-c/00130.c similarity index 100% rename from tests-c/00130.c rename to src/tests/tests-c/00130.c diff --git a/tests-c/00131.c b/src/tests/tests-c/00131.c similarity index 100% rename from tests-c/00131.c rename to src/tests/tests-c/00131.c diff --git a/tests-c/00132.c b/src/tests/tests-c/00132.c similarity index 100% rename from tests-c/00132.c rename to src/tests/tests-c/00132.c diff --git a/tests-c/00133.c b/src/tests/tests-c/00133.c similarity index 100% rename from tests-c/00133.c rename to src/tests/tests-c/00133.c diff --git a/tests-c/00134.c b/src/tests/tests-c/00134.c similarity index 100% rename from tests-c/00134.c rename to src/tests/tests-c/00134.c diff --git a/tests-c/00135.c b/src/tests/tests-c/00135.c similarity index 100% rename from tests-c/00135.c rename to src/tests/tests-c/00135.c diff --git a/tests-c/00136.c b/src/tests/tests-c/00136.c similarity index 100% rename from tests-c/00136.c rename to src/tests/tests-c/00136.c diff --git a/tests-c/00137.c b/src/tests/tests-c/00137.c similarity index 100% rename from tests-c/00137.c rename to src/tests/tests-c/00137.c diff --git a/tests-c/00138.c b/src/tests/tests-c/00138.c similarity index 100% rename from tests-c/00138.c rename to src/tests/tests-c/00138.c diff --git a/tests-c/00139.c b/src/tests/tests-c/00139.c similarity index 100% rename from tests-c/00139.c rename to src/tests/tests-c/00139.c diff --git a/tests-c/00140.c b/src/tests/tests-c/00140.c similarity index 100% rename from tests-c/00140.c rename to src/tests/tests-c/00140.c diff --git a/tests-c/00141.c b/src/tests/tests-c/00141.c similarity index 100% rename from tests-c/00141.c rename to src/tests/tests-c/00141.c diff --git a/tests-c/00142.c b/src/tests/tests-c/00142.c similarity index 100% rename from tests-c/00142.c rename to src/tests/tests-c/00142.c diff --git a/tests-c/00143.c b/src/tests/tests-c/00143.c similarity index 100% rename from tests-c/00143.c rename to src/tests/tests-c/00143.c diff --git a/tests-c/00144.c b/src/tests/tests-c/00144.c similarity index 100% rename from tests-c/00144.c rename to src/tests/tests-c/00144.c diff --git a/tests-c/00145.c b/src/tests/tests-c/00145.c similarity index 100% rename from tests-c/00145.c rename to src/tests/tests-c/00145.c diff --git a/tests-c/00146.c b/src/tests/tests-c/00146.c similarity index 100% rename from tests-c/00146.c rename to src/tests/tests-c/00146.c diff --git a/tests-c/00147.c b/src/tests/tests-c/00147.c similarity index 100% rename from tests-c/00147.c rename to src/tests/tests-c/00147.c diff --git a/tests-c/00148.c b/src/tests/tests-c/00148.c similarity index 100% rename from tests-c/00148.c rename to src/tests/tests-c/00148.c diff --git a/tests-c/00149.c b/src/tests/tests-c/00149.c similarity index 100% rename from tests-c/00149.c rename to src/tests/tests-c/00149.c diff --git a/tests-c/00150.c b/src/tests/tests-c/00150.c similarity index 100% rename from tests-c/00150.c rename to src/tests/tests-c/00150.c diff --git a/tests-c/00151.c b/src/tests/tests-c/00151.c similarity index 100% rename from tests-c/00151.c rename to src/tests/tests-c/00151.c diff --git a/tests-c/00152.c b/src/tests/tests-c/00152.c similarity index 100% rename from tests-c/00152.c rename to src/tests/tests-c/00152.c diff --git a/tests-c/00153.c b/src/tests/tests-c/00153.c similarity index 100% rename from tests-c/00153.c rename to src/tests/tests-c/00153.c diff --git a/tests-c/00154.c b/src/tests/tests-c/00154.c similarity index 100% rename from tests-c/00154.c rename to src/tests/tests-c/00154.c diff --git a/tests-c/00155.c b/src/tests/tests-c/00155.c similarity index 100% rename from tests-c/00155.c rename to src/tests/tests-c/00155.c diff --git a/tests-c/00156.c b/src/tests/tests-c/00156.c similarity index 100% rename from tests-c/00156.c rename to src/tests/tests-c/00156.c diff --git a/tests-c/00157.c b/src/tests/tests-c/00157.c similarity index 100% rename from tests-c/00157.c rename to src/tests/tests-c/00157.c diff --git a/tests-c/00158.c b/src/tests/tests-c/00158.c similarity index 100% rename from tests-c/00158.c rename to src/tests/tests-c/00158.c diff --git a/tests-c/00159.c b/src/tests/tests-c/00159.c similarity index 100% rename from tests-c/00159.c rename to src/tests/tests-c/00159.c diff --git a/tests-c/00160.c b/src/tests/tests-c/00160.c similarity index 100% rename from tests-c/00160.c rename to src/tests/tests-c/00160.c diff --git a/tests-c/00161.c b/src/tests/tests-c/00161.c similarity index 100% rename from tests-c/00161.c rename to src/tests/tests-c/00161.c diff --git a/tests-c/00162.c b/src/tests/tests-c/00162.c similarity index 100% rename from tests-c/00162.c rename to src/tests/tests-c/00162.c diff --git a/tests-c/00163.c b/src/tests/tests-c/00163.c similarity index 100% rename from tests-c/00163.c rename to src/tests/tests-c/00163.c diff --git a/tests-c/00164.c b/src/tests/tests-c/00164.c similarity index 100% rename from tests-c/00164.c rename to src/tests/tests-c/00164.c diff --git a/tests-c/00165.c b/src/tests/tests-c/00165.c similarity index 100% rename from tests-c/00165.c rename to src/tests/tests-c/00165.c diff --git a/tests-c/00166.c b/src/tests/tests-c/00166.c similarity index 100% rename from tests-c/00166.c rename to src/tests/tests-c/00166.c diff --git a/tests-c/00167.c b/src/tests/tests-c/00167.c similarity index 100% rename from tests-c/00167.c rename to src/tests/tests-c/00167.c diff --git a/tests-c/00168.c b/src/tests/tests-c/00168.c similarity index 100% rename from tests-c/00168.c rename to src/tests/tests-c/00168.c diff --git a/tests-c/00169.c b/src/tests/tests-c/00169.c similarity index 100% rename from tests-c/00169.c rename to src/tests/tests-c/00169.c diff --git a/tests-c/00170.c b/src/tests/tests-c/00170.c similarity index 100% rename from tests-c/00170.c rename to src/tests/tests-c/00170.c diff --git a/tests-c/00171.c b/src/tests/tests-c/00171.c similarity index 100% rename from tests-c/00171.c rename to src/tests/tests-c/00171.c diff --git a/tests-c/00172.c b/src/tests/tests-c/00172.c similarity index 100% rename from tests-c/00172.c rename to src/tests/tests-c/00172.c diff --git a/tests-c/00173.c b/src/tests/tests-c/00173.c similarity index 100% rename from tests-c/00173.c rename to src/tests/tests-c/00173.c diff --git a/tests-c/00174.c b/src/tests/tests-c/00174.c similarity index 100% rename from tests-c/00174.c rename to src/tests/tests-c/00174.c diff --git a/tests-c/00175.c b/src/tests/tests-c/00175.c similarity index 100% rename from tests-c/00175.c rename to src/tests/tests-c/00175.c diff --git a/tests-c/00176.c b/src/tests/tests-c/00176.c similarity index 100% rename from tests-c/00176.c rename to src/tests/tests-c/00176.c diff --git a/tests-c/00177.c b/src/tests/tests-c/00177.c similarity index 100% rename from tests-c/00177.c rename to src/tests/tests-c/00177.c diff --git a/tests-c/00178.c b/src/tests/tests-c/00178.c similarity index 100% rename from tests-c/00178.c rename to src/tests/tests-c/00178.c diff --git a/tests-c/00179.c b/src/tests/tests-c/00179.c similarity index 100% rename from tests-c/00179.c rename to src/tests/tests-c/00179.c diff --git a/tests-c/00180.c b/src/tests/tests-c/00180.c similarity index 100% rename from tests-c/00180.c rename to src/tests/tests-c/00180.c diff --git a/tests-c/00181.c b/src/tests/tests-c/00181.c similarity index 100% rename from tests-c/00181.c rename to src/tests/tests-c/00181.c diff --git a/tests-c/00182.c b/src/tests/tests-c/00182.c similarity index 100% rename from tests-c/00182.c rename to src/tests/tests-c/00182.c diff --git a/tests-c/00183.c b/src/tests/tests-c/00183.c similarity index 100% rename from tests-c/00183.c rename to src/tests/tests-c/00183.c diff --git a/tests-c/00184.c b/src/tests/tests-c/00184.c similarity index 100% rename from tests-c/00184.c rename to src/tests/tests-c/00184.c diff --git a/tests-c/00185.c b/src/tests/tests-c/00185.c similarity index 100% rename from tests-c/00185.c rename to src/tests/tests-c/00185.c diff --git a/tests-c/00186.c b/src/tests/tests-c/00186.c similarity index 100% rename from tests-c/00186.c rename to src/tests/tests-c/00186.c diff --git a/tests-c/00187.c b/src/tests/tests-c/00187.c similarity index 100% rename from tests-c/00187.c rename to src/tests/tests-c/00187.c diff --git a/tests-c/00188.c b/src/tests/tests-c/00188.c similarity index 100% rename from tests-c/00188.c rename to src/tests/tests-c/00188.c diff --git a/tests-c/00189.c b/src/tests/tests-c/00189.c similarity index 100% rename from tests-c/00189.c rename to src/tests/tests-c/00189.c diff --git a/tests-c/00190.c b/src/tests/tests-c/00190.c similarity index 100% rename from tests-c/00190.c rename to src/tests/tests-c/00190.c diff --git a/tests-c/00191.c b/src/tests/tests-c/00191.c similarity index 100% rename from tests-c/00191.c rename to src/tests/tests-c/00191.c diff --git a/tests-c/00192.c b/src/tests/tests-c/00192.c similarity index 100% rename from tests-c/00192.c rename to src/tests/tests-c/00192.c diff --git a/tests-c/00193.c b/src/tests/tests-c/00193.c similarity index 100% rename from tests-c/00193.c rename to src/tests/tests-c/00193.c diff --git a/tests-c/00194.c b/src/tests/tests-c/00194.c similarity index 100% rename from tests-c/00194.c rename to src/tests/tests-c/00194.c diff --git a/tests-c/00195.c b/src/tests/tests-c/00195.c similarity index 100% rename from tests-c/00195.c rename to src/tests/tests-c/00195.c diff --git a/tests-c/00196.c b/src/tests/tests-c/00196.c similarity index 100% rename from tests-c/00196.c rename to src/tests/tests-c/00196.c diff --git a/tests-c/00197.c b/src/tests/tests-c/00197.c similarity index 100% rename from tests-c/00197.c rename to src/tests/tests-c/00197.c diff --git a/tests-c/00198.c b/src/tests/tests-c/00198.c similarity index 100% rename from tests-c/00198.c rename to src/tests/tests-c/00198.c diff --git a/tests-c/00199.c b/src/tests/tests-c/00199.c similarity index 100% rename from tests-c/00199.c rename to src/tests/tests-c/00199.c diff --git a/tests-c/00200.c b/src/tests/tests-c/00200.c similarity index 100% rename from tests-c/00200.c rename to src/tests/tests-c/00200.c diff --git a/tests-c/00201.c b/src/tests/tests-c/00201.c similarity index 100% rename from tests-c/00201.c rename to src/tests/tests-c/00201.c diff --git a/tests-c/00202.c b/src/tests/tests-c/00202.c similarity index 100% rename from tests-c/00202.c rename to src/tests/tests-c/00202.c diff --git a/tests-c/00203.c b/src/tests/tests-c/00203.c similarity index 100% rename from tests-c/00203.c rename to src/tests/tests-c/00203.c diff --git a/tests-c/00204.c b/src/tests/tests-c/00204.c similarity index 100% rename from tests-c/00204.c rename to src/tests/tests-c/00204.c diff --git a/tests-c/00205.c b/src/tests/tests-c/00205.c similarity index 100% rename from tests-c/00205.c rename to src/tests/tests-c/00205.c diff --git a/tests-c/00206.c b/src/tests/tests-c/00206.c similarity index 100% rename from tests-c/00206.c rename to src/tests/tests-c/00206.c diff --git a/tests-c/00207.c b/src/tests/tests-c/00207.c similarity index 100% rename from tests-c/00207.c rename to src/tests/tests-c/00207.c diff --git a/tests-c/00208.c b/src/tests/tests-c/00208.c similarity index 100% rename from tests-c/00208.c rename to src/tests/tests-c/00208.c diff --git a/tests-c/00209.c b/src/tests/tests-c/00209.c similarity index 100% rename from tests-c/00209.c rename to src/tests/tests-c/00209.c diff --git a/tests-c/00210.c b/src/tests/tests-c/00210.c similarity index 100% rename from tests-c/00210.c rename to src/tests/tests-c/00210.c diff --git a/tests-c/00211.c b/src/tests/tests-c/00211.c similarity index 100% rename from tests-c/00211.c rename to src/tests/tests-c/00211.c diff --git a/tests-c/00212.c b/src/tests/tests-c/00212.c similarity index 100% rename from tests-c/00212.c rename to src/tests/tests-c/00212.c diff --git a/tests-c/00213.c b/src/tests/tests-c/00213.c similarity index 100% rename from tests-c/00213.c rename to src/tests/tests-c/00213.c diff --git a/tests-c/00214.c b/src/tests/tests-c/00214.c similarity index 100% rename from tests-c/00214.c rename to src/tests/tests-c/00214.c diff --git a/tests-c/00215.c b/src/tests/tests-c/00215.c similarity index 100% rename from tests-c/00215.c rename to src/tests/tests-c/00215.c diff --git a/tests-c/00216.c b/src/tests/tests-c/00216.c similarity index 100% rename from tests-c/00216.c rename to src/tests/tests-c/00216.c diff --git a/tests-c/00217.c b/src/tests/tests-c/00217.c similarity index 100% rename from tests-c/00217.c rename to src/tests/tests-c/00217.c diff --git a/tests-c/00218.c b/src/tests/tests-c/00218.c similarity index 100% rename from tests-c/00218.c rename to src/tests/tests-c/00218.c diff --git a/tests-c/00219.c b/src/tests/tests-c/00219.c similarity index 100% rename from tests-c/00219.c rename to src/tests/tests-c/00219.c diff --git a/tests-c/00220.c b/src/tests/tests-c/00220.c similarity index 100% rename from tests-c/00220.c rename to src/tests/tests-c/00220.c diff --git a/tests-cpp/test88.c b/src/tests/tests-cpp/test88.c similarity index 100% rename from tests-cpp/test88.c rename to src/tests/tests-cpp/test88.c diff --git a/tests-err/test14.c b/src/tests/tests-err/test14.c similarity index 100% rename from tests-err/test14.c rename to src/tests/tests-err/test14.c diff --git a/src/tests/tests-err/test14.out b/src/tests/tests-err/test14.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-err/test15.c b/src/tests/tests-err/test15.c similarity index 100% rename from tests-err/test15.c rename to src/tests/tests-err/test15.c diff --git a/src/tests/tests-err/test15.out b/src/tests/tests-err/test15.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-err/test23.c b/src/tests/tests-err/test23.c similarity index 100% rename from tests-err/test23.c rename to src/tests/tests-err/test23.c diff --git a/src/tests/tests-err/test23.out b/src/tests/tests-err/test23.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-err/test26.c b/src/tests/tests-err/test26.c similarity index 100% rename from tests-err/test26.c rename to src/tests/tests-err/test26.c diff --git a/src/tests/tests-err/test26.out b/src/tests/tests-err/test26.out new file mode 100644 index 0000000..e04ad23 --- /dev/null +++ b/src/tests/tests-err/test26.out @@ -0,0 +1,5 @@ + func (x, y) { + int x, y; // ‘x’ redeclared as different kind of symbol / ‘y’ redeclared as different kind of symbol + return x+y; + } + diff --git a/tests-err/test41.c b/src/tests/tests-err/test41.c similarity index 100% rename from tests-err/test41.c rename to src/tests/tests-err/test41.c diff --git a/src/tests/tests-err/test41.out b/src/tests/tests-err/test41.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-err/test43.c b/src/tests/tests-err/test43.c similarity index 100% rename from tests-err/test43.c rename to src/tests/tests-err/test43.c diff --git a/src/tests/tests-err/test43.out b/src/tests/tests-err/test43.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-err/test45.c b/src/tests/tests-err/test45.c similarity index 100% rename from tests-err/test45.c rename to src/tests/tests-err/test45.c diff --git a/src/tests/tests-err/test45.out b/src/tests/tests-err/test45.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-err/test5.c b/src/tests/tests-err/test5.c similarity index 100% rename from tests-err/test5.c rename to src/tests/tests-err/test5.c diff --git a/src/tests/tests-err/test5.out b/src/tests/tests-err/test5.out new file mode 100644 index 0000000..287f06a --- /dev/null +++ b/src/tests/tests-err/test5.out @@ -0,0 +1,18 @@ +typedef void *PyObject; + + int +PyMapping_SetItemString(o, key, value) + PyObject *o; + char *key; + PyObject *value; +{ + PyObject *okey; + int r; + + if( ! key) return Py_ReturnNullError(),-1; + if (!(okey=PyString_FromString(key))) return -1; + r = PyObject_SetItem(o,okey,value); + if (--( okey )->ob_refcnt != 0) ; else (*( okey )->ob_type->tp_dealloc)((PyObject *)( okey )) ; // (1)request for member ‘ob_refcnt’ in something not a structure or union / (2)request for member ‘ob_type’ in something not a structure or union + // ^(1) ^(2) + return r; +} \ No newline at end of file diff --git a/tests-err/test57.c b/src/tests/tests-err/test57.c similarity index 100% rename from tests-err/test57.c rename to src/tests/tests-err/test57.c diff --git a/src/tests/tests-err/test57.out b/src/tests/tests-err/test57.out new file mode 100644 index 0000000..62bdd16 --- /dev/null +++ b/src/tests/tests-err/test57.out @@ -0,0 +1,6 @@ + +void F(char l) +{ + return l<= '\~'; // ‘return’ with a value, in function returning void / unknown escape sequence: '\~' +} + diff --git a/tests-err/test66.c b/src/tests/tests-err/test66.c similarity index 100% rename from tests-err/test66.c rename to src/tests/tests-err/test66.c diff --git a/src/tests/tests-err/test66.out b/src/tests/tests-err/test66.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-err/test71.c b/src/tests/tests-err/test71.c similarity index 100% rename from tests-err/test71.c rename to src/tests/tests-err/test71.c diff --git a/src/tests/tests-err/test71.out b/src/tests/tests-err/test71.out new file mode 100644 index 0000000..e69de29 diff --git a/tests-gnu/test12.c b/src/tests/tests-gnu/test12.c similarity index 100% rename from tests-gnu/test12.c rename to src/tests/tests-gnu/test12.c diff --git a/src/tests/tests-gnu/test12.out b/src/tests/tests-gnu/test12.out new file mode 100644 index 0000000..7e63c17 --- /dev/null +++ b/src/tests/tests-gnu/test12.out @@ -0,0 +1,19 @@ +int foo(); +int abs; +int main() { + abs = ({ + __label__ hey, now; + + int y = foo (); + int z; + void *it; + it = &&hey; + + hey: if (y > 0) z = y; + + else z = - y; + z; + }); + +} + diff --git a/tests-gnu/test13.c b/src/tests/tests-gnu/test13.c similarity index 100% rename from tests-gnu/test13.c rename to src/tests/tests-gnu/test13.c diff --git a/src/tests/tests-gnu/test13.out b/src/tests/tests-gnu/test13.out new file mode 100644 index 0000000..7549ba4 --- /dev/null +++ b/src/tests/tests-gnu/test13.out @@ -0,0 +1,8 @@ + foo (double a, double b) + { + auto double square (double z); + double square (double z) { return z * z; } + + return square (a) + square (b); + } + diff --git a/tests-gnu/test14.c b/src/tests/tests-gnu/test14.c similarity index 100% rename from tests-gnu/test14.c rename to src/tests/tests-gnu/test14.c diff --git a/src/tests/tests-gnu/test14.out b/src/tests/tests-gnu/test14.out new file mode 100644 index 0000000..710f515 --- /dev/null +++ b/src/tests/tests-gnu/test14.out @@ -0,0 +1,7 @@ +main() { + int a; + //typedef b = (a); + typeof (int *) c; + typeof (d[0](1)) e; + c = &a; +} diff --git a/tests-gnu/test16.c b/src/tests/tests-gnu/test16.c similarity index 100% rename from tests-gnu/test16.c rename to src/tests/tests-gnu/test16.c diff --git a/src/tests/tests-gnu/test16.out b/src/tests/tests-gnu/test16.out new file mode 100644 index 0000000..8ecaa95 --- /dev/null +++ b/src/tests/tests-gnu/test16.out @@ -0,0 +1,5 @@ +hey() { + int x,y,z; + z= x ? : y; +} + diff --git a/tests-gnu/test17.c b/src/tests/tests-gnu/test17.c similarity index 100% rename from tests-gnu/test17.c rename to src/tests/tests-gnu/test17.c diff --git a/src/tests/tests-gnu/test17.out b/src/tests/tests-gnu/test17.out new file mode 100644 index 0000000..2915386 --- /dev/null +++ b/src/tests/tests-gnu/test17.out @@ -0,0 +1,11 @@ +heynow() { + long long int x = 10LL; + unsigned long long int y = 9ULL; + __complex__ float c, d, e; + float f; + c = 10.0 + 3.0fi; + d = ~ c; + f = __real__ c; + f = __imag__ d; +} + diff --git a/tests-gnu/test18.c b/src/tests/tests-gnu/test18.c similarity index 100% rename from tests-gnu/test18.c rename to src/tests/tests-gnu/test18.c diff --git a/src/tests/tests-gnu/test18.out b/src/tests/tests-gnu/test18.out new file mode 100644 index 0000000..9048d86 --- /dev/null +++ b/src/tests/tests-gnu/test18.out @@ -0,0 +1,7 @@ +concat_fopen (char *s1, char *s2, char *mode) +{ + char str[strlen (s1) + strlen (s2) + 1]; + strcpy (str, s1); + strcat (str, s2); + return fopen (str, mode); +} diff --git a/tests-gnu/test21.c b/src/tests/tests-gnu/test21.c similarity index 100% rename from tests-gnu/test21.c rename to src/tests/tests-gnu/test21.c diff --git a/src/tests/tests-gnu/test21.out b/src/tests/tests-gnu/test21.out new file mode 100644 index 0000000..8e49786 --- /dev/null +++ b/src/tests/tests-gnu/test21.out @@ -0,0 +1,15 @@ + +heynow() { + struct foo {int a; char b[2];} structure; + char **foo1 = (char *[]) { "x", "y", "z" }; + + structure = ((struct foo) {x + y, 'a', 0}); + + { + struct foo temp = {x + y, 'a', 0}; + structure = temp; + } + + output = ((int[]) { 2, x, 28 }) [input]; +} + diff --git a/tests-gnu/test22.c b/src/tests/tests-gnu/test22.c similarity index 100% rename from tests-gnu/test22.c rename to src/tests/tests-gnu/test22.c diff --git a/src/tests/tests-gnu/test22.out b/src/tests/tests-gnu/test22.out new file mode 100644 index 0000000..fd87de9 --- /dev/null +++ b/src/tests/tests-gnu/test22.out @@ -0,0 +1,23 @@ +aikoAllDay() { + int a[6] = { [4] 29, [2] = 15 }; + int ab[6] = { 0, 0, 15, 0, 29, 0 }; + int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 }; + + int xvalue, yvalue, v1, v2, v4; + struct point { int x, y; }; + struct point p = { xvalue, yvalue }; + struct point p = { y: yvalue, x: xvalue }; + struct point p = { .y = yvalue, .x = xvalue }; + + union foo { int i; double d; }; + union foo f = { d: 4 }; + + int a[6] = { [1] = v1, v2, [4] = v4 }; + int a[6] = { 0, v1, v2, 0, v4, 0 }; + + int whitespace[256] + = { [' '] = 1, ['\t'] = 1, ['\h'] = 1, + ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 }; + fn(1,2,3); +} + diff --git a/tests-gnu/test24.c b/src/tests/tests-gnu/test24.c similarity index 100% rename from tests-gnu/test24.c rename to src/tests/tests-gnu/test24.c diff --git a/src/tests/tests-gnu/test24.out b/src/tests/tests-gnu/test24.out new file mode 100644 index 0000000..57a4cf9 --- /dev/null +++ b/src/tests/tests-gnu/test24.out @@ -0,0 +1,17 @@ + +struct foo {int a[5];} ; +struct foo f(); + +inline int bar (int index) { + int c; + enum blah; + c = __alignof(foo.a); + c = __alignof(unsigned long int); + switch (index) { + case 'a'...'z': + break; + } + return f().a[index]; + +} + diff --git a/tests-gnu/test25.c b/src/tests/tests-gnu/test25.c similarity index 100% rename from tests-gnu/test25.c rename to src/tests/tests-gnu/test25.c diff --git a/src/tests/tests-gnu/test25.out b/src/tests/tests-gnu/test25.out new file mode 100644 index 0000000..d983373 --- /dev/null +++ b/src/tests/tests-gnu/test25.out @@ -0,0 +1,77 @@ + void fatal () __attribute__ ((noreturn)); + + typedef void voidfn (); + + volatile voidfn fatal; + + int square (int) __attribute__ ((const)); + + typedef int intfn (); + + extern const intfn square; + + extern int + my_printf (void *my_object, const char *my_format, ...) + __attribute__ ((format (printf, 2, 3))); + + extern char * + my_dgettext (char *my_domain, const char *my_format) + __attribute__ ((format_arg (2))); + + extern void foobar (void) __attribute__ ((section ("bar"))); + + void __f () { /* do something */; } + void f () __attribute__ ((weak, alias ("__f"))); + + int x __attribute__ ((aligned (16), packed)) = 0; + + struct foo { int x[2] __attribute__ ((aligned (8))); }; + + short array[3] __attribute__ ((aligned)); + + struct foo1 + { + char a; + int x[2] __attribute__ ((packed)); + }; + + struct duart a __attribute__ ((section ("DUART_A"))) = { 0 }; + struct duart b __attribute__ ((section ("DUART_B"))) = { 0 }; + char stack[10000] __attribute__ ((section ("STACK"))) = { 0 }; + int init_data __attribute__ ((section ("INITDATA"))) = 0; + + struct S { short f[3]; } __attribute__ ((aligned (8))); + typedef int more_aligned_int __attribute__ ((aligned (8))); + + union wait { int a, __ip; }; + typedef int pid_t; + + typedef union + { + int *__ip; + union wait *__up; + } wait_status_ptr_t __attribute__ ((__transparent_union__)); + + pid_t wait (wait_status_ptr_t); + + int w1 () { int w; return wait (&w); } + int w2 () { union wait w; return wait (&w); } + + + pid_t wait (wait_status_ptr_t p) + { + return waitpid (-1, p.__ip, 0); + } + + main() + { + /* Initialize stack pointer */ + init_sp (stack + sizeof (stack)); + + /* Initialize initialized data */ + memcpy (&init_data, &data, &edata - &data); + + /* Turn on the serial ports */ + init_duart (&a); + init_duart (&b); + } diff --git a/tests-gnu/test26.c b/src/tests/tests-gnu/test26.c similarity index 100% rename from tests-gnu/test26.c rename to src/tests/tests-gnu/test26.c diff --git a/src/tests/tests-gnu/test26.out b/src/tests/tests-gnu/test26.out new file mode 100644 index 0000000..2b56445 --- /dev/null +++ b/src/tests/tests-gnu/test26.out @@ -0,0 +1,3 @@ + int foo asm ("myfoo") = 2; + + extern func () asm ("FUNC"); diff --git a/tests-gnu/test27.c b/src/tests/tests-gnu/test27.c similarity index 100% rename from tests-gnu/test27.c rename to src/tests/tests-gnu/test27.c diff --git a/src/tests/tests-gnu/test27.out b/src/tests/tests-gnu/test27.out new file mode 100644 index 0000000..af2c739 --- /dev/null +++ b/src/tests/tests-gnu/test27.out @@ -0,0 +1,30 @@ +fn() { + asm ("fsinx %1,%0" : "=f" (result) : "f" (angle)); + asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar)); + + asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar)); + + asm volatile ("movc3 %0,%1,%2" + : /* no outputs */ + : "g" (from), "g" (to), "g" (count) + : "r0", "r1", "r2", "r3", "r4", "r5"); + + asm ("movl %0,r9;movl %1,r10;call _foo" + : /* no outputs */ + : "g" (from), "g" (to) + : "r9", "r10"); + + asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:" + : "g" (result) + : "g" (input)); + + { double __value, __arg = (x); + asm ("fsinx %1,%0": "=f" (__value): "f" (__arg)); + __value; } + + + { int __old; + asm volatile ("get_and_set_priority %0, %1": "=g" (__old) : "g" (new)); + __old; } +} + diff --git a/tests-gnu/test28.c b/src/tests/tests-gnu/test28.c similarity index 100% rename from tests-gnu/test28.c rename to src/tests/tests-gnu/test28.c diff --git a/src/tests/tests-gnu/test28.out b/src/tests/tests-gnu/test28.out new file mode 100644 index 0000000..b1d94e3 --- /dev/null +++ b/src/tests/tests-gnu/test28.out @@ -0,0 +1,8 @@ +// C++ comment + +int f$; + + tester (int len; char data[len][len], int len) { + + } + diff --git a/tests-gnu/test29.c b/src/tests/tests-gnu/test29.c similarity index 100% rename from tests-gnu/test29.c rename to src/tests/tests-gnu/test29.c diff --git a/src/tests/tests-gnu/test29.out b/src/tests/tests-gnu/test29.out new file mode 100644 index 0000000..f1dbd62 --- /dev/null +++ b/src/tests/tests-gnu/test29.out @@ -0,0 +1,23 @@ + +typedef struct a { + int b; + } c,*d; + +extern int execv(const char *, char *const []); +int b; +int a = b = 1; +static char *predefs = "whatever \ +more "; +char *temporary_firstobj = +(char *) __extension__ +({ struct obstack *__h = ( &temporary_obstack ); + __extension__ ({ struct obstack *__o = ( __h ); + int __len = ( ( 0 ) ); + if (__o->chunk_limit - __o->next_free < __len) _obstack_newchunk (__o, __len); __o->next_free += __len; (void) 0; }) ; __extension__ ({ struct obstack *__o1 = ( __h ); void *value; value = (void *) __o1->object_base; if (__o1->next_free == value) __o1->maybe_empty_object = 1; __o1->next_free = (( ((( __o1->next_free ) - (char *) 0) +__o1->alignment_mask) & ~ (__o1->alignment_mask) ) + (char *) 0) ; if (__o1->next_free - (char *)__o1->chunk > __o1->chunk_limit - (char *)__o1->chunk) __o1->next_free = __o1->chunk_limit; __o1->object_base = __o1->next_free; value; }) ; }) ; + +static char cPickle_module_documentation[] = +"C implementation and optimization of the Python pickle module\n" +"\n" +"cPickle.c,v 1.48 1997/12/07 14:37:39 jim Exp\n" +; + diff --git a/tests-gnu/test30.c b/src/tests/tests-gnu/test30.c similarity index 100% rename from tests-gnu/test30.c rename to src/tests/tests-gnu/test30.c diff --git a/src/tests/tests-gnu/test30.out b/src/tests/tests-gnu/test30.out new file mode 100644 index 0000000..cbac4b3 --- /dev/null +++ b/src/tests/tests-gnu/test30.out @@ -0,0 +1,46 @@ +typedef struct bitmap_element_def +{ + struct bitmap_element_def *next; + struct bitmap_element_def *prev; + unsigned int indx; + unsigned int bits[2 ]; +} bitmap_element; + + +typedef struct bitmap_head_def { + bitmap_element *first; + bitmap_element *current; + int indx; +} bitmap_head, *bitmap; + +static __inline__ void +bitmap_element_free (head, elt) + bitmap head; + bitmap_element *elt; +{ + bitmap_element *next = elt->next; +} + +main() { + /* See if this is a branch that is part of the path. If so, and it is + to be taken, do so. */ + if (next_branch->branch == insn) + { + enum taken status = next_branch++->status; + if (status != NOT_TAKEN) + { + if (status == TAKEN) + record_jump_equiv (insn, 1); + else + invalidate_skipped_block (NEXT_INSN (insn)); + + /* Set the last insn as the jump insn; it doesn't affect cc0. + Then follow this branch. */ + prev_insn_cc0 = 0; + prev_insn = insn; + insn = JUMP_LABEL (insn); + continue; + } + } +} + diff --git a/tests-gnu/test31.c b/src/tests/tests-gnu/test31.c similarity index 100% rename from tests-gnu/test31.c rename to src/tests/tests-gnu/test31.c diff --git a/src/tests/tests-gnu/test31.out b/src/tests/tests-gnu/test31.out new file mode 100644 index 0000000..2811a71 --- /dev/null +++ b/src/tests/tests-gnu/test31.out @@ -0,0 +1,39 @@ +typedef struct ppptype_ { + void *d; + void *l; + int t; + int m; +} ppptype; +typedef struct jjjtype_ jjjtype ; +typedef __typeof__ (sizeof (0)) size_t; +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned long ulong; +typedef ulong cttype; +typedef char *zz_list; +typedef int boolean; +typedef unsigned char tl; +typedef void abctype; +typedef int wwd_t; +typedef enum { + F_FE, + F_U, + F_E, +} yy; +typedef void xyz; +typedef xyz (xyz_t)(void); +typedef abctype (abcproc)(void ); +typedef boolean (mnsss)(ppptype *); +typedef void (void_r)(void *, ...); +typedef boolean (boolean_e)(void *, ...); +typedef void (*tyyx_func)(void *, void *, void *); +typedef boolean (*bbhg_type)(jjjtype *); + +typedef struct cl_ { + union { + uchar y[4]; + ushort s[2]; + ulong d; + } d; +} cl; + diff --git a/tests-gnu/test33.c b/src/tests/tests-gnu/test33.c similarity index 100% rename from tests-gnu/test33.c rename to src/tests/tests-gnu/test33.c diff --git a/src/tests/tests-gnu/test33.out b/src/tests/tests-gnu/test33.out new file mode 100644 index 0000000..325bb18 --- /dev/null +++ b/src/tests/tests-gnu/test33.out @@ -0,0 +1,18 @@ + +static inline void +ttt (int *wwp) +{ + int xyz = 6; + do { + asm(".set noreorder; \ + lqq %7,5(%8); \ + nop; \ + ziv %2,%2,-4; \ +1:\ + ab %5,7(%1);\ + .set reorder" + : "=r" (xyz) + : "r" (wwp), "0" (xyz)); + } while (!xyz); +} + diff --git a/tests-gnu/test34.c b/src/tests/tests-gnu/test34.c similarity index 100% rename from tests-gnu/test34.c rename to src/tests/tests-gnu/test34.c diff --git a/src/tests/tests-gnu/test34.out b/src/tests/tests-gnu/test34.out new file mode 100644 index 0000000..9a358be --- /dev/null +++ b/src/tests/tests-gnu/test34.out @@ -0,0 +1,18 @@ +static inline void +junk2 (void) +{ +long gtexews; +asm volatile (".set noreorder"); +asm volatile ("awde0 %8,$42" : "=r" (gtexews) : ); +asm volatile ("nop"); +asm volatile ("tref %7,$12" : : "r" (gtexews & ~0x00001111 ) +); +asm volatile ("nop"); +asm volatile (".set reorder"); +asm volatile (".set mips3"); +asm volatile (".set noreorder\n" + ".set noat\n" + ".set mips3"); +asm volatile ("yha0 $7 ,$29"); +} + diff --git a/tests-gnu/test35.c b/src/tests/tests-gnu/test35.c similarity index 100% rename from tests-gnu/test35.c rename to src/tests/tests-gnu/test35.c diff --git a/src/tests/tests-gnu/test35.out b/src/tests/tests-gnu/test35.out new file mode 100644 index 0000000..8e00c8a --- /dev/null +++ b/src/tests/tests-gnu/test35.out @@ -0,0 +1,7 @@ +typedef struct d4elhhtrt_ { + int alhhtrt : 6; + int bblhhtrt : 6; + int uyttffds:3 __attribute__ ((packed)) ; + int hfgeresshb:5 __attribute__ ((packed)) ; +} d4elhhtrt; + diff --git a/tests-gnu/test36.c b/src/tests/tests-gnu/test36.c similarity index 100% rename from tests-gnu/test36.c rename to src/tests/tests-gnu/test36.c diff --git a/src/tests/tests-gnu/test36.out b/src/tests/tests-gnu/test36.out new file mode 100644 index 0000000..9269665 --- /dev/null +++ b/src/tests/tests-gnu/test36.out @@ -0,0 +1,3 @@ +typedef struct { + } ff6tfdrg; + diff --git a/tests-gnu/test37.c b/src/tests/tests-gnu/test37.c similarity index 100% rename from tests-gnu/test37.c rename to src/tests/tests-gnu/test37.c diff --git a/src/tests/tests-gnu/test37.out b/src/tests/tests-gnu/test37.out new file mode 100644 index 0000000..62a8fa6 --- /dev/null +++ b/src/tests/tests-gnu/test37.out @@ -0,0 +1,10 @@ + enum { DDD = -7 }; + + +struct abc_ { + struct abc *next; + enum { DDD = -7 }; + int a; + char b; +}; + diff --git a/tests-gnu/test39.c b/src/tests/tests-gnu/test39.c similarity index 100% rename from tests-gnu/test39.c rename to src/tests/tests-gnu/test39.c diff --git a/src/tests/tests-gnu/test39.out b/src/tests/tests-gnu/test39.out new file mode 100644 index 0000000..4b25167 --- /dev/null +++ b/src/tests/tests-gnu/test39.out @@ -0,0 +1,17 @@ +typedef struct x_ x; +struct x_{ +int y; +int z; +}; +x b; + +struct x_ a = {}; + +x c = {}; + +typedef struct xyz_ { +int a; +int b;; +char c; +} xyz; + diff --git a/tests-gnu/test40.c b/src/tests/tests-gnu/test40.c similarity index 100% rename from tests-gnu/test40.c rename to src/tests/tests-gnu/test40.c diff --git a/src/tests/tests-gnu/test40.out b/src/tests/tests-gnu/test40.out new file mode 100644 index 0000000..36f905d --- /dev/null +++ b/src/tests/tests-gnu/test40.out @@ -0,0 +1,21 @@ +typedef int tt67t __attribute__ ((mode (SI))); +typedef unsigned int hg554x __attribute__ ((mode (SI))); +typedef int u887 __attribute__ ((mode (DI))); + struct lo98k {tt67t d453s, s7655fd4;}; +typedef union +{ + struct lo98k s; + u887 s432; +} c443ds4; +u887 +test (u887 e9877, u887 q3209) +{ + c443ds4 w; + c443ds4 e45d45, o908oo98; + e45d45.s432 = e9877, + o908oo98.s432 = q3209; + w.s432 = ({c443ds4 y665re; __asm__ ("trt %1,%9\ + gtri %6" : "=d" ((hg554x)( y665re.s.s7655fd4 )), "=d" ((hg554x)( y665re.s.d453s )) : "d" ((hg554x)( e45d45.s.s7655fd4 )), "d" ((hg554x)( o908oo98.s.s7655fd4 ))) ; y665re.s432; }) ; + return w.s432; +} + diff --git a/tests-gnu/test52.c b/src/tests/tests-gnu/test52.c similarity index 100% rename from tests-gnu/test52.c rename to src/tests/tests-gnu/test52.c diff --git a/src/tests/tests-gnu/test52.out b/src/tests/tests-gnu/test52.out new file mode 100644 index 0000000..f3c6fda --- /dev/null +++ b/src/tests/tests-gnu/test52.out @@ -0,0 +1,36 @@ + +funfn(int a, int b, int c, int d, char *e) +{ + if (a) { + print(); + return b; + } + if (b) { + int localfn() { + return a; + } + exit(c); + + } + if (d) { + __builtin_return( null ); + } + return c; +} + +fn() { + print("whoa"); +} + +fn2() { + if (1) + return 2; +} + +main() { + malloc(10); + nonMalloc(20); + fn(); + funfn(1,2,3,4,"hey"); +} + diff --git a/tests-gnu/test53.c b/src/tests/tests-gnu/test53.c similarity index 100% rename from tests-gnu/test53.c rename to src/tests/tests-gnu/test53.c diff --git a/src/tests/tests-gnu/test53.out b/src/tests/tests-gnu/test53.out new file mode 100644 index 0000000..153a2f4 --- /dev/null +++ b/src/tests/tests-gnu/test53.out @@ -0,0 +1,9 @@ +void * validate_malloc(typeof(sizeof(0)) size, void *pc); +void * get_current_pc(void); +void fn_entry(int functionId); +void fn_exit(int functionId); + +main() { + exit(0); +} + diff --git a/tests-gnu/test54.c b/src/tests/tests-gnu/test54.c similarity index 100% rename from tests-gnu/test54.c rename to src/tests/tests-gnu/test54.c diff --git a/src/tests/tests-gnu/test54.out b/src/tests/tests-gnu/test54.out new file mode 100644 index 0000000..aea525c --- /dev/null +++ b/src/tests/tests-gnu/test54.out @@ -0,0 +1,18 @@ +extern void rt(long, long); +extern long rn(void); +extern void rl(char*, int, int); +int rd (void **, int) ; +rf (int *rnx) +{ + return (rnx); +} + +rnn (int rny) +{ + return (rny); +} + ; + ; +extern const int XYZ ; ; + ; + diff --git a/tests-gnu/test56.c b/src/tests/tests-gnu/test56.c similarity index 100% rename from tests-gnu/test56.c rename to src/tests/tests-gnu/test56.c diff --git a/src/tests/tests-gnu/test56.out b/src/tests/tests-gnu/test56.out new file mode 100644 index 0000000..0c1c4d8 --- /dev/null +++ b/src/tests/tests-gnu/test56.out @@ -0,0 +1,2 @@ +cat = 13; + diff --git a/tests-gnu/test58.c b/src/tests/tests-gnu/test58.c similarity index 100% rename from tests-gnu/test58.c rename to src/tests/tests-gnu/test58.c diff --git a/src/tests/tests-gnu/test58.out b/src/tests/tests-gnu/test58.out new file mode 100644 index 0000000..ea2153f --- /dev/null +++ b/src/tests/tests-gnu/test58.out @@ -0,0 +1,7 @@ +g (); +f () +{ + int seed; + g (seed); +} + diff --git a/tests-gnu/test61.c b/src/tests/tests-gnu/test61.c similarity index 100% rename from tests-gnu/test61.c rename to src/tests/tests-gnu/test61.c diff --git a/src/tests/tests-gnu/test61.out b/src/tests/tests-gnu/test61.out new file mode 100644 index 0000000..210571a --- /dev/null +++ b/src/tests/tests-gnu/test61.out @@ -0,0 +1,9 @@ +struct s +{ + int a; + int b; + short c; + int d[3]; +}; +struct s s = { .b = 3, .d = {2,0,0} }; + diff --git a/tests-gnu/test62.c b/src/tests/tests-gnu/test62.c similarity index 100% rename from tests-gnu/test62.c rename to src/tests/tests-gnu/test62.c diff --git a/src/tests/tests-gnu/test62.out b/src/tests/tests-gnu/test62.out new file mode 100644 index 0000000..2acf909 --- /dev/null +++ b/src/tests/tests-gnu/test62.out @@ -0,0 +1,8 @@ +struct s { + int c[3]; +}; + +struct s s = { + c: {1, 2, 3} +}; + diff --git a/tests-gnu/test63.c b/src/tests/tests-gnu/test63.c similarity index 100% rename from tests-gnu/test63.c rename to src/tests/tests-gnu/test63.c diff --git a/src/tests/tests-gnu/test63.out b/src/tests/tests-gnu/test63.out new file mode 100644 index 0000000..71de49c --- /dev/null +++ b/src/tests/tests-gnu/test63.out @@ -0,0 +1,7 @@ +x(a) +{ + static void*j[]={&&l1}; + goto*j[a]; +l1:; +} + diff --git a/tests-gnu/test64.c b/src/tests/tests-gnu/test64.c similarity index 100% rename from tests-gnu/test64.c rename to src/tests/tests-gnu/test64.c diff --git a/src/tests/tests-gnu/test64.out b/src/tests/tests-gnu/test64.out new file mode 100644 index 0000000..b29543c --- /dev/null +++ b/src/tests/tests-gnu/test64.out @@ -0,0 +1,6 @@ +f() +{ +__label__ l; +l:p(); +} + diff --git a/tests-gnu/test65.c b/src/tests/tests-gnu/test65.c similarity index 100% rename from tests-gnu/test65.c rename to src/tests/tests-gnu/test65.c diff --git a/src/tests/tests-gnu/test65.out b/src/tests/tests-gnu/test65.out new file mode 100644 index 0000000..0dc780c --- /dev/null +++ b/src/tests/tests-gnu/test65.out @@ -0,0 +1,7 @@ +f() +{ + __label__ mylabel; +mylabel: + goto mylabel; +} + diff --git a/tests-gnu/test67.c b/src/tests/tests-gnu/test67.c similarity index 100% rename from tests-gnu/test67.c rename to src/tests/tests-gnu/test67.c diff --git a/src/tests/tests-gnu/test67.out b/src/tests/tests-gnu/test67.out new file mode 100644 index 0000000..51f925c --- /dev/null +++ b/src/tests/tests-gnu/test67.out @@ -0,0 +1,11 @@ +f () +{ + __label__ l; + void *x() + { + return &&l; + } +l:; +} + + diff --git a/tests-gnu/test68.c b/src/tests/tests-gnu/test68.c similarity index 100% rename from tests-gnu/test68.c rename to src/tests/tests-gnu/test68.c diff --git a/src/tests/tests-gnu/test68.out b/src/tests/tests-gnu/test68.out new file mode 100644 index 0000000..6b47289 --- /dev/null +++ b/src/tests/tests-gnu/test68.out @@ -0,0 +1,6 @@ +struct s +{ + int b; +}; +struct s s = { .b = 3 }; + diff --git a/tests-gnu/test70.c b/src/tests/tests-gnu/test70.c similarity index 100% rename from tests-gnu/test70.c rename to src/tests/tests-gnu/test70.c diff --git a/src/tests/tests-gnu/test70.out b/src/tests/tests-gnu/test70.out new file mode 100644 index 0000000..3a9c615 --- /dev/null +++ b/src/tests/tests-gnu/test70.out @@ -0,0 +1,5 @@ +f() +{ + if (!('\400')); +} + diff --git a/tests-gnu/test73.c b/src/tests/tests-gnu/test73.c similarity index 100% rename from tests-gnu/test73.c rename to src/tests/tests-gnu/test73.c diff --git a/src/tests/tests-gnu/test73.out b/src/tests/tests-gnu/test73.out new file mode 100644 index 0000000..7a9ceb8 --- /dev/null +++ b/src/tests/tests-gnu/test73.out @@ -0,0 +1,10 @@ +f() +{ + __label__ lbl1; + __label__ lbl2; + +lbl1:; +lbl2:; + +} + diff --git a/tests-gnu/test74.c b/src/tests/tests-gnu/test74.c similarity index 100% rename from tests-gnu/test74.c rename to src/tests/tests-gnu/test74.c diff --git a/src/tests/tests-gnu/test74.out b/src/tests/tests-gnu/test74.out new file mode 100644 index 0000000..13aab35 --- /dev/null +++ b/src/tests/tests-gnu/test74.out @@ -0,0 +1,5 @@ +main() +{ + if (! L'\400' != 0); +} + diff --git a/tests-gnu/test75.c b/src/tests/tests-gnu/test75.c similarity index 100% rename from tests-gnu/test75.c rename to src/tests/tests-gnu/test75.c diff --git a/src/tests/tests-gnu/test75.out b/src/tests/tests-gnu/test75.out new file mode 100644 index 0000000..5c62c6c --- /dev/null +++ b/src/tests/tests-gnu/test75.out @@ -0,0 +1,267 @@ +# 1 "a4.c" +void test0(void); +# 1 "a1.h" 1 +void test1(void); +# 1 "a11.h" 1 +void test2(void); +# 856 "a11.h" +void test3(void); +# 105 "a1.h" 2 +void test4(void); +# 1 "a13.h" 1 +void test5(void); +# 1 "a14.h" 1 +void test6(void); +# 1 "a18.h" 1 +void test7(void); +# 63 "a14.h" 2 +void test8(void); +# 133 "a13.h" 2 +void test9(void); +# 1 "a16.h" 1 +void test10(void); +# 1 "a15.h" 1 +void test11(void); +# 251 "a15.h" +void test12(void); +# 465 "a15.h" +void test13(void); +# 484 "a15.h" +void test14(void); +# 755 "a15.h" +void test15(void); +# 911 "a15.h" +void test16(void); +# 1388 "a15.h" +void test17(void); +# 1408 "a15.h" +void test18(void); +# 32 "a16.h" 2 +void test19(void); +# 229 "a13.h" 2 +void test20(void); +# 121 "a1.h" 2 +void test21(void); +# 1 "a20.h" 1 +void test22(void); +# 132 "a1.h" 2 +void test23(void); +# 1 "a999.h" 1 +void test24(void); +# 311 "a1.h" 2 +void test25(void); +# 1 "a100.h" 1 +void test26(void); +# 355 "a1.h" 2 +void test27(void); +# 1 "a30.h" 1 +void test28(void); +# 356 "a1.h" 2 +void test29(void); +# 1 "a99.h" 1 +void test30(void); +# 357 "a1.h" 2 +void test31(void); +# 1 "a32.h" 1 +void test32(void); +# 1 "a31.h" 1 +void test33(void); +# 25 "a32.h" 2 +void test34(void); +# 1 "a35.h" 1 +void test35(void); +# 33 "a32.h" 2 +void test36(void); +# 366 "a1.h" 2 +void test37(void); +# 1 "version.h" 1 +void test38(void); +# 367 "a1.h" 2 +void test39(void); +# 50 "a4.c" 2 +void test40(void); +# 1 "a3.h" 1 +void test41(void); +# 1 "a12_a11.h" 1 +void test42(void); +# 1 "a40.h" 1 +void test43(void); +# 15 "a12_a11.h" 2 +void test44(void); +# 1 "a42.h" 1 +void test45(void); +# 16 "a12_a11.h" 2 +void test46(void); +# 1 "a43.h" 1 +void test47(void); +# 1 "a44.h" 1 +void test48(void); +# 341 "a43.h" 2 +void test49(void); +# 17 "a12_a11.h" 2 +void test50(void); +# 1 "a12.h" 1 +void test51(void); +# 1 "a47.h" 1 +void test52(void); +# 301 "a12.h" 2 +void test53(void); +# 18 "a12_a11.h" 2 +void test54(void); +# 1 "a60.h" 1 +void test55(void); +# 20 "a12_a11.h" 2 +void test56(void); +# 1121 "a12_a11.h" +void test57(void); +# 1205 "a12_a11.h" +void test58(void); +# 1680 "a12_a11.h" +void test59(void); +# 1804 "a12_a11.h" +void test60(void); +# 1864 "a12_a11.h" +void test61(void); +# 871 "a3.h" 2 +void test62(void); +# 900 "a3.h" +void test63(void); +# 1226 "a3.h" +void test64(void); +# 1576 "a3.h" +void test65(void); +# 1737 "a3.h" +void test66(void); +# 1802 "a3.h" +void test67(void); +# 1947 "a3.h" +void test68(void); +# 1997 "a3.h" +void test69(void); +# 2074 "a3.h" +void test70(void); +# 2333 "a3.h" +void test71(void); +# 2528 "a3.h" +void test72(void); +# 2766 "a3.h" +void test73(void); +# 3120 "a3.h" +void test74(void); +# 3221 "a3.h" +void test75(void); +# 3244 "a3.h" +void test76(void); +# 3267 "a3.h" +void test77(void); +# 3298 "a3.h" +void test78(void); +# 3310 "a3.h" +void test79(void); +# 3332 "a3.h" +void test80(void); +# 3424 "a3.h" +void test81(void); +# 3551 "a3.h" +void test82(void); +# 3573 "a3.h" +void test83(void); +# 3738 "a3.h" +void test84(void); +# 3810 "a3.h" +void test85(void); +# 4017 "a3.h" +void test86(void); +# 4117 "a3.h" +void test87(void); +# 4131 "a3.h" +void test88(void); +# 51 "a4.c" 2 +void test89(void); +# 1 "a2.h" 1 +void test90(void); +# 217 "a2.h" +void test91(void); +# 460 "a2.h" +void test92(void); +# 52 "a4.c" 2 +void test93(void); +# 1 "a80.c" 1 +void test94(void); +# 1 "a1.h" 1 +void test95(void); +# 370 "a1.h" +void test96(void); +# 37 "a80.c" 2 +void test97(void); +# 53 "a4.c" 2 +void test98(void); +# 1 "a6.h" 1 +void test99(void); +# 135 "a6.h" +void test100(void); +# 150 "a6.h" +void test101(void); +# 1 "a81.h" 1 +void test102(void); +# 154 "a6.h" 2 +void test103(void); +# 1 "a84_a10.h" 1 +void test104(void); +# 155 "a6.h" 2 +void test105(void); +# 1 "a89.h" 1 +void test106(void); +# 156 "a6.h" 2 +void test107(void); +# 1 "a88.h" 1 +void test108(void); +# 122 "a88.h" +void test109(void); +# 248 "a88.h" +void test110(void); +# 294 "a88.h" +void test111(void); +# 339 "a88.h" +void test112(void); +# 157 "a6.h" 2 +void test113(void); +# 1 "a90.h" 1 +void test114(void); +# 158 "a6.h" 2 +void test115(void); +# 1 "a90_a91.h" 1 +void test116(void); +# 159 "a6.h" 2 +void test117(void); +# 1 "a8.h" 1 +void test118(void); +# 160 "a6.h" 2 +void test119(void); +# 1 "a10.h" 1 +void test120(void); +# 161 "a6.h" 2 +void test121(void); +# 1 "a9.h" 1 +void test122(void); +# 162 "a6.h" 2 +void test123(void); +# 186 "a6.h" +void test124(void); +# 219 "a6.h" +void test125(void); +# 54 "a4.c" 2 +void test126(void); +# 1 "a5.h" 1 +void test127(void); +# 1 "a7.h" 1 +void test128(void); +# 52 "a5.h" 2 +void test129(void); +# 55 "a4.c" 2 +void test130(void); +main() +{ + if (! L'\400' != 0); +} + diff --git a/tests-gnu/test76.c b/src/tests/tests-gnu/test76.c similarity index 100% rename from tests-gnu/test76.c rename to src/tests/tests-gnu/test76.c diff --git a/src/tests/tests-gnu/test76.out b/src/tests/tests-gnu/test76.out new file mode 100644 index 0000000..0120f85 --- /dev/null +++ b/src/tests/tests-gnu/test76.out @@ -0,0 +1,525 @@ +# 1 "a4.c" +void test0(void); +void test1(void); +a=b+c; +# 1 "a1.h" 1 +void test2(void); +void test3(void); +a=b+c; +# 1 "a11.h" 1 +void test4(void); +void test5(void); +a=b+c; +# 856 "a11.h" +void test6(void); +void test7(void); +a=b+c; +# 105 "a1.h" 2 +void test8(void); +void test9(void); +a=b+c; +# 1 "a13.h" 1 +void test10(void); +void test11(void); +a=b+c; +# 1 "a14.h" 1 +void test12(void); +void test13(void); +a=b+c; +# 1 "a18.h" 1 +void test14(void); +void test15(void); +a=b+c; +# 63 "a14.h" 2 +void test16(void); +void test17(void); +a=b+c; +# 133 "a13.h" 2 +void test18(void); +void test19(void); +a=b+c; +# 1 "a16.h" 1 +void test20(void); +void test21(void); +a=b+c; +# 1 "a15.h" 1 +void test22(void); +void test23(void); +a=b+c; +# 251 "a15.h" +void test24(void); +void test25(void); +a=b+c; +# 465 "a15.h" +void test26(void); +void test27(void); +a=b+c; +# 484 "a15.h" +void test28(void); +void test29(void); +a=b+c; +# 755 "a15.h" +void test30(void); +void test31(void); +a=b+c; +# 911 "a15.h" +void test32(void); +void test33(void); +a=b+c; +# 1388 "a15.h" +void test34(void); +void test35(void); +a=b+c; +# 1408 "a15.h" +void test36(void); +void test37(void); +a=b+c; +# 32 "a16.h" 2 +void test38(void); +void test39(void); +a=b+c; +# 229 "a13.h" 2 +void test40(void); +void test41(void); +a=b+c; +# 121 "a1.h" 2 +void test42(void); +void test43(void); +a=b+c; +# 1 "a20.h" 1 +void test44(void); +void test45(void); +a=b+c; +# 132 "a1.h" 2 +void test46(void); +void test47(void); +a=b+c; +# 1 "a999.h" 1 +void test48(void); +void test49(void); +a=b+c; +# 311 "a1.h" 2 +void test50(void); +void test51(void); +a=b+c; +# 1 "a100.h" 1 +void test52(void); +void test53(void); +a=b+c; +# 355 "a1.h" 2 +void test54(void); +void test55(void); +a=b+c; +# 1 "a30.h" 1 +void test56(void); +void test57(void); +a=b+c; +# 356 "a1.h" 2 +void test58(void); +void test59(void); +a=b+c; +# 1 "a99.h" 1 +void test60(void); +void test61(void); +a=b+c; +# 357 "a1.h" 2 +void test62(void); +void test63(void); +a=b+c; +# 1 "a32.h" 1 +void test64(void); +void test65(void); +a=b+c; +# 1 "a31.h" 1 +void test66(void); +void test67(void); +a=b+c; +# 25 "a32.h" 2 +void test68(void); +void test69(void); +a=b+c; +# 1 "a35.h" 1 +void test70(void); +void test71(void); +a=b+c; +# 33 "a32.h" 2 +void test72(void); +void test73(void); +a=b+c; +# 366 "a1.h" 2 +void test74(void); +void test75(void); +a=b+c; +# 1 "version.h" 1 +void test76(void); +void test77(void); +a=b+c; +# 367 "a1.h" 2 +void test78(void); +void test79(void); +a=b+c; +# 50 "a4.c" 2 +void test80(void); +void test81(void); +a=b+c; +# 1 "a3.h" 1 +void test82(void); +void test83(void); +a=b+c; +# 1 "a12_a11.h" 1 +void test84(void); +void test85(void); +a=b+c; +# 1 "a40.h" 1 +void test86(void); +void test87(void); +a=b+c; +# 15 "a12_a11.h" 2 +void test88(void); +void test89(void); +a=b+c; +# 1 "a42.h" 1 +void test90(void); +void test91(void); +a=b+c; +# 16 "a12_a11.h" 2 +void test92(void); +void test93(void); +a=b+c; +# 1 "a43.h" 1 +void test94(void); +void test95(void); +a=b+c; +# 1 "a44.h" 1 +void test96(void); +void test97(void); +a=b+c; +# 341 "a43.h" 2 +void test98(void); +void test99(void); +a=b+c; +# 17 "a12_a11.h" 2 +void test100(void); +void test101(void); +a=b+c; +# 1 "a12.h" 1 +void test102(void); +void test103(void); +a=b+c; +# 1 "a47.h" 1 +void test104(void); +void test105(void); +a=b+c; +# 301 "a12.h" 2 +void test106(void); +void test107(void); +a=b+c; +# 18 "a12_a11.h" 2 +void test108(void); +void test109(void); +a=b+c; +# 1 "a60.h" 1 +void test110(void); +void test111(void); +a=b+c; +# 20 "a12_a11.h" 2 +void test112(void); +void test113(void); +a=b+c; +# 1121 "a12_a11.h" +void test114(void); +void test115(void); +a=b+c; +# 1205 "a12_a11.h" +void test116(void); +void test117(void); +a=b+c; +# 1680 "a12_a11.h" +void test118(void); +void test119(void); +a=b+c; +# 1804 "a12_a11.h" +void test120(void); +void test121(void); +a=b+c; +# 1864 "a12_a11.h" +void test122(void); +void test123(void); +a=b+c; +# 871 "a3.h" 2 +void test124(void); +void test125(void); +a=b+c; +# 900 "a3.h" +void test126(void); +void test127(void); +a=b+c; +# 1226 "a3.h" +void test128(void); +void test129(void); +a=b+c; +# 1576 "a3.h" +void test130(void); +void test131(void); +a=b+c; +# 1737 "a3.h" +void test132(void); +void test133(void); +a=b+c; +# 1802 "a3.h" +void test134(void); +void test135(void); +a=b+c; +# 1947 "a3.h" +void test136(void); +void test137(void); +a=b+c; +# 1997 "a3.h" +void test138(void); +void test139(void); +a=b+c; +# 2074 "a3.h" +void test140(void); +void test141(void); +a=b+c; +# 2333 "a3.h" +void test142(void); +void test143(void); +a=b+c; +# 2528 "a3.h" +void test144(void); +void test145(void); +a=b+c; +# 2766 "a3.h" +void test146(void); +void test147(void); +a=b+c; +# 3120 "a3.h" +void test148(void); +void test149(void); +a=b+c; +# 3221 "a3.h" +void test150(void); +void test151(void); +a=b+c; +# 3244 "a3.h" +void test152(void); +void test153(void); +a=b+c; +# 3267 "a3.h" +void test154(void); +void test155(void); +a=b+c; +# 3298 "a3.h" +void test156(void); +void test157(void); +a=b+c; +# 3310 "a3.h" +void test158(void); +void test159(void); +a=b+c; +# 3332 "a3.h" +void test160(void); +void test161(void); +a=b+c; +# 3424 "a3.h" +void test162(void); +void test163(void); +a=b+c; +# 3551 "a3.h" +void test164(void); +void test165(void); +a=b+c; +# 3573 "a3.h" +void test166(void); +void test167(void); +a=b+c; +# 3738 "a3.h" +void test168(void); +void test169(void); +a=b+c; +# 3810 "a3.h" +void test170(void); +void test171(void); +a=b+c; +# 4017 "a3.h" +void test172(void); +void test173(void); +a=b+c; +# 4117 "a3.h" +void test174(void); +void test175(void); +a=b+c; +# 4131 "a3.h" +void test176(void); +void test177(void); +a=b+c; +# 51 "a4.c" 2 +void test178(void); +void test179(void); +a=b+c; +# 1 "a2.h" 1 +void test180(void); +void test181(void); +a=b+c; +# 217 "a2.h" +void test182(void); +void test183(void); +a=b+c; +# 460 "a2.h" +void test184(void); +void test185(void); +a=b+c; +# 52 "a4.c" 2 +void test186(void); +void test187(void); +a=b+c; +# 1 "a80.c" 1 +void test188(void); +void test189(void); +a=b+c; +# 1 "a1.h" 1 +void test190(void); +void test191(void); +a=b+c; +# 370 "a1.h" +void test192(void); +void test193(void); +a=b+c; +# 37 "a80.c" 2 +void test194(void); +void test195(void); +a=b+c; +# 53 "a4.c" 2 +void test196(void); +void test197(void); +a=b+c; +# 1 "a6.h" 1 +void test198(void); +void test199(void); +a=b+c; +# 135 "a6.h" +void test200(void); +void test201(void); +a=b+c; +# 150 "a6.h" +void test202(void); +void test203(void); +a=b+c; +# 1 "a81.h" 1 +void test204(void); +void test205(void); +a=b+c; +# 154 "a6.h" 2 +void test206(void); +void test207(void); +a=b+c; +# 1 "a84_a10.h" 1 +void test208(void); +void test209(void); +a=b+c; +# 155 "a6.h" 2 +void test210(void); +void test211(void); +a=b+c; +# 1 "a89.h" 1 +void test212(void); +void test213(void); +a=b+c; +# 156 "a6.h" 2 +void test214(void); +void test215(void); +a=b+c; +# 1 "a88.h" 1 +void test216(void); +void test217(void); +a=b+c; +# 122 "a88.h" +void test218(void); +void test219(void); +a=b+c; +# 248 "a88.h" +void test220(void); +void test221(void); +a=b+c; +# 294 "a88.h" +void test222(void); +void test223(void); +a=b+c; +# 339 "a88.h" +void test224(void); +void test225(void); +a=b+c; +# 157 "a6.h" 2 +void test226(void); +void test227(void); +a=b+c; +# 1 "a90.h" 1 +void test228(void); +void test229(void); +a=b+c; +# 158 "a6.h" 2 +void test230(void); +void test231(void); +a=b+c; +# 1 "a90_a91.h" 1 +void test232(void); +void test233(void); +a=b+c; +# 159 "a6.h" 2 +void test234(void); +void test235(void); +a=b+c; +# 1 "a8.h" 1 +void test236(void); +void test237(void); +a=b+c; +# 160 "a6.h" 2 +void test238(void); +void test239(void); +a=b+c; +# 1 "a10.h" 1 +void test240(void); +void test241(void); +a=b+c; +# 161 "a6.h" 2 +void test242(void); +void test243(void); +a=b+c; +# 1 "a9.h" 1 +void test244(void); +void test245(void); +a=b+c; +# 162 "a6.h" 2 +void test246(void); +void test247(void); +a=b+c; +# 186 "a6.h" +void test248(void); +void test249(void); +a=b+c; +# 219 "a6.h" +void test250(void); +void test251(void); +a=b+c; +# 54 "a4.c" 2 +void test252(void); +void test253(void); +a=b+c; +# 1 "a5.h" 1 +void test254(void); +void test255(void); +a=b+c; +# 1 "a7.h" 1 +void test256(void); +void test257(void); +a=b+c; +# 52 "a5.h" 2 +void test258(void); +void test259(void); +a=b+c; +# 55 "a4.c" 2 +void test260(void); +void test261(void); +a=b+c; + diff --git a/tests-gnu/test81.c b/src/tests/tests-gnu/test81.c similarity index 100% rename from tests-gnu/test81.c rename to src/tests/tests-gnu/test81.c diff --git a/src/tests/tests-gnu/test81.out b/src/tests/tests-gnu/test81.out new file mode 100644 index 0000000..259ab88 --- /dev/null +++ b/src/tests/tests-gnu/test81.out @@ -0,0 +1,11 @@ +# 1 "930927-1.c" +# 1 "/sw/packages/cygnus/progressive-97r1/sparc-sun-solaris2.5.1/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7-97r1/include/stddef.h" 1 3 +# 61 "/sw/packages/cygnus/progressive-97r1/sparc-sun-solaris2.5.1/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7-97r1/include/stddef.h" 3 +typedef int ptrdiff_t; +typedef unsigned int size_t; +typedef long int wchar_t; +typedef unsigned int wint_t; +# 302 "/sw/packages/cygnus/progressive-97r1/sparc-sun-solaris2.5.1/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7-97r1/include/stddef.h" 3 +# 1 "930927-1.c" 2 +wchar_t s[5] = L"abcd"; + diff --git a/tests-gnu/test83.c b/src/tests/tests-gnu/test83.c similarity index 100% rename from tests-gnu/test83.c rename to src/tests/tests-gnu/test83.c diff --git a/src/tests/tests-gnu/test83.out b/src/tests/tests-gnu/test83.out new file mode 100644 index 0000000..e223ce2 --- /dev/null +++ b/src/tests/tests-gnu/test83.out @@ -0,0 +1,4 @@ +main() +{ + if (! L'\400' != 0); +} diff --git a/tests-gnu/test85.c b/src/tests/tests-gnu/test85.c similarity index 100% rename from tests-gnu/test85.c rename to src/tests/tests-gnu/test85.c diff --git a/src/tests/tests-gnu/test85.out b/src/tests/tests-gnu/test85.out new file mode 100644 index 0000000..2c707f5 --- /dev/null +++ b/src/tests/tests-gnu/test85.out @@ -0,0 +1,524 @@ +# 1 "a4.c" +void test0(void); +void test1(void); +a=b+c; +# 1 "a1.h" 1 +void test2(void); +void test3(void); +a=b+c; +# 1 "a11.h" 1 +void test4(void); +void test5(void); +a=b+c; +# 856 "a11.h" +void test6(void); +void test7(void); +a=b+c; +# 105 "a1.h" 2 +void test8(void); +void test9(void); +a=b+c; +# 1 "a13.h" 1 +void test10(void); +void test11(void); +a=b+c; +# 1 "a14.h" 1 +void test12(void); +void test13(void); +a=b+c; +# 1 "a18.h" 1 +void test14(void); +void test15(void); +a=b+c; +# 63 "a14.h" 2 +void test16(void); +void test17(void); +a=b+c; +# 133 "a13.h" 2 +void test18(void); +void test19(void); +a=b+c; +# 1 "a16.h" 1 +void test20(void); +void test21(void); +a=b+c; +# 1 "a15.h" 1 +void test22(void); +void test23(void); +a=b+c; +# 251 "a15.h" +void test24(void); +void test25(void); +a=b+c; +# 465 "a15.h" +void test26(void); +void test27(void); +a=b+c; +# 484 "a15.h" +void test28(void); +void test29(void); +a=b+c; +# 755 "a15.h" +void test30(void); +void test31(void); +a=b+c; +# 911 "a15.h" +void test32(void); +void test33(void); +a=b+c; +# 1388 "a15.h" +void test34(void); +void test35(void); +a=b+c; +# 1408 "a15.h" +void test36(void); +void test37(void); +a=b+c; +# 32 "a16.h" 2 +void test38(void); +void test39(void); +a=b+c; +# 229 "a13.h" 2 +void test40(void); +void test41(void); +a=b+c; +# 121 "a1.h" 2 +void test42(void); +void test43(void); +a=b+c; +# 1 "a20.h" 1 +void test44(void); +void test45(void); +a=b+c; +# 132 "a1.h" 2 +void test46(void); +void test47(void); +a=b+c; +# 1 "a999.h" 1 +void test48(void); +void test49(void); +a=b+c; +# 311 "a1.h" 2 +void test50(void); +void test51(void); +a=b+c; +# 1 "a100.h" 1 +void test52(void); +void test53(void); +a=b+c; +# 355 "a1.h" 2 +void test54(void); +void test55(void); +a=b+c; +# 1 "a30.h" 1 +void test56(void); +void test57(void); +a=b+c; +# 356 "a1.h" 2 +void test58(void); +void test59(void); +a=b+c; +# 1 "a99.h" 1 +void test60(void); +void test61(void); +a=b+c; +# 357 "a1.h" 2 +void test62(void); +void test63(void); +a=b+c; +# 1 "a32.h" 1 +void test64(void); +void test65(void); +a=b+c; +# 1 "a31.h" 1 +void test66(void); +void test67(void); +a=b+c; +# 25 "a32.h" 2 +void test68(void); +void test69(void); +a=b+c; +# 1 "a35.h" 1 +void test70(void); +void test71(void); +a=b+c; +# 33 "a32.h" 2 +void test72(void); +void test73(void); +a=b+c; +# 366 "a1.h" 2 +void test74(void); +void test75(void); +a=b+c; +# 1 "version.h" 1 +void test76(void); +void test77(void); +a=b+c; +# 367 "a1.h" 2 +void test78(void); +void test79(void); +a=b+c; +# 50 "a4.c" 2 +void test80(void); +void test81(void); +a=b+c; +# 1 "a3.h" 1 +void test82(void); +void test83(void); +a=b+c; +# 1 "a12_a11.h" 1 +void test84(void); +void test85(void); +a=b+c; +# 1 "a40.h" 1 +void test86(void); +void test87(void); +a=b+c; +# 15 "a12_a11.h" 2 +void test88(void); +void test89(void); +a=b+c; +# 1 "a42.h" 1 +void test90(void); +void test91(void); +a=b+c; +# 16 "a12_a11.h" 2 +void test92(void); +void test93(void); +a=b+c; +# 1 "a43.h" 1 +void test94(void); +void test95(void); +a=b+c; +# 1 "a44.h" 1 +void test96(void); +void test97(void); +a=b+c; +# 341 "a43.h" 2 +void test98(void); +void test99(void); +a=b+c; +# 17 "a12_a11.h" 2 +void test100(void); +void test101(void); +a=b+c; +# 1 "a12.h" 1 +void test102(void); +void test103(void); +a=b+c; +# 1 "a47.h" 1 +void test104(void); +void test105(void); +a=b+c; +# 301 "a12.h" 2 +void test106(void); +void test107(void); +a=b+c; +# 18 "a12_a11.h" 2 +void test108(void); +void test109(void); +a=b+c; +# 1 "a60.h" 1 +void test110(void); +void test111(void); +a=b+c; +# 20 "a12_a11.h" 2 +void test112(void); +void test113(void); +a=b+c; +# 1121 "a12_a11.h" +void test114(void); +void test115(void); +a=b+c; +# 1205 "a12_a11.h" +void test116(void); +void test117(void); +a=b+c; +# 1680 "a12_a11.h" +void test118(void); +void test119(void); +a=b+c; +# 1804 "a12_a11.h" +void test120(void); +void test121(void); +a=b+c; +# 1864 "a12_a11.h" +void test122(void); +void test123(void); +a=b+c; +# 871 "a3.h" 2 +void test124(void); +void test125(void); +a=b+c; +# 900 "a3.h" +void test126(void); +void test127(void); +a=b+c; +# 1226 "a3.h" +void test128(void); +void test129(void); +a=b+c; +# 1576 "a3.h" +void test130(void); +void test131(void); +a=b+c; +# 1737 "a3.h" +void test132(void); +void test133(void); +a=b+c; +# 1802 "a3.h" +void test134(void); +void test135(void); +a=b+c; +# 1947 "a3.h" +void test136(void); +void test137(void); +a=b+c; +# 1997 "a3.h" +void test138(void); +void test139(void); +a=b+c; +# 2074 "a3.h" +void test140(void); +void test141(void); +a=b+c; +# 2333 "a3.h" +void test142(void); +void test143(void); +a=b+c; +# 2528 "a3.h" +void test144(void); +void test145(void); +a=b+c; +# 2766 "a3.h" +void test146(void); +void test147(void); +a=b+c; +# 3120 "a3.h" +void test148(void); +void test149(void); +a=b+c; +# 3221 "a3.h" +void test150(void); +void test151(void); +a=b+c; +# 3244 "a3.h" +void test152(void); +void test153(void); +a=b+c; +# 3267 "a3.h" +void test154(void); +void test155(void); +a=b+c; +# 3298 "a3.h" +void test156(void); +void test157(void); +a=b+c; +# 3310 "a3.h" +void test158(void); +void test159(void); +a=b+c; +# 3332 "a3.h" +void test160(void); +void test161(void); +a=b+c; +# 3424 "a3.h" +void test162(void); +void test163(void); +a=b+c; +# 3551 "a3.h" +void test164(void); +void test165(void); +a=b+c; +# 3573 "a3.h" +void test166(void); +void test167(void); +a=b+c; +# 3738 "a3.h" +void test168(void); +void test169(void); +a=b+c; +# 3810 "a3.h" +void test170(void); +void test171(void); +a=b+c; +# 4017 "a3.h" +void test172(void); +void test173(void); +a=b+c; +# 4117 "a3.h" +void test174(void); +void test175(void); +a=b+c; +# 4131 "a3.h" +void test176(void); +void test177(void); +a=b+c; +# 51 "a4.c" 2 +void test178(void); +void test179(void); +a=b+c; +# 1 "a2.h" 1 +void test180(void); +void test181(void); +a=b+c; +# 217 "a2.h" +void test182(void); +void test183(void); +a=b+c; +# 460 "a2.h" +void test184(void); +void test185(void); +a=b+c; +# 52 "a4.c" 2 +void test186(void); +void test187(void); +a=b+c; +# 1 "a80.c" 1 +void test188(void); +void test189(void); +a=b+c; +# 1 "a1.h" 1 +void test190(void); +void test191(void); +a=b+c; +# 370 "a1.h" +void test192(void); +void test193(void); +a=b+c; +# 37 "a80.c" 2 +void test194(void); +void test195(void); +a=b+c; +# 53 "a4.c" 2 +void test196(void); +void test197(void); +a=b+c; +# 1 "a6.h" 1 +void test198(void); +void test199(void); +a=b+c; +# 135 "a6.h" +void test200(void); +void test201(void); +a=b+c; +# 150 "a6.h" +void test202(void); +void test203(void); +a=b+c; +# 1 "a81.h" 1 +void test204(void); +void test205(void); +a=b+c; +# 154 "a6.h" 2 +void test206(void); +void test207(void); +a=b+c; +# 1 "a84_a10.h" 1 +void test208(void); +void test209(void); +a=b+c; +# 155 "a6.h" 2 +void test210(void); +void test211(void); +a=b+c; +# 1 "a89.h" 1 +void test212(void); +void test213(void); +a=b+c; +# 156 "a6.h" 2 +void test214(void); +void test215(void); +a=b+c; +# 1 "a88.h" 1 +void test216(void); +void test217(void); +a=b+c; +# 122 "a88.h" +void test218(void); +void test219(void); +a=b+c; +# 248 "a88.h" +void test220(void); +void test221(void); +a=b+c; +# 294 "a88.h" +void test222(void); +void test223(void); +a=b+c; +# 339 "a88.h" +void test224(void); +void test225(void); +a=b+c; +# 157 "a6.h" 2 +void test226(void); +void test227(void); +a=b+c; +# 1 "a90.h" 1 +void test228(void); +void test229(void); +a=b+c; +# 158 "a6.h" 2 +void test230(void); +void test231(void); +a=b+c; +# 1 "a90_a91.h" 1 +void test232(void); +void test233(void); +a=b+c; +# 159 "a6.h" 2 +void test234(void); +void test235(void); +a=b+c; +# 1 "a8.h" 1 +void test236(void); +void test237(void); +a=b+c; +# 160 "a6.h" 2 +void test238(void); +void test239(void); +a=b+c; +# 1 "a10.h" 1 +void test240(void); +void test241(void); +a=b+c; +# 161 "a6.h" 2 +void test242(void); +void test243(void); +a=b+c; +# 1 "a9.h" 1 +void test244(void); +void test245(void); +a=b+c; +# 162 "a6.h" 2 +void test246(void); +void test247(void); +a=b+c; +# 186 "a6.h" +void test248(void); +void test249(void); +a=b+c; +# 219 "a6.h" +void test250(void); +void test251(void); +a=b+c; +# 54 "a4.c" 2 +void test252(void); +void test253(void); +a=b+c; +# 1 "a5.h" 1 +void test254(void); +void test255(void); +a=b+c; +# 1 "a7.h" 1 +void test256(void); +void test257(void); +a=b+c; +# 52 "a5.h" 2 +void test258(void); +void test259(void); +a=b+c; +# 55 "a4.c" 2 +void test260(void); +void test261(void); +a=b+c; diff --git a/tests-gnu/test87.c b/src/tests/tests-gnu/test87.c similarity index 100% rename from tests-gnu/test87.c rename to src/tests/tests-gnu/test87.c diff --git a/src/tests/tests-gnu/test87.out b/src/tests/tests-gnu/test87.out new file mode 100644 index 0000000..53e00e6 --- /dev/null +++ b/src/tests/tests-gnu/test87.out @@ -0,0 +1,16 @@ +enum {e0, e1}; + +int x[] = +{ + [e0] = 0 +}; + +f () +{ + switch (1) + { + case e0: + case e1: + break; + } +} diff --git a/tests-parsimony/parsimony-lang/001.c b/src/tests/tests-parsimony/001.c similarity index 100% rename from tests-parsimony/parsimony-lang/001.c rename to src/tests/tests-parsimony/001.c diff --git a/tests-parsimony/parsimony-lang/001.out b/src/tests/tests-parsimony/001.out similarity index 100% rename from tests-parsimony/parsimony-lang/001.out rename to src/tests/tests-parsimony/001.out diff --git a/src/tests/tests-parsimony/002.c b/src/tests/tests-parsimony/002.c new file mode 100644 index 0000000..27df8ad --- /dev/null +++ b/src/tests/tests-parsimony/002.c @@ -0,0 +1,17 @@ +@{ + saved = `expression (1,2,"string",21<<1); + first = `constant 2; + nil; +} + +@{ + second = `constant 10; + nil; +} + +char t = @(`constant @second); +int i = @first; +int q = @(`constant 10); +int k = @(`expression (1,2,"stringy thingy",21<<1)); +int i = @saved; +int w = @second; \ No newline at end of file diff --git a/tests-parsimony/parsimony-lang/002.out b/src/tests/tests-parsimony/002.out similarity index 100% rename from tests-parsimony/parsimony-lang/002.out rename to src/tests/tests-parsimony/002.out diff --git a/tests-parsimony/parsimony-lang/003.c b/src/tests/tests-parsimony/003.c similarity index 87% rename from tests-parsimony/parsimony-lang/003.c rename to src/tests/tests-parsimony/003.c index 6383fea..f19a877 100644 --- a/tests-parsimony/parsimony-lang/003.c +++ b/src/tests/tests-parsimony/003.c @@ -2,7 +2,7 @@ @{ nTimes = `constant 10; - forLoop = (`statement for (int i = 0; i < 10; ++i) printf("%d\n", i);); + forLoop = `statement for (int i = 0; i < 10; ++i) printf("%d\n", i);; whileLoop = `statement while (i < 10) { printf("%d\n", i); ++il; }; useForLoop = 1; nil; diff --git a/tests-parsimony/parsimony-lang/003.out b/src/tests/tests-parsimony/003.out similarity index 100% rename from tests-parsimony/parsimony-lang/003.out rename to src/tests/tests-parsimony/003.out diff --git a/src/tests/tests-parsimony/004.c b/src/tests/tests-parsimony/004.c new file mode 100644 index 0000000..efc66e2 --- /dev/null +++ b/src/tests/tests-parsimony/004.c @@ -0,0 +1,18 @@ +@{ + num = `constant 21; + test = `expression 2 * 10; + nil; +} + +int x = @{`expression 2 * @num;}; + +int main() { + int i = @(`expression 2 * @num); + int y = @test; + int a = @{ + num = `constant 21; + test = 2; + `expression 2 * @num; + }; + return 0; +} \ No newline at end of file diff --git a/tests-parsimony/parsimony-lang/004.out b/src/tests/tests-parsimony/004.out similarity index 100% rename from tests-parsimony/parsimony-lang/004.out rename to src/tests/tests-parsimony/004.out diff --git a/tests-parsimony/parsimony-lang/005.c b/src/tests/tests-parsimony/005.c similarity index 100% rename from tests-parsimony/parsimony-lang/005.c rename to src/tests/tests-parsimony/005.c diff --git a/tests-parsimony/parsimony-lang/005.out b/src/tests/tests-parsimony/005.out similarity index 100% rename from tests-parsimony/parsimony-lang/005.out rename to src/tests/tests-parsimony/005.out diff --git a/tests-parsimony/parsimony-lang/006.c b/src/tests/tests-parsimony/006.c similarity index 96% rename from tests-parsimony/parsimony-lang/006.c rename to src/tests/tests-parsimony/006.c index 70fa4c4..f4c195d 100644 --- a/tests-parsimony/parsimony-lang/006.c +++ b/src/tests/tests-parsimony/006.c @@ -10,7 +10,7 @@ @a; @{ - t = `integer 2; + t = `constant 2; nil; } @(`declaration int abc = @t;); diff --git a/tests-parsimony/parsimony-lang/006.out b/src/tests/tests-parsimony/006.out similarity index 100% rename from tests-parsimony/parsimony-lang/006.out rename to src/tests/tests-parsimony/006.out diff --git a/tests-parsimony/parsimony-lang/007.c b/src/tests/tests-parsimony/007.c similarity index 100% rename from tests-parsimony/parsimony-lang/007.c rename to src/tests/tests-parsimony/007.c diff --git a/tests-parsimony/parsimony-lang/007.out b/src/tests/tests-parsimony/007.out similarity index 100% rename from tests-parsimony/parsimony-lang/007.out rename to src/tests/tests-parsimony/007.out diff --git a/tests-parsimony/parsimony-lang/008.c b/src/tests/tests-parsimony/008.c similarity index 100% rename from tests-parsimony/parsimony-lang/008.c rename to src/tests/tests-parsimony/008.c diff --git a/tests-parsimony/parsimony-lang/008.out b/src/tests/tests-parsimony/008.out similarity index 100% rename from tests-parsimony/parsimony-lang/008.out rename to src/tests/tests-parsimony/008.out diff --git a/tests-parsimony/parsimony-lang/009.c b/src/tests/tests-parsimony/009.c similarity index 100% rename from tests-parsimony/parsimony-lang/009.c rename to src/tests/tests-parsimony/009.c diff --git a/tests-parsimony/parsimony-lang/009.out b/src/tests/tests-parsimony/009.out similarity index 100% rename from tests-parsimony/parsimony-lang/009.out rename to src/tests/tests-parsimony/009.out diff --git a/src/tests/tests-parsimony/010.c b/src/tests/tests-parsimony/010.c new file mode 100644 index 0000000..aba28cf --- /dev/null +++ b/src/tests/tests-parsimony/010.c @@ -0,0 +1,15 @@ +@{ + f(x, y, z) { + print("x = ", x, ", y = ", y, ", z = ", z, "\n"); + nil; + } + + f(1, 2, 3); + f(x:1, y:2, z:3); + f(x:1, y:3); + f(x:1, z:3); + f(z:1,x:3); + f(y:1,x:3); + f(y:1,z:3); + f(z:1,y:3); +} \ No newline at end of file diff --git a/src/tests/tests-parsimony/010.out b/src/tests/tests-parsimony/010.out new file mode 100644 index 0000000..2c1ccd8 --- /dev/null +++ b/src/tests/tests-parsimony/010.out @@ -0,0 +1,8 @@ +x = 1, y = 2, z = 3 +x = 1, y = 2, z = 3 +x = 1, y = 3, z = null +x = 1, y = null, z = 3 +x = 3, y = null, z = 1 +x = 3, y = 1, z = null +x = null, y = 1, z = 3 +x = null, y = 3, z = 1 diff --git a/tests-parsimony/parsimony-lang/map.c b/src/tests/tests-parsimony/map.c similarity index 85% rename from tests-parsimony/parsimony-lang/map.c rename to src/tests/tests-parsimony/map.c index 85de001..8cb023e 100644 --- a/tests-parsimony/parsimony-lang/map.c +++ b/src/tests/tests-parsimony/map.c @@ -7,8 +7,6 @@ enum oof { A, B, C }; isEnum(x) { x.__proto__ == C_enum } notToken(x) { x.__proto__ != Token } to_C_string(x) {{ __proto__: C_string, value: "\"" + string(x.name.identifier) + "\"" }} - // to_C_string(program.enums.foo.enumList[?].name.identifier); - a = map(to_C_string, select(isEnum, program.enums.foo.enumList)); b = map(to_C_string, program.enums.foo.enumList, notToken); c = map(to_C_string, program.enums.foo.enumList, isEnum); diff --git a/tests-parsimony/parsimony-lang/map.out b/src/tests/tests-parsimony/map.out similarity index 100% rename from tests-parsimony/parsimony-lang/map.out rename to src/tests/tests-parsimony/map.out diff --git a/tests-parsimony/parsimony-lang/projectExample.c b/src/tests/tests-parsimony/projectExample.c similarity index 100% rename from tests-parsimony/parsimony-lang/projectExample.c rename to src/tests/tests-parsimony/projectExample.c diff --git a/tests-parsimony/parsimony-lang/projectExample.out b/src/tests/tests-parsimony/projectExample.out similarity index 100% rename from tests-parsimony/parsimony-lang/projectExample.out rename to src/tests/tests-parsimony/projectExample.out diff --git a/tests-parsimony/realObject.c b/src/tests/tests-parsimony/realObjectED.c similarity index 90% rename from tests-parsimony/realObject.c rename to src/tests/tests-parsimony/realObjectED.c index a8bffc3..28849f0 100644 --- a/tests-parsimony/realObject.c +++ b/src/tests/tests-parsimony/realObjectED.c @@ -1,4 +1,4 @@ -@import("parsimonyLibrary/dynamicObject.mc") +@import("parsimonyLibrary/dynamicObjectExtDecl.mc") #include @@ -27,9 +27,8 @@ int main() oop p = newPoint(3, 4); @send("p", "magnitude"); - + @send("p", "getX"); return 0; } - diff --git a/src/tests/tests-parsimony/realObjectED.out b/src/tests/tests-parsimony/realObjectED.out new file mode 100644 index 0000000..6b22552 --- /dev/null +++ b/src/tests/tests-parsimony/realObjectED.out @@ -0,0 +1,145 @@ +#include +#include +#include + +struct Symbol { + char *name; + int class, selector; +}; + +struct Symbol *newSymbol(char *name) +{ + struct Symbol *symbol = malloc(sizeof(*symbol)); + symbol->name = strdup(name); + symbol->class = 0; + symbol->selector = 0; + return symbol; +} + +struct Symbol **symbols = 0; +int nSymbols = 0; + +struct Symbol *intern(char *name) +{ + int lo = 0; + int hi = nSymbols - 1; + while (lo <= hi ) { + int mid = (lo+hi)/2; + int cmp = strcmp(name, symbols[mid]->name); + if (cmp > 0) lo = mid + 1; + else if (cmp < 0) hi = mid - 1; + else return symbols[mid]; + } + symbols = realloc(symbols, sizeof(*symbols) * ++nSymbols); + memmove(symbols + lo + 1, symbols + lo, sizeof(*symbols)*(nSymbols - lo - 1)); + return symbols[lo] = newSymbol(name); +} + +typedef void *(*method_t)(); + +void *method_dnu() +{ + printf("method not found\n"); + exit(1); + return 0; +} + +method_t **methods = 0; +int nClasses = 0; +int nSelectors = 0; + +int ensureClass(struct Symbol *symbol) +{ + if (symbol->class == 0) { + if (nClasses == 0) nClasses++; + symbol->class = nClasses++; + methods = realloc(methods, sizeof(*methods)*nClasses); + methods[symbol->class] = malloc(sizeof(*methods)*nSelectors); + for (int i = 0; iclass][i] = method_dnu; + } + return symbol->class; +} + +int ensureSelector(struct Symbol *symbol) +{ + if (symbol->selector == 0) { + if (nSelectors == 0) nSelectors++; + symbol->selector = nSelectors++; + for (int i = 0; iselector; +} + +int findClass(char *class) +{ + return ensureClass(intern(class)); +} + +int findSelector(char *selector) +{ + return ensureSelector(intern(selector)); +} + +void addMethod(int class, int selector, method_t method) +{ + methods[class][selector] = method; +} + +#define lookup(C, S) (methods[C][S]) + +struct Object { + int class; +}; + +#define send(R, M, ...) ({ struct Object *__ = (struct Object *)(R); lookup(__->class, _selector_##M)(__, ##__VA_ARGS__); }) + +struct __oop { int class; }; + +typedef struct __oop *oop; + +#include + +struct Point { int class; double x, y; }; + +oop newPoint(double x, double y) +{ + struct Point *self = calloc(1, sizeof *self); + self->x = x; + self->y = y; +self->class = findClass("Point"); + return (struct __oop *) self; +} + +double Point_magnitude(struct __oop *__self) +{ + struct Point *self = (struct Point *) __self; + printf("point method : %f\n", sqrt(self->x * self->x * self->y * self->y)); + return sqrt(self->x * self->x * self->y * self->y); +} + +double Point_getX(struct __oop *__self) +{ + struct Point *self = (struct Point *) __self; + printf("point method : %f\n", self->x); + return self->x; +} + +int main() +{ + int _selector_magnitude= findSelector("magnitude"); + int _selector_getX= findSelector("getX"); + int _class_Point= findClass("Point"); + addMethod(_class_Point, _selector_magnitude, (method_t) Point_magnitude); + addMethod(_class_Point, _selector_getX, (method_t) Point_getX); + oop p = newPoint(3, 4); + + send(p, magnitude); + + send(p, getX); + + return 0; +} diff --git a/tests-std/test.c b/src/tests/tests-std/test.c similarity index 100% rename from tests-std/test.c rename to src/tests/tests-std/test.c diff --git a/src/tests/tests-std/test.out b/src/tests/tests-std/test.out new file mode 100644 index 0000000..9b46df8 --- /dev/null +++ b/src/tests/tests-std/test.out @@ -0,0 +1,31 @@ +static int g1 = 0; +typedef long mylong; +static mylong z; + +typedef int Length; +Length len, maxlen; +Length *lengths[]; + +typedef char *String; +String p, lineptr[100], alloc(int); +int strcmp(String, String); +/* +typedef struct tnode *Treeptr; + +typedef struct tnode { + char *word; + int count; + Treeptr left; + Treeptr right; +} Treenode; + +Treeptr talloc(void) { + return (Treeptr) malloc(sizeof(Treenode)); +} + +int fun(int a, mylong b) { + mylong c; + return a+b; +} +*/ + diff --git a/tests-std/test10.c b/src/tests/tests-std/test10.c similarity index 100% rename from tests-std/test10.c rename to src/tests/tests-std/test10.c diff --git a/src/tests/tests-std/test10.out b/src/tests/tests-std/test10.out new file mode 100644 index 0000000..8ebe466 --- /dev/null +++ b/src/tests/tests-std/test10.out @@ -0,0 +1,7 @@ +int * f(char); +char * b; +main() { + f(*b)[4]; /* indirect on "b", call "f", and index the result + /* by "4" */ + } + diff --git a/tests-std/test11.c b/src/tests/tests-std/test11.c similarity index 100% rename from tests-std/test11.c rename to src/tests/tests-std/test11.c diff --git a/src/tests/tests-std/test11.out b/src/tests/tests-std/test11.out new file mode 100644 index 0000000..204be95 --- /dev/null +++ b/src/tests/tests-std/test11.out @@ -0,0 +1,6 @@ +typedef int f; +char * b; +main() { + f(*b)[4]; /* redeclare "b" to be a pointer to 4 ints */ + } + diff --git a/tests-std/test19.c b/src/tests/tests-std/test19.c similarity index 100% rename from tests-std/test19.c rename to src/tests/tests-std/test19.c diff --git a/src/tests/tests-std/test19.out b/src/tests/tests-std/test19.out new file mode 100644 index 0000000..2b42f19 --- /dev/null +++ b/src/tests/tests-std/test19.out @@ -0,0 +1,8 @@ + struct foo {int a[4];}; + + struct foo f(); + + bar (int index) + { + return f().a[index]; + } diff --git a/tests-std/test2.c b/src/tests/tests-std/test2.c similarity index 100% rename from tests-std/test2.c rename to src/tests/tests-std/test2.c diff --git a/src/tests/tests-std/test2.out b/src/tests/tests-std/test2.out new file mode 100644 index 0000000..fb01241 --- /dev/null +++ b/src/tests/tests-std/test2.out @@ -0,0 +1,40 @@ +int test2; +#line 37 "uhhuh.c" +#line 10 "input.c" +int i; +int *i; + +/* + this is a comment + #line 50 + with a line directive in it, + very annoying + */ + +typedef long mylong; + +enum myenum { one, two, three }; + +# 32 "gnustyle.h" 1 3 4 +// old style +//short foo(a, c) +// short a; +// char c; +//{ return 3; +//} + +#line 100 +int f(char c, char *d) +{ + + struct s; + int z = 100; + struct s { + short c, d; + long l; + mylong m; + }; + + +} + diff --git a/tests-std/test20.c b/src/tests/tests-std/test20.c similarity index 100% rename from tests-std/test20.c rename to src/tests/tests-std/test20.c diff --git a/src/tests/tests-std/test20.out b/src/tests/tests-std/test20.out new file mode 100644 index 0000000..f7aee66 --- /dev/null +++ b/src/tests/tests-std/test20.out @@ -0,0 +1,6 @@ + foo (float f, float g) + { + float beat_freqs[2] = { f-g, f+g }; + return 1; + } + diff --git a/tests-std/test23.c b/src/tests/tests-std/test23.c similarity index 100% rename from tests-std/test23.c rename to src/tests/tests-std/test23.c diff --git a/src/tests/tests-std/test23.out b/src/tests/tests-std/test23.out new file mode 100644 index 0000000..7b773f3 --- /dev/null +++ b/src/tests/tests-std/test23.out @@ -0,0 +1,12 @@ +now() { + union foo { int i; double d; }; + int x; + double y; + void hack (union foo); + union foo u; +// u = (union foo) x == (u.i = x); +// u = (union foo) y == (u.d = y); + hack ((union foo) x); + +} + diff --git a/tests-std/test3.c b/src/tests/tests-std/test3.c similarity index 100% rename from tests-std/test3.c rename to src/tests/tests-std/test3.c diff --git a/src/tests/tests-std/test3.out b/src/tests/tests-std/test3.out new file mode 100644 index 0000000..a3f3f13 --- /dev/null +++ b/src/tests/tests-std/test3.out @@ -0,0 +1,4 @@ +typedef double floatp; + +int gs_set(float (*)(floatp, floatp ) ); + diff --git a/tests-std/test32.c b/src/tests/tests-std/test32.c similarity index 100% rename from tests-std/test32.c rename to src/tests/tests-std/test32.c diff --git a/src/tests/tests-std/test32.out b/src/tests/tests-std/test32.out new file mode 100644 index 0000000..7d661cc --- /dev/null +++ b/src/tests/tests-std/test32.out @@ -0,0 +1,9 @@ +typedef enum { + F_FE, + F_U, + F_E, +} yy; +main() { + exit(0); +} + diff --git a/tests-std/test38.c b/src/tests/tests-std/test38.c similarity index 100% rename from tests-std/test38.c rename to src/tests/tests-std/test38.c diff --git a/src/tests/tests-std/test38.out b/src/tests/tests-std/test38.out new file mode 100644 index 0000000..b04a258 --- /dev/null +++ b/src/tests/tests-std/test38.out @@ -0,0 +1,10 @@ +typedef unsigned char uchar; +typedef struct _hgfretty { + uchar bvfetgl; + uchar aytrffr[80 ]; +} hgfretty; + +typedef struct pojeqsd { + char hgfretty[99 ]; +} pojeqsd_t; + diff --git a/tests-std/test4.c b/src/tests/tests-std/test4.c similarity index 100% rename from tests-std/test4.c rename to src/tests/tests-std/test4.c diff --git a/src/tests/tests-std/test4.out b/src/tests/tests-std/test4.out new file mode 100644 index 0000000..8360a5b --- /dev/null +++ b/src/tests/tests-std/test4.out @@ -0,0 +1,5 @@ +int a,b; +int f() { + a = 1, b = 2; +} + diff --git a/tests-std/test42.c b/src/tests/tests-std/test42.c similarity index 100% rename from tests-std/test42.c rename to src/tests/tests-std/test42.c diff --git a/src/tests/tests-std/test42.out b/src/tests/tests-std/test42.out new file mode 100644 index 0000000..73ed676 --- /dev/null +++ b/src/tests/tests-std/test42.out @@ -0,0 +1,21 @@ +typedef struct checkme_ checkme ; + +typedef struct yt668u_ { + int j76g; + int lk4f2s; + int hg62; +} yt668u; + +void +a233 (yt668u *checkme) +{ + if ((( checkme )->j76g) ) { + } + { + { ( ( checkme )->lk4f2s ) = 0; } ; + ( checkme )->hg62 = 0; + } + ; +} + + diff --git a/tests-std/test44.c b/src/tests/tests-std/test44.c similarity index 100% rename from tests-std/test44.c rename to src/tests/tests-std/test44.c diff --git a/src/tests/tests-std/test44.out b/src/tests/tests-std/test44.out new file mode 100644 index 0000000..a787f1e --- /dev/null +++ b/src/tests/tests-std/test44.out @@ -0,0 +1,11 @@ +#pragma whoa nellie +int a; +# +#ident something +#pragma something else + +main() { + exit(0); +#ident heynow +} + diff --git a/tests-std/test46.c b/src/tests/tests-std/test46.c similarity index 100% rename from tests-std/test46.c rename to src/tests/tests-std/test46.c diff --git a/src/tests/tests-std/test46.out b/src/tests/tests-std/test46.out new file mode 100644 index 0000000..65ede80 --- /dev/null +++ b/src/tests/tests-std/test46.out @@ -0,0 +1,6 @@ +const typedef struct as340kj_ { + short t45e; + char *u76h; +} as340kj; +extern char *hh(char, as340kj*); + diff --git a/tests-std/test47.c b/src/tests/tests-std/test47.c similarity index 100% rename from tests-std/test47.c rename to src/tests/tests-std/test47.c diff --git a/src/tests/tests-std/test47.out b/src/tests/tests-std/test47.out new file mode 100644 index 0000000..d95e8f9 --- /dev/null +++ b/src/tests/tests-std/test47.out @@ -0,0 +1,15 @@ +typedef struct g667h_ g667h ; +struct g667h_ { + const char *ttc; + const char *e; + const char *t; +}; + + +int dddd() +{ + +int g667h, ttt; + +} + diff --git a/tests-std/test48.c b/src/tests/tests-std/test48.c similarity index 100% rename from tests-std/test48.c rename to src/tests/tests-std/test48.c diff --git a/src/tests/tests-std/test48.out b/src/tests/tests-std/test48.out new file mode 100644 index 0000000..3391520 --- /dev/null +++ b/src/tests/tests-std/test48.out @@ -0,0 +1,18 @@ +typedef struct g667h_ g667h ; +struct g667h_ { + const char *ttc; + const char *e; + const char *t; +}; + + +int dddd(char *yt5, + g667h *g667h); +int dddd(char *yt5, + g667h *g667h) +{ + +int ttt; + +} + diff --git a/tests-std/test49.c b/src/tests/tests-std/test49.c similarity index 100% rename from tests-std/test49.c rename to src/tests/tests-std/test49.c diff --git a/src/tests/tests-std/test49.out b/src/tests/tests-std/test49.out new file mode 100644 index 0000000..8b7e11e --- /dev/null +++ b/src/tests/tests-std/test49.out @@ -0,0 +1,15 @@ +typedef struct gh554j_ { + long x2; + char *x3; +} gh554j; + void +ad (int *x3, int *x4) +{ + gh554j x1; + if (x3 && x4) { + char gh554j[19]; + gh554j[0]='\n'; + } + +} + diff --git a/tests-std/test50.c b/src/tests/tests-std/test50.c similarity index 100% rename from tests-std/test50.c rename to src/tests/tests-std/test50.c diff --git a/src/tests/tests-std/test50.out b/src/tests/tests-std/test50.out new file mode 100644 index 0000000..4fcb8e7 --- /dev/null +++ b/src/tests/tests-std/test50.out @@ -0,0 +1,15 @@ +struct aaa_ { +int a; +int b; +} ; +typedef struct aaa_ aaa; +void foo (void *aaa); +void foo (void *paa) +{ + aaa *aab = (void *)paa; + long *rtr; + char temptt; + short *zzs; + +} + diff --git a/tests-std/test51.c b/src/tests/tests-std/test51.c similarity index 100% rename from tests-std/test51.c rename to src/tests/tests-std/test51.c diff --git a/src/tests/tests-std/test51.out b/src/tests/tests-std/test51.out new file mode 100644 index 0000000..9d8bb46 --- /dev/null +++ b/src/tests/tests-std/test51.out @@ -0,0 +1,9 @@ +main() { + if (nerror) cleanup(); + else if (argc < 1) faterror("no input file%s", cmdusage); + else for (; 0 < argc; cleanup(), ++argv, --argc) { + targetdelta = 0; + ffree(); + } +} + diff --git a/tests-std/test55.c b/src/tests/tests-std/test55.c similarity index 100% rename from tests-std/test55.c rename to src/tests/tests-std/test55.c diff --git a/src/tests/tests-std/test55.out b/src/tests/tests-std/test55.out new file mode 100644 index 0000000..6696ead --- /dev/null +++ b/src/tests/tests-std/test55.out @@ -0,0 +1,4 @@ +/* program with only a + comment in it + */ + diff --git a/tests-std/test59.c b/src/tests/tests-std/test59.c similarity index 100% rename from tests-std/test59.c rename to src/tests/tests-std/test59.c diff --git a/src/tests/tests-std/test59.out b/src/tests/tests-std/test59.out new file mode 100644 index 0000000..efe32d2 --- /dev/null +++ b/src/tests/tests-std/test59.out @@ -0,0 +1,9 @@ +typedef long time_t; + +static time_t +f (janfirst, rulep) + __const time_t janfirst; + register __const int * __const rulep; +{ +} + diff --git a/tests-std/test6.c b/src/tests/tests-std/test6.c similarity index 100% rename from tests-std/test6.c rename to src/tests/tests-std/test6.c diff --git a/src/tests/tests-std/test6.out b/src/tests/tests-std/test6.out new file mode 100644 index 0000000..c44d582 --- /dev/null +++ b/src/tests/tests-std/test6.out @@ -0,0 +1,7 @@ +typedef char F; +main() { + long a=sizeof(F), F, b=sizeof(F); + //assert(1 == a); + //assert(sizeof(long) == b); + } + diff --git a/tests-std/test60.c b/src/tests/tests-std/test60.c similarity index 100% rename from tests-std/test60.c rename to src/tests/tests-std/test60.c diff --git a/src/tests/tests-std/test60.out b/src/tests/tests-std/test60.out new file mode 100644 index 0000000..039a88d --- /dev/null +++ b/src/tests/tests-std/test60.out @@ -0,0 +1,3 @@ +//long int s[5] = L"abcd"; +char *s = L"abcd"; + diff --git a/tests-std/test69.c b/src/tests/tests-std/test69.c similarity index 100% rename from tests-std/test69.c rename to src/tests/tests-std/test69.c diff --git a/src/tests/tests-std/test69.out b/src/tests/tests-std/test69.out new file mode 100644 index 0000000..403192b --- /dev/null +++ b/src/tests/tests-std/test69.out @@ -0,0 +1,3 @@ +char *b = "a string with a \ +continuation"; + diff --git a/tests-std/test7.c b/src/tests/tests-std/test7.c similarity index 100% rename from tests-std/test7.c rename to src/tests/tests-std/test7.c diff --git a/src/tests/tests-std/test7.out b/src/tests/tests-std/test7.out new file mode 100644 index 0000000..beb7d6b --- /dev/null +++ b/src/tests/tests-std/test7.out @@ -0,0 +1,2 @@ +typedef int A, B(A); + diff --git a/tests-std/test72.c b/src/tests/tests-std/test72.c similarity index 100% rename from tests-std/test72.c rename to src/tests/tests-std/test72.c diff --git a/src/tests/tests-std/test72.out b/src/tests/tests-std/test72.out new file mode 100644 index 0000000..269f7ac --- /dev/null +++ b/src/tests/tests-std/test72.out @@ -0,0 +1,15 @@ +# 1 "test72.c" +# 1 "/sw/packages/cygnus/progressive-97r1/sparc-sun-solaris2.5.1/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7-97r1/include/stdio.h" 1 3 +# 1 "test72.c" 2 +char f; +m() +{ +( +!( +f + +3 &3) +-1) +; +} + + diff --git a/tests-std/test77.c b/src/tests/tests-std/test77.c similarity index 100% rename from tests-std/test77.c rename to src/tests/tests-std/test77.c diff --git a/tests-std/test79.c b/src/tests/tests-std/test77.out similarity index 100% rename from tests-std/test79.c rename to src/tests/tests-std/test77.out diff --git a/tests-std/test78.c b/src/tests/tests-std/test78.c similarity index 100% rename from tests-std/test78.c rename to src/tests/tests-std/test78.c diff --git a/src/tests/tests-std/test78.out b/src/tests/tests-std/test78.out new file mode 100644 index 0000000..a9921e6 --- /dev/null +++ b/src/tests/tests-std/test78.out @@ -0,0 +1,53 @@ +# 1 "test78.c" + +# 1 "a.h" 1 + +int aa1; +int aa2; +void testaa(void); +# 2 "test78.c" 2 + +# 1 "b.h" 1 + +int bb1; +int bb2; +# 1 "b1.h" 1 + +int b12; +int b22; +# 1 "b12.h" 1 + +int b33; +# 1 "b13.h" 1 + +int b44; + +# 1 "b14.h" 1 +int r45; +void ttt(void); +int r56; +# 4 "b13.h" 2 + + +int b55; +# 3 "b12.h" 2 + +void test66(void); +# 4 "b1.h" 2 + +void testb12(void); +# 4 "b.h" 2 + +int bb3; + + + +# 3 "test78.c" 2 + +# 1 "c.h" 1 + +int c11; +int c12; +void testc1(void); +# 4 "test78.c" 2 + diff --git a/tests-std/test86.c b/src/tests/tests-std/test79.c similarity index 100% rename from tests-std/test86.c rename to src/tests/tests-std/test79.c diff --git a/src/tests/tests-std/test79.out b/src/tests/tests-std/test79.out new file mode 100644 index 0000000..1b6d0de --- /dev/null +++ b/src/tests/tests-std/test79.out @@ -0,0 +1,53 @@ +# 1 "a.c" + +# 1 "a.h" 1 + +int aa1; +int aa2; +void testaa(void); +# 2 "a.c" 2 + +# 1 "b.h" 1 + +int bb1; +int bb2; +# 1 "b1.h" 1 + +int b12; +int b22; +# 1 "b12.h" 1 + +int b33; +# 1 "b13.h" 1 + +int b44; + +# 1 "b14.h" 1 +int r45; +void ttt(void); +int r56; +# 4 "b13.h" 2 + + +int b55; +# 3 "b12.h" 2 + +void test66(void); +# 4 "b1.h" 2 + +void testb12(void); +# 4 "b.h" 2 + +int bb3; + + + +# 3 "a.c" 2 + +# 1 "c.h" 1 + +int c11; +int c12; +void testc1(void); +# 4 "a.c" 2 + diff --git a/tests-std/test8.c b/src/tests/tests-std/test8.c similarity index 100% rename from tests-std/test8.c rename to src/tests/tests-std/test8.c diff --git a/src/tests/tests-std/test8.out b/src/tests/tests-std/test8.out new file mode 100644 index 0000000..584c5a9 --- /dev/null +++ b/src/tests/tests-std/test8.out @@ -0,0 +1,6 @@ +typedef int T; +main() { + int T=100, a=(T)+1; + //assert(101 == T); + } + diff --git a/tests-std/test80.c b/src/tests/tests-std/test80.c similarity index 100% rename from tests-std/test80.c rename to src/tests/tests-std/test80.c diff --git a/src/tests/tests-std/test80.out b/src/tests/tests-std/test80.out new file mode 100644 index 0000000..f578276 --- /dev/null +++ b/src/tests/tests-std/test80.out @@ -0,0 +1,131 @@ +# 1 "a4.c" +# 1 "a1.h" 1 +# 1 "a11.h" 1 +# 856 "a11.h" +# 105 "a1.h" 2 +# 1 "a13.h" 1 +# 1 "a14.h" 1 +# 1 "a18.h" 1 +# 63 "a14.h" 2 +# 133 "a13.h" 2 +# 1 "a16.h" 1 +# 1 "a15.h" 1 +# 251 "a15.h" +# 465 "a15.h" +# 484 "a15.h" +# 755 "a15.h" +# 911 "a15.h" +# 1388 "a15.h" +# 1408 "a15.h" +# 32 "a16.h" 2 +# 229 "a13.h" 2 +# 121 "a1.h" 2 +# 1 "a20.h" 1 +# 132 "a1.h" 2 +# 1 "a999.h" 1 +# 311 "a1.h" 2 +# 1 "a100.h" 1 +# 355 "a1.h" 2 +# 1 "a30.h" 1 +# 356 "a1.h" 2 +# 1 "a99.h" 1 +# 357 "a1.h" 2 +# 1 "a32.h" 1 +# 1 "a31.h" 1 +# 25 "a32.h" 2 +# 1 "a35.h" 1 +# 33 "a32.h" 2 +# 366 "a1.h" 2 +# 1 "version.h" 1 +# 367 "a1.h" 2 +# 50 "a4.c" 2 +# 1 "a3.h" 1 +# 1 "a12_a11.h" 1 +# 1 "a40.h" 1 +# 15 "a12_a11.h" 2 +# 1 "a42.h" 1 +# 16 "a12_a11.h" 2 +# 1 "a43.h" 1 +# 1 "a44.h" 1 +# 341 "a43.h" 2 +# 17 "a12_a11.h" 2 +# 1 "a12.h" 1 +# 1 "a47.h" 1 +# 301 "a12.h" 2 +# 18 "a12_a11.h" 2 +# 1 "a60.h" 1 +# 20 "a12_a11.h" 2 +# 1121 "a12_a11.h" +# 1205 "a12_a11.h" +# 1680 "a12_a11.h" +# 1804 "a12_a11.h" +# 1864 "a12_a11.h" +# 871 "a3.h" 2 +# 900 "a3.h" +# 1226 "a3.h" +# 1576 "a3.h" +# 1737 "a3.h" +# 1802 "a3.h" +# 1947 "a3.h" +# 1997 "a3.h" +# 2074 "a3.h" +# 2333 "a3.h" +# 2528 "a3.h" +# 2766 "a3.h" +# 3120 "a3.h" +# 3221 "a3.h" +# 3244 "a3.h" +# 3267 "a3.h" +# 3298 "a3.h" +# 3310 "a3.h" +# 3332 "a3.h" +# 3424 "a3.h" +# 3551 "a3.h" +# 3573 "a3.h" +# 3738 "a3.h" +# 3810 "a3.h" +# 4017 "a3.h" +# 4117 "a3.h" +# 4131 "a3.h" +# 51 "a4.c" 2 +# 1 "a2.h" 1 +# 217 "a2.h" +# 460 "a2.h" +# 52 "a4.c" 2 +# 1 "a80.c" 1 +# 1 "a1.h" 1 +# 370 "a1.h" +# 37 "a80.c" 2 +# 53 "a4.c" 2 +# 1 "a6.h" 1 +# 135 "a6.h" +# 150 "a6.h" +# 1 "a81.h" 1 +# 154 "a6.h" 2 +# 1 "a84_a10.h" 1 +# 155 "a6.h" 2 +# 1 "a89.h" 1 +# 156 "a6.h" 2 +# 1 "a88.h" 1 +# 122 "a88.h" +# 248 "a88.h" +# 294 "a88.h" +# 339 "a88.h" +# 157 "a6.h" 2 +# 1 "a90.h" 1 +# 158 "a6.h" 2 +# 1 "a90_a91.h" 1 +# 159 "a6.h" 2 +# 1 "a8.h" 1 +# 160 "a6.h" 2 +# 1 "a10.h" 1 +# 161 "a6.h" 2 +# 1 "a9.h" 1 +# 162 "a6.h" 2 +# 186 "a6.h" +# 219 "a6.h" +# 54 "a4.c" 2 +# 1 "a5.h" 1 +# 1 "a7.h" 1 +# 52 "a5.h" 2 +# 55 "a4.c" 2 diff --git a/tests-std/test84.c b/src/tests/tests-std/test84.c similarity index 100% rename from tests-std/test84.c rename to src/tests/tests-std/test84.c diff --git a/src/tests/tests-std/test84.out b/src/tests/tests-std/test84.out new file mode 100644 index 0000000..646eedb --- /dev/null +++ b/src/tests/tests-std/test84.out @@ -0,0 +1,132 @@ +# 1 "a4.c" +# 1 "a1.h" 1 +# 1 "a11.h" 1 +# 856 "a11.h" +# 105 "a1.h" 2 +# 1 "a13.h" 1 +# 1 "a14.h" 1 +# 1 "a18.h" 1 +# 63 "a14.h" 2 +# 133 "a13.h" 2 +# 1 "a16.h" 1 +# 1 "a15.h" 1 +# 251 "a15.h" +# 465 "a15.h" +# 484 "a15.h" +# 755 "a15.h" +# 911 "a15.h" +# 1388 "a15.h" +# 1408 "a15.h" +# 32 "a16.h" 2 +# 229 "a13.h" 2 +# 121 "a1.h" 2 +# 1 "a20.h" 1 +# 132 "a1.h" 2 +# 1 "a999.h" 1 +# 311 "a1.h" 2 +# 1 "a100.h" 1 +# 355 "a1.h" 2 +# 1 "a30.h" 1 +# 356 "a1.h" 2 +# 1 "a99.h" 1 +# 357 "a1.h" 2 +# 1 "a32.h" 1 +# 1 "a31.h" 1 +# 25 "a32.h" 2 +# 1 "a35.h" 1 +# 33 "a32.h" 2 +# 366 "a1.h" 2 +# 1 "version.h" 1 +# 367 "a1.h" 2 +# 50 "a4.c" 2 +# 1 "a3.h" 1 +# 1 "a12_a11.h" 1 +# 1 "a40.h" 1 +# 15 "a12_a11.h" 2 +# 1 "a42.h" 1 +# 16 "a12_a11.h" 2 +# 1 "a43.h" 1 +# 1 "a44.h" 1 +# 341 "a43.h" 2 +# 17 "a12_a11.h" 2 +# 1 "a12.h" 1 +# 1 "a47.h" 1 +# 301 "a12.h" 2 +# 18 "a12_a11.h" 2 +# 1 "a60.h" 1 +# 20 "a12_a11.h" 2 +# 1121 "a12_a11.h" +# 1205 "a12_a11.h" +# 1680 "a12_a11.h" +# 1804 "a12_a11.h" +# 1864 "a12_a11.h" +# 871 "a3.h" 2 +# 900 "a3.h" +# 1226 "a3.h" +# 1576 "a3.h" +# 1737 "a3.h" +# 1802 "a3.h" +# 1947 "a3.h" +# 1997 "a3.h" +# 2074 "a3.h" +# 2333 "a3.h" +# 2528 "a3.h" +# 2766 "a3.h" +# 3120 "a3.h" +# 3221 "a3.h" +# 3244 "a3.h" +# 3267 "a3.h" +# 3298 "a3.h" +# 3310 "a3.h" +# 3332 "a3.h" +# 3424 "a3.h" +# 3551 "a3.h" +# 3573 "a3.h" +# 3738 "a3.h" +# 3810 "a3.h" +# 4017 "a3.h" +# 4117 "a3.h" +# 4131 "a3.h" +# 51 "a4.c" 2 +# 1 "a2.h" 1 +# 217 "a2.h" +# 460 "a2.h" +# 52 "a4.c" 2 +# 1 "a80.c" 1 +# 1 "a1.h" 1 +# 370 "a1.h" +# 37 "a80.c" 2 +# 53 "a4.c" 2 +# 1 "a6.h" 1 +# 135 "a6.h" +# 150 "a6.h" +# 1 "a81.h" 1 +# 154 "a6.h" 2 +# 1 "a84_a10.h" 1 +# 155 "a6.h" 2 +# 1 "a89.h" 1 +# 156 "a6.h" 2 +# 1 "a88.h" 1 +# 122 "a88.h" +# 248 "a88.h" +# 294 "a88.h" +# 339 "a88.h" +# 157 "a6.h" 2 +# 1 "a90.h" 1 +# 158 "a6.h" 2 +# 1 "a90_a91.h" 1 +# 159 "a6.h" 2 +# 1 "a8.h" 1 +# 160 "a6.h" 2 +# 1 "a10.h" 1 +# 161 "a6.h" 2 +# 1 "a9.h" 1 +# 162 "a6.h" 2 +# 186 "a6.h" +# 219 "a6.h" +# 54 "a4.c" 2 +# 1 "a5.h" 1 +# 1 "a7.h" 1 +# 52 "a5.h" 2 +# 55 "a4.c" 2 + diff --git a/src/tests/tests-std/test86.c b/src/tests/tests-std/test86.c new file mode 100644 index 0000000..1b6d0de --- /dev/null +++ b/src/tests/tests-std/test86.c @@ -0,0 +1,53 @@ +# 1 "a.c" + +# 1 "a.h" 1 + +int aa1; +int aa2; +void testaa(void); +# 2 "a.c" 2 + +# 1 "b.h" 1 + +int bb1; +int bb2; +# 1 "b1.h" 1 + +int b12; +int b22; +# 1 "b12.h" 1 + +int b33; +# 1 "b13.h" 1 + +int b44; + +# 1 "b14.h" 1 +int r45; +void ttt(void); +int r56; +# 4 "b13.h" 2 + + +int b55; +# 3 "b12.h" 2 + +void test66(void); +# 4 "b1.h" 2 + +void testb12(void); +# 4 "b.h" 2 + +int bb3; + + + +# 3 "a.c" 2 + +# 1 "c.h" 1 + +int c11; +int c12; +void testc1(void); +# 4 "a.c" 2 + diff --git a/src/tests/tests-std/test86.out b/src/tests/tests-std/test86.out new file mode 100644 index 0000000..1b6d0de --- /dev/null +++ b/src/tests/tests-std/test86.out @@ -0,0 +1,53 @@ +# 1 "a.c" + +# 1 "a.h" 1 + +int aa1; +int aa2; +void testaa(void); +# 2 "a.c" 2 + +# 1 "b.h" 1 + +int bb1; +int bb2; +# 1 "b1.h" 1 + +int b12; +int b22; +# 1 "b12.h" 1 + +int b33; +# 1 "b13.h" 1 + +int b44; + +# 1 "b14.h" 1 +int r45; +void ttt(void); +int r56; +# 4 "b13.h" 2 + + +int b55; +# 3 "b12.h" 2 + +void test66(void); +# 4 "b1.h" 2 + +void testb12(void); +# 4 "b.h" 2 + +int bb3; + + + +# 3 "a.c" 2 + +# 1 "c.h" 1 + +int c11; +int c12; +void testc1(void); +# 4 "a.c" 2 + diff --git a/tests-std/test9.c b/src/tests/tests-std/test9.c similarity index 100% rename from tests-std/test9.c rename to src/tests/tests-std/test9.c diff --git a/src/tests/tests-std/test9.out b/src/tests/tests-std/test9.out new file mode 100644 index 0000000..0c7747b --- /dev/null +++ b/src/tests/tests-std/test9.out @@ -0,0 +1,9 @@ +typedef int T1 ; +typedef int T2 ; +typedef int T3; +main() { + const T1 T1; /* redeclares T1 to be an int */ + const T2 (T2); /* redeclares T2 to be an int */ + const T3; /* syntax error : missing declarator */ + } + diff --git a/testPars.sh b/testPars.sh deleted file mode 100755 index 2413932..0000000 --- a/testPars.sh +++ /dev/null @@ -1,18 +0,0 @@ -make -run="./ccmeta" - -die() -{ - diff $1 $2 | head -20 - exit 1 -} - -for i in tests-parsimony/parsimony-lang/*.c; do - echo $i - j="${i%.c}.out" - k="tmp.out" - $run $i > $k - cmp $k $j || die $k $j -done - -rm tmp.out \ No newline at end of file diff --git a/tests-parsimony/objectExample.c b/tests-parsimony/objectExample.c deleted file mode 100644 index 9ea252b..0000000 --- a/tests-parsimony/objectExample.c +++ /dev/null @@ -1,25 +0,0 @@ -@import("parsimonyLibrary/fake-static-classes.mc") - -typedef long long int_t; -typedef long double flt_t; - -@beginObject() - -struct Integer { - int_t i; -}; - -struct Float { - flt_t _value; -}; - -struct String { - char *value; -}; - -struct Symbol { - char *name; -}; - -@endObject - diff --git a/tests-parsimony/parsimony-lang/002.c b/tests-parsimony/parsimony-lang/002.c deleted file mode 100644 index e6c5ccb..0000000 --- a/tests-parsimony/parsimony-lang/002.c +++ /dev/null @@ -1,18 +0,0 @@ -@{ - saved = `initializer (1,2,"string",21<<1); - cons = `constant 2; - two = `integer 2; - nil; -} - -@{ - a = `constant 10; - nil; -} - -char t = @(`constant @a); -int i = @cons; -int q = @(`constant 10); -int k = @(`initializer (1,2,"stringy thingy",21<<1)); -int i = @saved; -int w = @a; \ No newline at end of file diff --git a/tests-parsimony/parsimony-lang/004.c b/tests-parsimony/parsimony-lang/004.c deleted file mode 100644 index 3231b0a..0000000 --- a/tests-parsimony/parsimony-lang/004.c +++ /dev/null @@ -1,18 +0,0 @@ -@{ - num = `integer 21; - test = `initializer 2 * 10; - nil; -} - -int x = @{`initializer 2 * @num;}; - -int main() { - int i = @(`initializer 2 * @num); - int y = @test; - int a = @{ - num = `integer 21; - test = 2; - `initializer 2 * @num; - }; - return 0; -} \ No newline at end of file