home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (c) Oracle Corporation 1995. All Rights Reserved.
- *
- * ysfmt.h - String Formating.
- *
- * NOTE: These functions exist since it is not possible to construct a va_list
- * and to allow for "custom" extensions like the formating of transport layer
- * addresses and sysb8s.
- *
- * DESCRIPTION
- * ysfmt currently supports a subset of the ANSI C specified format string. The
- * flags supported are - and 0. Field width followed by an optional precision
- * is supported. The conversion character prefix L implies an sysb8. The
- * conversion characters u,d,x,c and s are also supported.
- *
- * The following flags and conversions are *NOT* currently supported:
- * +,<space>,#,i,o,f,e,E,g,G,p,n
- *
- * ATTRS: public, external
- */
-
- #ifndef YSFMT_ORACLE
- #define YSFMT_ORACLE
-
- #ifndef SYSX_ORACLE
- #include <sysx.h>
- #endif
-
- EXTC_START
-
- /* PUBLIC TYPES AND CONSTANTS */
- typedef struct ysfmtd ysfmtd;
-
- /* types for descriptor list elements */
- #define YSFMT_BAD (ub4) 0
- #define YSFMT_UB1 (ub4) 1
- #define YSFMT_SB1 (ub4) 2
- #define YSFMT_UB4 (ub4) 3
- #define YSFMT_SB4 (ub4) 4
- #define YSFMT_STR (ub4) 5
- #define YSFMT_SB8 (ub4) 6
-
- /*
- * ysFmtStr, ysFmtStrl - format a string much like sprintf()
- *
- * DESCRIPTION
- * ysFmtStr is intended as a replacement for sprintf(). Its interface is
- * identical.
- *
- * ysFmtStrl is identical to ysFmtStr, but the output size is limited by
- * the size parameter.
- *
- * Both ysFmtStr and ysFmtStrl build a typed argument descriptor list from
- * the arguments specified per the format strings specification. The format
- * string and argument descriptor list is then passed to ysFmtStrDesc() for
- * formatting.
- */
- void ysFmtStr(char *out,CONST char *fmt, ...);
- void ysFmtStrl(char *out, size_t size, CONST char *fmt, ...);
- void ysFmtVaStrl(char *out, size_t size, CONST char *fmt, va_list args);
-
- /*
- * ysFmtDescCreate, ysFmtDescDestroy, ysFmtAddElem
- * - typed argument descriptor list manipulation.
- *
- * DESCRIPTION
- *
- * ysFmtDescCreate() creates and returns an empty typed argument descriptor
- * list.
- *
- * ysFmtDescDestroy() destroys a typed argument descriptor list.
- *
- * ysFmtDescAddElem() adds an element (type and value) to the end of
- * the descriptor list. All values except for YSFMT_STR are copied into the
- * descriptor list itself so storage need only persist for YSFMT_STRs.
- *
- */
-
- ysfmtd *ysFmtDescCreate(void);
- void ysFmtDescDestroy(ysfmtd *d);
- ysfmtd *ysFmtAddElem(ysfmtd *d, ub4 type, dvoid *value);
-
- /*
- * ysFmtStrDesc - format a string using a typed descriptor list
- *
- * DESCRIPTION
- * ysFmtStrDesc formats the list typed arguments according the the format
- * string specified. The size of the output string is limited by the size
- * parameter. The output string is truncated to size-1 characters and '\0'
- * terminated.
- */
- void ysFmtStrDesc(char *out, size_t size, CONST char *fmt, ysfmtd *d);
-
- EXTC_END
- #endif
-