' PBXA64/PBXB64 JSON DOM declarations for optional PBXJSON64 runtime/helper DLL.
#IF NOT %DEF(PBX_JSON_DOM_PBI)
#DEFINE PBX_JSON_DOM_PBI
#INCLUDE ONCE "Legacy/System/json_core.inc"

%EQUATE `PBX_JSON_DOC_READONLY = &H00000001
%EQUATE `PBX_JSON_DOC_MUTABLE = &H00000002
%EQUATE `PBX_JSON_DOC_OWNS_TEXT = &H00000004

' Handles are QUAD. Strings are passed as pointer+byte count to avoid ANSI/WIDE ambiguity.
DECLARE FUNCTION PBXJson_ParseUtf8 LIB "pbxjson64.dll" ALIAS "PBXJson_ParseUtf8" (BYVAL pText AS QUAD, BYVAL cbText AS QUAD, BYVAL flags AS DWORD, BYVAL pDoc AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_ParseFileUtf8 LIB "pbxjson64.dll" ALIAS "PBXJson_ParseFileUtf8" (BYVAL pFileName AS ASCIIZ PTR, BYVAL flags AS DWORD, BYVAL pDoc AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_SaveFileUtf8 LIB "pbxjson64.dll" ALIAS "PBXJson_SaveFileUtf8" (BYVAL hDoc AS QUAD, BYVAL pFileName AS ASCIIZ PTR, BYVAL flags AS DWORD) AS LONG
DECLARE FUNCTION PBXJson_FreeDoc LIB "pbxjson64.dll" ALIAS "PBXJson_FreeDoc" (BYVAL hDoc AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_GetRoot LIB "pbxjson64.dll" ALIAS "PBXJson_GetRoot" (BYVAL hDoc AS QUAD) AS QUAD
DECLARE FUNCTION PBXJson_GetType LIB "pbxjson64.dll" ALIAS "PBXJson_GetType" (BYVAL hNode AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_GetCount LIB "pbxjson64.dll" ALIAS "PBXJson_GetCount" (BYVAL hNode AS QUAD) AS QUAD
DECLARE FUNCTION PBXJson_GetChildByIndex LIB "pbxjson64.dll" ALIAS "PBXJson_GetChildByIndex" (BYVAL hNode AS QUAD, BYVAL index AS QUAD) AS QUAD
DECLARE FUNCTION PBXJson_GetMemberByNameUtf8 LIB "pbxjson64.dll" ALIAS "PBXJson_GetMemberByNameUtf8" (BYVAL hObject AS QUAD, BYVAL pName AS QUAD, BYVAL cbName AS QUAD) AS QUAD
DECLARE FUNCTION PBXJson_GetMemberNameUtf8 LIB "pbxjson64.dll" ALIAS "PBXJson_GetMemberNameUtf8" (BYVAL hObject AS QUAD, BYVAL index AS QUAD, BYVAL ppName AS QUAD, BYVAL pcbName AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_GetStringUtf8 LIB "pbxjson64.dll" ALIAS "PBXJson_GetStringUtf8" (BYVAL hNode AS QUAD, BYVAL ppText AS QUAD, BYVAL pcbText AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_GetInt64 LIB "pbxjson64.dll" ALIAS "PBXJson_GetInt64" (BYVAL hNode AS QUAD, BYVAL pValue AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_GetDouble LIB "pbxjson64.dll" ALIAS "PBXJson_GetDouble" (BYVAL hNode AS QUAD, BYVAL pValue AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_GetBool LIB "pbxjson64.dll" ALIAS "PBXJson_GetBool" (BYVAL hNode AS QUAD, BYVAL pValue AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_SetNull LIB "pbxjson64.dll" ALIAS "PBXJson_SetNull" (BYVAL hNode AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_SetStringUtf8 LIB "pbxjson64.dll" ALIAS "PBXJson_SetStringUtf8" (BYVAL hNode AS QUAD, BYVAL pText AS QUAD, BYVAL cbText AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_SetInt64 LIB "pbxjson64.dll" ALIAS "PBXJson_SetInt64" (BYVAL hNode AS QUAD, BYVAL value AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_SetDouble LIB "pbxjson64.dll" ALIAS "PBXJson_SetDouble" (BYVAL hNode AS QUAD, BYVAL value AS DOUBLE) AS LONG
DECLARE FUNCTION PBXJson_SetBool LIB "pbxjson64.dll" ALIAS "PBXJson_SetBool" (BYVAL hNode AS QUAD, BYVAL value AS LONG) AS LONG
DECLARE FUNCTION PBXJson_CreateObject LIB "pbxjson64.dll" ALIAS "PBXJson_CreateObject" (BYVAL hDoc AS QUAD) AS QUAD
DECLARE FUNCTION PBXJson_CreateArray LIB "pbxjson64.dll" ALIAS "PBXJson_CreateArray" (BYVAL hDoc AS QUAD) AS QUAD
DECLARE FUNCTION PBXJson_ArrayAppend LIB "pbxjson64.dll" ALIAS "PBXJson_ArrayAppend" (BYVAL hArray AS QUAD, BYVAL hChild AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_ObjectSet LIB "pbxjson64.dll" ALIAS "PBXJson_ObjectSet" (BYVAL hObject AS QUAD, BYVAL pName AS QUAD, BYVAL cbName AS QUAD, BYVAL hChild AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_RemoveMemberUtf8 LIB "pbxjson64.dll" ALIAS "PBXJson_RemoveMemberUtf8" (BYVAL hObject AS QUAD, BYVAL pName AS QUAD, BYVAL cbName AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_RemoveIndex LIB "pbxjson64.dll" ALIAS "PBXJson_RemoveIndex" (BYVAL hArray AS QUAD, BYVAL index AS QUAD) AS LONG
DECLARE FUNCTION PBXJson_CloneSubtree LIB "pbxjson64.dll" ALIAS "PBXJson_CloneSubtree" (BYVAL hDoc AS QUAD, BYVAL hNode AS QUAD) AS QUAD
DECLARE FUNCTION PBXJson_LastError LIB "pbxjson64.dll" ALIAS "PBXJson_LastError" (BYVAL hDoc AS QUAD, BYVAL pInfo AS QUAD) AS LONG

#ENDIF
