Term-Gnuplot
view release on metacpan or search on metacpan
gnuterm/term/pm.trm view on Meta::CPAN
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
]*/
/*
* pm.trm --- inboard terminal driver for Presentation Manager
* --- after X-11 driver, by R.W.Fearick 31/1/92.
* v1.1 11/8/92 -- speed things up
*
* since March 1998: additions for mouse support implemented by Petr Mikulik
* last change: January 2000
* for mouse support, pm.trm has to be compiled with USE_MOUSE, e.g.
* gcc ... -DUSE_MOUSE ...
* January 1999: terminal entries for PM3D functionality by Petr Mikulik
*/
#include "driver.h"
#ifdef USE_ACTIVE_EVENTS
#include "mousing.h"
#endif
#ifdef TERM_REGISTER
register_term(pm)
#endif
#ifdef TERM_PROTO
TERM_PUBLIC void PM_init __PROTO((void));
TERM_PUBLIC void PM_options __PROTO((void));
TERM_PUBLIC void PM_reset __PROTO((void));
TERM_PUBLIC void PM_text __PROTO((void));
TERM_PUBLIC void PM_graphics __PROTO((void));
TERM_PUBLIC void PM_linetype __PROTO((int lt));
TERM_PUBLIC void PM_move __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC void PM_vector __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC int PM_text_angle __PROTO((int ang));
TERM_PUBLIC void PM_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
TERM_PUBLIC int PM_justify_text __PROTO((enum JUSTIFY mode));
TERM_PUBLIC void PM_point __PROTO((unsigned int x, unsigned int y, int number));
TERM_PUBLIC void PM_suspend __PROTO((void));
TERM_PUBLIC void PM_resume __PROTO((void));
TERM_PUBLIC void PM_fillbox __PROTO((int style, unsigned int x, unsigned int y, unsigned int w, unsigned int h));
TERM_PUBLIC void PM_linewidth __PROTO((double linewidth));
#ifdef USE_MOUSE
TERM_PUBLIC void PM_set_ruler __PROTO((int, int));
TERM_PUBLIC void PM_set_cursor __PROTO((int, int, int));
TERM_PUBLIC void PM_put_tmptext __PROTO((int, const char str[]));
TERM_PUBLIC void PM_set_clipboard __PROTO((const char[]));
#endif
#ifdef PM3D
TERM_PUBLIC int PM_make_palette (t_sm_palette *);
TERM_PUBLIC void PM_previous_palette (void);
TERM_PUBLIC void PM_set_color (double);
TERM_PUBLIC void PM_filled_polygon (int, gpiPoint *);
#endif
/* define PM world coordinate limits */
#define PM_XMAX 19500
#define PM_YMAX 12500
/* approximations for typical font/screen sizes */
#define PM_VCHAR (550)
#define PM_HCHAR (220)
/* Note: VCHAR AND HCHAR sizes in gnuplot 3.5 were 415 and 242,
in X11 are 500 and 195, respectively.
*/
#if 0 /* Sizes of gnuplot 3.6 and 3.7: */
# define PM_VTIC (200)
# define PM_HTIC (200)
#else /* Sizes as X11: */
# define PM_VTIC (125)
# define PM_HTIC (130)
/* Note: sizes for VTIC and HTIC in gnuplot 3.5 were 122 and 128, respectively.
*/
#endif
#endif
#ifdef TERM_BODY
#include <stdio.h>
#include <process.h>
#include <io.h>
#define INCL_DOSPROCESS
#define INCL_DOSSEMAPHORES
#define INCL_DOSMISC
#define INCL_DOSMODULEMGR
#include <os2.h>
/* graphics commands */
#define SET_GRAPHICS 'G'
#define SET_TEXT 'E'
#define SET_LINE 'L'
#define SET_FILLBOX 'B'
#define SET_LINEWIDTH 'W'
#define SET_ANGLE 'A'
#define SET_JUSTIFY 'J'
#define SET_POINTMODE 'D'
#define SET_FONT 'F'
#define SET_OPTIONS 'O'
#define SET_SPECIAL 'o' /* used for special options */
#define SET_MENU '#'
#define GR_QUERY 'Q'
#define GR_SUSPEND 'E' /*'s' */
#define GR_RESUME 'r'
#define GR_MOVE 'M'
gnuterm/term/pm.trm view on Meta::CPAN
pm_color = c;
#endif
putc(GR_SET_COLOR, PM_pipe);
putc(c, PM_pipe);
}
TERM_PUBLIC void PM_filled_polygon ( int points, gpiPoint *corners )
{
int i;
putc(GR_FILLED_POLYGON, PM_pipe);
fwrite(&points, sizeof(int), 1, PM_pipe); // tell him number of corners
for (i = 0; i < points; i++) {
fwrite(&corners[i].x, sizeof(int), 1, PM_pipe);
fwrite(&corners[i].y, sizeof(int), 1, PM_pipe);
}
}
#endif /* PM3D */
#ifdef USE_MOUSE
TERM_PUBLIC void
PM_put_tmptext(int i, const char str[])
{
if (PM_pipe) {
putc(PUT_TMPTEXT, PM_pipe);
fwrite(&i, sizeof(int), 1, PM_pipe);
i = strlen(str) + 1;
fwrite(&i, sizeof(int), 1, PM_pipe);
fwrite(&str[0], i, 1, PM_pipe);
fflush(PM_pipe);
}
}
TERM_PUBLIC void
PM_set_ruler(int x, int y)
{
if (PM_pipe) {
putc(SET_RULER, PM_pipe);
fwrite(&x, sizeof(int), 1, PM_pipe);
fwrite(&y, sizeof(int), 1, PM_pipe);
fflush(PM_pipe);
}
}
TERM_PUBLIC void
PM_set_cursor(int c, int x, int y)
{
if (PM_pipe) {
putc(SET_CURSOR, PM_pipe);
fwrite(&c, sizeof(int), 1, PM_pipe);
fwrite(&x, sizeof(int), 1, PM_pipe);
fwrite(&y, sizeof(int), 1, PM_pipe);
fflush(PM_pipe);
}
}
TERM_PUBLIC void
PM_set_clipboard(const char s[])
{
if (PM_pipe) {
int i = strlen(s);
putc(SET_CLIPBOARD, PM_pipe);
fwrite(&i, sizeof(int), 1, PM_pipe);
fwrite(s, i+1, 1, PM_pipe);
fflush(PM_pipe);
}
}
#endif /* USE_MOUSE */
#endif /* TERM_BODY */
#ifdef TERM_TABLE
TERM_TABLE_START(PM_driver)
"pm", "OS/2 Presentation Manager",
PM_XMAX, PM_YMAX, PM_VCHAR, PM_HCHAR,
PM_VTIC, PM_HTIC, PM_options, PM_init, PM_reset,
PM_text, null_scale, PM_graphics, PM_move, PM_vector,
PM_linetype, PM_put_text, PM_text_angle,
PM_justify_text, PM_point, do_arrow, PM_set_font,
0 /*pointsize */ , TERM_CAN_MULTIPLOT, PM_suspend, PM_resume,
PM_fillbox, PM_linewidth
#ifdef USE_MOUSE
#ifdef PIPE_IPC
, PM_waitforinput,
#else
, 0 /* PM_waitforinput */,
#endif
PM_put_tmptext, PM_set_ruler, PM_set_cursor, PM_set_clipboard
#endif
#ifdef PM3D
, PM_make_palette,
PM_previous_palette,
PM_set_color,
PM_filled_polygon
#endif
TERM_TABLE_END(PM_driver)
#undef LAST_TERM
#define LAST_TERM PM_driver
#endif /* TERM_TABLE */
#ifdef TERM_HELP
START_HELP(pm)
"1 pm",
"?commands set terminal pm",
"?set terminal pm",
"?set term pm",
"?terminal pm",
"?term pm",
"?pm",
" The `pm` terminal driver provides an OS/2 Presentation Manager window in",
" which the graph is plotted. The window is opened when the first graph is",
" plotted. This window has its own online help as well as facilities for",
" printing, copying to the clipboard and some line type and color adjustments.",
" The `multiplot` option is supported.",
"",
" Syntax:",
" set terminal pm {server {n}} {persist} {widelines} {enhanced} {\"title\"}",
"",
" If `persist` is specified, each graph appears in its own window and all",
" windows remain open after `gnuplot` exits. If `server` is specified, all",
" graphs appear in the same window, which remains open when `gnuplot` exits.",
" This option takes an optional numerical argument which specifies an instance",
" of the server process. Thus multiple server windows can be in use at the",
" same time.",
"",
" If `widelines` is specified, all plots will be drawn with wide lines. If",
" `enhanced` is specified, sub- and superscripts and multiple fonts are",
" enabled using the same syntax as the `enhanced postscript` option (see",
" `set terminal postscript enhanced` for details). Font names for the basic",
" PostScript fonts may be abbreviated to single letters.",
"",
" If `title` is specified, it will be used as the title of the plot window.",
" It will also be used as the name of the server instance, and will override",
" the optional numerical argument.",
"",
" Linewidths may be changed with `set linestyle`."
END_HELP(pm)
#endif /* TERM_HELP */
( run in 0.974 second using v1.01-cache-2.11-cpan-2398b32b56e )