131 |
|
|
132 |
|
|
133 |
int |
int |
134 |
fmt_tempstr(s) |
fmt_tempstr(int s) |
|
int s; |
|
135 |
{ |
{ |
136 |
return(fmt_temporary_string->st.st_self[s]); |
return(fmt_temporary_string->st.st_self[s]); |
137 |
} |
} |
138 |
|
|
139 |
ctl_advance() |
int |
140 |
|
ctl_advance(void) |
141 |
{ |
{ |
142 |
if (ctl_index >= ctl_end) |
if (ctl_index >= ctl_end) |
143 |
fmt_error("unexpected end of control string"); |
fmt_error("unexpected end of control string"); |
145 |
} |
} |
146 |
|
|
147 |
object |
object |
148 |
fmt_advance() |
fmt_advance(void) |
149 |
{ |
{ |
150 |
if (fmt_index >= fmt_end) |
if (fmt_index >= fmt_end) |
151 |
fmt_error("arguments exhausted"); |
fmt_error("arguments exhausted"); |
153 |
} |
} |
154 |
|
|
155 |
|
|
156 |
format(fmt_stream0, ctl_origin0, ctl_end0) |
void |
157 |
object fmt_stream0; |
format(object fmt_stream0, int ctl_origin0, int ctl_end0) |
|
int ctl_origin0; |
|
|
int ctl_end0; |
|
158 |
{ |
{ |
159 |
int c, i, n; |
int c, i, n; |
160 |
bool colon, atsign; |
bool colon, atsign; |
398 |
|
|
399 |
|
|
400 |
|
|
401 |
fmt_skip() |
int |
402 |
|
fmt_skip(void) |
403 |
{ |
{ |
404 |
int c, level = 0; |
int c, level = 0; |
405 |
|
|
447 |
} |
} |
448 |
|
|
449 |
|
|
450 |
fmt_max_param(n) |
void |
451 |
int n; |
fmt_max_param(int n) |
452 |
{ |
{ |
453 |
if (fmt_nparam > n) |
if (fmt_nparam > n) |
454 |
fmt_error("too many parameters"); |
fmt_error("too many parameters"); |
455 |
} |
} |
456 |
|
|
457 |
fmt_not_colon(colon) |
void |
458 |
bool colon; |
fmt_not_colon(bool colon) |
459 |
{ |
{ |
460 |
if (colon) |
if (colon) |
461 |
fmt_error("illegal :"); |
fmt_error("illegal :"); |
462 |
} |
} |
463 |
|
|
464 |
fmt_not_atsign(atsign) |
void |
465 |
bool atsign; |
fmt_not_atsign(bool atsign) |
466 |
{ |
{ |
467 |
if (atsign) |
if (atsign) |
468 |
fmt_error("illegal @"); |
fmt_error("illegal @"); |
469 |
} |
} |
470 |
|
|
471 |
fmt_not_colon_atsign(colon, atsign) |
void |
472 |
bool colon, atsign; |
fmt_not_colon_atsign(bool colon, bool atsign) |
473 |
{ |
{ |
474 |
if (colon && atsign) |
if (colon && atsign) |
475 |
fmt_error("illegal :@"); |
fmt_error("illegal :@"); |
476 |
} |
} |
477 |
|
|
478 |
fmt_set_param(i, p, t, v) |
void |
479 |
int i, *p, t, v; |
fmt_set_param(int i, int *p, int t, int v) |
480 |
{ |
{ |
481 |
if (i >= fmt_nparam || FMT_PARAM[i].fmt_param_type == fmt_null) |
if (i >= fmt_nparam || FMT_PARAM[i].fmt_param_type == fmt_null) |
482 |
*p = v; |
*p = v; |
487 |
} |
} |
488 |
|
|
489 |
|
|
490 |
fmt_ascii(colon, atsign) |
void |
491 |
bool colon,atsign; |
fmt_ascii(bool colon, bool atsign) |
492 |
{ |
{ |
493 |
int mincol, colinc, minpad, padchar; |
int mincol, colinc, minpad, padchar; |
494 |
object x; |
object x; |
495 |
int c, l, i; |
int l, i; |
496 |
|
|
497 |
fmt_max_param(4); |
fmt_max_param(4); |
498 |
fmt_set_param(0, &mincol, fmt_int, 0); |
fmt_set_param(0, &mincol, fmt_int, 0); |
525 |
} |
} |
526 |
} |
} |
527 |
|
|
528 |
fmt_S_expression(colon, atsign) |
void |
529 |
bool colon,atsign; |
fmt_S_expression(bool colon, bool atsign) |
530 |
{ |
{ |
531 |
int mincol, colinc, minpad, padchar; |
int mincol, colinc, minpad, padchar; |
532 |
object x; |
object x; |
533 |
int c, l, i; |
int l, i; |
534 |
|
|
535 |
fmt_max_param(4); |
fmt_max_param(4); |
536 |
fmt_set_param(0, &mincol, fmt_int, 0); |
fmt_set_param(0, &mincol, fmt_int, 0); |
563 |
} |
} |
564 |
} |
} |
565 |
|
|
566 |
fmt_decimal(colon, atsign) |
void |
567 |
bool colon,atsign; |
fmt_decimal(bool colon, bool atsign) |
568 |
{ |
{ |
569 |
int mincol, padchar, commachar; |
int mincol, padchar, commachar; |
570 |
|
|
576 |
10, mincol, padchar, commachar); |
10, mincol, padchar, commachar); |
577 |
} |
} |
578 |
|
|
579 |
fmt_binary(colon, atsign) |
void |
580 |
bool colon,atsign; |
fmt_binary(bool colon, bool atsign) |
581 |
{ |
{ |
582 |
int mincol, padchar, commachar; |
int mincol, padchar, commachar; |
583 |
|
|
589 |
2, mincol, padchar, commachar); |
2, mincol, padchar, commachar); |
590 |
} |
} |
591 |
|
|
592 |
fmt_octal(colon, atsign) |
void |
593 |
bool colon,atsign; |
fmt_octal(bool colon, bool atsign) |
594 |
{ |
{ |
595 |
int mincol, padchar, commachar; |
int mincol, padchar, commachar; |
596 |
|
|
602 |
8, mincol, padchar, commachar); |
8, mincol, padchar, commachar); |
603 |
} |
} |
604 |
|
|
605 |
fmt_hexadecimal(colon, atsign) |
void |
606 |
bool colon,atsign; |
fmt_hexadecimal(bool colon, bool atsign) |
607 |
{ |
{ |
608 |
int mincol, padchar, commachar; |
int mincol, padchar, commachar; |
609 |
|
|
615 |
16, mincol, padchar, commachar); |
16, mincol, padchar, commachar); |
616 |
} |
} |
617 |
|
|
618 |
fmt_radix(colon, atsign) |
void |
619 |
bool colon,atsign; |
fmt_radix(bool colon, bool atsign) |
620 |
{ |
{ |
621 |
int radix, mincol, padchar, commachar; |
int radix, mincol, padchar, commachar; |
622 |
object x; |
object x; |
623 |
int i, j, k; |
int i, j, k; |
624 |
int s, t; |
int s, t; |
625 |
bool b; |
bool b; |
626 |
extern (*write_ch_fun)(), writec_PRINTstream(); |
extern void (*write_ch_fun)(int), writec_PRINTstream(int); |
627 |
|
|
628 |
if (fmt_nparam == 0) { |
if (fmt_nparam == 0) { |
629 |
x = fmt_advance(); |
x = fmt_advance(); |
633 |
i = fix(x); |
i = fix(x); |
634 |
else |
else |
635 |
i = -1; |
i = -1; |
636 |
if (!colon && (i <= 0 || i >= 4000) || |
if ((!colon && (i <= 0 || i >= 4000)) || |
637 |
colon && (i <= 0 || i >= 5000)) { |
(colon && (i <= 0 || i >= 5000))) { |
638 |
fmt_integer(x, FALSE, FALSE, 10, 0, ' ', ','); |
fmt_integer(x, FALSE, FALSE, 10, 0, ' ', ','); |
639 |
return; |
return; |
640 |
} |
} |
696 |
fmt_integer(x, colon, atsign, radix, mincol, padchar, commachar); |
fmt_integer(x, colon, atsign, radix, mincol, padchar, commachar); |
697 |
} |
} |
698 |
|
|
699 |
fmt_integer(x, colon, atsign, radix, mincol, padchar, commachar) |
void |
700 |
bool colon,atsign; |
fmt_integer(object x, bool colon, bool atsign, int radix, int mincol, int padchar, int commachar) |
|
int radix, mincol, padchar, commachar; |
|
|
object x; |
|
701 |
{ |
{ |
702 |
int l, l1; |
int l, l1; |
703 |
int s; |
int s; |
704 |
extern (*write_ch_fun)(), writec_PRINTstream(); |
extern void (*write_ch_fun)(int), writec_PRINTstream(int); |
705 |
|
|
706 |
if (type_of(x) != t_fixnum && type_of(x) != t_bignum) { |
if (type_of(x) != t_fixnum && type_of(x) != t_bignum) { |
707 |
fmt_temporary_string->st.st_fillp = 0; |
fmt_temporary_string->st.st_fillp = 0; |
753 |
} |
} |
754 |
} |
} |
755 |
|
|
756 |
fmt_nonillion(s, i, b, o, t) |
int |
757 |
int s, t; |
fmt_nonillion(int s, int i, bool b, bool o, int t) |
|
int i; |
|
|
bool b, o; |
|
758 |
{ |
{ |
759 |
int j; |
int j; |
760 |
|
|
774 |
return(fmt_thousand(s, i, b, o, t)); |
return(fmt_thousand(s, i, b, o, t)); |
775 |
} |
} |
776 |
|
|
777 |
fmt_thousand(s, i, b, o, t) |
int |
778 |
int s, t; |
fmt_thousand(int s, int i, bool b, bool o, int t) |
|
int i; |
|
|
bool b, o; |
|
779 |
{ |
{ |
780 |
if (i == 3 && fmt_tempstr(s) > '0') { |
if (i == 3 && fmt_tempstr(s) > '0') { |
781 |
if (b) |
if (b) |
785 |
--i; |
--i; |
786 |
s++; |
s++; |
787 |
b = TRUE; |
b = TRUE; |
788 |
if (o & s > t) |
if (o && s > t) |
789 |
writestr_stream("th", fmt_stream); |
writestr_stream("th", fmt_stream); |
790 |
} |
} |
791 |
if (i == 3) { |
if (i == 3) { |
831 |
return(b); |
return(b); |
832 |
} |
} |
833 |
|
|
834 |
fmt_write_numeral(s, i) |
void |
835 |
int s, i; |
fmt_write_numeral(int s, int i) |
836 |
{ |
{ |
837 |
writestr_stream(fmt_numeral[fmt_tempstr(s) - '0' + i], fmt_stream); |
writestr_stream(fmt_numeral[fmt_tempstr(s) - '0' + i], fmt_stream); |
838 |
} |
} |
839 |
|
|
840 |
fmt_write_ordinal(s, i) |
void |
841 |
int s, i; |
fmt_write_ordinal(int s, int i) |
842 |
{ |
{ |
843 |
writestr_stream(fmt_ordinal[fmt_tempstr(s) - '0' + i], fmt_stream); |
writestr_stream(fmt_ordinal[fmt_tempstr(s) - '0' + i], fmt_stream); |
844 |
} |
} |
845 |
|
|
846 |
fmt_roman(i, one, five, ten, colon) |
void |
847 |
int i, one, five, ten, colon; |
fmt_roman(int i, int one, int five, int ten, int colon) |
848 |
{ |
{ |
849 |
int j; |
int j; |
850 |
|
|
851 |
if (i == 0) |
if (i == 0) |
852 |
return; |
return; |
853 |
if (!colon && i < 4 || colon && i < 5) |
if ((!colon && i < 4) || (colon && i < 5)) |
854 |
for (j = 0; j < i; j++) |
for (j = 0; j < i; j++) |
855 |
writec_stream(one, fmt_stream); |
writec_stream(one, fmt_stream); |
856 |
else if (!colon && i == 4) { |
else if (!colon && i == 4) { |
857 |
writec_stream(one, fmt_stream); |
writec_stream(one, fmt_stream); |
858 |
writec_stream(five, fmt_stream); |
writec_stream(five, fmt_stream); |
859 |
} else if (!colon && i < 9 || colon) { |
} else if ((!colon && i < 9) || colon) { |
860 |
writec_stream(five, fmt_stream); |
writec_stream(five, fmt_stream); |
861 |
for (j = 5; j < i; j++) |
for (j = 5; j < i; j++) |
862 |
writec_stream(one, fmt_stream); |
writec_stream(one, fmt_stream); |
866 |
} |
} |
867 |
} |
} |
868 |
|
|
869 |
fmt_plural(colon, atsign) |
void |
870 |
bool colon,atsign; |
fmt_plural(bool colon, bool atsign) |
871 |
{ |
{ |
872 |
fmt_max_param(0); |
fmt_max_param(0); |
873 |
if (colon) { |
if (colon) { |
887 |
writec_stream('s', fmt_stream); |
writec_stream('s', fmt_stream); |
888 |
} |
} |
889 |
|
|
890 |
fmt_character(colon, atsign) |
void |
891 |
bool colon,atsign; |
fmt_character(bool colon, bool atsign) |
892 |
{ |
{ |
893 |
object x; |
object x; |
894 |
int i; |
int i; |
908 |
writec_stream(fmt_tempstr(i), fmt_stream); |
writec_stream(fmt_tempstr(i), fmt_stream); |
909 |
} |
} |
910 |
|
|
911 |
fmt_fix_float(colon, atsign) |
void |
912 |
bool colon,atsign; |
fmt_fix_float(bool colon, bool atsign) |
913 |
{ |
{ |
914 |
int w, d, k, overflowchar, padchar; |
int w, d, k, overflowchar, padchar; |
915 |
double f; |
double f; |
1064 |
} |
} |
1065 |
|
|
1066 |
int |
int |
1067 |
fmt_exponent_length(e) |
fmt_exponent_length(int e) |
|
int e; |
|
1068 |
{ |
{ |
1069 |
int i; |
int i; |
1070 |
|
|
1077 |
return(i); |
return(i); |
1078 |
} |
} |
1079 |
|
|
1080 |
fmt_exponent(e) |
void |
1081 |
int e; |
fmt_exponent(int e) |
1082 |
{ |
{ |
1083 |
if (e == 0) { |
if (e == 0) { |
1084 |
writec_stream('0', fmt_stream); |
writec_stream('0', fmt_stream); |
1089 |
fmt_exponent1(e); |
fmt_exponent1(e); |
1090 |
} |
} |
1091 |
|
|
1092 |
fmt_exponent1(e) |
void |
1093 |
int e; |
fmt_exponent1(int e) |
1094 |
{ |
{ |
1095 |
if (e == 0) |
if (e == 0) |
1096 |
return; |
return; |
1098 |
writec_stream('0' + e%10, fmt_stream); |
writec_stream('0' + e%10, fmt_stream); |
1099 |
} |
} |
1100 |
|
|
1101 |
fmt_exponential_float(colon, atsign) |
void |
1102 |
bool colon,atsign; |
fmt_exponential_float(bool colon, bool atsign) |
1103 |
{ |
{ |
1104 |
int w, d, e, k, overflowchar, padchar, exponentchar; |
int w, d, e, k, overflowchar, padchar, exponentchar; |
1105 |
double f; |
double f; |
1300 |
return; |
return; |
1301 |
} |
} |
1302 |
|
|
1303 |
fmt_general_float(colon, atsign) |
void |
1304 |
bool colon,atsign; |
fmt_general_float(bool colon, bool atsign) |
1305 |
{ |
{ |
1306 |
int w, d, e, k, overflowchar, padchar, exponentchar; |
int w, d, e, k, overflowchar, padchar, exponentchar; |
1307 |
int sign, exp; |
int sign, exp; |
1390 |
vs_reset; |
vs_reset; |
1391 |
} |
} |
1392 |
|
|
1393 |
fmt_dollars_float(colon, atsign) |
void |
1394 |
bool colon,atsign; |
fmt_dollars_float(bool colon, bool atsign) |
1395 |
{ |
{ |
1396 |
int d, n, w, padchar; |
int d, n, w, padchar; |
1397 |
double f; |
double f; |
1475 |
vs_reset; |
vs_reset; |
1476 |
} |
} |
1477 |
|
|
1478 |
fmt_percent(colon, atsign) |
void |
1479 |
bool colon,atsign; |
fmt_percent(bool colon, bool atsign) |
1480 |
{ |
{ |
1481 |
int n, i; |
int n, i; |
1482 |
|
|
1492 |
} |
} |
1493 |
} |
} |
1494 |
|
|
1495 |
fmt_ampersand(colon, atsign) |
void |
1496 |
bool colon,atsign; |
fmt_ampersand(bool colon, bool atsign) |
1497 |
{ |
{ |
1498 |
int n; |
int n; |
1499 |
|
|
1510 |
fmt_indents = 0; |
fmt_indents = 0; |
1511 |
} |
} |
1512 |
|
|
1513 |
fmt_bar(colon, atsign) |
void |
1514 |
bool colon,atsign; |
fmt_bar(bool colon, bool atsign) |
1515 |
{ |
{ |
1516 |
int n; |
int n; |
1517 |
|
|
1523 |
writec_stream('\f', fmt_stream); |
writec_stream('\f', fmt_stream); |
1524 |
} |
} |
1525 |
|
|
1526 |
fmt_tilde(colon, atsign) |
void |
1527 |
bool colon,atsign; |
fmt_tilde(bool colon, bool atsign) |
1528 |
{ |
{ |
1529 |
int n; |
int n; |
1530 |
|
|
1536 |
writec_stream('~', fmt_stream); |
writec_stream('~', fmt_stream); |
1537 |
} |
} |
1538 |
|
|
1539 |
fmt_newline(colon, atsign) |
void |
1540 |
bool colon,atsign; |
fmt_newline(bool colon, bool atsign) |
1541 |
{ |
{ |
|
int c; |
|
1542 |
|
|
1543 |
fmt_max_param(0); |
fmt_max_param(0); |
1544 |
fmt_not_colon_atsign(colon, atsign); |
fmt_not_colon_atsign(colon, atsign); |
1551 |
} |
} |
1552 |
} |
} |
1553 |
|
|
1554 |
fmt_tabulate(colon, atsign) |
void |
1555 |
bool colon,atsign; |
fmt_tabulate(bool colon, bool atsign) |
1556 |
{ |
{ |
1557 |
int colnum, colinc; |
int colnum, colinc; |
1558 |
int c, i; |
int c, i; |
1587 |
} |
} |
1588 |
} |
} |
1589 |
|
|
1590 |
fmt_asterisk(colon, atsign) |
void |
1591 |
bool colon,atsign; |
fmt_asterisk(bool colon, bool atsign) |
1592 |
{ |
{ |
1593 |
int n; |
int n; |
1594 |
|
|
1611 |
} |
} |
1612 |
} |
} |
1613 |
|
|
1614 |
fmt_indirection(colon, atsign) |
void |
1615 |
bool colon,atsign; |
fmt_indirection(bool colon, bool atsign) |
1616 |
{ object endp_temp; |
{ object endp_temp; |
1617 |
object s, l; |
object s, l; |
1618 |
fmt_old; |
fmt_old; |
1619 |
jmp_buf fmt_jmp_buf0; |
jmp_buf fmt_jmp_buf0; |
1620 |
int up_colon; |
int up_colon; |
1621 |
|
|
1622 |
|
up_colon=(int)&old_fmt_paramp; |
1623 |
fmt_max_param(0); |
fmt_max_param(0); |
1624 |
fmt_not_colon(colon); |
fmt_not_colon(colon); |
1625 |
s = fmt_advance(); |
s = fmt_advance(); |
1629 |
fmt_save; |
fmt_save; |
1630 |
fmt_jmp_bufp = &fmt_jmp_buf0; |
fmt_jmp_bufp = &fmt_jmp_buf0; |
1631 |
fmt_string = s; |
fmt_string = s; |
1632 |
if (up_colon = setjmp(*fmt_jmp_bufp)) { |
if ((up_colon = setjmp(*fmt_jmp_bufp))) { |
1633 |
if (--up_colon) |
if (--up_colon) |
1634 |
fmt_error("illegal ~:^"); |
fmt_error("illegal ~:^"); |
1635 |
} else |
} else |
1644 |
vs_check_push(l->c.c_car); |
vs_check_push(l->c.c_car); |
1645 |
fmt_jmp_bufp = &fmt_jmp_buf0; |
fmt_jmp_bufp = &fmt_jmp_buf0; |
1646 |
fmt_string = s; |
fmt_string = s; |
1647 |
if (up_colon = setjmp(*fmt_jmp_bufp)) { |
if ((up_colon = setjmp(*fmt_jmp_bufp))) { |
1648 |
if (--up_colon) |
if (--up_colon) |
1649 |
fmt_error("illegal ~:^"); |
fmt_error("illegal ~:^"); |
1650 |
} else |
} else |
1654 |
} |
} |
1655 |
} |
} |
1656 |
|
|
1657 |
fmt_case(colon, atsign) |
void |
1658 |
bool colon,atsign; |
fmt_case(bool colon, bool atsign) |
1659 |
{ |
{ |
1660 |
VOL object x; |
VOL object x; |
1661 |
VOL int i, j; |
VOL int i, j; |
1672 |
fmt_error("~) expected"); |
fmt_error("~) expected"); |
1673 |
fmt_save; |
fmt_save; |
1674 |
fmt_jmp_bufp = &fmt_jmp_buf0; |
fmt_jmp_bufp = &fmt_jmp_buf0; |
1675 |
if (up_colon = setjmp(*fmt_jmp_bufp)) |
if ((up_colon = setjmp(*fmt_jmp_bufp))) |
1676 |
; |
; |
1677 |
else |
else |
1678 |
format(x, ctl_origin + i, j - i); |
format(x, ctl_origin + i, j - i); |
1717 |
j -= 'a' - 'A'; |
j -= 'a' - 'A'; |
1718 |
writec_stream(j, fmt_stream); |
writec_stream(j, fmt_stream); |
1719 |
} |
} |
1720 |
vs_pop; |
vs_popp; |
1721 |
if (up_colon) |
if (up_colon) |
1722 |
longjmp(*fmt_jmp_bufp, up_colon); |
longjmp(*fmt_jmp_bufp, up_colon); |
1723 |
} |
} |
1724 |
|
|
1725 |
fmt_conditional(colon, atsign) |
void |
1726 |
bool colon,atsign; |
fmt_conditional(bool colon, bool atsign) |
1727 |
{ |
{ |
1728 |
int i, j, k; |
int i, j, k; |
1729 |
object x; |
object x; |
1811 |
} |
} |
1812 |
} |
} |
1813 |
|
|
1814 |
fmt_iteration(colon, atsign) |
void |
1815 |
bool colon,atsign; |
fmt_iteration(bool colon, bool atsign) |
1816 |
{ object endp_temp; |
{ object endp_temp; |
1817 |
int i,n; |
int i,n; |
1818 |
VOL int j; |
VOL int j; |
1824 |
jmp_buf fmt_jmp_buf0; |
jmp_buf fmt_jmp_buf0; |
1825 |
int up_colon; |
int up_colon; |
1826 |
|
|
1827 |
|
up_colon=(int)&old_fmt_paramp; |
1828 |
fmt_max_param(1); |
fmt_max_param(1); |
1829 |
fmt_set_param(0, &n, fmt_int, 1000000); |
fmt_set_param(0, &n, fmt_int, 1000000); |
1830 |
i = ctl_index; |
i = ctl_index; |
1852 |
L1: |
L1: |
1853 |
if (n-- <= 0) |
if (n-- <= 0) |
1854 |
break; |
break; |
1855 |
if (up_colon = setjmp(*fmt_jmp_bufp)) { |
if ((up_colon = setjmp(*fmt_jmp_bufp))) { |
1856 |
if (--up_colon) |
if (--up_colon) |
1857 |
fmt_error("illegal ~:^"); |
fmt_error("illegal ~:^"); |
1858 |
break; |
break; |
1877 |
fmt_index = 0; |
fmt_index = 0; |
1878 |
for (fmt_end = 0; !endp(l); fmt_end++, l = l->c.c_cdr) |
for (fmt_end = 0; !endp(l); fmt_end++, l = l->c.c_cdr) |
1879 |
vs_check_push(l->c.c_car); |
vs_check_push(l->c.c_car); |
1880 |
if (up_colon = setjmp(*fmt_jmp_bufp)) { |
if ((up_colon = setjmp(*fmt_jmp_bufp))) { |
1881 |
vs_top = fmt_base; |
vs_top = fmt_base; |
1882 |
if (--up_colon) |
if (--up_colon) |
1883 |
break; |
break; |
1897 |
L3: |
L3: |
1898 |
if (n-- <= 0) |
if (n-- <= 0) |
1899 |
break; |
break; |
1900 |
if (up_colon = setjmp(*fmt_jmp_bufp)) { |
if ((up_colon = setjmp(*fmt_jmp_bufp))) { |
1901 |
if (--up_colon) |
if (--up_colon) |
1902 |
fmt_error("illegal ~:^"); |
fmt_error("illegal ~:^"); |
1903 |
break; |
break; |
1919 |
for (fmt_end = 0; !endp(l); fmt_end++, l = l->c.c_cdr) |
for (fmt_end = 0; !endp(l); fmt_end++, l = l->c.c_cdr) |
1920 |
vs_check_push(l->c.c_car); |
vs_check_push(l->c.c_car); |
1921 |
fmt_jmp_bufp = &fmt_jmp_buf0; |
fmt_jmp_bufp = &fmt_jmp_buf0; |
1922 |
if (up_colon = setjmp(*fmt_jmp_bufp)) { |
if ((up_colon = setjmp(*fmt_jmp_bufp))) { |
1923 |
vs_top = fmt_base; |
vs_top = fmt_base; |
1924 |
fmt_restore; |
fmt_restore; |
1925 |
if (--up_colon) |
if (--up_colon) |
1936 |
|
|
1937 |
#define FORMAT_DIRECTIVE_LIMIT 100 |
#define FORMAT_DIRECTIVE_LIMIT 100 |
1938 |
|
|
1939 |
fmt_justification(colon, atsign) |
void |
1940 |
bool colon,atsign; |
fmt_justification(volatile bool colon, bool atsign) |
1941 |
{ |
{ |
1942 |
int mincol, colinc, minpad, padchar; |
int mincol, colinc, minpad, padchar; |
1943 |
object fields[FORMAT_DIRECTIVE_LIMIT]; |
object fields[FORMAT_DIRECTIVE_LIMIT]; |
1947 |
int k,l,m,l0; |
int k,l,m,l0; |
1948 |
int up_colon; |
int up_colon; |
1949 |
VOL int special = 0; |
VOL int special = 0; |
1950 |
int spare_spaces, line_length; |
volatile int spare_spaces=0, line_length=0; |
1951 |
vs_mark; |
vs_mark; |
1952 |
|
|
1953 |
|
up_colon=(int)&old_fmt_paramp; |
1954 |
fmt_max_param(4); |
fmt_max_param(4); |
1955 |
fmt_set_param(0, &mincol, fmt_int, 0); |
fmt_set_param(0, &mincol, fmt_int, 0); |
1956 |
fmt_set_param(1, &colinc, fmt_int, 1); |
fmt_set_param(1, &colinc, fmt_int, 1); |
1969 |
vs_push(fields[n]); |
vs_push(fields[n]); |
1970 |
fmt_save; |
fmt_save; |
1971 |
fmt_jmp_bufp = &fmt_jmp_buf0; |
fmt_jmp_bufp = &fmt_jmp_buf0; |
1972 |
if (up_colon = setjmp(*fmt_jmp_bufp)) { |
if ((up_colon = setjmp(*fmt_jmp_bufp))) { |
1973 |
--n; |
--n; |
1974 |
if (--up_colon) |
if (--up_colon) |
1975 |
fmt_error("illegal ~:^"); |
fmt_error("illegal ~:^"); |
2035 |
} |
} |
2036 |
|
|
2037 |
|
|
2038 |
fmt_up_and_out(colon, atsign) |
void |
2039 |
bool colon,atsign; |
fmt_up_and_out(bool colon, bool atsign) |
2040 |
{ |
{ |
2041 |
int i, j, k; |
int i, j, k; |
2042 |
|
|
2064 |
} |
} |
2065 |
|
|
2066 |
|
|
2067 |
fmt_semicolon(colon, atsign) |
void |
2068 |
bool colon,atsign; |
fmt_semicolon(bool colon, bool atsign) |
2069 |
{ |
{ |
2070 |
fmt_not_atsign(atsign); |
fmt_not_atsign(atsign); |
2071 |
if (!colon) |
if (!colon) |
2122 |
else |
else |
2123 |
fmt_indents = 0; |
fmt_indents = 0; |
2124 |
fmt_string = control; |
fmt_string = control; |
2125 |
if (colon = setjmp(*fmt_jmp_bufp)) { |
if ((colon = setjmp(*fmt_jmp_bufp))) { |
2126 |
if (--colon) |
if (--colon) |
2127 |
fmt_error("illegal ~:^"); |
fmt_error("illegal ~:^"); |
2128 |
vs_base = vs_top; |
vs_base = vs_top; |
2148 |
RETURN1 (x ==0 ? Cnil : x); |
RETURN1 (x ==0 ? Cnil : x); |
2149 |
} |
} |
2150 |
|
|
2151 |
object c_apply_n(); |
/* object c_apply_n(long int (*fn) (), int n, object *x); */ |
|
|
|
2152 |
|
|
2153 |
fmt_error(s) |
void |
2154 |
char *s; |
fmt_error(char *s) |
2155 |
{ |
{ |
2156 |
vs_push(make_simple_string(s)); |
vs_push(make_simple_string(s)); |
2157 |
vs_push(make_fixnum(&ctl_string[ctl_index] - fmt_string->st.st_self)); |
vs_push(make_fixnum(&ctl_string[ctl_index] - fmt_string->st.st_self)); |
2160 |
} |
} |
2161 |
|
|
2162 |
DEFVAR("*INDENT-FORMATTED-OUTPUT*",sSAindent_formatted_outputA,SI,Cnil,""); |
DEFVAR("*INDENT-FORMATTED-OUTPUT*",sSAindent_formatted_outputA,SI,Cnil,""); |
2163 |
init_format() |
void |
2164 |
|
init_format(void) |
2165 |
{ |
{ |
2166 |
fmt_temporary_stream = make_string_output_stream(64); |
fmt_temporary_stream = make_string_output_stream(64); |
2167 |
enter_mark_origin(&fmt_temporary_stream); |
enter_mark_origin(&fmt_temporary_stream); |