/[gcl]/gcl/o/format.c
ViewVC logotype

Diff of /gcl/o/format.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by wfs, Mon Dec 6 22:44:11 1999 UTC revision 1.2 by camm, Sat Jul 20 07:10:55 2002 UTC
# Line 131  int fmt_line_length; Line 131  int fmt_line_length;
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");
# Line 145  ctl_advance() Line 145  ctl_advance()
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");
# Line 153  fmt_advance() Line 153  fmt_advance()
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;
# Line 400  DIRECTIVE: Line 398  DIRECTIVE:
398    
399    
400    
401  fmt_skip()  int
402    fmt_skip(void)
403  {  {
404          int c, level = 0;          int c, level = 0;
405                    
# Line 448  DIRECTIVE: Line 447  DIRECTIVE:
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;
# Line 488  int i, *p, t, v; Line 487  int i, *p, t, 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);
# Line 526  fmt_ascii(colon, atsign) Line 525  fmt_ascii(colon, atsign)
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);
# Line 564  fmt_S_expression(colon, atsign) Line 563  fmt_S_expression(colon, atsign)
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    
# Line 577  fmt_decimal(colon, atsign) Line 576  fmt_decimal(colon, atsign)
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    
# Line 590  fmt_binary(colon, atsign) Line 589  fmt_binary(colon, atsign)
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    
# Line 603  fmt_octal(colon, atsign) Line 602  fmt_octal(colon, atsign)
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    
# Line 616  fmt_hexadecimal(colon, atsign) Line 615  fmt_hexadecimal(colon, atsign)
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();
# Line 634  fmt_radix(colon, atsign) Line 633  fmt_radix(colon, atsign)
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                          }                          }
# Line 697  fmt_radix(colon, atsign) Line 696  fmt_radix(colon, atsign)
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;
# Line 756  fmt_integer(x, colon, atsign, radix, min Line 753  fmt_integer(x, colon, atsign, radix, min
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    
# Line 779  bool b, o; Line 774  bool b, o;
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)
# Line 792  bool b, o; Line 785  bool b, o;
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) {
# Line 838  bool b, o; Line 831  bool b, o;
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);
# Line 873  fmt_roman(i, one, five, ten, colon) Line 866  fmt_roman(i, one, five, ten, colon)
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) {
# Line 894  fmt_plural(colon, atsign) Line 887  fmt_plural(colon, atsign)
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;
# Line 915  fmt_character(colon, atsign) Line 908  fmt_character(colon, atsign)
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;
# Line 1071  OVER: Line 1064  OVER:
1064  }  }
1065    
1066  int  int
1067  fmt_exponent_length(e)  fmt_exponent_length(int e)
  int e;  
1068  {  {
1069          int i;          int i;
1070    
# Line 1085  fmt_exponent_length(e) Line 1077  fmt_exponent_length(e)
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);
# Line 1097  fmt_exponent(e) Line 1089  fmt_exponent(e)
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;
# Line 1106  fmt_exponent1(e) Line 1098  fmt_exponent1(e)
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;
# Line 1308  OVER: Line 1300  OVER:
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;
# Line 1398  fmt_general_float(colon, atsign) Line 1390  fmt_general_float(colon, atsign)
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;
# Line 1483  fmt_dollars_float(colon, atsign) Line 1475  fmt_dollars_float(colon, atsign)
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    
# Line 1500  fmt_percent(colon, atsign) Line 1492  fmt_percent(colon, atsign)
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    
# Line 1518  fmt_ampersand(colon, atsign) Line 1510  fmt_ampersand(colon, atsign)
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    
# Line 1531  fmt_bar(colon, atsign) Line 1523  fmt_bar(colon, atsign)
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    
# Line 1544  fmt_tilde(colon, atsign) Line 1536  fmt_tilde(colon, atsign)
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);
# Line 1560  fmt_newline(colon, atsign) Line 1551  fmt_newline(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;
# Line 1596  fmt_tabulate(colon, atsign) Line 1587  fmt_tabulate(colon, atsign)
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    
# Line 1620  fmt_asterisk(colon, atsign) Line 1611  fmt_asterisk(colon, atsign)
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();
# Line 1637  fmt_indirection(colon, atsign) Line 1629  fmt_indirection(colon, atsign)
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
# Line 1652  fmt_indirection(colon, atsign) Line 1644  fmt_indirection(colon, atsign)
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
# Line 1662  fmt_indirection(colon, atsign) Line 1654  fmt_indirection(colon, atsign)
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;
# Line 1680  fmt_case(colon, atsign) Line 1672  fmt_case(colon, atsign)
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);
# Line 1725  fmt_case(colon, atsign) Line 1717  fmt_case(colon, atsign)
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;
# Line 1819  fmt_conditional(colon, atsign) Line 1811  fmt_conditional(colon, atsign)
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;
# Line 1832  fmt_iteration(colon, atsign) Line 1824  fmt_iteration(colon, atsign)
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;
# Line 1859  fmt_iteration(colon, atsign) Line 1852  fmt_iteration(colon, atsign)
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;
# Line 1884  fmt_iteration(colon, atsign) Line 1877  fmt_iteration(colon, atsign)
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;
# Line 1904  fmt_iteration(colon, atsign) Line 1897  fmt_iteration(colon, atsign)
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;
# Line 1926  fmt_iteration(colon, atsign) Line 1919  fmt_iteration(colon, atsign)
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)
# Line 1943  fmt_iteration(colon, atsign) Line 1936  fmt_iteration(colon, atsign)
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];
# Line 1954  fmt_justification(colon, atsign) Line 1947  fmt_justification(colon, atsign)
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);
# Line 1975  fmt_justification(colon, atsign) Line 1969  fmt_justification(colon, atsign)
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 ~:^");
# Line 2041  fmt_justification(colon, atsign) Line 2035  fmt_justification(colon, atsign)
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    
# Line 2070  fmt_up_and_out(colon, atsign) Line 2064  fmt_up_and_out(colon, atsign)
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)
# Line 2128  DEFUNO("FORMAT",object,fLformat,LISP Line 2122  DEFUNO("FORMAT",object,fLformat,LISP
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;
# Line 2154  L: Line 2148  L:
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));
# Line 2167  fmt_error(s) Line 2160  fmt_error(s)
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);

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26