|
HP85 GPIB Disk Emulator
1.0
HP85GPIBDiskEmulator
|
Small printf, and verious conversion code with floating point support. More...
Go to the source code of this file.
Functions | |
| MEMSPACE size_t WEAK_ATR | strlen (const char *str) |
| String Length. More... | |
| MEMSPACE int WEAK_ATR | isdigit (int c) |
| test if a character is a digit More... | |
| MEMSPACE void WEAK_ATR | reverse (char *str) |
| Reverse a string in place Example: abcdef -> fedcba. More... | |
| MEMSPACE void WEAK_ATR | strupper (char *str) |
| UPPERCASE a string. More... | |
| MEMSPACE int | bin2num (uint8_t *str, int strmax, int nummin, int base, uint8_t *nump, int numsize, int sign_ch) |
| Convert an unsigned number (numsize bytes in size) to ASCII in specified base Notes: No limit except available memory on number size. More... | |
| MEMSPACE void | pch_init (p_ch_t *p, char *str, int max) |
| Initialize character buffer with limits. More... | |
| MEMSPACE int | pch (p_ch_t *p, char ch) |
| Put character in buffer with limits. More... | |
| MEMSPACE int | pch_ind (p_ch_t *p) |
| Return current index of character buffer with limits. More... | |
| MEMSPACE int | pch_max_ind (p_ch_t *p) |
| Return maximum valid index for character buffer. More... | |
| MEMSPACE void | print_flags (f_t f) |
| print flags set in t_t structure More... | |
| MEMSPACE int | p_ntoa (uint8_t *nump, int numsize, char *str, int strmax, int radix, int width, int prec, f_t f) |
| Convert number an base 2 .. 16 to ASCII with optional sign Notes: 1) Numbers can be any number of digits long - limited only by memory available To print negative numbers convert to positive before calling this function and set f.b.neg 2) Warning: as with printf width and prec are only minimum sizes - results can be bigger We assume all numbers are positive: More... | |
| MEMSPACE void | _puts_pad (printf_t *fn, char *s, int width, int count, int left) |
| put string, via user function, count bytes long, padded up to width, left or right aligned More... | |
| MEMSPACE void | _printf_fn (printf_t *fn, __memx const char *fmt, va_list va) |
| vsnprintf function More... | |
| MEMSPACE void | _putc_buffer_fn (struct _printf_t *p, char ch) |
| _putc_buffer_fn - character output to a string buffer Used by snprintf and vsnprintf You can make _printf_fn call this helper for each character More... | |
| MEMSPACE int | vsnprintf (char *str, size_t size, const char *format, va_list va) |
| vsnprintf function More... | |
| MEMSPACE int | snprintf (char *str, size_t size, const char *format,...) |
| snprintf function More... | |
Small printf, and verious conversion code with floating point support.
This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file printf.c.
vsnprintf function
| [out] | fn | output character function pointer |
| [in] | fmt | printf forat string |
| [in] | va | va_list arguments |
Calling Variadic Functions
Definition at line 806 of file printf.c.
Referenced by fprintf(), and vsnprintf().
_putc_buffer_fn - character output to a string buffer Used by snprintf and vsnprintf You can make _printf_fn call this helper for each character
| [in] | *p | structure with pointers and buffer to be written to |
| [in] | ch | character to place in buffer |
Definition at line 1187 of file printf.c.
Referenced by vsnprintf().
put string, via user function, count bytes long, padded up to width, left or right aligned
| [out] | fn | output character function pointer |
| [in] | s | string |
| [in] | width | of characters to pad up to - if needed |
| [in] | count | number of characters to copy from buff |
| [in] | left | string is left aligned |
Definition at line 678 of file printf.c.
Referenced by _printf_fn().
| MEMSPACE int bin2num | ( | uint8_t * | str, |
| int | strmax, | ||
| int | nummin, | ||
| int | base, | ||
| uint8_t * | nump, | ||
| int | numsize, | ||
| int | sign_ch | ||
| ) |
Convert an unsigned number (numsize bytes in size) to ASCII in specified base Notes: No limit except available memory on number size.
| [out] | str | ASCII number string result |
| [in] | strmax | maximum size of str in bytes |
| [in] | nummin | minimum number of digits to display |
| [in] | *nump | Pointer to binary number |
| [in] | numsize | size of binary number in bytes |
| [in] | sign_ch | sign of binary number return converted number string numsize in bytes |
Definition at line 143 of file printf.c.
Referenced by p_ntoa().
test if a character is a digit
undo any existing macros
| [in] | c | character |
Definition at line 71 of file printf.c.
Referenced by _printf_fn().
| MEMSPACE int p_ntoa | ( | uint8_t * | nump, |
| int | numsize, | ||
| char * | str, | ||
| int | strmax, | ||
| int | radix, | ||
| int | width, | ||
| int | prec, | ||
| f_t | f | ||
| ) |
Convert number an base 2 .. 16 to ASCII with optional sign Notes: 1) Numbers can be any number of digits long - limited only by memory available To print negative numbers convert to positive before calling this function and set f.b.neg 2) Warning: as with printf width and prec are only minimum sizes - results can be bigger We assume all numbers are positive:
| [in] | nump | number pointer |
| [in] | numsize | number size in bytes |
| [out] | *str | string result |
| [in] | strmax | strmaximum length of string result |
| [in] | radix | Radix may be 2 .. 16 |
| [in] | width | Width of result padded if needed |
| [in] | prec | minumum number of digits, zero padded if needed |
| [in] | f | flags f.b.left justify left f.b.plus display + for positive number, - for negative numbers f.b.space display ' ' for positive, - for negative f.b.zero pad with zeros if needed f.b.alt Alternate display form - work in progress f.b.width Width of result - pad if required f.b.prec Zero padd to prec if sepcified f.b.neg Sign of number is negative |
Definition at line 314 of file printf.c.
Referenced by _printf_fn().
String Length.
| [in] | str | string |
Definition at line 53 of file printf.c.
Referenced by _printf_fn(), reverse(), and vsnprintf().
UPPERCASE a string.
| [in] | str | string |
Definition at line 112 of file printf.c.
Referenced by _printf_fn().
vsnprintf function
| [out] | str | string buffer for result |
| [in] | size | maximum length of converted string |
| [in] | format | printf forat string |
| [in] | va | va_list list of arguments |
Definition at line 1220 of file printf.c.
Referenced by snprintf().
1.8.17