From a1a25cc57fe0b33129f57717d82e3954c3d14949 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Wed, 4 Sep 2024 20:23:47 +0800 Subject: [PATCH 1/6] complete cjson --- c/cjson/cjson.go | 674 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 598 insertions(+), 76 deletions(-) diff --git a/c/cjson/cjson.go b/c/cjson/cjson.go index af969e2d..179214e6 100644 --- a/c/cjson/cjson.go +++ b/c/cjson/cjson.go @@ -26,87 +26,25 @@ const ( LLGoPackage = "link: $(pkg-config --libs libcjson); -lcjson" ) +type JSON_bool c.Int + // llgo:type C type JSON struct { Unused [0]byte } -//go:linkname Parse C.cJSON_Parse -func Parse(value *c.Char) *JSON - -//go:linkname ParseWithLength C.cJSON_ParseWithLength -func ParseWithLength(value *byte, valueLength uintptr) *JSON - func ParseBytes(value []byte) *JSON { - return ParseWithLength(unsafe.SliceData(value), uintptr(len(value))) + return ParseWithLength((*c.Char)(unsafe.Pointer(&value[0])), uintptr(len(value))) } func ParseString(value string) *JSON { - return ParseWithLength(unsafe.StringData(value), uintptr(len(value))) + return ParseWithLength(c.AllocaCStr(value), uintptr(len(value))) } -//go:linkname Null C.cJSON_CreateNull -func Null() *JSON - -//go:linkname True C.cJSON_CreateTrue -func True() *JSON - -//go:linkname False C.cJSON_CreateFalse -func False() *JSON - -//go:linkname Bool C.cJSON_CreateBool -func Bool(boolean c.Int) *JSON - -//go:linkname Number C.cJSON_CreateNumber -func Number(num float64) *JSON - -//go:linkname String C.cJSON_CreateString -func String(str *c.Char) *JSON - -//go:linkname Array C.cJSON_CreateArray -func Array() *JSON - -//go:linkname Object C.cJSON_CreateObject -func Object() *JSON - -// raw json +// CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); // -//go:linkname Raw C.cJSON_CreateRaw -func Raw(raw *c.Char) *JSON - -// Create a string where valuestring references a string so -// it will not be freed by Delete +// Render a cJSON entity to text for transfer/storage without any formatting. // -//go:linkname StringRef C.cJSON_CreateStringReference -func StringRef(str *c.Char) *JSON - -// Create an object that only references it's elements so -// they will not be freed by Delete -// -//go:linkname ObjectRef C.cJSON_CreateObjectReference -func ObjectRef(child *JSON) *JSON - -// Create an array that only references it's elements so -// they will not be freed by Delete -// -//go:linkname ArrayRef C.cJSON_CreateArrayReference -func ArrayRef(child *JSON) *JSON - -// Delete a JSON entity and all subentities. -// -// llgo:link (*JSON).Delete C.cJSON_Delete -func (o *JSON) Delete() {} - -// Append item to the specified array. -// -// llgo:link (*JSON).AddItem C.cJSON_AddItemToArray -func (o *JSON) AddItem(item *JSON) c.Int { return 0 } - -// Append item to the specified object. -// -// llgo:link (*JSON).SetItem C.cJSON_AddItemToObject -func (o *JSON) SetItem(key *c.Char, item *JSON) c.Int { return 0 } - // llgo:link (*JSON).CStr C.cJSON_PrintUnformatted func (o *JSON) CStr() *c.Char { return nil } @@ -115,39 +53,623 @@ func (o *JSON) CStr() *c.Char { return nil } // llgo:link (*JSON).Cstr C.cJSON_PrintUnformatted func (o *JSON) Cstr() *c.Char { return nil } +// malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks +// +//go:linkname FreeCStr C.cJSON_free +func FreeCStr(*c.Char) + +// CJSON_PUBLIC(const char*) cJSON_Version(void); +// +// returns the version of cJSON as a string +// +//go:linkname Version C.cJSON_Version +func Version() *c.Char + +// CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); +// +// Memory Management: the caller is always responsible to free +// the results from all variants of cJSON_Parse (with cJSON_Delete) +// and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or +// cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, +// where the caller has full responsibility of the buffer. +// +//go:linkname Parse C.cJSON_Parse +func Parse(value *c.Char) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length); +// +// Memory Management: the caller is always responsible to free +// the results from all variants of cJSON_Parse (with cJSON_Delete) +// and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or +// cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, +// where the caller has full responsibility of the buffer. +// +//go:linkname ParseWithLength C.cJSON_ParseWithLength +func ParseWithLength(value *c.Char, valueLength uintptr) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); +// +// ParseWithOpts allows you to require (and check) that the JSON is null terminated, +// and to retrieve the pointer to the final byte parsed. +// If you supply a ptr in return_parse_end and parsing fails, then +// return_parse_end will contain a pointer to the error so will match +// cJSON_GetErrorPtr(). +// +//go:linkname ParseWithOpts C.cJSON_ParseWithOpts +func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated JSON_bool) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); +// +// ParseWithOpts allows you to require (and check) that the JSON is null terminated, +// and to retrieve the pointer to the final byte parsed. +// If you supply a ptr in return_parse_end and parsing fails, then +// return_parse_end will contain a pointer to the error so will match +// cJSON_GetErrorPtr(). +// +//go:linkname ParseWithLengthOpts C.cJSON_ParseWithLengthOpts +func ParseWithLengthOpts(value *c.Char, buffer_length uintptr, return_parse_end **c.Char, require_null_terminated JSON_bool) *JSON + +// CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); // Render a JSON entity to text for transfer/storage. // // llgo:link (*JSON).Print C.cJSON_Print func (o *JSON) Print() *c.Char { return nil } +// CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); // Render a JSON entity to text for transfer/storage without any formatting. // // llgo:link (*JSON).PrintUnformatted C.cJSON_PrintUnformatted func (o *JSON) PrintUnformatted() *c.Char { return nil } +// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); +// // Render a JSON entity to text using a buffered strategy. -// // prebuffer is a guess at the final size. guessing well reduces reallocation. -// // fmt=0 gives unformatted, =1 gives formatted. // // llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered -func (o *JSON) PrintBuffered(prebuffer c.Int, fmt c.Int) *c.Char { return nil } +func (o *JSON) PrintBuffered(prebuffer c.Int, fmt JSON_bool) *c.Char { return nil } -// llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive -func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON { return nil } +// CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); +// +// Render a cJSON entity to text using a buffer already allocated in memory with given +// length. Returns 1 on success and 0 on failure. +// NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, +// so to be safe allocate 5 bytes more than you actually need +// +// llgo:link (*JSON).PrintPreallocated C.cJSON_PrintPreallocated +func (o *JSON) PrintPreallocated(buffer *c.Char, length c.Int, format JSON_bool) JSON_bool { + return JSON_bool(0) +} +// CJSON_PUBLIC(void) cJSON_Delete(cJSON *item); +// Delete a JSON entity and all subentities. +// +// llgo:link (*JSON).Delete C.cJSON_Delete +func (o *JSON) Delete() {} + +// CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); +// +// Returns the number of items in an array (or object). +// // llgo:link (*JSON).GetArraySize C.cJSON_GetArraySize func (o *JSON) GetArraySize() c.Int { return 0 } +// CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index); +// +// Retrieve item number "index" from array "array". Returns NULL if unsuccessful. +// // llgo:link (*JSON).GetArrayItem C.cJSON_GetArrayItem func (o *JSON) GetArrayItem(index c.Int) *JSON { return nil } +// CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string); +// +// Get item "string" from object. Case insensitive. +// +// llgo:link (*JSON).GetObjectItem C.cJSON_GetObjectItem +func (o *JSON) GetObjectItem(s *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); +// +// Get item "string" from object. Case sensitive. +// +// llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive +func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string); +// +// llgo:link (*JSON).HasObjectItem C.cJSON_HasObjectItem +func (o *JSON) HasObjectItem(s *c.Char) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); +// +// For analysing failed parses. This returns a pointer to the parse error. +// You'll probably need to look a few chars back to make sense of it. +// Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. +// +//go:linkname GetErrorPtr C.cJSON_GetErrorPtr +func GetErrorPtr() *c.Char + +// CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item); +// +// Check item type and return its value +// // llgo:link (*JSON).GetStringValue C.cJSON_GetStringValue func (o *JSON) GetStringValue() *c.Char { return nil } +// CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item); +// +// Check item type and return its value +// +// llgo:link (*JSON).GetNumberValue C.cJSON_GetNumberValue +func (o *JSON) GetNumberValue() c.Double { return 0 } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsInvalid C.cJSON_IsInvalid +func (o *JSON) IsInvalid() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsFalse C.cJSON_IsFalse +func (o *JSON) IsFalse() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsTrue C.cJSON_IsTrue +func (o *JSON) IsTrue() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsBool C.cJSON_IsBool +func (o *JSON) IsBool() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsNull C.cJSON_IsNull +func (o *JSON) IsNull() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsNumber C.cJSON_IsNumber +func (o *JSON) IsNumber() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsString C.cJSON_IsString +func (o *JSON) IsString() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsArray C.cJSON_IsArray +func (o *JSON) IsArray() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsObject C.cJSON_IsObject +func (o *JSON) IsObject() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item); +// +// These functions check the type of an item +// +// llgo:link (*JSON).IsRaw C.cJSON_IsRaw +func (o *JSON) IsRaw() JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void); +// +// These calls create a cJSON item of the appropriate type. +// +//go:linkname Null C.cJSON_CreateNull +func Null() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void); +// +// same as Null func +// +//go:linkname CreateNull C.cJSON_CreateNull +func CreateNull() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void); +// +//go:linkname True C.cJSON_CreateTrue +func True() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void); +// +// same as True func +// +//go:linkname CreateTrue C.cJSON_CreateTrue +func CreateTrue() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void); +// +//go:linkname False C.cJSON_CreateFalse +func False() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void); +// +// same as False func +// +//go:linkname CreateFalse C.cJSON_CreateFalse +func CreateFalse() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); +// +//go:linkname Bool C.cJSON_CreateBool +func Bool(boolean c.Int) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); +// +// same as Bool func +// +//go:linkname CreateBool C.cJSON_CreateBool +func CreateBool(boolean c.Int) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num); +// +//go:linkname Number C.cJSON_CreateNumber +func Number(num float64) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num); +// +// same as Number func +// +//go:linkname CreateNumber C.cJSON_CreateNumber +func CreateNumber(num float64) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string); +// +//go:linkname String C.cJSON_CreateString +func String(str *c.Char) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string); +// +// same as String func +// +//go:linkname CreateString C.cJSON_CreateString +func CreateString(str *c.Char) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw); +// raw json +// +//go:linkname Raw C.cJSON_CreateRaw +func Raw(raw *c.Char) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw); +// +// same as Raw func +// +//go:linkname CreateRaw C.cJSON_CreateRaw +func CreateRaw(raw *c.Char) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void); +// +//go:linkname Array C.cJSON_CreateArray +func Array() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void); +// +// same as Array func +// +//go:linkname CreateArray C.cJSON_CreateArray +func CreateArray() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); +// +//go:linkname Object C.cJSON_CreateObject +func Object() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); +// +// same as Object func +// +//go:linkname CreateObject C.cJSON_CreateObject +func CreateObject() *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string); +// +// Create a string where valuestring references a string so +// it will not be freed by Delete +// +//go:linkname StringRef C.cJSON_CreateStringReference +func StringRef(str *c.Char) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string); +// +// same as StringRef func +// +//go:linkname CreateStringReference C.cJSON_CreateStringReference +func CreateStringReference(str *c.Char) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child); +// +// Create an object that only references it's elements so +// they will not be freed by Delete +// +//go:linkname ObjectRef C.cJSON_CreateObjectReference +func ObjectRef(child *JSON) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child); +// +// same as ObjectRef func +// +//go:linkname CreateObjectReference C.cJSON_CreateObjectReference +func CreateObjectReference(child *JSON) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); +// +// Create an array that only references it's elements so +// they will not be freed by Delete +// +//go:linkname ArrayRef C.cJSON_CreateArrayReference +func ArrayRef(child *JSON) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); +// +// same as ArrayRef func +// +//go:linkname CreateArrayReference C.cJSON_CreateArrayReference +func CreateArrayReference(child *JSON) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); +// +//go:linkname CreateIntArray C.cJSON_CreateIntArray +func CreateIntArray(numbers *c.Int, count c.Int) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count); +// +//go:linkname CreateFloatArray C.cJSON_CreateFloatArray +func CreateFloatArray(numbers *c.Float, count c.Int) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count); +// +//go:linkname CreateDoubleArray C.cJSON_CreateDoubleArray +func CreateDoubleArray(numbers *c.Double, count c.Int) *JSON + +// CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count); +// +//go:linkname CreateStringArray C.cJSON_CreateStringArray +func CreateStringArray(strings *c.Char, count c.Int) *JSON + +// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// +// Append item to the specified array. +// +// llgo:link (*JSON).AddItem C.cJSON_AddItemToArray +func (o *JSON) AddItem(item *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// +// same as AddItem func +// +// llgo:link (*JSON).AddItemToArray C.cJSON_AddItemToArray +func (o *JSON) AddItemToArray(item *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// +// Append item to the specified object. +// +// llgo:link (*JSON).SetItem C.cJSON_AddItemToObject +func (o *JSON) SetItem(key *c.Char, item *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// +// same as SetItem func +// +// llgo:link (*JSON).AddItemToObject C.cJSON_AddItemToObject +func (o *JSON) AddItemToObject(key *c.Char, item *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +// +// Use this when string is definitely const (i.e. a literal, or as good as), +// and will definitely survive the cJSON object. +// WARNING: When this function was used, make sure to always check that +// (item->type & cJSON_StringIsConst) is zero before writing to `item->string` +// +// llgo:link (*JSON).AddItemToObjectCS C.cJSON_AddItemToObjectCS +func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +// +// Append reference to item to the specified array/object. +// Use this when you want to add an existing cJSON to a new cJSON, +// but don't want to corrupt your existing cJSON. +// +// llgo:link (*JSON).AddItemReferenceToArray C.cJSON_AddItemReferenceToArray +func (o *JSON) AddItemReferenceToArray(item *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); +// +// llgo:link (*JSON).AddItemReferenceToObject C.cJSON_AddItemReferenceToObject +func (o *JSON) AddItemReferenceToObject(s *c.Char, item *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); +// +// Remove/Detach items from Arrays/Objects. +// +// llgo:link (*JSON).DetachItemViaPointer C.cJSON_DetachItemViaPointer +func (o *JSON) DetachItemViaPointer(item *JSON) *JSON { return nil } + +// CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which); +// +// llgo:link (*JSON).DetachItemFromArray C.cJSON_DetachItemFromArray +func (o *JSON) DetachItemFromArray(which c.Int) *JSON { return nil } + +// CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which); +// +// llgo:link (*JSON).DeleteItemFromArray C.cJSON_DeleteItemFromArray +func (o *JSON) DeleteItemFromArray(which c.Int) {} + +// CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string); +// +// llgo:link (*JSON).DetachItemFromObject C.cJSON_DetachItemFromObject +func (o *JSON) DetachItemFromObject(s *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); +// +// llgo:link (*JSON).DetachItemFromObjectCaseSensitive C.cJSON_DetachItemFromObjectCaseSensitive +func (o *JSON) DetachItemFromObjectCaseSensitive(s *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string); +// +// llgo:link (*JSON).DeleteItemFromObject C.cJSON_DeleteItemFromObject +func (o *JSON) DeleteItemFromObject(s *c.Char) {} + +// CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); +// +// llgo:link (*JSON).DeleteItemFromObjectCaseSensitive C.cJSON_DeleteItemFromObjectCaseSensitive +func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char) {} + +// CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); +// +// Update array items. +// Shifts pre-existing items to the right. +// +// llgo:link (*JSON).InsertItemInArray C.cJSON_InsertItemInArray +func (o *JSON) InsertItemInArray(which c.Int, newitem *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +// +// llgo:link (*JSON).ReplaceItemViaPointer C.cJSON_ReplaceItemViaPointer +func (o *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +// +// llgo:link (*JSON).ReplaceItemInArray C.cJSON_ReplaceItemInArray +func (o *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +// +// llgo:link (*JSON).ReplaceItemInObject C.cJSON_ReplaceItemInObject +func (o *JSON) ReplaceItemInObject(s *c.Char, newitem *JSON) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); +// +// llgo:link (*JSON).ReplaceItemInObjectCaseSensitive C.cJSON_ReplaceItemInObjectCaseSensitive +func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) JSON_bool { + return JSON_bool(0) +} + +// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); +// +// Duplicate a cJSON item +// +// Duplicate will create a new, identical cJSON item to the one you pass, +// in new memory that will need to be released. With recurse!=0, +// it will duplicate any children connected to the item. +// The item->next and ->prev pointers are always zero on return from Duplicate. +// +// llgo:link (*JSON).Duplicate C.cJSON_Duplicate +func (o *JSON) Duplicate(recurse JSON_bool) *JSON { return nil } + +// CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); +// +// Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, +// they will be considered unequal. case_sensitive determines if object keys are treated +// case sensitive (1) or case insensitive (0) +// +// llgo:link (*JSON).Compare C.cJSON_Compare +func (o *JSON) Compare(b *JSON, case_sensitive JSON_bool) JSON_bool { return JSON_bool(0) } + +// CJSON_PUBLIC(void) cJSON_Minify(char *json); +// +// Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. +// The input pointer json cannot point to a read-only address area, such as a string constant, +// but should point to a readable and writable address area. +// +//go:linkname Minify C.cJSON_Minify +func Minify() + +// CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name); +// +// Helper functions for creating and adding items to an object at the same time. +// They return the added item or NULL on failure. +// +// llgo:link (*JSON).AddNullToObject C.cJSON_AddNullToObject +func (o *JSON) AddNullToObject(name *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name); +// +// llgo:link (*JSON).AddTrueToObject C.cJSON_AddTrueToObject +func (o *JSON) AddTrueToObject(name *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name); +// +// llgo:link (*JSON).AddFalseToObject C.cJSON_AddFalseToObject +func (o *JSON) AddFalseToObject(name *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean); +// +// llgo:link (*JSON).AddBoolToObject C.cJSON_AddBoolToObject +func (o *JSON) AddBoolToObject(name *c.Char, b JSON_bool) *JSON { return nil } + +// CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); +// +// llgo:link (*JSON).AddNumberToObject C.cJSON_AddNumberToObject +func (o *JSON) AddNumberToObject(name *c.Char, num c.Double) *JSON { return nil } + +// CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string); +// +// llgo:link (*JSON).AddStringToObject C.cJSON_AddStringToObject +func (o *JSON) AddStringToObject(name *c.Char, s *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); +// +// llgo:link (*JSON).AddRawToObject C.cJSON_AddRawToObject +func (o *JSON) AddRawToObject(name *c.Char, raw *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name); +// +// llgo:link (*JSON).AddObjectToObject C.cJSON_AddObjectToObject +func (o *JSON) AddObjectToObject(name *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name); +// +// llgo:link (*JSON).AddArrayToObject C.cJSON_AddArrayToObject +func (o *JSON) AddArrayToObject(name *c.Char) *JSON { return nil } + +// CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number); +// +// helper for the cJSON_SetNumberValue macro +// +// llgo:link (*JSON).SetNumberHelper C.cJSON_SetNumberHelper +func (o *JSON) SetNumberHelper(number c.Double) c.Double { return 0 } + +// CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring); +// +// Change the valuestring of a cJSON_String object, only takes effect when type of +// object is cJSON_String +// +// llgo:link (*JSON).SetValuestring C.cJSON_SetValuestring +func (o *JSON) SetValuestring(v *c.Char) *c.Char { return nil } + +// CJSON_PUBLIC(void *) cJSON_malloc(size_t size); +// +// malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks +// +//go:linkname Malloc C.cJSON_malloc +func Malloc(size uintptr) + +// CJSON_PUBLIC(void) cJSON_free(void *object); +// //go:linkname Free C.cJSON_free func Free(ptr unsafe.Pointer) - -//go:linkname FreeCStr C.cJSON_free -func FreeCStr(*c.Char) From df92e215206245c73751836567fc944253afb4b3 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Wed, 4 Sep 2024 20:31:45 +0800 Subject: [PATCH 2/6] fix error --- c/cjson/cjson.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c/cjson/cjson.go b/c/cjson/cjson.go index 179214e6..0a2e0906 100644 --- a/c/cjson/cjson.go +++ b/c/cjson/cjson.go @@ -134,7 +134,7 @@ func (o *JSON) PrintBuffered(prebuffer c.Int, fmt JSON_bool) *c.Char { return ni // // Render a cJSON entity to text using a buffer already allocated in memory with given // length. Returns 1 on success and 0 on failure. -// NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, +// note that cJSON is not always 100% accurate in estimating how much memory it will use, // so to be safe allocate 5 bytes more than you actually need // // llgo:link (*JSON).PrintPreallocated C.cJSON_PrintPreallocated @@ -482,7 +482,7 @@ func (o *JSON) AddItemToObject(key *c.Char, item *JSON) JSON_bool { return JSON_ // // Use this when string is definitely const (i.e. a literal, or as good as), // and will definitely survive the cJSON object. -// WARNING: When this function was used, make sure to always check that +// warning that When this function was used, make sure to always check that // (item->type & cJSON_StringIsConst) is zero before writing to `item->string` // // llgo:link (*JSON).AddItemToObjectCS C.cJSON_AddItemToObjectCS From 8a4370c1f651200c4fbc3bc6cfdf02289f520c5e Mon Sep 17 00:00:00 2001 From: tsingbx Date: Thu, 5 Sep 2024 10:55:49 +0800 Subject: [PATCH 3/6] change ParseBytes and ParseString, change JSON_bool to Bool, remove Bool() --- c/cjson/cjson.go | 137 +++++++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 71 deletions(-) diff --git a/c/cjson/cjson.go b/c/cjson/cjson.go index 0a2e0906..286c0137 100644 --- a/c/cjson/cjson.go +++ b/c/cjson/cjson.go @@ -26,7 +26,7 @@ const ( LLGoPackage = "link: $(pkg-config --libs libcjson); -lcjson" ) -type JSON_bool c.Int +type Bool c.Int // llgo:type C type JSON struct { @@ -34,11 +34,11 @@ type JSON struct { } func ParseBytes(value []byte) *JSON { - return ParseWithLength((*c.Char)(unsafe.Pointer(&value[0])), uintptr(len(value))) + return ParseWithLength((*c.Char)(unsafe.Pointer(unsafe.SliceData(value))), uintptr(len(value))) } func ParseString(value string) *JSON { - return ParseWithLength(c.AllocaCStr(value), uintptr(len(value))) + return ParseWithLength((*c.Char)(unsafe.Pointer(unsafe.StringData(value))), uintptr(len(value))) } // CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); @@ -87,7 +87,7 @@ func Parse(value *c.Char) *JSON //go:linkname ParseWithLength C.cJSON_ParseWithLength func ParseWithLength(value *c.Char, valueLength uintptr) *JSON -// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cBool require_null_terminated); // // ParseWithOpts allows you to require (and check) that the JSON is null terminated, // and to retrieve the pointer to the final byte parsed. @@ -96,9 +96,9 @@ func ParseWithLength(value *c.Char, valueLength uintptr) *JSON // cJSON_GetErrorPtr(). // //go:linkname ParseWithOpts C.cJSON_ParseWithOpts -func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated JSON_bool) *JSON +func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated Bool) *JSON -// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cBool require_null_terminated); // // ParseWithOpts allows you to require (and check) that the JSON is null terminated, // and to retrieve the pointer to the final byte parsed. @@ -107,7 +107,7 @@ func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_termin // cJSON_GetErrorPtr(). // //go:linkname ParseWithLengthOpts C.cJSON_ParseWithLengthOpts -func ParseWithLengthOpts(value *c.Char, buffer_length uintptr, return_parse_end **c.Char, require_null_terminated JSON_bool) *JSON +func ParseWithLengthOpts(value *c.Char, buffer_length uintptr, return_parse_end **c.Char, require_null_terminated Bool) *JSON // CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); // Render a JSON entity to text for transfer/storage. @@ -121,16 +121,16 @@ func (o *JSON) Print() *c.Char { return nil } // llgo:link (*JSON).PrintUnformatted C.cJSON_PrintUnformatted func (o *JSON) PrintUnformatted() *c.Char { return nil } -// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); +// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cBool fmt); // // Render a JSON entity to text using a buffered strategy. // prebuffer is a guess at the final size. guessing well reduces reallocation. // fmt=0 gives unformatted, =1 gives formatted. // // llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered -func (o *JSON) PrintBuffered(prebuffer c.Int, fmt JSON_bool) *c.Char { return nil } +func (o *JSON) PrintBuffered(prebuffer c.Int, fmt Bool) *c.Char { return nil } -// CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); +// CJSON_PUBLIC(cBool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cBool format); // // Render a cJSON entity to text using a buffer already allocated in memory with given // length. Returns 1 on success and 0 on failure. @@ -138,8 +138,8 @@ func (o *JSON) PrintBuffered(prebuffer c.Int, fmt JSON_bool) *c.Char { return ni // so to be safe allocate 5 bytes more than you actually need // // llgo:link (*JSON).PrintPreallocated C.cJSON_PrintPreallocated -func (o *JSON) PrintPreallocated(buffer *c.Char, length c.Int, format JSON_bool) JSON_bool { - return JSON_bool(0) +func (o *JSON) PrintPreallocated(buffer *c.Char, length c.Int, format Bool) Bool { + return Bool(0) } // CJSON_PUBLIC(void) cJSON_Delete(cJSON *item); @@ -176,10 +176,10 @@ func (o *JSON) GetObjectItem(s *c.Char) *JSON { return nil } // llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON { return nil } -// CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string); +// CJSON_PUBLIC(cBool) cJSON_HasObjectItem(const cJSON *object, const char *string); // // llgo:link (*JSON).HasObjectItem C.cJSON_HasObjectItem -func (o *JSON) HasObjectItem(s *c.Char) JSON_bool { return JSON_bool(0) } +func (o *JSON) HasObjectItem(s *c.Char) Bool { return Bool(0) } // CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); // @@ -204,75 +204,75 @@ func (o *JSON) GetStringValue() *c.Char { return nil } // llgo:link (*JSON).GetNumberValue C.cJSON_GetNumberValue func (o *JSON) GetNumberValue() c.Double { return 0 } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsInvalid(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsInvalid C.cJSON_IsInvalid -func (o *JSON) IsInvalid() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsInvalid() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsFalse(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsFalse C.cJSON_IsFalse -func (o *JSON) IsFalse() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsFalse() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsTrue(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsTrue C.cJSON_IsTrue -func (o *JSON) IsTrue() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsTrue() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsBool(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsBool C.cJSON_IsBool -func (o *JSON) IsBool() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsBool() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsNull(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsNull C.cJSON_IsNull -func (o *JSON) IsNull() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsNull() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsNumber(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsNumber C.cJSON_IsNumber -func (o *JSON) IsNumber() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsNumber() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsString(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsString C.cJSON_IsString -func (o *JSON) IsString() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsString() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsArray(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsArray C.cJSON_IsArray -func (o *JSON) IsArray() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsArray() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsObject(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsObject C.cJSON_IsObject -func (o *JSON) IsObject() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsObject() Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsRaw(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsRaw C.cJSON_IsRaw -func (o *JSON) IsRaw() JSON_bool { return JSON_bool(0) } +func (o *JSON) IsRaw() Bool { return Bool(0) } // CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void); // @@ -312,12 +312,7 @@ func False() *JSON //go:linkname CreateFalse C.cJSON_CreateFalse func CreateFalse() *JSON -// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); -// -//go:linkname Bool C.cJSON_CreateBool -func Bool(boolean c.Int) *JSON - -// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); +// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cBool boolean); // // same as Bool func // @@ -450,35 +445,35 @@ func CreateDoubleArray(numbers *c.Double, count c.Int) *JSON //go:linkname CreateStringArray C.cJSON_CreateStringArray func CreateStringArray(strings *c.Char, count c.Int) *JSON -// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToArray(cJSON *array, cJSON *item); // // Append item to the specified array. // // llgo:link (*JSON).AddItem C.cJSON_AddItemToArray -func (o *JSON) AddItem(item *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) AddItem(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToArray(cJSON *array, cJSON *item); // // same as AddItem func // // llgo:link (*JSON).AddItemToArray C.cJSON_AddItemToArray -func (o *JSON) AddItemToArray(item *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) AddItemToArray(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); // // Append item to the specified object. // // llgo:link (*JSON).SetItem C.cJSON_AddItemToObject -func (o *JSON) SetItem(key *c.Char, item *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) SetItem(key *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); // // same as SetItem func // // llgo:link (*JSON).AddItemToObject C.cJSON_AddItemToObject -func (o *JSON) AddItemToObject(key *c.Char, item *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); // // Use this when string is definitely const (i.e. a literal, or as good as), // and will definitely survive the cJSON object. @@ -486,21 +481,21 @@ func (o *JSON) AddItemToObject(key *c.Char, item *JSON) JSON_bool { return JSON_ // (item->type & cJSON_StringIsConst) is zero before writing to `item->string` // // llgo:link (*JSON).AddItemToObjectCS C.cJSON_AddItemToObjectCS -func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); // // Append reference to item to the specified array/object. // Use this when you want to add an existing cJSON to a new cJSON, // but don't want to corrupt your existing cJSON. // // llgo:link (*JSON).AddItemReferenceToArray C.cJSON_AddItemReferenceToArray -func (o *JSON) AddItemReferenceToArray(item *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) AddItemReferenceToArray(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); // // llgo:link (*JSON).AddItemReferenceToObject C.cJSON_AddItemReferenceToObject -func (o *JSON) AddItemReferenceToObject(s *c.Char, item *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) AddItemReferenceToObject(s *c.Char, item *JSON) Bool { return Bool(0) } // CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); // @@ -539,37 +534,37 @@ func (o *JSON) DeleteItemFromObject(s *c.Char) {} // llgo:link (*JSON).DeleteItemFromObjectCaseSensitive C.cJSON_DeleteItemFromObjectCaseSensitive func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char) {} -// CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); +// CJSON_PUBLIC(cBool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); // // Update array items. // Shifts pre-existing items to the right. // // llgo:link (*JSON).InsertItemInArray C.cJSON_InsertItemInArray -func (o *JSON) InsertItemInArray(which c.Int, newitem *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) InsertItemInArray(which c.Int, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +// CJSON_PUBLIC(cBool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); // // llgo:link (*JSON).ReplaceItemViaPointer C.cJSON_ReplaceItemViaPointer -func (o *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInArray C.cJSON_ReplaceItemInArray -func (o *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInObject C.cJSON_ReplaceItemInObject -func (o *JSON) ReplaceItemInObject(s *c.Char, newitem *JSON) JSON_bool { return JSON_bool(0) } +func (o *JSON) ReplaceItemInObject(s *c.Char, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); +// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInObjectCaseSensitive C.cJSON_ReplaceItemInObjectCaseSensitive -func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) JSON_bool { - return JSON_bool(0) +func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool { + return Bool(0) } -// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); +// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cBool recurse); // // Duplicate a cJSON item // @@ -579,16 +574,16 @@ func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) JSON_b // The item->next and ->prev pointers are always zero on return from Duplicate. // // llgo:link (*JSON).Duplicate C.cJSON_Duplicate -func (o *JSON) Duplicate(recurse JSON_bool) *JSON { return nil } +func (o *JSON) Duplicate(recurse Bool) *JSON { return nil } -// CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); +// CJSON_PUBLIC(cBool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cBool case_sensitive); // // Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, // they will be considered unequal. case_sensitive determines if object keys are treated // case sensitive (1) or case insensitive (0) // // llgo:link (*JSON).Compare C.cJSON_Compare -func (o *JSON) Compare(b *JSON, case_sensitive JSON_bool) JSON_bool { return JSON_bool(0) } +func (o *JSON) Compare(b *JSON, case_sensitive Bool) Bool { return Bool(0) } // CJSON_PUBLIC(void) cJSON_Minify(char *json); // @@ -617,10 +612,10 @@ func (o *JSON) AddTrueToObject(name *c.Char) *JSON { return nil } // llgo:link (*JSON).AddFalseToObject C.cJSON_AddFalseToObject func (o *JSON) AddFalseToObject(name *c.Char) *JSON { return nil } -// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean); +// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cBool boolean); // // llgo:link (*JSON).AddBoolToObject C.cJSON_AddBoolToObject -func (o *JSON) AddBoolToObject(name *c.Char, b JSON_bool) *JSON { return nil } +func (o *JSON) AddBoolToObject(name *c.Char, b Bool) *JSON { return nil } // CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); // From a6f6451434dee59d65346fe963ba33f412d7c6a6 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Thu, 5 Sep 2024 10:58:40 +0800 Subject: [PATCH 4/6] change comment cBool to Bool --- c/cjson/cjson.go | 62 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/c/cjson/cjson.go b/c/cjson/cjson.go index 286c0137..fbe7f15b 100644 --- a/c/cjson/cjson.go +++ b/c/cjson/cjson.go @@ -87,7 +87,7 @@ func Parse(value *c.Char) *JSON //go:linkname ParseWithLength C.cJSON_ParseWithLength func ParseWithLength(value *c.Char, valueLength uintptr) *JSON -// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cBool require_null_terminated); +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, Bool require_null_terminated); // // ParseWithOpts allows you to require (and check) that the JSON is null terminated, // and to retrieve the pointer to the final byte parsed. @@ -98,7 +98,7 @@ func ParseWithLength(value *c.Char, valueLength uintptr) *JSON //go:linkname ParseWithOpts C.cJSON_ParseWithOpts func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated Bool) *JSON -// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cBool require_null_terminated); +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, Bool require_null_terminated); // // ParseWithOpts allows you to require (and check) that the JSON is null terminated, // and to retrieve the pointer to the final byte parsed. @@ -121,7 +121,7 @@ func (o *JSON) Print() *c.Char { return nil } // llgo:link (*JSON).PrintUnformatted C.cJSON_PrintUnformatted func (o *JSON) PrintUnformatted() *c.Char { return nil } -// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cBool fmt); +// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, Bool fmt); // // Render a JSON entity to text using a buffered strategy. // prebuffer is a guess at the final size. guessing well reduces reallocation. @@ -130,7 +130,7 @@ func (o *JSON) PrintUnformatted() *c.Char { return nil } // llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered func (o *JSON) PrintBuffered(prebuffer c.Int, fmt Bool) *c.Char { return nil } -// CJSON_PUBLIC(cBool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cBool format); +// CJSON_PUBLIC(Bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const Bool format); // // Render a cJSON entity to text using a buffer already allocated in memory with given // length. Returns 1 on success and 0 on failure. @@ -176,7 +176,7 @@ func (o *JSON) GetObjectItem(s *c.Char) *JSON { return nil } // llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON { return nil } -// CJSON_PUBLIC(cBool) cJSON_HasObjectItem(const cJSON *object, const char *string); +// CJSON_PUBLIC(Bool) cJSON_HasObjectItem(const cJSON *object, const char *string); // // llgo:link (*JSON).HasObjectItem C.cJSON_HasObjectItem func (o *JSON) HasObjectItem(s *c.Char) Bool { return Bool(0) } @@ -204,70 +204,70 @@ func (o *JSON) GetStringValue() *c.Char { return nil } // llgo:link (*JSON).GetNumberValue C.cJSON_GetNumberValue func (o *JSON) GetNumberValue() c.Double { return 0 } -// CJSON_PUBLIC(cBool) cJSON_IsInvalid(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsInvalid(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsInvalid C.cJSON_IsInvalid func (o *JSON) IsInvalid() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsFalse(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsFalse(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsFalse C.cJSON_IsFalse func (o *JSON) IsFalse() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsTrue(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsTrue(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsTrue C.cJSON_IsTrue func (o *JSON) IsTrue() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsBool(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsBool(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsBool C.cJSON_IsBool func (o *JSON) IsBool() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsNull(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsNull(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsNull C.cJSON_IsNull func (o *JSON) IsNull() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsNumber(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsNumber(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsNumber C.cJSON_IsNumber func (o *JSON) IsNumber() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsString(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsString(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsString C.cJSON_IsString func (o *JSON) IsString() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsArray(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsArray(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsArray C.cJSON_IsArray func (o *JSON) IsArray() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsObject(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsObject(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsObject C.cJSON_IsObject func (o *JSON) IsObject() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsRaw(const cJSON * const item); +// CJSON_PUBLIC(Bool) cJSON_IsRaw(const cJSON * const item); // // These functions check the type of an item // @@ -312,7 +312,7 @@ func False() *JSON //go:linkname CreateFalse C.cJSON_CreateFalse func CreateFalse() *JSON -// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cBool boolean); +// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(Bool boolean); // // same as Bool func // @@ -445,35 +445,35 @@ func CreateDoubleArray(numbers *c.Double, count c.Int) *JSON //go:linkname CreateStringArray C.cJSON_CreateStringArray func CreateStringArray(strings *c.Char, count c.Int) *JSON -// CJSON_PUBLIC(cBool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); // // Append item to the specified array. // // llgo:link (*JSON).AddItem C.cJSON_AddItemToArray func (o *JSON) AddItem(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); // // same as AddItem func // // llgo:link (*JSON).AddItemToArray C.cJSON_AddItemToArray func (o *JSON) AddItemToArray(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(Bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); // // Append item to the specified object. // // llgo:link (*JSON).SetItem C.cJSON_AddItemToObject func (o *JSON) SetItem(key *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(Bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); // // same as SetItem func // // llgo:link (*JSON).AddItemToObject C.cJSON_AddItemToObject func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(Bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); // // Use this when string is definitely const (i.e. a literal, or as good as), // and will definitely survive the cJSON object. @@ -483,7 +483,7 @@ func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool { return Bool(0) } // llgo:link (*JSON).AddItemToObjectCS C.cJSON_AddItemToObjectCS func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(Bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); // // Append reference to item to the specified array/object. // Use this when you want to add an existing cJSON to a new cJSON, @@ -492,7 +492,7 @@ func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool { return Bool(0) } // llgo:link (*JSON).AddItemReferenceToArray C.cJSON_AddItemReferenceToArray func (o *JSON) AddItemReferenceToArray(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(Bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); // // llgo:link (*JSON).AddItemReferenceToObject C.cJSON_AddItemReferenceToObject func (o *JSON) AddItemReferenceToObject(s *c.Char, item *JSON) Bool { return Bool(0) } @@ -534,7 +534,7 @@ func (o *JSON) DeleteItemFromObject(s *c.Char) {} // llgo:link (*JSON).DeleteItemFromObjectCaseSensitive C.cJSON_DeleteItemFromObjectCaseSensitive func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char) {} -// CJSON_PUBLIC(cBool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); +// CJSON_PUBLIC(Bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); // // Update array items. // Shifts pre-existing items to the right. @@ -542,29 +542,29 @@ func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char) {} // llgo:link (*JSON).InsertItemInArray C.cJSON_InsertItemInArray func (o *JSON) InsertItemInArray(which c.Int, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +// CJSON_PUBLIC(Bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); // // llgo:link (*JSON).ReplaceItemViaPointer C.cJSON_ReplaceItemViaPointer func (o *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +// CJSON_PUBLIC(Bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInArray C.cJSON_ReplaceItemInArray func (o *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +// CJSON_PUBLIC(Bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInObject C.cJSON_ReplaceItemInObject func (o *JSON) ReplaceItemInObject(s *c.Char, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); +// CJSON_PUBLIC(Bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInObjectCaseSensitive C.cJSON_ReplaceItemInObjectCaseSensitive func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cBool recurse); +// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, Bool recurse); // // Duplicate a cJSON item // @@ -576,7 +576,7 @@ func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool { // llgo:link (*JSON).Duplicate C.cJSON_Duplicate func (o *JSON) Duplicate(recurse Bool) *JSON { return nil } -// CJSON_PUBLIC(cBool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cBool case_sensitive); +// CJSON_PUBLIC(Bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const Bool case_sensitive); // // Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, // they will be considered unequal. case_sensitive determines if object keys are treated @@ -612,7 +612,7 @@ func (o *JSON) AddTrueToObject(name *c.Char) *JSON { return nil } // llgo:link (*JSON).AddFalseToObject C.cJSON_AddFalseToObject func (o *JSON) AddFalseToObject(name *c.Char) *JSON { return nil } -// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cBool boolean); +// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const Bool boolean); // // llgo:link (*JSON).AddBoolToObject C.cJSON_AddBoolToObject func (o *JSON) AddBoolToObject(name *c.Char, b Bool) *JSON { return nil } From 88dbe90075bd1b25d8c84af04443d797cb94f1f0 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Thu, 5 Sep 2024 11:00:20 +0800 Subject: [PATCH 5/6] Revert "change comment cBool to Bool" This reverts commit a6f6451434dee59d65346fe963ba33f412d7c6a6. --- c/cjson/cjson.go | 62 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/c/cjson/cjson.go b/c/cjson/cjson.go index fbe7f15b..286c0137 100644 --- a/c/cjson/cjson.go +++ b/c/cjson/cjson.go @@ -87,7 +87,7 @@ func Parse(value *c.Char) *JSON //go:linkname ParseWithLength C.cJSON_ParseWithLength func ParseWithLength(value *c.Char, valueLength uintptr) *JSON -// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, Bool require_null_terminated); +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cBool require_null_terminated); // // ParseWithOpts allows you to require (and check) that the JSON is null terminated, // and to retrieve the pointer to the final byte parsed. @@ -98,7 +98,7 @@ func ParseWithLength(value *c.Char, valueLength uintptr) *JSON //go:linkname ParseWithOpts C.cJSON_ParseWithOpts func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated Bool) *JSON -// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, Bool require_null_terminated); +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cBool require_null_terminated); // // ParseWithOpts allows you to require (and check) that the JSON is null terminated, // and to retrieve the pointer to the final byte parsed. @@ -121,7 +121,7 @@ func (o *JSON) Print() *c.Char { return nil } // llgo:link (*JSON).PrintUnformatted C.cJSON_PrintUnformatted func (o *JSON) PrintUnformatted() *c.Char { return nil } -// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, Bool fmt); +// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cBool fmt); // // Render a JSON entity to text using a buffered strategy. // prebuffer is a guess at the final size. guessing well reduces reallocation. @@ -130,7 +130,7 @@ func (o *JSON) PrintUnformatted() *c.Char { return nil } // llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered func (o *JSON) PrintBuffered(prebuffer c.Int, fmt Bool) *c.Char { return nil } -// CJSON_PUBLIC(Bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const Bool format); +// CJSON_PUBLIC(cBool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cBool format); // // Render a cJSON entity to text using a buffer already allocated in memory with given // length. Returns 1 on success and 0 on failure. @@ -176,7 +176,7 @@ func (o *JSON) GetObjectItem(s *c.Char) *JSON { return nil } // llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON { return nil } -// CJSON_PUBLIC(Bool) cJSON_HasObjectItem(const cJSON *object, const char *string); +// CJSON_PUBLIC(cBool) cJSON_HasObjectItem(const cJSON *object, const char *string); // // llgo:link (*JSON).HasObjectItem C.cJSON_HasObjectItem func (o *JSON) HasObjectItem(s *c.Char) Bool { return Bool(0) } @@ -204,70 +204,70 @@ func (o *JSON) GetStringValue() *c.Char { return nil } // llgo:link (*JSON).GetNumberValue C.cJSON_GetNumberValue func (o *JSON) GetNumberValue() c.Double { return 0 } -// CJSON_PUBLIC(Bool) cJSON_IsInvalid(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsInvalid(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsInvalid C.cJSON_IsInvalid func (o *JSON) IsInvalid() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsFalse(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsFalse(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsFalse C.cJSON_IsFalse func (o *JSON) IsFalse() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsTrue(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsTrue(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsTrue C.cJSON_IsTrue func (o *JSON) IsTrue() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsBool(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsBool(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsBool C.cJSON_IsBool func (o *JSON) IsBool() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsNull(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsNull(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsNull C.cJSON_IsNull func (o *JSON) IsNull() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsNumber(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsNumber(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsNumber C.cJSON_IsNumber func (o *JSON) IsNumber() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsString(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsString(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsString C.cJSON_IsString func (o *JSON) IsString() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsArray(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsArray(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsArray C.cJSON_IsArray func (o *JSON) IsArray() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsObject(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsObject(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsObject C.cJSON_IsObject func (o *JSON) IsObject() Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_IsRaw(const cJSON * const item); +// CJSON_PUBLIC(cBool) cJSON_IsRaw(const cJSON * const item); // // These functions check the type of an item // @@ -312,7 +312,7 @@ func False() *JSON //go:linkname CreateFalse C.cJSON_CreateFalse func CreateFalse() *JSON -// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(Bool boolean); +// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cBool boolean); // // same as Bool func // @@ -445,35 +445,35 @@ func CreateDoubleArray(numbers *c.Double, count c.Int) *JSON //go:linkname CreateStringArray C.cJSON_CreateStringArray func CreateStringArray(strings *c.Char, count c.Int) *JSON -// CJSON_PUBLIC(Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToArray(cJSON *array, cJSON *item); // // Append item to the specified array. // // llgo:link (*JSON).AddItem C.cJSON_AddItemToArray func (o *JSON) AddItem(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToArray(cJSON *array, cJSON *item); // // same as AddItem func // // llgo:link (*JSON).AddItemToArray C.cJSON_AddItemToArray func (o *JSON) AddItemToArray(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); // // Append item to the specified object. // // llgo:link (*JSON).SetItem C.cJSON_AddItemToObject func (o *JSON) SetItem(key *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); // // same as SetItem func // // llgo:link (*JSON).AddItemToObject C.cJSON_AddItemToObject func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); // // Use this when string is definitely const (i.e. a literal, or as good as), // and will definitely survive the cJSON object. @@ -483,7 +483,7 @@ func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool { return Bool(0) } // llgo:link (*JSON).AddItemToObjectCS C.cJSON_AddItemToObjectCS func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); // // Append reference to item to the specified array/object. // Use this when you want to add an existing cJSON to a new cJSON, @@ -492,7 +492,7 @@ func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool { return Bool(0) } // llgo:link (*JSON).AddItemReferenceToArray C.cJSON_AddItemReferenceToArray func (o *JSON) AddItemReferenceToArray(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cBool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); // // llgo:link (*JSON).AddItemReferenceToObject C.cJSON_AddItemReferenceToObject func (o *JSON) AddItemReferenceToObject(s *c.Char, item *JSON) Bool { return Bool(0) } @@ -534,7 +534,7 @@ func (o *JSON) DeleteItemFromObject(s *c.Char) {} // llgo:link (*JSON).DeleteItemFromObjectCaseSensitive C.cJSON_DeleteItemFromObjectCaseSensitive func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char) {} -// CJSON_PUBLIC(Bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); +// CJSON_PUBLIC(cBool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); // // Update array items. // Shifts pre-existing items to the right. @@ -542,29 +542,29 @@ func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char) {} // llgo:link (*JSON).InsertItemInArray C.cJSON_InsertItemInArray func (o *JSON) InsertItemInArray(which c.Int, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +// CJSON_PUBLIC(cBool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); // // llgo:link (*JSON).ReplaceItemViaPointer C.cJSON_ReplaceItemViaPointer func (o *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInArray C.cJSON_ReplaceItemInArray func (o *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInObject C.cJSON_ReplaceItemInObject func (o *JSON) ReplaceItemInObject(s *c.Char, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(Bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); +// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInObjectCaseSensitive C.cJSON_ReplaceItemInObjectCaseSensitive func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, Bool recurse); +// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cBool recurse); // // Duplicate a cJSON item // @@ -576,7 +576,7 @@ func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool { // llgo:link (*JSON).Duplicate C.cJSON_Duplicate func (o *JSON) Duplicate(recurse Bool) *JSON { return nil } -// CJSON_PUBLIC(Bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const Bool case_sensitive); +// CJSON_PUBLIC(cBool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cBool case_sensitive); // // Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, // they will be considered unequal. case_sensitive determines if object keys are treated @@ -612,7 +612,7 @@ func (o *JSON) AddTrueToObject(name *c.Char) *JSON { return nil } // llgo:link (*JSON).AddFalseToObject C.cJSON_AddFalseToObject func (o *JSON) AddFalseToObject(name *c.Char) *JSON { return nil } -// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const Bool boolean); +// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cBool boolean); // // llgo:link (*JSON).AddBoolToObject C.cJSON_AddBoolToObject func (o *JSON) AddBoolToObject(name *c.Char, b Bool) *JSON { return nil } From 4a449ed85ee8d2fb2feedb6f1c7e3b7c64c04756 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Thu, 5 Sep 2024 11:01:34 +0800 Subject: [PATCH 6/6] change comment cBool to cJSON_Bool --- c/cjson/cjson.go | 62 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/c/cjson/cjson.go b/c/cjson/cjson.go index 286c0137..fb1e729c 100644 --- a/c/cjson/cjson.go +++ b/c/cjson/cjson.go @@ -87,7 +87,7 @@ func Parse(value *c.Char) *JSON //go:linkname ParseWithLength C.cJSON_ParseWithLength func ParseWithLength(value *c.Char, valueLength uintptr) *JSON -// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cBool require_null_terminated); +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_Bool require_null_terminated); // // ParseWithOpts allows you to require (and check) that the JSON is null terminated, // and to retrieve the pointer to the final byte parsed. @@ -98,7 +98,7 @@ func ParseWithLength(value *c.Char, valueLength uintptr) *JSON //go:linkname ParseWithOpts C.cJSON_ParseWithOpts func ParseWithOpts(value *c.Char, return_parse_end **c.Char, require_null_terminated Bool) *JSON -// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cBool require_null_terminated); +// CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_Bool require_null_terminated); // // ParseWithOpts allows you to require (and check) that the JSON is null terminated, // and to retrieve the pointer to the final byte parsed. @@ -121,7 +121,7 @@ func (o *JSON) Print() *c.Char { return nil } // llgo:link (*JSON).PrintUnformatted C.cJSON_PrintUnformatted func (o *JSON) PrintUnformatted() *c.Char { return nil } -// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cBool fmt); +// CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_Bool fmt); // // Render a JSON entity to text using a buffered strategy. // prebuffer is a guess at the final size. guessing well reduces reallocation. @@ -130,7 +130,7 @@ func (o *JSON) PrintUnformatted() *c.Char { return nil } // llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered func (o *JSON) PrintBuffered(prebuffer c.Int, fmt Bool) *c.Char { return nil } -// CJSON_PUBLIC(cBool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cBool format); +// CJSON_PUBLIC(cJSON_Bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_Bool format); // // Render a cJSON entity to text using a buffer already allocated in memory with given // length. Returns 1 on success and 0 on failure. @@ -176,7 +176,7 @@ func (o *JSON) GetObjectItem(s *c.Char) *JSON { return nil } // llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON { return nil } -// CJSON_PUBLIC(cBool) cJSON_HasObjectItem(const cJSON *object, const char *string); +// CJSON_PUBLIC(cJSON_Bool) cJSON_HasObjectItem(const cJSON *object, const char *string); // // llgo:link (*JSON).HasObjectItem C.cJSON_HasObjectItem func (o *JSON) HasObjectItem(s *c.Char) Bool { return Bool(0) } @@ -204,70 +204,70 @@ func (o *JSON) GetStringValue() *c.Char { return nil } // llgo:link (*JSON).GetNumberValue C.cJSON_GetNumberValue func (o *JSON) GetNumberValue() c.Double { return 0 } -// CJSON_PUBLIC(cBool) cJSON_IsInvalid(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsInvalid(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsInvalid C.cJSON_IsInvalid func (o *JSON) IsInvalid() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsFalse(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsFalse(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsFalse C.cJSON_IsFalse func (o *JSON) IsFalse() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsTrue(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsTrue(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsTrue C.cJSON_IsTrue func (o *JSON) IsTrue() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsBool(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsBool(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsBool C.cJSON_IsBool func (o *JSON) IsBool() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsNull(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsNull(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsNull C.cJSON_IsNull func (o *JSON) IsNull() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsNumber(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsNumber(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsNumber C.cJSON_IsNumber func (o *JSON) IsNumber() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsString(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsString(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsString C.cJSON_IsString func (o *JSON) IsString() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsArray(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsArray(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsArray C.cJSON_IsArray func (o *JSON) IsArray() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsObject(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsObject(const cJSON * const item); // // These functions check the type of an item // // llgo:link (*JSON).IsObject C.cJSON_IsObject func (o *JSON) IsObject() Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_IsRaw(const cJSON * const item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_IsRaw(const cJSON * const item); // // These functions check the type of an item // @@ -312,7 +312,7 @@ func False() *JSON //go:linkname CreateFalse C.cJSON_CreateFalse func CreateFalse() *JSON -// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cBool boolean); +// CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_Bool boolean); // // same as Bool func // @@ -445,35 +445,35 @@ func CreateDoubleArray(numbers *c.Double, count c.Int) *JSON //go:linkname CreateStringArray C.cJSON_CreateStringArray func CreateStringArray(strings *c.Char, count c.Int) *JSON -// CJSON_PUBLIC(cBool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); // // Append item to the specified array. // // llgo:link (*JSON).AddItem C.cJSON_AddItemToArray func (o *JSON) AddItem(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); // // same as AddItem func // // llgo:link (*JSON).AddItemToArray C.cJSON_AddItemToArray func (o *JSON) AddItemToArray(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); // // Append item to the specified object. // // llgo:link (*JSON).SetItem C.cJSON_AddItemToObject func (o *JSON) SetItem(key *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); // // same as SetItem func // // llgo:link (*JSON).AddItemToObject C.cJSON_AddItemToObject func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); // // Use this when string is definitely const (i.e. a literal, or as good as), // and will definitely survive the cJSON object. @@ -483,7 +483,7 @@ func (o *JSON) AddItemToObject(key *c.Char, item *JSON) Bool { return Bool(0) } // llgo:link (*JSON).AddItemToObjectCS C.cJSON_AddItemToObjectCS func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); // // Append reference to item to the specified array/object. // Use this when you want to add an existing cJSON to a new cJSON, @@ -492,7 +492,7 @@ func (o *JSON) AddItemToObjectCS(s *c.Char, item *JSON) Bool { return Bool(0) } // llgo:link (*JSON).AddItemReferenceToArray C.cJSON_AddItemReferenceToArray func (o *JSON) AddItemReferenceToArray(item *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); +// CJSON_PUBLIC(cJSON_Bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); // // llgo:link (*JSON).AddItemReferenceToObject C.cJSON_AddItemReferenceToObject func (o *JSON) AddItemReferenceToObject(s *c.Char, item *JSON) Bool { return Bool(0) } @@ -534,7 +534,7 @@ func (o *JSON) DeleteItemFromObject(s *c.Char) {} // llgo:link (*JSON).DeleteItemFromObjectCaseSensitive C.cJSON_DeleteItemFromObjectCaseSensitive func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char) {} -// CJSON_PUBLIC(cBool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); +// CJSON_PUBLIC(cJSON_Bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); // // Update array items. // Shifts pre-existing items to the right. @@ -542,29 +542,29 @@ func (o *JSON) DeleteItemFromObjectCaseSensitive(s *c.Char) {} // llgo:link (*JSON).InsertItemInArray C.cJSON_InsertItemInArray func (o *JSON) InsertItemInArray(which c.Int, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +// CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); // // llgo:link (*JSON).ReplaceItemViaPointer C.cJSON_ReplaceItemViaPointer func (o *JSON) ReplaceItemViaPointer(item *JSON, replacement *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +// CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInArray C.cJSON_ReplaceItemInArray func (o *JSON) ReplaceItemInArray(which c.Int, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +// CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInObject C.cJSON_ReplaceItemInObject func (o *JSON) ReplaceItemInObject(s *c.Char, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cBool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); +// CJSON_PUBLIC(cJSON_Bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); // // llgo:link (*JSON).ReplaceItemInObjectCaseSensitive C.cJSON_ReplaceItemInObjectCaseSensitive func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool { return Bool(0) } -// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cBool recurse); +// CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_Bool recurse); // // Duplicate a cJSON item // @@ -576,7 +576,7 @@ func (o *JSON) ReplaceItemInObjectCaseSensitive(s *c.Char, newitem *JSON) Bool { // llgo:link (*JSON).Duplicate C.cJSON_Duplicate func (o *JSON) Duplicate(recurse Bool) *JSON { return nil } -// CJSON_PUBLIC(cBool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cBool case_sensitive); +// CJSON_PUBLIC(cJSON_Bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_Bool case_sensitive); // // Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, // they will be considered unequal. case_sensitive determines if object keys are treated @@ -612,7 +612,7 @@ func (o *JSON) AddTrueToObject(name *c.Char) *JSON { return nil } // llgo:link (*JSON).AddFalseToObject C.cJSON_AddFalseToObject func (o *JSON) AddFalseToObject(name *c.Char) *JSON { return nil } -// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cBool boolean); +// CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_Bool boolean); // // llgo:link (*JSON).AddBoolToObject C.cJSON_AddBoolToObject func (o *JSON) AddBoolToObject(name *c.Char, b Bool) *JSON { return nil }