npupp.h 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is mozilla.org code.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1998
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. /*
  38. * npupp.h $Revision: 1.1 $
  39. * function call mecahnics needed by platform specific glue code.
  40. */
  41. #ifndef _NPUPP_H_
  42. #define _NPUPP_H_
  43. #if defined(__OS2__)
  44. #pragma pack(1)
  45. #endif
  46. #ifndef GENERATINGCFM
  47. #define GENERATINGCFM 0
  48. #endif
  49. #ifndef _NPAPI_H_
  50. #include "npapi.h"
  51. #endif
  52. #include "npruntime.h"
  53. #include "jri.h"
  54. /******************************************************************************************
  55. plug-in function table macros
  56. for each function in and out of the plugin API we define
  57. typedef NPP_FooUPP
  58. #define NewNPP_FooProc
  59. #define CallNPP_FooProc
  60. for mac, define the UPP magic for PPC/68K calling
  61. *******************************************************************************************/
  62. /* NPP_Initialize */
  63. #define _NPUPP_USE_UPP_ (TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON)
  64. #if _NPUPP_USE_UPP_
  65. typedef UniversalProcPtr NPP_InitializeUPP;
  66. enum {
  67. uppNPP_InitializeProcInfo = kThinkCStackBased
  68. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
  69. | RESULT_SIZE(SIZE_CODE(0))
  70. };
  71. #define NewNPP_InitializeProc(FUNC) \
  72. (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture())
  73. #define CallNPP_InitializeProc(FUNC) \
  74. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo)
  75. #else
  76. typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
  77. #define NewNPP_InitializeProc(FUNC) \
  78. ((NPP_InitializeUPP) (FUNC))
  79. #define CallNPP_InitializeProc(FUNC) \
  80. (*(FUNC))()
  81. #endif
  82. /* NPP_Shutdown */
  83. #if _NPUPP_USE_UPP_
  84. typedef UniversalProcPtr NPP_ShutdownUPP;
  85. enum {
  86. uppNPP_ShutdownProcInfo = kThinkCStackBased
  87. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
  88. | RESULT_SIZE(SIZE_CODE(0))
  89. };
  90. #define NewNPP_ShutdownProc(FUNC) \
  91. (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture())
  92. #define CallNPP_ShutdownProc(FUNC) \
  93. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo)
  94. #else
  95. typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
  96. #define NewNPP_ShutdownProc(FUNC) \
  97. ((NPP_ShutdownUPP) (FUNC))
  98. #define CallNPP_ShutdownProc(FUNC) \
  99. (*(FUNC))()
  100. #endif
  101. /* NPP_New */
  102. #if _NPUPP_USE_UPP_
  103. typedef UniversalProcPtr NPP_NewUPP;
  104. enum {
  105. uppNPP_NewProcInfo = kThinkCStackBased
  106. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType)))
  107. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP)))
  108. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16)))
  109. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16)))
  110. | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **)))
  111. | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **)))
  112. | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *)))
  113. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  114. };
  115. #define NewNPP_NewProc(FUNC) \
  116. (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture())
  117. #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
  118. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \
  119. (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
  120. #else
  121. typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
  122. #define NewNPP_NewProc(FUNC) \
  123. ((NPP_NewUPP) (FUNC))
  124. #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
  125. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
  126. #endif
  127. /* NPP_Destroy */
  128. #if _NPUPP_USE_UPP_
  129. typedef UniversalProcPtr NPP_DestroyUPP;
  130. enum {
  131. uppNPP_DestroyProcInfo = kThinkCStackBased
  132. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  133. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **)))
  134. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  135. };
  136. #define NewNPP_DestroyProc(FUNC) \
  137. (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture())
  138. #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
  139. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2))
  140. #else
  141. typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
  142. #define NewNPP_DestroyProc(FUNC) \
  143. ((NPP_DestroyUPP) (FUNC))
  144. #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
  145. (*(FUNC))((ARG1), (ARG2))
  146. #endif
  147. /* NPP_SetWindow */
  148. #if _NPUPP_USE_UPP_
  149. typedef UniversalProcPtr NPP_SetWindowUPP;
  150. enum {
  151. uppNPP_SetWindowProcInfo = kThinkCStackBased
  152. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  153. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *)))
  154. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  155. };
  156. #define NewNPP_SetWindowProc(FUNC) \
  157. (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture())
  158. #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
  159. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2))
  160. #else
  161. typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
  162. #define NewNPP_SetWindowProc(FUNC) \
  163. ((NPP_SetWindowUPP) (FUNC))
  164. #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
  165. (*(FUNC))((ARG1), (ARG2))
  166. #endif
  167. /* NPP_NewStream */
  168. #if _NPUPP_USE_UPP_
  169. typedef UniversalProcPtr NPP_NewStreamUPP;
  170. enum {
  171. uppNPP_NewStreamProcInfo = kThinkCStackBased
  172. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  173. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
  174. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *)))
  175. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool)))
  176. | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16 *)))
  177. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  178. };
  179. #define NewNPP_NewStreamProc(FUNC) \
  180. (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture())
  181. #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
  182. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
  183. #else
  184. typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
  185. #define NewNPP_NewStreamProc(FUNC) \
  186. ((NPP_NewStreamUPP) (FUNC))
  187. #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
  188. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
  189. #endif
  190. /* NPP_DestroyStream */
  191. #if _NPUPP_USE_UPP_
  192. typedef UniversalProcPtr NPP_DestroyStreamUPP;
  193. enum {
  194. uppNPP_DestroyStreamProcInfo = kThinkCStackBased
  195. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  196. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
  197. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
  198. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  199. };
  200. #define NewNPP_DestroyStreamProc(FUNC) \
  201. (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture())
  202. #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
  203. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPReasonArg))
  204. #else
  205. typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
  206. #define NewNPP_DestroyStreamProc(FUNC) \
  207. ((NPP_DestroyStreamUPP) (FUNC))
  208. #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
  209. (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
  210. #endif
  211. /* NPP_WriteReady */
  212. #if _NPUPP_USE_UPP_
  213. typedef UniversalProcPtr NPP_WriteReadyUPP;
  214. enum {
  215. uppNPP_WriteReadyProcInfo = kThinkCStackBased
  216. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  217. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
  218. | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
  219. };
  220. #define NewNPP_WriteReadyProc(FUNC) \
  221. (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture())
  222. #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
  223. (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr))
  224. #else
  225. typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
  226. #define NewNPP_WriteReadyProc(FUNC) \
  227. ((NPP_WriteReadyUPP) (FUNC))
  228. #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
  229. (*(FUNC))((NPParg), (NPStreamPtr))
  230. #endif
  231. /* NPP_Write */
  232. #if _NPUPP_USE_UPP_
  233. typedef UniversalProcPtr NPP_WriteUPP;
  234. enum {
  235. uppNPP_WriteProcInfo = kThinkCStackBased
  236. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  237. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
  238. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
  239. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32)))
  240. | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*)))
  241. | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
  242. };
  243. #define NewNPP_WriteProc(FUNC) \
  244. (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture())
  245. #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
  246. (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
  247. #else
  248. typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
  249. #define NewNPP_WriteProc(FUNC) \
  250. ((NPP_WriteUPP) (FUNC))
  251. #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
  252. (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
  253. #endif
  254. /* NPP_StreamAsFile */
  255. #if _NPUPP_USE_UPP_
  256. typedef UniversalProcPtr NPP_StreamAsFileUPP;
  257. enum {
  258. uppNPP_StreamAsFileProcInfo = kThinkCStackBased
  259. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  260. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
  261. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
  262. | RESULT_SIZE(SIZE_CODE(0))
  263. };
  264. #define NewNPP_StreamAsFileProc(FUNC) \
  265. (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture())
  266. #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
  267. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3))
  268. #else
  269. typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
  270. #define NewNPP_StreamAsFileProc(FUNC) \
  271. ((NPP_StreamAsFileUPP) (FUNC))
  272. #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
  273. (*(FUNC))((ARG1), (ARG2), (ARG3))
  274. #endif
  275. /* NPP_Print */
  276. #if _NPUPP_USE_UPP_
  277. typedef UniversalProcPtr NPP_PrintUPP;
  278. enum {
  279. uppNPP_PrintProcInfo = kThinkCStackBased
  280. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  281. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *)))
  282. | RESULT_SIZE(SIZE_CODE(0))
  283. };
  284. #define NewNPP_PrintProc(FUNC) \
  285. (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture())
  286. #define CallNPP_PrintProc(FUNC, NPParg, voidPtr) \
  287. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr))
  288. #else
  289. typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
  290. #define NewNPP_PrintProc(FUNC) \
  291. ((NPP_PrintUPP) (FUNC))
  292. #define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
  293. (*(FUNC))((NPParg), (NPPrintArg))
  294. #endif
  295. /* NPP_HandleEvent */
  296. #if _NPUPP_USE_UPP_
  297. typedef UniversalProcPtr NPP_HandleEventUPP;
  298. enum {
  299. uppNPP_HandleEventProcInfo = kThinkCStackBased
  300. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  301. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
  302. | RESULT_SIZE(SIZE_CODE(sizeof(int16)))
  303. };
  304. #define NewNPP_HandleEventProc(FUNC) \
  305. (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture())
  306. #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
  307. (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr))
  308. #else
  309. typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
  310. #define NewNPP_HandleEventProc(FUNC) \
  311. ((NPP_HandleEventUPP) (FUNC))
  312. #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
  313. (*(FUNC))((NPParg), (voidPtr))
  314. #endif
  315. /* NPP_URLNotify */
  316. #if _NPUPP_USE_UPP_
  317. typedef UniversalProcPtr NPP_URLNotifyUPP;
  318. enum {
  319. uppNPP_URLNotifyProcInfo = kThinkCStackBased
  320. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  321. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
  322. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
  323. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
  324. | RESULT_SIZE(SIZE_CODE(SIZE_CODE(0)))
  325. };
  326. #define NewNPP_URLNotifyProc(FUNC) \
  327. (NPP_URLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, GetCurrentArchitecture())
  328. #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  329. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
  330. #else
  331. typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
  332. #define NewNPP_URLNotifyProc(FUNC) \
  333. ((NPP_URLNotifyUPP) (FUNC))
  334. #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  335. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  336. #endif
  337. /* NPP_GetValue */
  338. #if _NPUPP_USE_UPP_
  339. typedef UniversalProcPtr NPP_GetValueUPP;
  340. enum {
  341. uppNPP_GetValueProcInfo = kThinkCStackBased
  342. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  343. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable)))
  344. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
  345. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  346. };
  347. #define NewNPP_GetValueProc(FUNC) \
  348. (NPP_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_GetValueProcInfo, GetCurrentArchitecture())
  349. #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
  350. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
  351. #else
  352. typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
  353. #define NewNPP_GetValueProc(FUNC) \
  354. ((NPP_GetValueUPP) (FUNC))
  355. #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
  356. (*(FUNC))((ARG1), (ARG2), (ARG3))
  357. #endif
  358. /* NPP_SetValue */
  359. #if _NPUPP_USE_UPP_
  360. typedef UniversalProcPtr NPP_SetValueUPP;
  361. enum {
  362. uppNPP_SetValueProcInfo = kThinkCStackBased
  363. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  364. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
  365. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
  366. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  367. };
  368. #define NewNPP_SetValueProc(FUNC) \
  369. (NPP_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetValueProcInfo, GetCurrentArchitecture())
  370. #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
  371. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetValueProcInfo, (ARG1), (ARG2), (ARG3))
  372. #else
  373. typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
  374. #define NewNPP_SetValueProc(FUNC) \
  375. ((NPP_SetValueUPP) (FUNC))
  376. #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
  377. (*(FUNC))((ARG1), (ARG2), (ARG3))
  378. #endif
  379. /*
  380. * Netscape entry points
  381. */
  382. /* NPN_GetValue */
  383. #if _NPUPP_USE_UPP_
  384. typedef UniversalProcPtr NPN_GetValueUPP;
  385. enum {
  386. uppNPN_GetValueProcInfo = kThinkCStackBased
  387. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  388. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
  389. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
  390. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  391. };
  392. #define NewNPN_GetValueProc(FUNC) \
  393. (NPN_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetValueProcInfo, GetCurrentArchitecture())
  394. #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
  395. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
  396. #else
  397. typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
  398. #define NewNPN_GetValueProc(FUNC) \
  399. ((NPN_GetValueUPP) (FUNC))
  400. #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
  401. (*(FUNC))((ARG1), (ARG2), (ARG3))
  402. #endif
  403. /* NPN_SetValue */
  404. #if _NPUPP_USE_UPP_
  405. typedef UniversalProcPtr NPN_SetValueUPP;
  406. enum {
  407. uppNPN_SetValueProcInfo = kThinkCStackBased
  408. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  409. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable)))
  410. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
  411. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  412. };
  413. #define NewNPN_SetValueProc(FUNC) \
  414. (NPN_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_SetValueProcInfo, GetCurrentArchitecture())
  415. #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
  416. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_SetValueProcInfo, (ARG1), (ARG2), (ARG3))
  417. #else
  418. typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
  419. #define NewNPN_SetValueProc(FUNC) \
  420. ((NPN_SetValueUPP) (FUNC))
  421. #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
  422. (*(FUNC))((ARG1), (ARG2), (ARG3))
  423. #endif
  424. /* NPN_GetUrlNotify */
  425. #if _NPUPP_USE_UPP_
  426. typedef UniversalProcPtr NPN_GetURLNotifyUPP;
  427. enum {
  428. uppNPN_GetURLNotifyProcInfo = kThinkCStackBased
  429. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  430. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
  431. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
  432. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
  433. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  434. };
  435. #define NewNPN_GetURLNotifyProc(FUNC) \
  436. (NPN_GetURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, GetCurrentArchitecture())
  437. #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  438. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
  439. #else
  440. typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
  441. #define NewNPN_GetURLNotifyProc(FUNC) \
  442. ((NPN_GetURLNotifyUPP) (FUNC))
  443. #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  444. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  445. #endif
  446. /* NPN_PostUrlNotify */
  447. #if _NPUPP_USE_UPP_
  448. typedef UniversalProcPtr NPN_PostURLNotifyUPP;
  449. enum {
  450. uppNPN_PostURLNotifyProcInfo = kThinkCStackBased
  451. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  452. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
  453. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
  454. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
  455. | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
  456. | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
  457. | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(void*)))
  458. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  459. };
  460. #define NewNPN_PostURLNotifyProc(FUNC) \
  461. (NPN_PostURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, GetCurrentArchitecture())
  462. #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
  463. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
  464. #else
  465. typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData);
  466. #define NewNPN_PostURLNotifyProc(FUNC) \
  467. ((NPN_PostURLNotifyUPP) (FUNC))
  468. #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
  469. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
  470. #endif
  471. /* NPN_GetUrl */
  472. #if _NPUPP_USE_UPP_
  473. typedef UniversalProcPtr NPN_GetURLUPP;
  474. enum {
  475. uppNPN_GetURLProcInfo = kThinkCStackBased
  476. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  477. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
  478. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
  479. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  480. };
  481. #define NewNPN_GetURLProc(FUNC) \
  482. (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture())
  483. #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
  484. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3))
  485. #else
  486. typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
  487. #define NewNPN_GetURLProc(FUNC) \
  488. ((NPN_GetURLUPP) (FUNC))
  489. #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
  490. (*(FUNC))((ARG1), (ARG2), (ARG3))
  491. #endif
  492. /* NPN_PostUrl */
  493. #if _NPUPP_USE_UPP_
  494. typedef UniversalProcPtr NPN_PostURLUPP;
  495. enum {
  496. uppNPN_PostURLProcInfo = kThinkCStackBased
  497. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  498. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
  499. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
  500. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
  501. | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
  502. | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
  503. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  504. };
  505. #define NewNPN_PostURLProc(FUNC) \
  506. (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture())
  507. #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
  508. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
  509. #else
  510. typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
  511. #define NewNPN_PostURLProc(FUNC) \
  512. ((NPN_PostURLUPP) (FUNC))
  513. #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
  514. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
  515. #endif
  516. /* NPN_RequestRead */
  517. #if _NPUPP_USE_UPP_
  518. typedef UniversalProcPtr NPN_RequestReadUPP;
  519. enum {
  520. uppNPN_RequestReadProcInfo = kThinkCStackBased
  521. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *)))
  522. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *)))
  523. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  524. };
  525. #define NewNPN_RequestReadProc(FUNC) \
  526. (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture())
  527. #define CallNPN_RequestReadProc(FUNC, stream, range) \
  528. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range))
  529. #else
  530. typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
  531. #define NewNPN_RequestReadProc(FUNC) \
  532. ((NPN_RequestReadUPP) (FUNC))
  533. #define CallNPN_RequestReadProc(FUNC, stream, range) \
  534. (*(FUNC))((stream), (range))
  535. #endif
  536. /* NPN_NewStream */
  537. #if _NPUPP_USE_UPP_
  538. typedef UniversalProcPtr NPN_NewStreamUPP;
  539. enum {
  540. uppNPN_NewStreamProcInfo = kThinkCStackBased
  541. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  542. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
  543. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
  544. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPStream **)))
  545. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  546. };
  547. #define NewNPN_NewStreamProc(FUNC) \
  548. (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture())
  549. #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
  550. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (window), (stream))
  551. #else
  552. typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
  553. #define NewNPN_NewStreamProc(FUNC) \
  554. ((NPN_NewStreamUPP) (FUNC))
  555. #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
  556. (*(FUNC))((npp), (type), (window), (stream))
  557. #endif
  558. /* NPN_Write */
  559. #if _NPUPP_USE_UPP_
  560. typedef UniversalProcPtr NPN_WriteUPP;
  561. enum {
  562. uppNPN_WriteProcInfo = kThinkCStackBased
  563. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  564. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
  565. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
  566. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
  567. | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
  568. };
  569. #define NewNPN_WriteProc(FUNC) \
  570. (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture())
  571. #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
  572. (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer))
  573. #else
  574. typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
  575. #define NewNPN_WriteProc(FUNC) \
  576. ((NPN_WriteUPP) (FUNC))
  577. #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
  578. (*(FUNC))((npp), (stream), (len), (buffer))
  579. #endif
  580. /* NPN_DestroyStream */
  581. #if _NPUPP_USE_UPP_
  582. typedef UniversalProcPtr NPN_DestroyStreamUPP;
  583. enum {
  584. uppNPN_DestroyStreamProcInfo = kThinkCStackBased
  585. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP )))
  586. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
  587. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
  588. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  589. };
  590. #define NewNPN_DestroyStreamProc(FUNC) \
  591. (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture())
  592. #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
  593. (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (reason))
  594. #else
  595. typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
  596. #define NewNPN_DestroyStreamProc(FUNC) \
  597. ((NPN_DestroyStreamUPP) (FUNC))
  598. #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
  599. (*(FUNC))((npp), (stream), (reason))
  600. #endif
  601. /* NPN_Status */
  602. #if _NPUPP_USE_UPP_
  603. typedef UniversalProcPtr NPN_StatusUPP;
  604. enum {
  605. uppNPN_StatusProcInfo = kThinkCStackBased
  606. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  607. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *)))
  608. };
  609. #define NewNPN_StatusProc(FUNC) \
  610. (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture())
  611. #define CallNPN_StatusProc(FUNC, npp, msg) \
  612. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg))
  613. #else
  614. typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
  615. #define NewNPN_StatusProc(FUNC) \
  616. ((NPN_StatusUPP) (FUNC))
  617. #define CallNPN_StatusProc(FUNC, npp, msg) \
  618. (*(FUNC))((npp), (msg))
  619. #endif
  620. /* NPN_UserAgent */
  621. #if _NPUPP_USE_UPP_
  622. typedef UniversalProcPtr NPN_UserAgentUPP;
  623. enum {
  624. uppNPN_UserAgentProcInfo = kThinkCStackBased
  625. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  626. | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
  627. };
  628. #define NewNPN_UserAgentProc(FUNC) \
  629. (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture())
  630. #define CallNPN_UserAgentProc(FUNC, ARG1) \
  631. (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1))
  632. #else
  633. typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
  634. #define NewNPN_UserAgentProc(FUNC) \
  635. ((NPN_UserAgentUPP) (FUNC))
  636. #define CallNPN_UserAgentProc(FUNC, ARG1) \
  637. (*(FUNC))((ARG1))
  638. #endif
  639. /* NPN_MemAlloc */
  640. #if _NPUPP_USE_UPP_
  641. typedef UniversalProcPtr NPN_MemAllocUPP;
  642. enum {
  643. uppNPN_MemAllocProcInfo = kThinkCStackBased
  644. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
  645. | RESULT_SIZE(SIZE_CODE(sizeof(void *)))
  646. };
  647. #define NewNPN_MemAllocProc(FUNC) \
  648. (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture())
  649. #define CallNPN_MemAllocProc(FUNC, ARG1) \
  650. (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1))
  651. #else
  652. typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
  653. #define NewNPN_MemAllocProc(FUNC) \
  654. ((NPN_MemAllocUPP) (FUNC))
  655. #define CallNPN_MemAllocProc(FUNC, ARG1) \
  656. (*(FUNC))((ARG1))
  657. #endif
  658. /* NPN__MemFree */
  659. #if _NPUPP_USE_UPP_
  660. typedef UniversalProcPtr NPN_MemFreeUPP;
  661. enum {
  662. uppNPN_MemFreeProcInfo = kThinkCStackBased
  663. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *)))
  664. };
  665. #define NewNPN_MemFreeProc(FUNC) \
  666. (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture())
  667. #define CallNPN_MemFreeProc(FUNC, ARG1) \
  668. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1))
  669. #else
  670. typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
  671. #define NewNPN_MemFreeProc(FUNC) \
  672. ((NPN_MemFreeUPP) (FUNC))
  673. #define CallNPN_MemFreeProc(FUNC, ARG1) \
  674. (*(FUNC))((ARG1))
  675. #endif
  676. /* NPN_MemFlush */
  677. #if _NPUPP_USE_UPP_
  678. typedef UniversalProcPtr NPN_MemFlushUPP;
  679. enum {
  680. uppNPN_MemFlushProcInfo = kThinkCStackBased
  681. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
  682. | RESULT_SIZE(SIZE_CODE(sizeof(uint32)))
  683. };
  684. #define NewNPN_MemFlushProc(FUNC) \
  685. (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture())
  686. #define CallNPN_MemFlushProc(FUNC, ARG1) \
  687. (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1))
  688. #else
  689. typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
  690. #define NewNPN_MemFlushProc(FUNC) \
  691. ((NPN_MemFlushUPP) (FUNC))
  692. #define CallNPN_MemFlushProc(FUNC, ARG1) \
  693. (*(FUNC))((ARG1))
  694. #endif
  695. /* NPN_ReloadPlugins */
  696. #if _NPUPP_USE_UPP_
  697. typedef UniversalProcPtr NPN_ReloadPluginsUPP;
  698. enum {
  699. uppNPN_ReloadPluginsProcInfo = kThinkCStackBased
  700. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool)))
  701. | RESULT_SIZE(SIZE_CODE(0))
  702. };
  703. #define NewNPN_ReloadPluginsProc(FUNC) \
  704. (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture())
  705. #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
  706. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1))
  707. #else
  708. typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
  709. #define NewNPN_ReloadPluginsProc(FUNC) \
  710. ((NPN_ReloadPluginsUPP) (FUNC))
  711. #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
  712. (*(FUNC))((ARG1))
  713. #endif
  714. /* NPN_GetJavaEnv */
  715. #if _NPUPP_USE_UPP_
  716. typedef UniversalProcPtr NPN_GetJavaEnvUPP;
  717. enum {
  718. uppNPN_GetJavaEnvProcInfo = kThinkCStackBased
  719. | RESULT_SIZE(SIZE_CODE(sizeof(JRIEnv*)))
  720. };
  721. #define NewNPN_GetJavaEnvProc(FUNC) \
  722. (NPN_GetJavaEnvUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo, GetCurrentArchitecture())
  723. #define CallNPN_GetJavaEnvProc(FUNC) \
  724. (JRIEnv*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo)
  725. #else
  726. typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
  727. #define NewNPN_GetJavaEnvProc(FUNC) \
  728. ((NPN_GetJavaEnvUPP) (FUNC))
  729. #define CallNPN_GetJavaEnvProc(FUNC) \
  730. (*(FUNC))()
  731. #endif
  732. /* NPN_GetJavaPeer */
  733. #if _NPUPP_USE_UPP_
  734. typedef UniversalProcPtr NPN_GetJavaPeerUPP;
  735. enum {
  736. uppNPN_GetJavaPeerProcInfo = kThinkCStackBased
  737. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  738. | RESULT_SIZE(SIZE_CODE(sizeof(jref)))
  739. };
  740. #define NewNPN_GetJavaPeerProc(FUNC) \
  741. (NPN_GetJavaPeerUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, GetCurrentArchitecture())
  742. #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
  743. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, (ARG1))
  744. #else
  745. typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
  746. #define NewNPN_GetJavaPeerProc(FUNC) \
  747. ((NPN_GetJavaPeerUPP) (FUNC))
  748. #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
  749. (*(FUNC))((ARG1))
  750. #endif
  751. /* NPN_InvalidateRect */
  752. #if _NPUPP_USE_UPP_
  753. typedef UniversalProcPtr NPN_InvalidateRectUPP;
  754. enum {
  755. uppNPN_InvalidateRectProcInfo = kThinkCStackBased
  756. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  757. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRect *)))
  758. | RESULT_SIZE(SIZE_CODE(0))
  759. };
  760. #define NewNPN_InvalidateRectProc(FUNC) \
  761. (NPN_InvalidateRectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, GetCurrentArchitecture())
  762. #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
  763. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, (ARG1), (ARG2))
  764. #else
  765. typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
  766. #define NewNPN_InvalidateRectProc(FUNC) \
  767. ((NPN_InvalidateRectUPP) (FUNC))
  768. #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
  769. (*(FUNC))((ARG1), (ARG2))
  770. #endif
  771. /* NPN_InvalidateRegion */
  772. #if _NPUPP_USE_UPP_
  773. typedef UniversalProcPtr NPN_InvalidateRegionUPP;
  774. enum {
  775. uppNPN_InvalidateRegionProcInfo = kThinkCStackBased
  776. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  777. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRegion)))
  778. | RESULT_SIZE(SIZE_CODE(0))
  779. };
  780. #define NewNPN_InvalidateRegionProc(FUNC) \
  781. (NPN_InvalidateRegionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, GetCurrentArchitecture())
  782. #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
  783. (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, (ARG1), (ARG2))
  784. #else
  785. typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
  786. #define NewNPN_InvalidateRegionProc(FUNC) \
  787. ((NPN_InvalidateRegionUPP) (FUNC))
  788. #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
  789. (*(FUNC))((ARG1), (ARG2))
  790. #endif
  791. /* NPN_ForceRedraw */
  792. #if _NPUPP_USE_UPP_
  793. typedef UniversalProcPtr NPN_ForceRedrawUPP;
  794. enum {
  795. uppNPN_ForceRedrawProcInfo = kThinkCStackBased
  796. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  797. | RESULT_SIZE(SIZE_CODE(sizeof(0)))
  798. };
  799. #define NewNPN_ForceRedrawProc(FUNC) \
  800. (NPN_ForceRedrawUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, GetCurrentArchitecture())
  801. #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
  802. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, (ARG1))
  803. #else
  804. typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
  805. #define NewNPN_ForceRedrawProc(FUNC) \
  806. ((NPN_ForceRedrawUPP) (FUNC))
  807. #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
  808. (*(FUNC))((ARG1))
  809. #endif
  810. /* NPN_GetStringIdentifier */
  811. #if _NPUPP_USE_UPP_
  812. typedef UniversalProcPtr NPN_GetStringIdentifierUPP;
  813. enum {
  814. uppNPN_GetStringIdentifierProcInfo = kThinkCStackBased
  815. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(const NPUTF8*)))
  816. | RESULT_SIZE(SIZE_CODE(sizeof(NPIdentifier)))
  817. };
  818. #define NewNPN_GetStringIdentifierProc(FUNC) \
  819. (NPN_GetStringIdentifierUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetStringIdentifierProcInfo, GetCurrentArchitecture())
  820. #define CallNPN_GetStringIdentifierProc(FUNC, ARG1) \
  821. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetStringIdentifierProcInfo, (ARG1))
  822. #else
  823. typedef NPIdentifier (* NP_LOADDS NPN_GetStringIdentifierUPP)(const NPUTF8* name);
  824. #define NewNPN_GetStringIdentifierProc(FUNC) \
  825. ((NPN_GetStringIdentifierUPP) (FUNC))
  826. #define CallNPN_GetStringIdentifierProc(FUNC, ARG1) \
  827. (*(FUNC))((ARG1))
  828. #endif
  829. /* NPN_GetStringIdentifiers */
  830. #if _NPUPP_USE_UPP_
  831. typedef UniversalProcPtr NPN_GetStringIdentifiersUPP;
  832. enum {
  833. uppNPN_GetStringIdentifiersProcInfo = kThinkCStackBased
  834. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(const NPUTF8**)))
  835. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(int32_t)))
  836. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPIdentifier*)))
  837. | RESULT_SIZE(SIZE_CODE(0))
  838. };
  839. #define NewNPN_GetStringIdentifiersProc(FUNC) \
  840. (NPN_GetStringIdentifiersUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetStringIdentifiersProcInfo, GetCurrentArchitecture())
  841. #define CallNPN_GetStringIdentifiersProc(FUNC, ARG1, ARG2, ARG3) \
  842. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetStringIdentifiersProcInfo, (ARG1), (ARG2), (ARG3))
  843. #else
  844. typedef void (* NP_LOADDS NPN_GetStringIdentifiersUPP)(const NPUTF8** names,
  845. int32_t nameCount,
  846. NPIdentifier* identifiers);
  847. #define NewNPN_GetStringIdentifiersProc(FUNC) \
  848. ((NPN_GetStringIdentifiersUPP) (FUNC))
  849. #define CallNPN_GetStringIdentifiersProc(FUNC, ARG1, ARG2, ARG3) \
  850. (*(FUNC))((ARG1), (ARG2), (ARG3))
  851. #endif
  852. /* NPN_GetIntIdentifier */
  853. #if _NPUPP_USE_UPP_
  854. typedef UniversalProcPtr NPN_GetIntIdentifierUPP;
  855. enum {
  856. uppNPN_GetIntIdentifierProcInfo = kThinkCStackBased
  857. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(int32_t)))
  858. | RESULT_SIZE(SIZE_CODE(sizeof(NPIdentifier)))
  859. };
  860. #define NewNPN_GetIntIdentifierProc(FUNC) \
  861. (NPN_GetIntIdentifierUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetIntIdentifierProcInfo, GetCurrentArchitecture())
  862. #define CallNPN_GetIntIdentifierProc(FUNC, ARG1) \
  863. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetIntIdentifierProcInfo, (ARG1))
  864. #else
  865. typedef NPIdentifier (* NP_LOADDS NPN_GetIntIdentifierUPP)(int32_t intid);
  866. #define NewNPN_GetIntIdentifierProc(FUNC) \
  867. ((NPN_GetIntIdentifierUPP) (FUNC))
  868. #define CallNPN_GetIntIdentifierProc(FUNC, ARG1) \
  869. (*(FUNC))((ARG1))
  870. #endif
  871. /* NPN_IdentifierIsString */
  872. #if _NPUPP_USE_UPP_
  873. typedef UniversalProcPtr NPN_IdentifierIsStringUPP;
  874. enum {
  875. uppNPN_IdentifierIsStringProcInfo = kThinkCStackBased
  876. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPIdentifier identifier)))
  877. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  878. };
  879. #define NewNPN_IdentifierIsStringProc(FUNC) \
  880. (NPN_IdentifierIsStringUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_IdentifierIsStringProcInfo, GetCurrentArchitecture())
  881. #define CallNPN_IdentifierIsStringProc(FUNC, ARG1) \
  882. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_IdentifierIsStringProcInfo, (ARG1))
  883. #else
  884. typedef bool (* NP_LOADDS NPN_IdentifierIsStringUPP)(NPIdentifier identifier);
  885. #define NewNPN_IdentifierIsStringProc(FUNC) \
  886. ((NPN_IdentifierIsStringUPP) (FUNC))
  887. #define CallNPN_IdentifierIsStringProc(FUNC, ARG1) \
  888. (*(FUNC))((ARG1))
  889. #endif
  890. /* NPN_UTF8FromIdentifier */
  891. #if _NPUPP_USE_UPP_
  892. typedef UniversalProcPtr NPN_UTF8FromIdentifierUPP;
  893. enum {
  894. uppNPN_UTF8FromIdentifierProcInfo = kThinkCStackBased
  895. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPIdentifier)))
  896. | RESULT_SIZE(SIZE_CODE(sizeof(NPUTF8*)))
  897. };
  898. #define NewNPN_UTF8FromIdentifierProc(FUNC) \
  899. (NPN_UTF8FromIdentifierUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UTF8FromIdentifierProcInfo, GetCurrentArchitecture())
  900. #define CallNPN_UTF8FromIdentifierProc(FUNC, ARG1) \
  901. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UTF8FromIdentifierProcInfo, (ARG1))
  902. #else
  903. typedef NPUTF8* (* NP_LOADDS NPN_UTF8FromIdentifierUPP)(NPIdentifier identifier);
  904. #define NewNPN_UTF8FromIdentifierProc(FUNC) \
  905. ((NPN_UTF8FromIdentifierUPP) (FUNC))
  906. #define CallNPN_UTF8FromIdentifierProc(FUNC, ARG1) \
  907. (*(FUNC))((ARG1))
  908. #endif
  909. /* NPN_IntFromIdentifier */
  910. #if _NPUPP_USE_UPP_
  911. typedef UniversalProcPtr NPN_IntFromIdentifierUPP;
  912. enum {
  913. uppNPN_IntFromIdentifierProcInfo = kThinkCStackBased
  914. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPIdentifier)))
  915. | RESULT_SIZE(SIZE_CODE(sizeof(int32_t)))
  916. };
  917. #define NewNPN_IntFromIdentifierProc(FUNC) \
  918. (NPN_IntFromIdentifierUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_IntFromIdentifierProcInfo, GetCurrentArchitecture())
  919. #define CallNPN_IntFromIdentifierProc(FUNC, ARG1) \
  920. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_IntFromIdentifierProcInfo, (ARG1))
  921. #else
  922. typedef int32_t (* NP_LOADDS NPN_IntFromIdentifierUPP)(NPIdentifier identifier);
  923. #define NewNPN_IntFromIdentifierProc(FUNC) \
  924. ((NPN_IntFromIdentifierUPP) (FUNC))
  925. #define CallNPN_IntFromIdentifierProc(FUNC, ARG1) \
  926. (*(FUNC))((ARG1))
  927. #endif
  928. /* NPN_CreateObject */
  929. #if _NPUPP_USE_UPP_
  930. typedef UniversalProcPtr NPN_CreateObjectUPP;
  931. enum {
  932. uppNPN_CreateObjectProcInfo = kThinkCStackBased
  933. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  934. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPClass*)))
  935. | RESULT_SIZE(SIZE_CODE(sizeof(NPObject*)))
  936. };
  937. #define NewNPN_CreateObjectProc(FUNC) \
  938. (NPN_CreateObjectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_CreateObjectProcInfo, GetCurrentArchitecture())
  939. #define CallNPN_CreateObjectProc(FUNC, ARG1, ARG2) \
  940. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_CreateObjectProcInfo, (ARG1), (ARG2))
  941. #else
  942. typedef NPObject* (* NP_LOADDS NPN_CreateObjectUPP)(NPP npp, NPClass *aClass);
  943. #define NewNPN_CreateObjectProc(FUNC) \
  944. ((NPN_CreateObjectUPP) (FUNC))
  945. #define CallNPN_CreateObjectProc(FUNC, ARG1, ARG2) \
  946. (*(FUNC))((ARG1), (ARG2))
  947. #endif
  948. /* NPN_RetainObject */
  949. #if _NPUPP_USE_UPP_
  950. typedef UniversalProcPtr NPN_RetainObjectUPP;
  951. enum {
  952. uppNPN_RetainObjectProcInfo = kThinkCStackBased
  953. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPObject*)))
  954. | RESULT_SIZE(SIZE_CODE(sizeof(NPObject*)))
  955. };
  956. #define NewNPN_RetainObjectProc(FUNC) \
  957. (NPN_RetainObjectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RetainObjectProcInfo, GetCurrentArchitecture())
  958. #define CallNPN_RetainObjectProc(FUNC, ARG1) \
  959. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RetainObjectProcInfo, (ARG1))
  960. #else
  961. typedef NPObject* (* NP_LOADDS NPN_RetainObjectUPP)(NPObject *obj);
  962. #define NewNPN_RetainObjectProc(FUNC) \
  963. ((NPN_RetainObjectUPP) (FUNC))
  964. #define CallNPN_RetainObjectProc(FUNC, ARG1) \
  965. (*(FUNC))((ARG1))
  966. #endif
  967. /* NPN_ReleaseObject */
  968. #if _NPUPP_USE_UPP_
  969. typedef UniversalProcPtr NPN_ReleaseObjectUPP;
  970. enum {
  971. uppNPN_ReleaseObjectProcInfo = kThinkCStackBased
  972. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPObject*)))
  973. | RESULT_SIZE(SIZE_CODE(0))
  974. };
  975. #define NewNPN_ReleaseObjectProc(FUNC) \
  976. (NPN_ReleaseObjectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReleaseObjectProcInfo, GetCurrentArchitecture())
  977. #define CallNPN_ReleaseObjectProc(FUNC, ARG1) \
  978. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReleaseObjectProcInfo, (ARG1))
  979. #else
  980. typedef void (* NP_LOADDS NPN_ReleaseObjectUPP)(NPObject *obj);
  981. #define NewNPN_ReleaseObjectProc(FUNC) \
  982. ((NPN_ReleaseObjectUPP) (FUNC))
  983. #define CallNPN_ReleaseObjectProc(FUNC, ARG1) \
  984. (*(FUNC))((ARG1))
  985. #endif
  986. /* NPN_Invoke */
  987. #if _NPUPP_USE_UPP_
  988. typedef UniversalProcPtr NPN_InvokeUPP;
  989. enum {
  990. uppNPN_InvokeProcInfo = kThinkCStackBased
  991. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  992. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPObject*)))
  993. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPIdentifier)))
  994. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(const NPVariant*)))
  995. | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint32_t)))
  996. | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPVariant*)))
  997. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  998. };
  999. #define NewNPN_InvokeProc(FUNC) \
  1000. (NPN_InvokeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvokeProcInfo, GetCurrentArchitecture())
  1001. #define CallNPN_InvokeProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
  1002. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvokeProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
  1003. #else
  1004. typedef bool (* NP_LOADDS NPN_InvokeUPP)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
  1005. #define NewNPN_InvokeProc(FUNC) \
  1006. ((NPN_InvokeUPP) (FUNC))
  1007. #define CallNPN_InvokeProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
  1008. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
  1009. #endif
  1010. /* NPN_InvokeDefault */
  1011. #if _NPUPP_USE_UPP_
  1012. typedef UniversalProcPtr NPN_InvokeDefaultUPP;
  1013. enum {
  1014. uppNPN_InvokeDefaultProcInfo = kThinkCStackBased
  1015. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1016. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPObject*)))
  1017. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(const NPVariant*)))
  1018. | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint32_t)))
  1019. | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPVariant*)))
  1020. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  1021. };
  1022. #define NewNPN_InvokeDefaultProc(FUNC) \
  1023. (NPN_InvokeDefaultUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvokeDefaultProcInfo, GetCurrentArchitecture())
  1024. #define CallNPN_InvokeDefaultProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
  1025. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvokeDefaultProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
  1026. #else
  1027. typedef bool (* NP_LOADDS NPN_InvokeDefaultUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
  1028. #define NewNPN_InvokeDefaultProc(FUNC) \
  1029. ((NPN_InvokeDefaultUPP) (FUNC))
  1030. #define CallNPN_InvokeDefaultProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
  1031. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
  1032. #endif
  1033. /* NPN_Evaluate */
  1034. #if _NPUPP_USE_UPP_
  1035. typedef UniversalProcPtr NPN_EvaluateUPP;
  1036. enum {
  1037. uppNPN_EvaluateProcInfo = kThinkCStackBased
  1038. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1039. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPObject*)))
  1040. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPString*)))
  1041. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPVariant*)))
  1042. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  1043. };
  1044. #define NewNPN_EvaluateProc(FUNC) \
  1045. (NPN_EvaluateUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_EvaluateProcInfo, GetCurrentArchitecture())
  1046. #define CallNPN_EvaluateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  1047. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_EvaluateProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
  1048. #else
  1049. typedef bool (* NP_LOADDS NPN_EvaluateUPP)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
  1050. #define NewNPN_EvaluateProc(FUNC) \
  1051. ((NPN_EvaluateUPP) (FUNC))
  1052. #define CallNPN_EvaluateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  1053. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  1054. #endif
  1055. /* NPN_GetProperty */
  1056. #if _NPUPP_USE_UPP_
  1057. typedef UniversalProcPtr NPN_GetPropertyUPP;
  1058. enum {
  1059. uppNPN_GetPropertyProcInfo = kThinkCStackBased
  1060. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1061. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPObject*)))
  1062. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPIdentifier)))
  1063. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPVariant*)))
  1064. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  1065. };
  1066. #define NewNPN_GetPropertyProc(FUNC) \
  1067. (NPN_GetPropertyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetPropertyProcInfo, GetCurrentArchitecture())
  1068. #define CallNPN_GetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  1069. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetPropertyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
  1070. #else
  1071. typedef bool (* NP_LOADDS NPN_GetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
  1072. #define NewNPN_GetPropertyProc(FUNC) \
  1073. ((NPN_GetPropertyUPP) (FUNC))
  1074. #define CallNPN_GetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  1075. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  1076. #endif
  1077. /* NPN_SetProperty */
  1078. #if _NPUPP_USE_UPP_
  1079. typedef UniversalProcPtr NPN_SetPropertyUPP;
  1080. enum {
  1081. uppNPN_SetPropertyProcInfo = kThinkCStackBased
  1082. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1083. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPObject*)))
  1084. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPIdentifier)))
  1085. | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(const NPVariant*)))
  1086. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  1087. };
  1088. #define NewNPN_SetPropertyProc(FUNC) \
  1089. (NPN_SetPropertyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_SetPropertyProcInfo, GetCurrentArchitecture())
  1090. #define CallNPN_SetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  1091. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_SetPropertyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
  1092. #else
  1093. typedef bool (* NP_LOADDS NPN_SetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
  1094. #define NewNPN_SetPropertyProc(FUNC) \
  1095. ((NPN_SetPropertyUPP) (FUNC))
  1096. #define CallNPN_SetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  1097. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  1098. #endif
  1099. /* NPN_RemoveProperty */
  1100. #if _NPUPP_USE_UPP_
  1101. typedef UniversalProcPtr NPN_RemovePropertyUPP;
  1102. enum {
  1103. uppNPN_RemovePropertyProcInfo = kThinkCStackBased
  1104. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1105. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPObject*)))
  1106. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPIdentifier)))
  1107. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  1108. };
  1109. #define NewNPN_RemovePropertyProc(FUNC) \
  1110. (NPN_RemovePropertyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RemovePropertyProcInfo, GetCurrentArchitecture())
  1111. #define CallNPN_RemovePropertyProc(FUNC, ARG1, ARG2, ARG3) \
  1112. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RemovePropertyProcInfo, (ARG1), (ARG2), (ARG3))
  1113. #else
  1114. typedef bool (* NP_LOADDS NPN_RemovePropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  1115. #define NewNPN_RemovePropertyProc(FUNC) \
  1116. ((NPN_RemovePropertyUPP) (FUNC))
  1117. #define CallNPN_RemovePropertyProc(FUNC, ARG1, ARG2, ARG3) \
  1118. (*(FUNC))((ARG1), (ARG2), (ARG3))
  1119. #endif
  1120. /* NPN_HasProperty */
  1121. #if _NPUPP_USE_UPP_
  1122. typedef UniversalProcPtr NPN_HasPropertyUPP;
  1123. enum {
  1124. uppNPN_HasPropertyProcInfo = kThinkCStackBased
  1125. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1126. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPObject*)))
  1127. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPIdentifier)))
  1128. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  1129. };
  1130. #define NewNPN_HasPropertyProc(FUNC) \
  1131. (NPN_HasPropertyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_HasPropertyProcInfo, GetCurrentArchitecture())
  1132. #define CallNPN_HasPropertyProc(FUNC, ARG1, ARG2, ARG3) \
  1133. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_HasPropertyProcInfo, (ARG1), (ARG2), (ARG3))
  1134. #else
  1135. typedef bool (* NP_LOADDS NPN_HasPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  1136. #define NewNPN_HasPropertyProc(FUNC) \
  1137. ((NPN_HasPropertyUPP) (FUNC))
  1138. #define CallNPN_HasPropertyProc(FUNC, ARG1, ARG2, ARG3) \
  1139. (*(FUNC))((ARG1), (ARG2), (ARG3))
  1140. #endif
  1141. /* NPN_HasMethod */
  1142. #if _NPUPP_USE_UPP_
  1143. typedef UniversalProcPtr NPN_HasMethodUPP;
  1144. enum {
  1145. uppNPN_HasMethodProcInfo = kThinkCStackBased
  1146. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1147. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPObject*)))
  1148. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPIdentifier)))
  1149. | RESULT_SIZE(SIZE_CODE(sizeof(bool)))
  1150. };
  1151. #define NewNPN_HasMethodProc(FUNC) \
  1152. (NPN_HasMethodUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_HasMethodProcInfo, GetCurrentArchitecture())
  1153. #define CallNPN_HasMethodProc(FUNC, ARG1, ARG2, ARG3) \
  1154. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_HasMethodProcInfo, (ARG1), (ARG2), (ARG3))
  1155. #else
  1156. typedef bool (* NP_LOADDS NPN_HasMethodUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  1157. #define NewNPN_HasMethodProc(FUNC) \
  1158. ((NPN_HasMethodUPP) (FUNC))
  1159. #define CallNPN_HasMethodProc(FUNC, ARG1, ARG2, ARG3) \
  1160. (*(FUNC))((ARG1), (ARG2), (ARG3))
  1161. #endif
  1162. /* NPN_ReleaseVariantValue */
  1163. #if _NPUPP_USE_UPP_
  1164. typedef UniversalProcPtr NPN_ReleaseVariantValue;
  1165. enum {
  1166. uppNPN_ReleaseVariantValueProcInfo = kThinkCStackBased
  1167. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPVariant*)))
  1168. | RESULT_SIZE(SIZE_CODE(0))
  1169. };
  1170. #define NewNPN_ReleaseVariantValueProc(FUNC) \
  1171. (NPN_ReleaseVariantValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReleaseVariantValueProcInfo, GetCurrentArchitecture())
  1172. #define CallNPN_ReleaseVariantValueProc(FUNC, ARG1) \
  1173. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReleaseVariantValueProcInfo, (ARG1))
  1174. #else
  1175. typedef void (* NP_LOADDS NPN_ReleaseVariantValueUPP)(NPVariant *variant);
  1176. #define NewNPN_ReleaseVariantValueProc(FUNC) \
  1177. ((NPN_ReleaseVariantValueUPP) (FUNC))
  1178. #define CallNPN_ReleaseVariantValueProc(FUNC, ARG1) \
  1179. (*(FUNC))((ARG1))
  1180. #endif
  1181. /* NPN_SetException */
  1182. #if _NPUPP_USE_UPP_
  1183. typedef UniversalProcPtr NPN_SetExceptionUPP;
  1184. enum {
  1185. uppNPN_SetExceptionProcInfo = kThinkCStackBased
  1186. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPObject*)))
  1187. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const NPUTF8*)))
  1188. | RESULT_SIZE(SIZE_CODE(0))
  1189. };
  1190. #define NewNPN_SetExceptionProc(FUNC) \
  1191. (NPN_SetExceptionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_SetExceptionProcInfo, GetCurrentArchitecture())
  1192. #define CallNPN_SetExceptionProc(FUNC, ARG1, ARG2) \
  1193. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_SetExceptionProcInfo, (ARG1), (ARG2))
  1194. #else
  1195. typedef void (* NP_LOADDS NPN_SetExceptionUPP)(NPObject *obj, const NPUTF8 *message);
  1196. #define NewNPN_SetExceptionProc(FUNC) \
  1197. ((NPN_SetExceptionUPP) (FUNC))
  1198. #define CallNPN_SetExceptionProc(FUNC, ARG1, ARG2) \
  1199. (*(FUNC))((ARG1), (ARG2))
  1200. #endif
  1201. /* NPN_PushPopupsEnabledStateUPP */
  1202. #if _NPUPP_USE_UPP_
  1203. typedef UniversalProcPtr NPN_PushPopupsEnabledStateUPP;
  1204. enum {
  1205. uppNPN_PushPopupsEnabledStateProcInfo = kThinkCStackBased
  1206. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1207. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPBool)))
  1208. | RESULT_SIZE(SIZE_CODE(0))
  1209. };
  1210. #define NewNPN_PushPopupsEnabledStateProc(FUNC) \
  1211. (NPN_PushPopupsEnabledStateUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PushPopupsEnabledStateProcInfo, GetCurrentArchitecture())
  1212. #define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
  1213. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PushPopupsEnabledStateProcInfo, (ARG1), (ARG2))
  1214. #else
  1215. typedef bool (* NP_LOADDS NPN_PushPopupsEnabledStateUPP)(NPP npp, NPBool enabled);
  1216. #define NewNPN_PushPopupsEnabledStateProc(FUNC) \
  1217. ((NPN_PushPopupsEnabledStateUPP) (FUNC))
  1218. #define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
  1219. (*(FUNC))((ARG1), (ARG2))
  1220. #endif
  1221. /* NPN_PopPopupsEnabledState */
  1222. #if _NPUPP_USE_UPP_
  1223. typedef UniversalProcPtr NPN_PopPopupsEnabledStateUPP;
  1224. enum {
  1225. uppNPN_PopPopupsEnabledStateProcInfo = kThinkCStackBased
  1226. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
  1227. | RESULT_SIZE(SIZE_CODE(0))
  1228. };
  1229. #define NewNPN_PopPopupsEnabledStateProc(FUNC) \
  1230. (NPN_PopPopupsEnabledStateUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PopPopupsEnabledStateProcInfo, GetCurrentArchitecture())
  1231. #define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
  1232. (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PopPopupsEnabledStateProcInfo, (ARG1))
  1233. #else
  1234. typedef bool (* NP_LOADDS NPN_PopPopupsEnabledStateUPP)(NPP npp);
  1235. #define NewNPN_PopPopupsEnabledStateProc(FUNC) \
  1236. ((NPN_PopPopupsEnabledStateUPP) (FUNC))
  1237. #define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
  1238. (*(FUNC))((ARG1))
  1239. #endif
  1240. /******************************************************************************************
  1241. * The actual plugin function table definitions
  1242. *******************************************************************************************/
  1243. #ifdef XP_MAC
  1244. #if PRAGMA_STRUCT_ALIGN
  1245. #pragma options align=mac68k
  1246. #endif
  1247. #endif
  1248. typedef struct _NPPluginFuncs {
  1249. uint16 size;
  1250. uint16 version;
  1251. NPP_NewUPP newp;
  1252. NPP_DestroyUPP destroy;
  1253. NPP_SetWindowUPP setwindow;
  1254. NPP_NewStreamUPP newstream;
  1255. NPP_DestroyStreamUPP destroystream;
  1256. NPP_StreamAsFileUPP asfile;
  1257. NPP_WriteReadyUPP writeready;
  1258. NPP_WriteUPP write;
  1259. NPP_PrintUPP print;
  1260. NPP_HandleEventUPP event;
  1261. NPP_URLNotifyUPP urlnotify;
  1262. JRIGlobalRef javaClass;
  1263. NPP_GetValueUPP getvalue;
  1264. NPP_SetValueUPP setvalue;
  1265. } NPPluginFuncs;
  1266. typedef struct _NPNetscapeFuncs {
  1267. uint16 size;
  1268. uint16 version;
  1269. NPN_GetURLUPP geturl;
  1270. NPN_PostURLUPP posturl;
  1271. NPN_RequestReadUPP requestread;
  1272. NPN_NewStreamUPP newstream;
  1273. NPN_WriteUPP write;
  1274. NPN_DestroyStreamUPP destroystream;
  1275. NPN_StatusUPP status;
  1276. NPN_UserAgentUPP uagent;
  1277. NPN_MemAllocUPP memalloc;
  1278. NPN_MemFreeUPP memfree;
  1279. NPN_MemFlushUPP memflush;
  1280. NPN_ReloadPluginsUPP reloadplugins;
  1281. NPN_GetJavaEnvUPP getJavaEnv;
  1282. NPN_GetJavaPeerUPP getJavaPeer;
  1283. NPN_GetURLNotifyUPP geturlnotify;
  1284. NPN_PostURLNotifyUPP posturlnotify;
  1285. NPN_GetValueUPP getvalue;
  1286. NPN_SetValueUPP setvalue;
  1287. NPN_InvalidateRectUPP invalidaterect;
  1288. NPN_InvalidateRegionUPP invalidateregion;
  1289. NPN_ForceRedrawUPP forceredraw;
  1290. NPN_GetStringIdentifierUPP getstringidentifier;
  1291. NPN_GetStringIdentifiersUPP getstringidentifiers;
  1292. NPN_GetIntIdentifierUPP getintidentifier;
  1293. NPN_IdentifierIsStringUPP identifierisstring;
  1294. NPN_UTF8FromIdentifierUPP utf8fromidentifier;
  1295. NPN_IntFromIdentifierUPP intfromidentifier;
  1296. NPN_CreateObjectUPP createobject;
  1297. NPN_RetainObjectUPP retainobject;
  1298. NPN_ReleaseObjectUPP releaseobject;
  1299. NPN_InvokeUPP invoke;
  1300. NPN_InvokeDefaultUPP invokeDefault;
  1301. NPN_EvaluateUPP evaluate;
  1302. NPN_GetPropertyUPP getproperty;
  1303. NPN_SetPropertyUPP setproperty;
  1304. NPN_RemovePropertyUPP removeproperty;
  1305. NPN_HasPropertyUPP hasproperty;
  1306. NPN_HasMethodUPP hasmethod;
  1307. NPN_ReleaseVariantValueUPP releasevariantvalue;
  1308. NPN_SetExceptionUPP setexception;
  1309. NPN_PushPopupsEnabledStateUPP pushpopupsenabledstate;
  1310. NPN_PopPopupsEnabledStateUPP poppopupsenabledstate;
  1311. } NPNetscapeFuncs;
  1312. #ifdef XP_MAC
  1313. #if PRAGMA_STRUCT_ALIGN
  1314. #pragma options align=reset
  1315. #endif
  1316. #endif
  1317. #if defined(XP_MAC) || defined(XP_MACOSX)
  1318. /******************************************************************************************
  1319. * Mac platform-specific plugin glue stuff
  1320. *******************************************************************************************/
  1321. /*
  1322. * Main entry point of the plugin.
  1323. * This routine will be called when the plugin is loaded. The function
  1324. * tables are passed in and the plugin fills in the NPPluginFuncs table
  1325. * and NPPShutdownUPP for Netscape's use.
  1326. */
  1327. #if _NPUPP_USE_UPP_
  1328. typedef UniversalProcPtr NPP_MainEntryUPP;
  1329. enum {
  1330. uppNPP_MainEntryProcInfo = kThinkCStackBased
  1331. | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*)))
  1332. | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*)))
  1333. | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*)))
  1334. | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
  1335. };
  1336. #define NewNPP_MainEntryProc(FUNC) \
  1337. (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture())
  1338. #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
  1339. CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP))
  1340. #else
  1341. typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
  1342. #define NewNPP_MainEntryProc(FUNC) \
  1343. ((NPP_MainEntryUPP) (FUNC))
  1344. #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
  1345. (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
  1346. #endif
  1347. /*
  1348. * Mac version(s) of NP_GetMIMEDescription(const char *)
  1349. * These can be called to retreive MIME information from the plugin dynamically
  1350. *
  1351. * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
  1352. * to get mime info from the plugin only on OSX and may not be supported
  1353. * in furture version--use NP_GetMIMEDescription instead
  1354. */
  1355. enum
  1356. {
  1357. kBPSupportedMIMETypesStructVers_1 = 1
  1358. };
  1359. typedef struct _BPSupportedMIMETypes
  1360. {
  1361. SInt32 structVersion; /* struct version */
  1362. Handle typeStrings; /* STR# formated handle, allocated by plug-in */
  1363. Handle infoStrings; /* STR# formated handle, allocated by plug-in */
  1364. } BPSupportedMIMETypes;
  1365. OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
  1366. #if _NPUPP_USE_UPP_
  1367. #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescriptionRD"
  1368. typedef UniversalProcPtr NP_GetMIMEDescriptionUPP;
  1369. enum {
  1370. uppNP_GetMIMEDescEntryProc = kThinkCStackBased
  1371. | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
  1372. };
  1373. #define NewNP_GetMIMEDescEntryProc(FUNC) \
  1374. (NP_GetMIMEDescriptionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNP_GetMIMEDescEntryProc, GetCurrentArchitecture())
  1375. #define CallNP_GetMIMEDescEntryProc(FUNC) \
  1376. (const char *)CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNP_GetMIMEDescEntryProc)
  1377. #else /* !_NPUPP_USE_UPP_ */
  1378. /* NP_GetMIMEDescription */
  1379. #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
  1380. typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
  1381. #define NewNP_GetMIMEDescEntryProc(FUNC) \
  1382. ((NP_GetMIMEDescriptionUPP) (FUNC))
  1383. #define CallNP_GetMIMEDescEntryProc(FUNC) \
  1384. (*(FUNC))()
  1385. /* BP_GetSupportedMIMETypes */
  1386. typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32);
  1387. #define NewBP_GetSupportedMIMETypesEntryProc(FUNC) \
  1388. ((BP_GetSupportedMIMETypesUPP) (FUNC))
  1389. #define CallBP_GetMIMEDescEntryProc(FUNC, mimeInfo, flags) \
  1390. (*(FUNC))((mimeInfo), (flags))
  1391. #endif
  1392. #endif /* MAC */
  1393. #if defined(_WINDOWS)
  1394. #define OSCALL WINAPI
  1395. #else
  1396. #if defined(__OS2__)
  1397. #define OSCALL _System
  1398. #else
  1399. #define OSCALL
  1400. #endif
  1401. #endif
  1402. #if defined( _WINDOWS ) || defined (__OS2__)
  1403. #ifdef __cplusplus
  1404. extern "C" {
  1405. #endif
  1406. /* plugin meta member functions */
  1407. #if defined(__OS2__)
  1408. typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
  1409. char *pMimeTypes;
  1410. char *pFileExtents;
  1411. char *pFileOpenTemplate;
  1412. char *pProductName;
  1413. char *pProductDescription;
  1414. unsigned long dwProductVersionMS;
  1415. unsigned long dwProductVersionLS;
  1416. } NPPluginData;
  1417. NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
  1418. #endif
  1419. NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
  1420. NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
  1421. NPError OSCALL NP_Shutdown();
  1422. char* NP_GetMIMEDescription();
  1423. #ifdef __cplusplus
  1424. }
  1425. #endif
  1426. #endif /* _WINDOWS || __OS2__ */
  1427. #if defined(__OS2__)
  1428. #pragma pack()
  1429. #endif
  1430. #ifdef XP_UNIX
  1431. #ifdef __cplusplus
  1432. extern "C" {
  1433. #endif
  1434. /* plugin meta member functions */
  1435. char* NP_GetMIMEDescription(void);
  1436. NPError NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
  1437. NPError NP_Shutdown(void);
  1438. NPError NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
  1439. #ifdef __cplusplus
  1440. }
  1441. #endif
  1442. #endif /* XP_UNIX */
  1443. #endif /* _NPUPP_H_ */