php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
snprintf.c File Reference
#include "php.h"
#include <zend_strtod.h>
#include <stddef.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <inttypes.h>
#include <locale.h>

Go to the source code of this file.

Data Structures

struct  buf_area
 

Macros

#define _GNU_SOURCE
 
#define LCONV_DECIMAL_POINT   (*lconv->decimal_point)
 
#define NUL   '\0'
 
#define INT_NULL   ((int *)0)
 
#define S_NULL   "(null)"
 
#define S_NULL_LEN   6
 
#define FLOAT_DIGITS   6
 
#define EXPONENT_LENGTH   10
 
#define NDIG   320
 
#define NUM_BUF_SIZE   2048
 
#define INS_CHAR(c, sp, bep, cc)
 
#define NUM(c)
 
#define STR_TO_DEC(str, num)
 
#define FIX_PRECISION(adjust, precision, s, s_len)
 
#define PAD(width, len, ch)
 

Typedefs

typedef struct buf_area buffy
 

Functions

PHPAPI char * ap_php_conv_10 (int64_t num, bool is_unsigned, bool *is_negative, char *buf_end, size_t *len)
 
PHPAPI char * php_conv_fp (char format, double num, bool add_dp, int precision, char dec_point, bool *is_negative, char *buf, size_t *len)
 
PHPAPI char * ap_php_conv_p2 (uint64_t num, int nbits, char format, char *buf_end, size_t *len)
 
PHPAPI int ap_php_slprintf (char *buf, size_t len, const char *format,...)
 
PHPAPI int ap_php_vslprintf (char *buf, size_t len, const char *format, va_list ap)
 
PHPAPI int ap_php_snprintf (char *buf, size_t len, const char *format,...)
 
PHPAPI int ap_php_vsnprintf (char *buf, size_t len, const char *format, va_list ap)
 
PHPAPI int ap_php_vasprintf (char **buf, const char *format, va_list ap)
 
PHPAPI int ap_php_asprintf (char **buf, const char *format,...)
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 18 of file snprintf.c.

◆ EXPONENT_LENGTH

#define EXPONENT_LENGTH   10

Definition at line 197 of file snprintf.c.

◆ FIX_PRECISION

#define FIX_PRECISION ( adjust,
precision,
s,
s_len )
Value:
if ( adjust ) \
while ( s_len < (size_t)precision ) \
{ \
*--s = '0' ; \
s_len++ ; \
}
char s[4]
Definition cdf.c:77

Definition at line 451 of file snprintf.c.

◆ FLOAT_DIGITS

#define FLOAT_DIGITS   6

Definition at line 196 of file snprintf.c.

◆ INS_CHAR

#define INS_CHAR ( c,
sp,
bep,
cc )
Value:
{ \
if (sp < bep) \
{ \
*sp++ = c; \
} \
cc++; \
}

Definition at line 426 of file snprintf.c.

◆ INT_NULL

#define INT_NULL   ((int *)0)

Definition at line 191 of file snprintf.c.

◆ LCONV_DECIMAL_POINT

#define LCONV_DECIMAL_POINT   (*lconv->decimal_point)

Definition at line 39 of file snprintf.c.

◆ NDIG

#define NDIG   320

Definition at line 261 of file snprintf.c.

◆ NUL

#define NUL   '\0'

Definition at line 190 of file snprintf.c.

◆ NUM

#define NUM ( c)
Value:
( c - '0' )

Definition at line 435 of file snprintf.c.

◆ NUM_BUF_SIZE

#define NUM_BUF_SIZE   2048

Definition at line 403 of file snprintf.c.

◆ PAD

#define PAD ( width,
len,
ch )
Value:
do \
{ \
INS_CHAR( ch, sp, bep, cc ) ; \
width-- ; \
} \
while ( (size_t)width > len )
size_t len
Definition apprentice.c:174
zend_long ch
Definition ffi.c:4580

Definition at line 463 of file snprintf.c.

◆ S_NULL

#define S_NULL   "(null)"

Definition at line 193 of file snprintf.c.

◆ S_NULL_LEN

#define S_NULL_LEN   6

Definition at line 194 of file snprintf.c.

◆ STR_TO_DEC

#define STR_TO_DEC ( str,
num )
Value:
num = NUM( *str++ ) ; \
while ( isdigit((int)*str ) ) \
{ \
num *= 10 ; \
num += NUM( *str++ ) ; \
}
#define NUM(c)
Definition snprintf.c:435

Definition at line 437 of file snprintf.c.

Typedef Documentation

◆ buffy

typedef struct buf_area buffy

Definition at line 414 of file snprintf.c.

Function Documentation

◆ ap_php_asprintf()

PHPAPI int ap_php_asprintf ( char ** buf,
const char * format,
... )

Definition at line 1172 of file snprintf.c.

◆ ap_php_conv_10()

PHPAPI char * ap_php_conv_10 ( int64_t num,
bool is_unsigned,
bool * is_negative,
char * buf_end,
size_t * len )

Definition at line 213 of file snprintf.c.

◆ ap_php_conv_p2()

PHPAPI char * ap_php_conv_p2 ( uint64_t num,
int nbits,
char format,
char * buf_end,
size_t * len )

Definition at line 376 of file snprintf.c.

◆ ap_php_slprintf()

PHPAPI int ap_php_slprintf ( char * buf,
size_t len,
const char * format,
... )

Definition at line 1102 of file snprintf.c.

◆ ap_php_snprintf()

PHPAPI int ap_php_snprintf ( char * buf,
size_t len,
const char * format,
... )

Definition at line 1129 of file snprintf.c.

◆ ap_php_vasprintf()

PHPAPI int ap_php_vasprintf ( char ** buf,
const char * format,
va_list ap )

Definition at line 1148 of file snprintf.c.

◆ ap_php_vslprintf()

PHPAPI int ap_php_vslprintf ( char * buf,
size_t len,
const char * format,
va_list ap )

Definition at line 1118 of file snprintf.c.

◆ ap_php_vsnprintf()

PHPAPI int ap_php_vsnprintf ( char * buf,
size_t len,
const char * format,
va_list ap )

Definition at line 1141 of file snprintf.c.

◆ php_conv_fp()

PHPAPI char * php_conv_fp ( char format,
double num,
bool add_dp,
int precision,
char dec_point,
bool * is_negative,
char * buf,
size_t * len )

Definition at line 271 of file snprintf.c.