#include "mruby.h"
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include "mruby/hash.h"
#include "mruby/numeric.h"
#include <math.h>
#include <ctype.h>
Go to the source code of this file.
Macro Definition Documentation
#define BIT_DIGITS |
( |
|
N | ) |
(((N)*146)/485 + 1) /* log2(10) =~ 146/485 */ |
#define BITSPERDIG (sizeof(mrb_int)*CHAR_BIT) |
Value:do {\
\
while (blen + (l) >= bsiz) {\
bsiz*=2;\
}\
mrb_str_resize(mrb, result, bsiz);\
\
} while (0)
Definition at line 124 of file sprintf.c.
#define CHECK_FOR_FLAGS |
( |
|
f | ) |
|
#define CHECK_FOR_WIDTH |
( |
|
f | ) |
|
#define EXTENDSIGN |
( |
|
n, |
|
|
|
l |
|
) |
| (((~0 << (n)) >> (((n)*(l)) % BITSPERDIG)) & ~(~0 << (n))) |
Value:do { \
CHECK(l);\
memset(&buf[blen], c, l);\
blen += (l);\
} while (0)
Definition at line 140 of file sprintf.c.
Value:
posarg == -1 ? \
posarg == -2 ? \
Definition at line 146 of file sprintf.c.
Value:do { \
t = p++; \
n = 0; \
GETNUM(n, val); \
if (*p == '$') { \
} \
else { \
p = t; \
} \
} while (0)
Definition at line 183 of file sprintf.c.
#define GETNAMEARG |
( |
|
id, |
|
|
|
name, |
|
|
|
len |
|
) |
| |
Value:( \
posarg > 0 ? \
posarg == -1 ? \
(posarg = -2,
mrb_hash_fetch(mrb, get_hash(mrb, &hash, argc, argv),
id, mrb_undef_value())))
Definition at line 164 of file sprintf.c.
#define GETNTHARG |
( |
|
nth | ) |
((nth >= argc) ? (mrb_raise(mrb, E_ARGUMENT_ERROR, "too few arguments"), mrb_undef_value()) : argv[nth]) |
#define GETNUM |
( |
|
n, |
|
|
|
val |
|
) |
| |
Value:for (; p < end &&
ISDIGIT(*p); p++) {\
int next_n = 10 * n + (*p - '0'); \
if (next_n / 10 != n) {\
} \
n = next_n; \
} \
if (p >= end) { \
}
Definition at line 171 of file sprintf.c.
Value:(posarg > 0 ? \
(
mrb_raisef(mrb,
E_ARGUMENT_ERROR,
"numbered(%S) after unnumbered(%S)", mrb_fixnum_value(n), mrb_fixnum_value(posarg)), mrb_undef_value()) : \
posarg == -2 ? \
((n < 1) ? \
Definition at line 153 of file sprintf.c.
Value:do { \
CHECK(l);\
memcpy(&buf[blen], s, l);\
blen += (l);\
} while (0)
Definition at line 134 of file sprintf.c.
Function Documentation