• R/O
  • SSH
  • HTTPS

jpl: Commit


Commit MetaInfo

Revision484 (tree)
Time2019-03-10 08:01:23
Authorjakobthomsen

Log Message

fix indent

Change Summary

Incremental Difference

--- trunk/experimental2/compiler.compiled.c (revision 483)
+++ trunk/experimental2/compiler.compiled.c (revision 484)
@@ -802,168 +802,168 @@
802802 case /*onchar*/122519904870770LLU:
803803 {
804804
805- uint32_t c = (uint32_t)memory[tuple2_access1(stackframe)].value;
805+ uint32_t c = (uint32_t)memory[tuple2_access1(stackframe)].value;
806806
807- while(isspace(c)) c = (uint32_t)getchar(); // skip WS
808- if((unsigned int)c > 255)
807+ while(isspace(c)) c = (uint32_t)getchar(); // skip WS
808+ if((unsigned int)c > 255)
809+ {
810+ memory[tuple2_access0(stackframe)].value = 0;
811+ break;
812+ }
813+ printf(" case ");
814+ //if(isdigit(c))
815+ //{
816+ // while(isdigit(c))
817+ // putchar(c = (uint32_t)getchar()); // echo label
818+ //}
819+ //else
820+ if(isalpha(c))
821+ {
822+ printf("/*");
823+ uint64_t tmp = 0;
824+ while(isalpha(c))
809825 {
810- memory[tuple2_access0(stackframe)].value = 0;
811- break;
826+ printf("%c", (char)c);
827+ tmp <<= 8;
828+ tmp |= (uint64_t)(c & 255);
829+ c = (uint32_t)getchar();
812830 }
813- printf(" case ");
814- //if(isdigit(c))
815- //{
816- // while(isdigit(c))
817- // putchar(c = (uint32_t)getchar()); // echo label
818- //}
819- //else
820- if(isalpha(c))
831+ printf("*/");
832+ printf("%lluLLU", (unsigned long long)tmp);
833+ }
834+ printf(":\n");
835+
836+ while(isspace(c)) c = (uint32_t)getchar(); // skip WS
837+
838+ if(123 != c) // match brace open
839+ {
840+ fprintf(stderr, "missing '{', unexpected char '%c'\n", c);
841+ exit(-1);
842+ }
843+ printf(" {\n");
844+ bool in_c_code = false;
845+ for(c = (uint32_t)getchar(); c <= 255; c = (uint32_t)getchar())
846+ {
847+ if(96 == c)
821848 {
822- printf("/*");
823- uint64_t tmp = 0;
824- while(isalpha(c))
825- {
826- printf("%c", (char)c);
827- tmp <<= 8;
828- tmp |= (uint64_t)(c & 255);
829- c = (uint32_t)getchar();
830- }
831- printf("*/");
832- printf("%lluLLU", (unsigned long long)tmp);
849+ in_c_code = !in_c_code;
850+ continue;
833851 }
834- printf(":\n");
835852
836- while(isspace(c)) c = (uint32_t)getchar(); // skip WS
837-
838- if(123 != c) // match brace open
853+ if(in_c_code)
839854 {
840- fprintf(stderr, "missing '{', unexpected char '%c'\n", c);
841- exit(-1);
855+ putchar((int)c);
856+ if(10 == c)
857+ printf(" ");
842858 }
843- printf(" {\n");
844- bool in_c_code = false;
845- for(c = (uint32_t)getchar(); c <= 255; c = (uint32_t)getchar())
859+ else
846860 {
847- if(96 == c)
861+ if(125 == c)
848862 {
849- in_c_code = !in_c_code;
850- continue;
863+ printf("tuple2_free(stackframe);\n");
864+ printf(" stackframe = stack_pop(&callstack);\n");
865+ printf(" stack_push(&callstack, result);\n");
866+ break;
851867 }
852-
853- if(in_c_code)
868+ //else if(isdigit(c))
869+ //{
870+ // uint64_t dest = --tmpaddr;
871+ // printf("memory[tuple2_access0(stackframe)].value = %lldLL;\n", (long long)dest); // use negative to display numbers concisely
872+ // printf(" stack_push(&callstack, stackframe);\n");
873+ // printf(" stackframe = tuple2_alloc(%c", c);
874+ // while(isdigit(ungetc(getchar(), stdin))) putchar(getchar()); // echo label
875+ // printf(", 0);\n");
876+ // printf(" result = 0;\n");
877+ // printf(" break;\n");
878+ // printf(" }\n");
879+ // //printf(" case %lluLLU:\n", (unsigned long long)--tmpaddr);
880+ // printf(" case %lldLL:\n", (long long)dest); // use negative to display numbers concisely
881+ // printf(" {\n");
882+ // printf(" result = stack_pop(&callstack);\n");
883+ //}
884+ else if(isalpha(c))
854885 {
855- putchar((int)c);
856- if(10 == c)
857- printf(" ");
858- }
859- else
860- {
861- if(125 == c)
886+ printf("/*");
887+ uint64_t id = 0;
888+ while(isalpha(c))
862889 {
863- printf("tuple2_free(stackframe);\n");
864- printf(" stackframe = stack_pop(&callstack);\n");
865- printf(" stack_push(&callstack, result);\n");
866- break;
890+ printf("%c", (char)c);
891+ id <<= 8;
892+ id |= (uint64_t)(c & 255);
893+ c = (uint32_t)getchar();
867894 }
868- //else if(isdigit(c))
869- //{
870- // uint64_t dest = --tmpaddr;
871- // printf("memory[tuple2_access0(stackframe)].value = %lldLL;\n", (long long)dest); // use negative to display numbers concisely
872- // printf(" stack_push(&callstack, stackframe);\n");
873- // printf(" stackframe = tuple2_alloc(%c", c);
874- // while(isdigit(ungetc(getchar(), stdin))) putchar(getchar()); // echo label
875- // printf(", 0);\n");
876- // printf(" result = 0;\n");
877- // printf(" break;\n");
878- // printf(" }\n");
879- // //printf(" case %lluLLU:\n", (unsigned long long)--tmpaddr);
880- // printf(" case %lldLL:\n", (long long)dest); // use negative to display numbers concisely
881- // printf(" {\n");
882- // printf(" result = stack_pop(&callstack);\n");
883- //}
884- else if(isalpha(c))
895+ printf("*/");
896+
897+ if(31365121518368116LLU == id)
885898 {
886- printf("/*");
887- uint64_t id = 0;
888- while(isalpha(c))
889- {
890- printf("%c", (char)c);
891- id <<= 8;
892- id |= (uint64_t)(c & 255);
893- c = (uint32_t)getchar();
894- }
895- printf("*/");
899+ uint64_t dest = --tmpaddr;
900+ printf("\n stack_push(&callstack, 0);"); // push unit to be popped returning from called function
901+ printf("\n memory[tuple2_access0(stackframe)].value = %lluLLU;", (long long)dest); // use negative to display numbers concisely
902+ printf("\n break;");
903+ printf("\n }");
904+ printf("\n case %lluLLU:", (long long)dest); // use negative to display numbers concisely
905+ printf("\n {");
906+ printf("\n /*unit*/(void)stack_pop(&callstack);");
907+ printf("\n if((unsigned int)ungetc(getchar(), stdin) <= 255)");
908+ printf("\n {");
896909
897- if(31365121518368116LLU == id)
910+ while(isspace(c)) c = (uint32_t)getchar(); // skip WS
911+ if(isalpha(c))
898912 {
899- uint64_t dest = --tmpaddr;
900- printf("\n stack_push(&callstack, 0);"); // push unit to be popped returning from called function
901- printf("\n memory[tuple2_access0(stackframe)].value = %lluLLU;", (long long)dest); // use negative to display numbers concisely
902- printf("\n break;");
903- printf("\n }");
904- printf("\n case %lluLLU:", (long long)dest); // use negative to display numbers concisely
905- printf("\n {");
906- printf("\n /*unit*/(void)stack_pop(&callstack);");
907- printf("\n if((unsigned int)ungetc(getchar(), stdin) <= 255)");
908- printf("\n {");
909-
910- while(isspace(c)) c = (uint32_t)getchar(); // skip WS
911- if(isalpha(c))
913+ printf("/*");
914+ id = 0;
915+ while(isalpha(c))
912916 {
913- printf("/*");
914- id = 0;
915- while(isalpha(c))
916- {
917- printf("%c", (char)c);
918- id <<= 8;
919- id |= (uint64_t)(c & 255);
920- c = (uint32_t)getchar();
921- }
922- printf("*/");
917+ printf("%c", (char)c);
918+ id <<= 8;
919+ id |= (uint64_t)(c & 255);
920+ c = (uint32_t)getchar();
923921 }
922+ printf("*/");
923+ }
924924
925- printf("\n memory[tuple2_access0(stackframe)].value = %lluLLU;", (long long)dest); // use negative to display numbers concisely
926- printf("\n stack_push(&callstack, stackframe);");
927- printf("\n stackframe = tuple2_alloc(%lluLLU, (uint64_t)getchar());", (unsigned long long)id); // echo label
928- printf("\n result = 0;");
929- printf("\n break;");
930- printf("\n }");
931- printf("\n");
932- }
933- else
934- {
935- uint64_t dest = --tmpaddr;
936- printf("memory[tuple2_access0(stackframe)].value = %lluLLU;\n", (long long)dest); // use negative to display numbers concisely
937- printf(" stack_push(&callstack, stackframe);\n");
938- printf(" stackframe = tuple2_alloc(%lluLLU, 0);\n", (unsigned long long)id); // echo label
939- printf(" result = 0;\n");
940- printf(" break;\n");
941- printf(" }\n");
942- //printf(" case %lluLLU:\n", (unsigned long long)--tmpaddr);
943- printf(" case %lluLLU:\n", (long long)dest); // use negative to display numbers concisely
944- printf(" {\n");
945- printf(" result = stack_pop(&callstack);\n");
946- }
925+ printf("\n memory[tuple2_access0(stackframe)].value = %lluLLU;", (long long)dest); // use negative to display numbers concisely
926+ printf("\n stack_push(&callstack, stackframe);");
927+ printf("\n stackframe = tuple2_alloc(%lluLLU, (uint64_t)getchar());", (unsigned long long)id); // echo label
928+ printf("\n result = 0;");
929+ printf("\n break;");
930+ printf("\n }");
931+ printf("\n");
947932 }
948- else if(64 == c)
933+ else
949934 {
950- printf(" result = ");
951- while(isspace(ungetc(getchar(), stdin))) (void)getchar(); // skip WS
952- while(isdigit(ungetc(getchar(), stdin))) putchar(getchar()); // echo number
953- printf(";\n");
935+ uint64_t dest = --tmpaddr;
936+ printf("memory[tuple2_access0(stackframe)].value = %lluLLU;\n", (long long)dest); // use negative to display numbers concisely
937+ printf(" stack_push(&callstack, stackframe);\n");
938+ printf(" stackframe = tuple2_alloc(%lluLLU, 0);\n", (unsigned long long)id); // echo label
939+ printf(" result = 0;\n");
940+ printf(" break;\n");
941+ printf(" }\n");
942+ //printf(" case %lluLLU:\n", (unsigned long long)--tmpaddr);
943+ printf(" case %lluLLU:\n", (long long)dest); // use negative to display numbers concisely
944+ printf(" {\n");
945+ printf(" result = stack_pop(&callstack);\n");
954946 }
955- else if(!isspace(c))
956- {
957- fprintf(stderr, "unexpected char '%c'\n", c);
958- exit(-1);
959- }
960947 }
948+ else if(64 == c)
949+ {
950+ printf(" result = ");
951+ while(isspace(ungetc(getchar(), stdin))) (void)getchar(); // skip WS
952+ while(isdigit(ungetc(getchar(), stdin))) putchar(getchar()); // echo number
953+ printf(";\n");
954+ }
955+ else if(!isspace(c))
956+ {
957+ fprintf(stderr, "unexpected char '%c'\n", c);
958+ exit(-1);
959+ }
961960 }
962- printf("\n");
963- printf(" break;\n");
964- printf(" }\n");
961+ }
962+ printf("\n");
963+ printf(" break;\n");
964+ printf(" }\n");
965965
966- c = (uint32_t)getchar();
966+ c = (uint32_t)getchar();
967967 tuple2_free(stackframe);
968968 stackframe = stack_pop(&callstack);
969969 stack_push(&callstack, result);
--- trunk/experimental2/compiler.source.c (revision 483)
+++ trunk/experimental2/compiler.source.c (revision 484)
@@ -420,168 +420,168 @@
420420 onchar
421421 {
422422 `
423- uint32_t c = (uint32_t)memory[tuple2_access1(stackframe)].value;
423+ uint32_t c = (uint32_t)memory[tuple2_access1(stackframe)].value;
424424
425- while(isspace(c)) c = (uint32_t)getchar(); // skip WS
426- if((unsigned int)c > 255)
425+ while(isspace(c)) c = (uint32_t)getchar(); // skip WS
426+ if((unsigned int)c > 255)
427+ {
428+ memory[tuple2_access0(stackframe)].value = 0;
429+ break;
430+ }
431+ printf(" case ");
432+ //if(isdigit(c))
433+ //{
434+ // while(isdigit(c))
435+ // putchar(c = (uint32_t)getchar()); // echo label
436+ //}
437+ //else
438+ if(isalpha(c))
439+ {
440+ printf("/*");
441+ uint64_t tmp = 0;
442+ while(isalpha(c))
427443 {
428- memory[tuple2_access0(stackframe)].value = 0;
429- break;
444+ printf("%c", (char)c);
445+ tmp <<= 8;
446+ tmp |= (uint64_t)(c & 255);
447+ c = (uint32_t)getchar();
430448 }
431- printf(" case ");
432- //if(isdigit(c))
433- //{
434- // while(isdigit(c))
435- // putchar(c = (uint32_t)getchar()); // echo label
436- //}
437- //else
438- if(isalpha(c))
449+ printf("*/");
450+ printf("%lluLLU", (unsigned long long)tmp);
451+ }
452+ printf(":\n");
453+
454+ while(isspace(c)) c = (uint32_t)getchar(); // skip WS
455+
456+ if(123 != c) // match brace open
457+ {
458+ fprintf(stderr, "missing '{', unexpected char '%c'\n", c);
459+ exit(-1);
460+ }
461+ printf(" {\n");
462+ bool in_c_code = false;
463+ for(c = (uint32_t)getchar(); c <= 255; c = (uint32_t)getchar())
464+ {
465+ if(96 == c)
439466 {
440- printf("/*");
441- uint64_t tmp = 0;
442- while(isalpha(c))
443- {
444- printf("%c", (char)c);
445- tmp <<= 8;
446- tmp |= (uint64_t)(c & 255);
447- c = (uint32_t)getchar();
448- }
449- printf("*/");
450- printf("%lluLLU", (unsigned long long)tmp);
467+ in_c_code = !in_c_code;
468+ continue;
451469 }
452- printf(":\n");
453470
454- while(isspace(c)) c = (uint32_t)getchar(); // skip WS
455-
456- if(123 != c) // match brace open
471+ if(in_c_code)
457472 {
458- fprintf(stderr, "missing '{', unexpected char '%c'\n", c);
459- exit(-1);
473+ putchar((int)c);
474+ if(10 == c)
475+ printf(" ");
460476 }
461- printf(" {\n");
462- bool in_c_code = false;
463- for(c = (uint32_t)getchar(); c <= 255; c = (uint32_t)getchar())
477+ else
464478 {
465- if(96 == c)
479+ if(125 == c)
466480 {
467- in_c_code = !in_c_code;
468- continue;
481+ printf("tuple2_free(stackframe);\n");
482+ printf(" stackframe = stack_pop(&callstack);\n");
483+ printf(" stack_push(&callstack, result);\n");
484+ break;
469485 }
470-
471- if(in_c_code)
486+ //else if(isdigit(c))
487+ //{
488+ // uint64_t dest = --tmpaddr;
489+ // printf("memory[tuple2_access0(stackframe)].value = %lldLL;\n", (long long)dest); // use negative to display numbers concisely
490+ // printf(" stack_push(&callstack, stackframe);\n");
491+ // printf(" stackframe = tuple2_alloc(%c", c);
492+ // while(isdigit(ungetc(getchar(), stdin))) putchar(getchar()); // echo label
493+ // printf(", 0);\n");
494+ // printf(" result = 0;\n");
495+ // printf(" break;\n");
496+ // printf(" }\n");
497+ // //printf(" case %lluLLU:\n", (unsigned long long)--tmpaddr);
498+ // printf(" case %lldLL:\n", (long long)dest); // use negative to display numbers concisely
499+ // printf(" {\n");
500+ // printf(" result = stack_pop(&callstack);\n");
501+ //}
502+ else if(isalpha(c))
472503 {
473- putchar((int)c);
474- if(10 == c)
475- printf(" ");
476- }
477- else
478- {
479- if(125 == c)
504+ printf("/*");
505+ uint64_t id = 0;
506+ while(isalpha(c))
480507 {
481- printf("tuple2_free(stackframe);\n");
482- printf(" stackframe = stack_pop(&callstack);\n");
483- printf(" stack_push(&callstack, result);\n");
484- break;
508+ printf("%c", (char)c);
509+ id <<= 8;
510+ id |= (uint64_t)(c & 255);
511+ c = (uint32_t)getchar();
485512 }
486- //else if(isdigit(c))
487- //{
488- // uint64_t dest = --tmpaddr;
489- // printf("memory[tuple2_access0(stackframe)].value = %lldLL;\n", (long long)dest); // use negative to display numbers concisely
490- // printf(" stack_push(&callstack, stackframe);\n");
491- // printf(" stackframe = tuple2_alloc(%c", c);
492- // while(isdigit(ungetc(getchar(), stdin))) putchar(getchar()); // echo label
493- // printf(", 0);\n");
494- // printf(" result = 0;\n");
495- // printf(" break;\n");
496- // printf(" }\n");
497- // //printf(" case %lluLLU:\n", (unsigned long long)--tmpaddr);
498- // printf(" case %lldLL:\n", (long long)dest); // use negative to display numbers concisely
499- // printf(" {\n");
500- // printf(" result = stack_pop(&callstack);\n");
501- //}
502- else if(isalpha(c))
513+ printf("*/");
514+
515+ if(31365121518368116LLU == id)
503516 {
504- printf("/*");
505- uint64_t id = 0;
506- while(isalpha(c))
507- {
508- printf("%c", (char)c);
509- id <<= 8;
510- id |= (uint64_t)(c & 255);
511- c = (uint32_t)getchar();
512- }
513- printf("*/");
517+ uint64_t dest = --tmpaddr;
518+ printf("\n stack_push(&callstack, 0);"); // push unit to be popped returning from called function
519+ printf("\n memory[tuple2_access0(stackframe)].value = %lluLLU;", (long long)dest); // use negative to display numbers concisely
520+ printf("\n break;");
521+ printf("\n }");
522+ printf("\n case %lluLLU:", (long long)dest); // use negative to display numbers concisely
523+ printf("\n {");
524+ printf("\n /*unit*/(void)stack_pop(&callstack);");
525+ printf("\n if((unsigned int)ungetc(getchar(), stdin) <= 255)");
526+ printf("\n {");
514527
515- if(31365121518368116LLU == id)
528+ while(isspace(c)) c = (uint32_t)getchar(); // skip WS
529+ if(isalpha(c))
516530 {
517- uint64_t dest = --tmpaddr;
518- printf("\n stack_push(&callstack, 0);"); // push unit to be popped returning from called function
519- printf("\n memory[tuple2_access0(stackframe)].value = %lluLLU;", (long long)dest); // use negative to display numbers concisely
520- printf("\n break;");
521- printf("\n }");
522- printf("\n case %lluLLU:", (long long)dest); // use negative to display numbers concisely
523- printf("\n {");
524- printf("\n /*unit*/(void)stack_pop(&callstack);");
525- printf("\n if((unsigned int)ungetc(getchar(), stdin) <= 255)");
526- printf("\n {");
527-
528- while(isspace(c)) c = (uint32_t)getchar(); // skip WS
529- if(isalpha(c))
531+ printf("/*");
532+ id = 0;
533+ while(isalpha(c))
530534 {
531- printf("/*");
532- id = 0;
533- while(isalpha(c))
534- {
535- printf("%c", (char)c);
536- id <<= 8;
537- id |= (uint64_t)(c & 255);
538- c = (uint32_t)getchar();
539- }
540- printf("*/");
535+ printf("%c", (char)c);
536+ id <<= 8;
537+ id |= (uint64_t)(c & 255);
538+ c = (uint32_t)getchar();
541539 }
540+ printf("*/");
541+ }
542542
543- printf("\n memory[tuple2_access0(stackframe)].value = %lluLLU;", (long long)dest); // use negative to display numbers concisely
544- printf("\n stack_push(&callstack, stackframe);");
545- printf("\n stackframe = tuple2_alloc(%lluLLU, (uint64_t)getchar());", (unsigned long long)id); // echo label
546- printf("\n result = 0;");
547- printf("\n break;");
548- printf("\n }");
549- printf("\n");
550- }
551- else
552- {
553- uint64_t dest = --tmpaddr;
554- printf("memory[tuple2_access0(stackframe)].value = %lluLLU;\n", (long long)dest); // use negative to display numbers concisely
555- printf(" stack_push(&callstack, stackframe);\n");
556- printf(" stackframe = tuple2_alloc(%lluLLU, 0);\n", (unsigned long long)id); // echo label
557- printf(" result = 0;\n");
558- printf(" break;\n");
559- printf(" }\n");
560- //printf(" case %lluLLU:\n", (unsigned long long)--tmpaddr);
561- printf(" case %lluLLU:\n", (long long)dest); // use negative to display numbers concisely
562- printf(" {\n");
563- printf(" result = stack_pop(&callstack);\n");
564- }
543+ printf("\n memory[tuple2_access0(stackframe)].value = %lluLLU;", (long long)dest); // use negative to display numbers concisely
544+ printf("\n stack_push(&callstack, stackframe);");
545+ printf("\n stackframe = tuple2_alloc(%lluLLU, (uint64_t)getchar());", (unsigned long long)id); // echo label
546+ printf("\n result = 0;");
547+ printf("\n break;");
548+ printf("\n }");
549+ printf("\n");
565550 }
566- else if(64 == c)
551+ else
567552 {
568- printf(" result = ");
569- while(isspace(ungetc(getchar(), stdin))) (void)getchar(); // skip WS
570- while(isdigit(ungetc(getchar(), stdin))) putchar(getchar()); // echo number
571- printf(";\n");
553+ uint64_t dest = --tmpaddr;
554+ printf("memory[tuple2_access0(stackframe)].value = %lluLLU;\n", (long long)dest); // use negative to display numbers concisely
555+ printf(" stack_push(&callstack, stackframe);\n");
556+ printf(" stackframe = tuple2_alloc(%lluLLU, 0);\n", (unsigned long long)id); // echo label
557+ printf(" result = 0;\n");
558+ printf(" break;\n");
559+ printf(" }\n");
560+ //printf(" case %lluLLU:\n", (unsigned long long)--tmpaddr);
561+ printf(" case %lluLLU:\n", (long long)dest); // use negative to display numbers concisely
562+ printf(" {\n");
563+ printf(" result = stack_pop(&callstack);\n");
572564 }
573- else if(!isspace(c))
574- {
575- fprintf(stderr, "unexpected char '%c'\n", c);
576- exit(-1);
577- }
578565 }
566+ else if(64 == c)
567+ {
568+ printf(" result = ");
569+ while(isspace(ungetc(getchar(), stdin))) (void)getchar(); // skip WS
570+ while(isdigit(ungetc(getchar(), stdin))) putchar(getchar()); // echo number
571+ printf(";\n");
572+ }
573+ else if(!isspace(c))
574+ {
575+ fprintf(stderr, "unexpected char '%c'\n", c);
576+ exit(-1);
577+ }
579578 }
580- printf("\n");
581- printf(" break;\n");
582- printf(" }\n");
579+ }
580+ printf("\n");
581+ printf(" break;\n");
582+ printf(" }\n");
583583
584- c = (uint32_t)getchar();
584+ c = (uint32_t)getchar();
585585 `
586586 }
587587
Show on old repository browser