@@ -813,11 +813,8 @@ new_patterns(void)
813
813
cur_chr = LC_CODE (cur_chr );
814
814
815
815
if (cur_chr == 0 ) {
816
- if (file_line_error_style_p )
817
- print_file_line ();
818
- else
819
- print_nl_cstr ("! " );
820
- print_cstr ("Nonletter" );
816
+ error_here_with_diagnostic ("Nonletter" );
817
+ capture_to_diagnostic (NULL );
821
818
help_ptr = 1 ;
822
819
help_line [0 ] = "(See Appendix H.)" ;
823
820
error ();
@@ -893,11 +890,8 @@ new_patterns(void)
893
890
}
894
891
895
892
if (trie_o [q ] != MIN_TRIE_OP ) {
896
- if (file_line_error_style_p )
897
- print_file_line ();
898
- else
899
- print_nl_cstr ("! " );
900
- print_cstr ("Duplicate pattern" );
893
+ error_here_with_diagnostic ("Duplicate pattern" );
894
+ capture_to_diagnostic (NULL );
901
895
help_ptr = 1 ;
902
896
help_line [0 ] = "(See Appendix H.)" ;
903
897
error ();
@@ -915,12 +909,9 @@ new_patterns(void)
915
909
break ;
916
910
917
911
default :
918
- if (file_line_error_style_p )
919
- print_file_line ();
920
- else
921
- print_nl_cstr ("! " );
922
- print_cstr ("Bad " );
912
+ error_here_with_diagnostic ("Bad " );
923
913
print_esc_cstr ("patterns" );
914
+ capture_to_diagnostic (NULL );
924
915
help_ptr = 1 ;
925
916
help_line [0 ] = "(See Appendix H.)" ;
926
917
error ();
@@ -990,12 +981,9 @@ new_patterns(void)
990
981
trie_r [q ] = 0 ; /*:1644*/
991
982
}
992
983
} else {
993
- if (file_line_error_style_p )
994
- print_file_line ();
995
- else
996
- print_nl_cstr ("! " );
997
- print_cstr ("Too late for " );
984
+ error_here_with_diagnostic ("Too late for " );
998
985
print_esc_cstr ("patterns" );
986
+ capture_to_diagnostic (NULL );
999
987
help_ptr = 1 ;
1000
988
help_line [0 ] = "All patterns must be given before typesetting begins." ;
1001
989
error ();
@@ -1198,11 +1186,8 @@ new_hyph_exceptions(void)
1198
1186
hc [0 ] = trie_tro [hyph_index + cur_chr ];
1199
1187
1200
1188
if (hc [0 ] == 0 ) {
1201
- if (file_line_error_style_p )
1202
- print_file_line ();
1203
- else
1204
- print_nl_cstr ("! " );
1205
- print_cstr ("Not a letter" );
1189
+ error_here_with_diagnostic ("Not a letter" );
1190
+ capture_to_diagnostic (NULL );
1206
1191
help_ptr = 2 ;
1207
1192
help_line [1 ] = "Letters in \\hyphenation words must have \\lccode>0." ;
1208
1193
help_line [0 ] = "Proceed; I'll ignore the character I just read." ;
@@ -1300,13 +1285,10 @@ new_hyph_exceptions(void)
1300
1285
break ;
1301
1286
1302
1287
default :
1303
- if (file_line_error_style_p )
1304
- print_file_line ();
1305
- else
1306
- print_nl_cstr ("! " );
1307
- print_cstr ("Improper " );
1288
+ error_here_with_diagnostic ("Improper " );
1308
1289
print_esc_cstr ("hyphenation" );
1309
1290
print_cstr (" will be flushed" );
1291
+ capture_to_diagnostic (NULL );
1310
1292
help_ptr = 2 ;
1311
1293
help_line [1 ] = "Hyphenation exceptions must contain only letters" ;
1312
1294
help_line [0 ] = "and hyphens. But continue; I'll forgive and forget." ;
@@ -1339,13 +1321,10 @@ prefixed_command(void)
1339
1321
} while (cur_cmd == SPACER || cur_cmd == RELAX );
1340
1322
1341
1323
if (cur_cmd <= MAX_NON_PREFIXED_COMMAND ) { /*1247:*/
1342
- if (file_line_error_style_p )
1343
- print_file_line ();
1344
- else
1345
- print_nl_cstr ("! " );
1346
- print_cstr ("You can't use a prefix with `" );
1324
+ error_here_with_diagnostic ("You can't use a prefix with `" );
1347
1325
print_cmd_chr (cur_cmd , cur_chr );
1348
1326
print_char ('\'' );
1327
+ capture_to_diagnostic (NULL );
1349
1328
help_ptr = 1 ;
1350
1329
help_line [0 ] = "I'll pretend you didn't say \\long or \\outer or \\global or \\protected." ;
1351
1330
back_error ();
@@ -1365,21 +1344,18 @@ prefixed_command(void)
1365
1344
}
1366
1345
1367
1346
if (cur_cmd != DEF && (a % 4 != 0 || j != 0 )) {
1368
- if (file_line_error_style_p )
1369
- print_file_line ();
1370
- else
1371
- print_nl_cstr ("! " );
1372
- print_cstr ("You can't use `" );
1347
+ error_here_with_diagnostic ("You can't use `" );
1373
1348
print_esc_cstr ("long" );
1374
1349
print_cstr ("' or `" );
1375
1350
print_esc_cstr ("outer" );
1376
- help_ptr = 1 ;
1377
- help_line [0 ] = "I'll pretend you didn't say \\long or \\outer or \\protected here." ;
1378
1351
print_cstr ("' or `" );
1379
1352
print_esc_cstr ("protected" );
1380
1353
print_cstr ("' with `" );
1381
1354
print_cmd_chr (cur_cmd , cur_chr );
1382
1355
print_char ('\'' );
1356
+ capture_to_diagnostic (NULL );
1357
+ help_ptr = 1 ;
1358
+ help_line [0 ] = "I'll pretend you didn't say \\long or \\outer or \\protected here." ;
1383
1359
error ();
1384
1360
}
1385
1361
@@ -1614,11 +1590,8 @@ prefixed_command(void)
1614
1590
scan_int ();
1615
1591
n = cur_val ;
1616
1592
if (!scan_keyword ("to" )) {
1617
- if (file_line_error_style_p )
1618
- print_file_line ();
1619
- else
1620
- print_nl_cstr ("! " );
1621
- print_cstr ("Missing `to' inserted" );
1593
+ error_here_with_diagnostic ("Missing `to' inserted" );
1594
+ capture_to_diagnostic (NULL );
1622
1595
help_ptr = 2 ;
1623
1596
help_line [1 ] = "You should have said `\\read<number> to \\cs'." ;
1624
1597
help_line [0 ] = "I'm going to look for the \\cs now." ;
@@ -1890,17 +1863,14 @@ prefixed_command(void)
1890
1863
scan_int ();
1891
1864
1892
1865
if ((cur_val < 0 && p < DEL_CODE_BASE ) || cur_val > n ) {
1893
- if (file_line_error_style_p )
1894
- print_file_line ();
1895
- else
1896
- print_nl_cstr ("! " );
1897
- print_cstr ("Invalid code (" );
1866
+ error_here_with_diagnostic ("Invalid code (" );
1898
1867
print_int (cur_val );
1899
1868
if (p < DEL_CODE_BASE )
1900
1869
print_cstr ("), should be in the range 0.." );
1901
1870
else
1902
1871
print_cstr ("), should be at most " );
1903
1872
print_int (n );
1873
+ capture_to_diagnostic (NULL );
1904
1874
help_ptr = 1 ;
1905
1875
help_line [0 ] = "I'm going to use 0 instead of that illegal code value." ;
1906
1876
error ();
@@ -1967,12 +1937,9 @@ prefixed_command(void)
1967
1937
if (set_box_allowed ) {
1968
1938
scan_box (n );
1969
1939
} else {
1970
- if (file_line_error_style_p )
1971
- print_file_line ();
1972
- else
1973
- print_nl_cstr ("! " );
1974
- print_cstr ("Improper " );
1940
+ error_here_with_diagnostic ("Improper " );
1975
1941
print_esc_cstr ("setbox" );
1942
+ capture_to_diagnostic (NULL );
1976
1943
help_ptr = 2 ;
1977
1944
help_line [1 ] = "Sorry, \\setbox is not allowed after \\halign in a display," ;
1978
1945
help_line [0 ] = "or between \\accent and an accented character." ;
@@ -2047,11 +2014,8 @@ prefixed_command(void)
2047
2014
goto done ;
2048
2015
}
2049
2016
2050
- if (file_line_error_style_p )
2051
- print_file_line ();
2052
- else
2053
- print_nl_cstr ("! " );
2054
- print_cstr ("Patterns can be loaded only by INITEX" );
2017
+ error_here_with_diagnostic ("Patterns can be loaded only by INITEX" );
2018
+ capture_to_diagnostic (NULL );
2055
2019
help_ptr = 0 ;
2056
2020
error ();
2057
2021
@@ -2139,12 +2103,8 @@ store_fmt_file(void)
2139
2103
rust_output_handle_t fmt_out ;
2140
2104
2141
2105
if (save_ptr != 0 ) {
2142
- if (file_line_error_style_p )
2143
- print_file_line ();
2144
- else
2145
- print_nl_cstr ("! " );
2146
-
2147
- print_cstr ("You can't dump inside a group" );
2106
+ error_here_with_diagnostic ("You can't dump inside a group" );
2107
+ capture_to_diagnostic (NULL );
2148
2108
help_ptr = 1 ;
2149
2109
help_line [0 ] = "`{...\\dump}' is a no-no." ;
2150
2110
@@ -2405,11 +2365,8 @@ store_fmt_file(void)
2405
2365
if (font_area [k ] == AAT_FONT_FLAG || font_area [k ] == OTGR_FONT_FLAG || font_mapping [k ] != NULL ) {
2406
2366
print_file_name (font_name [k ], EMPTY_STRING , EMPTY_STRING );
2407
2367
2408
- if (file_line_error_style_p )
2409
- print_file_line ();
2410
- else
2411
- print_nl_cstr ("! " );
2412
- print_cstr ("Can't \\dump a format with native fonts or font-mappings" );
2368
+ error_here_with_diagnostic ("Can't \\dump a format with native fonts or font-mappings" );
2369
+ capture_to_diagnostic (NULL );
2413
2370
2414
2371
help_ptr = 3 ;
2415
2372
help_line [2 ] = "You really, really don't want to do this." ;
0 commit comments