ajfmt.c
Format and emit the converted numeric (ajFmtPutd) or string
(ajFmtPuts) in str[0..len-1] according to Fmt's defaults
and the values of flags,width and precision. It is a c.r.e
for str=null, len less than 0 or flags=null.
Synopsis
Prototype
void ajFmtPuts (
const char* str,
ajint len,
int function put,
void* cl,
const ajuint* flags,
ajint width,
ajint precision
);
| Type | Name | Read/Write | Description |
| const char* | str | Input | Text to write. |
| ajint | len | Input | Text length. |
| int function | put | Function | Standard function. |
| void* | cl | Modify | Standard - where to write the output |
| const ajuint* | flags | Input | Flags (after the %) |
| ajint | width | Input | Width (before the dot) |
| ajint | precision | Input | Precision (after the dot) |
| void | | RETURN | |
Input
| str: | (Input) | Text to write. |
| len: | (Input) | Text length. |
| put: | (Function) | Standard function. |
| flags: | (Input) | Flags (after the %) |
| width: | (Input) | Width (before the dot) |
| precision: | (Input) | Precision (after the dot) |
Input & Output
| cl: | (Modify) | Standard - where to write the output |
Returns
Description
Format and emit the converted numeric (ajFmtPutd) or string
(ajFmtPuts) in str[0..len-1] according to Fmt's defaults
and the values of flags,width and precision. It is a c.r.e
for str=null, len less than 0 or flags=null.
See Also
See other functions in this section
Availability
In release 6.4.0
formats and emits the "..." arguments according to the format string fmt
Synopsis
Prototype
void ajFmtFmt (
ajint function put,
void* cl,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| ajint function | put | Function | Standard function. |
| void* | cl | Modify | Standard - where to write the output |
| const char* | fmt | Input | Format string |
| ... | vararg | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| put: | (Function) | Standard function. |
| fmt: | (Input) | Format string |
| : | (Vararg) | Variable length argument list |
Input & Output
| cl: | (Modify) | Standard - where to write the output |
Returns
Description
formats and emits the "..." arguments according to the format string fmt
See Also
See other functions in this section
Availability
In release 6.4.0
format and emit the "..." arguments according to fmt;writes to stdout.
Synopsis
Prototype
void ajFmtPrint (
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| const char* | fmt | Input | Format string. |
| ... | vararg | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| fmt: | (Input) | Format string. |
| : | (Vararg) | Variable length argument list |
Returns
Description
format and emit the "..." arguments according to fmt;writes to stdout.
See Also
See other functions in this section
Availability
In release 6.4.0
format and emit the "..." arguments according to fmt;writes to stdout.
Synopsis
Prototype
void ajFmtVPrint (
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| const char* | fmt | Input | Format string. |
| va_list | ap | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| fmt: | (Input) | Format string. |
| ap: | (Vararg) | Variable length argument list |
Returns
Description
format and emit the "..." arguments according to fmt;writes to stdout.
See Also
See other functions in this section
Availability
In release 6.4.0
format and emit the "..." arguments according to fmt;writes to stderr.
Synopsis
Prototype
void ajFmtError (
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| const char* | fmt | Input | Format string. |
| ... | vararg | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| fmt: | (Input) | Format string. |
| : | (Vararg) | Variable length argument list |
Returns
Description
format and emit the "..." arguments according to fmt;writes to stderr.
See Also
See other functions in this section
Availability
In release 6.4.0
format and emit the "..." arguments according to fmt. Writes to stderr.
Synopsis
Prototype
void ajFmtVError (
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| const char* | fmt | Input | Format string. |
| va_list | ap | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| fmt: | (Input) | Format string. |
| ap: | (Vararg) | Variable length argument list |
Returns
Description
format and emit the "..." arguments according to fmt. Writes to stderr.
See Also
See other functions in this section
Availability
In release 6.4.0
format and emit the "..." arguments according to fmt;writes to stream..
Synopsis
Prototype
void ajFmtPrintF (
AjPFile file,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| AjPFile | file | Modify | Output file. |
| const char* | fmt | Input | Format string. |
| ... | vararg | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| fmt: | (Input) | Format string. |
| : | (Vararg) | Variable length argument list |
Input & Output
| file: | (Modify) | Output file. |
Returns
Description
format and emit the "..." arguments according to fmt;writes to stream..
See Also
See other functions in this section
Availability
In release 6.4.0
format and emit the "..." arguments according to fmt;writes to stream..
Synopsis
Prototype
void ajFmtVPrintF (
AjPFile file,
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| AjPFile | file | Modify | Output file. |
| const char* | fmt | Input | Format string. |
| va_list | ap | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| fmt: | (Input) | Format string. |
| ap: | (Vararg) | Variable length argument list |
Input & Output
| file: | (Modify) | Output file. |
Returns
Description
format and emit the "..." arguments according to fmt;writes to stream..
See Also
See other functions in this section
Availability
In release 6.4.0
Format and emit the "..." arguments according to fmt;writes to stream..
Synopsis
Prototype
void ajFmtVPrintFp (
FILE* stream,
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| FILE* | stream | Modify | Output file. |
| const char* | fmt | Input | Format string. |
| va_list | ap | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| fmt: | (Input) | Format string. |
| ap: | (Vararg) | Variable length argument list |
Input & Output
| stream: | (Modify) | Output file. |
Returns
Description
Format and emit the "..." arguments according to fmt;writes to stream..
See Also
See other functions in this section
Availability
In release 6.4.0
format and emit the "..." arguments according to fmt;writes to stream..
Synopsis
Prototype
void ajFmtPrintFp (
FILE* stream,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| FILE* | stream | Modify | Output file. |
| const char* | fmt | Input | Format string. |
| ... | vararg | Vararg | Variable length argument list |
| void | | RETURN | |
Input
| fmt: | (Input) | Format string. |
| : | (Vararg) | Variable length argument list |
Input & Output
| stream: | (Modify) | Output file. |
Returns
Description
format and emit the "..." arguments according to fmt;writes to stream..
See Also
See other functions in this section
Availability
In release 6.4.0
formats the "..." arguments into buf[1...size-1] according to fmt,
appends a num character, and returns the length of buf. It is a
c.r.e for size to be less than or equal to 0. Raises Fmt_Overflow
if more than size-1 characters are emitted.
Synopsis
Prototype
ajint ajFmtVPrintCL (
char* buf,
ajint size,
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| char* | buf | Output | char string to be written to. |
| ajint | size | Input | length of buffer |
| const char* | fmt | Input | Format string. |
| va_list | ap | Vararg | Variable length argument list |
| ajint | | RETURN | number of characters written to buf. |
Input
| size: | (Input) | length of buffer |
| fmt: | (Input) | Format string. |
| ap: | (Vararg) | Variable length argument list |
Output
| buf: | (Output) | char string to be written to. |
Returns
| ajint: | number of characters written to buf. |
Description
formats the "..." arguments into buf[1...size-1] according to fmt,
appends a num character, and returns the length of buf. It is a
c.r.e for size to be less than or equal to 0. Raises Fmt_Overflow
if more than size-1 characters are emitted.
See Also
See other functions in this section
Availability
In release 6.4.0
formats the "..." arguments into buf[1...size-1] according to fmt,
appends a num character, and returns the length of buf. It is a
c.r.e for size to be lass than or equal to 0. Raises Fmt_Overflow
if more than size-1 characters are emitted.
Synopsis
Prototype
ajint ajFmtPrintCL (
char* buf,
ajint size,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| char* | buf | Output | char string to be written to. |
| ajint | size | Input | length of buffer |
| const char* | fmt | Input | Format string |
| ... | vararg | Vararg | Variable length argument list |
| ajint | | RETURN | number of characters written to buf. |
Input
| size: | (Input) | length of buffer |
| fmt: | (Input) | Format string |
| : | (Vararg) | Variable length argument list |
Output
| buf: | (Output) | char string to be written to. |
Returns
| ajint: | number of characters written to buf. |
Description
formats the "..." arguments into buf[1...size-1] according to fmt,
appends a num character, and returns the length of buf. It is a
c.r.e for size to be lass than or equal to 0. Raises Fmt_Overflow
if more than size-1 characters are emitted.
See Also
See other functions in this section
Availability
In release 6.4.0
Formats the "..." arguments into a New AjPStr according to fmt.
It starts with an initial size of 20 then doubles until the
fmt output fits.
The caller is responsible for deleting the AjPStr afterwards.
Synopsis
Prototype
AjPStr ajFmtStr (
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| const char* | fmt | Input | Format string. |
| ... | vararg | Vararg | Variable length argument list |
| AjPStr | | RETURN | new AjPStr with Ptr holding formatted chars |
Input
| fmt: | (Input) | Format string. |
| : | (Vararg) | Variable length argument list |
Returns
| AjPStr: | new AjPStr with Ptr holding formatted chars |
Description
Formats the "..." arguments into a New AjPStr according to fmt.
It starts with an initial size of 20 then doubles until the
fmt output fits.
The caller is responsible for deleting the AjPStr afterwards.
See Also
See other functions in this section
Availability
In release 6.4.0
Formats the "..." arguments into an AjPStr according to fmt.
If AjPStr is not large enough then if it is the only one i.e
Use = 1 then increase till it fits. Else return 0 if it does not
fit. If it fits return the address of the new AjPStr.
Synopsis
Prototype
AjPStr ajFmtPrintS (
AjPStr* pthis,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| AjPStr* | pthis | Modify | String to be written too. |
| const char* | fmt | Input | Format for string. |
| ... | vararg | Vararg | Variable length argument list |
| AjPStr | | RETURN | Output string |
Input
| fmt: | (Input) | Format for string. |
| : | (Vararg) | Variable length argument list |
Input & Output
| pthis: | (Modify) | String to be written too. |
Returns
Description
Formats the "..." arguments into an AjPStr according to fmt.
If AjPStr is not large enough then if it is the only one i.e
Use = 1 then increase till it fits. Else return 0 if it does not
fit. If it fits return the address of the new AjPStr.
See Also
See other functions in this section
Availability
In release 6.4.0
Formats the "..." arguments into an AjPStr according to fmt.
If AjPStr is not large enough then if it is the only one i.e
Use = 1 then increase till it fits. Else return 0 if it does not
fit. If it fits return the address of the new AjPStr.
Synopsis
Prototype
AjPStr ajFmtVPrintS (
AjPStr* pthis,
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| AjPStr* | pthis | Modify | String to be written too. |
| const char* | fmt | Input | Format for string. |
| va_list | ap | Vararg | Variable length argument list |
| AjPStr | | RETURN | Output string |
Input
| fmt: | (Input) | Format for string. |
| ap: | (Vararg) | Variable length argument list |
Input & Output
| pthis: | (Modify) | String to be written too. |
Returns
Description
Formats the "..." arguments into an AjPStr according to fmt.
If AjPStr is not large enough then if it is the only one i.e
Use = 1 then increase till it fits. Else return 0 if it does not
fit. If it fits return the address of the new AjPStr.
See Also
See other functions in this section
Availability
In release 6.4.0
Formats the "..." arguments and appends to an AjPStr according to fmt.
If AjPStr is not large enough then if it is the only one i.e
Use = 1 then increase till it fits. Else return 0 if it does not
fit. If it fits return the address of the new AjPStr.
Synopsis
Prototype
AjPStr ajFmtPrintAppS (
AjPStr* pthis,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| AjPStr* | pthis | Modify | String to be written too. |
| const char* | fmt | Input | Format for string. |
| ... | vararg | Vararg | Variable length argument list |
| AjPStr | | RETURN | Output string. |
Input
| fmt: | (Input) | Format for string. |
| : | (Vararg) | Variable length argument list |
Input & Output
| pthis: | (Modify) | String to be written too. |
Returns
Description
Formats the "..." arguments and appends to an AjPStr according to fmt.
If AjPStr is not large enough then if it is the only one i.e
Use = 1 then increase till it fits. Else return 0 if it does not
fit. If it fits return the address of the new AjPStr.
See Also
See other functions in this section
Availability
In release 6.4.0
Same as ajFmtPrintCL but takes arguments from the list ap.
Synopsis
Prototype
ajint ajFmtVfmtStrCL (
char** pbuf,
ajint pos,
size_t* size,
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| char** | pbuf | Output | char string to be written to. |
| ajint | pos | Input | position in buffer to start writing |
| size_t* | size | Modify | allocated size of the buffer |
| const char* | fmt | Input | Format string. |
| va_list | ap | Vararg | Variable length argument list. |
| ajint | | RETURN | number of characters written to buf. |
Input
| pos: | (Input) | position in buffer to start writing |
| fmt: | (Input) | Format string. |
| ap: | (Vararg) | Variable length argument list. |
Output
| pbuf: | (Output) | char string to be written to. |
Input & Output
| size: | (Modify) | allocated size of the buffer |
Returns
| ajint: | number of characters written to buf. |
Description
Same as ajFmtPrintCL but takes arguments from the list ap.
See Also
See other functions in this section
Availability
In release 6.4.0
Same as ajFmtPrintCL but takes arguments from the list ap.
Synopsis
Prototype
ajint ajFmtVfmtCL (
char* buf,
ajint size,
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| char* | buf | Output | char string to be written to. |
| ajint | size | Input | length of buffer |
| const char* | fmt | Input | Format string. |
| va_list | ap | Vararg | Variable length argument list. |
| ajint | | RETURN | number of characters written to buf. |
Input
| size: | (Input) | length of buffer |
| fmt: | (Input) | Format string. |
| ap: | (Vararg) | Variable length argument list. |
Output
| buf: | (Output) | char string to be written to. |
Returns
| ajint: | number of characters written to buf. |
Description
Same as ajFmtPrintCL but takes arguments from the list ap.
See Also
See other functions in this section
Availability
In release 6.4.0
formats the "..." arguments into a null-terminated string according to
fmt and returns that string.
Synopsis
Prototype
char* ajFmtString (
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| const char* | fmt | Input | Format string |
| ... | vararg | Vararg | Variable length argument list |
| char* | | RETURN | Output string. |
Input
| fmt: | (Input) | Format string |
| : | (Vararg) | Variable length argument list |
Returns
Description
formats the "..." arguments into a null-terminated string according to
fmt and returns that string.
See Also
See other functions in this section
Availability
In release 6.4.0
as ajFmtString but takes arguments from the list ap.
Synopsis
Prototype
char* ajFmtVString (
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| const char* | fmt | Input | Format string. |
| va_list | ap | Vararg | Variable length argument list. |
| char* | | RETURN | Output string. |
Input
| fmt: | (Input) | Format string. |
| ap: | (Vararg) | Variable length argument list. |
Returns
Description
as ajFmtString but takes arguments from the list ap.
See Also
See other functions in this section
Availability
In release 6.4.0
as ajFmtPrint but takes arguments from the list ap.
Synopsis
Prototype
void ajFmtVfmt (
int function put,
void* cl,
const char* fmt,
va_list ap
);
| Type | Name | Read/Write | Description |
| int function | put | Function | Standard function |
| void* | cl | Modify | Where we are going to write the results |
| const char* | fmt | Input | Format string |
| va_list | ap | Vararg | Variable argument list |
| void | | RETURN | |
Input
| put: | (Function) | Standard function |
| fmt: | (Input) | Format string |
| ap: | (Vararg) | Variable argument list |
Input & Output
| cl: | (Modify) | Where we are going to write the results |
Returns
Description
as ajFmtPrint but takes arguments from the list ap.
See Also
See other functions in this section
Availability
In release 6.4.0
Given a string containing a number in full, converts it using the width
and precision values.
Synopsis
Prototype
void ajFmtPutd (
const char* str,
ajint len,
int function put,
void* cl,
const ajuint* flags,
ajint width,
ajint precision
);
| Type | Name | Read/Write | Description |
| const char* | str | Input | Text to write. |
| ajint | len | Input | Text length. |
| int function | put | Function | Standard function. |
| void* | cl | Modify | Standard - where to write the output |
| const ajuint* | flags | Input | Flags (after the %) |
| ajint | width | Input | Width (before the dot) |
| ajint | precision | Input | Precision (after the dot) |
| void | | RETURN | |
Input
| str: | (Input) | Text to write. |
| len: | (Input) | Text length. |
| put: | (Function) | Standard function. |
| flags: | (Input) | Flags (after the %) |
| width: | (Input) | Width (before the dot) |
| precision: | (Input) | Precision (after the dot) |
Input & Output
| cl: | (Modify) | Standard - where to write the output |
Returns
Description
Given a string containing a number in full, converts it using the width
and precision values.
See Also
See other functions in this section
Availability
In release 6.4.0
Block and print a string. String is split at given delimiters
Synopsis
Prototype
void ajFmtPrintSplit (
AjPFile outf,
const AjPStr str,
const char* prefix,
ajint len,
const char* delim
);
| Type | Name | Read/Write | Description |
| AjPFile | outf | Modify | output stream |
| const AjPStr | str | Input | text to write |
| const char* | prefix | Input | prefix string |
| ajint | len | Input | maximum span |
| const char* | delim | Input | delimiter string |
| void | | RETURN | |
Input
| str: | (Input) | text to write |
| prefix: | (Input) | prefix string |
| len: | (Input) | maximum span |
| delim: | (Input) | delimiter string |
Input & Output
| outf: | (Modify) | output stream |
Returns
Description
Block and print a string. String is split at given delimiters
See Also
See other functions in this section
Availability
In release 6.4.0
Scan a string according to fmt and load the ... variable pointers
Like C function sscanf.
Synopsis
Prototype
ajint ajFmtScanS (
const AjPStr thys,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| const AjPStr | thys | Input | String. |
| const char* | fmt | Input | Format string. |
| ... | vararg | Vararg | Variable length argument list |
| ajint | | RETURN | number of successful conversions |
Input
| thys: | (Input) | String. |
| fmt: | (Input) | Format string. |
| : | (Vararg) | Variable length argument list |
Returns
| ajint: | number of successful conversions |
Description
Scan a string according to fmt and load the ... variable pointers
Like C function sscanf.
See Also
See other functions in this section
Availability
In release 6.4.0
Scan a string according to fmt and load the ... variable pointers
Like C function sscanf.
Synopsis
Prototype
ajint ajFmtScanC (
const char* thys,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| const char* | thys | Input | String. |
| const char* | fmt | Input | Format string. |
| ... | vararg | Vararg | Variable length argument list |
| ajint | | RETURN | number of successful conversions |
Input
| thys: | (Input) | String. |
| fmt: | (Input) | Format string. |
| : | (Vararg) | Variable length argument list |
Returns
| ajint: | number of successful conversions |
Description
Scan a string according to fmt and load the ... variable pointers
Like C function sscanf.
See Also
See other functions in this section
Availability
In release 6.4.0
Scan an AjPFile object according to fmt and load the ... variable pointers
Like C function fscanf.
Synopsis
Prototype
ajint ajFmtScanF (
AjPFile thys,
const char* fmt,
...
);
| Type | Name | Read/Write | Description |
| AjPFile | thys | Modify | Input file object |
| const char* | fmt | Input | Format string. |
| ... | vararg | Vararg | Variable length argument list |
| ajint | | RETURN | number of successful conversions |
Input
| fmt: | (Input) | Format string. |
| : | (Vararg) | Variable length argument list |
Input & Output
| thys: | (Modify) | Input file object |
Returns
| ajint: | number of successful conversions |
Description
Scan an AjPFile object according to fmt and load the ... variable pointers
Like C function fscanf.
See Also
See other functions in this section
Availability
In release 6.4.0