-1.5
+1.5 Thu Jan 29 00:43:48 CET 2004
- share io manager between rxvt-unicode and vpe
- bugfix for --disable-utmp, reported by fefe himsel.
- colors were sometimes not used correctly because
Markus Demleitner.
- improved selection support, now supports UTF8_STRING
and properly encodes CUT_BUFFER0 in iso-8859-1.
+ - completely removed non-working graphics mode.
1.4 Fri Jan 16 23:03:22 CET 2004
- fix stupid segfault on esc-c
# ./Makefile.in -*- Makefile -*-
-# $Id: Makefile.in,v 1.4 2003-12-18 07:41:39 pcg Exp $
+# $Id: Makefile.in,v 1.5 2004-01-28 23:48:01 pcg Exp $
@MCOMMON@
srcdir = @srcdir@
first_rule: all
dummy:
-subdirs = src doc src/graphics src/test
+subdirs = src doc src/test
allsubdirs = W11 $(subdirs)
DIST = INSTALL README.configure configure Makefile Makefile.in ChangeLog
rxvt:
(cd src; ${MAKE})
-clock:
- (cd rclock; ${MAKE})
-
-graphics qplot:
- (cd src/graphics; ${MAKE} qplot)
-
tests:
(cd src/test; ${MAKE} tests)
-# $Id: Makefile.in,v 1.8 2004-01-17 01:20:01 pcg Exp $
+# $Id: Makefile.in,v 1.9 2004-01-28 23:48:02 pcg Exp $
@MCOMMON@
LINT = lint -DNARROWPROTO=1 $(XINC) -chapbxz
first_rule: all
dummy:
-LIBSRCS = command.C defaultfont.C graphics.C grkelot.C init.C logging.C \
+LIBSRCS = command.C defaultfont.C grkelot.C init.C logging.C \
main.C menubar.C misc.C netdisp.C ptytty.C screen.C scrollbar.C \
scrollbar-rxvt.C scrollbar-next.C scrollbar-xterm.C strings.C \
xdefaults.C xpm.C encoding.C rxvtcolor.C rxvtstl.C iom.C
EXTRAHDRS = rxvtlib.h rxvtdaemon.h
-OBJS = command.o defaultfont.o init.o graphics.o grkelot.o logging.o \
+OBJS = command.o defaultfont.o init.o grkelot.o logging.o \
main.o menubar.o misc.o netdisp.o ptytty.o screen.o \
scrollbar.o scrollbar-next.o scrollbar-rxvt.o scrollbar-xterm.o \
strings.o xdefaults.o xpm.o rxvt.o encoding.o rxvtcolor.o rxvtstl.o iom.o
-LIBOBJS = command.lo defaultfont.lo init.lo graphics.lo grkelot.lo logging.lo \
+LIBOBJS = command.lo defaultfont.lo init.lo grkelot.lo logging.lo \
main.lo menubar.lo misc.lo netdisp.lo ptytty.lo screen.lo \
scrollbar.lo scrollbar-next.lo scrollbar-rxvt.lo scrollbar-xterm.lo \
strings.lo xdefaults.lo xpm.lo encoding.lo rxvt.lo rxvtcolor.lo rxvtstl.lo iom.lo
RXVTD_VERNAME=$(DESTDIR)$(bindir)/$(RXVT_BASENAME)d-$(VERSION)$(EXEEXT)
RXVT_OLDNAME=$(DESTDIR)$(bindir)/$(RXVT_BASENAME)-old$(EXEEXT)
-EXTPROS = command.extpro defaultfont.extpro graphics.extpro grkelot.extpro \
+EXTPROS = command.extpro defaultfont.extpro grkelot.extpro \
init.extpro logging.extpro main.extpro menubar.extpro misc.extpro \
netdisp.extpro ptytty.extpro screen.extpro scrollbar.extpro \
scrollbar-rxvt.extpro scrollbar-next.extpro scrollbar-xterm.extpro \
strings.extpro xdefaults.extpro xpm.extpro
-INTPROS = command.intpro defaultfont.intpro graphics.intpro grkelot.intpro \
+INTPROS = command.intpro defaultfont.intpro grkelot.intpro \
init.intpro logging.intpro main.intpro menubar.intpro misc.intpro \
netdisp.intpro ptytty.intpro screen.intpro scrollbar.intpro \
scrollbar-rxvt.intpro scrollbar-next.intpro scrollbar-xterm.intpro \
command.o: command.C $(DEPS) command.intpro command.h version.h
defaultfont.o: defaultfont.C $(DEPS) defaultfont.intpro defaultfont.h
-graphics.o: graphics.C $(DEPS) graphics.intpro
grkelot.o: grkelot.C $(DEPS) grkelot.intpro grkelot.h
init.o: init.C $(DEPS) init.intpro init.h defaultfont.h
logging.o: logging.C $(DEPS) logging.intpro logging.h
command.lo: command.C $(DEPS) command.intpro command.h version.h
defaultfont.lo: defaultfont.C $(DEPS) defaultfont.intpro defaultfont.h encoding.h
-graphics.lo: graphics.C $(DEPS) graphics.intpro defaultfont.h
grkelot.lo: grkelot.C $(DEPS) grkelot.intpro grkelot.h
init.lo: init.C $(DEPS) init.intpro init.h
logging.lo: logging.C $(DEPS) logging.intpro logging.h
+++ /dev/null
-/*--------------------------------*-C-*---------------------------------*
- * File: graphics.c
- *----------------------------------------------------------------------*
- * $Id: graphics.C,v 1.4 2003-12-18 02:07:12 pcg Exp $
- *
- * All portions of code are copyright by their respective author/s.
- * Copyright (c) 1994 Rob Nation <nation@rocket.sanders.lockheed.com>
- * - original version
- * Copyright (c) 1997 Raul Garcia Garcia <rgg@tid.es>
- * Copyright (c) 1997,1998 mj olesen <olesen@me.queensu.ca>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *----------------------------------------------------------------------*/
-
-#include "../config.h" /* NECESSARY */
-#ifdef RXVT_GRAPHICS
-#include "rxvt.h" /* NECESSARY */
-#include "rxvtgrx.h"
-
-typedef struct grcmd_t {
- char cmd;
- short color;
- short ncoords;
- int *coords;
- unsigned char *text;
- struct grcmd_t *next;
-} grcmd_t;
-
-typedef struct grwin_t {
- Window win;
- int x, y;
- unsigned int w, h;
- short screen;
- grcmd_t *graphics;
- struct grwin_t *prev, *next;
-} grwin_t;
-
-#include "graphics.intpro" /* PROTOS for internal routines */
-#include <X11/cursorfont.h>
-
-/* commands:
- * 'C' = Clear
- * 'F' = Fill
- * 'G' = Geometry
- * 'L' = Line
- * 'P' = Points
- * 'T' = Text
- * 'W' = Window
- */
-
-#ifndef GRX_SCALE
-# define GRX_SCALE 10000
-#endif
-
-/*----------------------------------------------------------------------*
- * local functions
- */
-/* ARGSUSED */
-/* INTPROTO */
-void
-rxvt_Gr_NewWindow(pR_ int nargs, int args[])
-{
- int x, y;
- unsigned int w, h;
- Window win;
- grwin_t *grwin;
- Cursor cursor;
-
- if (nargs != 4) {
- rxvt_print_error("NewWindow: 4 args needed, got %d\n", nargs);
- return;
- }
- x = args[0] * TermWin_TotalWidth() / GRX_SCALE;
- y = args[1] * TermWin_TotalHeight() / GRX_SCALE;
- w = args[2] * TermWin_TotalWidth() / GRX_SCALE;
- h = args[3] * TermWin_TotalHeight() / GRX_SCALE;
-
- win = XCreateSimpleWindow(R->Xdisplay, R->TermWin.vt,
- x, y, w, h,
- 0,
- R->PixColors[Color_fg],
- R->PixColors[Color_bg]);
-
- cursor = XCreateFontCursor(R->Xdisplay, XC_crosshair);
- XDefineCursor(R->Xdisplay, win, cursor);
- XMapWindow(R->Xdisplay, win);
- XSelectInput(R->Xdisplay, win, ExposureMask);
-
- grwin = (grwin_t *) rxvt_malloc(sizeof(grwin_t));
- grwin->win = win;
- grwin->x = x;
- grwin->y = y;
- grwin->w = w;
- grwin->h = h;
- grwin->screen = 0;
- grwin->prev = NULL;
- grwin->next = R->gr_root;
- if (grwin->next)
- grwin->next->prev = grwin;
- R->gr_root = grwin;
- grwin->graphics = NULL;
- R->graphics_up++;
-
- R->tt_printf("\033W%ld\n", (long)grwin->win);
-}
-
-/* ARGSUSED */
-/* INTPROTO */
-void
-rxvt_Gr_ClearWindow(pR_ grwin_t *grwin)
-{
- grcmd_t *cmd, *next;
-
- for (cmd = grwin->graphics; cmd != NULL; cmd = next) {
- next = cmd->next;
- free(cmd->coords);
- if (cmd->text != NULL)
- free(cmd->text);
- free(cmd);
- }
- grwin->graphics = NULL;
- XClearWindow(R->Xdisplay, grwin->win);
-}
-
-/*
- * arg [0] = x
- * arg [1] = y
- * arg [2] = alignment
- * arg [3] = strlen (text)
- */
-/* ARGSUSED */
-/* INTPROTO */
-void
-rxvt_Gr_Text(pR_ grwin_t *grwin, grcmd_t *data)
-{
- int x, y, align;
-
- if (data->ncoords < 4 || data->text == NULL || *(data->text) == '\0')
- return;
-
- x = data->coords[0] * grwin->w / GRX_SCALE;
- y = data->coords[1] * grwin->h / GRX_SCALE;
- align = data->coords[2];
-
- if ((align & HORIZONTAL_ALIGNMENT) == RIGHT_TEXT)
- x -= XTextWidth(R->TermWin.font, data->text, data->coords[3]);
- else if ((align & HORIZONTAL_ALIGNMENT) == HCENTER_TEXT)
- x -= (XTextWidth(R->TermWin.font, data->text, data->coords[3]) >> 1);
-
- if ((align & VERTICAL_ALIGNMENT) == TOP_TEXT)
- y += R->TermWin.font->ascent;
- else if ((align & VERTICAL_ALIGNMENT) == BOTTOM_TEXT)
- y -= R->TermWin.font->descent;
-
- if ((align & VERTICAL_ALIGNMENT) == VCENTER_TEXT)
- y -= R->TermWin.font->descent
- + ((R->TermWin.font->ascent + R->TermWin.font->descent) >> 1);
- if ((align & VERTICAL_ALIGNMENT) == VCAPS_CENTER_TEXT)
- y += (R->TermWin.font->ascent >> 1);
-
- XPMClearArea(R->Xdisplay, grwin->win, x, y - R->TermWin.font->ascent,
- Width2Pixel(data->coords[3]), Height2Pixel(1), 0);
- XDrawString(R->Xdisplay, grwin->win, R->TermWin.gc, x, y,
- data->text, data->coords[3]);
-}
-
-/* ARGSUSED */
-/* INTPROTO */
-void
-rxvt_Gr_Geometry(pR_ grwin_t *grwin, grcmd_t *data __attribute__((unused)))
-{
- if (grwin)
- rxvt_tt_printf(aR_ "\033G%ld %d %d %u %u %d %d %ld %ld %d\n",
- (long)grwin->win,
- grwin->x, grwin->y, grwin->w, grwin->h,
- R->TermWin.fwidth,
- R->TermWin.fheight,
- (long)GRX_SCALE * R->TermWin.fwidth / grwin->w,
- (long)GRX_SCALE * R->TermWin.fheight / grwin->h,
- XDEPTH);
- else /* rxvt terminal window size */
- rxvt_tt_printf(aR_ "\033G0 0 0 %d %d %d %d %ld %ld %d\n",
- TermWin_TotalWidth(), TermWin_TotalHeight(),
- R->TermWin.fwidth, R->TermWin.fheight,
- (long)GRX_SCALE * R->TermWin.fwidth / R->TermWin.width,
- (long)GRX_SCALE * R->TermWin.fheight / R->TermWin.height,
- XDEPTH);
-}
-
-/* ARGSUSED */
-/* INTPROTO */
-void
-rxvt_Gr_DestroyWindow(pR_ grwin_t *grwin)
-{
- grcmd_t *cmd, *next;
-
- if (grwin == NULL)
- return;
-
- for (cmd = grwin->graphics; cmd; cmd = next) {
- next = cmd->next;
- free(cmd->coords);
- if (cmd->text != NULL)
- free(cmd->text);
- free(cmd);
- }
-
- XDestroyWindow(R->Xdisplay, grwin->win);
- if (grwin->next != NULL)
- grwin->next->prev = grwin->prev;
- if (grwin->prev != NULL)
- grwin->prev->next = grwin->next;
- else
- R->gr_root = grwin->next;
- free(grwin);
-
- R->graphics_up--;
-}
-
-/* ARGSUSED */
-/* INTPROTO */
-void
-rxvt_Gr_Dispatch(pR_ grwin_t *grwin, grcmd_t *data)
-{
- int i, n;
- union {
- XPoint pt[NGRX_PTS / 2];
- XRectangle rect[NGRX_PTS / 4];
- } xdata;
-
- if (data->color != Color_fg) {
- XGCValues gcv;
-
- gcv.foreground = R->PixColors[data->color];
- XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcv);
- }
- if (grwin)
- switch (data->cmd) {
- case 'L':
- if (data->ncoords > 3) {
- for (n = i = 0; i < data->ncoords; i += 2, n++) {
- xdata.pt[n].x = data->coords[i] * grwin->w / GRX_SCALE;
- xdata.pt[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE;
- }
- XDrawLines(R->Xdisplay,
- grwin->win, R->TermWin.gc, xdata.pt, n, CoordModeOrigin);
- }
- break;
-
- case 'P':
- if (data->ncoords > 3) {
- for (n = i = 0; i < data->ncoords; i += 2, n++) {
- xdata.pt[n].x = data->coords[i] * grwin->w / GRX_SCALE;
- xdata.pt[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE;
- }
- XDrawPoints(R->Xdisplay,
- grwin->win, R->TermWin.gc, xdata.pt, n, CoordModeOrigin);
- }
- break;
-
- case 'F':
- if (data->ncoords > 0) {
- for (n = i = 0; i < data->ncoords; i += 4, n++) {
- xdata.rect[n].x = data->coords[i] * grwin->w / GRX_SCALE;
- xdata.rect[n].y = data->coords[i + 1] * grwin->h
- / GRX_SCALE;
- xdata.rect[n].width = ((data->coords[i + 2]
- - data->coords[i] + 1) *
- grwin->w / GRX_SCALE);
- xdata.rect[n].height = ((data->coords[i + 3]
- - data->coords[i + 1] + 1) *
- grwin->h / GRX_SCALE);
- XPMClearArea(R->Xdisplay, grwin->win,
- xdata.rect[n].x, xdata.rect[n].y,
- xdata.rect[n].width, xdata.rect[n].height,
- 0);
- }
- XFillRectangles(R->Xdisplay, grwin->win, R->TermWin.gc, xdata.rect,
- n);
- }
- break;
- case 'T':
- rxvt_Gr_Text(aR_ grwin, data);
- break;
- case 'C':
- rxvt_Gr_ClearWindow(aR_ grwin);
- break;
- }
- if (data->color != Color_fg) {
- XGCValues gcv;
-
- gcv.foreground = R->PixColors[Color_fg];
- XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcv);
- }
-}
-
-/* ARGSUSED */
-/* INTPROTO */
-void
-rxvt_Gr_Redraw(pR_ grwin_t *grwin)
-{
- grcmd_t *cmd;
-
- for (cmd = grwin->graphics; cmd != NULL; cmd = cmd->next)
- rxvt_Gr_Dispatch(aR_ grwin, cmd);
-}
-
-/*----------------------------------------------------------------------*
- * end of static functions
- */
-/* ARGSUSED */
-/* EXTPROTO */
-void
-rxvt_Gr_ButtonReport(pR_ int but, int x, int y)
-{
- grwin_t *grwin;
-
- for (grwin = R->gr_root; grwin != NULL; grwin = grwin->next)
- if ((x > grwin->x)
- && (y > grwin->y)
- && ((unsigned int)x < grwin->x + grwin->w)
- && ((unsigned int)y < grwin->y + grwin->h))
- break;
-
- if (grwin == NULL)
- return;
-
- x = GRX_SCALE * (x - grwin->x) / grwin->w;
- y = GRX_SCALE * (y - grwin->y) / grwin->h;
- rxvt_tt_printf(aR_ "\033%c%ld;%d;%d;\n", but, (long)grwin->win, x, y);
-}
-
-/* ARGSUSED */
-/* EXTPROTO */
-void
-rxvt_Gr_do_graphics(pR_ int cmd, unsigned int nargs, int args[], unsigned char *text)
-{
- int i;
- Window win_id;
- grwin_t *grwin;
- grcmd_t *newcmd, *oldcmd;
-
- if (cmd == 'W') {
- rxvt_Gr_NewWindow(aR_ nargs, args);
- return;
- }
- win_id = (nargs > 0) ? (Window) args[0] : None;
-
- if ((cmd == 'G') && (win_id == None)) {
- rxvt_Gr_Geometry(aR_ NULL, NULL);
- return;
- }
- if ((win_id == None) && (R->gr_last_id != None))
- win_id = R->gr_last_id;
-
- if (win_id == None)
- return;
-
- grwin = R->gr_root;
- while ((grwin != NULL) && (grwin->win != win_id))
- grwin = grwin->next;
-
- if (grwin == NULL)
- return;
-
- if (cmd == 'G') {
- rxvt_Gr_Geometry(aR_ grwin, NULL);
- return;
- }
- nargs--;
- args++; /* skip over window id */
-
-/* record this new command */
- newcmd = (grcmd_t *) rxvt_malloc(sizeof(grcmd_t));
- newcmd->ncoords = nargs;
- newcmd->coords = (int *)rxvt_malloc((newcmd->ncoords * sizeof(int)));
-
- newcmd->next = NULL;
- newcmd->cmd = cmd;
- newcmd->color = rxvt_scr_get_fgcolor(aR);
- newcmd->text = text;
-
- for (i = 0; i < newcmd->ncoords; i++)
- newcmd->coords[i] = args[i];
-
-/*
- * If newcmd == fill, and rectangle is full window, drop all prior
- * commands.
- */
- if ((newcmd->cmd == 'F') && (grwin) && (grwin->graphics)) {
- for (i = 0; i < newcmd->ncoords; i += 4) {
- if ((newcmd->coords[i] == 0)
- && (newcmd->coords[i + 1] == 0)
- && (newcmd->coords[i + 2] == GRX_SCALE)
- && (newcmd->coords[i + 3] == GRX_SCALE)) {
- /* drop previous commands */
- oldcmd = grwin->graphics;
- while (oldcmd->next != NULL) {
- grcmd_t *tmp = oldcmd;
-
- oldcmd = oldcmd->next;
- free(tmp);
- }
- grwin->graphics = NULL;
- }
- }
- }
-/* insert new command into command list */
- oldcmd = grwin->graphics;
- if (oldcmd == NULL)
- grwin->graphics = newcmd;
- else {
- while (oldcmd->next != NULL)
- oldcmd = oldcmd->next;
- oldcmd->next = newcmd;
- }
- rxvt_Gr_Dispatch(aR_ grwin, newcmd);
-}
-
-/* ARGSUSED */
-/* EXTPROTO */
-void
-rxvt_Gr_scroll(pR_ int count)
-{
- grwin_t *grwin, *next;
-
- if ((count == 0) && (R->gr_prev_start == R->TermWin.view_start))
- return;
-
- R->gr_prev_start = R->TermWin.view_start;
-
- for (grwin = R->gr_root; grwin != NULL; grwin = next) {
- next = grwin->next;
- grwin->y -= (count * R->TermWin.fheight);
- if ((long)(grwin->y + grwin->h)
- < -(long)(R->TermWin.saveLines * R->TermWin.fheight))
- rxvt_Gr_DestroyWindow(aR_ grwin);
- else
- XMoveWindow(R->Xdisplay, grwin->win,
- grwin->x,
- grwin->y + (R->TermWin.view_start * R->TermWin.fheight));
- }
-}
-
-/* EXTPROTO */
-void
-rxvt_Gr_ClearScreen(pR)
-{
- grwin_t *grwin, *next;
-
- for (grwin = R->gr_root; grwin != NULL; grwin = next) {
- next = grwin->next;
- if ((grwin->screen == 0) && (grwin->y + grwin->h > 0)) {
- if (grwin->y >= 0)
- rxvt_Gr_DestroyWindow(aR_ grwin);
- else
- XResizeWindow(R->Xdisplay, grwin->win,
- grwin->w, -grwin->y);
- }
- }
-}
-
-/* EXTPROTO */
-void
-rxvt_Gr_ChangeScreen(pR)
-{
- grwin_t *grwin, *next;
-
- for (grwin = R->gr_root; grwin != NULL; grwin = next) {
- next = grwin->next;
- if (grwin->y + grwin->h > 0) {
- if (grwin->screen == 1) {
- XMapWindow(R->Xdisplay, grwin->win);
- grwin->screen = 0;
- } else {
- XUnmapWindow(R->Xdisplay, grwin->win);
- grwin->screen = 1;
- }
- }
- }
-}
-
-/* ARGSUSED */
-/* EXTPROTO */
-void
-rxvt_Gr_expose(pR_ Window win)
-{
- grwin_t *grwin;
-
- for (grwin = R->gr_root; grwin != NULL; grwin = grwin->next) {
- if (grwin->win == win) {
- rxvt_Gr_Redraw(aR_ grwin);
- break;
- }
- }
-}
-
-/* ARGSUSED */
-/* EXTPROTO */
-void
-rxvt_Gr_Resize(pR_ int w __attribute__((unused)), int h)
-{
- grwin_t *grwin;
-
- for (grwin = R->gr_root; grwin != NULL; grwin = grwin->next) {
- if (R->TermWin.height != h) {
- grwin->y += (R->TermWin.height - h);
- XMoveWindow(R->Xdisplay, grwin->win,
- grwin->x,
- grwin->y + (R->TermWin.view_start * R->TermWin.fheight));
- }
- rxvt_Gr_Redraw(aR_ grwin);
- }
-}
-
-/* EXTPROTO */
-void
-rxvt_Gr_reset(pR)
-{
- grwin_t *grwin, *next;
-
- for (grwin = R->gr_root; grwin != NULL; grwin = next) {
- next = grwin->next;
- rxvt_Gr_DestroyWindow(aR_ grwin);
- }
-
- R->graphics_up = 0;
-}
-
-/* EXTPROTO */
-int
-rxvt_Gr_Displayed(pR)
-{
- return R->graphics_up;
-}
-#endif
-/*----------------------- end-of-file (C source) -----------------------*/
+++ /dev/null
-# test/graphics/Makefile.in -*- Makefile -*-
-# $Id: Makefile.in,v 1.2 2003-11-24 17:31:28 pcg Exp $
-@MCOMMON@
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-.PATH: @srcdir@
-
-basedir = ../..
-thisdir = src/graphics
-
-first_rule: qplot
-dummy:
-
-SRCS = grxlib.c qplot.c
-OBJS = grxlib.o qplot.o
-HDRS = grxlib.h
-
-#
-# Distribution variables
-#
-
-DIST = $(HDRS) $(SRCS) README data Makefile.in
-
-# inference rules
-.c.o:
- $(COMPILE) -I$(srcdir)/.. -c $<
-
-#-------------------------------------------------------------------------
-all:
-
-graphics: qplot
-
-qplot: $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -lm
-
-tags: $(SRCS)
- ctags $(SRCS)
-
-alldoc:
-
-allbin: qplot
-
-clean:
- $(RMF) qplot core a.out *.o *.bak *~
-
-realclean: clean
- $(RMF) tags
-
-cleandir: realclean
-
-distclean:
- (cd $(srcdir); $(RMF) qplot *~ *.o core a.out)
- if test $(srcdir) = .; then $(MAKE) realclean; fi
- (cd $(srcdir); $(RMF) Makefile)
-
-install uninstall:
-
-distdirs:
- mkdir $(basedir)/../$(VERNAME)/$(thisdir)
-
-distcopy:
- $(CP) -p $(DIST) $(basedir)/../$(VERNAME)/$(thisdir)
-
-# -----------------------------------------------------------------------
-# forget dependencies, there are too few
+++ /dev/null
-This is an example of rxvt graphics.
+++ /dev/null
-0 1e+4
-1e+4 2e+4
-
-2e+6 5e+2
-5e+2 7e+5
+++ /dev/null
-/*
- * $Id: grxlib.c,v 1.2 2003-11-24 17:31:28 pcg Exp $
- */
-
-#include "../../config.h"
-#include "rxvt.h"
-#include "init.h" /* for GET_TERMIOS / SET_TERMIOS */
-#include "grxlib.h"
-
-/*----------------------------------------------------------------------*/
-
-void
-Done(void)
-{
- putchar(':');
-}
-
-void
-StartLine(long id)
-{
- printf("\033GL%ld", id);
-}
-
-void
-StartPoint(long id)
-{
- printf("\033GP%ld", id);
-}
-
-void
-StartFill(long id)
-{
- printf("\033GF%ld", id);
-}
-
-void
-Extend(int x, int y)
-{
- printf(";%d;%d", x, y);
-}
-
-void
-FillArea(int x1, int y1, int x2, int y2)
-{
- printf(";%d;%d;%d;%d", x1, y1, x2, y2);
-}
-
-void
-PlaceText(long id, int x, int y, int mode, char *text)
-{
- printf("\033GT%ld;%d;%d;%d;%d:%s", id, x, y, mode, strlen(text), text);
- fflush(stdout);
-}
-
-void
-ClearWindow(long id)
-{
- printf("\033GC%ld:", id);
-}
-
-void
-ForeColor(int col)
-{
- printf("\033[3%dm", (col < 0 || col > 7) ? 0 : col);
-}
-
-void
-DefaultRendition(void)
-{
- printf("\033[m");
-}
-
-#define LINESZ 100
-static char line[LINESZ];
-static FILE *infd = NULL;
-
-long
-CreateWin(int x, int y, int w, int h)
-{
- long id = 0;
-
- fflush(stdout);
- printf("\033GW%d;%d;%d;%d:", x, y, w, h);
- fflush(stdout);
- while (1) {
- if ((fgets(line, LINESZ, infd) != NULL) &&
- (sscanf(line, "\033W%ld", &id) == 1))
- break;
- }
- return id;
-}
-
-void
-QueryWin(long id, int *nfwidth, int *nfheight)
-{
- int id1, x, y, width, height, fwidth, fheight;
-
- printf("\033GG%ld:", id);
- fflush(stdout);
- while (1) {
- if ((fgets(line, sizeof(line), infd) != NULL) &&
- (sscanf(line, "\033G%ld %ld %ld %ld %ld %ld %ld %ld %ld",
- &id1, &x, &y, &width, &height,
- &fwidth, &fheight, nfwidth, nfheight) != 0))
- break;
- }
-}
-
-int
-WaitForCarriageReturn(long *win, int *x, int *y)
-{
- int i, len;
-
- fgets(line, LINESZ, infd);
- line[LINESZ - 1] = 0;
- len = strlen(line);
- for (i = 0; i < len; i++) {
- if (line[i] == '\033') {
- int ret = 1;
-
- i++;
- switch (line[i]) {
- case 'R':
- ret++;
- /* drop */
- case 'P':
- sscanf(&line[i + 1], "%ld;%d;%d", win, x, y);
- return ret;
- break;
- }
- }
- }
- return 0;
-}
-
-static int fno2;
-static ttymode_t ttmode;
-
-int
-InitializeGraphics(int scroll_text_up)
-{
- int fno, i;
- char *screen_tty;
- struct winsize winsize;
-
- fno = fileno(stdout);
- if (!isatty(fno)) {
- fprintf(stderr, "stdout must be a tty\n");
- return 0;
- }
- screen_tty = ttyname(fno);
-
-#ifdef HAVE_TERMIOS_H
- GET_TERMIOS(fno, &ttmode);
- ttmode.c_lflag &= ~ECHO;
- SET_TERMIOS(fno, &ttmode);
-#endif
-
- infd = fopen(screen_tty, "rw");
-
-#ifdef HAVE_TERMIOS_H
- fno2 = fileno(infd);
- GET_TERMIOS(fno2, &ttmode);
- ttmode.c_lflag &= ~ECHO;
- SET_TERMIOS(fno2, &ttmode);
-#endif
-
- /* query rxvt to find if graphics are available */
- fflush(stdout);
- printf("\033GQ");
- fflush(stdout);
- while (1) {
- if ((fgets(line, LINESZ, infd) != NULL) &&
- (sscanf(line, "\033G%d", &i) == 1)) {
- if (!i) {
- fprintf(stderr, "rxvt graphics not available\n");
- CloseGraphics();
- return 0;
- }
- break;
- }
- }
- if (scroll_text_up) {
- ioctl(fno, TIOCGWINSZ, &winsize);
- fflush(stdout);
- for (i = 0; i < winsize.ws_row; i++)
- putchar('\n');
- fflush(stdout);
- }
- return i;
-}
-
-void
-CloseGraphics(void)
-{
- DefaultRendition();
- fflush(stdout);
-#ifdef HAVE_TERMIOS_H
- ttmode.c_lflag |= ECHO;
- SET_TERMIOS(fno2, &ttmode);
-#endif
- fclose(infd);
-}
-
-/*----------------------- end-of-file (C source) -----------------------*/
+++ /dev/null
-/*
- * $Id: grxlib.h,v 1.2 2003-11-24 17:31:28 pcg Exp $
- */
-#include "rxvtgrx.h" /* text alignment */
-
-/*function pointer to either StartLine or StartPoint */
-typedef void (*LineFunction) (long id);
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- extern void StartLine (long id);
- extern void StartPoint (long id);
- extern void Extend (int x, int y);
- extern void StartFill (long id);
- extern void FillArea (int x1, int y1, int x2, int y2);
- extern void Done (void);
- extern void PlaceText (long id, int x, int y, int mode, char *text);
-
- extern void ClearWindow (long id);
- extern long CreateWin (int x, int y, int w, int h);
- extern void QueryWin (long id, int *nfwidth, int *nfheight);
- extern void ForeColor (int color);
- extern void DefaultRendition (void);
- extern int WaitForCarriageReturn (long *win, int *x, int *y);
- extern int InitializeGraphics (int scroll_text_up);
- extern void CloseGraphics (void);
-#ifdef __cplusplus
-}
-#endif
-/*----------------------- end-of-file (C header) -----------------------*/
+++ /dev/null
-/*
- * $Id: qplot.c,v 1.2 2003-11-24 17:31:28 pcg Exp $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <signal.h>
-#include "grxlib.h"
-
-#define Real float
-
-#ifndef GRX_SCALE
-# define GRX_SCALE 10000
-#endif
-
-#define DEFAULT_DATA_FILE "data"
-
-static void
-axis_round(Real * min, Real * max, Real * grid_spacing)
-{
- int logspace;
-
- logspace = (int)(log10((*max - *min) / 10.0) + 0.5);
- *grid_spacing = pow(10, (double)logspace);
- *min = (Real) ((int)(*min / (*grid_spacing))) * (*grid_spacing);
- *max = (Real) ((int)(*max / (*grid_spacing)) + 1) * (*grid_spacing);
-}
-
-static int
-nice_end(int junk)
-{
- CloseGraphics();
- putchar('\n');
- exit(EXIT_SUCCESS);
- return 0;
-}
-
-int
-main(int argc, char **argv)
-{
- char *file = NULL;
- int Do_Start = 1, tmp;
- int m, p, i, j, n, nchars, theight, twidth, xclick, yclick;
- int downx = 1000, downy = 1000, upx, upy;
- long id, winclick;
- Real xmax, xmin, ymax, ymin, xdiff, ydiff, xgrid_spacing,
- ygrid_spacing;
- Real *x, *y, *nls;
- LineFunction linetype = StartLine;
- char axis[100], line[256];
- FILE *fd;
-
- x = (Real *)malloc(1000000 * sizeof(Real));
- y = (Real *)malloc(1000000 * sizeof(Real));
- nls = (Real *)malloc(1000 * sizeof(Real));
- if (x == NULL || y == NULL || nls == NULL) {
- fprintf(stderr, "Can't allocate initial memory\n");
- exit(1);
- }
-
- ymax = xmax = -HUGE_VAL;
- ymin = xmin = HUGE_VAL;
-
- for (i = 1; i < argc; i++) {
- if (*argv[i] == '-') {
- if (!strcmp(argv[i], "-nl"))
- linetype = StartPoint;
- else if (argv[i][1] == '\0') /* use stdin */
- file = argv[i];
- else {
-
- fprintf(stderr, "Usage:\n\t %s [options] [file]\n\n", argv[0]);
- fprintf(stderr,
- "where options include:\n"
- " -pt plot with points instead of lines\n\n");
-
- fprintf(stderr,
- "file name `-' specifies stdin\n"
- "if no file name is specified, "
- "the default is \"%s\"\n\n", DEFAULT_DATA_FILE);
-
- return EXIT_FAILURE;
- }
- } else
- file = argv[i];
- }
-
- if (file && !strcmp(file, "-")) {
- fd = stdin;
- file = "stdin";
- } else {
- if (file == NULL)
- file = DEFAULT_DATA_FILE;
-
- if ((fd = fopen(file, "r")) == NULL) {
- fprintf(stderr, "%s: can't open file \"%s\"\n", argv[0], file);
- return EXIT_FAILURE;
- }
- }
- m = 0;
- p = 0;
- while (fgets(line, sizeof(line), fd) != NULL) {
- if (sscanf(line, "%f %f", &x[m], &y[m]) == 2) {
- if (x[m] > xmax)
- xmax = x[m];
- else if (x[m] < xmin)
- xmin = x[m];
- if (y[m] > ymax)
- ymax = y[m];
- else if (y[m] < ymin)
- ymin = y[m];
- m++;
- } else {
- nls[p] = m;
- p++;
- }
- }
- nls[p++] = m;
-
- if (m == 0)
- return;
-
- signal(SIGTERM, nice_end);
- signal(SIGSTOP, nice_end);
- signal(SIGTSTP, nice_end);
- signal(SIGINT, nice_end);
- signal(SIGQUIT, nice_end);
- if (!InitializeGraphics(1))
- return EXIT_FAILURE;
-
- n = 1;
- do {
- axis_round(&xmin, &xmax, &xgrid_spacing);
- axis_round(&ymin, &ymax, &ygrid_spacing);
-
- id = CreateWin(0, 0, GRX_SCALE, GRX_SCALE);
- if (id == 0) {
- fprintf(stderr, "Help id = 0\n");
- return EXIT_FAILURE;
- }
- /* Fill the window in black for real eye-catching graphics! */
- ForeColor(0);
- StartFill(id);
- FillArea(0, 0, GRX_SCALE, GRX_SCALE);
- Done();
-
- /* draw outline box in white */
- ForeColor(7);
-
- /* Draw outline box */
- StartLine(id);
- Extend(1000, 1000);
- Extend(1000, 9000);
- Extend(9000, 9000);
- Extend(9000, 1000);
- Extend(1000, 1000);
- Done();
-
- /* Draw the data - either lines or dots */
- xdiff = 8000 / (xmax - xmin);
- ydiff = 8000 / (ymax - ymin);
-
- for (i = j = 0; j < p; j++) {
- int n = 0;
-
- ForeColor(j % 6 + 1);
- while (((x[i] < xmin) || (x[i] > xmax) ||
- (y[i] < ymin) || (y[i] > ymax)) && (i < nls[j]))
- i++;
-
- while (i < nls[j]) {
- if (n == 0)
- linetype(id);
- Extend(1000 + (x[i] - xmin) * xdiff,
- 9000 - (y[i] - ymin) * ydiff);
- n++;
- if (n > 450) {
- Done();
- n = 0;
- continue;
- }
- i++;
- while ((i < nls[j]) &&
- ((x[i] < xmin) || (x[i] > xmax) ||
- (y[i] < ymin) || (y[i] > ymax)))
- i++;
- }
- if (n > 0)
- Done();
- }
-
- /* Do axis labels in black */
- ForeColor(7);
- QueryWin(id, &twidth, &theight);
- PlaceText(id, GRX_SCALE / 2, 0, HCENTER_TEXT | TOP_TEXT, file);
- PlaceText(id, GRX_SCALE / 2, GRX_SCALE, HCENTER_TEXT | BOTTOM_TEXT,
- "X");
- PlaceText(id, 0, GRX_SCALE / 2, LEFT_TEXT | VCENTER_TEXT, "Y");
- sprintf(axis, "%f", ymax);
- nchars = 1000 / twidth;
- axis[nchars] = 0;
- PlaceText(id, GRX_SCALE / 10, GRX_SCALE / 10,
- RIGHT_TEXT | TOP_TEXT, axis);
- sprintf(axis, "%f", ymin);
- axis[nchars] = 0;
- PlaceText(id, GRX_SCALE / 10, 9 * GRX_SCALE / 10,
- RIGHT_TEXT | BOTTOM_TEXT, axis);
- sprintf(axis, "%f", xmax);
- PlaceText(id, 9 * GRX_SCALE / 10, 9 * GRX_SCALE / 10,
- HCENTER_TEXT | TOP_TEXT, axis);
- sprintf(axis, "%f", xmin);
- PlaceText(id, GRX_SCALE / 10, 9 * GRX_SCALE / 10,
- HCENTER_TEXT | TOP_TEXT, axis);
- fflush(stdout);
-
- do {
- n = WaitForCarriageReturn(&winclick, &xclick, &yclick);
- switch (n) {
- case 1:
- downx = xclick;
- downy = yclick;
- break;
- case 2:
- upx = xclick;
- upy = yclick;
- if (upx < downx) {
- tmp = downx;
- downx = upx;
- upx = tmp;
- }
- if (upy < downy) {
- tmp = downy;
- downy = upy;
- upy = tmp;
- }
- xmin = (xmax - xmin) * (downx - 1000) / (8000) + xmin;
- xmax = (xmax - xmin) * (upx - 1000) / (8000) + xmin;
- ymax = ymax - (ymax - ymin) * (downy - 1000) / (8000);
- ymin = ymax - (ymax - ymin) * (upy - 1000) / (8000);
- break;
- }
- } while (n && (n != 2));
- } while (n);
- nice_end(EXIT_SUCCESS);
- return EXIT_SUCCESS;
-}
-
-/*----------------------- end-of-file (C source) -----------------------*/
#define VERSION "1.5"
#define VSTRING "10500"
-#define DATE "2004-01-16"
-#define LSMDATE "16JAN04"
+#define DATE "2004-01-29"
+#define LSMDATE "29JAN04"
#define LIBVERSION "1:5:0"