diff options
author | dos-reis <gdr@axiomatics.org> | 2007-09-02 21:56:58 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2007-09-02 21:56:58 +0000 |
commit | 7eb38fea596969878a33f30e36fe33b125f9c4bd (patch) | |
tree | 2e4222a4406fb5ed3d69b781f528b9ac08bb9fbc /src/lib | |
parent | 869512ac1dd0bc9c80182cbef6e01b39540fef7f (diff) | |
download | open-axiom-7eb38fea596969878a33f30e36fe33b125f9c4bd.tar.gz |
* XSpadFill.c: New. Replace corresponding pamphlet.
* XSpadFill.c.pamphlet: Remove.
* XShade.c: New. Replace corresponding pamphlet.
* XShade.c.pamphlet: Remove.
* XDither.c: New. Replace corresponding pamphlet.
* XDither.c.pamphlet: Remove.
* wct.c: New. Replace corresponding pamphlet.
* wct.c.pamphlet: Remove.
* util.c: New. Replace corresponding pamphlet.
* util.c.pamphlet: Remove.
* spadcolors.c: New. Replace corresponding pamphlet.
* spadcolors.c.pamphlet: Remove.
* sockio-c.c: New. Replace corresponding pamphlet.
* sockio-c.c.pamphlet: Remove.
* prt.c: New. Replace corresponding pamphlet.
* prt.c.pamphlet: Remove.
* pixmap.c: New. Replace corresponding pamphlet.
* pixmap.c.pamphlet: Remove.
* openpty.c: New. Replace corresponding pamphlet.
* openpty.c.pamphlet: Remove.
* hash.c: New. Replace corresponding pamphlet.
* hash.c.pamphlet: Remove.
* halloc.c: New. Replace corresponding pamphlet.
* halloc.c.pamphlet: Remove.
* fnct_key.c: New. Replace corresponding pamphlet.
* fnct_key.c.pamphlet: Remove.
* edin.c: New. Replace corresponding pamphlet.
* edin.c.pamphlet: Remove.
* bsdsignal.c: New. Replace correponding pamphlet.
* bsdsignal.c.pamphlet: Remove.
* cursor.c: New. Replace corresponding pamphlet.
* cursor.c.pamphlet: Remove.
* cfuns-c.c: New. Replace corresponding pamphlet.
* cfuns-c.c.pamphlet: Remove.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ChangeLog | 37 | ||||
-rw-r--r-- | src/lib/Makefile.in | 31 | ||||
-rw-r--r-- | src/lib/Makefile.pamphlet | 55 | ||||
-rw-r--r-- | src/lib/XDither.c (renamed from src/lib/XDither.c.pamphlet) | 82 | ||||
-rw-r--r-- | src/lib/XShade.c (renamed from src/lib/XShade.c.pamphlet) | 82 | ||||
-rw-r--r-- | src/lib/XSpadFill.c (renamed from src/lib/XSpadFill.c.pamphlet) | 113 | ||||
-rw-r--r-- | src/lib/bsdsignal.c | 71 | ||||
-rw-r--r-- | src/lib/bsdsignal.c.pamphlet | 320 | ||||
-rw-r--r-- | src/lib/cfuns-c.c (renamed from src/lib/cfuns-c.c.pamphlet) | 84 | ||||
-rw-r--r-- | src/lib/cursor.c (renamed from src/lib/cursor.c.pamphlet) | 82 | ||||
-rw-r--r-- | src/lib/edin.c | 941 | ||||
-rw-r--r-- | src/lib/edin.c.pamphlet | 971 | ||||
-rw-r--r-- | src/lib/fnct_key.c (renamed from src/lib/fnct_key.c.pamphlet) | 108 | ||||
-rw-r--r-- | src/lib/halloc.c | 57 | ||||
-rw-r--r-- | src/lib/halloc.c.pamphlet | 79 | ||||
-rw-r--r-- | src/lib/hash.c (renamed from src/lib/hash.c.pamphlet) | 83 | ||||
-rw-r--r-- | src/lib/openpty.c (renamed from src/lib/openpty.c.pamphlet) | 134 | ||||
-rw-r--r-- | src/lib/pixmap.c (renamed from src/lib/pixmap.c.pamphlet) | 97 | ||||
-rw-r--r-- | src/lib/prt.c (renamed from src/lib/prt.c.pamphlet) | 82 | ||||
-rw-r--r-- | src/lib/sockio-c.c (renamed from src/lib/sockio-c.c.pamphlet) | 95 | ||||
-rw-r--r-- | src/lib/spadcolors.c (renamed from src/lib/spadcolors.c.pamphlet) | 205 | ||||
-rw-r--r-- | src/lib/util.c (renamed from src/lib/util.c.pamphlet) | 94 | ||||
-rw-r--r-- | src/lib/wct.c (renamed from src/lib/wct.c.pamphlet) | 98 |
23 files changed, 1635 insertions, 2366 deletions
diff --git a/src/lib/ChangeLog b/src/lib/ChangeLog index 8bcace53..3104d00b 100644 --- a/src/lib/ChangeLog +++ b/src/lib/ChangeLog @@ -1,3 +1,40 @@ +2007-09-02 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * XSpadFill.c: New. Replace corresponding pamphlet. + * XSpadFill.c.pamphlet: Remove. + * XShade.c: New. Replace corresponding pamphlet. + * XShade.c.pamphlet: Remove. + * XDither.c: New. Replace corresponding pamphlet. + * XDither.c.pamphlet: Remove. + * wct.c: New. Replace corresponding pamphlet. + * wct.c.pamphlet: Remove. + * util.c: New. Replace corresponding pamphlet. + * util.c.pamphlet: Remove. + * spadcolors.c: New. Replace corresponding pamphlet. + * spadcolors.c.pamphlet: Remove. + * sockio-c.c: New. Replace corresponding pamphlet. + * sockio-c.c.pamphlet: Remove. + * prt.c: New. Replace corresponding pamphlet. + * prt.c.pamphlet: Remove. + * pixmap.c: New. Replace corresponding pamphlet. + * pixmap.c.pamphlet: Remove. + * openpty.c: New. Replace corresponding pamphlet. + * openpty.c.pamphlet: Remove. + * hash.c: New. Replace corresponding pamphlet. + * hash.c.pamphlet: Remove. + * halloc.c: New. Replace corresponding pamphlet. + * halloc.c.pamphlet: Remove. + * fnct_key.c: New. Replace corresponding pamphlet. + * fnct_key.c.pamphlet: Remove. + * edin.c: New. Replace corresponding pamphlet. + * edin.c.pamphlet: Remove. + * bsdsignal.c: New. Replace correponding pamphlet. + * bsdsignal.c.pamphlet: Remove. + * cursor.c: New. Replace corresponding pamphlet. + * cursor.c.pamphlet: Remove. + * cfuns-c.c: New. Replace corresponding pamphlet. + * cfuns-c.c.pamphlet: Remove. + 2007-08-17 Gabriel Dos Reis <gdr@cs.tamu.edu> * Makefile.pamphlet ($(axiom_target_libdir)/libspad.la): Remove diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 09d7ea2b..05045445 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -1,6 +1,6 @@ -core_sources = bsdsignal.c cfuns-c.c sockio-c.c -terminal_io_sources = cursor.c edin.c fnct_key.c openpty.c prt.c wct.c -graphics_sources = \ +core_SOURCES = bsdsignal.c cfuns-c.c sockio-c.c +terminal_io_SOURCES = cursor.c edin.c fnct_key.c openpty.c prt.c wct.c +graphics_SOURCES = \ halloc.c \ hash.c \ pixmap.c \ @@ -10,23 +10,19 @@ graphics_sources = \ XShade.c \ XSpadFill.c -libspad_la_sources = $(foreach comp, \ - $(addsuffix _sources, @axiom_c_runtime@), \ +libspad_la_SOURCES = $(foreach comp, \ + $(addsuffix _SOURCES, @axiom_c_runtime@), \ $($(comp))) -libspad_la_SOURCES = $(addsuffix .pamphlet,$(libspad_la_sources)) +other_SOURCES = cfuns-c.c -other_sources = cfuns-c.c +unused_SOURCES = emupty.c -other_SOURCES = $(addsuffix .pamphlet,$(other_sources)) +libspad_la_objects = $(libspad_la_SOURCES:.c=.lo) -unused_sources = emupty.c +other_objects = $(other_SOURCES:.c=.$(OBJEXT)) -libspad_la_objects = $(libspad_la_sources:.c=.lo) - -other_objects = $(other_sources:.c=.$(OBJEXT)) - -pamphlets = Makefile.pamphlet $(libspad_la_SOURCES) $(other_SOURCES) +pamphlets = Makefile.pamphlet subdir = src/lib/ @@ -46,11 +42,6 @@ $(axiom_target_libdir)/libspad.la: $(libspad_la_objects) $(LIBTOOL) --mode=link $(CC) -o $@ $(libspad_la_objects) \ -rpath $(libdir)/axiom/target/$(target)/lib -.PRECIOUS: %.c - -%.c: $(srcdir)/%.c.pamphlet - $(axiom_build_document) --tangle --output=$@ $< - .PRECIOUS: %.$(OBJEXT) %.lo %.lo: %.c $(axiom_c_macros_h) @@ -65,7 +56,7 @@ mostlyclean-local: clean-local: mostlyclean-local @$(LIBTOOL) --mode=clean $(axiom_target_libdir)/libspad.la @rm -f $(other_objects) - @rm -f $(libspad_la_sources) $(other_sources) + @rm -f $(libspad_la_SOURCES) $(other_SOURCES) @rm -fr .libs _libs @rm -f stamp diff --git a/src/lib/Makefile.pamphlet b/src/lib/Makefile.pamphlet index 6b0b0433..3dc252e9 100644 --- a/src/lib/Makefile.pamphlet +++ b/src/lib/Makefile.pamphlet @@ -40,7 +40,7 @@ they depend on [[<unistd.h>]], [[<sys/stat.h>]], and [[<sys/socket.h>]] <<environment>>= -core_sources = bsdsignal.c cfuns-c.c sockio-c.c +core_SOURCES = bsdsignal.c cfuns-c.c sockio-c.c @ @@ -50,7 +50,7 @@ This component provides all the routines necessary to build the \Tool{Superman} component. <<environment>>= -terminal_io_sources = cursor.c edin.c fnct_key.c openpty.c prt.c wct.c +terminal_io_SOURCES = cursor.c edin.c fnct_key.c openpty.c prt.c wct.c @ @@ -59,7 +59,7 @@ terminal_io_sources = cursor.c edin.c fnct_key.c openpty.c prt.c wct.c HyperDoc and any other graphics capability. <<environment>>= -graphics_sources = \ +graphics_SOURCES = \ halloc.c \ hash.c \ pixmap.c \ @@ -81,35 +81,23 @@ It is a list of the main components. It also contain [[core]] <<environment>>= -libspad_la_sources = $(foreach comp, \ - $(addsuffix _sources, @axiom_c_runtime@), \ +libspad_la_SOURCES = $(foreach comp, \ + $(addsuffix _SOURCES, @axiom_c_runtime@), \ $($(comp))) -libspad_la_SOURCES = $(addsuffix .pamphlet,$(libspad_la_sources)) +other_SOURCES = cfuns-c.c -other_sources = cfuns-c.c +unused_SOURCES = emupty.c -other_SOURCES = $(addsuffix .pamphlet,$(other_sources)) +libspad_la_objects = $(libspad_la_SOURCES:.c=.lo) -unused_sources = emupty.c +other_objects = $(other_SOURCES:.c=.$(OBJEXT)) -libspad_la_objects = $(libspad_la_sources:.c=.lo) - -other_objects = $(other_sources:.c=.$(OBJEXT)) - -pamphlets = Makefile.pamphlet $(libspad_la_SOURCES) $(other_SOURCES) +pamphlets = Makefile.pamphlet @ \section{Files} -\subsection{C from pamphlet} -<<C from pamphlet>>= -.PRECIOUS: %.c - -%.c: $(srcdir)/%.c.pamphlet - $(axiom_build_document) --tangle --output=$@ $< -@ - \subsection{object from C} <<object from C>>= .PRECIOUS: %.$(OBJEXT) %.lo @@ -150,7 +138,7 @@ mostlyclean-local: clean-local: mostlyclean-local @$(LIBTOOL) --mode=clean $(axiom_target_libdir)/libspad.la @rm -f $(other_objects) - @rm -f $(libspad_la_sources) $(other_sources) + @rm -f $(libspad_la_SOURCES) $(other_SOURCES) @rm -fr .libs _libs @rm -f stamp @@ -178,30 +166,9 @@ $(axiom_target_libdir)/libspad.la: $(libspad_la_objects) $(LIBTOOL) --mode=link $(CC) -o $@ $(libspad_la_objects) \ -rpath $(libdir)/axiom/target/$(target)/lib -<<C from pamphlet>> - <<object from C>> <<cleanup>> @ -\eject -\begin{thebibliography}{99} -\bibitem{1} {\$SPAD/src/lib/bsdssignal.c.pamphlet} -\bibitem{2} {\$SPAD/src/lib/cfuns-c.c.pamphlet} -\bibitem{3} {\$SPAD/src/lib/cursor.c.pamphlet} -\bibitem{4} {\$SPAD/src/lib/edin.c.pamphlet} -\bibitem{5} {\$SPAD/src/lib/fnct\_key.c.pamphlet} -\bibitem{6} {\$SPAD/src/lib/halloc.c.pamphlet} -\bibitem{7} {\$SPAD/src/lib/openpty.c.pamphlet} -\bibitem{8} {\$SPAD/src/lib/pixmap.c.pamphlet} -\bibitem{9} {\$SPAD/src/lib/prt.c.pamphlet} -\bibitem{10} {\$SPAD/src/lib/sockio-c.c.pamphlet} -\bibitem{11} {\$SPAD/src/lib/spadcolors.c.pamphlet} -\bibitem{12} {\$SPAD/src/lib/util.c.pamphlet} -\bibitem{13} {\$SPAD/src/lib/wct.c.pamphlet} -\bibitem{14} {\$SPAD/src/lib/XDither.c.pamphlet} -\bibitem{15} {\$SPAD/src/lib/XShade.c.pamphlet} -\bibitem{16} {\$SPAD/src/lib/XSpadFill.c.pamphlet} -\end{thebibliography} \end{document} diff --git a/src/lib/XDither.c.pamphlet b/src/lib/XDither.c index 8344a584..ab2a84b6 100644 --- a/src/lib/XDither.c.pamphlet +++ b/src/lib/XDither.c @@ -1,51 +1,35 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib XDither.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. + + 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>> #include "axiom-c-macros.h" #ifndef MSYSplatform @@ -246,9 +230,3 @@ XDitherArcs(Display *display,Drawable drawable, GC gc, XArc *arcs,int narcs) XFillArcs(display, drawable, gc, arcs, narcs); } #endif /* MSYSplatform */ -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/XShade.c.pamphlet b/src/lib/XShade.c index 8435b2dd..2a89a493 100644 --- a/src/lib/XShade.c.pamphlet +++ b/src/lib/XShade.c @@ -1,51 +1,35 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib XShade.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. + + 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>> #include "axiom-c-macros.h" #ifndef MSYSplatform @@ -228,9 +212,3 @@ XShadeArcs(Display *display, Drawable drawable, XArc *arcs, int narcs) #endif /* MSYSplatform */ -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/XSpadFill.c.pamphlet b/src/lib/XSpadFill.c index 0172ea32..71e6f16b 100644 --- a/src/lib/XSpadFill.c.pamphlet +++ b/src/lib/XSpadFill.c @@ -1,66 +1,51 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib XSpadFill.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\begin{verbatim} - -This file contains the routines needed in order to dither using the -spadcolors. The routines will have names such as XSpadFill, ... The user -simply gives the normal arguments as with the corresponding XFill routine, -with two additional arguments which choose the shade and the hue. - -The file will maintain twoGC's: stippleGC - will be used when stippling the -backgrounds. solidGC - will be used when the background should be solid - -The user should call XSpadInit to get everthing going. This routine has the -job of Initializing the dithering routines, and getting the colors all -into place. - -\end{verbatim} -\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. + + 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>> + +/* + This file contains the routines needed in order to dither using the + spadcolors. The routines will have names such as XSpadFill, ... The user + simply gives the normal arguments as with the corresponding XFill routine, + with two additional arguments which choose the shade and the hue. + + The file will maintain twoGC's: stippleGC - will be used when stippling the + backgrounds. solidGC - will be used when the background should be solid + + The user should call XSpadInit to get everthing going. This routine has the + job of Initializing the dithering routines, and getting the colors all + into place. + + */ + #include "axiom-c-macros.h" #ifndef MSYSplatform @@ -313,9 +298,3 @@ XSpadFillArcs(Display *dsply, Drawable drawable,XArc *arcs, int narcs, #endif /* MSYSplatform */ -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/bsdsignal.c b/src/lib/bsdsignal.c new file mode 100644 index 00000000..3454507f --- /dev/null +++ b/src/lib/bsdsignal.c @@ -0,0 +1,71 @@ +/* + 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. +*/ + +#include "axiom-c-macros.h" +#include "bsdsignal.h" + +#if defined(MACOSXplatform) +#include "/usr/include/signal.h" +#else +#include <signal.h> +#endif + +#include "bsdsignal.H1" + + +SignalHandlerFunc +bsdSignal(int sig, SignalHandlerFunc action, int restartSystemCall) +{ +#if HAVE_DECL_SIGACTION + + struct sigaction in,out; + in.sa_handler = action; + /* handler is reinstalled - calls are restarted if restartSystemCall */ +#ifdef SA_RESTART + if(restartSystemCall) in.sa_flags = SA_RESTART; + else in.sa_flags = 0; +#elif defined(SA_INTERRUPT) + if (restartSystemCall) in.sa_flags = 0; + else in.sa_flags = SA_INTERRUPT; +#else + in.sa_flags = 0; +#endif + + return (sigaction(sig, &in, &out) ? (SignalHandlerFunc) -1 : + (SignalHandlerFunc) out.sa_handler); +#else /* !HAVE_DECL_SIGACTION */ + return (SignalHandlerFunc) -1; +#endif /* HAVE_DECL_SIGACTION */ +} + + diff --git a/src/lib/bsdsignal.c.pamphlet b/src/lib/bsdsignal.c.pamphlet deleted file mode 100644 index 5807659b..00000000 --- a/src/lib/bsdsignal.c.pamphlet +++ /dev/null @@ -1,320 +0,0 @@ -\documentclass{article} -\usepackage{axiom} - -\newcommand{\var}[1]{\textsl{#1}} - -\title{\File{src/lib/bsdsignal.c} Pamphlet} -\author{The Axiom Team} - -\begin{document} -\maketitle - -\begin{abstract} -\end{abstract} -\eject - -\tableofcontents -\newpage - -\section{Executive Overview} - -\section{Signals} - -The system defines a set of signals that may be delivered to a process. -Signal -delivery resembles the occurrence of a hardware interrupt: the signal is -normally blocked from further occurrence, the current process context is -saved, -and a new one is built. A process may specify a \emph{handler} to -which a signal -is delivered, or specify that a signal is to be \emph{ignored}. A process may -also specify that a default action is to be taken by the system when a signal -occurs. A signal may also be \emph{blocked}, in which case its delivery is -postponed until it is \emph{unblocked}. The action to be taken on delivery is -determined at the time of delivery. Normally, signal handlers execute on the -current stack of the process. This may be changed, on a per-handler basis, so -that signals are taken on a special \emph{signal stack}. - -Signal routines normally execute with the signal that caused their invocation -\emph{blocked}, but other signals may yet occur. A global \emph{signal mask} -defines the set of signals currently blocked from delivery to a process. -The signal mask for a process is initialized from that of its parent -(normally empty). It may be changed with a \emph{[[sigprocmask]](2)} call, or -when a signal is delivered to the process. - -When a signal condition arises for a process, the signal is added to a set of -signals pending for the process. If the signal is not currently \emph{blocked} -by the process then it is delivered to the process. Signals may be delivered -any time a process enters the operating system (e.g., during a system call, -page fault or trap, or clock interrupt). If muliple signals are ready to be -delivered at the same time, any signals that could be caused by traps are -delivered first. Additional signals may be processed at the same time, with -each appearing to interrupt the handlers for the previous signals before -their first instructions. The set of pending signals is retuned by the -\emph{[[sigpending]](2)} system call. When a caught signal is delivered, -the current -state of the process is saved, a new signal mask is calculated (as described -below), and the signal handler is invoked. The call to the handler is arranged -so that if the signal handling routine returns normally the process will resume -execution in the context from before the signal's delivery. If the process -wishes to resume in a different context, then it must arrange to restore -the previous context itself. - -When a signal is delivered to a proces a new signal mask is installed for the -duration of the process's signal handler (or until a \emph{[[sigprocmask]](2)} -system call is made). This mask is formed by taking the union of the current -signal mask set, the signal to be delivered, and the signal mask associated -with the handler to be invoked. - -The \emph{[[sigaction]]()} system call assigns an action for a signal -specified by \var{sig}. If \var{act} is non-zero, it specifies an action -([[SIG_DFL]], [[SIG_IGN]], or a handler routine) and mask to be used when -delivering the specified signal. -If \var{oact} is non-zero, the previous handling information for the signal is -returned to the user. - -Once a signal handler is installed, it normally remains installed until -another -[[sigaction()]] system call is made, or an \emph{[[execve]](2)} is performed. -A -signal-specific default action may be reset by setting [[sa_handler]] to -[[SIG_DFL]]. The defaults are process termination, possibly with core dump; -no action; stopping the process; or continuing the process. See the signal -list below for each signal's default action. If [[sa_handler]] is [[SIG_DFL]], -the default action for the signal is to discard the signal, and if a signal -is pending, the pending signal is discarded even if the signal is masked. If -[[sa_handler]] is set to [[SIG_IGN]] current and pending instances of the -signal -are ignored and discarded. - -Options may be specified by setting [[sa_flags]]. The meaning of the various -bits is as follows: -\begin{tabular}{ll} -SA\_NOCLDSTOP & If this bit is set when installing a catching function for\\ - & the SIGCHLD signal, the SIGCHLD signal will be generated only\\ - & when a child process exits, not when a child process stops.\\ -SA\_NOCLDWAIT & If this bit is set when calling {\sl sigaction()} for the\\ - & SIGCHLD signal, the system will not create zombie processes\\ - & when children of the calling process exit. If the calling\\ - & process subsequently issues a {\sf wait()} (or equivalent),\\ - & it blocks until all of the calling process's child processes\\ - & terminate, and then returns a value of -1 with errno set to\\ - & ECHILD.\\ -SA\_ONSTACK & If this bit is set, the system will deliver the signal to\\ - & the process on a {\sl signal stack}, specified with\\ - & {\bf sigaltstack(2)}.\\ -SA\_NODEFER & If this bit is set, further occurrences of the delivered\\ - & signal are not masked during the execution of the handler.\\ -SA\_RESETHAND & If this bit is set, the handler is reset back to SIG\_DFL\\ - & at the moment the signal is delivered.\\ -SA\_RESTART & See the paragraph below\\ -SA\_SIGINFO & If this bit is set, the handler function is assumed to be\\ - & pointed to by the sa\_sigaction member of struct sigaction\\ - & and should match the prototype shown above or as below in\\ - & EXAMPLES. This bit should not be set when assigning SIG\_DFL\\ - & or SIG\_IGN -\end{tabular} - -If a signal is caught during the system calls listed below, the call may be -forced to terminate with the error [[EINTR]], the call may return with a data -transfer shorter than requested, or the call may be restarted. Restart of -pending calls is requested by setting the SA\_RESTART bit in {\sl sa\_flags}. -The affected system calls include {\bf open(2)}, {\bf read(2)}, {\bf write(2)}, -{\bf sendto(2)}, {\bf recvfrom(2)}, {\bf sendmsg(2)} and {\bf recvmsg(2)} -on a communications channel or a slow device (such as a terminal, but not a -regular file) and during a {\bf wait(2)} or {\bf ioctl(2)}. However, calls -that have already committed are not restarted, but instead return a partial -success (for example, a short read count). - -After a {\bf fork(2)} or {\bf vfork(2)} all signals, the signal mask, the -signal stack, and the restart/interrupt flags are inherited by the child. - -The {\bf execve(2)} system call reinstates the default action for all signals -which were caught and resets all signals to be caught on the user stack. -Ignored signals remain ignored; the signal mask remains the same; signals -that restart pending system calls continue to do so. - -The following is a list of all signals with names as in the include file -{\sl <signal.h>}: - -\begin{tabular}{lll} -{\bf NAME} & {\bf Default Action} & Description\\ -SIGHUP & terminate process & terminal line hangup\\ -SIGINT & terminate process & interrupt program\\ -SIGQUIT & create core image & quit program\\ -SIGILL & create core image & illegal instruction\\ -SIGTRAP & create core image & trace trap\\ -SIGABRT & create core image & {\bf abort(3)} call (formerly SIGIOT)\\ -SIGEMT & create core image & emulate instruction executed\\ -SIGFPE & create core image & floating-point exception\\ -SIGKILL & terminate process & kill program\\ -SIGBUS & create core image & bus error\\ -SIGSEGV & create core image & segmentation violation\\ -SIGSYS & create core image & non-existent system call invoked\\ -SIGPIPE & terminate process & write on a pipe with no reader\\ -SIGALRM & terminate process & real-time timer expired\\ -SIGTERM & terminate process & software termination signal\\ -SIGURG & discard signal & urgent condition present on socket\\ -SIGSTOP & stop process & stop (cannot be caught or ignored)\\ -SIGSTP & stop process & stop signal generated from keyboard\\ -SIGCONT & discard signal & continue after stop\\ -SIGCHLD & discard signal & child status has changed\\ -SIGTTIN & stop process & background read attempted from \\ - & & control terminal\\ -SIGTTOU & stop process & background write attempted from\\ - & & control terminal\\ -SIGIO & discard signal & I/O is possible on a descriptor {\bf fcntl(2)}\\ -SIGXCPU & terminate process & cpu time limit exceeded {\bf setrlimit(2)}\\ -SIGXFSZ & terminate process & file size limit exceeded {\bf setrlimit(2)}\\ -SIGVTALRM & terminate process & virtual time alarm {\bf setitimer(2)}\\ -SIGPROF & terminate process & profiling timer alarm {\bf setitimer(2)}\\ -SIGWINCH & discard signal & Window size change\\ -SIGINFO & discard signal & status request from keyboard\\ -SIGUSR1 & terminate process & User defined signal 1\\ -SIGUSR2 & terminate process & User defined signal 2 -\end{tabular} - -The {\sl sigaction()} function returns the value 0 if successful; otherwise -the value -1 is returned and the global variable {\sl errno} is set to indicate -the error. - -Signal handlers should have either the ANSI C prototype: -\begin{verbatim} - void handler(int); -\end{verbatim} -or the POSIX SA\_SIGINFO prototype: -\begin{verbatim} - void handler(int, siginfo\_t *info, ucontext\_t *uap); -\end{verbatim} - -The handler function should match the SA\_SIGINFO prototype if the SA\_SIGINFO -bit is set in flags. It then should be pointed to by the sa\_sigaction member -of struct sigaction. Note that you should not assign SIG\_DFL or SIG\_IGN this way. - -If the SA\_SIGINFO flag is not set, the handler function should match either -the ANSI C or traditional BSD prototype and be pointed to by the sa\_handler -member of struct sigaction. In practice, FreeBSD always sends the three -arguments of the latter and since the ANSI C prototype is a subset, both -will work. The sa\_handler member declaration in FreeBSD include files is -that of ANSI C (as required by POSIX), so a function pointer of a BSD-style -function needs to be casted to compile without warning. The traditional BSD -style is not portable and since its capabilities are a full subset of a -SA\_SIGNFO handler its use is deprecated. - -The {\sl sig} argument is the signal number, one of the SIG\ldots values from -{\sl <signal.h>}. - -The {\sl code} argument of the BSD-style handler and the si\_code member of the -info argument to a SA\_SIGINFO handler contain a numeric code explaining the -cause of the signal, usually on of the SI\_\ldots values from {\sl <sys/signal.h>} -or codes specific to a signal, i.e. one of the FPE\_\ldots values for SIGFPE. - -The {\sl uap} argument to a POSIX SA\_SIGINFO handler points to an instance of -ucontext\_t. - -The {\bf sigaction()} system call will fail and no new signal handler will be -installed if one of the following occurs: -\begin{tabular}{ll} -EFAULT & Either {\sl act} or {\sl oact} points to memory that is not a\\ - & valid part of the process address space\\ -EINVAL & The {\sl sig} argument is not a valid signal number\\ -EINVAL & An attempt is made to ignore or supply a handler for SIGKILL\\ - & or SIGSTOP -\end{tabular} -\section{MAC OSX and BSD platform change} -<<*>>= -<<license>> - -#include "axiom-c-macros.h" -#include "bsdsignal.h" - -@ -The MACOSX platform is broken because no matter what you do it seems to -include files from [[/usr/include/sys]] ahead of [[/usr/include]]. On linux -systems these files include themselves which causes an infinite regression -of includes that fails. GCC gracefully steps over that problem but the -build fails anyway. On MACOSX the [[/usr/include/sys]] versions -of files are badly broken with respect to the [[/usr/include]] versions. -<<*>>= -#if defined(MACOSXplatform) -#include "/usr/include/signal.h" -#else -#include <signal.h> -#endif - -#include "bsdsignal.H1" - - -SignalHandlerFunc -bsdSignal(int sig, SignalHandlerFunc action, int restartSystemCall) -{ -#if HAVE_DECL_SIGACTION - - struct sigaction in,out; - in.sa_handler = action; - /* handler is reinstalled - calls are restarted if restartSystemCall */ -@ - -We needed to change [[SIGCLD]] to [[SIGCHLD]] for the [[MAC OSX]] platform -and we need to create a new platform variable. This change is made to -propogate that platform variable. -<<*>>= -#ifdef SA_RESTART - if(restartSystemCall) in.sa_flags = SA_RESTART; - else in.sa_flags = 0; -#elif defined(SA_INTERRUPT) - if (restartSystemCall) in.sa_flags = 0; - else in.sa_flags = SA_INTERRUPT; -#else - in.sa_flags = 0; -#endif - - return (sigaction(sig, &in, &out) ? (SignalHandlerFunc) -1 : - (SignalHandlerFunc) out.sa_handler); -#else /* !HAVE_DECL_SIGACTION */ - return (SignalHandlerFunc) -1; -#endif /* HAVE_DECL_SIGACTION */ -} - - -@ -\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. -*/ -@ -\newpage -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/cfuns-c.c.pamphlet b/src/lib/cfuns-c.c index ad5a97e8..de00deee 100644 --- a/src/lib/cfuns-c.c.pamphlet +++ b/src/lib/cfuns-c.c @@ -1,51 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib cfuns-c.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. + + 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) 2007, Gabriel Dos Reis */ -@ -<<*>>= -<<license>> #include <sys/types.h> #include <sys/stat.h> @@ -277,9 +263,3 @@ copyEnvValue(char *varName, char *buffer) return strlen(s); } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/cursor.c.pamphlet b/src/lib/cursor.c index dd2d34da..960d12e8 100644 --- a/src/lib/cursor.c.pamphlet +++ b/src/lib/cursor.c @@ -1,51 +1,35 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib cursor.c} -\author{Stephen Watt, James Wen} -\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. + + 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>> #include <stdlib.h> #include "axiom-c-macros.h" @@ -156,9 +140,3 @@ Cursor_shape(int shape) -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/edin.c b/src/lib/edin.c new file mode 100644 index 00000000..baa997ed --- /dev/null +++ b/src/lib/edin.c @@ -0,0 +1,941 @@ +/* + 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. +*/ + +/* #define debug 1 */ + +#include <stdlib.h> +#include "axiom-c-macros.h" +#if defined(MACOSXplatform) +#include "/usr/include/unistd.h" +#else +#include <unistd.h> +#endif +#include <string.h> +#include <stdio.h> +#include <sys/types.h> + +#include "edible.h" + +#define HFT 0 +#define SUN 1 +#define DEC 2 +#define control_to_alpha(x) (x + ('A' - 0x01)) +#define alpha_to_control(x) (x - ('A' - 0x01)) + +int termId; +QueStruct *ring = NULL; +QueStruct *current = NULL; +int ring_size = 0; +int MAXRING = 64; +int prev_check = 10; +int curr_pntr; +int num_pntr; +int num_proc; +int had_tab; +int had_tab_last; +extern char buff[1024]; /* Buffers for collecting input and */ +extern int buff_flag[1024]; /* flags for whether buff chars + are printing or non-printing */ +int buff_pntr; /* present length of buff */ + + +#include "edin.H1" +#include "prt.H1" +#include "wct.H1" +#include "cursor.H1" +#include "fnct_key.H1" + + + +void +init_reader(void) +{ + char *termVal; + + buff[50] = '\0'; /** initialize some stuff ***/ + init_flag(buff_flag, MAXLINE); + buff_pntr = curr_pntr = 0; + + had_tab = 0; + had_tab_last = 0; + termVal = (char *) getenv("TERM"); + if (!strcmp("sun", termVal)) + termId = SUN; + else if (!strcmp("xterm", termVal) || !strncmp("vt", termVal, 2)) + termId = DEC; + else if (!strcmp("hft", termVal) || !strncmp("aixterm", termVal, 7)) + termId = HFT; +} + + +void +do_reading(void) +{ + int ttt_read; + int done_completely; + + done_completely = 0; + num_proc = 0; + while (num_proc < num_read) { + if(in_buff[num_proc]== _ERASE) { + back_over_current_char(); + num_proc++; + } + else { + switch (in_buff[num_proc]) { + /* lets start checking for different types of chars */ + case _EOLN: + case _CR: + /* If I have read a complete line, so send it to the child */ + send_line_to_child(); + if (!PTY) + myputchar('\n'); + break; + + /* + * Use 0x7f as delete + */ + case _DEL: + /* Had a delete key */ + delete_current_char(); + break; + + case _CNTRL_W: + move_back_word(); + num_proc++; + break; + case _TAB: + had_tab = 1; + /* command completion stuff */ + num_proc++; + if (had_tab_last) + rescan_wct(); + else + find_wct(); + break; + case _BELL: + insert_buff_nonprinting(1); + putchar(_BELL); + fflush(stdout); + break; + case _ESC: + + /* + * get 2 characters more + */ + while (!(num_read - num_proc > 2)) { + ttt_read = read(0, + in_buff + num_read, + 2 - (num_read - num_proc) + 1); + if (ttt_read > 0) + num_read = num_read + ttt_read; + } + if ((in_buff[num_proc + 1] == _LBRACK)) { + + /* ESC [ */ + + switch (in_buff[num_proc + 2]) { + /* look for arrows */ + case _A: + /* up arrow */ + + /* + * The first thing I plan to do is get rid of the present + * input ** + */ + prev_buff(); + curr_pntr = buff_pntr; + num_proc = num_proc + 3; + break; + case _B: + /* down arrow */ + next_buff(); + curr_pntr = buff_pntr; + num_proc = num_proc + 3; + break; + case _C: + /* right arrow */ + move_ahead(); + num_proc = num_proc + 3; + break; + case _D: + /* left arrow */ + move_back(); + num_proc = num_proc + 3; + break; + + /* + * Use ^[[P as delete + */ + case _P: + /*** Had a delete key ****/ + delete_current_char(); + break; + case _H: + case 0: + move_home(); + num_proc += 3; + break; + case _M: + case _Z: + insert_buff_nonprinting(3); + done_completely = 1; + num_proc += 3; + break; + case _x: + num_proc = num_read; + break; + case _1: + case _2: + case _0: + + /* + * I have had a possible function key hit, look for the + * ones I want. check for ESC ] x ~ + */ + while (!(num_read - num_proc > 3)) { + ttt_read = read(0, + in_buff + num_read, + 3 - (num_read - num_proc) + 1); + if (ttt_read > 0) + num_read = num_read + ttt_read; + } + if (in_buff[num_proc + 3] == _twiddle) { + + /* + * treat ESC ] x ~ + */ + switch (in_buff[num_proc + 2]) { + case _2: + flip(INS_MODE); + if (INS_MODE) + Cursor_shape(5); + else + Cursor_shape(2); + reprint(curr_pntr); + num_proc += 4; + break; + default: + insert_buff_nonprinting(1); + break; + } + break; + } + /* check for ESC ] x y ~ */ + while (!(num_read - num_proc > 4)) { + ttt_read = read(0, + in_buff + num_read, + 4 - (num_read - num_proc) + 1); + if (ttt_read > 0) + num_read = num_read + ttt_read; + } + if (in_buff[num_proc + 4] == _twiddle) { + + /* + * treat ESC ] x y ~ + */ + insert_buff_nonprinting(1); + break; + } + + /* check for ESC ] x y z [q|z] */ + + while (!(num_read - num_proc > 5)) { + ttt_read = read(0, + in_buff + num_read, + 5 - (num_read - num_proc) + 1); + if (ttt_read > 0) + num_read = num_read + ttt_read; + } + if (insert_toggle(&in_buff[num_proc + 3])) { + flip(INS_MODE); + if (INS_MODE) + Cursor_shape(5); + else + Cursor_shape(2); + reprint(curr_pntr); + num_proc = num_proc + 6; + break; + } + else if (cntrl_end(&in_buff[num_proc + 3])) { + num_proc = num_proc + 6; + delete_to_end_of_line(); + break; + } + else if (back_word(&in_buff[num_proc + 3])) { + move_back_word(); + num_proc += 6; + break; + } + else if (fore_word(&in_buff[num_proc + 3])) { + move_fore_word(); + num_proc += 6; + break; + } + else if (end_key(&in_buff[num_proc + 3])) { + move_end(); + num_proc += 6; + break; + } + switch (in_buff[num_proc + 5]) { + case _q: + + /* + * IBM function keys + */ + { + char num[3]; + int key; + + num[0] = in_buff[num_proc + 3]; + num[1] = in_buff[num_proc + 4]; + num[2] = '\0'; + key = atoi(num); + if (key > 0 && key < 13) { + if (function_key[key].str != NULL) { + handle_function_key(key, contNum); + done_completely = 1; + } + else { + insert_buff_nonprinting(6); + done_completely = 1; + } + } + else { + insert_buff_nonprinting(6); + done_completely = 1; + } + break; + } + case _z: + + /* + * Sun function keys + */ + { + char num[3]; + int key; + + num[0] = in_buff[num_proc + 3]; + num[1] = in_buff[num_proc + 4]; + num[2] = '\0'; + key = atoi(num) - 23; + if (key > 0 && key < 13) { + if (function_key[key].str != NULL) { + handle_function_key(key, contNum); + done_completely = 1; + } + else { + insert_buff_nonprinting(6); + done_completely = 1; + } + } + else if (atoi(num) == 14) { + move_home(); + num_proc += 6; + done_completely = 1; + } + else if (atoi(num) == 20) { + move_end(); + num_proc += 6; + done_completely = 1; + } + else if (atoi(num) == 47) { + flip(INS_MODE); + if (INS_MODE) + Cursor_shape(5); + else + Cursor_shape(2); + reprint(curr_pntr); + num_proc = num_proc + 6; + done_completely = 1; + } + else { + insert_buff_nonprinting(6); + done_completely = 1; + } + + break; + } + + default: + insert_buff_nonprinting(1); + break; + } + default: + if (!done_completely) + insert_buff_nonprinting(1); + break; + } + } /* if */ + else { /* ESC w/o [ */ + insert_buff_nonprinting(1); + } + break; + + case _BKSPC: + back_over_current_char(); + num_proc++; + break; + default: + if (in_buff[num_proc] == _KILL) { + delete_line(); + num_proc++; + } + else { + if ((in_buff[num_proc] == _INTR) || (in_buff[num_proc] == _QUIT)) { + write(contNum, &in_buff[num_proc], num_read - num_proc); + if (!PTY) + write(contNum, "\n", 1); + num_proc++; + } + else { + if (in_buff[num_proc] == _EOF) { + insert_buff_nonprinting(1); + if (!PTY) + write(contNum, "\n", 1); + + /*comment out this bit + if (!buff_pntr) { + write(contNum, &in_buff[num_proc], 1); + if (!PTY) + write(contNum, "\n", 1); + } + else { + write(contNum, buff, buff_pntr); + } + */ + num_proc++; + } + else { + if (in_buff[num_proc] == _EOL) { + send_line_to_child(); + if (!PTY) + write(contNum, "\n", 1); + } + else { + if (in_buff[num_proc] == _ERASE) { + back_over_current_char(); + num_proc++; + } + else { + if (control_char(in_buff[num_proc])) + insert_buff_nonprinting(1); + else + insert_buff_printing(1); + } + } + } + } + } /* close the default case */ + break; + } /* switch */ + } /*else*/ + if (had_tab) { + had_tab_last = 1; + had_tab = 0; + } + else + had_tab_last = 0; + + } /* while */ +} + + + +void +send_line_to_child(void) +{ + static char converted_buffer[MAXLINE]; + int converted_num; + + /* Takes care of sending a line to the child, and resetting the + buffer for new input */ + + back_it_up(curr_pntr); + + /* start by putting the line into the command line ring ***/ + if (buff_pntr) + insert_queue(); + + /* finish the line and send it to the child **/ + buff[buff_pntr] = in_buff[num_proc]; + buff_flag[buff_pntr++] = 1; + buff[buff_pntr] = '\0'; + buff_flag[buff_pntr] = -1; + + /* + * Instead of actually writing the Line, I have to substitute in the + * actual characters recieved + */ + converted_num = + convert_buffer(converted_buffer, buff, buff_flag, buff_pntr); + write(contNum, converted_buffer, converted_num); + + /** reinitialize the buffer ***/ + init_flag(buff_flag, buff_pntr); + init_buff(buff, buff_pntr); + /** reinitialize my buffer pointers **/ + buff_pntr = curr_pntr = 0; + + /** reset the ring pointer **/ + current = NULL; + num_proc++; + return; +} + +int +convert_buffer(char *target, char *source,int * source_flag, int num) +{ + int i, j; + + /* + * Until I get something wierd, just keep copying + */ + for (i = 0, j = 0; i < num; i++, j++) { + switch (source[i]) { + case _CARROT: + if (source_flag[i] == 1) { + target[j] = source[i]; + } + else { + if (source[i + 1] == _LBRACK) { + target[j] = _ESC; + i++; + } + else if (source[i + 1] >= 'A' && source[i + 1] <= 'Z') { + target[j] = alpha_to_control(source[i + 1]); + i++; + } + } + break; + case '?': + default: + target[j] = source[i]; + } + } + return j; +} + + +void +insert_buff_printing(int amount) +{ + int count; + + /* This procedure takes the character at in_buff[num_proc] and adds + it to the buffer. It first checks to see if we should be inserting + or overwriting, and then does the appropriate thing */ + + if ((buff_pntr + amount) > 1023) { + putchar(_BELL); + fflush(stdout); + num_proc += amount; + } + else { + + if (INS_MODE) { + + forwardcopy(&buff[curr_pntr + amount], + &buff[curr_pntr], + buff_pntr - curr_pntr); + forwardflag_cpy(&buff_flag[curr_pntr + amount], + &buff_flag[curr_pntr], + buff_pntr - curr_pntr); + for (count = 0; count < amount; count++) { + buff[curr_pntr + count] = in_buff[num_proc + count]; + buff_flag[curr_pntr + count] = 1; + } + ins_print(curr_pntr, amount); + buff_pntr = buff_pntr + amount; + } + else { + for (count = 0; count < amount; count++) { + if (buff_flag[curr_pntr + count] == 2) { + myputchar(buff[curr_pntr + count]); + curr_pntr += count + 1; + delete_current_char(); + /** fix num_proc affected by delete **/ + num_proc -= 3; + curr_pntr -= count + 1; + myputchar(_BKSPC); + } + buff[curr_pntr + count] = in_buff[num_proc + count]; + buff_flag[curr_pntr + count] = 1; + } + myputchar(in_buff[num_proc]); + if (curr_pntr == buff_pntr) + buff_pntr++; + } + num_proc = num_proc + amount; + curr_pntr = curr_pntr + amount; + fflush(stdout); + } + return; + +} + +void +insert_buff_nonprinting(int amount) +{ + int count; + + /* This procedure takes the character at in_buff[num_proc] and adds + it to the buffer. It first checks to see if we should be inserting + or overwriting, and then does the appropriate thing */ + + /* it takes care of the special case, when I have an esc character */ + + if ((buff_pntr + amount) > 1023) { + myputchar(_BELL); + fflush(stdout); + num_proc += amount; + } + else { + if (INS_MODE) { + forwardcopy(&buff[curr_pntr + amount + 1], + &buff[curr_pntr], + buff_pntr - curr_pntr); + forwardflag_cpy(&buff_flag[curr_pntr + amount + 1], + &buff_flag[curr_pntr], + buff_pntr - curr_pntr); + /** now insert the special character **/ + switch (in_buff[num_proc]) { + case _ESC: + /** in this case I insert a '^[' into the string ***/ + buff[curr_pntr] = _CARROT; + buff_flag[curr_pntr] = 2; + buff[curr_pntr + 1] = _LBRACK; + buff_flag[curr_pntr + 1] = 0; + break; + default: + if (control_char(in_buff[num_proc])) { + buff[curr_pntr] = _CARROT; + buff_flag[curr_pntr] = 2; + buff[curr_pntr + 1] = control_to_alpha(in_buff[num_proc]); + buff_flag[curr_pntr + 1] = 0; + } + else { + /** What do I have ? **/ + buff[curr_pntr] = '?'; + buff_flag[curr_pntr] = 2; + buff[curr_pntr + 1] = in_buff[num_proc]; + buff_flag[curr_pntr] = 0; + break; + } + } + /** Now add the normal characters **/ + for (count = 1; count < amount; count++) { + buff[curr_pntr + count + 1] = in_buff[num_proc + count]; + buff_flag[curr_pntr + count + 1] = 1; + } + ins_print(curr_pntr, amount + 1); + buff_pntr = buff_pntr + amount + 1; + } + else { + /** I am in the overstrike mode **/ + switch (in_buff[num_proc]) { + case _ESC: + /** in this case I insert a '^[' into the string ***/ + buff[curr_pntr] = _CARROT; + buff_flag[curr_pntr] = 2; + buff[curr_pntr + 1] = _LBRACK; + buff_flag[curr_pntr + 1] = 0; + break; + default: + if (control_char(in_buff[num_proc])) { + buff[curr_pntr] = _CARROT; + buff_flag[curr_pntr] = 2; + buff[curr_pntr + 1] = control_to_alpha(in_buff[num_proc]); + buff_flag[curr_pntr + 1] = 0; + } + else { + /** What do I have ? **/ + buff[curr_pntr] = '?'; + buff_flag[curr_pntr] = 2; + buff[curr_pntr + 1] = in_buff[num_proc]; + buff_flag[curr_pntr] = 0; + break; + } + } + for (count = 1; count < amount; count++) { + if (buff_flag[curr_pntr + count] == 2) { + curr_pntr += count + 1; + delete_current_char(); + /** fix num. processed form delete **/ + num_proc -= 3; + curr_pntr -= count + 1; + } + buff[curr_pntr + count + 1] = in_buff[num_proc + count]; + buff_flag[curr_pntr + count + 1] = 1; + } + /** now print the characters I have put in **/ + printbuff(curr_pntr, amount + 1); + } + num_proc = num_proc + amount; + curr_pntr = curr_pntr + amount + 1; + if (curr_pntr > buff_pntr) + buff_pntr = curr_pntr; + } + return; + +} + +void +prev_buff(void) +{ + + /* + * If the current command ring is NULL, then I should NOT clear the + * current line. Thus my business is already done + */ + if (ring == NULL) + return; + clear_buff(); + init_buff(buff, buff_pntr); + init_flag(buff_flag, buff_pntr); + + if (current == NULL) { + if (ring == NULL) + return; + current = ring; + } + else + current = current->prev; + strcpy(buff, current->buff); + flagcpy(buff_flag, current->flags); + + /* first back up and blank the line */ + fflush(stdout); + printbuff(0, strlen(buff)); + curr_pntr = buff_pntr = strlen(buff); + fflush(stdout); + return ; +} + +void +next_buff(void) +{ + + /* + * If the current command ring is NULL, then I should NOT clear the + * current line. Thus my business is already done + */ + if (ring == NULL) + return; + clear_buff(); + init_buff(buff, buff_pntr); + init_flag(buff_flag, buff_pntr); + if (current == NULL) { + if (ring == NULL) + return; + current = ring->next; + } + else + current = current->next; + strcpy(buff, current->buff); + flagcpy(buff_flag, current->flags); + + /* first back up and blank the line **/ + fflush(stdout); + printbuff(0, strlen(buff)); + curr_pntr = buff_pntr = strlen(buff); + fflush(stdout); + return ; +} + + +void +forwardcopy(char *buff1,char * buff2,int num) +{ + int count; + + for (count = num; count >= 0; count--) + buff1[count] = buff2[count]; +} + + +void +forwardflag_cpy(int *buff1,int * buff2,int num) +{ + int count; + + for (count = num; count >= 0; count--) + buff1[count] = buff2[count]; +} + +void +flagcpy(int *s,int *t) +{ + while (*t >= 0) + *s++ = *t++; + *s = *t; +} + +void +flagncpy(int *s,int *t,int n) +{ + while (n-- > 0) + *s++ = *t++; +} + +void +insert_queue(void) +{ + QueStruct *trace; + QueStruct *new; + int c; + + if (!ECHOIT) + return; + if (ring != NULL && !strcmp(buff, ring->buff)) + return; + for (c = 0, trace = ring; trace != NULL && c < (prev_check - 1); + c++, trace = trace->prev) { + if (!strcmp(buff, trace->buff)) { + + /* + * throw this puppy at the end of the ring + */ + trace->next->prev = trace->prev; + trace->prev->next = trace->next; + trace->prev = ring; + trace->next = ring->next; + ring->next = trace; + trace->next->prev = trace; + ring = trace; + return; + } + } + + /* + * simply places the buff command into the front of the queue + */ + if (ring_size < MAXRING) { + new = (QueStruct *) malloc(sizeof(struct que_struct)); + if (new == NULL) { + fprintf(stderr, "Malloc Error: Ran out of memory\n"); + exit(-1); + } + if (ring_size == 0) { + ring = new; + ring->prev = ring->next = new; + } + else { + new->next = ring->next; + new->prev = ring; + ring->next = new; + new->next->prev = new; + ring = new; + } + ring_size++; + } + else + ring = ring->next; + + init_flag(ring->flags, MAXLINE); + init_buff(ring->buff, MAXLINE); + strcpy(ring->buff, buff); + flagncpy(ring->flags, buff_flag, buff_pntr); + (ring->buff)[buff_pntr] = '\0'; + (ring->flags)[buff_pntr] = -1; +} + + +void +init_flag(int *flags, int num) +{ + int i; + + for (i = 0; i < num; i++) + flags[i] = -1; +} + +void +init_buff(char *flags, int num) +{ + int i; + + for (i = 0; i < num; i++) + flags[i] = '\0'; +} + + +void +send_function_to_child(void) +{ + /* Takes care of sending a line to the child, and resetting the + buffer for new input */ + + back_it_up(curr_pntr); + /** start by putting the line into the command line ring ***/ + if (buff_pntr) + insert_queue(); + + /** finish the line and send it to the child **/ + buff[buff_pntr] = _EOLN; + + buff_flag[buff_pntr++] = 1; + buff[buff_pntr] = '\0'; + buff_flag[buff_pntr] = 0; + write(contNum, buff, buff_pntr); + + /** reinitialize the buffer ***/ + init_flag(buff_flag, buff_pntr); + init_buff(buff, buff_pntr); + /** reinitialize my buffer pointers **/ + buff_pntr = curr_pntr = 0; + + /** reset the ring pointer **/ + current = NULL; + + num_proc++; + return; +} + +void +send_buff_to_child(int chann) +{ + if (buff_pntr > 0) + write(chann, buff, buff_pntr); + num_proc += 6; + /** reinitialize the buffer ***/ + init_flag(buff_flag, buff_pntr); + init_buff(buff, buff_pntr); + /** reinitialize my buffer pointers **/ + buff_pntr = curr_pntr = 0; + /** reset the ring pointer **/ + current = NULL; + return; +} + diff --git a/src/lib/edin.c.pamphlet b/src/lib/edin.c.pamphlet deleted file mode 100644 index 97b9143a..00000000 --- a/src/lib/edin.c.pamphlet +++ /dev/null @@ -1,971 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib edin.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>> - -/* #define debug 1 */ - -#include <stdlib.h> -#include "axiom-c-macros.h" -@ -The MACOSX platform is broken because no matter what you do it seems to -include files from [[/usr/include/sys]] ahead of [[/usr/include]]. On linux -systems these files include themselves which causes an infinite regression -of includes that fails. GCC gracefully steps over that problem but the -build fails anyway. On MACOSX the [[/usr/include/sys]] versions -of files are badly broken with respect to the [[/usr/include]] versions. -<<*>>= -#if defined(MACOSXplatform) -#include "/usr/include/unistd.h" -#else -#include <unistd.h> -#endif -#include <string.h> -#include <stdio.h> -#include <sys/types.h> - -#include "edible.h" - -#define HFT 0 -#define SUN 1 -#define DEC 2 -#define control_to_alpha(x) (x + ('A' - 0x01)) -#define alpha_to_control(x) (x - ('A' - 0x01)) - -int termId; -QueStruct *ring = NULL; -QueStruct *current = NULL; -int ring_size = 0; -int MAXRING = 64; -int prev_check = 10; -int curr_pntr; -int num_pntr; -int num_proc; -int had_tab; -int had_tab_last; -extern char buff[1024]; /* Buffers for collecting input and */ -extern int buff_flag[1024]; /* flags for whether buff chars - are printing or non-printing */ -int buff_pntr; /* present length of buff */ - - -#include "edin.H1" -#include "prt.H1" -#include "wct.H1" -#include "cursor.H1" -#include "fnct_key.H1" - - - -void -init_reader(void) -{ - char *termVal; - - buff[50] = '\0'; /** initialize some stuff ***/ - init_flag(buff_flag, MAXLINE); - buff_pntr = curr_pntr = 0; - - had_tab = 0; - had_tab_last = 0; - termVal = (char *) getenv("TERM"); - if (!strcmp("sun", termVal)) - termId = SUN; - else if (!strcmp("xterm", termVal) || !strncmp("vt", termVal, 2)) - termId = DEC; - else if (!strcmp("hft", termVal) || !strncmp("aixterm", termVal, 7)) - termId = HFT; -} - - -void -do_reading(void) -{ - int ttt_read; - int done_completely; - - done_completely = 0; - num_proc = 0; - while (num_proc < num_read) { - if(in_buff[num_proc]== _ERASE) { - back_over_current_char(); - num_proc++; - } - else { - switch (in_buff[num_proc]) { - /* lets start checking for different types of chars */ - case _EOLN: - case _CR: - /* If I have read a complete line, so send it to the child */ - send_line_to_child(); - if (!PTY) - myputchar('\n'); - break; - - /* - * Use 0x7f as delete - */ - case _DEL: - /* Had a delete key */ - delete_current_char(); - break; - - case _CNTRL_W: - move_back_word(); - num_proc++; - break; - case _TAB: - had_tab = 1; - /* command completion stuff */ - num_proc++; - if (had_tab_last) - rescan_wct(); - else - find_wct(); - break; - case _BELL: - insert_buff_nonprinting(1); - putchar(_BELL); - fflush(stdout); - break; - case _ESC: - - /* - * get 2 characters more - */ - while (!(num_read - num_proc > 2)) { - ttt_read = read(0, - in_buff + num_read, - 2 - (num_read - num_proc) + 1); - if (ttt_read > 0) - num_read = num_read + ttt_read; - } - if ((in_buff[num_proc + 1] == _LBRACK)) { - - /* ESC [ */ - - switch (in_buff[num_proc + 2]) { - /* look for arrows */ - case _A: - /* up arrow */ - - /* - * The first thing I plan to do is get rid of the present - * input ** - */ - prev_buff(); - curr_pntr = buff_pntr; - num_proc = num_proc + 3; - break; - case _B: - /* down arrow */ - next_buff(); - curr_pntr = buff_pntr; - num_proc = num_proc + 3; - break; - case _C: - /* right arrow */ - move_ahead(); - num_proc = num_proc + 3; - break; - case _D: - /* left arrow */ - move_back(); - num_proc = num_proc + 3; - break; - - /* - * Use ^[[P as delete - */ - case _P: - /*** Had a delete key ****/ - delete_current_char(); - break; - case _H: - case 0: - move_home(); - num_proc += 3; - break; - case _M: - case _Z: - insert_buff_nonprinting(3); - done_completely = 1; - num_proc += 3; - break; - case _x: - num_proc = num_read; - break; - case _1: - case _2: - case _0: - - /* - * I have had a possible function key hit, look for the - * ones I want. check for ESC ] x ~ - */ - while (!(num_read - num_proc > 3)) { - ttt_read = read(0, - in_buff + num_read, - 3 - (num_read - num_proc) + 1); - if (ttt_read > 0) - num_read = num_read + ttt_read; - } - if (in_buff[num_proc + 3] == _twiddle) { - - /* - * treat ESC ] x ~ - */ - switch (in_buff[num_proc + 2]) { - case _2: - flip(INS_MODE); - if (INS_MODE) - Cursor_shape(5); - else - Cursor_shape(2); - reprint(curr_pntr); - num_proc += 4; - break; - default: - insert_buff_nonprinting(1); - break; - } - break; - } - /* check for ESC ] x y ~ */ - while (!(num_read - num_proc > 4)) { - ttt_read = read(0, - in_buff + num_read, - 4 - (num_read - num_proc) + 1); - if (ttt_read > 0) - num_read = num_read + ttt_read; - } - if (in_buff[num_proc + 4] == _twiddle) { - - /* - * treat ESC ] x y ~ - */ - insert_buff_nonprinting(1); - break; - } - - /* check for ESC ] x y z [q|z] */ - - while (!(num_read - num_proc > 5)) { - ttt_read = read(0, - in_buff + num_read, - 5 - (num_read - num_proc) + 1); - if (ttt_read > 0) - num_read = num_read + ttt_read; - } - if (insert_toggle(&in_buff[num_proc + 3])) { - flip(INS_MODE); - if (INS_MODE) - Cursor_shape(5); - else - Cursor_shape(2); - reprint(curr_pntr); - num_proc = num_proc + 6; - break; - } - else if (cntrl_end(&in_buff[num_proc + 3])) { - num_proc = num_proc + 6; - delete_to_end_of_line(); - break; - } - else if (back_word(&in_buff[num_proc + 3])) { - move_back_word(); - num_proc += 6; - break; - } - else if (fore_word(&in_buff[num_proc + 3])) { - move_fore_word(); - num_proc += 6; - break; - } - else if (end_key(&in_buff[num_proc + 3])) { - move_end(); - num_proc += 6; - break; - } - switch (in_buff[num_proc + 5]) { - case _q: - - /* - * IBM function keys - */ - { - char num[3]; - int key; - - num[0] = in_buff[num_proc + 3]; - num[1] = in_buff[num_proc + 4]; - num[2] = '\0'; - key = atoi(num); - if (key > 0 && key < 13) { - if (function_key[key].str != NULL) { - handle_function_key(key, contNum); - done_completely = 1; - } - else { - insert_buff_nonprinting(6); - done_completely = 1; - } - } - else { - insert_buff_nonprinting(6); - done_completely = 1; - } - break; - } - case _z: - - /* - * Sun function keys - */ - { - char num[3]; - int key; - - num[0] = in_buff[num_proc + 3]; - num[1] = in_buff[num_proc + 4]; - num[2] = '\0'; - key = atoi(num) - 23; - if (key > 0 && key < 13) { - if (function_key[key].str != NULL) { - handle_function_key(key, contNum); - done_completely = 1; - } - else { - insert_buff_nonprinting(6); - done_completely = 1; - } - } - else if (atoi(num) == 14) { - move_home(); - num_proc += 6; - done_completely = 1; - } - else if (atoi(num) == 20) { - move_end(); - num_proc += 6; - done_completely = 1; - } - else if (atoi(num) == 47) { - flip(INS_MODE); - if (INS_MODE) - Cursor_shape(5); - else - Cursor_shape(2); - reprint(curr_pntr); - num_proc = num_proc + 6; - done_completely = 1; - } - else { - insert_buff_nonprinting(6); - done_completely = 1; - } - - break; - } - - default: - insert_buff_nonprinting(1); - break; - } - default: - if (!done_completely) - insert_buff_nonprinting(1); - break; - } - } /* if */ - else { /* ESC w/o [ */ - insert_buff_nonprinting(1); - } - break; - - case _BKSPC: - back_over_current_char(); - num_proc++; - break; - default: - if (in_buff[num_proc] == _KILL) { - delete_line(); - num_proc++; - } - else { - if ((in_buff[num_proc] == _INTR) || (in_buff[num_proc] == _QUIT)) { - write(contNum, &in_buff[num_proc], num_read - num_proc); - if (!PTY) - write(contNum, "\n", 1); - num_proc++; - } - else { - if (in_buff[num_proc] == _EOF) { - insert_buff_nonprinting(1); - if (!PTY) - write(contNum, "\n", 1); - - /*comment out this bit - if (!buff_pntr) { - write(contNum, &in_buff[num_proc], 1); - if (!PTY) - write(contNum, "\n", 1); - } - else { - write(contNum, buff, buff_pntr); - } - */ - num_proc++; - } - else { - if (in_buff[num_proc] == _EOL) { - send_line_to_child(); - if (!PTY) - write(contNum, "\n", 1); - } - else { - if (in_buff[num_proc] == _ERASE) { - back_over_current_char(); - num_proc++; - } - else { - if (control_char(in_buff[num_proc])) - insert_buff_nonprinting(1); - else - insert_buff_printing(1); - } - } - } - } - } /* close the default case */ - break; - } /* switch */ - } /*else*/ - if (had_tab) { - had_tab_last = 1; - had_tab = 0; - } - else - had_tab_last = 0; - - } /* while */ -} - - - -void -send_line_to_child(void) -{ - static char converted_buffer[MAXLINE]; - int converted_num; - - /* Takes care of sending a line to the child, and resetting the - buffer for new input */ - - back_it_up(curr_pntr); - - /* start by putting the line into the command line ring ***/ - if (buff_pntr) - insert_queue(); - - /* finish the line and send it to the child **/ - buff[buff_pntr] = in_buff[num_proc]; - buff_flag[buff_pntr++] = 1; - buff[buff_pntr] = '\0'; - buff_flag[buff_pntr] = -1; - - /* - * Instead of actually writing the Line, I have to substitute in the - * actual characters recieved - */ - converted_num = - convert_buffer(converted_buffer, buff, buff_flag, buff_pntr); - write(contNum, converted_buffer, converted_num); - - /** reinitialize the buffer ***/ - init_flag(buff_flag, buff_pntr); - init_buff(buff, buff_pntr); - /** reinitialize my buffer pointers **/ - buff_pntr = curr_pntr = 0; - - /** reset the ring pointer **/ - current = NULL; - num_proc++; - return; -} - -int -convert_buffer(char *target, char *source,int * source_flag, int num) -{ - int i, j; - - /* - * Until I get something wierd, just keep copying - */ - for (i = 0, j = 0; i < num; i++, j++) { - switch (source[i]) { - case _CARROT: - if (source_flag[i] == 1) { - target[j] = source[i]; - } - else { - if (source[i + 1] == _LBRACK) { - target[j] = _ESC; - i++; - } - else if (source[i + 1] >= 'A' && source[i + 1] <= 'Z') { - target[j] = alpha_to_control(source[i + 1]); - i++; - } - } - break; - case '?': - default: - target[j] = source[i]; - } - } - return j; -} - - -void -insert_buff_printing(int amount) -{ - int count; - - /* This procedure takes the character at in_buff[num_proc] and adds - it to the buffer. It first checks to see if we should be inserting - or overwriting, and then does the appropriate thing */ - - if ((buff_pntr + amount) > 1023) { - putchar(_BELL); - fflush(stdout); - num_proc += amount; - } - else { - - if (INS_MODE) { - - forwardcopy(&buff[curr_pntr + amount], - &buff[curr_pntr], - buff_pntr - curr_pntr); - forwardflag_cpy(&buff_flag[curr_pntr + amount], - &buff_flag[curr_pntr], - buff_pntr - curr_pntr); - for (count = 0; count < amount; count++) { - buff[curr_pntr + count] = in_buff[num_proc + count]; - buff_flag[curr_pntr + count] = 1; - } - ins_print(curr_pntr, amount); - buff_pntr = buff_pntr + amount; - } - else { - for (count = 0; count < amount; count++) { - if (buff_flag[curr_pntr + count] == 2) { - myputchar(buff[curr_pntr + count]); - curr_pntr += count + 1; - delete_current_char(); - /** fix num_proc affected by delete **/ - num_proc -= 3; - curr_pntr -= count + 1; - myputchar(_BKSPC); - } - buff[curr_pntr + count] = in_buff[num_proc + count]; - buff_flag[curr_pntr + count] = 1; - } - myputchar(in_buff[num_proc]); - if (curr_pntr == buff_pntr) - buff_pntr++; - } - num_proc = num_proc + amount; - curr_pntr = curr_pntr + amount; - fflush(stdout); - } - return; - -} - -void -insert_buff_nonprinting(int amount) -{ - int count; - - /* This procedure takes the character at in_buff[num_proc] and adds - it to the buffer. It first checks to see if we should be inserting - or overwriting, and then does the appropriate thing */ - - /* it takes care of the special case, when I have an esc character */ - - if ((buff_pntr + amount) > 1023) { - myputchar(_BELL); - fflush(stdout); - num_proc += amount; - } - else { - if (INS_MODE) { - forwardcopy(&buff[curr_pntr + amount + 1], - &buff[curr_pntr], - buff_pntr - curr_pntr); - forwardflag_cpy(&buff_flag[curr_pntr + amount + 1], - &buff_flag[curr_pntr], - buff_pntr - curr_pntr); - /** now insert the special character **/ - switch (in_buff[num_proc]) { - case _ESC: - /** in this case I insert a '^[' into the string ***/ - buff[curr_pntr] = _CARROT; - buff_flag[curr_pntr] = 2; - buff[curr_pntr + 1] = _LBRACK; - buff_flag[curr_pntr + 1] = 0; - break; - default: - if (control_char(in_buff[num_proc])) { - buff[curr_pntr] = _CARROT; - buff_flag[curr_pntr] = 2; - buff[curr_pntr + 1] = control_to_alpha(in_buff[num_proc]); - buff_flag[curr_pntr + 1] = 0; - } - else { - /** What do I have ? **/ - buff[curr_pntr] = '?'; - buff_flag[curr_pntr] = 2; - buff[curr_pntr + 1] = in_buff[num_proc]; - buff_flag[curr_pntr] = 0; - break; - } - } - /** Now add the normal characters **/ - for (count = 1; count < amount; count++) { - buff[curr_pntr + count + 1] = in_buff[num_proc + count]; - buff_flag[curr_pntr + count + 1] = 1; - } - ins_print(curr_pntr, amount + 1); - buff_pntr = buff_pntr + amount + 1; - } - else { - /** I am in the overstrike mode **/ - switch (in_buff[num_proc]) { - case _ESC: - /** in this case I insert a '^[' into the string ***/ - buff[curr_pntr] = _CARROT; - buff_flag[curr_pntr] = 2; - buff[curr_pntr + 1] = _LBRACK; - buff_flag[curr_pntr + 1] = 0; - break; - default: - if (control_char(in_buff[num_proc])) { - buff[curr_pntr] = _CARROT; - buff_flag[curr_pntr] = 2; - buff[curr_pntr + 1] = control_to_alpha(in_buff[num_proc]); - buff_flag[curr_pntr + 1] = 0; - } - else { - /** What do I have ? **/ - buff[curr_pntr] = '?'; - buff_flag[curr_pntr] = 2; - buff[curr_pntr + 1] = in_buff[num_proc]; - buff_flag[curr_pntr] = 0; - break; - } - } - for (count = 1; count < amount; count++) { - if (buff_flag[curr_pntr + count] == 2) { - curr_pntr += count + 1; - delete_current_char(); - /** fix num. processed form delete **/ - num_proc -= 3; - curr_pntr -= count + 1; - } - buff[curr_pntr + count + 1] = in_buff[num_proc + count]; - buff_flag[curr_pntr + count + 1] = 1; - } - /** now print the characters I have put in **/ - printbuff(curr_pntr, amount + 1); - } - num_proc = num_proc + amount; - curr_pntr = curr_pntr + amount + 1; - if (curr_pntr > buff_pntr) - buff_pntr = curr_pntr; - } - return; - -} - -void -prev_buff(void) -{ - - /* - * If the current command ring is NULL, then I should NOT clear the - * current line. Thus my business is already done - */ - if (ring == NULL) - return; - clear_buff(); - init_buff(buff, buff_pntr); - init_flag(buff_flag, buff_pntr); - - if (current == NULL) { - if (ring == NULL) - return; - current = ring; - } - else - current = current->prev; - strcpy(buff, current->buff); - flagcpy(buff_flag, current->flags); - - /* first back up and blank the line */ - fflush(stdout); - printbuff(0, strlen(buff)); - curr_pntr = buff_pntr = strlen(buff); - fflush(stdout); - return ; -} - -void -next_buff(void) -{ - - /* - * If the current command ring is NULL, then I should NOT clear the - * current line. Thus my business is already done - */ - if (ring == NULL) - return; - clear_buff(); - init_buff(buff, buff_pntr); - init_flag(buff_flag, buff_pntr); - if (current == NULL) { - if (ring == NULL) - return; - current = ring->next; - } - else - current = current->next; - strcpy(buff, current->buff); - flagcpy(buff_flag, current->flags); - - /* first back up and blank the line **/ - fflush(stdout); - printbuff(0, strlen(buff)); - curr_pntr = buff_pntr = strlen(buff); - fflush(stdout); - return ; -} - - -void -forwardcopy(char *buff1,char * buff2,int num) -{ - int count; - - for (count = num; count >= 0; count--) - buff1[count] = buff2[count]; -} - - -void -forwardflag_cpy(int *buff1,int * buff2,int num) -{ - int count; - - for (count = num; count >= 0; count--) - buff1[count] = buff2[count]; -} - -void -flagcpy(int *s,int *t) -{ - while (*t >= 0) - *s++ = *t++; - *s = *t; -} - -void -flagncpy(int *s,int *t,int n) -{ - while (n-- > 0) - *s++ = *t++; -} - -void -insert_queue(void) -{ - QueStruct *trace; - QueStruct *new; - int c; - - if (!ECHOIT) - return; - if (ring != NULL && !strcmp(buff, ring->buff)) - return; - for (c = 0, trace = ring; trace != NULL && c < (prev_check - 1); - c++, trace = trace->prev) { - if (!strcmp(buff, trace->buff)) { - - /* - * throw this puppy at the end of the ring - */ - trace->next->prev = trace->prev; - trace->prev->next = trace->next; - trace->prev = ring; - trace->next = ring->next; - ring->next = trace; - trace->next->prev = trace; - ring = trace; - return; - } - } - - /* - * simply places the buff command into the front of the queue - */ - if (ring_size < MAXRING) { - new = (QueStruct *) malloc(sizeof(struct que_struct)); - if (new == NULL) { - fprintf(stderr, "Malloc Error: Ran out of memory\n"); - exit(-1); - } - if (ring_size == 0) { - ring = new; - ring->prev = ring->next = new; - } - else { - new->next = ring->next; - new->prev = ring; - ring->next = new; - new->next->prev = new; - ring = new; - } - ring_size++; - } - else - ring = ring->next; - - init_flag(ring->flags, MAXLINE); - init_buff(ring->buff, MAXLINE); - strcpy(ring->buff, buff); - flagncpy(ring->flags, buff_flag, buff_pntr); - (ring->buff)[buff_pntr] = '\0'; - (ring->flags)[buff_pntr] = -1; -} - - -void -init_flag(int *flags, int num) -{ - int i; - - for (i = 0; i < num; i++) - flags[i] = -1; -} - -void -init_buff(char *flags, int num) -{ - int i; - - for (i = 0; i < num; i++) - flags[i] = '\0'; -} - - -void -send_function_to_child(void) -{ - /* Takes care of sending a line to the child, and resetting the - buffer for new input */ - - back_it_up(curr_pntr); - /** start by putting the line into the command line ring ***/ - if (buff_pntr) - insert_queue(); - - /** finish the line and send it to the child **/ - buff[buff_pntr] = _EOLN; - - buff_flag[buff_pntr++] = 1; - buff[buff_pntr] = '\0'; - buff_flag[buff_pntr] = 0; - write(contNum, buff, buff_pntr); - - /** reinitialize the buffer ***/ - init_flag(buff_flag, buff_pntr); - init_buff(buff, buff_pntr); - /** reinitialize my buffer pointers **/ - buff_pntr = curr_pntr = 0; - - /** reset the ring pointer **/ - current = NULL; - - num_proc++; - return; -} - -void -send_buff_to_child(int chann) -{ - if (buff_pntr > 0) - write(chann, buff, buff_pntr); - num_proc += 6; - /** reinitialize the buffer ***/ - init_flag(buff_flag, buff_pntr); - init_buff(buff, buff_pntr); - /** reinitialize my buffer pointers **/ - buff_pntr = curr_pntr = 0; - /** reset the ring pointer **/ - current = NULL; - return; -} - -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/fnct_key.c.pamphlet b/src/lib/fnct_key.c index 576b89ac..a44f0bf5 100644 --- a/src/lib/fnct_key.c.pamphlet +++ b/src/lib/fnct_key.c @@ -1,73 +1,37 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib fnct\_key.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{MAC OSX and BSD port} -On the MAC OSX the signal [[SIGCLD]] has been renamed to [[SIGCHLD]]. -In order to handle this change we need to ensure that the platform -variable is set properly and that the platform variable is changed -everywhere. -<<mac os signal rename>>= -#if defined(MACOSXplatform) || defined(BSDplatform) - bsdSignal(SIGCHLD, null_fnct,RestartSystemCalls); -#else - bsdSignal(SIGCLD, null_fnct,RestartSystemCalls); -#endif -@ -\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. + + 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>> #include "axiom-c-macros.h" -@ -The MACOSX platform is broken because no matter what you do it seems to -include files from [[/usr/include/sys]] ahead of [[/usr/include]]. On linux -systems these files include themselves which causes an infinite regression -of includes that fails. GCC gracefully steps over that problem but the -build fails anyway. On MACOSX the [[/usr/include/sys]] versions -of files are badly broken with respect to the [[/usr/include]] versions. -<<*>>= #if defined(MACOSXplatform) #include "/usr/include/unistd.h" #else @@ -346,7 +310,11 @@ handle_function_key(int key,int chann) close(fd); } } -<<mac os signal rename>> +#if defined(MACOSXplatform) || defined(BSDplatform) + bsdSignal(SIGCHLD, null_fnct,RestartSystemCalls); +#else + bsdSignal(SIGCLD, null_fnct,RestartSystemCalls); +#endif switch (id = fork()) { case -1: perror("Special key"); @@ -387,9 +355,3 @@ handle_function_key(int key,int chann) return; } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/halloc.c b/src/lib/halloc.c new file mode 100644 index 00000000..aa9fe9dd --- /dev/null +++ b/src/lib/halloc.c @@ -0,0 +1,57 @@ +/* + 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. +*/ + +#include "axiom-c-macros.h" + +/* memory allocation used by HyperDoc and addfile */ + +#include <stdlib.h> +#include <stdio.h> + +#include "halloc.H1" + + +/* allocate memory and bomb if none left (hyperTeX alloc) */ +char * +halloc(int bytes,char * msg) +{ + static char buf[200]; + char *result; + + result = (char *) malloc(bytes); + if (result == NULL) { + sprintf(buf, "Ran out of memory allocating %s.\b", msg); + exit(-1); + } + return result; +} diff --git a/src/lib/halloc.c.pamphlet b/src/lib/halloc.c.pamphlet deleted file mode 100644 index 037181d3..00000000 --- a/src/lib/halloc.c.pamphlet +++ /dev/null @@ -1,79 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib halloc.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>> - -#include "axiom-c-macros.h" - -/* memory allocation used by HyperDoc and addfile */ - -#include <stdlib.h> -#include <stdio.h> - -#include "halloc.H1" - - -/* allocate memory and bomb if none left (hyperTeX alloc) */ -char * -halloc(int bytes,char * msg) -{ - static char buf[200]; - char *result; - - result = (char *) malloc(bytes); - if (result == NULL) { - sprintf(buf, "Ran out of memory allocating %s.\b", msg); - exit(-1); - } - return result; -} -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/hash.c.pamphlet b/src/lib/hash.c index 44fed43a..b7a8a379 100644 --- a/src/lib/hash.c.pamphlet +++ b/src/lib/hash.c @@ -1,51 +1,36 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{no title} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -<<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. + + 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>> #include "axiom-c-macros.h" #define _HASH_C @@ -89,7 +74,7 @@ free_hash(HashTable *table, FreeFunction free_fun) for (e = table->table[i]; e != NULL;) { next = e->next; (*free_fun) (e->data); - (*e).data=0; + (*e).data=0; free(e); e = next; } @@ -232,9 +217,3 @@ alloc_string(char *str) strcpy(result,str); return (result); } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/openpty.c.pamphlet b/src/lib/openpty.c index 20976367..5b99f2ad 100644 --- a/src/lib/openpty.c.pamphlet +++ b/src/lib/openpty.c @@ -1,63 +1,35 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib openpty.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{MAC OSX and BSD platform changes} -Since we have no other information we are adding the [[MACOSXplatform]] variable -to the list everywhere we find [[LINUXplatform]]. This may not be correct but -we have no way to know yet. We have also added the [[BSDplatform]] variable. -MAC OSX is some variant of BSD. These should probably be merged but we -cannot yet prove that. -<<mac osx platform change 1>>= -#if defined(SUN4OS5platform) ||defined(ALPHAplatform) || defined(HP10platform) || defined(LINUXplatform) || defined(MACOSXplatform) || defined(BSDplatform) -@ -<<mac osx platform change 2>>= -#if defined(SUNplatform) || defined(HP9platform) || defined(LINUXplatform) || defined(MACOSXplatform) || defined(BSDplatform) -@ -\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. + + 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>> #include "axiom-c-macros.h" #include <stdlib.h> @@ -107,9 +79,9 @@ ptyopen(int *controller,int * server, char *controllerPath,char * serverPath) if (*controller >= 0) { *server = open(serverPath, oflag, 0); if (*server > 0) - looking = 0; + looking = 0; else - close(*controller); + close(*controller); } } if (looking) { @@ -139,7 +111,7 @@ ptyopen(int *controller,int * server, char *controllerPath,char * serverPath) return(fdm); #endif -<<mac osx platform change 1>> +#if defined(SUN4OS5platform) ||defined(ALPHAplatform) || defined(HP10platform) || defined(LINUXplatform) || defined(MACOSXplatform) || defined(BSDplatform) extern int grantpt(int); extern int unlockpt(int); extern char* ptsname(int); @@ -198,29 +170,23 @@ void makeNextPtyNames(char *cont,char * serv) { #ifdef AIX370platform - static int channelNo = 0; - sprintf(cont, "/dev/ptyp%02x", channelNo); - sprintf(serv, "/dev/ttyp%02x", channelNo); - channelNo++; + static int channelNo = 0; + sprintf(cont, "/dev/ptyp%02x", channelNo); + sprintf(serv, "/dev/ttyp%02x", channelNo); + channelNo++; #endif -<<mac osx platform change 2>> - static int channelNo = 0; - static char group[] = "pqrstuvwxyzPQRST"; - static int groupNo = 0; - - sprintf(cont, "/dev/pty%c%x", group[groupNo], channelNo); - sprintf(serv, "/dev/tty%c%x", group[groupNo], channelNo); - channelNo++; /* try next */ - if (channelNo == 16) { /* move to new group */ - channelNo = 0; - groupNo++; - if (groupNo == 16) groupNo = 0; /* recycle */ - } +#if defined(SUNplatform) || defined(HP9platform) || defined(LINUXplatform) || defined(MACOSXplatform) || defined(BSDplatform) + static int channelNo = 0; + static char group[] = "pqrstuvwxyzPQRST"; + static int groupNo = 0; + + sprintf(cont, "/dev/pty%c%x", group[groupNo], channelNo); + sprintf(serv, "/dev/tty%c%x", group[groupNo], channelNo); + channelNo++; /* try next */ + if (channelNo == 16) { /* move to new group */ + channelNo = 0; + groupNo++; + if (groupNo == 16) groupNo = 0; /* recycle */ + } #endif } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/pixmap.c.pamphlet b/src/lib/pixmap.c index 509e1ea3..05b06c25 100644 --- a/src/lib/pixmap.c.pamphlet +++ b/src/lib/pixmap.c @@ -1,61 +1,35 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib pixmap.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{MAC OSX zopen redefinition} -On the [[MAC OSX]] platform they defined [[zopen]]. Since the function -is only used in this file we simply rename it to [[zzopen]]. -<<mac zopen redefinition 1>>= -FILE * -zzopen(char *file,char * mode) -@ -<<mac zopen redefinition 2>>= - file = zzopen(filename, "r"); -@ -\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. + + 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>> #include "axiom-c-macros.h" @@ -93,7 +67,8 @@ file_exists(char *file) return 0; } -<<mac zopen redefinition 1>> +FILE * +zzopen(char *file,char * mode) { char com[512], zfile[512]; @@ -218,7 +193,7 @@ read_pixmap_file(Display *display, int screen, char *filename, if ((num_colors = makeColors(display, screen, &cmap, &spadColors, &ts)) < 0) { return(-1); } -<<mac zopen redefinition 2>> + file = zzopen(filename, "r"); if (file == NULL) { printf("couldn't open %s\n", filename); return BitmapOpenFailed; @@ -344,9 +319,3 @@ write_pixmap_file(Display *dsp, int scr, char *fn, -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/prt.c.pamphlet b/src/lib/prt.c index 7491c9fb..4138bc50 100644 --- a/src/lib/prt.c.pamphlet +++ b/src/lib/prt.c @@ -1,51 +1,35 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib prt.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. + + 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>> #include "axiom-c-macros.h" #include <string.h> @@ -421,9 +405,3 @@ back_over_current_char(void) return; } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/sockio-c.c.pamphlet b/src/lib/sockio-c.c index 184a5ff5..f1ab39c8 100644 --- a/src/lib/sockio-c.c.pamphlet +++ b/src/lib/sockio-c.c @@ -1,56 +1,35 @@ -\documentclass{article} -\usepackage{axiom} - -\title{\$SPAD/src/lib sockio-c.c} -\author{The Axiom Team} - -\begin{document} -\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. + + 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>> /* socket i/o primitives */ @@ -494,9 +473,9 @@ get_string(Sock *sock) buf = malloc(len*sizeof(char)); val = fill_buf(sock, buf, len, "string"); if (val == -1){ - free(buf); - return NULL; - } + free(buf); + return NULL; + } #ifdef DEBUG fprintf(stderr,"get_string: received \"%s\" \n",buf); #endif @@ -1170,7 +1149,7 @@ print_line(char *s) typedef union { double f; long l[2]; - } DoubleFloat; + } DoubleFloat; double plus_infinity(void ) @@ -1210,9 +1189,3 @@ NANQ(void) } return nanq.f; } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/spadcolors.c.pamphlet b/src/lib/spadcolors.c index 635b0f9f..4cd79e09 100644 --- a/src/lib/spadcolors.c.pamphlet +++ b/src/lib/spadcolors.c @@ -1,51 +1,35 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib spadcolors.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. + + 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>> #include "axiom-c-macros.h" #include "spadcolors.h" @@ -214,7 +198,7 @@ HLStoRGB(HLS hls) int makeColors(Display *dsply, int scrn, Colormap *colorMap, - unsigned long **colorIndex, int *total_Shades) + unsigned long **colorIndex, int *total_Shades) { int h, s; @@ -249,14 +233,14 @@ makeColors(Display *dsply, int scrn, Colormap *colorMap, hsv.s = saturations[s]; hsv.v = values[s]; rgb = HSVtoRGB(hsv); - color.red = rgb.r *((1<<16)-1); - color.green = rgb.g *((1<<16)-1); - color.blue = rgb.b *((1<<16)-1); + color.red = rgb.r *((1<<16)-1); + color.green = rgb.g *((1<<16)-1); + color.blue = rgb.b *((1<<16)-1); color.flags = DoRed | DoGreen | DoBlue; - /* - fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); - fprintf(stderr,"%d\t%d\t%d\n",color.red,color.green,color.blue); - */ + /* + fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); + fprintf(stderr,"%d\t%d\t%d\n",color.red,color.green,color.blue); + */ if ((okay = XAllocColor(dsply, *colorMap, &color))) hiya[colorNum++] = color.pixel; /* hiya points to table */ } /* for s */ @@ -268,14 +252,14 @@ makeColors(Display *dsply, int scrn, Colormap *colorMap, hsv.v = values[s]; rgb = HSVtoRGB(hsv); - color.red = rgb.r *((1<<16)-1); - color.green = rgb.g *((1<<16)-1); - color.blue = rgb.b *((1<<16)-1); + color.red = rgb.r *((1<<16)-1); + color.green = rgb.g *((1<<16)-1); + color.blue = rgb.b *((1<<16)-1); color.flags = DoRed | DoGreen | DoBlue; - /* - fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); - fprintf(stderr,"%d\t%d\t%d\n",color.red,color.green,color.blue); - */ + /* + fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); + fprintf(stderr,"%d\t%d\t%d\n",color.red,color.green,color.blue); + */ if ((okay = XAllocColor(dsply, *colorMap, &color))) hiya[colorNum++] = color.pixel; @@ -289,14 +273,14 @@ makeColors(Display *dsply, int scrn, Colormap *colorMap, hsv.v = values[s]; rgb = HSVtoRGB(hsv); - color.red = rgb.r *((1<<16)-1); - color.green = rgb.g *((1<<16)-1); - color.blue = rgb.b *((1<<16)-1); + color.red = rgb.r *((1<<16)-1); + color.green = rgb.g *((1<<16)-1); + color.blue = rgb.b *((1<<16)-1); color.flags = DoRed | DoGreen | DoBlue; - /* - fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); - fprintf(stderr,"%d\t%d\t%d\n",color.red,color.green,color.blue); - */ + /* + fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); + fprintf(stderr,"%d\t%d\t%d\n",color.red,color.green,color.blue); + */ if ((okay = XAllocColor(dsply, *colorMap, &color))) hiya[colorNum++] = color.pixel; } @@ -412,14 +396,14 @@ makeNewColorMap(Display *dsply, Colormap colorMap, int smoothHue) hls.s = saturation; rgb = HLStoRGB(hls); - xcolor.red = rgb.r *((1<<16)-1); - xcolor.green = rgb.g *((1<<16)-1); - xcolor.blue = rgb.b *((1<<16)-1); - xcolor.flags = DoRed | DoGreen | DoBlue; - /* - fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); - fprintf(stderr,"%d\t%d\t%d\n",xcolor.red,xcolor.green,xcolor.blue); - */ + xcolor.red = rgb.r *((1<<16)-1); + xcolor.green = rgb.g *((1<<16)-1); + xcolor.blue = rgb.b *((1<<16)-1); + xcolor.flags = DoRed | DoGreen | DoBlue; + /* + fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); + fprintf(stderr,"%d\t%d\t%d\n",xcolor.red,xcolor.green,xcolor.blue); + */ if (XAllocColor(dsply, colorMap, &xcolor)) { pixels[count] = xcolor.pixel; count++; @@ -505,65 +489,6 @@ FreePixels(Display *dsply, Colormap colorMap, int num) int AllocCells(Display *dsply, Colormap colorMap, int smoothHue) -@ -This routine used to have the following code block. However this -code block makes no sense. To see why you need to know that an -XColor object looks like: -\begin{verbatim} -/* - * Data structure used by color operations - */ -typedef struct { - unsigned long pixel; - unsigned short red, green, blue; - char flags; /* do_red, do_green, do_blue */ - char pad; -} XColor; -\end{verbatim} -This routine used to set the values of all of the elements of the XColor struct -except [[pixel]]. This is usually done to specify a desired color in RGB -values. To try to get a pixel value close to that color you call XAllocColor. -This routine sets up the desired color values but it never asks for the pixel -(which is really an index into the colormap of the nearest color) value that -corresponds to the desired color. In fact it uses pixel without ever giving -it a value. I've rewritten that code. -\begin{verbatim} -{ - unsigned long plane_masks[1]; - int i, count; - float lightness; - RGB rgb; - XColor xcolor; - HLS hls; - - count = 0; - for (i = 0; i < (smoothConst + 1); i++) { - lightness = (float) (i) / (float) (smoothConst); - hls.h = (float) smoothHue; - hls.l = lightness; - hls.s = saturation; - rgb = HLStoRGB(hls); - xcolor.red = rgb.r *((1@<<16)-1); - xcolor.green = rgb.g *((1@<<16)-1); - xcolor.blue = rgb.b *((1@<<16)-1); - xcolor.flags = DoRed | DoGreen | DoBlue; - /* - fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); - fprintf(stderr,"%d\t%d\t%d\n",xcolor.red,xcolor.green,xcolor.blue); - */ - pixels[i] = xcolor.pixel; - count++; - } - if (XAllocColorCells(dsply, colorMap, False, - plane_masks, 0, pixels, smoothConst + 1)) { - return (smoothConst + 1); - } - else { - return (0); - } -} -\end{verbatim} -<<*>>= { unsigned long plane_masks[1]; int i, count; @@ -587,10 +512,6 @@ it a value. I've rewritten that code. fprintf(stderr,"%f\t%f\t%f\n",rgb.r,rgb.g,rgb.b); fprintf(stderr,"%d\t%d\t%d\n",xcolor.red,xcolor.green,xcolor.blue); */ -@ -Here I've modified the code to actually as for the pixel (colormap index) that -most closely matches our requested RGB values. -<<*>>= if (XAllocColor(dsply, colorMap, &xcolor)) { pixels[count] = xcolor.pixel; count++; @@ -610,9 +531,3 @@ most closely matches our requested RGB values. return (0); } } -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/util.c.pamphlet b/src/lib/util.c index f4ec3a6e..3d34c275 100644 --- a/src/lib/util.c.pamphlet +++ b/src/lib/util.c @@ -1,28 +1,39 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib util.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\newpage -<<*>>= -<<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. +*/ #include "axiom-c-macros.h" #include <stdlib.h> -@ -The MACOSX platform is broken because no matter what you do it seems to -include files from [[/usr/include/sys]] ahead of [[/usr/include]]. On linux -systems these files include themselves which causes an infinite regression -of includes that fails. GCC gracefully steps over that problem but the -build fails anyway. On MACOSX the [[/usr/include/sys]] versions -of files are badly broken with respect to the [[/usr/include]] versions. -<<*>>= #if defined(MACOSXplatform) #include "/usr/include/unistd.h" #else @@ -149,44 +160,3 @@ getWindowSizeXY(Display *display,Window w) return (size); } -@ -\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. -*/ -@ -\newpage -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/lib/wct.c.pamphlet b/src/lib/wct.c index 0ceff558..58b4e308 100644 --- a/src/lib/wct.c.pamphlet +++ b/src/lib/wct.c @@ -1,16 +1,35 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/lib wct.c} -\author{The Axiom Team} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\newpage -<<*>>= -<<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. +*/ /* * Word completion. * @@ -24,14 +43,6 @@ #include <stdio.h> #include <stdlib.h> -@ -The MACOSX platform is broken because no matter what you do it seems to -include files from [[/usr/include/sys]] ahead of [[/usr/include]]. On linux -systems these files include themselves which causes an infinite regression -of includes that fails. GCC gracefully steps over that problem but the -build fails anyway. On MACOSX the [[/usr/include/sys]] versions -of files are badly broken with respect to the [[/usr/include]] versions. -<<*>>= #if defined(MACOSXplatform) #include "/usr/include/unistd.h" #else @@ -177,7 +188,7 @@ rescanWct(void) for (i = 0; i < wc; i++) { curr_wix.word = i; if (strneql(wv[i], prefix, preflen)) - return &curr_wix; + return &curr_wix; } } @@ -192,7 +203,7 @@ rescanWct(void) for (i = 0; i < wc; i++) { curr_wix.word = i; if (strneql(wv[i], prefix, preflen)) - return &curr_wix; + return &curr_wix; } } @@ -725,44 +736,3 @@ find_wct(void) } -@ -\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. -*/ -@ -\newpage -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} |