Loading...
Searching...
No Matches
aprintf.c File Reference

GIS Library - Print functions for aligning wide characters. More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <stdarg.h>`
`#include <grass/gis.h>`
`#include <grass/glocale.h>`
Include dependency graph for aprintf.c:

Go to the source code of this file.

## Macros

#define | CONVS "diouxXeEfFgGaAcsCSpnm%"
#define | SPEC_BUF_SIZE 16

## Functions

int | G_vaprintf (const char *format, va_list ap)
| vprintf() version of G_aprintf(). See G_aprintf() for more details.
int | G_vfaprintf (FILE *stream, const char *format, va_list ap)
| vfprintf() version of G_aprintf(). See G_aprintf() for more details.
int | G_vsaprintf (char *str, const char *format, va_list ap)
| vsprintf() version of G_aprintf(). See G_aprintf() for more details.
int | G_vsnaprintf (char *str, size_t size, const char *format, va_list ap)
| vsnprintf() version of G_aprintf(). See G_aprintf() for more details.
int | G_aprintf (const char *format,...)
| Adjust the width of string specifiers to the display space instead of the number of bytes for wide characters and print them formatted using the adjusted display width.
int | G_faprintf (FILE *stream, const char *format,...)
| fprintf() version of G_aprintf(). See G_aprintf() for more details.
int | G_saprintf (char *str, const char *format,...)
| sprintf() version of G_aprintf(). See G_aprintf() for more details.
int | G_snaprintf (char *str, size_t size, const char *format,...)
| snprintf() version of G_aprintf(). See G_aprintf() for more details.

## Detailed Description

GIS Library - Print functions for aligning wide characters.

Extracted from the aligned printf C library (libaprintf under GPL v3+) by Huidae Cho.

(C) 2020 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
  Huidae Cho

Date
  2020

Definition in file aprintf.c.

## Macro Definition Documentation

## CONVS

#define CONVS "diouxXeEfFgGaAcsCSpnm%"

Definition at line 28 of file aprintf.c.

## SPEC_BUF_SIZE

#define SPEC_BUF_SIZE 16

Definition at line 31 of file aprintf.c.

## Function Documentation

## G_aprintf()

int G_aprintf | ( | const char * | format,
|  |  | ... )

Adjust the width of string specifiers to the display space instead of the number of bytes for wide characters and print them formatted using the adjusted display width.

compare

## printf("%10s|\n%10s|\n", "ABCD", "가나");

ABCD|

## 가나|

and

## G_aprintf("%10s|\n%10s|\n", "ABCD", "가나");

ABCD|

## 가나|

Parameters

  [in] | format | string format
  [in] | ... | arguments for the format string

Returns
  number of bytes printed or fatal error on error

Definition at line 465 of file aprintf.c.

References G_vaprintf().

## G_faprintf()

int G_faprintf | ( | FILE * | stream,
|  | const char * | format,
|  |  | ... )

fprintf() version of G_aprintf(). See G_aprintf() for more details.

Parameters

  [in] | stream | file pointer
  [in] | format | string format
  [in] | ... | arguments for the format string

Returns
  number of bytes printed or fatal error on error

Definition at line 485 of file aprintf.c.

References G_vfaprintf().

## G_saprintf()

int G_saprintf | ( | char * | str,
|  | const char * | format,
|  |  | ... )

sprintf() version of G_aprintf(). See G_aprintf() for more details.

Parameters

  [in] | str | string buffer
  [in] | format | string format
  [in] | ... | arguments for the format string

Returns
  number of bytes printed or fatal error on error

Definition at line 505 of file aprintf.c.

References G_vsaprintf().

## G_snaprintf()

int G_snaprintf | ( | char * | str,
|  | size_t | size,
|  | const char * | format,
|  |  | ... )

snprintf() version of G_aprintf(). See G_aprintf() for more details.

Parameters

  [in] | str | string buffer
  [in] | size | string buffer size
  [in] | format | string format
  [in] | ... | arguments for the format string

Returns
  number of bytes that would be printed if size was big enough or fatal error on error

Definition at line 527 of file aprintf.c.

References G_vsnaprintf().

## G_vaprintf()

int G_vaprintf | ( | const char * | format,
|  | va_list | ap )

vprintf() version of G_aprintf(). See G_aprintf() for more details.

Parameters

  [in] | format | string format
  [in] | ap | variable argument list for the format string

Returns
  number of bytes printed or fatal error on error

Definition at line 379 of file aprintf.c.

References NULL.

Referenced by G_aprintf().

## G_vfaprintf()

int G_vfaprintf | ( | FILE * | stream,
|  | const char * | format,
|  | va_list | ap )

vfprintf() version of G_aprintf(). See G_aprintf() for more details.

Parameters

  [in] | stream | file pointer
  [in] | format | string format
  [in] | ap | variable argument list for the format string

Returns
  number of bytes printed or fatal error on error

Definition at line 392 of file aprintf.c.

References NULL.

Referenced by G_faprintf().

## G_vsaprintf()

int G_vsaprintf | ( | char * | str,
|  | const char * | format,
|  | va_list | ap )

vsprintf() version of G_aprintf(). See G_aprintf() for more details.

Parameters

  [in] | str | string buffer
  [in] | format | string format
  [in] | ap | variable argument list for the format string

Returns
  number of bytes printed or fatal error on error

Definition at line 411 of file aprintf.c.

References NULL.

Referenced by G_saprintf().

## G_vsnaprintf()

int G_vsnaprintf | ( | char * | str,
|  | size_t | size,
|  | const char * | format,
|  | va_list | ap )

vsnprintf() version of G_aprintf(). See G_aprintf() for more details.

Parameters

  [in] | str | string buffer
  [in] | size | string buffer size
  [in] | format | string format
  [in] | ap | variable argument list for the format string

Returns
  number of bytes that would be printed if size was big enough or fatal error on error

Definition at line 432 of file aprintf.c.

References NULL.

Referenced by G_snaprintf().