Browse Source

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


			
			
				pre-master-46
			
			
		
arno 26 years ago
parent
commit
1820d1a249
  1. 1
      src/include/terminal.h
  2. 2
      src/misc/Makefile.am
  3. 126
      src/misc/terminal.c
  4. 13
      src/misc/terminal.h
  5. 2
      src/parser/Makefile.am

1
src/include/terminal.h

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

2
src/misc/Makefile.am

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

126
src/parser/output.c → src/misc/terminal.c

@ -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 * dependencies in here, and it isn't clear that versions of this stuff
* can be written for every possible machine... * can be written for every possible machine...
*/ */
#include <config.h> #include <config.h>
#include "ngspice.h"
#include "cpdefs.h"
#include "output.h"
#ifdef HAVE_SGTTY_H #ifdef HAVE_SGTTY_H
#include <sgtty.h> #include <sgtty.h>
#endif #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 #define DEF_SCRHEIGHT 24
@ -32,11 +45,6 @@ static int xsize, ysize;
static int xpos, ypos; static int xpos, ypos;
static bool noprint, nopause; 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 /* out_printf doesn't handle double arguments correctly, so we
sprintf into this buf and call out_send w/ it */ sprintf into this buf and call out_send w/ it */
@ -108,7 +116,7 @@ outbufputc(void)
if (ourbuf.count != BUFSIZ) { if (ourbuf.count != BUFSIZ) {
fputs(staticbuf, cp_out); fputs(staticbuf, cp_out);
bzero(staticbuf, BUFSIZ-ourbuf.count);
memset(staticbuf, 0, BUFSIZ-ourbuf.count);
ourbuf.count = BUFSIZ; ourbuf.count = BUFSIZ;
ourbuf.ptr = staticbuf; 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 */ /* prompt for a return */
void void
@ -255,46 +241,14 @@ out_printf(char *fmt, char *s1, char *s2, char *s3, char *s4, char *s5, char *s6
return; 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 static int
outfn(char c)
outfn(int c)
{ {
putc(c, stdout); putc(c, stdout);
return c; return c;
} }
void void
tcap_init(void) tcap_init(void)
{ {
@ -334,3 +288,39 @@ tcap_init(void)
ysize = 0; 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
}

13
src/parser/output.h → src/misc/terminal.h

@ -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 out_init(void);
void outbufputc(void); void outbufputc(void);
void promptreturn(void); void promptreturn(void);
void out_send(char *string); 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); char *s7, char *s8, char *s9, char *s10);
void term_clear(void); void term_clear(void);
void term_home(void); void term_home(void);
void term_cleol(void); void term_cleol(void);
void tcap_init(void); void tcap_init(void);
#endif #endif

2
src/parser/Makefile.am

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

Loading…
Cancel
Save