* src/parser/output.c src/parser/output.h: Moved these files

to src/misc directory.

	* src/include/terminal.h src/misc/terminal.c
	src/misc/terminal.h: new home to output.[ch] files.

	* src/parser/Makefile.am src/misc/Makefile.am: Updated for move.
This commit is contained in:
arno 2000-05-13 10:15:32 +00:00
parent 6269d030f0
commit 1820d1a249
5 changed files with 66 additions and 80 deletions

1
src/include/terminal.h Normal file
View File

@ -0,0 +1 @@
#include "../misc/terminal.h"

View File

@ -17,9 +17,11 @@ libmisc_a_SOURCES = \
printnum.h \
string.c \
string.h \
terminal.c \
terminal.h \
tilde.c \
tilde.h \
misc_time.c \
misc_time.c \
misc_time.h

View File

@ -8,18 +8,31 @@ Author: 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
* dependencies in here, and it isn't clear that versions of this stuff
* can be written for every possible machine...
*/
#include <config.h>
#include "ngspice.h"
#include "cpdefs.h"
#include "output.h"
#ifdef HAVE_SGTTY_H
#include <sgtty.h>
#endif
static void bufputc(char c);
static int outfn(char c);
#if 0
/* Bad interaction with bool type in bool.h because curses also
defines this symbol. */
#ifdef HAVE_TERMCAP
#include <curses.h>
#include <term.h>
#endif
#endif
#include "ngspice.h"
#include "cpdefs.h"
#include "terminal.h"
static char *motion_chars;
static char *clear_chars;
static char *home_chars;
static char *cleol_chars;
#define DEF_SCRHEIGHT 24
@ -32,11 +45,6 @@ static int xsize, ysize;
static int xpos, ypos;
static bool noprint, nopause;
static char *motion_chars;
static char *clear_chars;
static char *home_chars;
static char *cleol_chars;
/* out_printf doesn't handle double arguments correctly, so we
sprintf into this buf and call out_send w/ it */
@ -108,7 +116,7 @@ outbufputc(void)
if (ourbuf.count != BUFSIZ) {
fputs(staticbuf, cp_out);
bzero(staticbuf, BUFSIZ-ourbuf.count);
memset(staticbuf, 0, BUFSIZ-ourbuf.count);
ourbuf.count = BUFSIZ;
ourbuf.ptr = staticbuf;
}
@ -129,28 +137,6 @@ bufputc(char c)
}
}
#ifdef NOTDEF
/* This tricky little macro + recursive routine was giving the Ultrix
* global optimizer serious fits, so it was nuked.
* The replacement above is not quite as fast, but somehow I don't think
* that will cause too many problems these days.
*/
#define bufputc(c) ( --ourbuf.count >= 0 ? ((int) \
(*ourbuf.ptr++ = (unsigned)(c))) : fbufputc((unsigned) (c)))
static int
fbufputc(c)
unsigned char c;
{
ourbuf.count = 0;
outbufputc();
ourbuf.count = BUFSIZ;
ourbuf.ptr = staticbuf;
bufputc(c);
}
#endif
/* prompt for a return */
void
@ -255,46 +241,14 @@ out_printf(char *fmt, char *s1, char *s2, char *s3, char *s4, char *s5, char *s6
return;
}
void
term_clear(void)
{
#ifdef HAVE_TERMCAP
if (*clear_chars)
tputs(clear_chars, 1, outfn);
else
fputs("\n", stdout);
#endif
}
void
term_home(void)
{
#ifdef HAVE_TERMCAP
if (*home_chars)
tputs(home_chars, 1, outfn);
else if (*motion_chars)
tputs(tgoto(motion_chars, 1, 1), 1, outfn);
else
fputs("\n", stdout);
#endif
}
void
term_cleol(void)
{
#ifdef HAVE_TERMCAP
if (*cleol_chars)
tputs(cleol_chars, 1, outfn);
#endif
}
static int
outfn(char c)
outfn(int c)
{
putc(c, stdout);
return c;
}
void
tcap_init(void)
{
@ -334,3 +288,39 @@ tcap_init(void)
ysize = 0;
}
}
void
term_clear(void)
{
#ifdef HAVE_TERMCAP
if (*clear_chars)
tputs(clear_chars, 1, outfn);
else
fputs("\n", stdout);
#endif
}
void
term_home(void)
{
#ifdef HAVE_TERMCAP
if (*home_chars)
tputs(home_chars, 1, outfn);
else if (*motion_chars)
tputs(tgoto(motion_chars, 1, 1), 1, outfn);
else
fputs("\n", stdout);
#endif
}
void
term_cleol(void)
{
#ifdef HAVE_TERMCAP
if (*cleol_chars)
tputs(cleol_chars, 1, outfn);
#endif
}

View File

@ -1,21 +1,16 @@
/*************
* Header file for output.c
* 1999 E. Rouat
************/
#ifndef OUTPUT_H_INCLUDED
#define OUTPUT_H_INCLUDED
#ifndef _TERMINAL_H
#define _TERMINAL_H
void out_init(void);
void outbufputc(void);
void promptreturn(void);
void out_send(char *string);
void out_printf(char *fmt, char *s1, char *s2, char *s3, char *s4, char *s5, char *s6,
void out_printf(char *fmt, char *s1, char *s2, char *s3,
char *s4, char *s5, char *s6,
char *s7, char *s8, char *s9, char *s10);
void term_clear(void);
void term_home(void);
void term_cleol(void);
void tcap_init(void);
#endif

View File

@ -25,8 +25,6 @@ libparser_a_SOURCES = \
modify.h \
numparse.c \
numparse.h \
output.c \
output.h \
quote.c \
quote.h \
std.c \