C++ mode of PIC_UNUSED
This commit is contained in:
parent
f8b05efa7f
commit
2a0a7be40d
|
@ -262,7 +262,7 @@ pic_socket_socket_close(pic_state *pic)
|
|||
}
|
||||
|
||||
static int
|
||||
xf_socket_read(pic_state PIC_UNUSED(*pic), void *cookie, char *ptr, int size)
|
||||
xf_socket_read(pic_state *PIC_UNUSED(pic), void *cookie, char *ptr, int size)
|
||||
{
|
||||
struct pic_socket_t *sock;
|
||||
|
||||
|
@ -272,7 +272,7 @@ xf_socket_read(pic_state PIC_UNUSED(*pic), void *cookie, char *ptr, int size)
|
|||
}
|
||||
|
||||
static int
|
||||
xf_socket_write(pic_state PIC_UNUSED(*pic), void *cookie, const char *ptr, int size)
|
||||
xf_socket_write(pic_state *PIC_UNUSED(pic), void *cookie, const char *ptr, int size)
|
||||
{
|
||||
struct pic_socket_t *sock;
|
||||
|
||||
|
@ -282,14 +282,14 @@ xf_socket_write(pic_state PIC_UNUSED(*pic), void *cookie, const char *ptr, int s
|
|||
}
|
||||
|
||||
static long
|
||||
xf_socket_seek(pic_state PIC_UNUSED(*pic), void PIC_UNUSED(*cookie), long PIC_UNUSED(pos), int PIC_UNUSED(whence))
|
||||
xf_socket_seek(pic_state *PIC_UNUSED(pic), void *PIC_UNUSED(cookie), long PIC_UNUSED(pos), int PIC_UNUSED(whence))
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
xf_socket_close(pic_state PIC_UNUSED(*pic), void PIC_UNUSED(*cookie))
|
||||
xf_socket_close(pic_state *PIC_UNUSED(pic), void *PIC_UNUSED(cookie))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ pic_blob_value(pic_state *pic, const unsigned char *buf, int len)
|
|||
}
|
||||
|
||||
unsigned char *
|
||||
pic_blob(pic_state PIC_UNUSED(*pic), pic_value blob, int *len)
|
||||
pic_blob(pic_state *PIC_UNUSED(pic), pic_value blob, int *len)
|
||||
{
|
||||
if (len) {
|
||||
*len = pic_blob_ptr(pic, blob)->len;
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
#if PIC_NAN_BOXING
|
||||
|
||||
bool
|
||||
pic_eq_p(pic_state PIC_UNUSED(*pic), pic_value x, pic_value y)
|
||||
pic_eq_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)
|
||||
{
|
||||
return x == y;
|
||||
}
|
||||
|
||||
bool
|
||||
pic_eqv_p(pic_state PIC_UNUSED(*pic), pic_value x, pic_value y)
|
||||
pic_eqv_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)
|
||||
{
|
||||
return x == y;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ pic_eqv_p(pic_state PIC_UNUSED(*pic), pic_value x, pic_value y)
|
|||
#else
|
||||
|
||||
bool
|
||||
pic_eq_p(pic_state PIC_UNUSED(*pic), pic_value x, pic_value y)
|
||||
pic_eq_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)
|
||||
{
|
||||
if (pic_type(pic, x) != pic_type(pic, y))
|
||||
return false;
|
||||
|
@ -38,7 +38,7 @@ pic_eq_p(pic_state PIC_UNUSED(*pic), pic_value x, pic_value y)
|
|||
}
|
||||
|
||||
bool
|
||||
pic_eqv_p(pic_state PIC_UNUSED(*pic), pic_value x, pic_value y)
|
||||
pic_eqv_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)
|
||||
{
|
||||
if (pic_type(pic, x) != pic_type(pic, y))
|
||||
return false;
|
||||
|
|
|
@ -11,7 +11,7 @@ pic_data_p(pic_state *pic, pic_value obj, const pic_data_type *type)
|
|||
}
|
||||
|
||||
void *
|
||||
pic_data(pic_state PIC_UNUSED(*pic), pic_value data)
|
||||
pic_data(pic_state *PIC_UNUSED(pic), pic_value data)
|
||||
{
|
||||
return pic_data_ptr(pic, data)->data;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ pic_dict_set(pic_state *pic, pic_value dict, pic_value key, pic_value val)
|
|||
}
|
||||
|
||||
int
|
||||
pic_dict_size(pic_state PIC_UNUSED(*pic), pic_value dict)
|
||||
pic_dict_size(pic_state *PIC_UNUSED(pic), pic_value dict)
|
||||
{
|
||||
return kh_size(&pic_dict_ptr(pic, dict)->hash);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ pic_dict_del(pic_state *pic, pic_value dict, pic_value key)
|
|||
}
|
||||
|
||||
bool
|
||||
pic_dict_next(pic_state PIC_UNUSED(*pic), pic_value dict, int *iter, pic_value *key, pic_value *val)
|
||||
pic_dict_next(pic_state *PIC_UNUSED(pic), pic_value dict, int *iter, pic_value *key, pic_value *val)
|
||||
{
|
||||
khash_t(dict) *h = &pic_dict_ptr(pic, dict)->hash;
|
||||
int it = *iter;
|
||||
|
|
|
@ -110,7 +110,7 @@ analyzer_scope_init(pic_state *pic, analyze_scope *scope, pic_value formal, anal
|
|||
}
|
||||
|
||||
static void
|
||||
analyzer_scope_destroy(pic_state PIC_UNUSED(*pic), analyze_scope PIC_UNUSED(*scope))
|
||||
analyzer_scope_destroy(pic_state *PIC_UNUSED(pic), analyze_scope *PIC_UNUSED(scope))
|
||||
{
|
||||
/* nothing here */
|
||||
}
|
||||
|
|
|
@ -40,15 +40,15 @@ int xfclose(pic_state *pic, xFILE *fp) {
|
|||
return fp->vtable.close(pic, fp->vtable.cookie);
|
||||
}
|
||||
|
||||
void xclearerr(pic_state PIC_UNUSED(*pic), xFILE *fp) {
|
||||
void xclearerr(pic_state *PIC_UNUSED(pic), xFILE *fp) {
|
||||
fp->flag &= ~(X_EOF | X_ERR);
|
||||
}
|
||||
|
||||
int xfeof(pic_state PIC_UNUSED(*pic), xFILE *fp) {
|
||||
int xfeof(pic_state *PIC_UNUSED(pic), xFILE *fp) {
|
||||
return (fp->flag & X_EOF) != 0;
|
||||
}
|
||||
|
||||
int xferror(pic_state PIC_UNUSED(*pic), xFILE *fp) {
|
||||
int xferror(pic_state *PIC_UNUSED(pic), xFILE *fp) {
|
||||
return (fp->flag & X_ERR) != 0;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ char *xfgets(pic_state *pic, char *s, int size, xFILE *stream) {
|
|||
return (c == EOF && buf == s) ? NULL : s;
|
||||
}
|
||||
|
||||
int xungetc(pic_state PIC_UNUSED(*pic), int c, xFILE *fp) {
|
||||
int xungetc(pic_state *PIC_UNUSED(pic), int c, xFILE *fp) {
|
||||
unsigned char uc = c;
|
||||
|
||||
if (c == EOF || fp->base == fp->ptr) {
|
||||
|
@ -367,7 +367,7 @@ xFILE *xfile_xstderr(pic_state *pic) { return &pic->files[2]; }
|
|||
#if PIC_ENABLE_STDIO
|
||||
|
||||
static int
|
||||
file_read(pic_state PIC_UNUSED(*pic), void *cookie, char *ptr, int size) {
|
||||
file_read(pic_state *PIC_UNUSED(pic), void *cookie, char *ptr, int size) {
|
||||
FILE *file = cookie;
|
||||
int r;
|
||||
|
||||
|
@ -384,7 +384,7 @@ file_read(pic_state PIC_UNUSED(*pic), void *cookie, char *ptr, int size) {
|
|||
}
|
||||
|
||||
static int
|
||||
file_write(pic_state PIC_UNUSED(*pic), void *cookie, const char *ptr, int size) {
|
||||
file_write(pic_state *PIC_UNUSED(pic), void *cookie, const char *ptr, int size) {
|
||||
FILE *file = cookie;
|
||||
int r;
|
||||
|
||||
|
@ -397,7 +397,7 @@ file_write(pic_state PIC_UNUSED(*pic), void *cookie, const char *ptr, int size)
|
|||
}
|
||||
|
||||
static long
|
||||
file_seek(pic_state PIC_UNUSED(*pic), void *cookie, long pos, int whence) {
|
||||
file_seek(pic_state *PIC_UNUSED(pic), void *cookie, long pos, int whence) {
|
||||
switch (whence) {
|
||||
case XSEEK_CUR:
|
||||
whence = SEEK_CUR;
|
||||
|
@ -416,7 +416,7 @@ file_seek(pic_state PIC_UNUSED(*pic), void *cookie, long pos, int whence) {
|
|||
}
|
||||
|
||||
static int
|
||||
file_close(pic_state PIC_UNUSED(*pic), void *cookie) {
|
||||
file_close(pic_state *PIC_UNUSED(pic), void *cookie) {
|
||||
return fclose(cookie);
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@ xFILE *xfopen_file(pic_state *pic, FILE *fp, const char *mode) {
|
|||
typedef struct { char *buf; long pos, end, capa; } xbuf_t;
|
||||
|
||||
static int
|
||||
string_read(pic_state PIC_UNUSED(*pic), void *cookie, char *ptr, int size)
|
||||
string_read(pic_state *PIC_UNUSED(pic), void *cookie, char *ptr, int size)
|
||||
{
|
||||
xbuf_t *m = cookie;
|
||||
|
||||
|
@ -463,7 +463,7 @@ string_write(pic_state *pic, void *cookie, const char *ptr, int size)
|
|||
}
|
||||
|
||||
static long
|
||||
string_seek(pic_state PIC_UNUSED(*pic), void *cookie, long pos, int whence)
|
||||
string_seek(pic_state *PIC_UNUSED(pic), void *cookie, long pos, int whence)
|
||||
{
|
||||
xbuf_t *m = cookie;
|
||||
|
||||
|
@ -529,26 +529,26 @@ int xfget_buf(pic_state *pic, xFILE *file, const char **buf, int *len) {
|
|||
}
|
||||
|
||||
static int
|
||||
null_read(pic_state PIC_UNUSED(*pic), void PIC_UNUSED(*cookie), char PIC_UNUSED(*ptr), int PIC_UNUSED(size)) {
|
||||
null_read(pic_state *PIC_UNUSED(pic), void *PIC_UNUSED(cookie), char *PIC_UNUSED(ptr), int PIC_UNUSED(size)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
null_write(pic_state PIC_UNUSED(*pic), void PIC_UNUSED(*cookie), const char PIC_UNUSED(*ptr), int size) {
|
||||
null_write(pic_state *PIC_UNUSED(pic), void *PIC_UNUSED(cookie), const char *PIC_UNUSED(ptr), int size) {
|
||||
return size;
|
||||
}
|
||||
|
||||
static long
|
||||
null_seek(pic_state PIC_UNUSED(*pic), void PIC_UNUSED(*cookie), long PIC_UNUSED(pos), int PIC_UNUSED(whence)) {
|
||||
null_seek(pic_state *PIC_UNUSED(pic), void *PIC_UNUSED(cookie), long PIC_UNUSED(pos), int PIC_UNUSED(whence)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
null_close(pic_state PIC_UNUSED(*pic), void PIC_UNUSED(*cookie)) {
|
||||
null_close(pic_state *PIC_UNUSED(pic), void *PIC_UNUSED(cookie)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
xFILE *xfopen_null(pic_state PIC_UNUSED(*pic), const char *mode) {
|
||||
xFILE *xfopen_null(pic_state *PIC_UNUSED(pic), const char *mode) {
|
||||
switch (*mode) {
|
||||
case 'r':
|
||||
return xfunopen(pic, 0, null_read, 0, null_seek, null_close);
|
||||
|
|
|
@ -84,7 +84,7 @@ pic_heap_close(pic_state *pic, struct pic_heap *heap)
|
|||
|
||||
#if PIC_ENABLE_LIBC
|
||||
void *
|
||||
pic_default_allocf(void PIC_UNUSED(*userdata), void *ptr, size_t size)
|
||||
pic_default_allocf(void *PIC_UNUSED(userdata), void *ptr, size_t size)
|
||||
{
|
||||
if (size != 0) {
|
||||
return realloc(ptr, size);
|
||||
|
|
|
@ -138,7 +138,9 @@ typedef unsigned long uint32_t;
|
|||
|
||||
#define PIC_FALLTHROUGH ((void)0)
|
||||
|
||||
#if __GNUC__ || __clang__
|
||||
#if __cplusplus
|
||||
# define PIC_UNUSED(v)
|
||||
#elif __GNUC__ || __clang__
|
||||
# define PIC_UNUSED(v) __attribute__((unused)) v
|
||||
#else
|
||||
# define PIC_UNUSED(v) v
|
||||
|
|
|
@ -22,7 +22,7 @@ pic_open_port(pic_state *pic, xFILE *file)
|
|||
}
|
||||
|
||||
xFILE *
|
||||
pic_fileno(pic_state PIC_UNUSED(*pic), pic_value port)
|
||||
pic_fileno(pic_state *PIC_UNUSED(pic), pic_value port)
|
||||
{
|
||||
return pic_port_ptr(pic, port)->file;
|
||||
}
|
||||
|
|
|
@ -1024,7 +1024,7 @@ pic_funcall(pic_state *pic, const char *lib, const char *name, int n, ...)
|
|||
}
|
||||
|
||||
void
|
||||
pic_irep_incref(pic_state PIC_UNUSED(*pic), struct pic_irep *irep)
|
||||
pic_irep_incref(pic_state *PIC_UNUSED(pic), struct pic_irep *irep)
|
||||
{
|
||||
irep->refc++;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ case_fold(int c, struct reader_control *p)
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_comment(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*p))
|
||||
read_comment(pic_state *pic, xFILE *file, int c, struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
do {
|
||||
c = next(pic, file);
|
||||
|
@ -111,7 +111,7 @@ read_comment(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSE
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_block_comment(pic_state *pic, xFILE *file, int PIC_UNUSED(c), struct reader_control PIC_UNUSED(*p))
|
||||
read_block_comment(pic_state *pic, xFILE *file, int PIC_UNUSED(c), struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
int x, y;
|
||||
int i = 1;
|
||||
|
@ -240,7 +240,7 @@ read_symbol(pic_state *pic, xFILE *file, int c, struct reader_control *p)
|
|||
}
|
||||
|
||||
static unsigned
|
||||
read_uinteger(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*p))
|
||||
read_uinteger(pic_state *pic, xFILE *file, int c, struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
unsigned u = 0;
|
||||
|
||||
|
@ -257,7 +257,7 @@ read_uinteger(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUS
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_unsigned(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*p))
|
||||
read_unsigned(pic_state *pic, xFILE *file, int c, struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
#define ATOF_BUF_SIZE (64)
|
||||
char buf[ATOF_BUF_SIZE];
|
||||
|
@ -370,7 +370,7 @@ read_plus(pic_state *pic, xFILE *file, int c, struct reader_control *p)
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_true(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*p))
|
||||
read_true(pic_state *pic, xFILE *file, int c, struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
if ((c = peek(pic, file)) == 'r') {
|
||||
if (! expect(pic, file, "rue")) {
|
||||
|
@ -384,7 +384,7 @@ read_true(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_false(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*p))
|
||||
read_false(pic_state *pic, xFILE *file, int c, struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
if ((c = peek(pic, file)) == 'a') {
|
||||
if (! expect(pic, file, "alse")) {
|
||||
|
@ -398,7 +398,7 @@ read_false(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_char(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*p))
|
||||
read_char(pic_state *pic, xFILE *file, int c, struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
c = next(pic, file);
|
||||
|
||||
|
@ -433,7 +433,7 @@ read_char(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_string(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*p))
|
||||
read_string(pic_state *pic, xFILE *file, int c, struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
char *buf;
|
||||
int size, cnt;
|
||||
|
@ -468,7 +468,7 @@ read_string(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_pipe(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED(*p))
|
||||
read_pipe(pic_state *pic, xFILE *file, int c, struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
char *buf;
|
||||
int size, cnt;
|
||||
|
@ -678,7 +678,7 @@ read_label_set(pic_state *pic, xFILE *file, int i, struct reader_control *p)
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_label_ref(pic_state *pic, xFILE PIC_UNUSED(*file), int i, struct reader_control *p)
|
||||
read_label_ref(pic_state *pic, xFILE *PIC_UNUSED(file), int i, struct reader_control *p)
|
||||
{
|
||||
khash_t(read) *h = &p->labels;
|
||||
int it;
|
||||
|
@ -710,7 +710,7 @@ read_label(pic_state *pic, xFILE *file, int c, struct reader_control *p)
|
|||
}
|
||||
|
||||
static pic_value
|
||||
read_unmatch(pic_state *pic, xFILE PIC_UNUSED(*file), int PIC_UNUSED(c), struct reader_control PIC_UNUSED(*p))
|
||||
read_unmatch(pic_state *pic, xFILE *PIC_UNUSED(file), int PIC_UNUSED(c), struct reader_control *PIC_UNUSED(p))
|
||||
{
|
||||
read_error(pic, "unmatched parenthesis", pic_nil_value(pic));
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ reader_table_init(void)
|
|||
}
|
||||
|
||||
static void
|
||||
reader_init(pic_state PIC_UNUSED(*pic), struct reader_control *p)
|
||||
reader_init(pic_state *PIC_UNUSED(pic), struct reader_control *p)
|
||||
{
|
||||
p->typecase = CASE_DEFAULT;
|
||||
kh_init(read, &p->labels);
|
||||
|
|
|
@ -33,7 +33,7 @@ struct pic_rope {
|
|||
} while (0)
|
||||
|
||||
void
|
||||
pic_rope_incref(pic_state PIC_UNUSED(*pic), struct pic_rope *x) {
|
||||
pic_rope_incref(pic_state *PIC_UNUSED(pic), struct pic_rope *x) {
|
||||
x->refcnt++;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ pic_str_value(pic_state *pic, const char *str, int len)
|
|||
}
|
||||
|
||||
int
|
||||
pic_str_len(pic_state PIC_UNUSED(*pic), pic_value str)
|
||||
pic_str_len(pic_state *PIC_UNUSED(pic), pic_value str)
|
||||
{
|
||||
return rope_len(pic_str_ptr(pic, str)->rope);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ pic_make_identifier(pic_state *pic, pic_value base, pic_value env)
|
|||
}
|
||||
|
||||
pic_value
|
||||
pic_sym_name(pic_state PIC_UNUSED(*pic), pic_value sym)
|
||||
pic_sym_name(pic_state *PIC_UNUSED(pic), pic_value sym)
|
||||
{
|
||||
return pic_obj_value(pic_sym_ptr(pic, sym)->u.str);
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#define pic_init_value(v,vtype) (v = (0xfff0000000000000ul | ((uint64_t)(vtype) << 48)))
|
||||
|
||||
int
|
||||
pic_vtype(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_vtype(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
return 0xfff0 >= (v >> 48) ? PIC_TYPE_FLOAT : ((v >> 48) & 0xf);
|
||||
}
|
||||
|
||||
double
|
||||
pic_float(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_float(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
union { double f; uint64_t i; } u;
|
||||
u.i = v;
|
||||
|
@ -32,7 +32,7 @@ pic_float(pic_state PIC_UNUSED(*pic), pic_value v)
|
|||
}
|
||||
|
||||
int
|
||||
pic_int(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_int(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
union { int i; unsigned u; } u;
|
||||
u.u = v & 0xfffffffful;
|
||||
|
@ -40,7 +40,7 @@ pic_int(pic_state PIC_UNUSED(*pic), pic_value v)
|
|||
}
|
||||
|
||||
char
|
||||
pic_char(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_char(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
return v & 0xfffffffful;
|
||||
}
|
||||
|
@ -56,25 +56,25 @@ pic_obj_ptr(pic_value v)
|
|||
#define pic_init_value(v,vtype) ((v).type = (vtype), (v).u.data = NULL)
|
||||
|
||||
int
|
||||
pic_vtype(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_vtype(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
return (int)(v.type);
|
||||
}
|
||||
|
||||
double
|
||||
pic_float(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_float(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
return v.u.f;
|
||||
}
|
||||
|
||||
int
|
||||
pic_int(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_int(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
return v.u.i;
|
||||
}
|
||||
|
||||
char
|
||||
pic_char(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_char(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
return v.u.c;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ pic_obj_value(void *ptr)
|
|||
}
|
||||
|
||||
pic_value
|
||||
pic_float_value(pic_state PIC_UNUSED(*pic), double f)
|
||||
pic_float_value(pic_state *PIC_UNUSED(pic), double f)
|
||||
{
|
||||
union { double f; uint64_t i; } u;
|
||||
|
||||
|
@ -113,7 +113,7 @@ pic_float_value(pic_state PIC_UNUSED(*pic), double f)
|
|||
}
|
||||
|
||||
pic_value
|
||||
pic_int_value(pic_state PIC_UNUSED(*pic), int i)
|
||||
pic_int_value(pic_state *PIC_UNUSED(pic), int i)
|
||||
{
|
||||
pic_value v;
|
||||
|
||||
|
@ -123,7 +123,7 @@ pic_int_value(pic_state PIC_UNUSED(*pic), int i)
|
|||
}
|
||||
|
||||
pic_value
|
||||
pic_char_value(pic_state PIC_UNUSED(*pic), char c)
|
||||
pic_char_value(pic_state *PIC_UNUSED(pic), char c)
|
||||
{
|
||||
pic_value v;
|
||||
|
||||
|
@ -145,7 +145,7 @@ pic_obj_value(void *ptr)
|
|||
}
|
||||
|
||||
pic_value
|
||||
pic_float_value(pic_state PIC_UNUSED(*pic), double f)
|
||||
pic_float_value(pic_state *PIC_UNUSED(pic), double f)
|
||||
{
|
||||
pic_value v;
|
||||
|
||||
|
@ -155,7 +155,7 @@ pic_float_value(pic_state PIC_UNUSED(*pic), double f)
|
|||
}
|
||||
|
||||
pic_value
|
||||
pic_int_value(pic_state PIC_UNUSED(*pic), int i)
|
||||
pic_int_value(pic_state *PIC_UNUSED(pic), int i)
|
||||
{
|
||||
pic_value v;
|
||||
|
||||
|
@ -165,7 +165,7 @@ pic_int_value(pic_state PIC_UNUSED(*pic), int i)
|
|||
}
|
||||
|
||||
pic_value
|
||||
pic_char_value(pic_state PIC_UNUSED(*pic), char c)
|
||||
pic_char_value(pic_state *PIC_UNUSED(pic), char c)
|
||||
{
|
||||
pic_value v;
|
||||
|
||||
|
@ -177,7 +177,7 @@ pic_char_value(pic_state PIC_UNUSED(*pic), char c)
|
|||
#endif
|
||||
|
||||
#define DEFVAL(name, type) \
|
||||
pic_value name(pic_state PIC_UNUSED(*pic)) { \
|
||||
pic_value name(pic_state *PIC_UNUSED(pic)) { \
|
||||
pic_value v; \
|
||||
pic_init_value(v, type); \
|
||||
return v; \
|
||||
|
@ -191,7 +191,7 @@ DEFVAL(pic_undef_value, PIC_TYPE_UNDEF)
|
|||
DEFVAL(pic_invalid_value, PIC_TYPE_INVALID)
|
||||
|
||||
int
|
||||
pic_type(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||
pic_type(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||
{
|
||||
int tt = pic_vtype(pic, v);
|
||||
|
||||
|
|
|
@ -26,19 +26,19 @@ pic_make_vec(pic_state *pic, int len, pic_value *argv)
|
|||
}
|
||||
|
||||
pic_value
|
||||
pic_vec_ref(pic_state PIC_UNUSED(*pic), pic_value vec, int k)
|
||||
pic_vec_ref(pic_state *PIC_UNUSED(pic), pic_value vec, int k)
|
||||
{
|
||||
return pic_vec_ptr(pic, vec)->data[k];
|
||||
}
|
||||
|
||||
void
|
||||
pic_vec_set(pic_state PIC_UNUSED(*pic), pic_value vec, int k, pic_value val)
|
||||
pic_vec_set(pic_state *PIC_UNUSED(pic), pic_value vec, int k, pic_value val)
|
||||
{
|
||||
pic_vec_ptr(pic, vec)->data[k] = val;
|
||||
}
|
||||
|
||||
int
|
||||
pic_vec_len(pic_state PIC_UNUSED(*pic), pic_value vec)
|
||||
pic_vec_len(pic_state *PIC_UNUSED(pic), pic_value vec)
|
||||
{
|
||||
return pic_vec_ptr(pic, vec)->len;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue