1 #include <../../nrnconf.h>
6 #include "utils/logger.hpp"
17 #define IGNORE(arg) arg
20 #if defined(__linux__)
29 static void hplot(
int,
double,
double);
32 static void Fig_plt(
int,
double,
double);
35 static void tplot(
int,
double,
double);
40 #if defined(__MINGW32__)
41 extern char** _environ;
46 #if !defined(__APPLE__)
47 extern char** environ;
49 #include <crt_externs.h>
60 #define text hoc_plttext
80 static char vt100[] =
"TERM=vt125";
81 static char adm3a[] =
"TERM=adm3a";
82 static char ssun[] =
"TERM=sun";
84 static char ncsa[] =
"NEURON=ncsa";
89 extern void x11_put_text(
const char*), x11_close_window(
void), x11_setcolor(
int);
90 extern void x11_coord(
double,
double), x11_vector(), x11_point(), x11_move(), x11flush();
91 extern void x11_clear(), x11_cleararea(), x11_open_window(), x11_fast(
int);
92 static void hoc_x11plot(
int,
double,
double);
100 if (
text &&
s[strlen(
s) - 1] ==
'\n') {
103 buf[strlen(
s) - 1] =
'\0';
133 #if !defined(__MINGW32__)
135 #if defined(__APPLE__)
136 char** environ = (*_NSGetEnviron());
139 for (
i = 0; environ[
i] !=
NULL;
i++) {
140 if (strcmp(environ[
i],
vt100) == 0)
142 if (strcmp(environ[
i],
ssun) == 0)
144 if (strcmp(environ[
i],
adm3a) == 0)
146 if (strcmp(environ[
i],
tek4014) == 0)
148 if (strcmp(environ[
i],
ncsa) == 0)
155 hoc_open_sunplot(environ);
205 hoc_sunplot(&
text, mode, x, y);
209 hoc_x11plot(mode, x, y);
246 static void tplot(
int mode,
double x,
double y) {
266 hy = (((
YHOME & 01777) >> 5) + 32);
267 ly = ((
YHOME & 037) + 96);
268 hx = (((
XHOME & 01777) >> 5) + 32);
311 hy = (((iy & 01777) >> 5) + 32);
312 ly = ((iy & 037) + 96);
313 hx = (((ix & 01777) >> 5) + 32);
314 lx = ((ix & 037) + 64);
339 IGNORE(fprintf(stderr,
"Can't open %s for hardplot output\n",
s));
370 static char fig_preamble[] =
"#FIG 1.4\n80 2\n";
378 #define SCX(x) ((int) (x * .8))
379 #define SCY(y) (600 - (int) (y * .8))
380 #define SCXD(x) ((x * .8))
381 #define SCYD(y) (7.5 * 80. - (y * .8))
386 static short state = 0;
387 static double oldx, oldy;
388 static char text_preamble[] =
"4 0 0 16 0 0 0 0.000 1 16 40 ", text_postamble[] =
"\1\n",
389 line_preamble[] =
"7 1 0 1 0 0 0 0 0.000 0 0\n", line_postamble[] =
" 9999 9999\n";
404 if (state ==
LINE2) {
423 if (state ==
LINE2) {
429 if (state ==
LINE1) {
441 void hplot(
int mode,
double x,
double y) {
443 static short txt = 0;
480 IGNORE(fprintf(
hpdev,
"PU %8.2f,%8.2f;PD;", x, y));
493 void vtplot(
int mode,
double x,
double y) {
494 static short vtgrph = 0;
536 vtx = (int) ((767. / 1023.) * x);
537 vty = (int) (479. - (479 / 779.) * y);
563 #define CODRAW_MAXPOINT 200
570 static char codraw_preamble[] =
571 "SW(1,0,8,0,8);\nST(1);\nSG(0.1);\n\
572 SF(1,'HELVET-L');\nSF(2,'HELVET');\nSF(3,'CENTURY');\nSF(4,'SCRIPT');\n\
573 SF(5,'GREEK');\nSP(1);\nLT(1);LW(1);LC(15);LD(50);\nTF(1);TW(1);TS(0);TC(15);\
574 TL(1);TV(4);TA(0);TH(0.2);\n";
590 #define SCXD(x) ((x * .008))
591 #define SCYD(y) ((y * .008))
598 static short state = 0;
599 static double oldx, oldy;
611 if (state ==
LINE2) {
631 if (state ==
LINE2) {
637 if (state ==
LINE1) {
664 if (((
i + 1) % 8) == 0) {
680 extern char* getenv();
681 static void hoc_x11plot(
int mode,
double x,
double y) {
682 extern int x11_init_done;
684 if (!x11_init_done) {
void hoc_plprint(const char *s)
void hoc_close_plot(void)
void hoc_plt(int mode, double x, double y)
void * hoc_Emalloc(size_t)
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
HOC interpreter function declarations (included by hocdec.h)
static char hardplot_filename[100]
static void Fig_preamble(void)
static void hard_text_preamble()
void Fig_file(const char *, int)
static void hardplot_file(const char *s)
static void Fig_plt(int, double, double)
static void hplot(int, double, double)
static void Codraw_preamble(void)
static void codraw_line()
static char fig_text_preamble[100]
static float * codraw_pointx
static void Codraw_plt(int, double, double)
static void tplot(int, double, double)
static float * codraw_pointy
int Printf(const char *fmt, Args... args)