/[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.18 by camm, Tue Nov 15 06:24:54 2005 UTC revision 1.19 by camm, Wed Nov 16 01:03:47 2005 UTC
# Line 759  fmt_radix(bool colon, bool atsign) Line 759  fmt_radix(bool colon, bool atsign)
759          bool b;          bool b;
760          extern void (*write_ch_fun)(int), writec_PRINTstream(int);          extern void (*write_ch_fun)(int), writec_PRINTstream(int);
761    
762          if (fmt_nparam == 0) {          fmt_max_param(5);
763            fmt_set_param(0, &radix, fmt_int, -1);
764            if (radix==-1) {
765                  x = fmt_advance();                  x = fmt_advance();
766                  check_type_integer(&x);                  check_type_integer(&x);
767                  if (atsign) {                  if (atsign) {
# Line 816  fmt_radix(bool colon, bool atsign) Line 818  fmt_radix(bool colon, bool atsign)
818                  }                  }
819                  return;                  return;
820          }          }
821          fmt_max_param(5);          fmt_set_param(0, &radix, fmt_int, -1);
         fmt_set_param(0, &radix, fmt_int, 10);  
822          fmt_set_param(1, &mincol, fmt_int, 0);          fmt_set_param(1, &mincol, fmt_int, 0);
823          fmt_set_param(2, &padchar, fmt_char, ' ');          fmt_set_param(2, &padchar, fmt_char, ' ');
824          fmt_set_param(3, &commachar, fmt_char, ',');          fmt_set_param(3, &commachar, fmt_char, ',');
# Line 840  fmt_integer(object x, bool colon, bool a Line 841  fmt_integer(object x, bool colon, bool a
841    
842          mincol=BOUND_MINCOL(mincol);          mincol=BOUND_MINCOL(mincol);
843          if (type_of(x) != t_fixnum && type_of(x) != t_bignum) {          if (type_of(x) != t_fixnum && type_of(x) != t_bignum) {
844                  fmt_temporary_string->st.st_fillp = 0;                  object fts,ftm;/*FIXME more comprehensive solution
845                  /* fmt_temporary_stream->sm.sm_int0 = file_column(fmt_stream); */                                   here, but this avoids some recursive
846                  STREAM_FILE_COLUMN(fmt_temporary_stream) = file_column(fmt_stream);                                   use of the temporaries*/
847                    ftm=make_string_output_stream(64);
848                    fts=ftm->sm.sm_object0;
849                    fts->st.st_fillp = 0;
850                    /* ftm->sm.sm_int0 = file_column(fmt_stream); */
851                    STREAM_FILE_COLUMN(ftm) = file_column(fmt_stream);
852                  {SETUP_PRINT_DEFAULT(x);                  {SETUP_PRINT_DEFAULT(x);
853                  PRINTstream = fmt_temporary_stream;                  PRINTstream = ftm;
854                  PRINTescape = FALSE;                  PRINTescape = FALSE;
855                  PRINTbase = radix;                  PRINTbase = radix;
856                  write_ch_fun = writec_PRINTstream;                  write_ch_fun = writec_PRINTstream;
857                  write_object(x, 0);                  write_object(x, 0);
858                  CLEANUP_PRINT_DEFAULT;}                  CLEANUP_PRINT_DEFAULT;}
859                  l = fmt_temporary_string->st.st_fillp;                  l = fts->st.st_fillp;
860                  mincol -= l;                  mincol -= l;
861                  while (mincol-- > 0)                  while (mincol-- > 0)
862                          writec_stream(padchar, fmt_stream);                          writec_stream(padchar, fmt_stream);
863                  for (s = 0;  l > 0;  --l, s++)                  for (s = 0;  l > 0;  --l, s++)
864                          writec_stream(fmt_tempstr(s), fmt_stream);                          writec_stream(fts->st.st_self[s], fmt_stream);
865                  return;                  return;
866          }          }
867          fmt_temporary_string->st.st_fillp = 0;          fmt_temporary_string->st.st_fillp = 0;
# Line 1028  fmt_character(bool colon, bool atsign) Line 1034  fmt_character(bool colon, bool atsign)
1034  {  {
1035          object x;          object x;
1036          int i;          int i;
1037            int c1[]={'\r',' ','\177','\f','\t','\b','\n',0},*c;
1038    
1039          fmt_max_param(0);          fmt_max_param(0);
         fmt_temporary_string->st.st_fillp = 0;  
         /* fmt_temporary_stream->sm.sm_int0 = 0;*/  
         STREAM_FILE_COLUMN(fmt_temporary_stream) = 0;  
1040          x = fmt_advance();          x = fmt_advance();
1041          check_type_character(&x);          check_type_character(&x);
1042          prin1(x, fmt_temporary_stream);          
1043          if (!colon && atsign)          for (c=c1;*c && *c!=x->ch.ch_code;c++);
1044                  i = 0;          if (colon ? *c : atsign) {
1045          else  
1046                  i = 2;            i=(!colon && atsign) ? 0 : 2;
1047          for (;  i < fmt_temporary_string->st.st_fillp;  i++)  
1048                  writec_stream(fmt_tempstr(i), fmt_stream);            fmt_temporary_string->st.st_fillp = 0;
1049              /* fmt_temporary_stream->sm.sm_int0 = 0;*/
1050              STREAM_FILE_COLUMN(fmt_temporary_stream) = 0;
1051              prin1(x, fmt_temporary_stream);
1052    
1053              for (;  i < fmt_temporary_string->st.st_fillp;  i++)
1054                writec_stream(fmt_tempstr(i), fmt_stream);
1055    
1056            } else
1057              writec_stream(x->ch.ch_code, fmt_stream);
1058    
1059  }  }
1060    
1061  static void  static void
# Line 2331  L: Line 2345  L:
2345          } else          } else
2346          switch (type_of(control)) {          switch (type_of(control)) {
2347              case t_cfun:              case t_cfun:
2348                case t_ifun:
2349              case t_gfun:              case t_gfun:
2350              case t_sfun:              case t_sfun:
2351              case t_vfun:              case t_vfun:

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

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