From 13c27199231cbc2cc83969ada741b95be1cca4d3 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Wed, 10 Nov 2004 19:04:29 +0000 Subject: Import Trio 1.10 into fetchmail's trunk. svn path=/trunk/; revision=3995 --- trio/CHANGES | 626 +++ trio/FILES | 33 + trio/Makefile | 61 + trio/Makefile.in | 60 + trio/README | 38 + trio/autogen.sh | 3 + trio/compare.c | 53 + trio/config.cache | 22 + trio/config.log | 52 + trio/config.status | 160 + trio/configure | 1213 +++++ trio/configure.in | 45 + trio/doc/doc.h | 161 + trio/doc/doc_dynamic.h | 31 + trio/doc/doc_printf.h | 532 +++ trio/doc/doc_register.h | 357 ++ trio/doc/doc_scanf.h | 120 + trio/doc/doc_static.h | 61 + trio/doc/footer.html | 4 + trio/doc/header.html | 8 + trio/doc/trio.cfg | 873 ++++ trio/doc/trio.css | 35 + trio/example.c | 594 +++ trio/html/group___dynamic_strings.html | 362 ++ trio/html/group___printf.html | 1259 ++++++ trio/html/group___scanf.html | 145 + trio/html/group___special_quantities.html | 390 ++ trio/html/group___static_strings.html | 1809 ++++++++ trio/html/group___user_defined.html | 379 ++ trio/html/index.html | 88 + trio/html/modules.html | 23 + trio/html/trio.css | 35 + trio/install-sh | 250 ++ trio/libtrio.a | Bin 0 -> 169062 bytes trio/maketgz | 46 + trio/regression | Bin 0 -> 166737 bytes trio/regression.c | 1206 +++++ trio/strio.h | 73 + trio/trio.c | 6855 +++++++++++++++++++++++++++++ trio/trio.h | 216 + trio/triodef.h | 220 + trio/trionan.c | 901 ++++ trio/trionan.h | 81 + trio/triop.h | 150 + trio/triostr.c | 2102 +++++++++ trio/triostr.h | 140 + 46 files changed, 21872 insertions(+) create mode 100644 trio/CHANGES create mode 100644 trio/FILES create mode 100644 trio/Makefile create mode 100644 trio/Makefile.in create mode 100644 trio/README create mode 100644 trio/autogen.sh create mode 100644 trio/compare.c create mode 100644 trio/config.cache create mode 100644 trio/config.log create mode 100755 trio/config.status create mode 100755 trio/configure create mode 100644 trio/configure.in create mode 100644 trio/doc/doc.h create mode 100644 trio/doc/doc_dynamic.h create mode 100644 trio/doc/doc_printf.h create mode 100644 trio/doc/doc_register.h create mode 100644 trio/doc/doc_scanf.h create mode 100644 trio/doc/doc_static.h create mode 100644 trio/doc/footer.html create mode 100644 trio/doc/header.html create mode 100644 trio/doc/trio.cfg create mode 100644 trio/doc/trio.css create mode 100644 trio/example.c create mode 100644 trio/html/group___dynamic_strings.html create mode 100644 trio/html/group___printf.html create mode 100644 trio/html/group___scanf.html create mode 100644 trio/html/group___special_quantities.html create mode 100644 trio/html/group___static_strings.html create mode 100644 trio/html/group___user_defined.html create mode 100644 trio/html/index.html create mode 100644 trio/html/modules.html create mode 100644 trio/html/trio.css create mode 100755 trio/install-sh create mode 100644 trio/libtrio.a create mode 100755 trio/maketgz create mode 100755 trio/regression create mode 100644 trio/regression.c create mode 100644 trio/strio.h create mode 100644 trio/trio.c create mode 100644 trio/trio.h create mode 100644 trio/triodef.h create mode 100644 trio/trionan.c create mode 100644 trio/trionan.h create mode 100644 trio/triop.h create mode 100644 trio/triostr.c create mode 100644 trio/triostr.h diff --git a/trio/CHANGES b/trio/CHANGES new file mode 100644 index 00000000..4fe3aa80 --- /dev/null +++ b/trio/CHANGES @@ -0,0 +1,626 @@ +CHANGES -- trio + + +The changes listed without a name attributed to them were most likely done by +Bjorn Reese and/or Daniel Stenberg. + +Version 1.10 - 2003/03/06 +------------------------- +* Rearranged some include files to accommodate large file support (reported by + Albert Chin-A-Young) + +* Added support for SunOS 4.1.x lack of strerror, tolower, and toupper + (reported by Peter McCluskey). + +* Fixed pedantic compilation with TRIO_MINIMAL. + +* Jose Kahan + Moved to avoid redefinition problems. + +* Fixed hex-float exponents (reported by Matthias Clasen). + +* Fixed handling of negative width and precision via paramters (reported by + Jacob Navia). + +* Nigel Hall + Fixed TRIO_VA_START for VMS. + +* Rune Enggaard Lausen + Fixed compilation for Borland C++ Builder. + +* Fixed precision of hex-float numbers (reported by James Antill). + +* Fixed plus sign only to be added for signed numbers. + +* Fixed printing of integers with value and precision of zero (reported by + James Antill). + +* Fixed %#.o to only print one zero if the value is zero (reported by James + Antill). + +* Rewrote check for IEEE compilation option to remove dependency on additional + scripts. + +* Mehdi Lavasani + Makefile install target fixed to work with older install programs. + +* Collapsed the DECC, MSVC, HP-UX, and AIX code for trio_fpclassify_and_sign() + with further preprocessing. + + +Version 1.9 - 2002/10/13 +------------------------ +* Fixed trio_fpclassify_and_signbit on AIX 3.2 + +* Added configure check for -ieee/-mieee compilation option for Alpha machines. + +* Craig Berry + Fixed compilation on VMS. + +* Albert Chin-A-Young + Fixed incorrect conditional expression in trio_isinf. + +* Fixed the warnings about uninitialized va_list in the printfv and scanfv + family without the use of compiler specific pragmas (suggested by Ian + Pilcher). + +* Fixed space flag for floating-point numbers (reported by Ian Main). + + +Version 1.8 - 2002/07/10 +------------------------ +* Fixed infinite loop in multibyte handling (reported by Gisli Ottarsson). + +* Added the customizable cprintf/cscanf family which enables to user to specify + input and output stream functions (suggested by Florian Schulze). + +* Fixed trio_isinf by removing the HP-UX workaround, and instead making sure + that the C99 macro will adhere to the trio return values (reported by Luke + Dunstan). + +* Alexander Lukyanov + Fixed boundary case for scanning and EOF. + +* Jacob Navia + Enabled the L modifier for formatting. + +* Added TRIO_MINIMAL to build trio without the string functions. + +* Added the R modifier to print rounded floating-point numbers. + +* Added trio_to_long_double and long double scanning (the L modifier). + +* Added trio_locale_decimal_point, trio_locale_thousand_separator, + trio_locale_grouping to overwrite locale settings. + +* Rewrote TrioWriteDouble to avoid temporary buffers and thus the danger of + buffer overflows (for instance %.5000f). + +* Improved floating-point formatting accuracy. + +* Fixed formatting of non-decimal exponents. + +* Fixed thousand separator checking. + +* Fixed %f scanning to get a float and %lf to get a double. + +* Fixed WIN32 compilation (reported by Emmanuel Mogenet) + +* Fixed regression test cases to exclude disabled features. + + +Version 1.7 - 2002/05/07 +------------------------ +* Fixed trio_to_double to handle hex-floats properly. + +* Fixed printing of %a-format to be like %e, not like %g. + +* Fixed floating-point printing of values beyond the machine accuracy. + +* Fixed %f for printing with large precision. + +* Fixed the usage of C99 nan(), which caused a crash on OSF/1 (reported by + Georg Bolz) + +* Joe Orton + Fixed %p on 64-bit platforms. + +* Made trio compile with K&R compilers. + +* Emmanuel Mogenet + Fixed bug in trio_asprintf. + +* Emmanuel Mogenet + Various WIN32 fixes. + +* Joe Orton + Fixed trio_isinf() on HP-UX, and added test cases. + +* Joe Orton + Fixed non-portable use of $^ in Makefile. + +* Joe Orton + Added autoconf. + +* Alexander Lukyanov + Fixed a number of bugs in the scanning of EOF and the count specifier. + +* Richard Jinks + Added trio_nzero + +* Fixed incorrect handling of return code from TrioReadChar (reported by + Henrik Löf) + +* Fixed parsing of character class expressions. + +* Fixed trio_to_double which did not work with long fractions. + +* Fixed %f for printing of large numbers. + +* Fixed %#s to handle whitespaces as non-printable characters. + +* Added trio_isfinite, trio_signbit, and trio_fpclassify. + +* Added new test cases. + + +Version 1.6 - 2002/01/13 +------------------------ +* Added dynamic string functions. + +* Rewrote and extended documentation in JavaDoc (using Doxygen). + +* Moved and renamed strio functions to triostr. + +* Robert Collins + Added definition for Cygwin. + +* Markus Henke + Added long double workaround for the HP C/iX compiler. + +* Marc Verwerft + Improved error handling for dynamically allocated strings. + +* John Fotheringham + Made trionan compile on OpenVMS. + +* Added 'd' and 'D' as exponent letters when using TRIO_MICROSOFT. + +* Fixed uninitial memory read for the parameter modifiers. + + +Version 1.5 - 2001/09/08 +------------------------ +* Merged with libxml changes. + +* Moved NaN and Inf handling to separate file to enable reuse in other + projects. + +* Igor Zlatkovic + Fixed TrioGenerateNan for MSVC. + +* Fixed lots of preprocessor macros and internal data structure names. + + +Version 1.4 - 2001/06/03 +------------------------ +* Added hex-float (%a and %A) for scanning. + +* Added wide character arguments (%ls, %ws, %S, %lc, %wc, and %C) for both + printf and scanf. + +* Added mutex callbacks for user-specified specifiers to enable applications to + add thread-safety. These are registered with trio_register, where the + namespace is set to either ":enter" to lock a mutex, or ":leave" to unlock a + mutex. + +* Added equivalence class expressions for scanning. For example, %[[=a=]] scans + for all letters in the same equivalence class as the letter 'a' as defined + by the locale. + +* Changed character class expressions for scanning. The expressions must now + be embedded withing an extra set of brackets, e.g. %[[:alpha:]]. This was + done to adhere to the syntax of UNIX98 regular expressions. + +* Added the possibility to specify standard support (TRIO_C99 etc.) as compiler + options. + +* Fixed conversion of hex-float in StrToDouble. + +* Fixed formatting of hex-float numbers. + +* Stan Boehm + Fixed crash on QNX, which happend because some buffers on the stack were too + big. + +* Fixed default precision for %f and %g (reported by Jose Ortiz) + +* Howard Kapustein + Added the I8, I16, I32, and I64 modifiers. + +* Jose Ortiz + Fixed rounding problem for %e. + +* Jose Ortiz + Fixed various problems with the xlC and Sun C++ compilers. + + +Version 1.3 - 2001/05/16 +------------------------ +* trio's treatment of the field width when the %e code was used was not + correct (reported by Gisli Ottarsson). It turns out the fraction part should + be zero-padded by default and the exponent part should be zero-prefixed if + it is only one digit. At least that's how the GNU and Sun libc's work. The + trio floating point output looks identical to them now. + +* Fixed group scanning with modifiers. + +* Fixed compilation for 64-bit Digital Unix. + +* Igor Zlatkovic + Fixed compilation of dprintf, which uses read/write, for MSVC. + +* Fixed various compilation problems on Digital Unix (mainly associated with + va_list). + + +Version 1.2 - 2001/04/11 +------------------------ +* Added autoconf integration. If compiled with HAVE_CONFIG_H the following + happens. Firstly, is included. Secondly, trio will only be + compiled if WITH_TRIO is defined herein. Thirdly, if TRIO_REPLACE_STDIO is + defined, only stdio functions that have not been detected by autoconf, i.e. + those not defined by HAVE_PRINTF or similar, will be replaced by trio + functions (suggested by Daniel Veillard). + +* Fixed '%m.nf' output. Previously trio did not treat the width properly + in all cases (reported by Gisli Ottarsson). + +* Added explicit promotion for the scanfv family. + +* Fixed more C++ compilation warnings. + + +Version 1.1 - 2001/02/25 +------------------------ +* Added explicit promotion for the printfv familiy. A float must be specified + by %hf. + +* Fixed positionals for printfv (reported by Gisli Ottarsson). + +* Fixed an integer to pointer conversion problem on the SGI MIPS C compiler + (reported by Gisli Ottarsson). + +* Fixed ANSI C++ warnings (type casting, and namespace is a reserved keyword). + +* Added \n to all examples in the documentation to prevent confusion. + +* Fixed StrSubstringMax + + +Version 1.0 - 2000/12/10 +------------------------ +* Bumped Version number. + + +Version 0.25 - 2000/12/09 +------------------------- +* Wrote more documentation. + +* Improved NaN support and added NaN to regression test. + +* Fixed C99 support. + +* Added missing getter/setter functions. + + +Version 0.24 - 2000/12/02 +------------------------- +* Added callback functionality for the user-defined specifier (<>). All + the necessary functions are defined in triop.h header file. See the + documentation for trio_register for further detail. + +* Wrote initial documentation on the callback functionality. + +* Added the printfv and scanfv family of functions, which takes a pointer + array rather than variadic arguments. Each pointer in the array must point + to the associated data (requested by Bruce Korb). + +* As indicated in version 0.21 the extension modifiers (<>) have now been + completely removed. + +* Added skipping of thousand-separators in floating-point number scanning. + + +Version 0.23 - 2000/10/21 +------------------------- +* Added width to scanning of floating-point numbers. + +* Wrote more documentation on trio_printf. + +* Fixed problem with trailing zeroes after decimal-point. + + +Version 0.22 - 2000/08/06 +------------------------- +* Added LC_CTYPE locale dependent character class expressions to scan lists. + Included are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], + [:lower:], [:print:], [:punct:], [:space:], [:upper:], [:xdigit:] + +* Added C escapes to alternative string formatting and scanning. + +* Added StrSubstringMax. + +* Wrote a little more documentation. + +* Fixed scanf return values. + +* Fixed a sign error for non-ascii characters. + + +Version 0.21 - 2000/07/19 +------------------------- +* Converted the documentation to TeX. With latex2man the documentation can + automatically be converted into man pages. + +* Added trio_scanf, trio_vscanf, trio_fscanf, and trio_vfscanf. + +* Added trio_dprintf, trio_vdprintf, trio_dscanf, and trio_vdscanf. These + functions can be used to write and read directly to pipes and sockets (the + assume blocking sockets). Stdio buffering is surpassed, so the functions are + async-safe. However, reading from stdin (STDIN_FILENO) or writing to stdout + (STDOUT_FILENO) reintroduces the buffering. + +* Added trio_dprintf and trio_vdprintf. These can be used to write directly + to pipes and sockets. + +* Paul Janzen + Added trio_asprintf and trio_vasprintf, which are compatible with the GNU + and BSD interfaces. + +* Added scanlist ranges for group scanning (%[]). + +* Added width for scanning (missing for floating-point numbers though). + +* Added variable size modifier (&) to handle system defined types of unknown + size. This modifier makes certain assumptions about the integer sizes, which + may not be valid on any machine. Consequently, the modifier will remain + undocumented, as it may be removed later. + +* Added \777 and \xFF to alternative string scanning (%#s) + +* Added the TRIO_REPLACE_STDIO check in the header. + +* Improved performance of the multibyte character parsing. + +* Fixed positionals (%n$) which had stopped working. + +* Fixed hh and ll modifiers to allow exactly two letters and no more. + +* Fixed ANSI C++ warnings. Also fixed the compiler warning about casting + between integer and pointer (this has been annoying me for ages). + +* Fixed snprintf and vsnprintf with zero buffer size. + +* Fixed NAN problems (reported by Keith Briggs). + +* Fixed parsing of multibyte characters. The format string was not correctly + advanced in case of a multibyte character. + +* Renamed many of the internal functions to have more consistant names. + +* Removed the and modifiers. They are not really worth + including. The other <> modifiers may disappear as well. + + +Version 0.20 - 2000/06/05 +------------------------- +* Added intmax_t and ptrdiff_t support. + +* Added support for LC_NUMERIC grouping. + +* Added double-dot notation for the conversion base. The style is now + %width.precision.base, where any argument can be a number, an asterix + indicating a parameter, or be omitted entirely. For example, %*..2i is + to specify binary numbers without precision, and with width as a parameter + on the va_list. + +* Added sticky modifier (!), which makes subsequent specifiers of the same + type reuse the current modifiers. Inspired by a suggestion from Gary Porter. + +* Added group scanning (%[]). Scanlist ranges and multibyte sequences are not + supported yet. + +* Added count scanning (%n). + +* Changed the number scanning to accept thousand separators and any base. + +* Fixed positional for parameters. It is possible to write something like + %3$*1$.*2$d (which happens to be the same as %*.*d). + +* Fixed precision of integers. + +* Fixed parameter flags. Before trio could only handle one parameter flag per + specifier, although two (three with double-dot base) were possible. + +* Fixed isinf() for those platforms where it is unimplemented. + + +Version 0.18 - 2000/05/27 +------------------------- +* Rewrote the entire floating-point formatting function (Danny Dulai had + reported several errors and even supplied some patches, which unfortunately + were lost due to the refactoring). + +* Removed the use of strlen() in the declaration of a stack array. This + caused problems on some compilers (besides it isn't really ANSI C compliant + anyways). Using some arbitrarily chosen maximum value; should examine if + some standard defines an upper limit on the length of decimal-point and + thousands-separator (sizeof(wchar_t) perhaps?) + +* Changed the parsing of the format string to be multibyte aware. + + +Version 0.17 - 2000/05/19 +------------------------- +* Added INF, -INF, and NAN for floating-point numbers. + +* Fixed %#.9g -- alternative with precision. + +* Ken Gibson + Fixed printing of negative hex numbers + +* Joerg (last name unknown) + Fixed convertion of non-ASCII characters + + +Version 0.16 - 1999/08/06 +------------------------- +* Changed the constness of the second argument of StrFloat and StrDouble. The + lack of parameter overloading in C is the reason for the strange use of + constness in strtof and strtod. + +* Cleaned up constness. + + +Version 0.15 - 1999/07/23 +------------------------- +* Fixed the internal representation of numbers from signed to unsigned. Signed + numbers posed a problem for large unsigned numbers (reported by Tero) + +* Fixed a tiny bug in trio_vsprintfcat + +* Changed the meaning of the max argument of StrAppendMax to be consistant + with StrFormatAppendMax. Now it is the maximal size of the entire target + buffer, not just the appended size. This makes it easier to avoid buffer + overflows (requested by Tero) + + +Version 0.14 - 1999/05/16 +------------------------- +* Added size_t support (just waiting for a C99 compliant compiler to add + ptrdiff_t and intmax_t) + +* Rewrote TrioOutStreamDouble so it does not use the libc sprintf to emulate + floating-point anylonger. + +* Fixed width, precision, and adjustment for numbers and doubles. + + +Version 0.13 - 1999/05/06 +------------------------- +* Fixed zero padding for %d. Now %d will only zero pad if explicitly requested + to do so with the 0 flag (reported by Tero). + +* Fixed an incorrect while() condition in TrioGetString (reported by Tero). + + +Version 0.12 - 1999/04/19 +------------------------- +* Fixed incorrect zero padding of pointers + +* Added StrHash with STRIO_HASH_PLAIN + +* Added StrFormatDateMax + + +Version 0.11 - 1999/03/25 +------------------------- +* Made it compile under cygwin + +* Fixed a bug were TrioPreprocess would return an error if no formatting chars + were found (reported by Tero). + + +Version - 1999/03/19 +-------------------- +* Added trio_strerror and TRIO_ERROR_NAME. + +* Changed the error codes to be positive (as errno) + +* Fixed two reads of uninitialized memory reported by Purify + +* Added binary specifiers 'b' and 'B' (like SCO.) ThousandSeparator can be + used to separate nibbles (4 bit) + +* Renamed all Internal* functions to Trio*, which seems like a better + namespace (even though it is of no practical interest because these + functions are not visible beyond the scope of this file.) + + +Version - 1999/03/12 +-------------------- +* Added hex-float format for StrToDouble + +* Double references and gaps in the arguments are not allowed (for the %n$ + format) and in both cases an error code is returned. + +* Added StrToDouble (and StrToFloat) + + +Version - 1999/03/08 +-------------------- +* Added InStream and OutStream to the trio_T structure. + +* Started work on TrioScan. + +* Return values for errors changed. Two macros to unpack the error code has + been added to the header. + +* Shortshort (hh) flag added. + +* %#s also quotes the quote-char now. + +* Removed the 'errorInFormat' boolean, which isn't used anymore after the + functions bail out with an error instead. + + +Version - 1999/03/04 +-------------------- +* More than MAX_PARAMETERS parametes will now cause the TrioPreprocess() + function to return error. + +* Unknown flags and/or specifiers cause errors too. + +* Added trio_snprintfcat and trio_vsnprintfcat and the defined name + StrFormatAppendMax. They append a formatted string to the end of a string. + +* Define MAX_PARAMETERS to 128 at all times instead of using NL_ARGMAX when + that exists. + +* Added platform fixes for Amiga as suggested by Tero Jänkä + + +Version - 1999/01/31 +-------------------- +* vaprintf did add a zero byte even when it had failed. + +* Cleaned up the code for locale handling and thousand separator + +* Added trio_aprintf() and trio_vaprintf(). They return an allocated string. + +* Added thousands separator for numbers + +* Added floating point support for *printf + + +Version - 1998/10/20 +-------------------- +* StrMatchCase() called StrMatch() instead of itself recursively + +* Rewrote the implementation of *printf and *scanf and put all the code in + this file. Extended qualifiers and qualifiers from other standards were + added. + +* Added StrSpanFunction, StrToLong, and StrToUnsignedLong + + +Version - 1998/05/23 +-------------------- +* Made the StrEqual* functions resistant to NULL pointers + +* Turns out strdup() is no standard at all, and some platforms (I seem to + recall HP-UX) has problems with it. Made our own StrDuplicate() instead. + +* Added StrFormat() and StrFormatMax() to serve as sprintf() and snprintf() + respectively. diff --git a/trio/FILES b/trio/FILES new file mode 100644 index 00000000..22a5ea12 --- /dev/null +++ b/trio/FILES @@ -0,0 +1,33 @@ +FILES +README +CHANGES +Makefile.in +maketgz +strio.h +trio.c +trio.h +triodef.h +trionan.c +trionan.h +triop.h +triostr.c +triostr.h +compare.c +example.c +regression.c +configure +configure.in +install-sh +autogen.sh +doc/doc.h +doc/doc_dynamic.h +doc/doc_printf.h +doc/doc_register.h +doc/doc_scanf.h +doc/doc_static.h +doc/footer.html +doc/header.html +doc/trio.cfg +doc/trio.css +html/trio.css +html/*.html diff --git a/trio/Makefile b/trio/Makefile new file mode 100644 index 00000000..84e78fd0 --- /dev/null +++ b/trio/Makefile @@ -0,0 +1,61 @@ +# Generated automatically from Makefile.in by configure. +CC = gcc +CFLAGS = -g -O2 -DDEBUG +OBJS = triostr.o trio.o trionan.o +TARGETLIB = libtrio.a +TARGETINCS = trio.h triop.h triodef.h trionan.h triostr.h +LDFLAGS = -L. -ltrio -lm +AR = ar +RANLIB = ranlib +ERASE = rm -f +MKDIR = mkdir -p +GENDOC = doxygen + +PURIFY = purify +PURIFYOPTIONS = -chain-length=16 -first-only=YES + +# Installation settings +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +prefix = /usr/local +exec_prefix = ${prefix} +includedir = ${prefix}/include +libdir = ${exec_prefix}/lib + +all: $(TARGETLIB) $(TARGET) regression + +test: + ./regression + +install: $(TARGETLIB) + $(MKDIR) $(libdir) + $(MKDIR) $(includedir) + $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB) + for i in $(TARGET_INCS);do \ + (set -x;$(INSTALL_DATA) $$i $(includedir)); \ + done + +pure: $(TOBJS) $(OBJS) + $(PURIFY) $(PURIFYOPTIONS) $(CC) $(CFLAGS) $^ $(LDFLAGS) + +regression: regression.o $(TARGETLIB) + $(CC) $(CFLAGS) regression.o $(LDFLAGS) -o $@ + +example: example.o $(TARGETLIB) + $(CC) $(CFLAGS) example.o $(LDFLAGS) -o $@ + +compare: compare.o $(TARGETLIB) + $(CC) $(CFLAGS) compare.o $(LDFLAGS) -o $@ + +userdef: userdef.o $(TARGETLIB) + $(CC) $(CFLAGS) userdef.o $(LDFLAGS) -o $@ + +$(TARGETLIB): $(OBJS) + $(AR) ruv $(TARGETLIB) $(OBJS) + $(RANLIB) $(TARGETLIB) + +doc:: + $(GENDOC) doc/trio.cfg + +clean: + $(ERASE) *~ core regression example $(TOBJS) $(OBJS) $(TARGET) $(TARGETLIB) example.o regression.o diff --git a/trio/Makefile.in b/trio/Makefile.in new file mode 100644 index 00000000..7be4bcb1 --- /dev/null +++ b/trio/Makefile.in @@ -0,0 +1,60 @@ +CC = @CC@ +CFLAGS = @CFLAGS@ -DDEBUG +OBJS = triostr.o trio.o trionan.o +TARGETLIB = libtrio.a +TARGETINCS = trio.h triop.h triodef.h trionan.h triostr.h +LDFLAGS = -L. -ltrio -lm +AR = ar +RANLIB = @RANLIB@ +ERASE = rm -f +MKDIR = mkdir -p +GENDOC = doxygen + +PURIFY = purify +PURIFYOPTIONS = -chain-length=16 -first-only=YES + +# Installation settings +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +includedir = @includedir@ +libdir = @libdir@ + +all: $(TARGETLIB) $(TARGET) regression + +test: + ./regression + +install: $(TARGETLIB) + $(MKDIR) $(libdir) + $(MKDIR) $(includedir) + $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB) + for i in $(TARGET_INCS);do \ + (set -x;$(INSTALL_DATA) $$i $(includedir)); \ + done + +pure: $(TOBJS) $(OBJS) + $(PURIFY) $(PURIFYOPTIONS) $(CC) $(CFLAGS) $^ $(LDFLAGS) + +regression: regression.o $(TARGETLIB) + $(CC) $(CFLAGS) regression.o $(LDFLAGS) -o $@ + +example: example.o $(TARGETLIB) + $(CC) $(CFLAGS) example.o $(LDFLAGS) -o $@ + +compare: compare.o $(TARGETLIB) + $(CC) $(CFLAGS) compare.o $(LDFLAGS) -o $@ + +userdef: userdef.o $(TARGETLIB) + $(CC) $(CFLAGS) userdef.o $(LDFLAGS) -o $@ + +$(TARGETLIB): $(OBJS) + $(AR) ruv $(TARGETLIB) $(OBJS) + $(RANLIB) $(TARGETLIB) + +doc:: + $(GENDOC) doc/trio.cfg + +clean: + $(ERASE) *~ core regression example $(TOBJS) $(OBJS) $(TARGET) $(TARGETLIB) example.o regression.o diff --git a/trio/README b/trio/README new file mode 100644 index 00000000..55ad1b07 --- /dev/null +++ b/trio/README @@ -0,0 +1,38 @@ +README -- trio + +Trio is a package with portable string functions. Including printf() clones +and others. + + Copyright (C) 1998-2001 by Bjorn Reese and Daniel Stenberg. + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. + +Trio is intended to be an integral part of another application, so we +have not done anything to create a proper installation. + +Compile with 'make' (edit the Makefile if you want a release build) + +Test the package with 'make test' + +Install by copying trio.h, triop.h, and libtrio.a (and man/man?/* if +you want documentation) to the appropriate directories. + +Catch some usage examples in example.c + +Send feedback and patches to the mailing list, subscription and other +information is found here: + + http://lists.sourceforge.net/lists/listinfo/ctrio-talk + +Enjoy! + +Trio web page + + http://daniel.haxx.se/trio/ diff --git a/trio/autogen.sh b/trio/autogen.sh new file mode 100644 index 00000000..9299034e --- /dev/null +++ b/trio/autogen.sh @@ -0,0 +1,3 @@ +#!/bin/sh +autoconf +rm -rf autom4te.cache diff --git a/trio/compare.c b/trio/compare.c new file mode 100644 index 00000000..3823aa2d --- /dev/null +++ b/trio/compare.c @@ -0,0 +1,53 @@ +#include "trio.h" + +#define compare(format, value) printf("FORMAT: %s\n", format); printf("TRIO: "); trio_printf(format,value); printf("\nLIBC: "); \ +printf(format,value); printf("\n\n"); + +int main() +{ + compare("\"%e\"",2.342E+02); + compare("\"%10.4e\"",-2.342E-02); + compare("\"%11.4e\"",-2.342E-02); + compare("\"%12.4e\"",-2.342E-02); + compare("\"%13.4e\"",-2.342E-02); + compare("\"%14.4e\"",-2.342E-02); + compare("\"%15.4e\"",-2.342E-02); + compare("\"%16.4e\"",-2.342E-02); + compare("\"%16.4e\"",-2.342E-22); + compare("\"%G\"",-2.342E-02); + compare("\"%G\"",3.1415e-6); + compare("%016e", 3141.5); + compare("%16e", 3141.5); + compare("%-16e", 3141.5); + compare("%010.3e", 3141.5); + + compare("*%5f*", 3.3); + compare("*%5f*", 3.0); + compare("*%5f*", .999999E-4); + compare("*%5f*", .99E-3); + compare("*%5f*", 3333.0); + + compare("*%5g*", 3.3); + compare("*%5g*", 3.0); + compare("*%5g*", .999999E-4); + compare("*%5g*", .99E-3); + compare("*%5g*", 3333.0); + compare("*%5g*", 0.01); + + compare("*%5.g*", 3.3); + compare("*%5.g*", 3.0); + compare("*%5.g*", .999999E-4); + compare("*%5.g*", 1.0E-4); + compare("*%5.g*", .99E-3); + compare("*%5.g*", 3333.0); + compare("*%5.g*", 0.01); + + compare("*%5.2g*", 3.3); + compare("*%5.2g*", 3.0); + compare("*%5.2g*", .999999E-4); + compare("*%5.2g*", .99E-3); + compare("*%5.2g*", 3333.0); + compare("*%5.2g*", 0.01); + + return 0; +} diff --git a/trio/config.cache b/trio/config.cache new file mode 100644 index 00000000..a12b1195 --- /dev/null +++ b/trio/config.cache @@ -0,0 +1,22 @@ +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +ac_cv_ieee_option=${ac_cv_ieee_option=none} +ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'} +ac_cv_prog_CC=${ac_cv_prog_CC=gcc} +ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib} +ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no} +ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes} +ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes} +ac_cv_prog_gcc=${ac_cv_prog_gcc=yes} diff --git a/trio/config.log b/trio/config.log new file mode 100644 index 00000000..5cb4bfeb --- /dev/null +++ b/trio/config.log @@ -0,0 +1,52 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +configure:529: checking for gcc +configure:642: checking whether the C compiler (gcc ) works +configure:658: gcc -o conftest conftest.c 1>&5 +configure:684: checking whether the C compiler (gcc ) is a cross-compiler +configure:689: checking whether we are using GNU C +configure:698: gcc -E conftest.c +configure:717: checking whether gcc accepts -g +configure:788: checking for a BSD compatible install +configure:843: checking for ranlib +configure:873: checking for IEEE compilation options +configure:890: gcc -c -g -O2 conftest.c 1>&5 +configure:884:3: #error "Option needed" +configure: failed program was: +#line 879 "configure" +#include "confdefs.h" + +int main() { + +#if !(defined(__alpha) && (defined(__DECC) || defined(__DECCXX) || (defined(__osf__) && defined(__LANGUAGE_C__))) && (defined(VMS) || defined(__VMS))) +# error "Option needed" +#endif + +; return 0; } +configure:909: gcc -c -g -O2 conftest.c 1>&5 +configure:903:3: #error "Option needed" +configure: failed program was: +#line 898 "configure" +#include "confdefs.h" + +int main() { + +#if !(defined(__alpha) && (defined(__DECC) || defined(__DECCXX) || (defined(__osf__) && defined(__LANGUAGE_C__))) && !(defined(VMS) || defined(__VMS)) && !defined(_CFE)) +# error "Option needed" +#endif + +; return 0; } +configure:928: gcc -c -g -O2 conftest.c 1>&5 +configure:922:3: #error "Option needed" +configure: failed program was: +#line 917 "configure" +#include "confdefs.h" + +int main() { + +#if !(defined(__alpha) && (defined(__GNUC__) && (defined(__osf__) || defined(__linux__)))) +# error "Option needed" +#endif + +; return 0; } diff --git a/trio/config.status b/trio/config.status new file mode 100755 index 00000000..4dc54459 --- /dev/null +++ b/trio/config.status @@ -0,0 +1,160 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host merlin: +# +# ./configure +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" +for ac_option +do + case "$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "./config.status generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "$ac_cs_usage"; exit 0 ;; + *) echo "$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=. +ac_given_INSTALL="/usr/bin/install -c" + +trap 'rm -fr Makefile conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +/^[ ]*VPATH[ ]*=[^:]*$/d + +s%@SHELL@%/bin/sh%g +s%@CFLAGS@%-g -O2%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%%g +s%@FFLAGS@%%g +s%@DEFS@% %g +s%@LDFLAGS@%%g +s%@LIBS@%%g +s%@exec_prefix@%${prefix}%g +s%@prefix@%/usr/local%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@CC@%gcc%g +s%@INSTALL_PROGRAM@%${INSTALL}%g +s%@INSTALL_SCRIPT@%${INSTALL_PROGRAM}%g +s%@INSTALL_DATA@%${INSTALL} -m 644%g +s%@RANLIB@%ranlib%g + +CEOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi + +CONFIG_FILES=${CONFIG_FILES-"Makefile"} +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + + + +exit 0 diff --git a/trio/configure b/trio/configure new file mode 100755 index 00000000..35ab3503 --- /dev/null +++ b/trio/configure @@ -0,0 +1,1213 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=triodef.h + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:529: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:559: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:610: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 653 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:689: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:717: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:788: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:843: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +echo $ac_n "checking for IEEE compilation options""... $ac_c" 1>&6 +echo "configure:873: checking for IEEE compilation options" >&5 +if eval "test \"`echo '$''{'ac_cv_ieee_option'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_ieee_option="/IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_ieee_option="-ieee" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_ieee_option="-mieee" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_ieee_option="none" + +fi +rm -f conftest* + +fi +rm -f conftest* + +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_ieee_option" 1>&6 +if test $ac_cv_ieee_option != none; then + CFLAGS="${CFLAGS} ${ac_cv_ieee_option}" +fi + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RANLIB@%$RANLIB%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/trio/configure.in b/trio/configure.in new file mode 100644 index 00000000..6783959b --- /dev/null +++ b/trio/configure.in @@ -0,0 +1,45 @@ +dnl +dnl Configuration for trio +dnl + +AC_INIT(triodef.h) + +AC_PROG_CC +ifdef([AC_PROG_CC_STDC], [AC_PROG_CC_STDC]) +AC_LANG_C + +AC_PROG_INSTALL +AC_PROG_RANLIB + +dnl +dnl Alpha floating-point compiler option. +dnl + +AC_MSG_CHECKING(for IEEE compilation options) +AC_CACHE_VAL(ac_cv_ieee_option, [ +AC_TRY_COMPILE(,[ +#if !(defined(__alpha) && (defined(__DECC) || defined(__DECCXX) || (defined(__osf__) && defined(__LANGUAGE_C__))) && (defined(VMS) || defined(__VMS))) +# error "Option needed" +#endif +],ac_cv_ieee_option="/IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE", +AC_TRY_COMPILE(,[ +#if !(defined(__alpha) && (defined(__DECC) || defined(__DECCXX) || (defined(__osf__) && defined(__LANGUAGE_C__))) && !(defined(VMS) || defined(__VMS)) && !defined(_CFE)) +# error "Option needed" +#endif +],ac_cv_ieee_option="-ieee", +AC_TRY_COMPILE(,[ +#if !(defined(__alpha) && (defined(__GNUC__) && (defined(__osf__) || defined(__linux__)))) +# error "Option needed" +#endif +],ac_cv_ieee_option="-mieee", +ac_cv_ieee_option="none" +) +) +) +]) +AC_MSG_RESULT($ac_cv_ieee_option) +if test $ac_cv_ieee_option != none; then + CFLAGS="${CFLAGS} ${ac_cv_ieee_option}" +fi + +AC_OUTPUT(Makefile) diff --git a/trio/doc/doc.h b/trio/doc/doc.h new file mode 100644 index 00000000..4b368f46 --- /dev/null +++ b/trio/doc/doc.h @@ -0,0 +1,161 @@ +/************************************************************************* + * + * $Id: doc.h,v 1.12 2002/12/08 10:42:49 breese Exp $ + * + * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. + * + ************************************************************************/ + +/** +@mainpage + +@author Bjørn Reese +@author Daniel Stenberg + +@section intro Introduction + +Trio is a fully matured and stable set of printf and string functions +designed be used by applications with focus on portability or with the +need for additional features that are not supported by standard stdio +implementation. + +There are several cases where you may want to consider using trio: + +@li Portability across heterogeneous platforms. +@li Embedded systems without stdio support. +@li Extendability of unsupported features. +@li Your native version does not do everything you need. + +When you write applications that must be portable to a wide range of +platforms you often have to deal with inadequate implementations of the +stdio library functions. Most notably is the lack of secure formatting +functions, such as snprintf, or the lack of parameter reordering commonly +used for the internationalization of applications, such as the $ +modifier. Sometimes the feature you need is simply not present in stdio. +So you end up spending much effort on determining which platforms supports +what, and to write your own versions of various features. This is where +trio can help you. Trio is a platform-independent implementation of the +stdio printf and scanf functions and the string library functions. + +The functionality described in the stdio standards is a compromise, and +does unfortunately not include a mechanism to extend the functionality for +an individual application. Oftentimes an application has the need for an +extra feature, and the application code can become much more clear and +readable by using an extension mechanism. Trio supports a range of useful +extensions such as user-defined specifiers, passing of arguments in arrays, +localized string scanning, thousand-separators, and arbitrary integer bases. + +Trio fully implements the C99 (ISO/IEC 9899:1999) and UNIX98 (the Single +Unix Specification, Version 2) standards, as well as many features from +other implemenations, e.g. the GNU libc and BSD4. + +@section examples Examples + +@subsection ex1 Binary Numbers +Output an integer as a binary number using a trio extension. +@verbatim + trio_printf("%..2i\n", number); +@endverbatim + +@subsection ex2 Thousand-separator +Output a number with thousand-separator using a trio extension. +@verbatim + trio_printf("%'f\n", 12345.6); +@endverbatim +The thousand-separator described by the locale is used. + +@subsection ex3 Fixed Length Array and Sticky Modifier +Output an fixed length array of floating-point numbers. +@verbatim + double array[] = {1.0, 2.0, 3.0}; + printf("%.2f %.2f %.2f\n", array[0], array[1], array[2]); +@endverbatim +The same with two trio extensions (arguments are passed in an array, and +the first formatting specifier sets the sticky option so we do not have +to type all the formatting modifiers for the remaining formatting specifiers) +@verbatim + trio_printfv("%!.2f %f %f\n", array); +@endverbatim +Another, and more powerful, application of being able to pass arguments in +an array is the creation of the printf/scanf statement at run-time, where +the formatting string, and thus the argument list, is based on an external +configuration file. + +@subsection ex4 Localized scanning +Parse a string consisting of one or more upper-case alphabetic characters +followed by one or more numeric characters. +@verbatim + sscanf(buffer, "%[A-Z]%[0-9]", alphabetic, numeric); +@endverbatim +The same but with locale using a trio extension. +@verbatim + trio_sscanf(buffer, "%[[:upper:]]%[[:digit:]]", alphabetic, numeric); +@endverbatim + +@section legal Legal Issues +Trio is distributed under the following license, which allows practically +anybody to use it in almost any kind of software, including proprietary +software, without difficulty. + +"Copyright (C) 1998-2001 Bjorn Reese and Daniel Stenberg. + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND +CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER." + +@section contribution Contribution + +@subsection contribute Contribute +We appreciate any type of contribution, from ideas over improvements to +error corrections. + +The project space contains references to bug and feature tracking, +mailing-list, and the CVS repository. We prefer communication via the +mailing-list, but do not require you to be subscribed, because trio is a +small project. + +The project space is located at http://sourceforge.net/projects/ctrio/ + +@subsection contributors Contributors +We have received contributions from the following persons (in alphabetic +order sorted by surname) + +@li Craig Berry +@li Stan Boehm +@li Robert Collins +@li Danny Dulai +@li John Fotheringham +@li Markus Henke +@li Ken Gibson +@li Paul Janzen +@li Richard Jinks +@li Tero Jänkä +@li Howard Kapustein +@li Rune Enggaard Lausen +@li Mehdi Lavasani +@li Alexander Lukyanov +@li Emmanuel Mogenet +@li Jacob Navia +@li Jose Ortiz +@li Joe Orton +@li Gisli Ottarsson +@li Marc Werwerft +@li Igor Zlatkovic + +Please let us know, and accept our apology, if we have omitted anybody. + +*/ diff --git a/trio/doc/doc_dynamic.h b/trio/doc/doc_dynamic.h new file mode 100644 index 00000000..92482676 --- /dev/null +++ b/trio/doc/doc_dynamic.h @@ -0,0 +1,31 @@ +/************************************************************************* + * + * $Id: doc_dynamic.h,v 1.1 2001/12/27 17:29:20 breese Exp $ + * + * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. + * + ************************************************************************/ + +/** @addtogroup DynamicStrings Dynamic String Functions. +Dynamic string functions. + +@b SYNOPSIS + +@verbatim +cc ... -ltrio -lm + +#include +@endverbatim + +@b DESCRIPTION + +*/ diff --git a/trio/doc/doc_printf.h b/trio/doc/doc_printf.h new file mode 100644 index 00000000..4321cd5c --- /dev/null +++ b/trio/doc/doc_printf.h @@ -0,0 +1,532 @@ +/************************************************************************* + * + * $Id: doc_printf.h,v 1.3 2002/05/07 16:26:00 breese Exp $ + * + * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. + * + ************************************************************************/ + +/** @addtogroup Printf Formatted Printing Functions. +Variations of formatted printing functions. + +@b SYNOPSIS + +@verbatim +cc ... -ltrio -lm + +#include +@endverbatim + +@b DESCRIPTION + +This documentation is incomplete. +The documentation of the printf family in [C99] and [UNIX98] also applies +to the trio counterparts. + +All these functions outputs a string which is formatted according to the +@p format string and the consecutive arguments. The @p format string is +described in the Formatting section below. + +@ref trio_printf, @ref trio_vprintf, and @ref trio_printfv writes the +output to the standard output stream (stdout). + +@ref trio_fprintf, @ref trio_vfprintf, and @ref trio_fprintfv writes the +output to a given output stream. + +@ref trio_dprintf, @ref trio_vdprintf, and @ref trio_dprintfv writes the +output to a file descriptor (this includes, for example, sockets). + +@ref trio_sprintf, @ref trio_vsprintf, and @ref trio_sprintfv writes the +output into @p buffer. + +@ref trio_snprintf, @ref trio_vsnprintf, and @ref trio_snprintfv writes @p +max - 1 characters into @p buffer followed by a terminating zero character. +If @p max is 1, then @p buffer will be an empty string. If @p max is 0, +then @p buffer is left untouched, and can consequently be NULL. The number +of characters that would have been written to @p buffer, had there been +sufficient space, is returned. + +@ref trio_snprintfcat appends the formatted text at the end of @p buffer. + +@ref trio_asprintf and @ref trio_vasprintf allocates and returns an +allocated string in @p buffer containing the formatted text. + +@b FORMATTING + +The @p format string can contain normal text and conversion indicators. +The normal text can be any character except the nil character (\000 = +'\0') and the percent character (\045 = '%'). Conversion indicators +consists of an indication character (%), followed by zero or more conversion +modifiers, and exactly one conversion specifier. + +@b Modifiers + +Some modifiers exhibit the same behaviour for all specifiers, other modifiers +indicate different behaviours for different specifiers, and other modifiers +are only applicable to certain specifiers. The relationship is described for +each modifier. The number 9 is used to denotes an arbitrary integer. + +@em Positional ( @c 9$ ) [UNIX98] + +Normally the arguments supplied to these functions are interpreted +incrementially from left to right. Arguments can be referenced specifically in +the format string. The modifier n$ selects the nth argument. The first +argument is referred as 1$. If this modifier is used, it must be the first +modifier after the indication character. n$ can also be used for argument +width, precision, and base. + +The performance penalty of using positionals is almost neglible (contrary to +most other printf implementations). + +@li @em Reference @em Mix. +Mixing normal and positional specifiers is allowed [TRIO]. For example, +@verbatim + trio_printf("%d %3$d %2$d\n", 1, 2, 3); +@endverbatim +results in +@verbatim + 1 3 2 +@endverbatim +Arguments for the printf family are passed on the stack. On most platforms it +is not possible to determine the size of individual stack elements, so it is +essential that the format string corresponds exactly to the passed arguments. +If this is not the case, incorrect values may be put into the result. + +@li @em Reference @em Gap. +For the same reason it is also essential that the format string does not +contain any "gaps" in the positional arguments. For example, +@verbatim + trio_printf("%1$d %3$d\n", 1, 2, 3); +@endverbatim +is NOT allowed. The format string parser has no knowledge about whether the +second argument is, say, an integer or a long double (which have different +sizes). +@verbatim +@endverbatim +[UNIX98] describes this as unspecified behaviour. [TRIO] will detect reference +gaps and return an error. + +@li @em Double @em Reference. +It is also not allowed to reference an argument twice or more. For example, +@verbatim + trio_printf("%1$d %1$lf\n", 1); +@endverbatim +is NOT allowed, because it references the first argument as two differently +sized objects. +@verbatim +@endverbatim +[UNIX98] describes this as unspecified behaviour. [TRIO] will detect double +references and return an error. + +The following two statements are equivalent +@verbatim + trio_printf("|%d %s\n|", 42, "meanings"); + |42 meanings| + + trio_printf("|%1$d %2$s|\n", 42, "meanings"); + |42 meanings| +@endverbatim + +@em Width ( @c 9 ) + +Specifies the minimum width of a field. If the fields has less characters than +specified by the width, the field will be left adjusted and padded by spaces. +The adjustment and padding can be changed by the Alignment ( @c - ) and +Padding ( @c 0 ) modifiers. + +The width is specified as a number. If an asterix ( @c * ) is used instead, the +width will be read from the argument list. + +Prefixes, such as 0x for hexadecimal integers, are part of width. +@verbatim + trio_printf("|%10i|\n", 42); + | 42| +@endverbatim + +@em Precision ( @c .9 ) + +The precision has different semantics for the various data types. +The precision specifies the maximum number of printed characters for strings, +the number of digits after the decimal-point for floating-point numbers, +the number of significant digits for the @c g (and @c G) representation of +floating-point numbers, the minimum number of printed digits for integers. +@verbatim + trio_printf("|%10.8i|%.8i|\n", 42, 42); + | 00000042|00000042| +@endverbatim + +@em Base ( @c ..9 ) [TRIO] + +Sets the base that the associated integer must be converted to. The base can +be between 2 and 36 (both included). +@verbatim + trio_printf("|%10.8.2i|%10..2i|%..2i|\n", 42, 42, 42); + | 00101010| 101010|101010| + + trio_printf("|%*.8.*i|\n", 10, 2, 42); + | 00101010| +@endverbatim + +@em Padding ( @c 0 ) + +Integer and floating point numbers are prepended by zeros. The number of +leading zeros are determined by the precision. If precision is not present, +width is used instead. + +@em Short ( @c h ) + +Integer arguments are read as an ( @c unsigned ) @c short @c int. String +and character arguments are read as @c char @c * and @c char respectively. + +@em Short @em short ( @c hh ) [C99, GNU] + +The argument is read as an ( @c unsigned ) @c char. + +@em Fixed @em Size ( @c I ) [MSVC] + +The argument is read as a fixed sized integer. The modifier is followed by +a number, which specifies the number of bits in the integer, and can be one +of the following + +@li @c I8 +@li @c I16 +@li @c I32 +@li @c I64 (if 64-bits integers are supported) + +Works only for integers (i, u, d, o, x, X) + +@em Largest ( @c j ) [C99] + +The argument is read as an @c intmax_t / @c uintmax_t, which is defined to +be the largest signed/unsigned integer. + +@em Long ( @c l ) + +An integral argument is read as an ( @c unsigned ) @c long @c int. A string +argument is read as a @c wchar_t @c *, and output as a multi-byte character +sequence. + +@em Long @em long ( @c ll ) [C99, UNIX98, GNU] + +The argument is read as an ( @c unsigned ) @c long @c long @c int. + +@em Long @em double ( @c L ) [C99, UNIX98, GNU] + +The argument is read as a @c long @c double. + +@em ptrdiff_t ( @c t ) [C99] + +The argument is read as a @c ptrdiff_t, which is defined to be the signed +integer type of the result of subtracting two pointers. + +@em Quad ( @c q ) [BSD, GNU] + +Corresponds to the long long modifier ( @c ll ). + +@em Wide ( @c w ) [MISC] + +For a string argument this is equivalent to using the long modifier ( @c l ). + +@em size_t ( @c z ) [C99] + +The argument is read as a @c size_t, which is defined to be the type +returned by the @c sizeof operator. + +@em size_t ( @c Z ) [GNU] + +Corresponds to the size_t modifier ( @c z ). + +@em Alternative ( @c # ) + +Prepend radix indicator for hexadecimal, octal, and binary integer numbers +and for pointers. +Always add a decimal-pointer for floating-point numbers. +Escape non-printable characters for strings. + +@em Spacing ( ) + +Prepend leading spaces when necessary. + +@em Sign ( @c + ) + +Always prepend a sign to numbers. Normally only the negative sign is prepended +to a number. With this modifier the positive sign may also be prepended. + +@em Alignment ( @c - ) + +The output will be left-justified in the field specified by the width. + +@em Argument ( @c * ) + +Width, precision, or base is read from the argument list, rather than from +the formatting string. + +@em Quote / @em Grouping ( @c ' ) [MISC] + +Groups integers and the integer-part of floating-point numbers according to +the locale. Quote strings and characters. + +@em Sticky ( @c ! ) [TRIO] + +The modifiers listed for the current specifier will be reused by subsequent +specifiers of the same group. +The following specifier groups exists +@li Integer ( @c i, @c u, @c d, @c o, @c x, @c X ) +@li Floating-point ( @c f, @c F, @c e, @c E, @c g, @c G, @c a, @c A ) +@li Character ( @c c ) +@li String ( @c s ) +@li Pointer ( @c p ) +@li Count ( @c n ) +@li Errno ( @c m ) +@li Group ( @c [] ) + +The sticky modifiers are active until superseeded by other sticky modifiers, +or the end of the format string is reached. +Local modifiers overrides sticky modifiers for the given specifier only. +@verbatim + trio_printf("|%!08#x|%04x|%x|\n", 42, 42, 42); + |0x00002a|0x2a|0x00002a| +@endverbatim + +@b Specifiers + +@em Percent ( @c % ) + +Produce a percent ( @c % ) character. This is used to quote the indication +character. No modifiers are allowed. +The full syntax is @c %%. +@verbatim + trio_printf("Percent is %%\n"); + Percent is % +@endverbatim + +@em Hex @em floats ( @c a, @c A ) [C99] + +Output a hexadecimal (base 16) representation of a floating point number. The +number is automatically preceeded by @c 0x ( or @c 0X ). The exponent is +@c p ( or @c P ). +@verbatim + trio_printf("|%a|%A|\n", 3.1415, 3.1415e20); + |0x3.228bc|0X3.228BCP+14| +@endverbatim + +@em Binary @em numbers ( @c b, @c B ) [MISC - SCO UnixWare 7] + +DEPRECATED: Use Base modifier @c %..2i instead. + +@em Character ( @c c ) + +Output a single character. + +@li Quote ( @c ' ) [TRIO]. +Quote the character. + +@em Decimal ( @c d ) + +Output a decimal (base 10) representation of a number. + +@li Grouping ( @c ' ) [TRIO]. +The number is separated by the locale thousand separator. +@verbatim + trio_printf("|%'ld|\n", 1234567); + |1,234,567| +@endverbatim + +@em Floating-point ( @c e, @c E) + +Output a decimal floating-point number. +The style is @c [-]9.99e[-]9, where +@li @c [-]9.99 is the mantissa (as described for the @c f, @c F specifier), and +@li @c e[-]9 is the exponent indicator (either @c e or @c E, depending on the +floating-point specifier), followed by an optional sign and the exponent + +If the precision is wider than the maximum number of digits that can be +represented by the floating-point unit, then the number will be adequately +rounded. For example, assuming DBL_DIG is 15 +@verbatim + trio_printf("|%.18e|\n", (1.0 / 3.0)); + |3.333333333333333000e-01| +@endverbatim + +@em Floating-point ( @c f, @c F ) + +Output a decimal floating-point number. +The style is @c [-]9.99, where +@li @c [-] is an optional sign (either @c + or @c -), +@li @c 9 is the integer-part (possibly interspersed with thousand-separators), +@li @c . is the decimal-point (depending on the locale), and +@li @c 99 is the fractional-part. + +If more digits are needed to output the number, than can be represented with +the accuracy of the floating-point unit, then the number will be adequately +rounded. For example, assuming that DBL_DIG is 15 +@verbatim + trio_printf("|%f|\n", (2.0 / 3.0) * 1E18); + |666666666666666700.000000| +@endverbatim + +The following modifiers holds a special meaning for this specifier +@li Alternative ( @c # ) [C99]. +Add decimal point. +@li Grouping ( @c ' ) [TRIO]. +Group integer part of number into thousands (according to locale). + +@em Floating-point ( @c g, @c G) + +Output a decimal floating-point representation of a number. The format of +either the @c f, @c F specifier or the @c e, @c E specifier is used, whatever +produces the shortest result. + +@em Integer ( @c i ) + +Output a signed integer. Default base is 10. + +@em Errno ( @c m ) [GNU] + +@em Count ( @c n ) + +Insert into the location pointed to by the argument, the number of octets +written to the output so far. + +@em Octal ( @c o ) + +Output an octal (base 8) representation of a number. + +@em Pointer ( @c p ) + +Ouput the address of the argument. The address is printed as a hexadecimal +number. If the argument is the NULL pointer the text @c (nil) will be used +instead. +@li Alternative ( @c # ) [TRIO]. +Prepend 0x + +@em String ( @c s, @c S ) + +Output a string. The argument must point to a zero terminated string. If the +argument is the NULL pointer the text @c (nil) will be used instead. +@c S is equivalent to @c ls. +@li Alternative ( @c # ) [TRIO]. +Escape non-printable characters. + +Non-printable characters are converted into C escapes, or hexadecimal numbers +where no C escapes exists for the character. The C escapes, the hexadecimal +number, and all backslashes are prepended by a backslash ( @c \ ). +The supported C escapes are +@li @c \a (\007) = alert +@li @c \b (\010) = backspace +@li @c \f (\014) = formfeed +@li @c \n (\012) = newline +@li @c \r (\015) = carriage return +@li @c \t (\011) = horizontal tab +@li @c \v (\013) = vertical tab + +@verbatim + trio_printf("|One %s Three|One %'s Three|\n", "Two", "Two"); + |One Two Three|One "Two" Three| + + trio_printf("|Argument missing %s|\n", NULL); + |Argument missing (nil)| + + trio_printf("|%#s|\n", "\007 \a."); + |\a \a.| +@endverbatim + +@em Unsigned ( @c u ) + +Output an unsigned integer. Default base is 10. + +@em Hex ( @c x, @c X ) + +Output a hexadecimal (base 16) representation of a number. + +@li Alternative ( @c # ). +Preceed the number by @c 0x ( or @c 0X ). The two characters are counted +as part of the width. + +@em User-defined ( @c <> ) + +Invoke user-defined formatting. +See @ref trio_register for further information. + +@b RETURN @b VALUES + +All functions returns the number of outputted characters. If an error occured +then a negative error code is returned [TRIO]. Note that this is a deviation +from the standard, which simply returns -1 (or EOF) and errno set +appropriately. +The error condition can be detected by checking whether the function returns +a negative number or not, and the number can be parsed with the following +macros. The error codes are primarily intended as debugging aide for the +developer. + +@li TRIO_EINVAL: Invalid argument. +@li TRIO_ETOOMANY: Too many arguments. +@li TRIO_EDBLREF: Double argument reference. +@li TRIO_EGAP: Argument reference gap. +@li TRIO_ENOMEM: Out of memory. +@li TRIO_ERANGE: Invalid range. +@li TRIO_ERRNO: The error is specified by the errno variable. + +Example: +@verbatim + int rc; + + rc = trio_printf("%r\n", 42); + if (rc < 0) { + if (TRIO_ERROR_CODE(rc) != TRIO_EOF) { + trio_printf("Error: %s at position %d\n", + TRIO_ERROR_NAME(rc), + TRIO_ERROR_POSITION(rc)); + } + } +@endverbatim + +@b SEE @b ALSO + +@e trio_scanf, @e trio_register. + +@b NOTES + +The printfv family uses an array rather than the stack to pass arguments. +This means that @c short @c int and @c float values will not be handled by +the default argument promotion in C. Instead, these values must be explicitly +converted with the Short (h) modifier in both cases. + +Example: +@verbatim + void *array[2]; + float float_number = 42.0; + short short_number = 42; + + array[0] = &float_number; + array[1] = &short_number; + + trio_printfv("%hf %hd\n", array); /* CORRECT */ + trio_printfv("%f %d\n", array); /* WRONG */ +@endverbatim + +@b CONFORMING @b TO + +Throughout this document the following abbreviations have been used to +indicate what standard a feature conforms to. If nothing else is indicated +ANSI C (C89) is assumed. + +@li [C89] ANSI X3.159-1989 +@li [C99] ISO/IEC 9899:1999 +@li [UNIX98] The Single UNIX Specification, Version 2 +@li [BSD] 4.4BSD +@li [GNU] GNU libc +@li [MSVC] Microsoft Visual C +@li [MISC] Other non-standard sources +@li [TRIO] Extensions specific for this package + +*/ diff --git a/trio/doc/doc_register.h b/trio/doc/doc_register.h new file mode 100644 index 00000000..03610bfa --- /dev/null +++ b/trio/doc/doc_register.h @@ -0,0 +1,357 @@ +/************************************************************************* + * + * $Id: doc_register.h,v 1.2 2002/04/20 13:28:09 breese Exp $ + * + * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. + * + ************************************************************************/ + +/** @addtogroup UserDefined User-defined Formatted Printing Functions. +Functions for using customized formatting specifiers. + +@b SYNOPSIS + +@verbatim +cc ... -ltrio -lm + +#include +#include +@endverbatim + +@b DESCRIPTION + +This documentation is incomplete. + +@b User-defined @b Specifier + +The user-defined specifier consists of a start character (\074 = '<'), an +optional namespace string followed by a namespace separator (\072 = ':'), +a format string, and an end character (\076 = '>'). + +The namespace string can consist of alphanumeric characters, and is used to +define a named reference (see below). The namespace is case-sensitive. If no +namespace is specified, then we use an unnamed reference (see below). + +The format can consist of any character except the end character ('>'), the +namespace separator (':'), and the nil character (\000). + +Any modifier can be used together with the user-defined specifier. + +@b Registering + +A user-defined specifier must be registered before it can be used. +Unregistered user-defined specifiers are ignored. The @ref trio_register +function is used to register a user-defined specifier. It takes two argument, +a callback function and a namespace, and it returns a handle. The handle must +be used to unregister the specifier later. + +The following example registers a user-define specifier with the "my_namespace" +namespace: + +@verbatim + my_handle = trio_register(my_callback, "my_namespace"); +@endverbatim + +There can only be one user-defined specifier with a given namespace. There +can be an unlimited number (subject to maximum length of the namespace) of +different user-defined specifiers. + +Passing NULL as the namespace argument results in an anonymous reference. +There can be an unlimited number of anonymous references. + +@b REFERENCES + +There are two ways that a registered callback can be called. Either the +user-defined specifier must contain the registered namespace in the format +string, or the handle is passed as an argument to the formatted printing +function. + +If the namespace is used, then a user-defined pointer must be passed as an +argument: + +@verbatim + trio_printf("\n", my_data); +@endverbatim + +If the handle is used, then the user-defined specifier must not contain a +namespace. Instead the handle must be passed as an argument, followed by a +user-defined pointer: + +@verbatim + trio_printf("\n", my_handle, my_data); +@endverbatim + +The two examples above are equivalent. + +There must be exactly one user-defined pointer per user-defined specifier. +This pointer can be used within the callback function with the +@ref trio_get_argument getter function (see below). + +The format string is optional. It can be used within the callback function +with the @ref trio_get_format getter function. + +@b Anonymous @b References +Anonymous references are specified by passing NULL as the namespace. + +The handle must be passed as an argument followed by a user-defined pointer. +No namespace can be specified. + +@verbatim + anon_handle = trio_register(callback, NULL); + trio_printf("\n", anon_handle, my_data); +@endverbatim + +@b Restrictions + +@li The length of the namespace string cannot exceed 63 characters. +@li The length of the user-defined format string cannot exceed 255 characters. +@li User-defined formatting cannot re-define existing specifiers. +This restriction was imposed because the existing formatting specifiers have +a well-defined behaviour, and any re-definition would apply globally to an +application (imagine a third-party library changing the behaviour of a +specifier that is crusial to your application). + +@b CALLBACK @b FUNCTION + +The callback function will be called if a matching user-defined specifier +is found within the formatting string. The callback function takes one input +parameter, an opaque reference which is needed by the private functions. It +returns an @c int, which is currently ignored. The prototype is + +@verbatim + int (*trio_callback_t)(void *ref); +@endverbatim + +See the Example section for full examples. + +@b PRINTING @b FUNCTIONS + +The following printing functions must only be used inside a callback function. +These functions will print to the same output medium as the printf function +which invoked the callback function. For example, if the user-defined +specifier is used in an sprintf function, then these print functions will +output their result to the same string. + +@b Elementary @b Printing + +There are a number of function to print elementary data types. + +@li @ref trio_print_int Print a signed integer. For example: +@verbatim + trio_print_int(42); +@endverbatim +@li @ref trio_print_uint Print an unsigned integer. +@li @ref trio_print_double Print a floating-point number. +@li @ref trio_print_string Print a string. For example: +@verbatim + trio_print_string("Hello World"); + trio_print_string(trio_get_format()); +@endverbatim +@li @ref trio_print_pointer Print a pointer. + +@b Formatted @b Printing + +The functions @ref trio_print_ref, @ref trio_vprint_ref, and +@ref trio_printv_ref outputs a formatted string just like its printf +equivalents. + +@verbatim + trio_print_ref(ref, "There are %d towels\n", 42); + trio_print_ref(ref, "%\n", recursive_writer, trio_get_argument()); +@endverbatim + +@b GETTER @b AND @b SETTER @b FUNCTIONS + +The following getter and setter functions must only be used inside a callback +function. They can either operate on the modifiers or on special data. + +@b Modifiers + +The value of a modifier, or a boolean indication of its presence or absence, +can be found or set with the getter and setter functions. +The generic prototypes of the these getter and setter functions are + +@verbatim + int trio_get_???(void *ref); + void trio_set_???(void *ref, int); +@endverbatim + +where @c ??? refers to a modifier. For example, to get the width of the +user-defined specifier use + +@verbatim + int width = trio_get_width(ref); +@endverbatim + +@b Special @b Data + +Consider the following user-defined specifier, in its two possible referencing +presentations. + +@verbatim + trio_printf("%\n", namespace_writer, argument); + trio_printf("%\n", argument); +@endverbatim + +@ref trio_get_format will get the @p format string, and +@ref trio_get_argument} will get the @p argument parameter. +There are no associated setter functions. + +@b EXAMPLES + +The following examples show various types of user-defined specifiers. Although +each specifier is demonstrated in isolation, they can all co-exist within the +same application. + +@b Time @b Example + +Print the time in the format "HOUR:MINUTE:SECOND" if "time" is specified inside +the user-defined specifier. + +@verbatim + static int time_writer(void *ref) + { + const char *format; + time_t *data; + char buffer[256]; + + format = trio_get_format(ref); + if ((format) && (strcmp(format, "time") == 0)) { + data = trio_get_argument(ref); + if (data == NULL) + return -1; + strftime(buffer, sizeof(buffer), "%H:%M:%S", localtime(data)); + trio_print_string(ref, buffer); + } + return 0; + } +@endverbatim + +@verbatim + int main(void) + { + void *handle; + time_t now = time(NULL); + + handle = trio_register(time_print, "my_time"); + + trio_printf("%