File: jig.h

package info (click to toggle)
entity 0.7.2-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,352 kB
  • ctags: 5,272
  • sloc: ansic: 61,707; sh: 7,921; makefile: 732; perl: 399
file content (136 lines) | stat: -rw-r--r-- 3,209 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
 * Utility routines for JIG-generated files
 * Copyright (c) 2000 Cylant Technology, LLC
 *
 * Author: Brian Bassett <bbassett@bbassett.net>
 */

/*
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA
 */

/*
 * $Source: /home/cvs/entity/libentitynjs/njs/jig.h,v $
 * $Id: jig.h,v 1.3 2000/07/25 05:26:06 imain Exp $
 */

#ifndef JIG_H
#define JIG_H

#include <njs/internal.h>

#ifdef __cplusplus
extern "C"
{
#endif

/*
 * js_return Return Macros
 */

#define js_return_any(retval)		\
  do {					\
    JS_COPY (js_retval, retval);	\
    goto js_done;			\
  } while (0)

#define js_return_null			\
  do {					\
    js_retval->type = JS_NULL;		\
    goto js_done;			\
  } while (0)

#define js_return_undef			\
  do {					\
    js_retval->type = JS_UNDEFINED;	\
    goto js_done;			\
  } while (0)

#define js_return_boolean(retval)	\
  do {					\
    js_retval->type = JS_BOOLEAN;	\
    js_retval->u.vboolean = retval;	\
    goto js_done;			\
  } while (0)

#define js_return_float(retval) 	\
  do {					\
    js_retval->type = JS_FLOAT;		\
    js_retval->u.vfloat = retval;	\
    goto js_done;			\
  } while (0)

#define js_return_int(retval)		\
  do {					\
    js_retval->type = JS_INTEGER;	\
    js_retval->u.vinteger = retval;	\
    goto js_done;			\
  } while (0)

#define js_return_nan			\
  do {					\
    js_retval->type = JS_NAN;		\
    goto js_done;			\
  } while (0)

#define js_return_jsstring(retval)					\
  do {									\
    js_retval->type = JS_STRING;					\
    js_retval->u.vstring = retval;					\
    goto js_done;							\
  } while (0)
#define js_return_cstring(retval)					\
  do {									\
    js_vm_make_string (js_vm, js_retval, retval, strlen(retval));	\
    goto js_done;							\
  } while (0)
#define js_return_cstring_static(retval)				\
  do {									\
    js_vm_make_static_string (js_vm, js_retval, retval, strlen(retval));\
    goto js_done;							\
  } while (0)

#define js_return_object(retval)	\
  do {					\
    js_retval->type = JS_OBJECT;	\
    js_retval->u.vobject = retval;	\
    goto js_done;			\
  } while (0)

#define js_return_array(retval)		\
  do {					\
    js_retval->type = JS_ARRAY;		\
    js_retval->u.varray = retval;	\
    goto js_done;			\
  } while (0)

/*
 * jig error messgaes
 */
#define JIG_ERROR(errmsg)						\
  do {									\
    js_vm_set_err (js_vm, "%s(): " errmsg, js_vm_symname(js_method));	\
    js_vm_error (js_vm);						\
  } while (0)

#define JIG_UNDEFINED \
  return JS_PROPERTY_UNKNOWN

#ifdef __cplusplus
}
#endif

#endif /* not JIG_H */