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