2013-05-14 15:11:29 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
1985-02-04 22:18:16 +00:00
|
|
|
#include "bc_string.h"
|
|
|
|
#include "bc_io.h"
|
1984-11-29 14:22:02 +00:00
|
|
|
|
1994-06-24 11:31:16 +00:00
|
|
|
/* $Id$ */
|
1984-11-29 14:22:02 +00:00
|
|
|
|
|
|
|
/* Here all routine to generate terminal oriented output is located */
|
|
|
|
|
|
|
|
_qstmark()
|
|
|
|
{
|
|
|
|
/* prompt for terminal input */
|
|
|
|
putchar('?');
|
|
|
|
}
|
|
|
|
|
|
|
|
_nl()
|
|
|
|
{
|
|
|
|
_asschn();
|
|
|
|
_outnl();
|
|
|
|
}
|
|
|
|
_prinum(i)
|
|
|
|
int i;
|
|
|
|
{
|
|
|
|
char buffer[40];
|
|
|
|
|
|
|
|
_asschn();
|
|
|
|
if(i>=0)
|
|
|
|
sprintf(buffer," %d ",i);
|
|
|
|
else sprintf(buffer,"-%d ",-i);
|
|
|
|
_out(buffer);
|
|
|
|
}
|
|
|
|
_str(f,buffer)
|
|
|
|
double f;
|
|
|
|
char *buffer;
|
|
|
|
{
|
1987-02-11 12:47:45 +00:00
|
|
|
register char *c = buffer;
|
|
|
|
int eformat = 0;
|
1984-11-29 14:22:02 +00:00
|
|
|
if( f>=0){
|
1987-02-11 12:47:45 +00:00
|
|
|
if( f> 1.0e8) {
|
|
|
|
eformat = 1;
|
1984-11-29 14:22:02 +00:00
|
|
|
sprintf(buffer," %e",f);
|
1987-02-11 12:47:45 +00:00
|
|
|
}
|
1984-11-29 14:22:02 +00:00
|
|
|
else sprintf(buffer," %f",f);
|
|
|
|
c++;
|
|
|
|
}else {
|
1987-02-11 12:47:45 +00:00
|
|
|
if(-f> 1.0e8) {
|
|
|
|
eformat = 1;
|
1984-11-29 14:22:02 +00:00
|
|
|
sprintf(buffer,"-%e",-f);
|
1987-02-11 12:47:45 +00:00
|
|
|
}
|
1984-11-29 14:22:02 +00:00
|
|
|
else sprintf(buffer,"-%f",-f);
|
|
|
|
}
|
1987-02-11 12:47:45 +00:00
|
|
|
if (! eformat) {
|
|
|
|
for( ; *c && *c!= ' ';c++) ;
|
|
|
|
c--;
|
|
|
|
while( c>buffer && *c== '0')
|
|
|
|
{
|
|
|
|
*c= 0;c--;
|
|
|
|
}
|
|
|
|
if( *c=='.') *c=0;
|
1984-11-29 14:22:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
_prfnum(f)
|
|
|
|
double f;
|
|
|
|
{
|
|
|
|
/* BASIC strings trailing zeroes */
|
|
|
|
char buffer[100];
|
|
|
|
char *c;
|
|
|
|
|
|
|
|
_asschn();
|
|
|
|
c= buffer;
|
|
|
|
_str(f,c);
|
1988-07-04 11:44:03 +00:00
|
|
|
strcat(buffer," ");
|
1984-11-29 14:22:02 +00:00
|
|
|
_out(buffer);
|
|
|
|
}
|
|
|
|
_prstr(str)
|
|
|
|
String *str;
|
|
|
|
{
|
|
|
|
_asschn();
|
|
|
|
if( str==0) _out("<null>");
|
|
|
|
else _out(str->strval);
|
|
|
|
}
|