[comp.sources.misc] v08i080: libhoward portability library, part 2 of 9

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (10/01/89)

Posting-number: Volume 8, Issue 80
Submitted-by: howard@dahlbeck.ericsson.se (Howard Gayle)
Archive-name: libhoward/part02

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 2 (of 9)."
# Contents:  LICENSE a2.3 a2d.c a2smp.c new-b.b
# Wrapped by howard@hasse on Mon Sep 25 07:08:05 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'LICENSE' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'LICENSE'\"
else
echo shar: Extracting \"'LICENSE'\" \(12487 characters\)
sed "s/^X//" >'LICENSE' <<'END_OF_FILE'
X		    GNU GENERAL PUBLIC LICENSE
X		     Version 1, February 1989
X
X Copyright (C) 1989 Free Software Foundation, Inc.
X                    675 Mass Ave, Cambridge, MA 02139, USA
X Everyone is permitted to copy and distribute verbatim copies
X of this license document, but changing it is not allowed.
X
X			    Preamble
X
X  The license agreements of most software companies try to keep users
Xat the mercy of those companies.  By contrast, our General Public
XLicense is intended to guarantee your freedom to share and change free
Xsoftware--to make sure the software is free for all its users.  The
XGeneral Public License applies to the Free Software Foundation's
Xsoftware and to any other program whose authors commit to using it.
XYou can use it for your programs, too.
X
X  When we speak of free software, we are referring to freedom, not
Xprice.  Specifically, the General Public License is designed to make
Xsure that you have the freedom to give away or sell copies of free
Xsoftware, that you receive source code or can get it if you want it,
Xthat you can change the software or use pieces of it in new free
Xprograms; and that you know you can do these things.
X
X  To protect your rights, we need to make restrictions that forbid
Xanyone to deny you these rights or to ask you to surrender the rights.
XThese restrictions translate to certain responsibilities for you if you
Xdistribute copies of the software, or if you modify it.
X
X  For example, if you distribute copies of a such a program, whether
Xgratis or for a fee, you must give the recipients all the rights that
Xyou have.  You must make sure that they, too, receive or can get the
Xsource code.  And you must tell them their rights.
X
X  We protect your rights with two steps: (1) copyright the software, and
X(2) offer you this license which gives you legal permission to copy,
Xdistribute and/or modify the software.
X
X  Also, for each author's protection and ours, we want to make certain
Xthat everyone understands that there is no warranty for this free
Xsoftware.  If the software is modified by someone else and passed on, we
Xwant its recipients to know that what they have is not the original, so
Xthat any problems introduced by others will not reflect on the original
Xauthors' reputations.
X
X  The precise terms and conditions for copying, distribution and
Xmodification follow.
X
X		    GNU GENERAL PUBLIC LICENSE
X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
X
X  0. This License Agreement applies to any program or other work which
Xcontains a notice placed by the copyright holder saying it may be
Xdistributed under the terms of this General Public License.  The
X"Program", below, refers to any such program or work, and a "work based
Xon the Program" means either the Program or any work containing the
XProgram or a portion of it, either verbatim or with modifications.  Each
Xlicensee is addressed as "you".
X
X  1. You may copy and distribute verbatim copies of the Program's source
Xcode as you receive it, in any medium, provided that you conspicuously and
Xappropriately publish on each copy an appropriate copyright notice and
Xdisclaimer of warranty; keep intact all the notices that refer to this
XGeneral Public License and to the absence of any warranty; and give any
Xother recipients of the Program a copy of this General Public License
Xalong with the Program.  You may charge a fee for the physical act of
Xtransferring a copy.
X
X  2. You may modify your copy or copies of the Program or any portion of
Xit, and copy and distribute such modifications under the terms of Paragraph
X1 above, provided that you also do the following:
X
X    a) cause the modified files to carry prominent notices stating that
X    you changed the files and the date of any change; and
X
X    b) cause the whole of any work that you distribute or publish, that
X    in whole or in part contains the Program or any part thereof, either
X    with or without modifications, to be licensed at no charge to all
X    third parties under the terms of this General Public License (except
X    that you may choose to grant warranty protection to some or all
X    third parties, at your option).
X
X    c) If the modified program normally reads commands interactively when
X    run, you must cause it, when started running for such interactive use
X    in the simplest and most usual way, to print or display an
X    announcement including an appropriate copyright notice and a notice
X    that there is no warranty (or else, saying that you provide a
X    warranty) and that users may redistribute the program under these
X    conditions, and telling the user how to view a copy of this General
X    Public License.
X
X    d) You may charge a fee for the physical act of transferring a
X    copy, and you may at your option offer warranty protection in
X    exchange for a fee.
X
XMere aggregation of another independent work with the Program (or its
Xderivative) on a volume of a storage or distribution medium does not bring
Xthe other work under the scope of these terms.
X
X  3. You may copy and distribute the Program (or a portion or derivative of
Xit, under Paragraph 2) in object code or executable form under the terms of
XParagraphs 1 and 2 above provided that you also do one of the following:
X
X    a) accompany it with the complete corresponding machine-readable
X    source code, which must be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    b) accompany it with a written offer, valid for at least three
X    years, to give any third party free (except for a nominal charge
X    for the cost of distribution) a complete machine-readable copy of the
X    corresponding source code, to be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    c) accompany it with the information you received as to where the
X    corresponding source code may be obtained.  (This alternative is
X    allowed only for noncommercial distribution and only if you
X    received the program in object code or executable form alone.)
X
XSource code for a work means the preferred form of the work for making
Xmodifications to it.  For an executable file, complete source code means
Xall the source code for all modules it contains; but, as a special
Xexception, it need not include source code for modules which are standard
Xlibraries that accompany the operating system on which the executable
Xfile runs, or for standard header files or definitions files that
Xaccompany that operating system.
X
X  4. You may not copy, modify, sublicense, distribute or transfer the
XProgram except as expressly provided under this General Public License.
XAny attempt otherwise to copy, modify, sublicense, distribute or transfer
Xthe Program is void, and will automatically terminate your rights to use
Xthe Program under this License.  However, parties who have received
Xcopies, or rights to use copies, from you under this General Public
XLicense will not have their licenses terminated so long as such parties
Xremain in full compliance.
X
X  5. By copying, distributing or modifying the Program (or any work based
Xon the Program) you indicate your acceptance of this license to do so,
Xand all its terms and conditions.
X
X  6. Each time you redistribute the Program (or any work based on the
XProgram), the recipient automatically receives a license from the original
Xlicensor to copy, distribute or modify the Program subject to these
Xterms and conditions.  You may not impose any further restrictions on the
Xrecipients' exercise of the rights granted herein.
X
X  7. The Free Software Foundation may publish revised and/or new versions
Xof the General Public License from time to time.  Such new versions will
Xbe similar in spirit to the present version, but may differ in detail to
Xaddress new problems or concerns.
X
XEach version is given a distinguishing version number.  If the Program
Xspecifies a version number of the license which applies to it and "any
Xlater version", you have the option of following the terms and conditions
Xeither of that version or of any later version published by the Free
XSoftware Foundation.  If the Program does not specify a version number of
Xthe license, you may choose any version ever published by the Free Software
XFoundation.
X
X  8. If you wish to incorporate parts of the Program into other free
Xprograms whose distribution conditions are different, write to the author
Xto ask for permission.  For software which is copyrighted by the Free
XSoftware Foundation, write to the Free Software Foundation; we sometimes
Xmake exceptions for this.  Our decision will be guided by the two goals
Xof preserving the free status of all derivatives of our free software and
Xof promoting the sharing and reuse of software generally.
X
X			    NO WARRANTY
X
X  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
XREPAIR OR CORRECTION.
X
X  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
XPOSSIBILITY OF SUCH DAMAGES.
X
X		     END OF TERMS AND CONDITIONS
X
X	Appendix: How to Apply These Terms to Your New Programs
X
X  If you develop a new program, and you want it to be of the greatest
Xpossible use to humanity, the best way to achieve this is to make it
Xfree software which everyone can redistribute and change under these
Xterms.
X
X  To do so, attach the following notices to the program.  It is safest to
Xattach them to the start of each source file to most effectively convey
Xthe exclusion of warranty; and each file should have at least the
X"copyright" line and a pointer to where the full notice is found.
X
X    <one line to give the program's name and a brief idea of what it does.>
X    Copyright (C) 19yy  <name of author>
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X
XAlso add information on how to contact you by electronic and paper mail.
X
XIf the program is interactive, make it output a short notice like this
Xwhen it starts in an interactive mode:
X
X    Gnomovision version 69, Copyright (C) 19xx name of author
X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
X    This is free software, and you are welcome to redistribute it
X    under certain conditions; type `show c' for details.
X
XThe hypothetical commands `show w' and `show c' should show the
Xappropriate parts of the General Public License.  Of course, the
Xcommands you use may be called something other than `show w' and `show
Xc'; they could even be mouse-clicks or menu items--whatever suits your
Xprogram.
X
XYou should also get your employer (if you work as a programmer) or your
Xschool, if any, to sign a "copyright disclaimer" for the program, if
Xnecessary.  Here a sample; alter the names:
X
X  Yoyodyne, Inc., hereby disclaims all copyright interest in the
X  program `Gnomovision' (a program to direct compilers to make passes
X  at assemblers) written by James Hacker.
X
X  <signature of Ty Coon>, 1 April 1989
X  Ty Coon, President of Vice
X
XThat's all there is to it!
END_OF_FILE
if test 12487 -ne `wc -c <'LICENSE'`; then
    echo shar: \"'LICENSE'\" unpacked with wrong size!
fi
# end of 'LICENSE'
fi
if test -f 'a2.3' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'a2.3'\"
else
echo shar: Extracting \"'a2.3'\" \(8479 characters\)
sed "s/^X//" >'a2.3' <<'END_OF_FILE'
X.\" $Header: a2.3,v 1.2 89/08/10 13:53:23 howard Exp $
X.TH A2 "3 -lhoward" "$Revision: 1.2 $" "Howard\'s C library" "Howard\'s C library"
X.SH NAME
Xa2 \- convert Ada-syntax numeric literals to internal representations
X.SH SYNOPSIS
X.nf
X.BR "#include <" stdio.h ">"
X.BR "#include <" howard/port.h ">"
X.BR "#include <" howard/a2.h ">"
X.fi
X.LP
X.BR "int " "a2d ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR resultPointer ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.BI "double *" resultPointer;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "double " "ma2d ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldname ;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "double " "mra2d ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR low ,
X.IR high ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldName ;
X.BI "double " low;
X.BI "double " high;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "int " "a2i ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR resultPointer ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.BI "int *" resultPointer;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "int " "ma2i ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldname ;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "int " "mra2i ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR low ,
X.IR high ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldName ;
X.BI "int " low;
X.BI "int " high;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "int " "a2l ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR resultPointer ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.BI "long *" resultPointer;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "long " "ma2l ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldname ;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "long " "mra2l ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR low ,
X.IR high ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldName ;
X.BI "long " low;
X.BI "long " high;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "int " "a2u ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR resultPointer ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.BI "unsigned *" resultPointer;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "unsigned " "ma2u ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldname ;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "unsigned " "mra2u ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR low ,
X.IR high ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldName ;
X.BI "unsigned " low;
X.BI "unsigned " high;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
X.BR "int " "a2ul ("
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR resultPointer ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "ulongT *" resultPointer ;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
XulongT ma2ul (
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldname ;
X.RI "bStrT *" endPointer ;
X.fi
X.LP
XulongT mra2ul (
X.IR string ,
X.IR limit ,
X.IR looseSyntax ,
X.IR fieldName ,
X.IR low ,
X.IR high ,
X.IR endPointer " )"
X.nf
X.RI "bStrT " string ";"
X.RI "bStrT " limit ";"
X.RI "boolT " looseSyntax ";"
X.RI "bStrT " fieldName ;
X.RI "ulongT " low ;
X.RI "ulongT " high ;
X.RI "bStrT *" endPointer ;
X.fi
X.SH COPYRIGHT
XCopyright \(co 1989 Howard Lee Gayle
X.SH DESCRIPTION
XThese functions convert Ada-syntax numeric literals to internal
Xrepresentations.
XThey check for syntax errors and overflow.
XThe syntax of Ada numeric literals is (from the Language
XReference Manual [LRM]):
X.nf
X   numeric_literal ::= decimal_literal | based_literal
X   decimal_literal ::= integer [.integer] [exponent]
X   integer ::= digit {[underline] digit}
X   exponent ::= E [+] integer | E - integer
X   based_literal ::= base # based_integer [.based_integer] # [exponent]
X   base ::= integer
X   based_integer ::= extended_digit {[underline] extended_digit}
X   extended_digit ::= digit | letter
X.fi
XA numeric literal may be preceded by an optional sign.
X.PP
XFor the appropriate functions,
X.I string
Xis the string representation of the numeric literal.
XIf
X.I limit
Xis not NULL, then it is taken as a pointer to the byte in
X.I string
Xafter the last byte to be treated as part of the literal.
XIf
X.I looseSyntax
Xis FALSE, then the literal must strictly follow Ada syntax.
XOtherwise, leading white space is permitted, no digit is
Xrequired either before or after a radix point, and conversion
Xstops when a byte is encountered that can not be part of the
Xliteral.
XIf
X.I resultPointer
Xis not NULL, and if the conversion is successful, then the
Xinternal value is stored in the area to which
X.I resultPointer
Xpoints.
XIf
X.I endPointer
Xis not NULL, then a pointer to the byte in
X.I string
Xthat ended the conversion is stored in the area to which
X.I endPointer
Xpoints.
X.I fieldName
Xis a string used to identify the conversion in possible error
Xmessages,
X.I e.g.
X"Body font size."
XIn functions starting with mr, the
X.I low
Xand
X.I high
Xparameters specify that the result must be in the range
X.RI [ low ", " high ].
X.SH RETURNS
XThe functions not starting with m return 0 on success,
XEINVAL on invalid arguments,
XEDOM on syntax error,
Xand ERANGE on overflow.
XThe funtions starting with m return the internal value of the
Xnumeric literal on success, and call
X.IR malf1 (3)
Xon error.
X.SH EXAMPLES
XHere are some examples of numeric literals from the LRM:
X.nf
X12   0   1E6   123_456
X12.0   0.0   0.456   3.14159_26
X1.34E-12   1.0E+6
X2#1111_1111#   16#FF#   016#0FF#
X16#E#E1   2#1110_0000#
X.fi
X.PP
XThis very simple program converts its input to decimal:
X.nf
Xmain (argc, argv)
Xint    argc; /* Number of arguments.*/
XbStrT *argv; /* Points to array of argument strings.*/
X{
Xprintf ("%ld\en", ma2l (argv[1], NULBSTR, FALSE, S("arg"), (bStrT *) NULL));
X}
X.fi
X.SH "SEE ALSO"
X.IR malf (3 \-lhoward),
X.IR simultipre (3 \-lhoward),
X.IR strtod (3),
X.IR strtol (3),
X.IR "Ada Language Reference Manual" .
X.SH DIAGNOSTICS
XIn case of syntax error,
X.IR malf (3)
Xplaces a veritcal line in the input string at the position of
Xthe error.
X.SH BUGS
XBased real literals are not implemented.
X.PP
XThe functions ending in
X.I a2d
Xcall
X.IR atof (3)
Xto do the actual conversion.
XOn some systems, atof does not check for overflow.
X.SH RATIONALE
XWhatever one thinks of the rest of the language, Ada's numeric
Xliteral syntax is consistent and logical.
XRadix selection is not
X.IR "ad hoc" ,
Xas in some other languages.
XThe underscore greatly increases readability of long literals,
Xso that even binary literals can be useful,
X.I e.g.
Xfor bit registers.
XInteger exponents can also increase readability.
XFor example, 2 to the 31st power can be written
Xstraightforwardly as 2#1#E31.
X.SH LICENSE
XThis program is free software; you can redistribute it and/or modify
Xit under the terms of the GNU General Public License version 1,
Xas published by the Free Software Foundation.
X.PP
XThis program is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
XGNU General Public License for more details.
X.PP
XYou should have received a copy of the GNU General Public License
Xalong with this program; if not, write to the Free Software
XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X.SH AUTHOR
XHoward Gayle,
XTN/ETX/T/BG,
XEricsson Telecom AB,
XS-126 25 Stockholm,
XSweden,
Xhoward@ericsson.se,
Xuunet!ericsson.se!howard,
XPhone: +46 8 719 5565,
XFAX: +46 8 719 9598,
XTelex: 14910 ERIC S
END_OF_FILE
if test 8479 -ne `wc -c <'a2.3'`; then
    echo shar: \"'a2.3'\" unpacked with wrong size!
fi
# end of 'a2.3'
fi
if test -f 'a2d.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'a2d.c'\"
else
echo shar: Extracting \"'a2d.c'\" \(9807 characters\)
sed "s/^X//" >'a2d.c' <<'END_OF_FILE'
X/*
X * a2d - convert Ada-syntax real literal to double
X */
X
X#ifndef lint
Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
X#endif lint
X
X/*
X * This program is free software; you can redistribute it and/or modify
X * it under the terms of the GNU General Public License version 1,
X * as published by the Free Software Foundation.
X *
X * This program is distributed in the hope that it will be useful,
X * but WITHOUT ANY WARRANTY; without even the implied warranty of
X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X * GNU General Public License for more details.
X *
X * You should have received a copy of the GNU General Public License
X * along with this program; if not, write to the Free Software
X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X */
X
X#include <stdio.h>
X#include <howard/port.h>
X#include <howard/version.h>
X
XMODVER ("@(#)$Header: a2d.c,v 1.7 89/08/09 18:13:20 howard Exp $");
X
X#include <ctype.h>
X#include <errno.h>
X#include <string.h>
X#include <howard/a2.h>
X#include <howard/malf.h>
X#include <howard/registers.i>
X#include <howard/simultipre.i>
X#include <howard/smp.h>
X
XPUBLIC int a2d (str, lim, synok, res, end)
XR7  bStrT   str;   /* Input string.*/
XR8  bStrT   lim;   /* Don't pass this.*/
XR5  boolT   synok; /* Accept non-fatal syntax errors.*/
XR9  double *res;   /* Points to where to store result.*/
XR11 bStrT  *end;   /* End pointer stored here.*/
X
X/* Function:
X *    
X * Algorithm:
X *    Scan str with finite state automaton.  Build up argument to atof().
X *    Call atof to do the actual conversion.
X * Returns:
X *    
X * Notes:
X *    1) Should not use atof, since it doesn't always set errno correctly.
X */
X{
X/* States: */
X#define S_BEG   (-1) /* Start.*/
X#define S_BINT  (-2) /* Start of integer part.*/
X#define S_IINT  (-3) /* In integer part.*/
X#define S_BFRAC (-4) /* Start of fractional part.*/
X#define S_IFRAC (-5) /* In fractional part.*/
X#define S_BEXP  (-6) /* Start of exponent.*/
X#define S_FEXP  (-7) /* Expecting first digit of exponent.*/
X#define S_IEXP  (-8) /* In exponent.*/
XR4     rcharT c;     /* Current character.*/
X       double d;     /* atof(3) returns this.*/
XR2     int    i;     /* General purpose.*/
XR1     cStrT  p;     /* Steps through buf[].*/
XR6     cStrT  pe;    /* Points to end of buf[].*/
XR3     int    s;     /* State or return code.*/
XR10    int    se;    /* Save errno.*/
Xstatic bStrT  dt[] = /* Digit table.*/
X   {
X   S("_"),
X   S("+"),
X   S("-"),
X   S("."),
X   S("0"),
X   S("1"),
X   S("2"),
X   S("3"),
X   S("4"),
X   S("5"),
X   S("6"),
X   S("7"),
X   S("8"),
X   S("9"),
X   NULBSTR
X   };
Xchar buf[512]; /* Accumulate string here.*/
Xextern double atof(); /* (3).*/
X
Xp = buf;
Xpe = &buf[sizeof (buf) - 2];
Xs = ((NULBSTR == str) ? EINVAL : S_BEG);
Xwhile (s < 0)
X   {
X   c = ((str == lim) ? EOS : B(*str));
X   i = ((EOS == c) ? -2 : smpdtl (c, dt));
X   switch (s)
X      {
X      case S_BEG:
X         if (DT_PLUS == i)
X            s = S_BINT;
X         else if (DT_NEG == i)
X            {
X            *p++ = '-';
X            s = S_BINT;
X            }
X         else if (DT_ZERO <= i)
X            {
X            *p++ = '0' + i - DT_ZERO;
X            s = S_IINT;
X            }
X         else if (synok && (DT_RADP == i))
X            {
X            *p++ = '0';
X            *p++ = '.';
X            s = S_BFRAC;
X            }
X         else if (!synok || !isascii (c) || !isspace (c))
X            s = EDOM; /* Leading white space OK if synok set.*/
X         break;
X      case S_BINT:
X         if (DT_ZERO <= i)
X            {
X            *p++ = '0' + i - DT_ZERO;
X            s = S_IINT;
X            }
X         else if (synok && (DT_RADP == i))
X            {
X            *p++ = '0';
X            *p++ = '.';
X            s = S_BFRAC;
X            }
X         else
X            s = EDOM;
X         break;
X      case S_IINT:
X         if (DT_ZERO <= i)
X            {
X            if (p == pe) s = EDOM; else *p++ = '0' + i - DT_ZERO;
X            }
X         else if (DT_RADP == i)
X            {
X            if (p == pe)
X               s = EDOM;
X            else
X               {
X               *p++ = '.';
X               s = S_BFRAC;
X               }
X            }
X         else if (DT_IGN != i)
X            switch (c)
X               {
X               case 'e':
X               case 'E':
X                  if (!synok || (p == pe))
X                     s = EDOM;
X                  else
X                     {
X                     *p++ = 'E';
X                     s = S_BEXP;
X                     }
X                  break;
X               default:
X                  s = (synok ? SUCCESS : EDOM);
X                  break;
X               }
X         break;
X      case S_BFRAC:
X         if (DT_ZERO <= i)
X            {
X            if (p == pe)
X               s = EDOM;
X            else
X               {
X               *p++ = '0' + i - DT_ZERO;
X               s = S_IFRAC;
X               }
X            }
X         else
X            s = (synok ? SUCCESS : EDOM);
X         break;
X      case S_IFRAC:
X         if (DT_ZERO <= i)
X            {
X            if (p == pe) s = EDOM; else *p++ = '0' + i - DT_ZERO;
X            }
X         else if (DT_IGN != i)
X            switch (c)
X               {
X               case EOS:
X                  s = SUCCESS;
X                  break;
X               case 'e':
X               case 'E':
X                  if (p == pe)
X                     s = EDOM;
X                  else
X                     {
X                     *p++ = 'E';
X                     s = S_BEXP;
X                     }
X                  break;
X               default:
X                  s = (synok ? SUCCESS : EDOM);
X                  break;
X               }
X         break;
X      case S_BEXP:
X         if (DT_PLUS == i)
X            s = S_FEXP;
X         else if (DT_NEG == i)
X            {
X            if (p == pe)
X               s = EDOM;
X            else
X               {
X               *p++ = '-';
X               s = S_FEXP;
X               }
X            }
X         else if (DT_ZERO <= i)
X            {
X            if (p == pe)
X               s = EDOM;
X            else
X               {
X               *p++ = '0' + i - DT_ZERO;
X               s = S_IEXP;
X               }
X            }
X         else if (synok)
X            {
X            --p;
X            s = SUCCESS;
X            }
X         else
X            s = EDOM;
X         break;
X      case S_FEXP:
X         if (DT_ZERO <= i)
X            {
X            if (p == pe)
X               s = EDOM;
X            else
X               {
X               *p++ = '0' + i - DT_ZERO;
X               s = S_IEXP;
X               }
X            }
X         else if (synok)
X            {
X            p = strrchr (buf, 'E');
X            s = SUCCESS;
X            }
X         else
X            s = EDOM;
X         break;
X      case S_IEXP:
X         if (DT_ZERO <= i)
X            {
X            if (p == pe) s = EDOM; else *p++ = '0' + i - DT_ZERO;
X            }
X         else if (DT_IGN != i)
X            {
X            s = (((EOS == c) || synok) ? SUCCESS : EDOM);
X            }
X         break;
X      default:
X         malf1 ("a2d: unknown state");
X         break;
X      }
X   if ((s < 0) && (lim != str)) ++str;
X   }
Xif (SUCCESS == s)
X   {
X   *p = EOS;
X#ifdef BADATOF
X   if (((double *) NULL) != res) *res = atof (buf);
X#else BADATOF
X   se = errno;
X   errno = SUCCESS;
X   d = atof (buf);
X   s = errno;
X/* if (ERANGE == s) FPRINTF (stderr, "a2d ERANGE: atof (%s) = %G\n", buf, d);*/
X   errno = se;
X   if ((SUCCESS == s) && (((double *) NULL) != res)) *res = d;
X#endif BADATOF
X   }
Xif (((bStrT *) NULL) != end) *end = str;
Xreturn (s);
X}
X
X#ifdef TEST
X#include <howard/usage.h>
X
XMAINVER ("@(#)$Header: a2d.c,v 1.7 89/08/09 18:13:20 howard Exp $");
XUSAGE ("");
X
XPRIVATE void t (num, str, limoff, synok, xrc, xres, xendoff)
Xint    num;     /* Test number.*/
XbStrT  str;     /* str argument.*/
Xint    limoff;  /* Limit offset, -1 for none.*/
XboolT  synok;   /* synok argument.*/
Xint    xrc;     /* Expected return code.*/
Xdouble xres;    /* Expected result.*/
Xint    xendoff; /* Expected end offset.*/
X{
Xint    rc;  /* Return code.*/
Xdouble res; /* Result stored here.*/
XbStrT  end; /* End string stored here.*/
X
Xrc = a2d (str, (limoff < 0) ? NULBSTR : str + limoff, synok, &res, &end);
Xif (rc != xrc) PRINTF ("%d: rc %d expected %d\n", num, rc, xrc);
Xif ((0 == rc) && (0 == xrc) && (res != xres))
X   PRINTF ("%d: res %f expected %f\n", num, res, xres);
Xif (xendoff < 0) xendoff = strlen (str);
Xif ((end - str) != xendoff)
X   PRINTF ("%d: end %s expected %s\n", num, end, str + xendoff);
X}
X
XPUBLIC int main (argc, argv)
Xint    argc; /* Number of arguments.*/
XbStrT *argv; /* Points to array of argument strings.*/
X{
Xif (1 != argc) usage();
X/*num      str           limoff syn  rc    res  end */
Xt(__LINE__,"12.0",            -1, 0, 0,      12.0,  -1);
Xt(__LINE__,"+12.0",           -1, 0, 0,      12.0,  -1);
Xt(__LINE__,"0.0",             -1, 0, 0,      0.0,  -1);
Xt(__LINE__,"-0.0",            -1, 0, 0,      0.0,  -1);
Xt(__LINE__,"0.456",           -1, 0, 0,      0.456,  -1);
Xt(__LINE__,"+.456",           -1, 1, 0,      0.456,  -1);
Xt(__LINE__,"456",             -1, 1, 0,      456.0,  -1);
Xt(__LINE__,"456._",           -1, 1, 0,      456.0,  4);
Xt(__LINE__," \t.456",         -1, 1, 0,      0.456,  -1);
Xt(__LINE__,"3.14159_26",      -1, 0, 0,      3.1415926,  -1);
Xt(__LINE__,"1.34E-12",        -1, 0, 0,      1.34E-12,  -1);
Xt(__LINE__,"1.34e-12",        -1, 0, 0,      1.34E-12,  -1);
Xt(__LINE__,"1.0E+6",          -1, 0, 0,      1.0E+6,  -1);
Xt(__LINE__,"1E6",             -1, 1, 0,      1.0E+6,  -1);
Xt(__LINE__,NULBSTR,            0, 0, EINVAL, 0.0,   0);
Xt(__LINE__,"0",                0, 0, EDOM,   0.0,   0);
Xt(__LINE__,"_0.0",            -1, 0, EDOM,   0.0,   0);
Xt(__LINE__,"-_0.0",           -1, 0, EDOM,   0.0,   1);
Xmfflush (stdout, S("Standard Output"));
Xexit (SUCCESS);
X
X#ifdef lint
Xreturn (SUCCESS);
X#endif
X}
X#endif
END_OF_FILE
if test 9807 -ne `wc -c <'a2d.c'`; then
    echo shar: \"'a2d.c'\" unpacked with wrong size!
fi
# end of 'a2d.c'
fi
if test -f 'a2smp.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'a2smp.c'\"
else
echo shar: Extracting \"'a2smp.c'\" \(9977 characters\)
sed "s/^X//" >'a2smp.c' <<'END_OF_FILE'
X/*
X * a2smp - convert Ada-syntax integer literal to SMP
X */
X
X#ifndef lint
Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
X#endif lint
X
X/*
X * This program is free software; you can redistribute it and/or modify
X * it under the terms of the GNU General Public License version 1,
X * as published by the Free Software Foundation.
X *
X * This program is distributed in the hope that it will be useful,
X * but WITHOUT ANY WARRANTY; without even the implied warranty of
X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X * GNU General Public License for more details.
X *
X * You should have received a copy of the GNU General Public License
X * along with this program; if not, write to the Free Software
X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X */
X
X#include <stdio.h>
X#include <howard/port.h>
X#include <howard/version.h>
X
XMODVER ("@(#)$Header: a2smp.c,v 1.11 89/08/15 13:33:10 howard Exp $");
X
X#include <ctype.h>
X#include <errno.h>
X#include <howard/malf.h>
X#include <howard/registers.i>
X#include <howard/simultipre.i>
X#include <howard/smp.h>
X
XPUBLIC int a2smp (str, lim, synok, res, end)
XR6  bStrT  str;   /* Input string.*/
XR7  bStrT  lim;   /* Don't pass this.*/
XR5  boolT  synok; /* Accept non-fatal syntax errors.*/
XR9  smpT  *res;   /* Points to where to store result.*/
XR10 bStrT *end;   /* End pointer stored here.*/
X
X/* Function:
X *    
X * Algorithm:
X *    Finite state automaton.
X * Returns:
X *    
X * Notes:
X *    
X */
X{
X/* States: */
X#define S_BEG   (-1) /* Start.*/
X#define S_BBASE (-2) /* Start of base or mantissa base.*/
X#define S_IBASE (-3) /* In base or mantissa.*/
X#define S_BMANT (-4) /* Start of mantissa.*/
X#define S_IMANT (-5) /* In mantissa.*/
X#define S_EMANT (-6) /* At end of mantissa.*/
X#define S_BEXP  (-7) /* Start of exponent.*/
X#define S_FEXP  (-8) /* Expecting first digit of exponent.*/
X#define S_IEXP  (-9) /* In exponent.*/
XR3     rcharT   c;           /* Current character.*/
XR1     int      i;           /* General purpose.*/
XR8     boolT    neg = FALSE; /* Minus sign at start.*/
XR4     unsigned rad = 10;    /* Radix.*/
X       long     l;           /* General purpose.*/
XR2     int      s;           /* State or return code.*/
X       smpT     baseSmp;     /* SMP of base or mantissa.*/
X       smpT     expSmp;      /* SMP of exponent.*/
Xstatic smpT     smp0;        /* Zero SMP, for initialization.*/
Xstatic bStrT dt[] =          /* Digit table.*/
X   {
X   S("_"),
X   S("+"),
X   S("-"),
X   S(""), /* Only integers, no radix point.*/
X   S("0"),
X   S("1"),
X   S("2"),
X   S("3"),
X   S("4"),
X   S("5"),
X   S("6"),
X   S("7"),
X   S("8"),
X   S("9"),
X   S("aA"),
X   S("bB"),
X   S("cC"),
X   S("dD"),
X   S("eE"),
X   S("fF"),
X   NULBSTR
X   };
X
XbaseSmp = smp0;
XexpSmp = smp0;
Xs = ((NULBSTR == str) ? EINVAL : S_BEG);
Xwhile (s < 0)
X   {
X   c = ((str == lim) ? EOS : B(*str));
X   i = ((EOS == c) ? -2 : smpdtl (c, dt));
X   switch (s)
X      {
X      case S_BEG:
X         if (DT_PLUS == i)
X            s = S_BBASE;
X         else if (DT_NEG == i)
X            {
X            neg = TRUE;
X            s = S_BBASE;
X            }
X         else if ((DT_ZERO <= i) && (i <= (DT_ZERO + 9)))
X            {
X            (void) smpdig (i - DT_ZERO, rad, &baseSmp);
X            s = S_IBASE;
X            }
X         else if (!synok || !isascii (c) || !isspace (c))
X            s = EDOM; /* Leading white space OK if synok set.*/
X         break;
X      case S_BBASE:
X         if ((DT_ZERO <= i) && (i <= (DT_ZERO + 9)))
X            {
X            (void) smpdig (i - DT_ZERO, rad, &baseSmp);
X            s = S_IBASE;
X            }
X         else
X            s = EDOM;
X         break;
X      case S_IBASE:
X         if ((DT_ZERO <= i) && (i <= (DT_ZERO + 9)))
X            {
X            if (!smpdig (i - DT_ZERO, rad, &baseSmp)) s = ERANGE;
X            }
X         else if (DT_IGN != i)
X            switch (c)
X               {
X               case '#':
X                  s = smp2l (&baseSmp, &l);
X                  if (SUCCESS == s)
X                     {
X                     if ((l < 2) || (l > 16)) s = EDOM;
X                     else
X                        {
X                        rad = l;
X                        baseSmp = smp0;
X                        s = S_BMANT;
X                        }
X                     }
X                  break;
X               case 'e':
X               case 'E':
X                  s = S_BEXP;
X                  break;
X               case EOS:
X                  s = SUCCESS;
X                  break;
X               default:
X                  s = (synok ? SUCCESS : EDOM);
X                  break;
X               }
X         break;
X      case S_BMANT:
X         if (i < DT_ZERO)
X            s = EDOM;
X         else
X            {
X            i -= DT_ZERO;
X            if (i >= rad)
X               s = EDOM;
X            else if (smpdig (i, rad, &baseSmp))
X               s = S_IMANT;
X            else
X               s = ERANGE;
X            }
X         break;
X      case S_IMANT:
X         if (DT_ZERO <= i)
X            {
X            i -= DT_ZERO;
X            if (i >= rad) s = EDOM;
X            else if (!smpdig (i, rad, &baseSmp)) s = ERANGE;
X            }
X         else if ('#' == c)
X            s = S_EMANT;
X         else if (DT_IGN != i)
X            s = EDOM;
X         break;
X      case S_EMANT:
X         switch (c)
X            {
X            case 'e':
X            case 'E':
X               s = S_BEXP;
X               break;
X            case EOS:
X               s = SUCCESS;
X               break;
X            default:
X               s = (synok ? SUCCESS : EDOM);
X               break;
X            }
X         break;
X      case S_BEXP:
X         if (DT_PLUS == i)
X            s = S_FEXP;
X         else if ((DT_ZERO <= i) && (i <= (DT_ZERO + 9)))
X            {
X            (void) smpdig (i - DT_ZERO, 10, &expSmp);
X            s = S_IEXP;
X            }
X         else
X            s = EDOM;
X         break;
X      case S_FEXP:
X         if ((DT_ZERO <= i) && (i <= (DT_ZERO + 9)))
X            {
X            (void) smpdig (i - DT_ZERO, 10, &expSmp);
X            s = S_IEXP;
X            }
X         else
X            s = EDOM;
X         break;
X      case S_IEXP:
X         if ((DT_ZERO <= i) && (i <= (DT_ZERO + 9)))
X            {
X            if (!smpdig (i - DT_ZERO, 10, &expSmp)) s = ERANGE;
X            }
X         else if (DT_IGN != i)
X            {
X            if ((EOS != c) && !synok)
X               s = EDOM;
X            else
X               {
X               s = smp2l (&expSmp, &l);
X               for (; (SUCCESS == s) && (0L != l); --l)
X                  if (!smpdig (0, rad, &baseSmp)) s = ERANGE;
X               }
X            }
X         break;
X      default:
X         malf1 ("a2smp: unknown state");
X         break;
X      }
X   if ((s < 0) && (lim != str)) ++str;
X   }
Xif ((SUCCESS == s) && (((smpT *) NULL) != res))
X   {
X   baseSmp.smp_neg = neg;
X   *res = baseSmp;
X   }
Xif (((bStrT *) NULL) != end) *end = str;
Xreturn (s);
X}
X
X#ifdef TEST
X#include <howard/usage.h>
X
XMAINVER ("@(#)$Header: a2smp.c,v 1.11 89/08/15 13:33:10 howard Exp $");
XUSAGE ("string");
X
X#include <limits.h>
X#include <string.h>
X
XPRIVATE void t (num, str, limoff, synok, xrc, xneg, xhi, xlo, xendoff)
Xint num; /* Test number.*/
XbStrT str; /* str argument.*/
Xint limoff; /* Limit offset, -1 for none.*/
XboolT synok; /* synok argument.*/
Xint xrc; /* Expected return code.*/
XboolT xneg; /* Expected result sign.*/
XsmpElT xhi; /* Expected high half of result.*/
XsmpElT xlo; /* Expected low half of result.*/
Xint xendoff; /* Expected end offset.*/
X{
Xint rc; /* Return code.*/
XsmpT res; /* Result stored here.*/
XbStrT end; /* End string stored here.*/
X
Xrc = a2smp (str, (limoff < 0) ? NULBSTR : str + limoff, synok, &res, &end);
Xif (rc != xrc) PRINTF ("%d: rc %d expected %d\n", num, rc, xrc);
Xif ((0 == rc) && (0 == xrc) &&
X   ((res.smp_neg != xneg) || (res.smp_el[1] != xhi) || (res.smp_el[0] != xlo)))
X   PRINTF ("%d: res %c%04X%04X expected %c%04X%04X\n", num,
X           res.smp_neg ? '-' : '+', res.smp_el[1], res.smp_el[0],
X           xneg ? '-' : '+', xhi, xlo);
Xif (xendoff < 0) xendoff = strlen (str);
Xif ((end - str) != xendoff)
X   PRINTF ("%d: end %s expected %s\n", num, end, str + xendoff);
X}
X
XPUBLIC int main ()
X{
X/*num      str           limoff syn  rc    neg      hi      lo  end */
Xt(__LINE__,"12",              -1, 0, 0,      0,      0,     12, -1);
Xt(__LINE__,"0",               -1, 0, 0,      0,      0,      0, -1);
Xt(__LINE__,"1E6",             -1, 0, 0,      0, 0x000F, 0x4240, -1);
Xt(__LINE__,"2#1111_1111#",    -1, 0, 0,      0,      0,    255, -1);
Xt(__LINE__,"16#FF#",          -1, 0, 0,      0,      0,    255, -1);
Xt(__LINE__,"016#0FF#",        -1, 0, 0,      0,      0,    255, -1);
Xt(__LINE__,"16#E#E1",         -1, 0, 0,      0,      0,    224, -1);
Xt(__LINE__,"2#1110_0000#",    -1, 0, 0,      0,      0,    224, -1);
Xt(__LINE__,NULBSTR,            0, 0, EINVAL, 0,      0,      0,  0);
Xt(__LINE__,"0",                0, 0, EDOM,   0,      0,      0,  0);
Xt(__LINE__,"012",              1, 0, 0,      0,      0,      0,  1);
Xt(__LINE__,"+_012",            4, 0, EDOM,   0,      0,      0,  1);
Xt(__LINE__,"_0123",            4, 0, EDOM,   0,      0,      0,  0);
Xt(__LINE__,"-2_147_483_648",  -1, 0, 0,      1, 0x8000, 0x0000, -1);
Xt(__LINE__," \t2_147_483_647",-1, 1, 0,      0, 0x7FFF, 0xFFFF, -1);
Xt(__LINE__," \t4_294_967_295",-1, 1, 0,      0, 0xFFFF, 0xFFFF, -1);
Xt(__LINE__,"1#1111_1111#",    -1, 0, EDOM,   0,      0,      0,  1);
Xt(__LINE__,"17#1#",           -1, 0, EDOM,   0,      0,      0,  2);
Xt(__LINE__,"99_e+_2a",        -1, 1, EDOM,   0,      0,      0,  5);
Xt(__LINE__,"12B",             -1, 1, 0,      0,      0,     12,  2);
Xt(__LINE__,"16#abcdef#e_0",   -1, 0, EDOM,   0,      0,      0, 11);
Xt(__LINE__,"16#abcdef#.",     -1, 1, 0,      0, 0x00AB, 0xCDEF, 10);
Xt(__LINE__,"2#1#E10",         -1, 0, 0,      0,      0,   1024, -1);
Xt(__LINE__,"-2#1#E10",        -1, 0, 0,      1,      0,   1024, -1);
X
Xmfflush (stdout, "Standard Output");
Xexit (SUCCESS);
X
X#ifdef lint
Xreturn (SUCCESS);
X#endif
X}
X#endif
END_OF_FILE
if test 9977 -ne `wc -c <'a2smp.c'`; then
    echo shar: \"'a2smp.c'\" unpacked with wrong size!
fi
# end of 'a2smp.c'
fi
if test -f 'new-b.b' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'new-b.b'\"
else
echo shar: Extracting \"'new-b.b'\" \(1456 characters\)
sed "s/^X//" >'new-b.b' <<'END_OF_FILE'
X  
X# new-b.b - create a new Bourne shell source file from a prototype
X#
X# $Header: new-b.b,v 1.2 89/09/23 13:49:12 howard Exp $
X#
X# Copyright 1989 Howard Lee Gayle
X# This file is written in the ISO 8859/1 character set.
X#
X# This program is free software; you can redistribute it and/or modify
X# it under the terms of the GNU General Public License version 1,
X# as published by the Free Software Foundation.
X#
X# This program is distributed in the hope that it will be useful,
X# but WITHOUT ANY WARRANTY; without even the implied warranty of
X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X# GNU General Public License for more details.
X#
X# You should have received a copy of the GNU General Public License
X# along with this program; if not, write to the Free Software
X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X#
X# Shell variables:
X# c - '#'
X# d - '$'
X# f - steps through files to create
X# p - file name prefix
X# u - usage string
X
XCMDNAME=new-b
Xexport CMDNAME
Xu="Usage: $CMDNAME file..."
Xif [ $# -eq 0 ]
Xthen
X   echo "$u" 1>&2
X   exit 1
Xfi
Xc='#'
Xd='$'
Xfor f
Xdo
X   p=`basename "$f" .b`
X   cat << EOF > "$f"
X$c $f - 
X$c
X$c ${d}Header$d
X$c
XEOF
X   if [ "$NEWTEXTPATH" ]
X   then
X      cat-path "$NEWTEXTPATH" new.txt | sed -e "s;^;$c ;" >> "$f"
X   fi
X   cat << EOF >> "$f"
X$c Shell variables:
X$c u - usage string
X
XCMDNAME=$p
Xexport CMDNAME
Xu="Usage: ${d}CMDNAME"
Xif [ $d$c -ne . ]
Xthen
X   echo "${d}u" 1>&2
X   exit 1
Xfi
XEOF
Xdone
END_OF_FILE
if test 1456 -ne `wc -c <'new-b.b'`; then
    echo shar: \"'new-b.b'\" unpacked with wrong size!
fi
# end of 'new-b.b'
fi
echo shar: End of archive 2 \(of 9\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 9 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0