/* Automatically generated by the nanoLang compiler ncc. The bolierplate and library code is released under the GNU General Public Licence, version 2 or, at your choice, any later version. Other code is governed by the license of the original source code. */ #include #include #include typedef long long N_Integer; typedef char* N_String; #define NANO_MAKESTR(s) s #define NANO_STRASSIGN(l, r) (l) = (r) #define NANO_STRVAL(s) s /* Global user variables */ /* Function declarations */ N_Integer n_Exit(N_Integer); N_Integer n_StrIsInt(N_String); N_Integer n_StrToInt(N_String); N_Integer n_StrLen(N_String); N_String n_IntToStr(N_Integer); N_String n_StrFront(N_String,N_Integer); N_String n_StrRest(N_String,N_Integer); N_String n_StrCat(N_String,N_String); N_Integer n_StrToASCII(N_String); N_String n_ASCIIToStr(N_Integer); N_String n_testfun(N_Integer,N_String); N_Integer n_main(N_String,N_String); /* nanoLang runtime library code */ /* String functions */ N_String n_StrCat(N_String arg1, N_String arg2) { size_t len = strlen(arg1)+strlen(arg2)+1; char *res = malloc(len); strcpy(res, arg1); strcat(res, arg2); return res; } N_Integer n_StrIsInt(N_String str) { char *err=NULL; if(!str[0]) { return 0; } strtoll(str, &err, 10); if(*err == 0) { return 1; } return 0; } N_Integer n_StrToInt(N_String str) { N_Integer res = strtoll(str, NULL, 10); return res; } N_Integer n_Exit(N_Integer ret) { exit(ret); } /* User function definitions */ N_String n_testfun(N_Integer n_count,N_String n_message) { N_Integer n_i = 0; N_String n_res = 0; n_i = (0); NANO_STRASSIGN(n_res, (NANO_MAKESTR(""))); while((n_i)<(n_count)) { printf("%s",NANO_STRVAL((NANO_MAKESTR("Schleifendurchlauf ")))); printf("%lld",(n_i)); printf("%s",NANO_STRVAL((NANO_MAKESTR("\n")))); NANO_STRASSIGN(n_res, (n_StrCat((n_res),(n_message)))); n_i = ((n_i)+(1)); } return (n_res); } N_Integer n_main(N_String n_arg1,N_String n_arg2) { N_Integer n_limit = 0; n_limit = (10); if((n_StrIsInt((n_arg1)))==(0)) { printf("%s",NANO_STRVAL((NANO_MAKESTR("Argment 1 should be numerical!\n")))); n_Exit((1)); } else { printf("%s",NANO_STRVAL((NANO_MAKESTR("Argumet 1 has value ")))); printf("%s",NANO_STRVAL((n_arg1))); printf("%s",NANO_STRVAL((NANO_MAKESTR("\n")))); } n_limit = (n_StrToInt((n_arg1))); printf("%s",NANO_STRVAL((n_testfun((n_limit),(n_arg2))))); printf("%s",NANO_STRVAL((NANO_MAKESTR("\n")))); return (0); } /* C main function */ int main(int argc, char* argv[]) { N_String arg1 = NANO_MAKESTR(""); if(1