glib2.pas 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826
  1. { GLIB - Library of useful routines for C programming
  2. Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with this library; if not, write to the
  13. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA.
  15. }
  16. {
  17. Modified by the GLib Team and others 1997-2000. See the AUTHORS
  18. file for a list of people on the GLib Team. See the ChangeLog
  19. files for a list of changes. These files are distributed with
  20. GLib at ftp://ftp.gtk.org/pub/gtk/.
  21. }
  22. unit glib2; // keep unit name lowercase for kylix
  23. {$IFDEF FPC}
  24. {$mode objfpc}
  25. {$ENDIF}
  26. {$IFDEF VER140}
  27. {$DEFINE KYLIX}
  28. {$ENDIF}
  29. interface
  30. uses
  31. ctypes,SysUtils;
  32. const
  33. {$ifdef win32}
  34. {$define gtkwin}
  35. gliblib = 'libglib-2.0-0.dll';
  36. gthreadlib = 'libgthread-2.0-0.dll';
  37. gmodulelib = 'libgmodule-2.0-0.dll';
  38. gobjectlib = 'libgobject-2.0-0.dll';
  39. {$IFDEF FPC}
  40. {$ifndef NO_SMART_LINK}
  41. {$smartlink on}
  42. {$endif}
  43. {$ENDIF}
  44. {$else}
  45. {$ifdef UseCustomLibs}
  46. gliblib = '';
  47. gthreadlib = '';
  48. gmodulelib = '';
  49. gobjectlib = '';
  50. {$else}
  51. gliblib = 'libglib-2.0.so';
  52. gthreadlib = 'libgthread-2.0.so';
  53. gmodulelib = 'libgmodule-2.0.so';
  54. gobjectlib = 'libgobject-2.0.so';
  55. {$endif}
  56. {$endif}
  57. {$ifdef FREEBSD}
  58. {$linklib c}
  59. {$linklib pthread}
  60. {$endif}
  61. {$IFNDEF KYLIX}
  62. {$PACKRECORDS C}
  63. {$ELSE}
  64. {$ALIGN 4}
  65. {$WEAKPACKAGEUNIT}
  66. {$WARNINGS OFF}
  67. {$ENDIF}
  68. {$DEFINE read_forward_definitions}
  69. type
  70. // internal types
  71. PGTypePlugin = pointer;
  72. PGParamSpecPool = pointer;
  73. {$include gincludes.inc}
  74. {$UNDEF read_forward_definitions}
  75. {$DEFINE read_interface_types}
  76. {$include gincludes.inc}
  77. {$UNDEF read_interface_types}
  78. {$DEFINE read_interface_rest}
  79. {$include gincludes.inc}
  80. {$UNDEF read_interface_rest}
  81. implementation
  82. {$DEFINE read_implementation}
  83. {$include gincludes.inc}
  84. {$UNDEF read_implementation}
  85. {$IFNDEF KYLIX}
  86. { There is a bug in the compiler. If an external variable is not used, it will
  87. create code, that can't be relocated by the linker.
  88. So, use them in this hidden dummy procedure.
  89. }
  90. procedure CheckUnusedVariable; [Public];
  91. begin
  92. if glib_mem_profiler_table=nil then ;
  93. if (glib_interface_age=0) or (glib_binary_age=0)
  94. or (g_thread_use_default_impl) then ;
  95. end;
  96. {$ENDIF}
  97. {************************************
  98. * macro functions
  99. *
  100. ************************************}
  101. {*
  102. * gtypes.inc
  103. *}
  104. function GUINT16_SWAP_LE_BE_CONSTANT(val: guint16): guint16;
  105. begin
  106. Result:=((val and $ff) shl 8) or ((val and $ff00) shr 8);
  107. end;
  108. function GUINT32_SWAP_LE_BE_CONSTANT(val: guint32): guint32;
  109. begin
  110. Result:=
  111. ((val and $000000ff) shl 24) or
  112. ((val and $0000ff00) shl 8) or
  113. ((val and $00ff0000) shr 8) or
  114. ((val and $ff000000) shr 24);
  115. end;
  116. {*
  117. * glibconfig.inc
  118. *}
  119. function GUINT_TO_POINTER(i: guint): pointer;
  120. begin
  121. Result:=Pointer(PtrInt(i));
  122. end;
  123. {*
  124. * garray.inc
  125. *}
  126. function g_array_append_val(a: PGArray; v : gpointer) : PGArray;
  127. begin
  128. g_array_append_val := g_array_append_vals(a,@(v),1);
  129. end;
  130. function g_array_prepend_val(a: PGArray; v : gpointer) : PGArray;
  131. begin
  132. g_array_prepend_val := g_array_prepend_vals(a,@(v),1);
  133. end;
  134. function g_array_insert_val(a: PGArray; i: guint; v : gpointer) : PGArray;
  135. begin
  136. g_array_insert_val := g_array_insert_vals(a,i,@(v),1);
  137. end;
  138. function g_ptr_array_index (parray: PGPtrArray; index: guint): gpointer;
  139. begin
  140. {$IFDEF FPC}
  141. g_ptr_array_index := parray^.pdata[index];
  142. {$ELSE}
  143. g_ptr_array_index := PGPointer(integer(parray^.pdata) + index*SizeOf(GPointer))^;
  144. {$ENDIF}
  145. end;
  146. {*
  147. * gthread.inc
  148. *}
  149. function G_THREAD_ERROR: TGQuark;
  150. begin
  151. G_THREAD_ERROR:=g_thread_error_quark;
  152. end;
  153. procedure g_mutex_lock (mutex: PGMutex);
  154. begin
  155. {$IFNDEF KYLIX}
  156. if g_threads_got_initialized then
  157. g_thread_functions_for_glib_use.mutex_lock (mutex);
  158. {$ENDIF}
  159. end;
  160. function g_mutex_trylock (mutex: PGMutex):gboolean;
  161. begin
  162. {$IFNDEF KYLIX}
  163. if g_threads_got_initialized then
  164. g_mutex_trylock := g_thread_functions_for_glib_use.mutex_trylock (mutex)
  165. else
  166. g_mutex_trylock := true;
  167. {$ENDIF}
  168. end;
  169. procedure g_mutex_unlock (mutex: PGMutex);
  170. begin
  171. {$IFNDEF KYLIX}
  172. if g_threads_got_initialized then
  173. g_thread_functions_for_glib_use.mutex_unlock (mutex);
  174. {$ENDIF}
  175. end;
  176. procedure g_mutex_free (mutex: PGMutex);
  177. begin
  178. {$IFNDEF KYLIX}
  179. if g_threads_got_initialized then
  180. g_thread_functions_for_glib_use.mutex_free (mutex);
  181. {$ENDIF}
  182. end;
  183. procedure g_cond_wait (cond: PGCond; mutex: PGMutex);
  184. begin
  185. {$IFNDEF KYLIX}
  186. if g_threads_got_initialized then
  187. g_thread_functions_for_glib_use.cond_wait (cond, mutex);
  188. {$ENDIF}
  189. end;
  190. function g_cond_timed_wait (cond : PGCond;
  191. mutex : PGMutex;
  192. end_time : PGTimeVal):gboolean;
  193. begin
  194. {$IFNDEF KYLIX}
  195. if g_threads_got_initialized then
  196. g_cond_timed_wait := g_thread_functions_for_glib_use.cond_timed_wait (cond,
  197. mutex,
  198. end_time)
  199. else
  200. g_cond_timed_wait := true;
  201. {$ENDIF}
  202. end;
  203. function g_thread_supported: gboolean;
  204. begin
  205. {$IFNDEF KYLIX}
  206. g_thread_supported := g_threads_got_initialized;
  207. {$ENDIF}
  208. end;
  209. function g_mutex_new : PGMutex;
  210. begin
  211. {$IFNDEF KYLIX}
  212. g_mutex_new := g_thread_functions_for_glib_use.mutex_new;
  213. {$ENDIF}
  214. end;
  215. function g_cond_new : PGCond;
  216. begin
  217. {$IFNDEF KYLIX}
  218. g_cond_new := g_thread_functions_for_glib_use.cond_new;
  219. {$ENDIF}
  220. end;
  221. procedure g_cond_signal (cond: PGCond);
  222. begin
  223. {$IFNDEF KYLIX}
  224. if g_threads_got_initialized then
  225. g_thread_functions_for_glib_use.cond_signal (cond);
  226. {$ENDIF}
  227. end;
  228. procedure g_cond_broadcast (cond: PGCond);
  229. begin
  230. {$IFNDEF KYLIX}
  231. if g_threads_got_initialized then
  232. g_thread_functions_for_glib_use.cond_broadcast (cond);
  233. {$ENDIF}
  234. end;
  235. procedure g_cond_free (cond: PGCond);
  236. begin
  237. {$IFNDEF KYLIX}
  238. if g_threads_got_initialized then
  239. g_thread_functions_for_glib_use.cond_free (cond);
  240. {$ENDIF}
  241. end;
  242. function g_private_new (dest: TGDestroyNotify): PGPrivate;
  243. begin
  244. {$IFNDEF KYLIX}
  245. g_private_new := g_thread_functions_for_glib_use.private_new (dest);
  246. {$ENDIF}
  247. end;
  248. function g_private_get (private_key: PGPrivate): gpointer;
  249. begin
  250. {$IFNDEF KYLIX}
  251. // convert result to gpointer
  252. if g_threads_got_initialized then
  253. g_private_get := g_thread_functions_for_glib_use.private_get (private_key)
  254. else
  255. g_private_get := private_key;
  256. {$ENDIF}
  257. end;
  258. procedure g_private_set (var private_key: PGPrivate; data: gpointer);
  259. begin
  260. {$IFNDEF KYLIX}
  261. if g_threads_got_initialized then
  262. // g_private_set := g_thread_functions_for_glib_use.private_set (private_key, data)
  263. else
  264. private_key := data; // data casted to GPrivate
  265. {$ENDIF}
  266. end;
  267. procedure g_thread_yield;
  268. begin
  269. {$IFNDEF KYLIX}
  270. if g_threads_got_initialized then
  271. g_thread_functions_for_glib_use.thread_yield;
  272. {$ENDIF}
  273. end;
  274. function g_thread_create (func: TGThreadFunc;
  275. data: gpointer;
  276. joinable: gboolean;
  277. error: PPGError): PGThread;
  278. begin
  279. g_thread_create := g_thread_create_full (func, data, 0, joinable, false,
  280. G_THREAD_PRIORITY_NORMAL, error);
  281. end;
  282. function g_static_mutex_get_mutex(mutex: PPGMutex):PGMutex;
  283. begin
  284. g_static_mutex_get_mutex := g_static_mutex_get_mutex_impl (mutex);
  285. end;
  286. procedure g_static_mutex_lock (mutex: PGStaticMutex);
  287. begin
  288. g_mutex_lock (g_static_mutex_get_mutex_impl (PPGMutex(mutex)));
  289. end;
  290. function g_static_mutex_trylock (mutex: PGStaticMutex): gboolean;
  291. begin
  292. g_static_mutex_trylock := g_mutex_trylock (g_static_mutex_get_mutex (PPGMutex(mutex)));
  293. end;
  294. procedure g_static_mutex_unlock (mutex: PGStaticMutex);
  295. begin
  296. g_mutex_unlock (g_static_mutex_get_mutex_impl (PPGMutex(mutex)));
  297. end;
  298. {*
  299. * gmain.inc
  300. *}
  301. function g_main_new(is_running: gboolean): PGMainLoop;
  302. begin
  303. g_main_new := g_main_loop_new (nil, is_running);
  304. end;
  305. function g_main_iteration (may_block: gboolean): gboolean;
  306. begin
  307. g_main_iteration := g_main_context_iteration (nil, may_block);
  308. end;
  309. function g_main_pending: gboolean;
  310. begin
  311. g_main_pending := g_main_context_pending (nil);
  312. end;
  313. procedure g_main_set_poll_func(func: TGPollFunc);
  314. begin
  315. g_main_context_set_poll_func (nil, func);
  316. end;
  317. {*
  318. * gslist.inc
  319. *}
  320. function g_slist_next(slist : PGSList) : PGSList;
  321. begin
  322. if slist <> nil then
  323. g_slist_next := slist^.next
  324. else
  325. g_slist_next := nil;
  326. end;
  327. {*
  328. * gmem.inc
  329. *}
  330. function g_new(bytes_per_struct, n_structs: gsize): gpointer;
  331. begin
  332. g_new:=g_malloc(n_structs*bytes_per_struct);
  333. end;
  334. function g_new0(bytes_per_struct, n_structs: gsize): gpointer;
  335. begin
  336. g_new0:=g_malloc0(n_structs*bytes_per_struct);
  337. end;
  338. function g_renew(struct_size: gsize; OldMem: gpointer; n_structs : gsize) : gpointer;
  339. begin
  340. g_renew:=g_realloc(OldMem,struct_size*n_structs);
  341. end;
  342. function g_chunk_new(chunk : Pointer) : Pointer;
  343. begin
  344. g_chunk_new:=g_mem_chunk_alloc(chunk);
  345. end;
  346. function g_chunk_new0(chunk : Pointer) : Pointer;
  347. begin
  348. g_chunk_new0:=g_mem_chunk_alloc0(chunk);
  349. end;
  350. procedure g_chunk_free(mem_chunk:PGMemChunk; mem:gpointer);
  351. begin
  352. g_mem_chunk_free(mem_chunk,mem);
  353. end;
  354. {*
  355. * glist.inc
  356. *}
  357. function g_list_previous (list : PGList) : PGList;
  358. begin
  359. if list <> nil then
  360. g_list_previous:=(PGList(list))^.prev
  361. else
  362. g_list_previous:=nil;
  363. end;
  364. function g_list_next (list : PGList) : PGList;
  365. begin
  366. if list <> nil then
  367. g_list_next:=(PGList(list))^.next
  368. else
  369. g_list_next:=NULL;
  370. end;
  371. {*
  372. * gconvert,inc
  373. *}
  374. function G_CONVERT_ERROR : TGQuark;
  375. begin
  376. G_CONVERT_ERROR:=g_convert_error_quark;
  377. end;
  378. {*
  379. * gdataset.inc
  380. *}
  381. procedure g_datalist_id_set_data (datalist: PPGData; key_id:TGQuark; data: gpointer);
  382. begin
  383. g_datalist_id_set_data_full (datalist, key_id, data, nil);
  384. end;
  385. procedure g_datalist_id_remove_data (datalist: PPGData; key_id:TGQuark);
  386. begin
  387. g_datalist_id_set_data (datalist, key_id, NULL);
  388. end;
  389. function g_datalist_get_data(datalist: PPGData; key_str:PGChar):PPGData;
  390. begin
  391. g_datalist_get_data := g_datalist_id_get_data (datalist, g_quark_try_string (key_str));
  392. end;
  393. procedure g_datalist_set_data_full(datalist: PPGData; key_str:PGChar; data:gpointer; destroy_func:TGDestroyNotify);
  394. begin
  395. g_datalist_id_set_data_full (datalist, g_quark_from_string (key_str), data, destroy_func);
  396. end;
  397. procedure g_datalist_set_data (datalist: PPGData; key_str:PGChar; data:gpointer);
  398. begin
  399. g_datalist_set_data_full (datalist, key_str, data, nil);
  400. end;
  401. procedure g_datalist_remove_no_notify(datalist: PPGData; key_str:PGChar);
  402. begin
  403. g_datalist_id_remove_no_notify (datalist, g_quark_try_string (key_str) );
  404. end;
  405. procedure g_datalist_remove_data(datalist:PPGData; key_str:PGChar);
  406. begin
  407. g_datalist_id_set_data (datalist, g_quark_try_string (key_str), nil);
  408. end;
  409. procedure g_dataset_id_set_data(location: gconstpointer; key_id:TGQuark; data:gpointer);
  410. begin
  411. g_dataset_id_set_data_full (location, key_id, data, nil);
  412. end;
  413. procedure g_dataset_id_remove_data(location: gconstpointer; key_id:TGQuark);
  414. begin
  415. g_dataset_id_set_data (location, key_id, nil);
  416. end;
  417. function g_dataset_get_data(location: gconstpointer; key_str:PGChar): gpointer;
  418. begin
  419. g_dataset_get_data:= g_dataset_id_get_data (location, g_quark_try_string (key_str));
  420. end;
  421. procedure g_dataset_set_data_full(location: gconstpointer; key_str:PGChar; data:gpointer; destroy_func:TGDestroyNotify);
  422. begin
  423. g_dataset_id_set_data_full (location, g_quark_from_string (key_str), data, destroy_func);
  424. end;
  425. procedure g_dataset_remove_no_notify(location: gconstpointer; key_str:PGChar);
  426. begin
  427. g_dataset_id_remove_no_notify (location, g_quark_try_string (key_str));
  428. end;
  429. procedure g_dataset_set_data(location: gconstpointer; key_str:PGChar; data:gpointer);
  430. begin
  431. g_dataset_set_data_full (location, key_str, data, nil);
  432. end;
  433. procedure g_dataset_remove_data(location:gconstpointer; key_str: PGChar);
  434. begin
  435. g_dataset_id_set_data (location, g_quark_try_string (key_str), nil);
  436. end;
  437. {*
  438. * gfileutils.inc
  439. *}
  440. function G_FILE_ERROR: TGQuark;
  441. begin
  442. G_FILE_ERROR:=g_file_error_quark;
  443. end;
  444. {*
  445. * ghook.inc
  446. *}
  447. function TGHookList_hook_size (var a : TGHookList) : guint;
  448. begin
  449. TGHookList_hook_size:=(a.flag0 and bm_TGHookList_hook_size) shr bp_TGHookList_hook_size;
  450. end;
  451. procedure TGHookList_set_hook_size (var a : TGHookList; __hook_size : guint);
  452. begin
  453. a.flag0:=a.flag0 or ((__hook_size shl bp_TGHookList_hook_size) and bm_TGHookList_hook_size);
  454. end;
  455. function TGHookList_is_setup (var a : TGHookList) : guint;
  456. begin
  457. TGHookList_is_setup:=(a.flag0 and bm_TGHookList_is_setup) shr bp_TGHookList_is_setup;
  458. end;
  459. procedure TGHookList_set_is_setup (var a : TGHookList; __is_setup : guint);
  460. begin
  461. a.flag0:=a.flag0 or ((__is_setup shl bp_TGHookList_is_setup) and bm_TGHookList_is_setup);
  462. end;
  463. function G_HOOK(hook : pointer) : PGHook;
  464. begin
  465. G_HOOK := PGHook(hook);
  466. end;
  467. function G_HOOK_FLAGS(hook : PGHook) : guint;
  468. begin
  469. G_HOOK_FLAGS := hook^.flags;
  470. end;
  471. { from the old glib}
  472. function G_HOOK_ACTIVE(hook : PGHook) : boolean;
  473. begin
  474. G_HOOK_ACTIVE:=(((PGHook(hook))^.flags) and cardinal(G_HOOK_FLAG_ACTIVE)) <> 0;
  475. end;
  476. function G_HOOK_IN_CALL(hook : PGHook) : boolean;
  477. begin
  478. G_HOOK_IN_CALL:=(((PGHook(hook))^.flags) and cardinal(G_HOOK_FLAG_IN_CALL)) <> 0;
  479. end;
  480. function G_HOOK_IS_VALID(hook : PGHook) : boolean;
  481. begin
  482. G_HOOK_IS_VALID:=(hook^.hook_id<>0) and G_HOOK_ACTIVE(hook);
  483. end;
  484. function G_HOOK_IS_UNLINKED(hook : PGHook) : boolean;
  485. begin
  486. G_HOOK_IS_UNLINKED:=(hook^.next=NULL) and (hook^.prev=NULL) and (hook^.hook_id=0) and (hook^.ref_count = 0);
  487. end;
  488. { end of old glib}
  489. procedure g_hook_append (hook_list: PGHookList; hook:PGHook);
  490. begin
  491. g_hook_insert_before (hook_list, nil, hook);
  492. end;
  493. {*
  494. * giochannel.inc
  495. *}
  496. function G_IO_CHANNEL_ERROR : TGQuark;
  497. begin
  498. G_IO_CHANNEL_ERROR:=g_io_channel_error_quark;
  499. end;
  500. function TGIOChannel_use_buffer(var a : TGIOChannel) : guint;
  501. begin
  502. TGIOChannel_use_buffer:=(a.flag0 and bm_TGIOChannel_use_buffer) shr bp_TGIOChannel_use_buffer;
  503. end;
  504. procedure TGIOChannel_set_use_buffer(var a : TGIOChannel; __use_buffer : guint);
  505. begin
  506. a.flag0:=a.flag0 or ((__use_buffer shl bp_TGIOChannel_use_buffer) and bm_TGIOChannel_use_buffer);
  507. end;
  508. function TGIOChannel_do_encode(var a : TGIOChannel) : guint;
  509. begin
  510. TGIOChannel_do_encode:=(a.flag0 and bm_TGIOChannel_do_encode) shr bp_TGIOChannel_do_encode;
  511. end;
  512. procedure TGIOChannel_set_do_encode(var a : TGIOChannel; __do_encode : guint);
  513. begin
  514. a.flag0:=a.flag0 or ((__do_encode shl bp_TGIOChannel_do_encode) and bm_TGIOChannel_do_encode);
  515. end;
  516. function TGIOChannel_close_on_unref(var a : TGIOChannel) : guint;
  517. begin
  518. TGIOChannel_close_on_unref:=(a.flag0 and bm_TGIOChannel_close_on_unref) shr bp_TGIOChannel_close_on_unref;
  519. end;
  520. procedure TGIOChannel_set_close_on_unref(var a : TGIOChannel; __close_on_unref : guint);
  521. begin
  522. a.flag0:=a.flag0 or ((__close_on_unref shl bp_TGIOChannel_close_on_unref) and bm_TGIOChannel_close_on_unref);
  523. end;
  524. function TGIOChannel_is_readable(var a : TGIOChannel) : guint;
  525. begin
  526. TGIOChannel_is_readable:=(a.flag0 and bm_TGIOChannel_is_readable) shr bp_TGIOChannel_is_readable;
  527. end;
  528. procedure TGIOChannel_set_is_readable(var a : TGIOChannel; __is_readable : guint);
  529. begin
  530. a.flag0:=a.flag0 or ((__is_readable shl bp_TGIOChannel_is_readable) and bm_TGIOChannel_is_readable);
  531. end;
  532. function TGIOChannel_is_writeable(var a : TGIOChannel) : guint;
  533. begin
  534. TGIOChannel_is_writeable:=(a.flag0 and bm_TGIOChannel_is_writeable) shr bp_TGIOChannel_is_writeable;
  535. end;
  536. procedure TGIOChannel_set_is_writeable(var a : TGIOChannel; __is_writeable : guint);
  537. begin
  538. a.flag0:=a.flag0 or ((__is_writeable shl bp_TGIOChannel_is_writeable) and bm_TGIOChannel_is_writeable);
  539. end;
  540. function TGIOChannel_is_seekable(var a : TGIOChannel) : guint;
  541. begin
  542. TGIOChannel_is_seekable:=(a.flag0 and bm_TGIOChannel_is_seekable) shr bp_TGIOChannel_is_seekable;
  543. end;
  544. procedure TGIOChannel_set_is_seekable(var a : TGIOChannel; __is_seekable : guint);
  545. begin
  546. a.flag0:=a.flag0 or ((__is_seekable shl bp_TGIOChannel_is_seekable) and bm_TGIOChannel_is_seekable);
  547. end;
  548. {*
  549. * gunicode.inc
  550. *}
  551. function g_utf8_next_char (p: pguchar):pguchar;
  552. begin
  553. {$IFNDEF KYLIX}
  554. g_utf8_next_char := p + ord ((g_utf8_skip + p^ )^); // needs to be tested
  555. {$ENDIF}
  556. end;
  557. {*
  558. * gutils.inc
  559. *}
  560. function GLIB_CHECK_VERSION (major, minor, micro: guint):boolean;
  561. begin
  562. {$IFNDEF KYLIX}
  563. GLIB_CHECK_VERSION := ( (GLIB_MAJOR_VERSION > major) or
  564. ((GLIB_MAJOR_VERSION = major) and (GLIB_MINOR_VERSION > minor)) or
  565. ((GLIB_MAJOR_VERSION = major) and (GLIB_MINOR_VERSION = minor) and (GLIB_MICRO_VERSION >= micro)));
  566. {$ENDIF}
  567. end;
  568. {*
  569. * gmessages.inc
  570. *}
  571. procedure g_error (format:Pgchar; args: array of const);
  572. begin
  573. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, Pgchar(SysUtils.Format(string(format), args)));
  574. end;
  575. procedure g_error (format:Pgchar);
  576. begin
  577. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format);
  578. end;
  579. procedure g_message (format:Pgchar; args: array of const);
  580. begin
  581. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, Pgchar(SysUtils.Format(string(format), args)));
  582. end;
  583. procedure g_message (format:Pgchar);
  584. begin
  585. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format);
  586. end;
  587. procedure g_critical (format:Pgchar; args: array of const);
  588. begin
  589. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, Pgchar(SysUtils.Format(string(format), args)));
  590. end;
  591. procedure g_critical (format:Pgchar);
  592. begin
  593. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format);
  594. end;
  595. procedure g_warning (format:Pgchar; args: array of const);
  596. begin
  597. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, Pgchar(SysUtils.Format(string(format), args)));
  598. end;
  599. procedure g_warning (format:Pgchar);
  600. begin
  601. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format);
  602. end;
  603. {*
  604. * gmarkup.inc
  605. *}
  606. function G_MARKUP_ERROR : TGQuark;
  607. begin
  608. G_MARKUP_ERROR:=g_markup_error_quark;
  609. end;
  610. {*
  611. * gnode.inc
  612. *}
  613. function G_NODE_IS_ROOT (node: PGNode): boolean;
  614. begin
  615. G_NODE_IS_ROOT := (node^.parent = nil) and (node^.next = nil) and (node^.prev = nil);
  616. end;
  617. function G_NODE_IS_LEAF (node: PGNode): boolean;
  618. begin
  619. G_NODE_IS_LEAF := node^.children = nil;
  620. end;
  621. function g_node_append (parent: PGNode; node: PGNode): PGNode;
  622. begin
  623. g_node_append := g_node_insert_before (parent, nil, node);
  624. end;
  625. function g_node_insert_data (parent: PGNode; position: gint; data: gpointer): PGNode;
  626. begin
  627. g_node_insert_data := g_node_insert (parent, position, g_node_new(data));
  628. end;
  629. function g_node_insert_data_before (parent: PGNode; sibling: PGNode; data: gpointer): PGNode;
  630. begin
  631. g_node_insert_data_before := g_node_insert_before (parent, sibling, g_node_new(data));
  632. end;
  633. function g_node_prepend_data (parent: PGNode; data: gpointer): PGNode;
  634. begin
  635. g_node_prepend_data := g_node_prepend (parent, g_node_new(data));
  636. end;
  637. function g_node_append_data (parent: PGNode; data: gpointer): PGNode;
  638. begin
  639. g_node_append_data := g_node_insert_before (parent, nil, g_node_new(data));
  640. end;
  641. function g_node_prev_sibling (node : PGNode): PGNode;
  642. begin
  643. if node <> nil then
  644. g_node_prev_sibling := node^.prev
  645. else
  646. g_node_prev_sibling := nil;
  647. end;
  648. function g_node_next_sibling (node : PGNode): PGNode;
  649. begin
  650. if node <> nil then
  651. g_node_next_sibling := node^.next
  652. else
  653. g_node_next_sibling := nil;
  654. end;
  655. function g_node_first_child (node : PGNode): PGNode;
  656. begin
  657. if node <> nil then
  658. g_node_first_child := node^.children
  659. else
  660. g_node_first_child := nil;
  661. end;
  662. {*
  663. * grand.inc
  664. *}
  665. function g_rand_boolean(rand : PGRand) : gboolean;
  666. begin
  667. g_rand_boolean:=((g_rand_int(rand)) and (1 shl 15)) <> 0;
  668. end;
  669. {
  670. function g_rand_boolean(rand : PGRand) :gboolean;
  671. begin
  672. if ((g_rand_int(rand)) and (1 shl 15)) <> 0 then
  673. g_rand_boolean := 1
  674. else
  675. g_rand_boolean := 0;
  676. end;
  677. }
  678. function g_random_boolean : gboolean;
  679. begin
  680. g_random_boolean:=((g_random_int) and (1 shl 15)) <> 0;
  681. end;
  682. {
  683. function g_random_boolean : gboolean;
  684. begin
  685. if (((g_random_int) and (1 shl 15))) <> 0 then
  686. g_random_boolean := 1
  687. else
  688. g_random_boolean := 0;
  689. end;
  690. }
  691. {*
  692. * gscanner.inc
  693. *}
  694. function TGScannerConfig_case_sensitive(var a : TGScannerConfig) : guint;
  695. begin
  696. TGScannerConfig_case_sensitive:=(a.flag0 and bm_TGScannerConfig_case_sensitive) shr bp_TGScannerConfig_case_sensitive;
  697. end;
  698. procedure TGScannerConfig_set_case_sensitive(var a : TGScannerConfig; __case_sensitive : guint);
  699. begin
  700. a.flag0:=a.flag0 or ((__case_sensitive shl bp_TGScannerConfig_case_sensitive) and bm_TGScannerConfig_case_sensitive);
  701. end;
  702. function TGScannerConfig_skip_comment_multi(var a : TGScannerConfig) : guint;
  703. begin
  704. TGScannerConfig_skip_comment_multi:=(a.flag0 and bm_TGScannerConfig_skip_comment_multi) shr bp_TGScannerConfig_skip_comment_multi;
  705. end;
  706. procedure TGScannerConfig_set_skip_comment_multi(var a : TGScannerConfig; __skip_comment_multi : guint);
  707. begin
  708. a.flag0:=a.flag0 or ((__skip_comment_multi shl bp_TGScannerConfig_skip_comment_multi) and bm_TGScannerConfig_skip_comment_multi);
  709. end;
  710. function TGScannerConfig_skip_comment_single(var a : TGScannerConfig) : guint;
  711. begin
  712. TGScannerConfig_skip_comment_single:=(a.flag0 and bm_TGScannerConfig_skip_comment_single) shr bp_TGScannerConfig_skip_comment_single;
  713. end;
  714. procedure TGScannerConfig_set_skip_comment_single(var a : TGScannerConfig; __skip_comment_single : guint);
  715. begin
  716. a.flag0:=a.flag0 or ((__skip_comment_single shl bp_TGScannerConfig_skip_comment_single) and bm_TGScannerConfig_skip_comment_single);
  717. end;
  718. function TGScannerConfig_scan_comment_multi(var a : TGScannerConfig) : guint;
  719. begin
  720. TGScannerConfig_scan_comment_multi:=(a.flag0 and bm_TGScannerConfig_scan_comment_multi) shr bp_TGScannerConfig_scan_comment_multi;
  721. end;
  722. procedure TGScannerConfig_set_scan_comment_multi(var a : TGScannerConfig; __scan_comment_multi : guint);
  723. begin
  724. a.flag0:=a.flag0 or ((__scan_comment_multi shl bp_TGScannerConfig_scan_comment_multi) and bm_TGScannerConfig_scan_comment_multi);
  725. end;
  726. function TGScannerConfig_scan_identifier(var a : TGScannerConfig) : guint;
  727. begin
  728. TGScannerConfig_scan_identifier:=(a.flag0 and bm_TGScannerConfig_scan_identifier) shr bp_TGScannerConfig_scan_identifier;
  729. end;
  730. procedure TGScannerConfig_set_scan_identifier(var a : TGScannerConfig; __scan_identifier : guint);
  731. begin
  732. a.flag0:=a.flag0 or ((__scan_identifier shl bp_TGScannerConfig_scan_identifier) and bm_TGScannerConfig_scan_identifier);
  733. end;
  734. function TGScannerConfig_scan_identifier_1char(var a : TGScannerConfig) : guint;
  735. begin
  736. TGScannerConfig_scan_identifier_1char:=(a.flag0 and bm_TGScannerConfig_scan_identifier_1char) shr bp_TGScannerConfig_scan_identifier_1char;
  737. end;
  738. procedure TGScannerConfig_set_scan_identifier_1char(var a : TGScannerConfig; __scan_identifier_1char : guint);
  739. begin
  740. a.flag0:=a.flag0 or ((__scan_identifier_1char shl bp_TGScannerConfig_scan_identifier_1char) and bm_TGScannerConfig_scan_identifier_1char);
  741. end;
  742. function TGScannerConfig_scan_identifier_NULL(var a : TGScannerConfig) : guint;
  743. begin
  744. TGScannerConfig_scan_identifier_NULL:=(a.flag0 and bm_TGScannerConfig_scan_identifier_NULL) shr bp_TGScannerConfig_scan_identifier_NULL;
  745. end;
  746. procedure TGScannerConfig_set_scan_identifier_NULL(var a : TGScannerConfig; __scan_identifier_NULL : guint);
  747. begin
  748. a.flag0:=a.flag0 or ((__scan_identifier_NULL shl bp_TGScannerConfig_scan_identifier_NULL) and bm_TGScannerConfig_scan_identifier_NULL);
  749. end;
  750. function TGScannerConfig_scan_symbols(var a : TGScannerConfig) : guint;
  751. begin
  752. TGScannerConfig_scan_symbols:=(a.flag0 and bm_TGScannerConfig_scan_symbols) shr bp_TGScannerConfig_scan_symbols;
  753. end;
  754. procedure TGScannerConfig_set_scan_symbols(var a : TGScannerConfig; __scan_symbols : guint);
  755. begin
  756. a.flag0:=a.flag0 or ((__scan_symbols shl bp_TGScannerConfig_scan_symbols) and bm_TGScannerConfig_scan_symbols);
  757. end;
  758. function TGScannerConfig_scan_binary(var a : TGScannerConfig) : guint;
  759. begin
  760. TGScannerConfig_scan_binary:=(a.flag0 and bm_TGScannerConfig_scan_binary) shr bp_TGScannerConfig_scan_binary;
  761. end;
  762. procedure TGScannerConfig_set_scan_binary(var a : TGScannerConfig; __scan_binary : guint);
  763. begin
  764. a.flag0:=a.flag0 or ((__scan_binary shl bp_TGScannerConfig_scan_binary) and bm_TGScannerConfig_scan_binary);
  765. end;
  766. function TGScannerConfig_scan_octal(var a : TGScannerConfig) : guint;
  767. begin
  768. TGScannerConfig_scan_octal:=(a.flag0 and bm_TGScannerConfig_scan_octal) shr bp_TGScannerConfig_scan_octal;
  769. end;
  770. procedure TGScannerConfig_set_scan_octal(var a : TGScannerConfig; __scan_octal : guint);
  771. begin
  772. a.flag0:=a.flag0 or ((__scan_octal shl bp_TGScannerConfig_scan_octal) and bm_TGScannerConfig_scan_octal);
  773. end;
  774. function TGScannerConfig_scan_float(var a : TGScannerConfig) : guint;
  775. begin
  776. TGScannerConfig_scan_float:=(a.flag0 and bm_TGScannerConfig_scan_float) shr bp_TGScannerConfig_scan_float;
  777. end;
  778. procedure TGScannerConfig_set_scan_float(var a : TGScannerConfig; __scan_float : guint);
  779. begin
  780. a.flag0:=a.flag0 or ((__scan_float shl bp_TGScannerConfig_scan_float) and bm_TGScannerConfig_scan_float);
  781. end;
  782. function TGScannerConfig_scan_hex(var a : TGScannerConfig) : guint;
  783. begin
  784. TGScannerConfig_scan_hex:=(a.flag0 and bm_TGScannerConfig_scan_hex) shr bp_TGScannerConfig_scan_hex;
  785. end;
  786. procedure TGScannerConfig_set_scan_hex(var a : TGScannerConfig; __scan_hex : guint);
  787. begin
  788. a.flag0:=a.flag0 or ((__scan_hex shl bp_TGScannerConfig_scan_hex) and bm_TGScannerConfig_scan_hex);
  789. end;
  790. function TGScannerConfig_scan_hex_dollar(var a : TGScannerConfig) : guint;
  791. begin
  792. TGScannerConfig_scan_hex_dollar:=(a.flag0 and bm_TGScannerConfig_scan_hex_dollar) shr bp_TGScannerConfig_scan_hex_dollar;
  793. end;
  794. procedure TGScannerConfig_set_scan_hex_dollar(var a : TGScannerConfig; __scan_hex_dollar : guint);
  795. begin
  796. a.flag0:=a.flag0 or ((__scan_hex_dollar shl bp_TGScannerConfig_scan_hex_dollar) and bm_TGScannerConfig_scan_hex_dollar);
  797. end;
  798. function TGScannerConfig_scan_string_sq(var a : TGScannerConfig) : guint;
  799. begin
  800. TGScannerConfig_scan_string_sq:=(a.flag0 and bm_TGScannerConfig_scan_string_sq) shr bp_TGScannerConfig_scan_string_sq;
  801. end;
  802. procedure TGScannerConfig_set_scan_string_sq(var a : TGScannerConfig; __scan_string_sq : guint);
  803. begin
  804. a.flag0:=a.flag0 or ((__scan_string_sq shl bp_TGScannerConfig_scan_string_sq) and bm_TGScannerConfig_scan_string_sq);
  805. end;
  806. function TGScannerConfig_scan_string_dq(var a : TGScannerConfig) : guint;
  807. begin
  808. TGScannerConfig_scan_string_dq:=(a.flag0 and bm_TGScannerConfig_scan_string_dq) shr bp_TGScannerConfig_scan_string_dq;
  809. end;
  810. procedure TGScannerConfig_set_scan_string_dq(var a : TGScannerConfig; __scan_string_dq : guint);
  811. begin
  812. a.flag0:=a.flag0 or ((__scan_string_dq shl bp_TGScannerConfig_scan_string_dq) and bm_TGScannerConfig_scan_string_dq);
  813. end;
  814. function TGScannerConfig_numbers_2_int(var a : TGScannerConfig) : guint;
  815. begin
  816. TGScannerConfig_numbers_2_int:=(a.flag0 and bm_TGScannerConfig_numbers_2_int) shr bp_TGScannerConfig_numbers_2_int;
  817. end;
  818. procedure TGScannerConfig_set_numbers_2_int(var a : TGScannerConfig; __numbers_2_int : guint);
  819. begin
  820. a.flag0:=a.flag0 or ((__numbers_2_int shl bp_TGScannerConfig_numbers_2_int) and bm_TGScannerConfig_numbers_2_int);
  821. end;
  822. function TGScannerConfig_int_2_float(var a : TGScannerConfig) : guint;
  823. begin
  824. TGScannerConfig_int_2_float:=(a.flag0 and bm_TGScannerConfig_int_2_float) shr bp_TGScannerConfig_int_2_float;
  825. end;
  826. procedure TGScannerConfig_set_int_2_float(var a : TGScannerConfig; __int_2_float : guint);
  827. begin
  828. a.flag0:=a.flag0 or ((__int_2_float shl bp_TGScannerConfig_int_2_float) and bm_TGScannerConfig_int_2_float);
  829. end;
  830. function TGScannerConfig_identifier_2_string(var a : TGScannerConfig) : guint;
  831. begin
  832. TGScannerConfig_identifier_2_string:=(a.flag0 and bm_TGScannerConfig_identifier_2_string) shr bp_TGScannerConfig_identifier_2_string;
  833. end;
  834. procedure TGScannerConfig_set_identifier_2_string(var a : TGScannerConfig; __identifier_2_string : guint);
  835. begin
  836. a.flag0:=a.flag0 or ((__identifier_2_string shl bp_TGScannerConfig_identifier_2_string) and bm_TGScannerConfig_identifier_2_string);
  837. end;
  838. function TGScannerConfig_char_2_token(var a : TGScannerConfig) : guint;
  839. begin
  840. TGScannerConfig_char_2_token:=(a.flag0 and bm_TGScannerConfig_char_2_token) shr bp_TGScannerConfig_char_2_token;
  841. end;
  842. procedure TGScannerConfig_set_char_2_token(var a : TGScannerConfig; __char_2_token : guint);
  843. begin
  844. a.flag0:=a.flag0 or ((__char_2_token shl bp_TGScannerConfig_char_2_token) and bm_TGScannerConfig_char_2_token);
  845. end;
  846. function TGScannerConfig_symbol_2_token(var a : TGScannerConfig) : guint;
  847. begin
  848. TGScannerConfig_symbol_2_token:=(a.flag0 and bm_TGScannerConfig_symbol_2_token) shr bp_TGScannerConfig_symbol_2_token;
  849. end;
  850. procedure TGScannerConfig_set_symbol_2_token(var a : TGScannerConfig; __symbol_2_token : guint);
  851. begin
  852. a.flag0:=a.flag0 or ((__symbol_2_token shl bp_TGScannerConfig_symbol_2_token) and bm_TGScannerConfig_symbol_2_token);
  853. end;
  854. function TGScannerConfig_scope_0_fallback(var a : TGScannerConfig) : guint;
  855. begin
  856. TGScannerConfig_scope_0_fallback:=(a.flag0 and bm_TGScannerConfig_scope_0_fallback) shr bp_TGScannerConfig_scope_0_fallback;
  857. end;
  858. procedure TGScannerConfig_set_scope_0_fallback(var a : TGScannerConfig; __scope_0_fallback : guint);
  859. begin
  860. a.flag0:=a.flag0 or ((__scope_0_fallback shl bp_TGScannerConfig_scope_0_fallback) and bm_TGScannerConfig_scope_0_fallback);
  861. end;
  862. procedure g_scanner_freeze_symbol_table(scanner : PGScanner);
  863. begin
  864. { do nothing }
  865. if Scanner=nil then ;
  866. end;
  867. procedure g_scanner_thaw_symbol_table(scanner : PGScanner);
  868. begin
  869. { do nothing }
  870. if Scanner=nil then ;
  871. end;
  872. {*
  873. * gshell.inc
  874. *}
  875. function G_SHELL_ERROR : TGQuark;
  876. begin
  877. G_SHELL_ERROR:=g_shell_error_quark;
  878. end;
  879. {*
  880. * gspawn.inc
  881. *}
  882. function G_SPAWN_ERROR : TGQuark;
  883. begin
  884. G_SPAWN_ERROR:=g_spawn_error_quark;
  885. end;
  886. // from gstrfuncs.inc ----------------------------------------------------------
  887. function g_ascii_isalnum(c : gchar) : boolean;
  888. begin
  889. {$IFNDEF KYLIX}
  890. g_ascii_isalnum:=((g_ascii_table[guchar(c)]) and G_ASCII_ALNUM) <> 0;
  891. {$ENDIF}
  892. end;
  893. function g_ascii_isalpha(c : gchar) : boolean;
  894. begin
  895. {$IFNDEF KYLIX}
  896. g_ascii_isalpha:=((g_ascii_table[guchar(c)]) and G_ASCII_ALPHA) <> 0;
  897. {$ENDIF}
  898. end;
  899. function g_ascii_iscntrl(c : gchar) : boolean;
  900. begin
  901. {$IFNDEF KYLIX}
  902. g_ascii_iscntrl:=((g_ascii_table[guchar(c)]) and G_ASCII_CNTRL) <> 0;
  903. {$ENDIF}
  904. end;
  905. function g_ascii_isdigit(c : gchar) : boolean;
  906. begin
  907. {$IFNDEF KYLIX}
  908. g_ascii_isdigit:=((g_ascii_table[guchar(c)]) and G_ASCII_DIGIT) <> 0;
  909. {$ENDIF}
  910. end;
  911. function g_ascii_isgraph(c : gchar) : boolean;
  912. begin
  913. {$IFNDEF KYLIX}
  914. g_ascii_isgraph:=((g_ascii_table[guchar(c)]) and G_ASCII_GRAPH) <> 0;
  915. {$ENDIF}
  916. end;
  917. function g_ascii_islower(c : gchar) : boolean;
  918. begin
  919. {$IFNDEF KYLIX}
  920. g_ascii_islower:=((g_ascii_table[guchar(c)]) and G_ASCII_LOWER) <> 0;
  921. {$ENDIF}
  922. end;
  923. function g_ascii_isprint(c : gchar) : boolean;
  924. begin
  925. {$IFNDEF KYLIX}
  926. g_ascii_isprint:=((g_ascii_table[guchar(c)]) and G_ASCII_PRINT) <> 0;
  927. {$ENDIF}
  928. end;
  929. function g_ascii_ispunct(c : gchar) : boolean;
  930. begin
  931. {$IFNDEF KYLIX}
  932. g_ascii_ispunct:=((g_ascii_table[guchar(c)]) and G_ASCII_PUNCT) <> 0;
  933. {$ENDIF}
  934. end;
  935. function g_ascii_isspace(c : gchar) : boolean;
  936. begin
  937. {$IFNDEF KYLIX}
  938. g_ascii_isspace:=((g_ascii_table[guchar(c)]) and G_ASCII_SPACE) <> 0;
  939. {$ENDIF}
  940. end;
  941. function g_ascii_isupper(c : gchar) : boolean;
  942. begin
  943. {$IFNDEF KYLIX}
  944. g_ascii_isupper:=((g_ascii_table[guchar(c)]) and G_ASCII_UPPER) <> 0;
  945. {$ENDIF}
  946. end;
  947. function g_ascii_isxdigit(c : gchar) : boolean;
  948. begin
  949. {$IFNDEF KYLIX}
  950. g_ascii_isxdigit:=((g_ascii_table[guchar(c)]) and G_ASCII_XDIGIT) <> 0;
  951. {$ENDIF}
  952. end;
  953. function g_strstrip(_string : PGChar) : PGChar;
  954. begin
  955. g_strstrip:=g_strchomp(g_strchug(_string));
  956. end;
  957. // gtype.inc -------------------------------------------------------------------
  958. function G_TYPE_MAKE_FUNDAMENTAL(x : longint) : GType;
  959. begin
  960. G_TYPE_MAKE_FUNDAMENTAL:=GType(x shl G_TYPE_FUNDAMENTAL_SHIFT);
  961. end;
  962. function G_TYPE_IS_FUNDAMENTAL(_type : GType) : boolean;
  963. begin
  964. G_TYPE_IS_FUNDAMENTAL:=_type <= G_TYPE_FUNDAMENTAL_MAX;
  965. end;
  966. function G_TYPE_IS_DERIVED(_type : GType) : boolean;
  967. begin
  968. G_TYPE_IS_DERIVED:=_type > G_TYPE_FUNDAMENTAL_MAX;
  969. end;
  970. function G_TYPE_IS_INTERFACE(_type : GType) : boolean;
  971. begin
  972. G_TYPE_IS_INTERFACE:=(G_TYPE_FUNDAMENTAL(_type)) = G_TYPE_INTERFACE;
  973. end;
  974. function G_TYPE_IS_CLASSED(_type : GType) : gboolean;
  975. begin
  976. G_TYPE_IS_CLASSED:=private_g_type_test_flags(_type,G_TYPE_FLAG_CLASSED);
  977. end;
  978. function G_TYPE_IS_INSTANTIATABLE(_type : GType) : boolean;
  979. begin
  980. G_TYPE_IS_INSTANTIATABLE:=private_g_type_test_flags(_type,
  981. G_TYPE_FLAG_INSTANTIATABLE);
  982. end;
  983. function G_TYPE_IS_DERIVABLE(_type : GType) : boolean;
  984. begin
  985. G_TYPE_IS_DERIVABLE:=private_g_type_test_flags(_type,G_TYPE_FLAG_DERIVABLE);
  986. end;
  987. function G_TYPE_IS_DEEP_DERIVABLE(_type : GType) : boolean;
  988. begin
  989. G_TYPE_IS_DEEP_DERIVABLE:=private_g_type_test_flags(_type,G_TYPE_FLAG_DEEP_DERIVABLE);
  990. end;
  991. function G_TYPE_IS_ABSTRACT(_type : GType) : boolean;
  992. begin
  993. G_TYPE_IS_ABSTRACT:=private_g_type_test_flags(_type,G_TYPE_FLAG_ABSTRACT);
  994. end;
  995. function G_TYPE_IS_VALUE_ABSTRACT(_type : GType) : boolean;
  996. begin
  997. G_TYPE_IS_VALUE_ABSTRACT:=private_g_type_test_flags(_type,G_TYPE_FLAG_VALUE_ABSTRACT);
  998. end;
  999. function G_TYPE_IS_VALUE_TYPE(_type : GType) : boolean;
  1000. begin
  1001. G_TYPE_IS_VALUE_TYPE:=private_g_type_check_is_value_type(_type);
  1002. end;
  1003. function G_TYPE_HAS_VALUE_TABLE(_type : GType) : boolean;
  1004. begin
  1005. G_TYPE_HAS_VALUE_TABLE:=(g_type_value_table_peek(_type)) <> NULL;
  1006. end;
  1007. function G_TYPE_CHECK_INSTANCE(instance : Pointer) : gboolean;
  1008. begin
  1009. G_TYPE_CHECK_INSTANCE:=private_g_type_check_instance(PGTypeInstance(instance));
  1010. end;
  1011. function G_TYPE_CHECK_INSTANCE_CAST(instance: Pointer; g_type: GType) : PGTypeInstance;
  1012. begin
  1013. G_TYPE_CHECK_INSTANCE_CAST:=private_g_type_check_instance_cast(instance,g_type);
  1014. end;
  1015. function G_TYPE_CHECK_INSTANCE_TYPE(instance: Pointer; g_type: GType) : boolean;
  1016. begin
  1017. G_TYPE_CHECK_INSTANCE_TYPE:=private_g_type_check_instance_is_a(instance,g_type);
  1018. end;
  1019. function G_TYPE_INSTANCE_GET_CLASS(instance: Pointer; g_type: GType) : PGTypeClass;
  1020. // #define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type) (_G_TYPE_IGC ((instance), (g_type), c_type))
  1021. // #define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class))
  1022. begin
  1023. Result:=PGTypeInstance(Instance)^.g_class;
  1024. Result:=private_g_type_check_class_cast(Result,g_type);
  1025. end;
  1026. function G_TYPE_INSTANCE_GET_INTERFACE(instance: Pointer; g_type: GType) : Pointer;
  1027. begin
  1028. G_TYPE_INSTANCE_GET_INTERFACE:=
  1029. g_type_interface_peek((PGTypeInstance(instance))^.g_class,g_type);
  1030. end;
  1031. function G_TYPE_CHECK_CLASS_CAST(g_class: pointer; g_type: GType) : Pointer;
  1032. begin
  1033. G_TYPE_CHECK_CLASS_CAST:=
  1034. private_g_type_check_class_cast(PGTypeClass(g_class),g_type);
  1035. end;
  1036. function G_TYPE_CHECK_CLASS_TYPE(g_class: pointer; g_type : GType) : boolean;
  1037. begin
  1038. G_TYPE_CHECK_CLASS_TYPE:=private_g_type_check_class_is_a(PGTypeClass(g_class),g_type);
  1039. end;
  1040. function G_TYPE_CHECK_VALUE(value : Pointer) : boolean;
  1041. begin
  1042. G_TYPE_CHECK_VALUE:=private_g_type_check_value(PGValue(Value));
  1043. end;
  1044. function G_TYPE_CHECK_VALUE_TYPE(value: pointer; g_type : GType) : boolean;
  1045. begin
  1046. G_TYPE_CHECK_VALUE_TYPE:=private_g_type_check_value_holds(PGValue(value),g_type);
  1047. end;
  1048. function G_TYPE_FROM_INSTANCE(instance : Pointer) : GType;
  1049. begin
  1050. G_TYPE_FROM_INSTANCE:=G_TYPE_FROM_CLASS((PGTypeInstance(instance))^.g_class);
  1051. end;
  1052. function G_TYPE_FROM_CLASS(g_class : Pointer) : GType;
  1053. begin
  1054. G_TYPE_FROM_CLASS:=(PGTypeClass(g_class))^.g_type;
  1055. end;
  1056. function G_TYPE_FROM_INTERFACE(g_iface : Pointer) : GType;
  1057. begin
  1058. G_TYPE_FROM_INTERFACE:=(PGTypeInterface(g_iface))^.g_type;
  1059. end;
  1060. // gvalue.inc ------------------------------------------------------------------
  1061. function G_TYPE_IS_VALUE(_type : GType) : boolean;
  1062. begin
  1063. G_TYPE_IS_VALUE:=private_g_type_check_is_value_type(_type);
  1064. end;
  1065. function G_IS_VALUE(value : Pointer) : boolean;
  1066. begin
  1067. G_IS_VALUE:=G_TYPE_CHECK_VALUE(value);
  1068. end;
  1069. function G_VALUE_TYPE(value : Pointer) : GType;
  1070. begin
  1071. G_VALUE_TYPE:=(PGValue(value))^.g_type;
  1072. end;
  1073. function G_VALUE_TYPE_NAME(value : Pointer) : PGChar;
  1074. begin
  1075. G_VALUE_TYPE_NAME:=g_type_name(G_VALUE_TYPE(value));
  1076. end;
  1077. function G_VALUE_HOLDS(value: pointer; g_type : GType) : boolean;
  1078. begin
  1079. G_VALUE_HOLDS:=G_TYPE_CHECK_VALUE_TYPE(value,g_type);
  1080. end;
  1081. // gparam.inc ------------------------------------------------------------------
  1082. function G_TYPE_IS_PARAM(_type : GType) : boolean;
  1083. begin
  1084. G_TYPE_IS_PARAM:=(G_TYPE_FUNDAMENTAL(_type)) = G_TYPE_PARAM;
  1085. end;
  1086. function G_PARAM_SPEC(pspec : Pointer) : PGParamSpec;
  1087. begin
  1088. G_PARAM_SPEC:=PGParamSpec(G_TYPE_CHECK_INSTANCE_CAST(pspec,G_TYPE_PARAM));
  1089. end;
  1090. function G_IS_PARAM_SPEC(pspec : Pointer) : boolean;
  1091. begin
  1092. G_IS_PARAM_SPEC:=G_TYPE_CHECK_INSTANCE_TYPE(pspec,G_TYPE_PARAM);
  1093. end;
  1094. function G_PARAM_SPEC_CLASS(pclass : Pointer) : PGParamSpecClass;
  1095. begin
  1096. G_PARAM_SPEC_CLASS:=PGParamSpecClass(G_TYPE_CHECK_CLASS_CAST(pclass,G_TYPE_PARAM));
  1097. end;
  1098. function G_IS_PARAM_SPEC_CLASS(pclass : Pointer) : boolean;
  1099. begin
  1100. G_IS_PARAM_SPEC_CLASS:=G_TYPE_CHECK_CLASS_TYPE(pclass,G_TYPE_PARAM);
  1101. end;
  1102. function G_PARAM_SPEC_GET_CLASS(pspec : Pointer) : PGParamSpecClass;
  1103. begin
  1104. G_PARAM_SPEC_GET_CLASS:=PGParamSpecClass(G_TYPE_INSTANCE_GET_CLASS(pspec,G_TYPE_PARAM));
  1105. end;
  1106. function G_PARAM_SPEC_TYPE(pspec : Pointer) : GType;
  1107. begin
  1108. G_PARAM_SPEC_TYPE:=G_TYPE_FROM_INSTANCE(pspec);
  1109. end;
  1110. function G_PARAM_SPEC_TYPE_NAME(pspec : Pointer) : PGChar;
  1111. begin
  1112. G_PARAM_SPEC_TYPE_NAME:=g_type_name(G_PARAM_SPEC_TYPE(pspec));
  1113. end;
  1114. function G_PARAM_SPEC_VALUE_TYPE(pspec : Pointer) : GType;
  1115. begin
  1116. G_PARAM_SPEC_VALUE_TYPE:=(G_PARAM_SPEC(pspec))^.value_type;
  1117. end;
  1118. function G_VALUE_HOLDS_PARAM(value : Pointer) : boolean;
  1119. begin
  1120. G_VALUE_HOLDS_PARAM:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_PARAM);
  1121. end;
  1122. // gclosure.inc ----------------------------------------------------------------
  1123. function G_CLOSURE_NEEDS_MARSHAL(closure : Pointer) : boolean;
  1124. begin
  1125. G_CLOSURE_NEEDS_MARSHAL := not Assigned((PGClosure(closure))^.marshal);
  1126. end;
  1127. function G_CLOSURE_N_NOTIFIERS(cl : PGClosure) : longint;
  1128. begin
  1129. G_CLOSURE_N_NOTIFIERS:=((meta_marshal(cl) + ((n_guards(cl)) shl 1))
  1130. + (n_fnotifiers(cl))) + (n_inotifiers(cl));
  1131. end;
  1132. function G_CCLOSURE_SWAP_DATA(cclosure : PGClosure) : longint;
  1133. begin
  1134. G_CCLOSURE_SWAP_DATA:=derivative_flag(cclosure);
  1135. end;
  1136. function G_CALLBACK(f : pointer) : TGCallback;
  1137. begin
  1138. G_CALLBACK:=TGCallback(f);
  1139. end;
  1140. function ref_count(var a : TGClosure) : guint;
  1141. begin
  1142. ref_count:=(a.flag0 and bm_TGClosure_ref_count) shr bp_TGClosure_ref_count;
  1143. end;
  1144. procedure set_ref_count(var a : TGClosure; __ref_count : guint);
  1145. begin
  1146. a.flag0:=a.flag0 or ((__ref_count shl bp_TGClosure_ref_count) and bm_TGClosure_ref_count);
  1147. end;
  1148. function meta_marshal(a : PGClosure) : guint;
  1149. begin
  1150. meta_marshal:=(a^.flag0 and bm_TGClosure_meta_marshal) shr bp_TGClosure_meta_marshal;
  1151. end;
  1152. procedure set_meta_marshal(var a : TGClosure; __meta_marshal : guint);
  1153. begin
  1154. a.flag0:=a.flag0 or ((__meta_marshal shl bp_TGClosure_meta_marshal) and bm_TGClosure_meta_marshal);
  1155. end;
  1156. function n_guards(a : PGClosure) : guint;
  1157. begin
  1158. n_guards:=(a^.flag0 and bm_TGClosure_n_guards) shr bp_TGClosure_n_guards;
  1159. end;
  1160. procedure set_n_guards(var a : TGClosure; __n_guards : guint);
  1161. begin
  1162. a.flag0:=a.flag0 or ((__n_guards shl bp_TGClosure_n_guards) and bm_TGClosure_n_guards);
  1163. end;
  1164. function n_fnotifiers(a : PGClosure) : guint;
  1165. begin
  1166. n_fnotifiers:=(a^.flag0 and bm_TGClosure_n_fnotifiers) shr bp_TGClosure_n_fnotifiers;
  1167. end;
  1168. procedure set_n_fnotifiers(var a : TGClosure; __n_fnotifiers : guint);
  1169. begin
  1170. a.flag0:=a.flag0 or ((__n_fnotifiers shl bp_TGClosure_n_fnotifiers) and bm_TGClosure_n_fnotifiers);
  1171. end;
  1172. function n_inotifiers(a : PGClosure) : guint;
  1173. begin
  1174. n_inotifiers:=(a^.flag0 and bm_TGClosure_n_inotifiers) shr bp_TGClosure_n_inotifiers;
  1175. end;
  1176. procedure set_n_inotifiers(var a : TGClosure; __n_inotifiers : guint);
  1177. begin
  1178. a.flag0:=a.flag0 or ((__n_inotifiers shl bp_TGClosure_n_inotifiers) and bm_TGClosure_n_inotifiers);
  1179. end;
  1180. function in_inotify(var a : TGClosure) : guint;
  1181. begin
  1182. in_inotify:=(a.flag0 and bm_TGClosure_in_inotify) shr bp_TGClosure_in_inotify;
  1183. end;
  1184. procedure set_in_inotify(var a : TGClosure; __in_inotify : guint);
  1185. begin
  1186. a.flag0:=a.flag0 or ((__in_inotify shl bp_TGClosure_in_inotify) and bm_TGClosure_in_inotify);
  1187. end;
  1188. function floating(var a : TGClosure) : guint;
  1189. begin
  1190. floating:=(a.flag0 and bm_TGClosure_floating) shr bp_TGClosure_floating;
  1191. end;
  1192. procedure set_floating(var a : TGClosure; __floating : guint);
  1193. begin
  1194. a.flag0:=a.flag0 or ((__floating shl bp_TGClosure_floating) and bm_TGClosure_floating);
  1195. end;
  1196. function derivative_flag(a : PGClosure) : guint;
  1197. begin
  1198. derivative_flag:=(a^.flag0 and bm_TGClosure_derivative_flag) shr bp_TGClosure_derivative_flag;
  1199. end;
  1200. procedure set_derivative_flag(var a : TGClosure; __derivative_flag : guint);
  1201. begin
  1202. a.flag0:=a.flag0 or ((__derivative_flag shl bp_TGClosure_derivative_flag) and bm_TGClosure_derivative_flag);
  1203. end;
  1204. function in_marshal(var a : TGClosure) : guint;
  1205. begin
  1206. in_marshal:=(a.flag0 and bm_TGClosure_in_marshal) shr bp_TGClosure_in_marshal;
  1207. end;
  1208. procedure set_in_marshal(var a : TGClosure; __in_marshal : guint);
  1209. begin
  1210. a.flag0:=a.flag0 or ((__in_marshal shl bp_TGClosure_in_marshal) and bm_TGClosure_in_marshal);
  1211. end;
  1212. function is_invalid(var a : TGClosure) : guint;
  1213. begin
  1214. is_invalid:=(a.flag0 and bm_TGClosure_is_invalid) shr bp_TGClosure_is_invalid;
  1215. end;
  1216. procedure set_is_invalid(var a : TGClosure; __is_invalid : guint);
  1217. begin
  1218. a.flag0:=a.flag0 or ((__is_invalid shl bp_TGClosure_is_invalid) and bm_TGClosure_is_invalid);
  1219. end;
  1220. // gsignal.inc -----------------------------------------------------------------
  1221. function g_signal_connect(instance:gpointer; detailed_signal:Pgchar;
  1222. c_handler:TGCallback; data:gpointer) : gulong;
  1223. begin
  1224. g_signal_connect:=g_signal_connect_data(instance,detailed_signal,c_handler,
  1225. data,NULL,TGConnectFlags(0));
  1226. end;
  1227. function g_signal_connect_after(instance:gpointer; detailed_signal:Pgchar;
  1228. c_handler:TGCallback; data:gpointer) : gulong;
  1229. begin
  1230. g_signal_connect_after:=g_signal_connect_data(instance,detailed_signal,
  1231. c_handler,data,NULL,G_CONNECT_AFTER);
  1232. end;
  1233. function g_signal_connect_swapped(instance:gpointer; detailed_signal:Pgchar;
  1234. c_handler:TGCallback; data:gpointer) : gulong;
  1235. begin
  1236. g_signal_connect_swapped:=g_signal_connect_data(instance,detailed_signal,
  1237. c_handler,data,NULL,G_CONNECT_SWAPPED);
  1238. end;
  1239. function g_signal_handlers_disconnect_by_func(instance:gpointer;
  1240. func, data: gpointer) : guint;
  1241. begin
  1242. g_signal_handlers_disconnect_by_func:=g_signal_handlers_disconnect_matched(
  1243. instance,TGSignalMatchType(G_SIGNAL_MATCH_FUNC or G_SIGNAL_MATCH_DATA),0,0,
  1244. NULL,func,data);
  1245. end;
  1246. procedure g_signal_handlers_block_by_func(instance: gpointer; func, data: gpointer);
  1247. begin
  1248. g_signal_handlers_block_matched(instance,
  1249. TGSignalMatchType(G_SIGNAL_MATCH_FUNC or G_SIGNAL_MATCH_DATA),
  1250. 0, 0, nil, func, data);
  1251. end;
  1252. procedure g_signal_handlers_unblock_by_func(instance: gpointer; func, data: gpointer);
  1253. begin
  1254. g_signal_handlers_unblock_matched(instance,
  1255. TGSignalMatchType(G_SIGNAL_MATCH_FUNC or G_SIGNAL_MATCH_DATA),
  1256. 0, 0, nil, func, data);
  1257. end;
  1258. // gobject.inc -----------------------------------------------------------------
  1259. function G_TYPE_IS_OBJECT(_type : GType) : boolean;
  1260. begin
  1261. G_TYPE_IS_OBJECT:=(G_TYPE_FUNDAMENTAL(_type)) = G_TYPE_OBJECT;
  1262. end;
  1263. function G_OBJECT(anObject: pointer) : PGObject;
  1264. begin
  1265. G_OBJECT:=PGObject(G_TYPE_CHECK_INSTANCE_CAST(anObject,G_TYPE_OBJECT));
  1266. end;
  1267. function G_OBJECT_CLASS(_class : Pointer) : PGObjectClass;
  1268. begin
  1269. G_OBJECT_CLASS:=PGObjectClass(G_TYPE_CHECK_CLASS_CAST(_class,G_TYPE_OBJECT));
  1270. end;
  1271. function G_IS_OBJECT(anObject: pointer) : boolean;
  1272. begin
  1273. G_IS_OBJECT:=G_TYPE_CHECK_INSTANCE_TYPE(anObject,G_TYPE_OBJECT);
  1274. end;
  1275. function G_IS_OBJECT_CLASS(_class : Pointer) : boolean;
  1276. begin
  1277. G_IS_OBJECT_CLASS:=G_TYPE_CHECK_CLASS_TYPE(_class,G_TYPE_OBJECT);
  1278. end;
  1279. function G_OBJECT_GET_CLASS(anObject: pointer) : PGObjectClass;
  1280. begin
  1281. G_OBJECT_GET_CLASS:=PGObjectClass(G_TYPE_INSTANCE_GET_CLASS(anObject,G_TYPE_OBJECT));
  1282. end;
  1283. function G_OBJECT_TYPE(anObject: pointer) : GType;
  1284. begin
  1285. G_OBJECT_TYPE:=G_TYPE_FROM_INSTANCE(anObject);
  1286. end;
  1287. function G_OBJECT_TYPE_NAME(anObject: pointer) : Pgchar;
  1288. begin
  1289. G_OBJECT_TYPE_NAME:=g_type_name(G_OBJECT_TYPE(anObject));
  1290. end;
  1291. function G_OBJECT_CLASS_TYPE(_class : Pointer) : GType;
  1292. begin
  1293. G_OBJECT_CLASS_TYPE:=G_TYPE_FROM_CLASS(_class);
  1294. end;
  1295. function G_OBJECT_CLASS_NAME(_class : Pointer) : Pgchar;
  1296. begin
  1297. G_OBJECT_CLASS_NAME:=g_type_name(G_OBJECT_CLASS_TYPE(_class));
  1298. end;
  1299. function G_VALUE_HOLDS_OBJECT(value : Pointer) : boolean;
  1300. begin
  1301. G_VALUE_HOLDS_OBJECT:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_OBJECT);
  1302. end;
  1303. procedure G_OBJECT_WARN_INVALID_PROPERTY_ID(anObject: gpointer;
  1304. property_id: gint; pspec : gpointer);
  1305. begin
  1306. G_OBJECT_WARN_INVALID_PSPEC(anObject,'property',property_id,pspec);
  1307. end;
  1308. procedure G_OBJECT_WARN_INVALID_PSPEC(anObject: gpointer; pname: PGChar;
  1309. property_id: gint; pspec: gpointer);
  1310. var
  1311. _object: PGObject;
  1312. _pspec: PGParamSpec;
  1313. _property_id: guint;
  1314. begin
  1315. _object := PGObject (anObject);
  1316. _pspec := PGParamSpec (pspec);
  1317. _property_id := (property_id);
  1318. g_warning ('%s: invalid %s id %u for "%s" of type `%s'' in `%s''',
  1319. ['',
  1320. pname,
  1321. _property_id,
  1322. _pspec^.name,
  1323. g_type_name (G_PARAM_SPEC_TYPE (_pspec)),
  1324. G_OBJECT_TYPE_NAME (_object)]);
  1325. end;
  1326. // gtypeplugin.inc -------------------------------------------------------------
  1327. function G_TYPE_TYPE_PLUGIN : GType;
  1328. begin
  1329. G_TYPE_TYPE_PLUGIN:=g_type_plugin_get_type;
  1330. end;
  1331. function G_TYPE_PLUGIN(inst : Pointer) : PGTypePlugin;
  1332. begin
  1333. G_TYPE_PLUGIN:=PGTypePlugin(G_TYPE_CHECK_INSTANCE_CAST(inst,G_TYPE_TYPE_PLUGIN));
  1334. end;
  1335. function G_TYPE_PLUGIN_CLASS(vtable : Pointer) : PGTypePluginClass;
  1336. begin
  1337. G_TYPE_PLUGIN_CLASS:=PGTypePluginClass(G_TYPE_CHECK_CLASS_CAST(vtable,G_TYPE_TYPE_PLUGIN));
  1338. end;
  1339. function G_IS_TYPE_PLUGIN(inst : Pointer) : boolean;
  1340. begin
  1341. G_IS_TYPE_PLUGIN:=G_TYPE_CHECK_INSTANCE_TYPE(inst,G_TYPE_TYPE_PLUGIN);
  1342. end;
  1343. function G_IS_TYPE_PLUGIN_CLASS(vtable : Pointer) : boolean;
  1344. begin
  1345. G_IS_TYPE_PLUGIN_CLASS:=G_TYPE_CHECK_CLASS_TYPE(vtable,G_TYPE_TYPE_PLUGIN);
  1346. end;
  1347. function G_TYPE_PLUGIN_GET_CLASS(inst : Pointer) : PGTypePluginClass;
  1348. begin
  1349. G_TYPE_PLUGIN_GET_CLASS:=PGTypePluginClass(G_TYPE_INSTANCE_GET_INTERFACE(inst,G_TYPE_TYPE_PLUGIN));
  1350. end;
  1351. // genums.inc ------------------------------------------------------------------
  1352. function G_TYPE_IS_ENUM(_type : GType) : gboolean;
  1353. begin
  1354. G_TYPE_IS_ENUM:=(G_TYPE_FUNDAMENTAL(_type) = G_TYPE_ENUM);
  1355. end;
  1356. function G_ENUM_CLASS(_class : pointer) : PGEnumClass;
  1357. begin
  1358. G_ENUM_CLASS:=PGEnumClass(G_TYPE_CHECK_CLASS_CAST(_class,G_TYPE_ENUM));
  1359. end;
  1360. function G_IS_ENUM_CLASS(_class : pointer) : gboolean;
  1361. begin
  1362. G_IS_ENUM_CLASS:=G_TYPE_CHECK_CLASS_TYPE(_class,G_TYPE_ENUM);
  1363. end;
  1364. function G_ENUM_CLASS_TYPE(_class : pointer) : GType;
  1365. begin
  1366. G_ENUM_CLASS_TYPE:=G_TYPE_FROM_CLASS(_class);
  1367. end;
  1368. function G_ENUM_CLASS_TYPE_NAME(_class : pointer) : PGChar;
  1369. begin
  1370. G_ENUM_CLASS_TYPE_NAME:=g_type_name(G_ENUM_CLASS_TYPE(_class));
  1371. end;
  1372. function G_TYPE_IS_FLAGS(_type : GType) : gboolean;
  1373. begin
  1374. G_TYPE_IS_FLAGS:=(G_TYPE_FUNDAMENTAL(_type)) = G_TYPE_FLAGS;
  1375. end;
  1376. function G_FLAGS_CLASS(_class : pointer) : PGFlagsClass;
  1377. begin
  1378. G_FLAGS_CLASS:=PGFlagsClass(G_TYPE_CHECK_CLASS_CAST(_class,G_TYPE_FLAGS));
  1379. end;
  1380. function G_IS_FLAGS_CLASS(_class : pointer) : gboolean;
  1381. begin
  1382. G_IS_FLAGS_CLASS:=G_TYPE_CHECK_CLASS_TYPE(_class,G_TYPE_FLAGS);
  1383. end;
  1384. function G_FLAGS_CLASS_TYPE(_class : pointer) : GType;
  1385. begin
  1386. G_FLAGS_CLASS_TYPE:=G_TYPE_FROM_CLASS(_class);
  1387. end;
  1388. function G_FLAGS_CLASS_TYPE_NAME(_class : pointer) : PGChar;
  1389. begin
  1390. G_FLAGS_CLASS_TYPE_NAME:=g_type_name(G_FLAGS_TYPE(PtrInt(_class)));
  1391. end;
  1392. function G_VALUE_HOLDS_ENUM(value : pointer) : gboolean;
  1393. begin
  1394. G_VALUE_HOLDS_ENUM:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_ENUM);
  1395. end;
  1396. function G_VALUE_HOLDS_FLAGS(value : pointer) : gboolean;
  1397. begin
  1398. G_VALUE_HOLDS_FLAGS:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_FLAGS);
  1399. end;
  1400. // gmacros.inc -----------------------------------------------------------------
  1401. function CLAMP(x, MinX, MaxX: integer): integer;
  1402. begin
  1403. if x<MinX then
  1404. Result:=MinX
  1405. else if x>MaxX then
  1406. Result:=MaxX
  1407. else
  1408. Result:=x;
  1409. end;
  1410. function GPOINTER_TO_SIZE(p: GPointer): GSize;
  1411. begin
  1412. Result:=GSize(PtrInt(p));
  1413. end;
  1414. function GSIZE_TO_POINTER(s: GSize): GPointer;
  1415. begin
  1416. Result:=GPointer(PtrInt(s));
  1417. end;
  1418. // gvaluetypes.inc -------------------------------------------------------------
  1419. function G_VALUE_HOLDS_CHAR(value : PGValue) : boolean;
  1420. begin
  1421. G_VALUE_HOLDS_CHAR:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_CHAR);
  1422. end;
  1423. function G_VALUE_HOLDS_UCHAR(value : PGValue) : boolean;
  1424. begin
  1425. G_VALUE_HOLDS_UCHAR:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_UCHAR);
  1426. end;
  1427. function G_VALUE_HOLDS_BOOLEAN(value : PGValue) : boolean;
  1428. begin
  1429. G_VALUE_HOLDS_BOOLEAN:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_BOOLEAN);
  1430. end;
  1431. function G_VALUE_HOLDS_INT(value : PGValue) : boolean;
  1432. begin
  1433. G_VALUE_HOLDS_INT:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_INT);
  1434. end;
  1435. function G_VALUE_HOLDS_UINT(value : PGValue) : boolean;
  1436. begin
  1437. G_VALUE_HOLDS_UINT:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_UINT);
  1438. end;
  1439. function G_VALUE_HOLDS_LONG(value : PGValue) : boolean;
  1440. begin
  1441. G_VALUE_HOLDS_LONG:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_LONG);
  1442. end;
  1443. function G_VALUE_HOLDS_ULONG(value : PGValue) : boolean;
  1444. begin
  1445. G_VALUE_HOLDS_ULONG:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_ULONG);
  1446. end;
  1447. function G_VALUE_HOLDS_INT64(value : PGValue) : boolean;
  1448. begin
  1449. G_VALUE_HOLDS_INT64:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_INT64);
  1450. end;
  1451. function G_VALUE_HOLDS_UINT64(value : PGValue) : boolean;
  1452. begin
  1453. G_VALUE_HOLDS_UINT64:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_UINT64);
  1454. end;
  1455. function G_VALUE_HOLDS_FLOAT(value : PGValue) : boolean;
  1456. begin
  1457. G_VALUE_HOLDS_FLOAT:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_FLOAT);
  1458. end;
  1459. function G_VALUE_HOLDS_DOUBLE(value : PGValue) : boolean;
  1460. begin
  1461. G_VALUE_HOLDS_DOUBLE:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_DOUBLE);
  1462. end;
  1463. function G_VALUE_HOLDS_STRING(value : PGValue) : boolean;
  1464. begin
  1465. G_VALUE_HOLDS_STRING:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_STRING);
  1466. end;
  1467. function G_VALUE_HOLDS_POINTER(value : PGValue) : boolean;
  1468. begin
  1469. G_VALUE_HOLDS_POINTER:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_POINTER);
  1470. end;
  1471. // gboxed.inc ------------------------------------------------------------------
  1472. function G_TYPE_IS_BOXED(_type : GType) : gboolean;
  1473. begin
  1474. G_TYPE_IS_BOXED:=(G_TYPE_FUNDAMENTAL(_type)) = G_TYPE_BOXED;
  1475. end;
  1476. function G_VALUE_HOLDS_BOXED(value : PGValue) : gboolean;
  1477. begin
  1478. G_VALUE_HOLDS_BOXED:=G_TYPE_CHECK_VALUE_TYPE(value,G_TYPE_BOXED);
  1479. end;
  1480. function G_TYPE_CLOSURE : GType;
  1481. begin
  1482. G_TYPE_CLOSURE:=g_closure_get_type;
  1483. end;
  1484. function G_TYPE_VALUE : GType;
  1485. begin
  1486. G_TYPE_VALUE:=g_value_get_type;
  1487. end;
  1488. function G_TYPE_VALUE_ARRAY : GType;
  1489. begin
  1490. G_TYPE_VALUE_ARRAY:=g_value_array_get_type;
  1491. end;
  1492. function G_TYPE_GSTRING : GType;
  1493. begin
  1494. G_TYPE_GSTRING:=g_gstring_get_type;
  1495. end;
  1496. end.