%% Oh Emacs, this is a -*- Makefile -*-, so give me tabs.
\documentclass{article}
\usepackage{axiom}

\title{\$SPAD/src/graph/Gdraws Makefile}
\author{Timothy Daly \and Gabriel Dos~Reis}

\begin{document}
\maketitle

\begin{abstract}
\end{abstract}
\eject

\tableofcontents
\eject

\section{Gdraws}

This directory consists of all the Gdraw functions along with a local
testing protocol to test out these functions.
The subdirectory PS contains all the ps drawing functions in support of
the Gdraw functions.

\subsection{GDRAW}

A Gdraw function, using a draw option dFlsg as input, provides drawings
capability on different output devices.  Currently, Gdraw supports routines
both in Xwindows functions, and in postscript functions on
a postscript printer/interpreter.

The general drawing functions are (see file for description of functionality)
\begin{verbatim}
 1.  Gdrawarc.c
 2.  Gdrawstring.c
 3.  Gdraw.c
 4.  Gdrawline.c
 5.  Gdrfilled.c
 6.  GdrawFrame.c
 7.  Gdrawlines.c
 8.  Gfillarc.c
 9.  GdrawIstr.c
 10. Gdrawrect.c
 11. Gmisc.c
 12. GinitPS.c
 13. GCreatePS.c
 14. PSFill.c
 15. ../include/G.h
    header information needed by all the Gdraw routines and
    view3D/view2D as well.
 16. ps.h
    header information needed by only the Gdraw routines.

\subsection{POSTSCRIPT}

A PostScript file can be generated by using a button on the control
panel of a viewAlone picture, or in Axiom, with the command write,
option Postscript.  This file can be submitted to the postsctipt
printer to be printed, or viewed using the postscript interpreter.
It will draw a window, title, and picture clipped to fit inside of the
window.

In order to generate a postscript output, we first initializ file names and
paths to be used by our program by using
\begin{verbatim}
	InitPs(viewWindow, titleWindow)    [in GinitPS.c]
\end{verbatim}
then call the G draw routines with option "PS", which would generate postscript
drawing commands.  Then create the output file (OUTPUT.ps by default) by using
\begin{verbatim}
	makePSfile(viewWindow, titleWindow, title)   [in GcreatePS.c]
\end{verbatim}

The output file would be in local directory, i.e., the directory where Axiom
or viewAlone, etc., was started up.

The following routines are used to test out the Gdraw functions:
\begin{verbatim}
1.  main.c      creates windows, and titles and processes Xwindow events.
2.  data.c      creates data for drawing and call Gdraw routines.
3.  menu.c      draws menu when mouse clicks in viewWindow
4.  yesORno.c   determines if mouse click in menu means "yes" or "no".
5.  loadFont.c 	loads font for display
\end{verbatim}

The Gdraw routines have been written in such a way that they are usable by
both view3D and view2D.

\subsection{TO USE G FUNCTIONS}

In order to draw in postscript, use GSetForeground to set the foreground
colors for the drawing (and fill) functions.  Use GSetLineAttributes
to set line attributes.  And finally, replace the XDraw commands with the
corresponding GDraw commands with the appropriate parameters.  In addition,
we need to: draw frame, set GC variable names, create GCs, initialize
postscript data structures, cat all the procedures used together.

{\bf IMPORTANT}:\\
In order to create postscript command file, we need environment
variable DEVE (i.e., setenv DEVE /u/jimwen/3D/version28) or AXIOM (e.g., setenv
AXIOM /spad/mnt/rt in case Gdraws directory has been installed on the server).
Without this path, the program would not know where the postscript files (in
Gdraws/PS) are.

{\bf LIMITATIONS} of current implementation:\\
A picture is printed with 1 inch x direction, and 1 inch y direction
offset, and the largest complete picutre is the size of the page
with the offest.

{\bf BUGS}:\\
The region box is not drawn correctly when perspective is altered.


{\bf FUTURE DIRECTIONS}:
\begin{itemize}
\item for view3D color rendering, may want to convert LINE drawing color
to the appropriate grayscale.  Right now, they're all drawn in black.
\item for view3D's routines for color rendering, may want to implement
color drawing for postscript functions just in case someone does
have access to a color postscript printer.
\item implement more functionality for attributes used in GC, i.e., dashed
line, dotted line etc.
\item implement a display postscript menu to set things like picture size,
landscape/portrait orientation, picture centered, left, right, up,
down, etc., reversed video.
\item make font an attribute in postscripts's graphics context so the
font can be set in user program.  Right now, it uses only 1 font.
\item for view2D's stuff, implement a smaller font for the drawing the
units on the axes.
\end{itemize}

\section{environment variables}
<<environment>>=
IN=	$(axiom_src_srcdir)/graph/Gdraws
OUT=	$(axiom_target_libdir)
PS=	$(axiom_target_libdir)/graph
DOC=    $(axiom_target_docdir)/src/graph

# local include files shared by graphics
LINC=	$(axiom_src_srcdir)/graph/include

# global include files shared by everyone
GINC=	$(axiom_src_srcdir)/include

# include files in Hyperdoc
HINC=	$(axiom_src_srcdir)/hyper

# bitmaps for cursors
BIT=	$(axiom_src_srcdir)/graph/include/bitmaps

# a .h file stuck in a really wierd place
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}

@
\section{Gdraw code}
\subsection{Gfun}
<<Gfun.c>>=
Gfun.c: $(srcdir)/Gfun.c.pamphlet
	$(axiom_build_document) --tangle --output=$@ $<

@

<<Gfun.o>>=
Gfun.$(OBJEXT): ${HEADERS}

Gfun.$(OBJEXT): $(builddir)/Gfun.c
	${CC} -c  $(CFLAGS) $(AXIOM_CFLAGS) -o $@ $<

@

<<*>>=
<<environment>>

subdir = src/graph/Gdraws/

pamphlets = Makefile.pamphlet Gfun.c.pamphlet psFiles.pamphlet

HEADERS = ${IN}/Gdraws0.h ${LINC}/G.h     ${LINC}/Gfun.H1    \
          ${GINC}/hash.h  ${GINC}/hash.H1 ${GINC}/useproto.h \
		$(axiom_c_macros_h)

PSFiles= ${PS}/colorpoly.ps ${PS}/colorwol.ps  ${PS}/draw.ps      \
         ${PS}/drawIstr.ps  ${PS}/drawarc.ps   ${PS}/drawcolor.ps \
         ${PS}/drawline.ps  ${PS}/drawlines.ps ${PS}/drawpoint.ps \
         ${PS}/drawrect.ps  ${PS}/drawstr.ps   ${PS}/drwfilled.ps \
         ${PS}/end.ps       ${PS}/fillarc.ps   ${PS}/fillpoly.ps  \
         ${PS}/fillwol.ps   ${PS}/header.ps    ${PS}/setup.ps

.SUFFIXES:
.SUFFIXES: .c .o .h .ps

.PHONY: all all-ax all-Gdraws
all: all-ax
all-ax all-Gdraws: stamp
	@ echo finished making $(axiom_src_srcdir)/Gdraws

.PHONY: PSfiles.post
stamp:  Gfun.$(OBJEXT) $(PSFiles)
	@-rm -f stamp
	$(STAMP) stamp

$(PS)/%.ps: $(srcdir)/psFiles.pamphlet
	$(axiom_build_document) --tangle=$* --output=$@ $<

<<Gfun.c>>
<<Gfun.o>>

mostlyclean-local:
	-rm -f Gfun.$(OBJEXT)

clean-local: mostlyclean-local
	-rm -f $(PSFiles)

distclean-local: clean-local

@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}
