Kestrel-3

Check-in [29d317a6a2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:.ascii support
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 29d317a6a2b2b7fcfee32b6925fd18fe9b7420ebf0dddc9b5a7e78b400946487
User & Date: kc5tja 2019-09-05 02:51:38.754
Context
2019-09-05
03:10
Support .asciz and fix unit test breakage in scanner check-in: f23325b630 user: kc5tja tags: trunk
02:51
.ascii support check-in: 29d317a6a2 user: kc5tja tags: trunk
2019-09-03
04:41
.8byte, .4byte, and .2byte implemented check-in: 8a46823df5 user: kc5tja tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to dev/src/bcpl/assemrv/manifest.h.
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
    scs_byte;
    scs_2byte;
    scs_4byte;
    scs_8byte;
    scs_half;
    scs_word;
    scs_dword;
    scs_ascii;
    scs_asciz;
    scs_zero;
    scs_p2align;
    scs_balign;
    scs_equ;
    scs_include;
    scs_file;







<







83
84
85
86
87
88
89

90
91
92
93
94
95
96
    scs_byte;
    scs_2byte;
    scs_4byte;
    scs_8byte;
    scs_half;
    scs_word;
    scs_dword;

    scs_asciz;
    scs_zero;
    scs_p2align;
    scs_balign;
    scs_equ;
    scs_include;
    scs_file;
Changes to dev/src/bcpl/assemrv/scanner.b.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
	addKW(s, ".byte",	scs_byte)
	addKW(s, ".2byte",	scs_2byte)
	addKW(s, ".4byte",	scs_4byte)
	addKW(s, ".8byte",	scs_8byte)
	addKW(s, ".half",	scs_half)
	addKW(s, ".word",	scs_word)
	addKW(s, ".dword",	scs_dword)
	addKW(s, ".ascii",	scs_ascii)
	addKW(s, ".asciz",	scs_asciz)
	addKW(s, ".string",	scs_asciz)
	addKW(s, ".zero",	scs_zero)
	addKW(s, ".p2align",	scs_p2align)
	addKW(s, ".balign",	scs_balign)
	addKW(s, ".equ",	scs_equ)
	addKW(s, ".set",	scs_equ)







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
	addKW(s, ".byte",	scs_byte)
	addKW(s, ".2byte",	scs_2byte)
	addKW(s, ".4byte",	scs_4byte)
	addKW(s, ".8byte",	scs_8byte)
	addKW(s, ".half",	scs_half)
	addKW(s, ".word",	scs_word)
	addKW(s, ".dword",	scs_dword)
	addKW(s, ".ascii",	scs_byte)
	addKW(s, ".asciz",	scs_asciz)
	addKW(s, ".string",	scs_asciz)
	addKW(s, ".zero",	scs_zero)
	addKW(s, ".p2align",	scs_p2align)
	addKW(s, ".balign",	scs_balign)
	addKW(s, ".equ",	scs_equ)
	addKW(s, ".set",	scs_equ)
Changes to dev/src/bcpl/assemrv/test_parser.b.
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
GET "globals_dynvec"
GET "globals_scanner"
GET "globals_utils"
GET "globals_parser"


LET testlist() = VALOF {
	MANIFEST { ntests = 21 }
	LET tl = getvec(ntests)
	tl!0 := ntests
	tl!1 := test_dword
	tl!2 := test_dword_chain
	tl!3 := test_dword_string
	tl!4 := test_word
	tl!5 := test_word_chain







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
GET "globals_dynvec"
GET "globals_scanner"
GET "globals_utils"
GET "globals_parser"


LET testlist() = VALOF {
	MANIFEST { ntests = 22 }
	LET tl = getvec(ntests)
	tl!0 := ntests
	tl!1 := test_dword
	tl!2 := test_dword_chain
	tl!3 := test_dword_string
	tl!4 := test_word
	tl!5 := test_word_chain
84
85
86
87
88
89
90

91
92
93
94
95
96
97
	tl!15 := test_8byte_string
	tl!16 := test_4byte
	tl!17 := test_4byte_chain
	tl!18 := test_4byte_string
	tl!19 := test_2byte
	tl!20 := test_2byte_chain
	tl!21 := test_2byte_string

	RESULTIS tl
}


// Parser Tests: Utilities

AND free_errors(p) BE {







>







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
	tl!15 := test_8byte_string
	tl!16 := test_4byte
	tl!17 := test_4byte_chain
	tl!18 := test_4byte_string
	tl!19 := test_2byte
	tl!20 := test_2byte_chain
	tl!21 := test_2byte_string
	tl!22 := test_ascii_string
	RESULTIS tl
}


// Parser Tests: Utilities

AND free_errors(p) BE {
1080
1081
1082
1083
1084
1085
1086


















































1087
1088
1089
1090
1091
1092
1093
	{
		LET outs = output()
		selectoutput(scb)
		writef(".byte 6, *"Abacab*"*n")
		selectoutput(outs)
		rewindstream(scb)
	}



















































	s := make_scanner()
	UNLESS NEQ(s, 0, 1) DO GOTO unwind
	UNLESS EQ(scanner_get_stream(s, scb, "RAM:"), TRUE, 3) DO GOTO unwind
	scanner_nextchar(s)
	scanner_next(s)








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
	{
		LET outs = output()
		selectoutput(scb)
		writef(".byte 6, *"Abacab*"*n")
		selectoutput(outs)
		rewindstream(scb)
	}

	s := make_scanner()
	UNLESS NEQ(s, 0, 1) DO GOTO unwind
	UNLESS EQ(scanner_get_stream(s, scb, "RAM:"), TRUE, 3) DO GOTO unwind
	scanner_nextchar(s)
	scanner_next(s)

	d := make_dynvec()
	UNLESS NEQ(d, 0, 4) DO GOTO unwind

	parse(s, d, @errlist)
	UNLESS EQ(errlist, 0, 5) DO GOTO unwind

	UNLESS EQ(d!dv_length, 21, 100) DO GOTO unwind
	FOR i = 0 TO 20 DO UNLESS EQ(dynvec_at(d, i), expected!i, 200+i) DO GOTO unwind

	err := 0

unwind:
	IF errlist DO free_errors(errlist)
	IF d DO dynvec_free(d)
	IF s DO scanner_free(s)
	IF scb DO endstream(scb)
	RESULTIS err
}

AND test_ascii_string(r) = VALOF {
	LET err = failat
	LET scb, s, d = 0, 0, 0
	LET expected = TABLE IR_LIT, 6, IR_BYTE,
	                     IR_LIT, 'A', IR_BYTE,
	                     IR_LIT, 'b', IR_BYTE,
	                     IR_LIT, 'a', IR_BYTE,
	                     IR_LIT, 'c', IR_BYTE,
	                     IR_LIT, 'a', IR_BYTE,
	                     IR_LIT, 'b', IR_BYTE
	LET errlist = 0

	IF r DO RESULTIS r
	testid := "test_ascii_string"

	scb := findinoutput("RAM:")
	UNLESS NEQ(scb, 0, 0) DO GOTO unwind
	{
		LET outs = output()
		selectoutput(scb)
		writef(".ascii 6, *"Abacab*"*n")
		selectoutput(outs)
		rewindstream(scb)
	}

	s := make_scanner()
	UNLESS NEQ(s, 0, 1) DO GOTO unwind
	UNLESS EQ(scanner_get_stream(s, scb, "RAM:"), TRUE, 3) DO GOTO unwind
	scanner_nextchar(s)
	scanner_next(s)