33 #ifndef _NP_RUNTIME_H_
34 #define _NP_RUNTIME_H_
73 #define NP_BEGIN_MACRO do {
74 #define NP_END_MACRO } while (0)
123 #define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void)
124 #define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null)
125 #define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
126 #define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32)
127 #define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double)
128 #define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String)
129 #define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object)
131 #define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
132 #define NPVARIANT_TO_INT32(_v) ((_v).value.intValue)
133 #define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue)
134 #define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue)
135 #define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue)
137 #define VOID_TO_NPVARIANT(_v) \
139 (_v).type = NPVariantType_Void; \
140 (_v).value.objectValue = NULL; \
143 #define NULL_TO_NPVARIANT(_v) \
145 (_v).type = NPVariantType_Null; \
146 (_v).value.objectValue = NULL; \
149 #define BOOLEAN_TO_NPVARIANT(_val, _v) \
151 (_v).type = NPVariantType_Bool; \
152 (_v).value.boolValue = !!(_val); \
155 #define INT32_TO_NPVARIANT(_val, _v) \
157 (_v).type = NPVariantType_Int32; \
158 (_v).value.intValue = _val; \
161 #define DOUBLE_TO_NPVARIANT(_val, _v) \
163 (_v).type = NPVariantType_Double; \
164 (_v).value.doubleValue = _val; \
167 #define STRINGZ_TO_NPVARIANT(_val, _v) \
169 (_v).type = NPVariantType_String; \
170 NPString str = { _val, (uint32_t)(strlen(_val)) }; \
171 (_v).value.stringValue = str; \
174 #define STRINGN_TO_NPVARIANT(_val, _len, _v) \
176 (_v).type = NPVariantType_String; \
177 NPString str = { _val, (uint32_t)(_len) }; \
178 (_v).value.stringValue = str; \
181 #define OBJECT_TO_NPVARIANT(_val, _v) \
183 (_v).type = NPVariantType_Object; \
184 (_v).value.objectValue = _val; \
225 NPIdentifier *identifiers);
252 const NPVariant *args, uint32_t argCount,
312 #define NP_CLASS_STRUCT_VERSION 3
314 #define NP_CLASS_STRUCT_VERSION_ENUM 2
315 #define NP_CLASS_STRUCT_VERSION_CTOR 3
317 #define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass) \
318 ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM)
320 #define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass) \
321 ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR)