Fixed line-endings (DOS to UNIX)
and translated German to English in comments.
This commit is contained in:
parent
7e542d122a
commit
7376fa66e5
|
|
@ -31,7 +31,7 @@ extern int X11_Init(void), X11_NewViewport(GRAPH *graph), X11_Close(void), X11_
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef HAS_WINDOWS /* Grafik-IO über MS Windows */
|
||||
#ifdef HAS_WINDOWS /* Graphic-IO under MS Windows */
|
||||
extern int WIN_Init(), WIN_NewViewport(), WIN_Close(), WIN_Clear(),
|
||||
WIN_DrawLine(), WIN_Arc(), WIN_Text(), WIN_DefineColor(),
|
||||
WIN_DefineLinestyle(), WIN_SetLinestyle(), WIN_SetColor(),
|
||||
|
|
@ -78,7 +78,7 @@ DISPDEVICE device[] = {
|
|||
gen_DatatoScreen,},
|
||||
#endif
|
||||
|
||||
#ifdef HAS_WINDOWS /* Grafik-IO über MS Windows */
|
||||
#ifdef HAS_WINDOWS /* Graphic-IO under MS Windows */
|
||||
{"Windows", 0, 0, 1000, 1000, 0, 0, WIN_Init, WIN_NewViewport,
|
||||
WIN_Close, WIN_Clear,
|
||||
WIN_DrawLine, WIN_Arc, WIN_Text, WIN_DefineColor, WIN_DefineLinestyle,
|
||||
|
|
@ -86,7 +86,7 @@ DISPDEVICE device[] = {
|
|||
nodev, nodev, nodev, gen_Input,
|
||||
gen_DatatoScreen, WIN_DiagramReady},
|
||||
|
||||
// Achtung: Namen "WinPrint" nicht ändern!
|
||||
// Warning: name "WinPrint" do not change!
|
||||
{"WinPrint", 0, 0, 1000, 1000, 0, 0, WPRINT_Init, WPRINT_NewViewport,
|
||||
WPRINT_Close, WPRINT_Clear,
|
||||
WPRINT_DrawLine, WPRINT_Arc, WPRINT_Text, WPRINT_DefineColor, WPRINT_DefineLinestyle,
|
||||
|
|
@ -128,7 +128,6 @@ DISPDEVICE device[] = {
|
|||
};
|
||||
|
||||
DISPDEVICE *dispdev = device + NUMELEMS(device) - 1;
|
||||
// DISPDEVICE *dispdev = device ; /* GCC257 stuertzt hier ab */
|
||||
|
||||
#define XtNumber(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,315 +1,313 @@
|
|||
/**********
|
||||
Author: Jim Groves
|
||||
**********/
|
||||
|
||||
/*
|
||||
HPGL driver
|
||||
*/
|
||||
|
||||
/*
|
||||
1000 plotter units / inch - 1pu = 0.025mm 1pu = 1mil
|
||||
|
||||
SP - select pen
|
||||
PU - pen up (PU x,y)
|
||||
PD - pen down (PD x,y)
|
||||
LT - line type
|
||||
0 dots only at plotted points
|
||||
1 . . . . .
|
||||
2 ___ ___ ___ ___
|
||||
3 ---- ---- ---- ----
|
||||
4 ----- . ----- . ----- . -----.
|
||||
5 ---- - ---- - ---- -
|
||||
6 --- - - --- - - --- - - --- - -
|
||||
null - solid line
|
||||
IN - initialize
|
||||
DF - default values (PA, solid line, set 0)
|
||||
PA - plot absolute
|
||||
SI - absolute character size (SI width, height) in cm
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "ngspice.h"
|
||||
#include "cpdefs.h"
|
||||
#include "graph.h"
|
||||
#include "ftedbgra.h"
|
||||
#include "ftedev.h"
|
||||
#include "fteinput.h"
|
||||
|
||||
#include "variable.h"
|
||||
|
||||
#define RAD_TO_DEG (180.0 / M_PI)
|
||||
#define DEVDEP(g) (*((GLdevdep *) (g)->devdep))
|
||||
#define MAX_GL_LINES 9999
|
||||
#define SOLID 0
|
||||
#define DOTTED 1
|
||||
|
||||
#define gtype graph->grid.gridtype
|
||||
#define xoff dispdev->minx
|
||||
#define yoff dispdev->miny
|
||||
#define XOFF 25 /* printer left margin */
|
||||
#define YOFF 28 /* printer bottom margin */
|
||||
#define XTADJ 0 /* printer text adjustment x */
|
||||
#define YTADJ 0 /* printer text adjustment y */
|
||||
|
||||
#define DELXMAX 360 /* printer gridsize divisible by 10, [7-2] */
|
||||
#define DELYMAX 360 /* printer gridsize divisible by [10-8], [6-2] */
|
||||
|
||||
#define FONTWIDTH 6 /* printer default fontwidth */
|
||||
#define FONTHEIGHT 8 /* printer default fontheight */
|
||||
|
||||
typedef struct {
|
||||
int lastlinestyle; /* initial invalid value */
|
||||
int lastx, lasty, linecount;
|
||||
} GLdevdep;
|
||||
|
||||
static char *linestyle[] = {
|
||||
"", /* solid */
|
||||
"1", /* was 1 - dotted */
|
||||
"", /* longdashed */
|
||||
"3", /* shortdashed */
|
||||
"4", /* longdotdashed */
|
||||
"5", /* shortdotdashed */
|
||||
"1"
|
||||
};
|
||||
|
||||
static FILE *plotfile;
|
||||
char psfont[128], psfontsize[32], psscale[32];
|
||||
static int fontwidth = FONTWIDTH;
|
||||
static int fontheight = FONTHEIGHT;
|
||||
static int jgmult = 10;
|
||||
static int screenflag = 0;
|
||||
static double tocm = 0.0025;
|
||||
static double scale; /* Used for fine tuning */
|
||||
static int hcopygraphid;
|
||||
|
||||
extern int DestroyGraph (int id);
|
||||
extern void internalerror (char *message);
|
||||
|
||||
int GL_Init()
|
||||
{
|
||||
if (!cp_getvar("hcopyscale", VT_STRING, psscale)) {
|
||||
scale = 1.0;
|
||||
} else {
|
||||
sscanf(psscale, "%lf", &scale);
|
||||
if ((scale <= 0) || (scale > 10))
|
||||
scale = 1.0;
|
||||
}
|
||||
|
||||
dispdev->numlinestyles = NUMELEMS(linestyle);
|
||||
dispdev->numcolors = 6;
|
||||
|
||||
dispdev->width = DELXMAX * scale;
|
||||
dispdev->height = DELYMAX * scale;
|
||||
|
||||
|
||||
screenflag = 0;
|
||||
dispdev->minx = XOFF * 1.0;
|
||||
dispdev->miny = YOFF * 1.0;
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
/* devdep initially contains name of output file */
|
||||
int GL_NewViewport(graph)
|
||||
GRAPH *graph;
|
||||
{
|
||||
/* double scaleps, scalex, scaley; */
|
||||
|
||||
hcopygraphid = graph->graphid;
|
||||
|
||||
if (!(plotfile = fopen(graph->devdep, "w"))) {
|
||||
perror(graph->devdep);
|
||||
graph->devdep = (char *) NULL;
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (graph->absolute.width) {
|
||||
/* hardcopying from the screen */
|
||||
|
||||
screenflag = 1;
|
||||
|
||||
/* scale to fit on 8 1/2 square */
|
||||
|
||||
}
|
||||
|
||||
/* reasonable values, used in gr_ for placement */
|
||||
graph->fontwidth = fontwidth * scale; /* was 12, p.w.h. */
|
||||
graph->fontheight = fontheight * scale; /* was 24, p.w.h. */
|
||||
|
||||
graph->absolute.width = dispdev->width;
|
||||
graph->absolute.height = dispdev->height;
|
||||
/* Also done in gr_init, if called . . . */
|
||||
graph->viewportxoff = 16 * fontwidth;
|
||||
graph->viewportyoff = 8 * fontheight;
|
||||
|
||||
xoff = XOFF;
|
||||
yoff = YOFF;
|
||||
|
||||
/* start file off with a % */
|
||||
fprintf(plotfile, "IN;DF;PA;");
|
||||
fprintf(plotfile, "SI %f,%f;", tocm*jgmult*fontwidth*scale,tocm*jgmult*fontheight*scale);
|
||||
|
||||
#ifdef notdef
|
||||
if (!screenflag)
|
||||
#endif
|
||||
|
||||
graph->devdep = tmalloc(sizeof(GLdevdep));
|
||||
DEVDEP(graph).lastlinestyle = -1;
|
||||
DEVDEP(graph).lastx = -1;
|
||||
DEVDEP(graph).lasty = -1;
|
||||
DEVDEP(graph).linecount = 0;
|
||||
graph->linestyle = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_Close()
|
||||
{
|
||||
|
||||
/* in case GL_Close is called as part of an abort,
|
||||
w/o having reached GL_NewViewport */
|
||||
if (plotfile) {
|
||||
if (DEVDEP(currentgraph).lastlinestyle != -1) {
|
||||
DEVDEP(currentgraph).linecount = 0;
|
||||
}
|
||||
fclose(plotfile);
|
||||
plotfile = NULL;
|
||||
}
|
||||
/* In case of hardcopy command destroy the hardcopy graph
|
||||
* and reset currentgraph to graphid 1, if possible
|
||||
*/
|
||||
if (!screenflag) {
|
||||
DestroyGraph(hcopygraphid);
|
||||
currentgraph = FindGraph(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_Clear()
|
||||
{
|
||||
|
||||
/* do nothing */
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_DrawLine(x1, y1, x2, y2)
|
||||
int x1, y1, x2, y2;
|
||||
{
|
||||
|
||||
/* note: this is not extendible to more than one graph
|
||||
=> will have to give NewViewport a writeable graph XXX */
|
||||
|
||||
|
||||
if (DEVDEP(currentgraph).linecount == 0
|
||||
|| x1 != DEVDEP(currentgraph).lastx
|
||||
|| y1 != DEVDEP(currentgraph).lasty)
|
||||
{
|
||||
fprintf(plotfile, "PU;PA %d , %d ;", jgmult*(x1 + xoff), jgmult*(y1 + yoff));
|
||||
}
|
||||
if (x1 != x2 || y1 != y2) {
|
||||
fprintf(plotfile, "PD;PA %d , %d ;", jgmult*(x2 + xoff), jgmult*(y2 + yoff));
|
||||
DEVDEP(currentgraph).linecount += 1;
|
||||
}
|
||||
|
||||
DEVDEP(currentgraph).lastx = x2;
|
||||
DEVDEP(currentgraph).lasty = y2;
|
||||
DEVDEP(currentgraph).lastlinestyle = currentgraph->linestyle;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int GL_Arc(x0, y0, r, theta1, theta2)
|
||||
int x0, y0, r;
|
||||
double theta1, theta2;
|
||||
{
|
||||
double x1, y1;
|
||||
double angle1, angle2;
|
||||
|
||||
while (theta1 >= theta2)
|
||||
theta2 += 2 * M_PI;
|
||||
|
||||
angle1 = (double) (RAD_TO_DEG * theta1);
|
||||
angle2 = (double) (RAD_TO_DEG * theta2);
|
||||
x1 = (double) x0 + r * cos(theta1);
|
||||
y1 = (double) y0 + r * sin(theta1);
|
||||
/*
|
||||
fprintf(plotfile, "%lf %lf moveto ", x1+(double)xoff, y1+(double)yoff);
|
||||
fprintf(plotfile, "%d %d %d %lf %lf arc\n", x0+xoff, y0+yoff, r,
|
||||
angle1, angle2);
|
||||
fprintf(plotfile, "stroke\n");
|
||||
*/
|
||||
DEVDEP(currentgraph).linecount = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_Text(text, x, y)
|
||||
char *text;
|
||||
int x, y;
|
||||
{
|
||||
|
||||
/* int savedlstyle; */
|
||||
|
||||
|
||||
/* move to (x, y) */
|
||||
|
||||
fprintf(plotfile, "PU;PA %d , %d;", jgmult*(x+xoff+XTADJ), jgmult*(y+yoff+YTADJ));
|
||||
fprintf(plotfile, "LB %s \x03", text);
|
||||
|
||||
DEVDEP(currentgraph).lastx = -1;
|
||||
DEVDEP(currentgraph).lasty = -1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
GL_SetLinestyle(linestyleid)
|
||||
int linestyleid;
|
||||
{
|
||||
|
||||
/* special case
|
||||
get it when GL_Text restores a -1 linestyle */
|
||||
if (linestyleid == -1) {
|
||||
currentgraph->linestyle = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (linestyleid < 0 || linestyleid > dispdev->numlinestyles) {
|
||||
internalerror("bad linestyleid");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (currentgraph->linestyle != linestyleid) {
|
||||
fprintf(plotfile, "LT %s ;", linestyle[linestyleid]);
|
||||
currentgraph->linestyle = linestyleid;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int GL_SetColor(colorid)
|
||||
int colorid;
|
||||
{
|
||||
/*va: unused: static int flag = 0;*/ /* A hack */
|
||||
|
||||
fprintf(plotfile, "SP %d;", colorid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_Update()
|
||||
{
|
||||
|
||||
fflush(plotfile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**********
|
||||
Author: Jim Groves
|
||||
**********/
|
||||
|
||||
/*
|
||||
HPGL driver
|
||||
*/
|
||||
|
||||
/*
|
||||
1000 plotter units / inch - 1pu = 0.025mm 1pu = 1mil
|
||||
|
||||
SP - select pen
|
||||
PU - pen up (PU x,y)
|
||||
PD - pen down (PD x,y)
|
||||
LT - line type
|
||||
0 dots only at plotted points
|
||||
1 . . . . .
|
||||
2 ___ ___ ___ ___
|
||||
3 ---- ---- ---- ----
|
||||
4 ----- . ----- . ----- . -----.
|
||||
5 ---- - ---- - ---- -
|
||||
6 --- - - --- - - --- - - --- - -
|
||||
null - solid line
|
||||
IN - initialize
|
||||
DF - default values (PA, solid line, set 0)
|
||||
PA - plot absolute
|
||||
SI - absolute character size (SI width, height) in cm
|
||||
|
||||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include "cpdefs.h"
|
||||
#include "graph.h"
|
||||
#include "ftedbgra.h"
|
||||
#include "ftedev.h"
|
||||
#include "fteinput.h"
|
||||
|
||||
#include "variable.h"
|
||||
|
||||
#define RAD_TO_DEG (180.0 / M_PI)
|
||||
#define DEVDEP(g) (*((GLdevdep *) (g)->devdep))
|
||||
#define MAX_GL_LINES 9999
|
||||
#define SOLID 0
|
||||
#define DOTTED 1
|
||||
|
||||
#define gtype graph->grid.gridtype
|
||||
#define xoff dispdev->minx
|
||||
#define yoff dispdev->miny
|
||||
#define XOFF 25 /* printer left margin */
|
||||
#define YOFF 28 /* printer bottom margin */
|
||||
#define XTADJ 0 /* printer text adjustment x */
|
||||
#define YTADJ 0 /* printer text adjustment y */
|
||||
|
||||
#define DELXMAX 360 /* printer gridsize divisible by 10, [7-2] */
|
||||
#define DELYMAX 360 /* printer gridsize divisible by [10-8], [6-2] */
|
||||
|
||||
#define FONTWIDTH 6 /* printer default fontwidth */
|
||||
#define FONTHEIGHT 8 /* printer default fontheight */
|
||||
|
||||
typedef struct {
|
||||
int lastlinestyle; /* initial invalid value */
|
||||
int lastx, lasty, linecount;
|
||||
} GLdevdep;
|
||||
|
||||
static char *linestyle[] = {
|
||||
"", /* solid */
|
||||
"1", /* was 1 - dotted */
|
||||
"", /* longdashed */
|
||||
"3", /* shortdashed */
|
||||
"4", /* longdotdashed */
|
||||
"5", /* shortdotdashed */
|
||||
"1"
|
||||
};
|
||||
|
||||
static FILE *plotfile;
|
||||
char psfont[128], psfontsize[32], psscale[32];
|
||||
static int fontwidth = FONTWIDTH;
|
||||
static int fontheight = FONTHEIGHT;
|
||||
static int jgmult = 10;
|
||||
static int screenflag = 0;
|
||||
static double tocm = 0.0025;
|
||||
static double scale; /* Used for fine tuning */
|
||||
static int hcopygraphid;
|
||||
|
||||
extern int DestroyGraph (int id);
|
||||
extern void internalerror (char *message);
|
||||
|
||||
int GL_Init()
|
||||
{
|
||||
if (!cp_getvar("hcopyscale", VT_STRING, psscale)) {
|
||||
scale = 1.0;
|
||||
} else {
|
||||
sscanf(psscale, "%lf", &scale);
|
||||
if ((scale <= 0) || (scale > 10))
|
||||
scale = 1.0;
|
||||
}
|
||||
|
||||
dispdev->numlinestyles = NUMELEMS(linestyle);
|
||||
dispdev->numcolors = 6;
|
||||
|
||||
dispdev->width = DELXMAX * scale;
|
||||
dispdev->height = DELYMAX * scale;
|
||||
|
||||
|
||||
screenflag = 0;
|
||||
dispdev->minx = XOFF * 1.0;
|
||||
dispdev->miny = YOFF * 1.0;
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
/* devdep initially contains name of output file */
|
||||
int GL_NewViewport(graph)
|
||||
GRAPH *graph;
|
||||
{
|
||||
/* double scaleps, scalex, scaley; */
|
||||
|
||||
hcopygraphid = graph->graphid;
|
||||
|
||||
if (!(plotfile = fopen(graph->devdep, "w"))) {
|
||||
perror(graph->devdep);
|
||||
graph->devdep = (char *) NULL;
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (graph->absolute.width) {
|
||||
/* hardcopying from the screen */
|
||||
|
||||
screenflag = 1;
|
||||
|
||||
/* scale to fit on 8 1/2 square */
|
||||
|
||||
}
|
||||
|
||||
/* reasonable values, used in gr_ for placement */
|
||||
graph->fontwidth = fontwidth * scale; /* was 12, p.w.h. */
|
||||
graph->fontheight = fontheight * scale; /* was 24, p.w.h. */
|
||||
|
||||
graph->absolute.width = dispdev->width;
|
||||
graph->absolute.height = dispdev->height;
|
||||
/* Also done in gr_init, if called . . . */
|
||||
graph->viewportxoff = 16 * fontwidth;
|
||||
graph->viewportyoff = 8 * fontheight;
|
||||
|
||||
xoff = XOFF;
|
||||
yoff = YOFF;
|
||||
|
||||
/* start file off with a % */
|
||||
fprintf(plotfile, "IN;DF;PA;");
|
||||
fprintf(plotfile, "SI %f,%f;", tocm*jgmult*fontwidth*scale,tocm*jgmult*fontheight*scale);
|
||||
|
||||
#ifdef notdef
|
||||
if (!screenflag)
|
||||
#endif
|
||||
|
||||
graph->devdep = tmalloc(sizeof(GLdevdep));
|
||||
DEVDEP(graph).lastlinestyle = -1;
|
||||
DEVDEP(graph).lastx = -1;
|
||||
DEVDEP(graph).lasty = -1;
|
||||
DEVDEP(graph).linecount = 0;
|
||||
graph->linestyle = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_Close()
|
||||
{
|
||||
|
||||
/* in case GL_Close is called as part of an abort,
|
||||
w/o having reached GL_NewViewport */
|
||||
if (plotfile) {
|
||||
if (DEVDEP(currentgraph).lastlinestyle != -1) {
|
||||
DEVDEP(currentgraph).linecount = 0;
|
||||
}
|
||||
fclose(plotfile);
|
||||
plotfile = NULL;
|
||||
}
|
||||
/* In case of hardcopy command destroy the hardcopy graph
|
||||
* and reset currentgraph to graphid 1, if possible
|
||||
*/
|
||||
if (!screenflag) {
|
||||
DestroyGraph(hcopygraphid);
|
||||
currentgraph = FindGraph(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_Clear()
|
||||
{
|
||||
|
||||
/* do nothing */
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_DrawLine(x1, y1, x2, y2)
|
||||
int x1, y1, x2, y2;
|
||||
{
|
||||
|
||||
/* note: this is not extendible to more than one graph
|
||||
=> will have to give NewViewport a writeable graph XXX */
|
||||
|
||||
|
||||
if (DEVDEP(currentgraph).linecount == 0
|
||||
|| x1 != DEVDEP(currentgraph).lastx
|
||||
|| y1 != DEVDEP(currentgraph).lasty)
|
||||
{
|
||||
fprintf(plotfile, "PU;PA %d , %d ;", jgmult*(x1 + xoff), jgmult*(y1 + yoff));
|
||||
}
|
||||
if (x1 != x2 || y1 != y2) {
|
||||
fprintf(plotfile, "PD;PA %d , %d ;", jgmult*(x2 + xoff), jgmult*(y2 + yoff));
|
||||
DEVDEP(currentgraph).linecount += 1;
|
||||
}
|
||||
|
||||
DEVDEP(currentgraph).lastx = x2;
|
||||
DEVDEP(currentgraph).lasty = y2;
|
||||
DEVDEP(currentgraph).lastlinestyle = currentgraph->linestyle;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int GL_Arc(x0, y0, r, theta1, theta2)
|
||||
int x0, y0, r;
|
||||
double theta1, theta2;
|
||||
{
|
||||
double x1, y1;
|
||||
double angle1, angle2;
|
||||
|
||||
while (theta1 >= theta2)
|
||||
theta2 += 2 * M_PI;
|
||||
|
||||
angle1 = (double) (RAD_TO_DEG * theta1);
|
||||
angle2 = (double) (RAD_TO_DEG * theta2);
|
||||
x1 = (double) x0 + r * cos(theta1);
|
||||
y1 = (double) y0 + r * sin(theta1);
|
||||
/*
|
||||
fprintf(plotfile, "%lf %lf moveto ", x1+(double)xoff, y1+(double)yoff);
|
||||
fprintf(plotfile, "%d %d %d %lf %lf arc\n", x0+xoff, y0+yoff, r,
|
||||
angle1, angle2);
|
||||
fprintf(plotfile, "stroke\n");
|
||||
*/
|
||||
DEVDEP(currentgraph).linecount = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_Text(text, x, y)
|
||||
char *text;
|
||||
int x, y;
|
||||
{
|
||||
|
||||
/* int savedlstyle; */
|
||||
|
||||
|
||||
/* move to (x, y) */
|
||||
|
||||
fprintf(plotfile, "PU;PA %d , %d;", jgmult*(x+xoff+XTADJ), jgmult*(y+yoff+YTADJ));
|
||||
fprintf(plotfile, "LB %s \x03", text);
|
||||
|
||||
DEVDEP(currentgraph).lastx = -1;
|
||||
DEVDEP(currentgraph).lasty = -1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
GL_SetLinestyle(linestyleid)
|
||||
int linestyleid;
|
||||
{
|
||||
|
||||
/* special case
|
||||
get it when GL_Text restores a -1 linestyle */
|
||||
if (linestyleid == -1) {
|
||||
currentgraph->linestyle = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (linestyleid < 0 || linestyleid > dispdev->numlinestyles) {
|
||||
internalerror("bad linestyleid");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (currentgraph->linestyle != linestyleid) {
|
||||
fprintf(plotfile, "LT %s ;", linestyle[linestyleid]);
|
||||
currentgraph->linestyle = linestyleid;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int GL_SetColor(colorid)
|
||||
int colorid;
|
||||
{
|
||||
/*va: unused: static int flag = 0;*/ /* A hack */
|
||||
|
||||
fprintf(plotfile, "SP %d;", colorid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GL_Update()
|
||||
{
|
||||
|
||||
fflush(plotfile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
|
|||
**********/
|
||||
|
||||
/*
|
||||
*
|
||||
* Read and write the ascii and binary rawfile formats.
|
||||
*/
|
||||
|
||||
|
|
@ -63,7 +62,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
|
|||
prec = DEFPREC;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// -Binärdatei binär schreiben- hvogt 15.03.2000 ---------------------
|
||||
/* - Binary file binary write - hvogt 15.03.2000 ---------------------*/
|
||||
if (binary) {
|
||||
if (!(fp = fopen(name, app ? "ab" : "wb"))) {
|
||||
perror(name);
|
||||
|
|
@ -78,7 +77,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
|
|||
}
|
||||
fprintf(cp_out,"ASCII raw file\n");
|
||||
}
|
||||
// --------------------------------------------------------------------
|
||||
/* --------------------------------------------------------------------*/
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -294,11 +293,11 @@ raw_read(char *name)
|
|||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// Test, ob Datei wirklich ASCII, sonst binär annehmen hvogt 15.3.2000
|
||||
/* Test, whether file really ASCII, otherwise assume binary hvogt 15.3.2000 */
|
||||
while (fgets(buf, BSIZE_SP, fp)) {
|
||||
if (ciprefix("values:", buf)) {
|
||||
binary = FALSE;
|
||||
rewind(fp); // zurückspulen
|
||||
rewind(fp); /* rewind */
|
||||
fprintf(cp_err, "\nASCII raw file\n");
|
||||
break;
|
||||
}
|
||||
|
|
@ -312,7 +311,7 @@ raw_read(char *name)
|
|||
}
|
||||
fprintf(cp_err, "\nbinary raw file\n");
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
/*--------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
/* Since we call cp_evloop() from here, we have to do this junk. */
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/**********
|
||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||
Author: 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
|
||||
**********/
|
||||
|
||||
/*
|
||||
*
|
||||
* Definitions common to the various graphics modules.
|
||||
*/
|
||||
|
||||
#define G_NONE 0
|
||||
#define G_HCOPY 1
|
||||
#define G_TERM 2
|
||||
#define G_MFB 3
|
||||
#define G_X 4
|
||||
|
||||
/**********
|
||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||
Author: 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
|
||||
**********/
|
||||
|
||||
/*
|
||||
*
|
||||
* Definitions common to the various graphics modules.
|
||||
*/
|
||||
|
||||
#define G_NONE 0
|
||||
#define G_HCOPY 1
|
||||
#define G_TERM 2
|
||||
#define G_MFB 3
|
||||
#define G_X 4
|
||||
|
||||
|
|
|
|||
|
|
@ -1,97 +1,95 @@
|
|||
/* I/O Redirection für Spice 3F4 unter Win32s
|
||||
Autor: Wolfgang Mües
|
||||
Stand: 21.05.95
|
||||
*/
|
||||
|
||||
#ifndef W_STDIO_H
|
||||
#define W_STDIO_H
|
||||
#include <stdio.h> // originale Definitionen
|
||||
#undef getc(f) // alte macros zurücknehmen
|
||||
#undef putc(c,f)
|
||||
#undef ungetc(c,f)
|
||||
#undef getchar()
|
||||
#undef putchar(c)
|
||||
#undef feof(f)
|
||||
#undef ferror(f)
|
||||
|
||||
|
||||
// -------------------------------<forwards>-----------------------------------
|
||||
|
||||
int f_c_l_o_s_e( FILE * __stream);
|
||||
int f_f_l_u_s_h( FILE * __stream);
|
||||
int fg_e_t_c( FILE * __stream);
|
||||
int f_g_e_t_p_o_s( FILE * __stream, fpos_t * __pos);
|
||||
char * fg_e_t_s(char * __s, int __n, FILE * __stream);
|
||||
int fp_r_i_n_t_f(FILE * __stream, const char * __format, ...);
|
||||
int fp_u_t_c(int __c, FILE * __stream);
|
||||
int fp_u_t_s(const char * __s, FILE * __stream);
|
||||
size_t f_r_e_a_d(void * __ptr, size_t __size, size_t __n, FILE * __stream);
|
||||
FILE * f_r_e_o_p_e_n(const char * __path, const char * __mode, FILE * __stream);
|
||||
int fs_c_a_n_f(FILE * __stream, const char * __format, ...);
|
||||
int f_s_e_e_k(FILE * __stream, long __offset, int __whence);
|
||||
int f_s_e_t_p_o_s(FILE * __stream, const fpos_t*__pos);
|
||||
long f_t_e_l_l(FILE * __stream);
|
||||
size_t f_w_r_i_t_e(const void * __ptr, size_t __size, size_t __n, FILE * __stream);
|
||||
char * g_e_t_s(char * __s);
|
||||
void p_e_r_r_o_r(const char * __s);
|
||||
int p_r_i_n_t_f(const char * __format, ...);
|
||||
int p_u_t_s(const char * __s);
|
||||
int s_c_a_n_f(const char * __format, ...);
|
||||
int ung_e_t_c(int __c, FILE * __stream);
|
||||
int vfp_r_i_n_t_f(FILE * __stream, const char * __format, void * __arglist);
|
||||
//int vfs_c_a_n_f(FILE * __stream, const char * __format, void * __arglist);
|
||||
int vp_r_i_n_t_f(const char * __format, void * __arglist);
|
||||
//int vs_c_a_n_f(const char * __format, void * __arglist);
|
||||
int r_e_a_d(int fd, char * __buf, int __n);
|
||||
int g_e_t_c(FILE * __fp);
|
||||
int g_e_t_char(void);
|
||||
int p_u_t_char(const int __c);
|
||||
int p_u_t_c(const int __c, FILE * __fp);
|
||||
int f_e_o_f(FILE * __fp);
|
||||
int f_e_r_r_o_r(FILE * __fp);
|
||||
int fg_e_t_char(void);
|
||||
int fp_u_t_char(int __c);
|
||||
|
||||
// ------------------------------<neue macros>---------------------------------
|
||||
|
||||
#define fclose f_c_l_o_s_e
|
||||
#define fflush f_f_l_u_s_h
|
||||
#define fgetc fg_e_t_c
|
||||
#define fgetpos f_g_e_t_p_o_s
|
||||
#define fgets fg_e_t_s
|
||||
#define fprintf fp_r_i_n_t_f
|
||||
#define fputc fp_u_t_c
|
||||
#define fputs fp_u_t_s
|
||||
#define fread f_r_e_a_d
|
||||
#define afreopen f_r_e_o_p_e_n // hvogt 10.05.2000
|
||||
#define fscanf fs_c_a_n_f
|
||||
#define fseek f_s_e_e_k
|
||||
#define fsetpos f_s_e_t_p_o_s
|
||||
#define ftell f_t_e_l_l
|
||||
#define fwrite f_w_r_i_t_e
|
||||
#define gets g_e_t_s
|
||||
#define perror p_e_r_r_o_r
|
||||
#define printf p_r_i_n_t_f
|
||||
#define puts p_u_t_s
|
||||
#define scanf s_c_a_n_f
|
||||
#define ungetc ung_e_t_c
|
||||
#define vfprintf vfp_r_i_n_t_f
|
||||
//#define vfscanf vfs_c_a_n_f
|
||||
#define vprintf vp_r_i_n_t_f
|
||||
//#define vscanf vs_c_a_n_f
|
||||
#define read r_e_a_d
|
||||
#define getc g_e_t_c
|
||||
#define getchar g_e_t_char
|
||||
#define putchar p_u_t_char
|
||||
#define putc p_u_t_c
|
||||
#define feof f_e_o_f
|
||||
#define ferror f_e_r_r_o_r
|
||||
#define fgetchar fg_e_t_char
|
||||
#define fputchar fp_u_t_char
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// #include "io_special.h"
|
||||
|
||||
#endif /* W_STDIO_H */
|
||||
|
||||
/* I/O Redirection for Spice 3F4 under Win32s
|
||||
Autor: Wolfgang Muees
|
||||
Stand: 21.05.95
|
||||
*/
|
||||
|
||||
#ifndef WSTDIO_H
|
||||
#define WSTDIO_H
|
||||
#include <stdio.h> /* original definitions */
|
||||
|
||||
#undef getc /* old macros removed */
|
||||
#undef putc
|
||||
#undef ungetc
|
||||
#undef getchar
|
||||
#undef putchar
|
||||
#undef feof
|
||||
#undef ferror
|
||||
|
||||
/* -------------------------------<forwards>----------------------------------*/
|
||||
|
||||
int f_c_l_o_s_e( FILE * __stream);
|
||||
int f_f_l_u_s_h( FILE * __stream);
|
||||
int fg_e_t_c( FILE * __stream);
|
||||
int f_g_e_t_p_o_s( FILE * __stream, fpos_t * __pos);
|
||||
char * fg_e_t_s(char * __s, int __n, FILE * __stream);
|
||||
int fp_r_i_n_t_f(FILE * __stream, const char * __format, ...);
|
||||
int fp_u_t_c(int __c, FILE * __stream);
|
||||
int fp_u_t_s(const char * __s, FILE * __stream);
|
||||
size_t f_r_e_a_d(void * __ptr, size_t __size, size_t __n, FILE * __stream);
|
||||
FILE * f_r_e_o_p_e_n(const char * __path, const char * __mode, FILE * __stream);
|
||||
int fs_c_a_n_f(FILE * __stream, const char * __format, ...);
|
||||
int f_s_e_e_k(FILE * __stream, long __offset, int __whence);
|
||||
int f_s_e_t_p_o_s(FILE * __stream, const fpos_t*__pos);
|
||||
long f_t_e_l_l(FILE * __stream);
|
||||
size_t f_w_r_i_t_e(const void * __ptr, size_t __size, size_t __n, FILE * __stream);
|
||||
char * g_e_t_s(char * __s);
|
||||
void p_e_r_r_o_r(const char * __s);
|
||||
int p_r_i_n_t_f(const char * __format, ...);
|
||||
int p_u_t_s(const char * __s);
|
||||
int s_c_a_n_f(const char * __format, ...);
|
||||
int ung_e_t_c(int __c, FILE * __stream);
|
||||
int vfp_r_i_n_t_f(FILE * __stream, const char * __format, void * __arglist);
|
||||
/*int vfs_c_a_n_f(FILE * __stream, const char * __format, void * __arglist);*/
|
||||
int vp_r_i_n_t_f(const char * __format, void * __arglist);
|
||||
/*int vs_c_a_n_f(const char * __format, void * __arglist); */
|
||||
int r_e_a_d(int fd, char * __buf, int __n);
|
||||
int g_e_t_c(FILE * __fp);
|
||||
int g_e_t_char(void);
|
||||
int p_u_t_char(const int __c);
|
||||
int p_u_t_c(const int __c, FILE * __fp);
|
||||
int f_e_o_f(FILE * __fp);
|
||||
int f_e_r_r_o_r(FILE * __fp);
|
||||
int fg_e_t_char(void);
|
||||
int fp_u_t_char(int __c);
|
||||
|
||||
/* ------------------------------<New macros>---------------------------------*/
|
||||
|
||||
#define fclose f_c_l_o_s_e
|
||||
#define fflush f_f_l_u_s_h
|
||||
#define fgetc fg_e_t_c
|
||||
#define fgetpos f_g_e_t_p_o_s
|
||||
#define fgets fg_e_t_s
|
||||
#define fprintf fp_r_i_n_t_f
|
||||
#define fputc fp_u_t_c
|
||||
#define fputs fp_u_t_s
|
||||
#define fread f_r_e_a_d
|
||||
#define afreopen f_r_e_o_p_e_n // hvogt 10.05.2000
|
||||
#define fscanf fs_c_a_n_f
|
||||
#define fseek f_s_e_e_k
|
||||
#define fsetpos f_s_e_t_p_o_s
|
||||
#define ftell f_t_e_l_l
|
||||
#define fwrite f_w_r_i_t_e
|
||||
#define gets g_e_t_s
|
||||
#define perror p_e_r_r_o_r
|
||||
#define printf p_r_i_n_t_f
|
||||
#define puts p_u_t_s
|
||||
#define scanf s_c_a_n_f
|
||||
#define ungetc ung_e_t_c
|
||||
#define vfprintf vfp_r_i_n_t_f
|
||||
/*#define vfscanf vfs_c_a_n_f*/
|
||||
#define vprintf vp_r_i_n_t_f
|
||||
/*#define vscanf vs_c_a_n_f*/
|
||||
#define read r_e_a_d
|
||||
#define getc g_e_t_c
|
||||
#define getchar g_e_t_char
|
||||
#define putchar p_u_t_char
|
||||
#define putc p_u_t_c
|
||||
#define feof f_e_o_f
|
||||
#define ferror f_e_r_r_o_r
|
||||
#define fgetchar fg_e_t_char
|
||||
#define fputchar fp_u_t_char
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* WSTDIO_H */
|
||||
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ ACan(CKTcircuit *ckt, int restart)
|
|||
case DECADE:
|
||||
case OCTAVE:
|
||||
|
||||
// neu eingefügt 14.12.2001
|
||||
/* inserted again 14.12.2001 */
|
||||
#ifdef HAS_WINDOWS
|
||||
{
|
||||
double endfreq = ((ACAN*)ckt->CKTcurJob)->ACstopFreq;
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
/**********
|
||||
Copyright 1999 AG inc. All rights reserved.
|
||||
Author: 1999 Alan Gillespie
|
||||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include "cktdefs.h"
|
||||
#include "suffix.h"
|
||||
|
||||
void
|
||||
CKTncDump(ckt)
|
||||
CKTcircuit *ckt;
|
||||
{
|
||||
CKTnode *node;
|
||||
double new, old, tol;
|
||||
int i=1;
|
||||
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"Last Node Voltages\n");
|
||||
fprintf(stdout,"------------------\n\n");
|
||||
fprintf(stdout,"%-30s %20s %20s\n", "Node", "Last Voltage", "Previous Iter");
|
||||
fprintf(stdout,"%-30s %20s %20s\n", "----", "------------", "-------------");
|
||||
for(node=ckt->CKTnodes->next;node;node=node->next) {
|
||||
if (strstr(node->name, "#branch") || !strstr(node->name, "#")) {
|
||||
new = *((ckt->CKTrhsOld) + i ) ;
|
||||
old = *((ckt->CKTrhs) + i ) ;
|
||||
fprintf(stdout,"%-30s %20g %20g", node->name, new, old);
|
||||
if(node->type == 3) {
|
||||
tol = ckt->CKTreltol * (MAX(fabs(old),fabs(new))) +
|
||||
ckt->CKTvoltTol;
|
||||
} else {
|
||||
tol = ckt->CKTreltol * (MAX(fabs(old),fabs(new))) +
|
||||
ckt->CKTabstol;
|
||||
}
|
||||
if (fabs(new-old) >tol ) {
|
||||
fprintf(stdout," *");
|
||||
}
|
||||
fprintf(stdout,"\n");
|
||||
};
|
||||
i++;
|
||||
};
|
||||
fprintf(stdout,"\n");
|
||||
}
|
||||
/**********
|
||||
Copyright 1999 AG inc. All rights reserved.
|
||||
Author: 1999 Alan Gillespie
|
||||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include "cktdefs.h"
|
||||
#include "suffix.h"
|
||||
|
||||
void
|
||||
CKTncDump(ckt)
|
||||
CKTcircuit *ckt;
|
||||
{
|
||||
CKTnode *node;
|
||||
double new, old, tol;
|
||||
int i=1;
|
||||
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"Last Node Voltages\n");
|
||||
fprintf(stdout,"------------------\n\n");
|
||||
fprintf(stdout,"%-30s %20s %20s\n", "Node", "Last Voltage", "Previous Iter");
|
||||
fprintf(stdout,"%-30s %20s %20s\n", "----", "------------", "-------------");
|
||||
for(node=ckt->CKTnodes->next;node;node=node->next) {
|
||||
if (strstr(node->name, "#branch") || !strstr(node->name, "#")) {
|
||||
new = *((ckt->CKTrhsOld) + i ) ;
|
||||
old = *((ckt->CKTrhs) + i ) ;
|
||||
fprintf(stdout,"%-30s %20g %20g", node->name, new, old);
|
||||
if(node->type == 3) {
|
||||
tol = ckt->CKTreltol * (MAX(fabs(old),fabs(new))) +
|
||||
ckt->CKTvoltTol;
|
||||
} else {
|
||||
tol = ckt->CKTreltol * (MAX(fabs(old),fabs(new))) +
|
||||
ckt->CKTabstol;
|
||||
}
|
||||
if (fabs(new-old) >tol ) {
|
||||
fprintf(stdout," *");
|
||||
}
|
||||
fprintf(stdout,"\n");
|
||||
};
|
||||
i++;
|
||||
};
|
||||
fprintf(stdout,"\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue