Corretti errori nel posizionamento dopo i codici di colore

e nella formattazione dei long ????


git-svn-id: svn://10.65.10.50/trunk@84 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1994-08-29 11:04:37 +00:00
parent 053739a3f7
commit 833e3df2ef

View File

@ -1,4 +1,4 @@
// $Id: printapp.cpp,v 1.3 1994-08-18 07:43:44 villa Exp $
// $Id: printapp.cpp,v 1.4 1994-08-29 11:04:37 alex Exp $
#include <ctype.h>
#include <stdarg.h>
@ -699,15 +699,15 @@ set_row (int r, const char *frmt,...)
case 'o':
case 'x':
case 'X':
q.format (t, islong ? va_arg (params, int) :
va_arg (params, long));
q.format (t, islong ? va_arg (params, long) :
va_arg (params, int));
break;
case 'f':
case 'e':
case 'E':
case 'G':
q.format (t, islong ? va_arg (params, float) :
va_arg (params, double));
q.format (t, islong ? va_arg (params, double) :
va_arg (params, float));
break;
case 'c':
q.format (t, va_arg (params, char));
@ -1091,66 +1091,81 @@ print_one (int file)
}
else if (t->tag () == 0)
{
// it's a _PrintfTok
_PrintfTok *pt = (_PrintfTok *) t;
TString v = pt->_val;
((TPrintrow *) (&rw[pt->row ()]))->put (v, pos[pt->row ()]);
if (pos[pt->row ()] != -1)
{
// it's a _PrintfTok
_PrintfTok *pt = (_PrintfTok *) t;
TString v = pt->_val;
((TPrintrow *) (&rw[pt->row ()]))->put (v, pos[pt->row ()]);
if (pos[pt->row ()] != -1)
pos[pt->row ()] += v.len ();
pos[pt->row ()] += v.len ();
const char * s = v;
while (*s && strncmp(s, "$[", 2) == 0)
{
while (*s && *s != ']')
{
pos[pt->row()]--;
s++;
}
if (*s)
pos[pt->row()]--;
while (*s && *s != '$') s++;
}
}
else if (t->tag () == 2)
}
else
if (t->tag () == 2)
{
// printf by reference
_PrintfRef *pr = (_PrintfRef *) t;
TString ps;
bool islong = (pr->_fmt).find ('l') != -1;
switch (pr->_type)
{
case 'd':
case 'i':
case 'u':
case 'o':
case 'x':
case 'X':
ps.format (pr->_fmt, islong ? *((long *) (pr->_what)) :
*((int *) (pr->_what)));
break;
case 'f':
case 'e':
ps.format (pr->_fmt, islong ? *((double *) (pr->_what)) :
*((float *) (pr->_what)));
break;
case 'c':
ps.format (pr->_fmt, *((char *) (pr->_what)));
break;
case 's':
ps.format (pr->_fmt, (char *) (pr->_what));
break;
case 't':
ps.format (pr->_fmt, (const char *)
(*((TString *) (pr->_what))));
break;
case 'r':
{
real *rrr = (real *) pr->_what;
if (pr->_fmt.len () == 2 && *_picture)
{
case 'd':
case 'i':
case 'u':
case 'o':
case 'x':
case 'X':
ps.format (pr->_fmt, islong ? *((int *) (pr->_what)) :
*((long *) (pr->_what)));
break;
case 'f':
case 'e':
ps.format (pr->_fmt, islong ? *((float *) (pr->_what)) :
*((double *) (pr->_what)));
break;
case 'c':
ps.format (pr->_fmt, *((char *) (pr->_what)));
break;
case 's':
ps.format (pr->_fmt, (char *) (pr->_what));
break;
case 't':
ps.format (pr->_fmt, (const char *)
(*((TString *) (pr->_what))));
break;
case 'r':
{
real *rrr = (real *) pr->_what;
if (pr->_fmt.len () == 2 && *_picture)
{
strcpy (__tmp_string, rrr->string (_picture));
}
else
{
char *fff = (char *) ((const char *) pr->_fmt);
dsprintf (__tmp_string, fff,
// (DEC*)*((real*)(pr->_what)));
((real *) pr->_what)->ptr ());
}
ps = __tmp_string;
if (rrr->is_zero () && !_print_zero)
ps.fill (' ');
break;
}
strcpy (__tmp_string, rrr->string (_picture));
}
else
{
char *fff = (char *) ((const char *) pr->_fmt);
dsprintf (__tmp_string, fff,
// (DEC*)*((real*)(pr->_what)));
((real *) pr->_what)->ptr ());
}
ps = __tmp_string;
if (rrr->is_zero () && !_print_zero)
ps.fill (' ');
break;
}
}
ps = fill_str (ps, _fillchar);
((TPrintrow *) (&rw[pr->row ()]))->