diff options
author | dos-reis <gdr@axiomatics.org> | 2008-03-09 03:47:21 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-03-09 03:47:21 +0000 |
commit | 6e07ce8f0c6c77b61cfa2f8be54781160018ff91 (patch) | |
tree | 91e5069719c924bd58242e932bd585d3e676112b /src/graph/Gdraws | |
parent | 3f7d906f8cd6edd2597a49f629bd31914de8ca08 (diff) | |
download | open-axiom-6e07ce8f0c6c77b61cfa2f8be54781160018ff91.tar.gz |
* graph/: Depamphletize.
* include/addfile.h: Move from hyper.
* include/addfile.H1: Move external declarations into
addfile.h. Remove.
Diffstat (limited to 'src/graph/Gdraws')
-rw-r--r--[-rwxr-xr-x] | src/graph/Gdraws/Gdraws0.h | 62 | ||||
-rw-r--r-- | src/graph/Gdraws/Gfun.c (renamed from src/graph/Gdraws/Gfun.c.pamphlet) | 362 | ||||
-rw-r--r-- | src/graph/Gdraws/Makefile.in | 9 | ||||
-rw-r--r-- | src/graph/Gdraws/data.c (renamed from src/graph/Gdraws/data.c.pamphlet) | 84 | ||||
-rw-r--r-- | src/graph/Gdraws/loadFont.c | 51 | ||||
-rw-r--r-- | src/graph/Gdraws/loadFont.c.pamphlet | 71 | ||||
-rw-r--r-- | src/graph/Gdraws/main.c | 195 | ||||
-rw-r--r-- | src/graph/Gdraws/main.c.pamphlet | 215 | ||||
-rw-r--r-- | src/graph/Gdraws/menu.c | 62 | ||||
-rw-r--r-- | src/graph/Gdraws/menu.c.pamphlet | 82 | ||||
-rw-r--r-- | src/graph/Gdraws/yesORno.c | 46 | ||||
-rw-r--r-- | src/graph/Gdraws/yesORno.c.pamphlet | 67 |
12 files changed, 591 insertions, 715 deletions
diff --git a/src/graph/Gdraws/Gdraws0.h b/src/graph/Gdraws/Gdraws0.h index 62066b69..8d703347 100755..100644 --- a/src/graph/Gdraws/Gdraws0.h +++ b/src/graph/Gdraws/Gdraws0.h @@ -1,34 +1,36 @@ /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _GDRAWS0_H_ diff --git a/src/graph/Gdraws/Gfun.c.pamphlet b/src/graph/Gdraws/Gfun.c index c7ef9d6e..ffb8275a 100644 --- a/src/graph/Gdraws/Gfun.c.pamphlet +++ b/src/graph/Gdraws/Gfun.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph Gfun.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@ -<<*>>= -<<license>> #define _GFUN_C @@ -117,21 +103,21 @@ PSCreateFile( i = 1; while (i < psDrawNo) { /* loops through each file/procedure */ if (psData[i].flag) { /* if set, procedure/file is used */ - if ((ifp = fopen(psData[i].filename, "r")) == NULL) { - if (i == GCdictps) { /* GC dictionaries */ - fprintf(stderr, "Warning: missing GCdictionary.\n"); + if ((ifp = fopen(psData[i].filename, "r")) == NULL) { + if (i == GCdictps) { /* GC dictionaries */ + fprintf(stderr, "Warning: missing GCdictionary.\n"); } - else { - fprintf(stderr, "Cannot open %s to read.\n", - psData[i].filename); - fclose(ofp); - return (psError); - } - } - else { - filecopy(ifp, ofp); - fclose(ifp); - } + else { + fprintf(stderr, "Cannot open %s to read.\n", + psData[i].filename); + fclose(ofp); + return (psError); + } + } + else { + filecopy(ifp, ofp); + fclose(ifp); + } } i++; } @@ -169,7 +155,7 @@ Gdraws_drawFrame( /* choose 2 and "frameDict" for frame dictionary: can be anything else */ PSCreateContext((GC)2, "frameDict", borderW, psButtCap, psMiterJoin, - psWhite, psBlack); + psWhite, psBlack); fp = fopen(psData[scriptps].filename, "a"); @@ -179,7 +165,7 @@ Gdraws_drawFrame( XGetWindowAttributes(dsply, titleWindow, &twInfo); fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\ttitle\n", "frameDict", - twInfo.height - vwInfo.height, twInfo.width, 0, vwInfo.height); + twInfo.height - vwInfo.height, twInfo.width, 0, vwInfo.height); /* draw viewport window */ @@ -189,7 +175,7 @@ Gdraws_drawFrame( psData[drawIstrps].flag = yes; fprintf(fp, "\t%s\tloadFont\n\t%d\t(%s) stringwidth pop sub 2 div\n", - "frameDict", twInfo.width, title); + "frameDict", twInfo.width, title); fprintf(fp, "\t%d\t(%s)\t(%s)\tpsDrawIStr\n", 15, title, "title"); return (fclose(fp)); @@ -200,8 +186,8 @@ Gdraws_drawFrame( int Gdraws_setDimension( - Window viewWindow, - Window titleWindow) + Window viewWindow, + Window titleWindow) { FILE *fp; XWindowAttributes vwInfo, twInfo; @@ -231,7 +217,7 @@ Gdraws_setDimension( } else { if (vwInfo.height > pageHeight) - fprintf(fp, "\t%f\t%f", width, pageHeight / width); + fprintf(fp, "\t%f\t%f", width, pageHeight / width); } } else { @@ -240,7 +226,7 @@ Gdraws_setDimension( fprintf(fp, "\tscale\n\n"); fprintf(fp, "\t%d\t%d\t%d\tsetDim\n", twInfo.height - vwInfo.height, - vwInfo.height, vwInfo.width); + vwInfo.height, vwInfo.width); /* Write a Bounding Box for psfig etc. */ @@ -272,14 +258,14 @@ GDrawImageString( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawImageString cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawImageString cannot open %s\n", + psData[scriptps].filename); + return (psError); } psData[drawIstrps].flag = yes; /* set procedure flag */ fprintf(fp, "\t%s\t%d\t%d\t(%s)\t(%s)\tpsDrawIStr\n", - PSfindGC(gc), x, y, string, "window"); + PSfindGC(gc), x, y, string, "window"); s = fclose(fp); } break; @@ -311,20 +297,20 @@ GDrawArc( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawArc cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawArc cannot open %s\n", + psData[scriptps].filename); + return (psError); } psData[drawarcps].flag = yes; fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\t%d\t%d\tpsDrawArc\n", - PSfindGC(gc), x, y, hght, wdth, ang1 / 64, ang2 / 64); + PSfindGC(gc), x, y, hght, wdth, ang1 / 64, ang2 / 64); s = fclose(fp); } break; default: fprintf(stderr, "Gdrawarc request (%d) not implemented yet.\n", - dFlag); + dFlag); return (psError); } return (s); @@ -350,20 +336,20 @@ GDrawLine( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawLine cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawLine cannot open %s\n", + psData[scriptps].filename); + return (psError); } psData[drawlineps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\tpsDrawLine\n", - PSfindGC(gc), x1, y1, x0, y0); + PSfindGC(gc), x1, y1, x0, y0); s = fclose(fp); } break; default: fprintf(stderr, "Gdrawline request (%d) not implemented yet.\n", - dFlag); + dFlag); return (psError); } return (s); @@ -397,9 +383,9 @@ GDrawLines( int i = 0; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawLines cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawLines cannot open %s\n", + psData[scriptps].filename); + return (psError); } psData[drawlinesps].flag = yes; /* set procedure flag */ @@ -411,13 +397,13 @@ GDrawLines( } fprintf(fp, "\t%d\t%d\t%d\tpsDrawLines\n", - numberOfPoints, points[i].x, points[i].y); + numberOfPoints, points[i].x, points[i].y); s = fclose(fp); } break; default: fprintf(stderr, "Gdrawlines request (%d) not implemented yet\n", - dFlag); + dFlag); return (psError); } return (s); @@ -444,20 +430,20 @@ GDrawPoint( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawPoint cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawPoint cannot open %s\n", + psData[scriptps].filename); + return (psError); } psData[drawpointps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\tpsDrawPoint\n", - PSfindGC(gc), x0, y0, x0 + 1, y0 + 1); + PSfindGC(gc), x0, y0, x0 + 1, y0 + 1); s = fclose(fp); } break; default: fprintf(stderr, "Gdrawpoint request (%d) not implemented yet\n", - dFlag); + dFlag); return (psError); } return (s); @@ -485,20 +471,20 @@ GDrawRectangle( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawRect cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawRect cannot open %s\n", + psData[scriptps].filename); + return (psError); } psData[drawrectps].flag = yes; fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\tpsDrawRect\n", - PSfindGC(gc), width, height, x, y); + PSfindGC(gc), width, height, x, y); s = fclose(fp); } break; default: fprintf(stderr, "Gdrawrect request (%d) not implemented yet\n", - dFlag); + dFlag); return (psError); } return (s); @@ -522,14 +508,14 @@ GDraw3DButtonOut( /* add extra line down rhs */ GDrawLine(gc, windowId, - x + width, y + 1, x + width, y + height, - dFlag); + x + width, y + 1, x + width, y + height, + dFlag); /* add extra line across bottom */ GDrawLine(gc, windowId, - x + 1, y + height, x + width, y + height, - dFlag); + x + 1, y + height, x + width, y + height, + dFlag); return (s); } @@ -552,14 +538,14 @@ GDraw3DButtonIn( /* add extra line down lhs */ GDrawLine(gc, windowId, - x, y, x, y + height - 1, - dFlag); + x, y, x, y + height - 1, + dFlag); /* add extra line across top */ GDrawLine(gc, windowId, - x, y, x + width - 1, y, - dFlag); + x, y, x + width - 1, y, + dFlag); return (s); } @@ -593,9 +579,9 @@ GDrawPushButton( GSetForeground(gc2, (float) color, dFlag); return GDrawString(gc2, windowId, - x + (isOn ? 2 : 0) + centerX(gc3, text, len, width), - y + (isOn ? 2 : 0) + centerY(gc3, height), - text, len, dFlag); + x + (isOn ? 2 : 0) + centerX(gc3, text, len, width), + y + (isOn ? 2 : 0) + centerY(gc3, height), + text, len, dFlag); } @@ -623,21 +609,21 @@ GDrawString( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawString cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawString cannot open %s\n", + psData[scriptps].filename); + return (psError); } psData[drawstrps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\t(%s)\t%d\t%d\tpsDrawStr\n", - PSfindGC(gc), string, x, y); + PSfindGC(gc), string, x, y); s = fclose(fp); } break; default: fprintf(stderr, "Gdrawstring request (%d) not implemented yet\n", - dFlag); + dFlag); return (psError); } return (s); @@ -666,21 +652,21 @@ GFillArc( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GFillArc cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GFillArc cannot open %s\n", + psData[scriptps].filename); + return (psError); } psData[fillarcps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\t%d %d\t%d %d\t%d %d\t%d %d\tpsFillArc\n", - PSfindGC(gc), x, y, hght, wdth, ang1 / 64, ang2 / 64, - x + wdth / 2, y + hght / 2); + PSfindGC(gc), x, y, hght, wdth, ang1 / 64, ang2 / 64, + x + wdth / 2, y + hght / 2); s = fclose(fp); } break; default: fprintf(stderr, "GFillArc request (%d) not implemented yet\n", - dFlag); + dFlag); return (psError); } return (s); @@ -713,74 +699,74 @@ PSGlobalInit(void) sprintf(psData[headerps].filename, "%s%s", envAXIOM, "/Gdraws/PS/header.ps"); sprintf(psData[drawps].filename, "%s%s", envAXIOM, "/Gdraws/PS/draw.ps"); sprintf(psData[drawarcps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drawarc.ps"); + "/Gdraws/PS/drawarc.ps"); sprintf(psData[drawfilledps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drwfilled.ps"); + "/Gdraws/PS/drwfilled.ps"); sprintf(psData[drawcolorps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drawcolor.ps"); + "/Gdraws/PS/drawcolor.ps"); sprintf(psData[fillpolyps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/fillpoly.ps"); + "/Gdraws/PS/fillpoly.ps"); sprintf(psData[colorpolyps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/colorpoly.ps"); + "/Gdraws/PS/colorpoly.ps"); sprintf(psData[fillwolps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/fillwol.ps"); + "/Gdraws/PS/fillwol.ps"); sprintf(psData[colorwolps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/colorwol.ps"); + "/Gdraws/PS/colorwol.ps"); sprintf(psData[drawpointps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drawpoint.ps"); + "/Gdraws/PS/drawpoint.ps"); sprintf(psData[drawlineps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drawline.ps"); + "/Gdraws/PS/drawline.ps"); sprintf(psData[drawlinesps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drawlines.ps"); + "/Gdraws/PS/drawlines.ps"); sprintf(psData[drawrectps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drawrect.ps"); + "/Gdraws/PS/drawrect.ps"); sprintf(psData[drawstrps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drawstr.ps"); + "/Gdraws/PS/drawstr.ps"); sprintf(psData[drawIstrps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/drawIstr.ps"); + "/Gdraws/PS/drawIstr.ps"); sprintf(psData[fillarcps].filename, "%s%s", envAXIOM, - "/Gdraws/PS/fillarc.ps"); + "/Gdraws/PS/fillarc.ps"); sprintf(psData[setupps].filename, "%s%s", envAXIOM, "/Gdraws/PS/setup.ps"); sprintf(psData[endps].filename, "%s%s", envAXIOM, "/Gdraws/PS/end.ps"); } else if ((envAXIOM = getenv("AXIOM")) != NULL) { psData[headerps].flag = yes; sprintf(psData[headerps].filename, "%s%s", envAXIOM, - "/lib/graph/header.ps"); + "/lib/graph/header.ps"); sprintf(psData[drawps].filename, "%s%s", envAXIOM, - "/lib/graph/draw.ps"); + "/lib/graph/draw.ps"); sprintf(psData[drawarcps].filename, "%s%s", envAXIOM, - "/lib/graph/drawarc.ps"); + "/lib/graph/drawarc.ps"); sprintf(psData[drawfilledps].filename, "%s%s", envAXIOM, - "/lib/graph/drwfilled.ps"); + "/lib/graph/drwfilled.ps"); sprintf(psData[drawcolorps].filename, "%s%s", envAXIOM, - "/lib/graph/drawcolor.ps"); + "/lib/graph/drawcolor.ps"); sprintf(psData[fillpolyps].filename, "%s%s", envAXIOM, - "/lib/graph/fillpoly.ps"); + "/lib/graph/fillpoly.ps"); sprintf(psData[colorpolyps].filename, "%s%s", envAXIOM, - "/lib/graph/colorpoly.ps"); + "/lib/graph/colorpoly.ps"); sprintf(psData[fillwolps].filename, "%s%s", envAXIOM, - "/lib/graph/fillwol.ps"); + "/lib/graph/fillwol.ps"); sprintf(psData[colorwolps].filename, "%s%s", envAXIOM, - "/lib/graph/colorwol.ps"); + "/lib/graph/colorwol.ps"); sprintf(psData[drawpointps].filename, "%s%s", envAXIOM, - "/lib/graph/drawpoint.ps"); + "/lib/graph/drawpoint.ps"); sprintf(psData[drawlineps].filename, "%s%s", envAXIOM, - "/lib/graph/drawline.ps"); + "/lib/graph/drawline.ps"); sprintf(psData[drawlinesps].filename, "%s%s", envAXIOM, - "/lib/graph/drawlines.ps"); + "/lib/graph/drawlines.ps"); sprintf(psData[drawrectps].filename, "%s%s", envAXIOM, - "/lib/graph/drawrect.ps"); + "/lib/graph/drawrect.ps"); sprintf(psData[drawstrps].filename, "%s%s", envAXIOM, - "/lib/graph/drawstr.ps"); + "/lib/graph/drawstr.ps"); sprintf(psData[drawIstrps].filename, "%s%s", envAXIOM, - "/lib/graph/drawIstr.ps"); + "/lib/graph/drawIstr.ps"); sprintf(psData[fillarcps].filename, "%s%s", envAXIOM, - "/lib/graph/fillarc.ps"); + "/lib/graph/fillarc.ps"); sprintf(psData[setupps].filename, "%s%s", envAXIOM, - "/lib/graph/setup.ps"); + "/lib/graph/setup.ps"); sprintf(psData[endps].filename, "%s%s", envAXIOM, - "/lib/graph/end.ps"); + "/lib/graph/end.ps"); } else { fprintf(stderr, " need environment variable AXIOM or DEVE; process aborted\n"); @@ -872,12 +858,12 @@ PSCreateContext( if ((fp = fopen(psData[GCdictps].filename, "a")) == NULL) { fprintf(stderr, "PSCreateContext cannot open %s\n", - psData[GCdictps].filename); + psData[GCdictps].filename); return (psError); } fprintf(fp, "\t%d\t%d\t%d\n\t%f\t%f\t/%s\tmakeDict\n", joinStyle, - capStyle, lineWidth, bg, fg, C_gc); + capStyle, lineWidth, bg, fg, C_gc); return (fclose(fp)); } @@ -925,9 +911,9 @@ GSetForeground( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GSetForeground cannot open %s\n", - psData[scriptps].filename); - return (0); + fprintf(stderr, "GSetForeground cannot open %s\n", + psData[scriptps].filename); + return (0); } fprintf(fp, "\t%s\t%f\tsetForeground\n", PSfindGC(gc), color); s = fclose(fp); @@ -961,9 +947,9 @@ GSetBackground( FILE *fp; if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GSetBackground cannot open %s\n", - psData[scriptps].filename); - return (0); + fprintf(stderr, "GSetBackground cannot open %s\n", + psData[scriptps].filename); + return (0); } fprintf(fp, "\t%s\t%f\tsetBackground\n", PSfindGC(gc), color); s = fclose(fp); @@ -993,7 +979,7 @@ GSetLineAttributes( switch (dFlag) { case Xoption: XSetLineAttributes(dsply, gc, lineWidth, lineStyle, - capStyle, joinStyle); + capStyle, joinStyle); break; case PSoption: { @@ -1003,32 +989,32 @@ GSetLineAttributes( switch (capStyle) { case 0: /* CapNotLast is not implemented in ps */ case 1: - psCap = psButtCap; - break; + psCap = psButtCap; + break; case 2: - psCap = psRoundCap; - break; + psCap = psRoundCap; + break; case 3: - psCap = psPSqCap; - break; + psCap = psPSqCap; + break; default: - fprintf(stderr, "cap style: %d unknown, using default.\n", capStyle); - psCap = psButtCap; + fprintf(stderr, "cap style: %d unknown, using default.\n", capStyle); + psCap = psButtCap; } switch (joinStyle) { case 0: - psJoin = psMiterJoin; - break; + psJoin = psMiterJoin; + break; case 1: - psJoin = psRoundJoin; - break; + psJoin = psRoundJoin; + break; case 2: - psJoin = psBevelJoin; - break; + psJoin = psBevelJoin; + break; default: - fprintf(stderr, "join style: %d unknown, using default.\n", joinStyle); - psJoin = psMiterJoin; + fprintf(stderr, "join style: %d unknown, using default.\n", joinStyle); + psJoin = psMiterJoin; } /* @@ -1038,13 +1024,13 @@ GSetLineAttributes( */ if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GSetLineAttributes cannot open %s\n", - psData[scriptps].filename); - return (0); + fprintf(stderr, "GSetLineAttributes cannot open %s\n", + psData[scriptps].filename); + return (0); } fprintf(fp, "\t%d\t%d\t%d\t%s\tsetLineAttributes\n", - lineWidth, psCap, psJoin, PSfindGC(gc)); + lineWidth, psCap, psJoin, PSfindGC(gc)); s = fclose(fp); } break; @@ -1115,7 +1101,7 @@ centerY (GC viewGCy,int windowHeight) fontStruct = XQueryFont(dsply,con); if (fontStruct == NULL) return(0); result = (windowHeight - - (fontStruct->max_bounds.ascent + fontStruct->max_bounds.descent))/2 + + (fontStruct->max_bounds.ascent + fontStruct->max_bounds.descent))/2 + fontStruct->max_bounds.ascent; XFreeFontInfo(NULL,fontStruct,1); return(result); @@ -1140,7 +1126,7 @@ PSColorPolygon( if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "PSColorPolygon cannot open %s\n", - psData[scriptps].filename); + psData[scriptps].filename); return (psError); } @@ -1190,7 +1176,7 @@ PSColorwOutline( } fprintf(fp, "\t%d\t%d\t%d\tpsFillwOutline\n", - numberOfPoints, points[i].x, points[i].y); + numberOfPoints, points[i].x, points[i].y); return (fclose(fp)); } @@ -1211,7 +1197,7 @@ PSDrawColor( if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "GDraw cannot open %s\n", - psData[scriptps].filename); + psData[scriptps].filename); return (psError); } @@ -1245,7 +1231,7 @@ PSFillPolygon( if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "PSFillPolygon cannot open %s\n", - psData[scriptps].filename); + psData[scriptps].filename); return (psError); } @@ -1292,7 +1278,7 @@ PSFillwOutline( } fprintf(fp, "\t%d\t%d\t%d\tpsFillwOutline\n", - numberOfPoints, points[i].x, points[i].y); + numberOfPoints, points[i].x, points[i].y); return (fclose(fp)); } @@ -1341,9 +1327,3 @@ XDeleteAssoc(Display * dsp,HashTable * table, Window w) -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/Gdraws/Makefile.in b/src/graph/Gdraws/Makefile.in index 597116d0..434b29bb 100644 --- a/src/graph/Gdraws/Makefile.in +++ b/src/graph/Gdraws/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, Gabriel Dos Reis. +# Copyright (C) 2007-2008, Gabriel Dos Reis. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -55,15 +55,13 @@ DOTH= $(axiom_src_srcdir)/graph/viewman # a .c file in the library subdirectory DOTC= $(axiom_src_srcdir)/lib -pamphlets = Gfun.c.pamphlet psFiles.pamphlet Makefile.pamphlet - AXIOM_CFLAGS = ${CCF} -I${LINC} -I${GINC} -I$(srcdir) -I${HINC} \ $(axiom_includes) ${AXIOM_X11_CFLAGS} subdir = src/graph/Gdraws/ -pamphlets = Makefile.pamphlet Gfun.c.pamphlet psFiles.pamphlet +pamphlets = psFiles.pamphlet HEADERS = ${IN}/Gdraws0.h ${LINC}/G.h ${LINC}/Gfun.H1 \ ${GINC}/hash.h ${GINC}/hash.H1 $(axiom_c_macros_h) @@ -91,9 +89,6 @@ stamp: Gfun.$(OBJEXT) $(PSfiles) $(PS)/%.ps: $(srcdir)/psFiles.pamphlet $(axiom_build_document) --tangle=$* --output=$@ $< -Gfun.c: $(srcdir)/Gfun.c.pamphlet - $(axiom_build_document) --tangle --output=$@ $< - Gfun.$(OBJEXT): ${HEADERS} Gfun.$(OBJEXT): $(builddir)/Gfun.c diff --git a/src/graph/Gdraws/data.c.pamphlet b/src/graph/Gdraws/data.c index 70c113b6..d3f58173 100644 --- a/src/graph/Gdraws/data.c.pamphlet +++ b/src/graph/Gdraws/data.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph data.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= /* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C), 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@ -<<*>>= -<<license>> /* Data file to test out Gdraw functions */ @@ -248,9 +234,3 @@ Gdraws_data(int dFlag) return (1); } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/Gdraws/loadFont.c b/src/graph/Gdraws/loadFont.c new file mode 100644 index 00000000..dc557525 --- /dev/null +++ b/src/graph/Gdraws/loadFont.c @@ -0,0 +1,51 @@ +/* + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +/* load_font for display to test out Gdraw functions in this directory */ + +#include "Gdraws0.h" +#include "../include/G.h" + +#include <stdio.h> + +void +Gdraws_load_font(XFontStruct **font_info, char *fontname) +{ + if ((*font_info = XLoadQueryFont(dsply, fontname)) == NULL) { + fprintf(stderr, "cannot open font %s\n", fontname); + exit(-1); + } +} diff --git a/src/graph/Gdraws/loadFont.c.pamphlet b/src/graph/Gdraws/loadFont.c.pamphlet deleted file mode 100644 index 72484e13..00000000 --- a/src/graph/Gdraws/loadFont.c.pamphlet +++ /dev/null @@ -1,71 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph loadFont.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= -/* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -@ -<<*>>= -<<license>> - - -/* load_font for display to test out Gdraw functions in this directory */ - -#include "Gdraws0.h" -#include "../include/G.h" - -#include <stdio.h> - -void -Gdraws_load_font(XFontStruct **font_info, char *fontname) -{ - if ((*font_info = XLoadQueryFont(dsply, fontname)) == NULL) { - fprintf(stderr, "cannot open font %s\n", fontname); - exit(-1); - } -} -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/Gdraws/main.c b/src/graph/Gdraws/main.c new file mode 100644 index 00000000..7d8e99fe --- /dev/null +++ b/src/graph/Gdraws/main.c @@ -0,0 +1,195 @@ +/* + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +/* main procedure to test out Gdraw functions in this directory */ +#include <stdio.h> +#include "Gdraws0.h" +#include "../view3D/header.h" + +GC gc, gc1; +Display *dsply; +int scrn; +viewPoints *viewport; + +int psInit=no; +GCptr GChead=NULL; +char *PSfilename="OUTPUT.ps"; +char *envAXIOM; + +int +main(int argc, char **argv) +{ + + XGCValues values; + + XEvent report; + int x0=0, y0=0, width=300, height=200, border=3; + + char *fontname = "6x13"; + XFontStruct *dsp_font; + + Window menu; + char *str1 = " Print out the PostScript file? ", + *str0 = "Generate a PostScript file (OUTPUT.ps)?"; + int m_width, m_height, flag=yes; + + /* open display */ + if ((dsply = XOpenDisplay(NULL)) == NULL) { + printf("Can't open display NULL\n"); + exit(-1); + } + + scrn = DefaultScreen(dsply); + + /* access font */ + Gdraws_load_font(&dsp_font, fontname); + + values.background = WhitePixel(dsply, scrn); + values.foreground = BlackPixel(dsply, scrn); + + gc = XCreateGC(dsply, RootWindow(dsply, scrn), + (GCForeground | GCBackground), &values); + PSGlobalInit(); /* must initiate before using G/PS functions */ + PSCreateContext(gc, "gc", psNormalWidth, psButtCap, + psMiterJoin, psWhite, psBlack); + XSetFont(dsply, gc, dsp_font->fid); + gc1 = XCreateGC(dsply, RootWindow(dsply, scrn), + (GCForeground | GCBackground), &values); + PSCreateContext(gc1, "gc1", psNormalWidth, psButtCap, psMiterJoin, + psWhite, psBlack); + XSetFont(dsply, gc1, dsp_font->fid); + + if (!(viewport = (viewPoints *)malloc(sizeof(viewPoints)))) { + fprintf(stderr,"Ran out of memory (malloc) trying to create a viewport.\n"); + exit(-1); + } + + viewport->titleWindow = XCreateSimpleWindow(dsply, RootWindow(dsply,scrn), + x0, y0, width+6, + height+32+height/4, border, + BlackPixel(dsply, scrn), + WhitePixel(dsply, scrn)); + + viewport->viewWindow = XCreateSimpleWindow(dsply, viewport->titleWindow, + x0, y0+20, width, height, border, + BlackPixel(dsply, scrn), + WhitePixel(dsply, scrn)); + + strcpy(viewport->title, "what is a test title?"); + + m_width = width; m_height = height/4; + menu = XCreateSimpleWindow(dsply, viewport->titleWindow, x0, y0+20+height+6, + m_width, m_height, border, + BlackPixel(dsply,scrn), WhitePixel(dsply,scrn)); + + XSelectInput(dsply, viewport->viewWindow, + KeyPressMask|ButtonPressMask|ExposureMask); + XSelectInput(dsply, viewport->titleWindow, KeyPressMask|ExposureMask); + XSelectInput(dsply, menu, KeyPressMask|ButtonPressMask|ExposureMask); + + XMapWindow(dsply, viewport->viewWindow); + XMapWindow(dsply, viewport->titleWindow); + XFlush(dsply); + + while (yes) { + XNextEvent(dsply, &report); + switch (report.type) { + + case Expose: + if (report.xexpose.window==viewport->titleWindow) { + if (GDrawImageString(gc, viewport->titleWindow, + 20, 15, viewport->title, + strlen(viewport->title),X) == psError) + printf("screen draw image string failed.\n"); + if (Gdraws_data(X) == psError) + printf("screen Gdraws_data failed.\n"); + } + if (report.xexpose.window==viewport->viewWindow) { + if (Gdraws_data(X) == psError) + printf("screen Gdraws_data failed.\n"); + } + else if (report.xexpose.window==menu) { + if (flag) + Gdraws_draw_menu(menu, str0, m_width, m_height); + else + Gdraws_draw_menu(menu, str1, m_width, m_height); + } + break; + + case ButtonPress: + if (report.xbutton.window==viewport->viewWindow) { + XMapWindow(dsply, menu); + XFlush(dsply); + } + else if (report.xbutton.window==menu && flag) { + XUnmapWindow(dsply, menu); + if (Gdraws_pressed_yes(m_width, m_height, report.xbutton.x, + report.xbutton.y)) { + flag=no; + XMapWindow(dsply, menu); + PSInit(viewport->viewWindow, viewport->titleWindow); + if (Gdraws_data(PS) != psError) + PSCreateFile(3,viewport->viewWindow, + viewport->titleWindow,viewport->title); + else printf("PS Gdraws_data failed.\n"); + } + } + else if (report.xbutton.window==menu && !flag) { + XUnmapWindow(dsply, menu); + if (Gdraws_pressed_yes(m_width, m_height, report.xbutton.x, + report.xbutton.y)) + system("print OUTPUT.ps"); + flag = yes; + } + break; + + case KeyPress: + if (report.xkey.window==viewport->viewWindow || + report.xkey.window==viewport->titleWindow) { + XFreeGC(dsply, gc); + XFreeGC(dsply, gc1); + XCloseDisplay(dsply); + PSClose(); + exit(1); + } + else if (report.xkey.window==menu) XUnmapWindow(dsply, menu); + + default: + break; + } + } + return 0; +} diff --git a/src/graph/Gdraws/main.c.pamphlet b/src/graph/Gdraws/main.c.pamphlet deleted file mode 100644 index 838b4bbb..00000000 --- a/src/graph/Gdraws/main.c.pamphlet +++ /dev/null @@ -1,215 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph main.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= -/* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -@ -<<*>>= -<<license>> - - -/* main procedure to test out Gdraw functions in this directory */ -#include <stdio.h> -#include "Gdraws0.h" -#include "../view3D/header.h" - -GC gc, gc1; -Display *dsply; -int scrn; -viewPoints *viewport; - -int psInit=no; -GCptr GChead=NULL; -char *PSfilename="OUTPUT.ps"; -char *envAXIOM; - -int -main(int argc, char **argv) -{ - - XGCValues values; - - XEvent report; - int x0=0, y0=0, width=300, height=200, border=3; - - char *fontname = "6x13"; - XFontStruct *dsp_font; - - Window menu; - char *str1 = " Print out the PostScript file? ", - *str0 = "Generate a PostScript file (OUTPUT.ps)?"; - int m_width, m_height, flag=yes; - - /* open display */ - if ((dsply = XOpenDisplay(NULL)) == NULL) { - printf("Can't open display NULL\n"); - exit(-1); - } - - scrn = DefaultScreen(dsply); - - /* access font */ - Gdraws_load_font(&dsp_font, fontname); - - values.background = WhitePixel(dsply, scrn); - values.foreground = BlackPixel(dsply, scrn); - - gc = XCreateGC(dsply, RootWindow(dsply, scrn), - (GCForeground | GCBackground), &values); - PSGlobalInit(); /* must initiate before using G/PS functions */ - PSCreateContext(gc, "gc", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - XSetFont(dsply, gc, dsp_font->fid); - gc1 = XCreateGC(dsply, RootWindow(dsply, scrn), - (GCForeground | GCBackground), &values); - PSCreateContext(gc1, "gc1", psNormalWidth, psButtCap, psMiterJoin, - psWhite, psBlack); - XSetFont(dsply, gc1, dsp_font->fid); - - if (!(viewport = (viewPoints *)malloc(sizeof(viewPoints)))) { - fprintf(stderr,"Ran out of memory (malloc) trying to create a viewport.\n"); - exit(-1); - } - - viewport->titleWindow = XCreateSimpleWindow(dsply, RootWindow(dsply,scrn), - x0, y0, width+6, - height+32+height/4, border, - BlackPixel(dsply, scrn), - WhitePixel(dsply, scrn)); - - viewport->viewWindow = XCreateSimpleWindow(dsply, viewport->titleWindow, - x0, y0+20, width, height, border, - BlackPixel(dsply, scrn), - WhitePixel(dsply, scrn)); - - strcpy(viewport->title, "what is a test title?"); - - m_width = width; m_height = height/4; - menu = XCreateSimpleWindow(dsply, viewport->titleWindow, x0, y0+20+height+6, - m_width, m_height, border, - BlackPixel(dsply,scrn), WhitePixel(dsply,scrn)); - - XSelectInput(dsply, viewport->viewWindow, - KeyPressMask|ButtonPressMask|ExposureMask); - XSelectInput(dsply, viewport->titleWindow, KeyPressMask|ExposureMask); - XSelectInput(dsply, menu, KeyPressMask|ButtonPressMask|ExposureMask); - - XMapWindow(dsply, viewport->viewWindow); - XMapWindow(dsply, viewport->titleWindow); - XFlush(dsply); - - while (yes) { - XNextEvent(dsply, &report); - switch (report.type) { - - case Expose: - if (report.xexpose.window==viewport->titleWindow) { - if (GDrawImageString(gc, viewport->titleWindow, - 20, 15, viewport->title, - strlen(viewport->title),X) == psError) - printf("screen draw image string failed.\n"); - if (Gdraws_data(X) == psError) - printf("screen Gdraws_data failed.\n"); - } - if (report.xexpose.window==viewport->viewWindow) { - if (Gdraws_data(X) == psError) - printf("screen Gdraws_data failed.\n"); - } - else if (report.xexpose.window==menu) { - if (flag) - Gdraws_draw_menu(menu, str0, m_width, m_height); - else - Gdraws_draw_menu(menu, str1, m_width, m_height); - } - break; - - case ButtonPress: - if (report.xbutton.window==viewport->viewWindow) { - XMapWindow(dsply, menu); - XFlush(dsply); - } - else if (report.xbutton.window==menu && flag) { - XUnmapWindow(dsply, menu); - if (Gdraws_pressed_yes(m_width, m_height, report.xbutton.x, - report.xbutton.y)) { - flag=no; - XMapWindow(dsply, menu); - PSInit(viewport->viewWindow, viewport->titleWindow); - if (Gdraws_data(PS) != psError) - PSCreateFile(3,viewport->viewWindow, - viewport->titleWindow,viewport->title); - else printf("PS Gdraws_data failed.\n"); - } - } - else if (report.xbutton.window==menu && !flag) { - XUnmapWindow(dsply, menu); - if (Gdraws_pressed_yes(m_width, m_height, report.xbutton.x, - report.xbutton.y)) - system("print OUTPUT.ps"); - flag = yes; - } - break; - - case KeyPress: - if (report.xkey.window==viewport->viewWindow || - report.xkey.window==viewport->titleWindow) { - XFreeGC(dsply, gc); - XFreeGC(dsply, gc1); - XCloseDisplay(dsply); - PSClose(); - exit(1); - } - else if (report.xkey.window==menu) XUnmapWindow(dsply, menu); - - default: - break; - } - } - return 0; -} -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/Gdraws/menu.c b/src/graph/Gdraws/menu.c new file mode 100644 index 00000000..7380065a --- /dev/null +++ b/src/graph/Gdraws/menu.c @@ -0,0 +1,62 @@ +/* + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* menu of display used for testing out Gdraw functions in this directory */ +#include "Gdraws0.h" +#include "../include/G.h" + +extern GC gc; + +void +Gdraws_draw_menu(Window menu, char *str, int width, int height) +{ + char *str1 = "y e s", *str2 = "n o"; + int x0=0, y0=0; + + XDrawString(dsply, menu, gc, 30, height/4+3, str, strlen(str)); + + XFillArc(dsply, menu, gc, 35, height/3+5, width/2-50, height/3*2-10, + 0*64, 360*64); + + XFillArc(dsply, menu, gc, width/2+5, height/3+5, width/2-50, height/3*2-10, + 0*64, 360*64); + + XSetForeground(dsply, gc, WhitePixel(dsply, scrn)); + XDrawString(dsply, menu, gc, width/4-5, height/3*2+3, str1, strlen(str1)); + XDrawString(dsply, menu, gc, width/4*3-28,height/3*2+3, str2, strlen(str2)); + XSetForeground(dsply, gc, BlackPixel(dsply, scrn)); + + XFlush(dsply); +} diff --git a/src/graph/Gdraws/menu.c.pamphlet b/src/graph/Gdraws/menu.c.pamphlet deleted file mode 100644 index 7219f8d6..00000000 --- a/src/graph/Gdraws/menu.c.pamphlet +++ /dev/null @@ -1,82 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph menu.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= -/* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -@ -<<*>>= -<<license>> - -/* menu of display used for testing out Gdraw functions in this directory */ -#include "Gdraws0.h" -#include "../include/G.h" - -extern GC gc; - -void -Gdraws_draw_menu(Window menu, char *str, int width, int height) -{ - char *str1 = "y e s", *str2 = "n o"; - int x0=0, y0=0; - - XDrawString(dsply, menu, gc, 30, height/4+3, str, strlen(str)); - - XFillArc(dsply, menu, gc, 35, height/3+5, width/2-50, height/3*2-10, - 0*64, 360*64); - - XFillArc(dsply, menu, gc, width/2+5, height/3+5, width/2-50, height/3*2-10, - 0*64, 360*64); - - XSetForeground(dsply, gc, WhitePixel(dsply, scrn)); - XDrawString(dsply, menu, gc, width/4-5, height/3*2+3, str1, strlen(str1)); - XDrawString(dsply, menu, gc, width/4*3-28,height/3*2+3, str2, strlen(str2)); - XSetForeground(dsply, gc, BlackPixel(dsply, scrn)); - - XFlush(dsply); -} -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/graph/Gdraws/yesORno.c b/src/graph/Gdraws/yesORno.c new file mode 100644 index 00000000..f1ef7acc --- /dev/null +++ b/src/graph/Gdraws/yesORno.c @@ -0,0 +1,46 @@ +/* + Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd. + All rights reserved. + Copyright (C) 2007-2008, Gabriel Dos Reis. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Decides if mouse click was in yes or no region; used by program to test + * out Gdraw functions in this directory. + */ + +#include "Gdraws0.h" + +int +Gdraws_pressed_yes(int win_width, int win_height, int x, int y) +{ + return (x < win_width / 2) ? yes : no; +} diff --git a/src/graph/Gdraws/yesORno.c.pamphlet b/src/graph/Gdraws/yesORno.c.pamphlet deleted file mode 100644 index daed4bca..00000000 --- a/src/graph/Gdraws/yesORno.c.pamphlet +++ /dev/null @@ -1,67 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/graph yesORno.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{License} -<<license>>= -/* -Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - - Neither the name of The Numerical ALgorithms Group Ltd. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -@ -<<*>>= -<<license>> - -/* - * Decides if mouse click was in yes or no region; used by program to test - * out Gdraw functions in this directory. - */ - -#include "Gdraws0.h" - -int -Gdraws_pressed_yes(int win_width, int win_height, int x, int y) -{ - return (x < win_width / 2) ? yes : no; -} -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} |