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
|
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;
|
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
|
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;
|
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
|
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;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ pic_blob_value(pic_state *pic, const unsigned char *buf, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *
|
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) {
|
if (len) {
|
||||||
*len = pic_blob_ptr(pic, blob)->len;
|
*len = pic_blob_ptr(pic, blob)->len;
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
#if PIC_NAN_BOXING
|
#if PIC_NAN_BOXING
|
||||||
|
|
||||||
bool
|
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;
|
return x == y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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;
|
return x == y;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ pic_eqv_p(pic_state PIC_UNUSED(*pic), pic_value x, pic_value y)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
bool
|
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))
|
if (pic_type(pic, x) != pic_type(pic, y))
|
||||||
return false;
|
return false;
|
||||||
|
@ -38,7 +38,7 @@ pic_eq_p(pic_state PIC_UNUSED(*pic), pic_value x, pic_value y)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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))
|
if (pic_type(pic, x) != pic_type(pic, y))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -11,7 +11,7 @@ pic_data_p(pic_state *pic, pic_value obj, const pic_data_type *type)
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
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;
|
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
|
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);
|
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
|
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;
|
khash_t(dict) *h = &pic_dict_ptr(pic, dict)->hash;
|
||||||
int it = *iter;
|
int it = *iter;
|
||||||
|
|
|
@ -110,7 +110,7 @@ analyzer_scope_init(pic_state *pic, analyze_scope *scope, pic_value formal, anal
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 */
|
/* nothing here */
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,15 +40,15 @@ int xfclose(pic_state *pic, xFILE *fp) {
|
||||||
return fp->vtable.close(pic, fp->vtable.cookie);
|
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);
|
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;
|
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;
|
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;
|
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;
|
unsigned char uc = c;
|
||||||
|
|
||||||
if (c == EOF || fp->base == fp->ptr) {
|
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
|
#if PIC_ENABLE_STDIO
|
||||||
|
|
||||||
static int
|
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;
|
FILE *file = cookie;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ file_read(pic_state PIC_UNUSED(*pic), void *cookie, char *ptr, int size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
FILE *file = cookie;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ file_write(pic_state PIC_UNUSED(*pic), void *cookie, const char *ptr, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
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) {
|
switch (whence) {
|
||||||
case XSEEK_CUR:
|
case XSEEK_CUR:
|
||||||
whence = SEEK_CUR;
|
whence = SEEK_CUR;
|
||||||
|
@ -416,7 +416,7 @@ file_seek(pic_state PIC_UNUSED(*pic), void *cookie, long pos, int whence) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
file_close(pic_state PIC_UNUSED(*pic), void *cookie) {
|
file_close(pic_state *PIC_UNUSED(pic), void *cookie) {
|
||||||
return fclose(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;
|
typedef struct { char *buf; long pos, end, capa; } xbuf_t;
|
||||||
|
|
||||||
static int
|
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;
|
xbuf_t *m = cookie;
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ string_write(pic_state *pic, void *cookie, const char *ptr, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
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;
|
xbuf_t *m = cookie;
|
||||||
|
|
||||||
|
@ -529,26 +529,26 @@ int xfget_buf(pic_state *pic, xFILE *file, const char **buf, int *len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
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) {
|
switch (*mode) {
|
||||||
case 'r':
|
case 'r':
|
||||||
return xfunopen(pic, 0, null_read, 0, null_seek, null_close);
|
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
|
#if PIC_ENABLE_LIBC
|
||||||
void *
|
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) {
|
if (size != 0) {
|
||||||
return realloc(ptr, size);
|
return realloc(ptr, size);
|
||||||
|
|
|
@ -138,7 +138,9 @@ typedef unsigned long uint32_t;
|
||||||
|
|
||||||
#define PIC_FALLTHROUGH ((void)0)
|
#define PIC_FALLTHROUGH ((void)0)
|
||||||
|
|
||||||
#if __GNUC__ || __clang__
|
#if __cplusplus
|
||||||
|
# define PIC_UNUSED(v)
|
||||||
|
#elif __GNUC__ || __clang__
|
||||||
# define PIC_UNUSED(v) __attribute__((unused)) v
|
# define PIC_UNUSED(v) __attribute__((unused)) v
|
||||||
#else
|
#else
|
||||||
# define PIC_UNUSED(v) v
|
# define PIC_UNUSED(v) v
|
||||||
|
|
|
@ -22,7 +22,7 @@ pic_open_port(pic_state *pic, xFILE *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
xFILE *
|
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;
|
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
|
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++;
|
irep->refc++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ case_fold(int c, struct reader_control *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
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 {
|
do {
|
||||||
c = next(pic, file);
|
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
|
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 x, y;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
@ -240,7 +240,7 @@ read_symbol(pic_state *pic, xFILE *file, int c, struct reader_control *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
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;
|
unsigned u = 0;
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ read_uinteger(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUS
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
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)
|
#define ATOF_BUF_SIZE (64)
|
||||||
char buf[ATOF_BUF_SIZE];
|
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
|
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 ((c = peek(pic, file)) == 'r') {
|
||||||
if (! expect(pic, file, "rue")) {
|
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
|
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 ((c = peek(pic, file)) == 'a') {
|
||||||
if (! expect(pic, file, "alse")) {
|
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
|
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);
|
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
|
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;
|
char *buf;
|
||||||
int size, cnt;
|
int size, cnt;
|
||||||
|
@ -468,7 +468,7 @@ read_string(pic_state *pic, xFILE *file, int c, struct reader_control PIC_UNUSED
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
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;
|
char *buf;
|
||||||
int size, cnt;
|
int size, cnt;
|
||||||
|
@ -678,7 +678,7 @@ read_label_set(pic_state *pic, xFILE *file, int i, struct reader_control *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
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;
|
khash_t(read) *h = &p->labels;
|
||||||
int it;
|
int it;
|
||||||
|
@ -710,7 +710,7 @@ read_label(pic_state *pic, xFILE *file, int c, struct reader_control *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
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));
|
read_error(pic, "unmatched parenthesis", pic_nil_value(pic));
|
||||||
}
|
}
|
||||||
|
@ -816,7 +816,7 @@ reader_table_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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;
|
p->typecase = CASE_DEFAULT;
|
||||||
kh_init(read, &p->labels);
|
kh_init(read, &p->labels);
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct pic_rope {
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
void
|
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++;
|
x->refcnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ pic_str_value(pic_state *pic, const char *str, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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);
|
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_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);
|
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)))
|
#define pic_init_value(v,vtype) (v = (0xfff0000000000000ul | ((uint64_t)(vtype) << 48)))
|
||||||
|
|
||||||
int
|
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);
|
return 0xfff0 >= (v >> 48) ? PIC_TYPE_FLOAT : ((v >> 48) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
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;
|
union { double f; uint64_t i; } u;
|
||||||
u.i = v;
|
u.i = v;
|
||||||
|
@ -32,7 +32,7 @@ pic_float(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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;
|
union { int i; unsigned u; } u;
|
||||||
u.u = v & 0xfffffffful;
|
u.u = v & 0xfffffffful;
|
||||||
|
@ -40,7 +40,7 @@ pic_int(pic_state PIC_UNUSED(*pic), pic_value v)
|
||||||
}
|
}
|
||||||
|
|
||||||
char
|
char
|
||||||
pic_char(pic_state PIC_UNUSED(*pic), pic_value v)
|
pic_char(pic_state *PIC_UNUSED(pic), pic_value v)
|
||||||
{
|
{
|
||||||
return v & 0xfffffffful;
|
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)
|
#define pic_init_value(v,vtype) ((v).type = (vtype), (v).u.data = NULL)
|
||||||
|
|
||||||
int
|
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);
|
return (int)(v.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
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;
|
return v.u.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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;
|
return v.u.i;
|
||||||
}
|
}
|
||||||
|
|
||||||
char
|
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;
|
return v.u.c;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ pic_obj_value(void *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
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;
|
union { double f; uint64_t i; } u;
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ pic_float_value(pic_state PIC_UNUSED(*pic), double f)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
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;
|
pic_value v;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ pic_int_value(pic_state PIC_UNUSED(*pic), int i)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
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;
|
pic_value v;
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ pic_obj_value(void *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
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;
|
pic_value v;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ pic_float_value(pic_state PIC_UNUSED(*pic), double f)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
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;
|
pic_value v;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ pic_int_value(pic_state PIC_UNUSED(*pic), int i)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
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;
|
pic_value v;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ pic_char_value(pic_state PIC_UNUSED(*pic), char c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEFVAL(name, type) \
|
#define DEFVAL(name, type) \
|
||||||
pic_value name(pic_state PIC_UNUSED(*pic)) { \
|
pic_value name(pic_state *PIC_UNUSED(pic)) { \
|
||||||
pic_value v; \
|
pic_value v; \
|
||||||
pic_init_value(v, type); \
|
pic_init_value(v, type); \
|
||||||
return v; \
|
return v; \
|
||||||
|
@ -191,7 +191,7 @@ DEFVAL(pic_undef_value, PIC_TYPE_UNDEF)
|
||||||
DEFVAL(pic_invalid_value, PIC_TYPE_INVALID)
|
DEFVAL(pic_invalid_value, PIC_TYPE_INVALID)
|
||||||
|
|
||||||
int
|
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);
|
int tt = pic_vtype(pic, v);
|
||||||
|
|
||||||
|
|
|
@ -26,19 +26,19 @@ pic_make_vec(pic_state *pic, int len, pic_value *argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
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];
|
return pic_vec_ptr(pic, vec)->data[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
pic_vec_ptr(pic, vec)->data[k] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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;
|
return pic_vec_ptr(pic, vec)->len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue