aes.pas 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959
  1. {
  2. Copyright (c) 2016 by Free Pascal development team
  3. AES interface unit for Atari TOS
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. {$MODE FPC}
  11. {$MODESWITCH OUT+}
  12. {$PACKRECORDS 2}
  13. unit aes;
  14. interface
  15. uses gemcmmn;
  16. { The API description of this file is based on the information available
  17. online at: https://freemint.github.io/tos.hyp/en/index.html }
  18. {$I aestypes.inc}
  19. type
  20. ARRAY_8 = gemcmmn.ARRAY_8;
  21. PMFORM = gemcmmn.PMFORM;
  22. TMFORM = gemcmmn.TMFORM;
  23. function appl_exit: smallint;
  24. function appl_read(ap_rid: smallint; ap_rlength: smallint; ap_rpbuff: pointer): smallint;
  25. function appl_write(ap_wid: smallint; ap_wlength: smallint; ap_wpbuff: pointer): smallint;
  26. function appl_find(fname: PChar): smallint;
  27. function appl_find(ap_fpname: String): smallint;
  28. function appl_tplay(ap_tpmem: Pointer; ap_tpnum, ap_tpscale: smallint): smallint;
  29. function appl_trecord(ap_trmem: Pointer; ap_trcount: smallint): smallint;
  30. function appl_bvset(ap_bvdisk, ap_bvhard: Word): smallint;
  31. function appl_yield: smallint;
  32. procedure _appl_yield;
  33. function appl_search(ap_smode: smallint; ap_sname: Pchar; out ap_stype, ap_sid: smallint): smallint;
  34. function appl_search(ap_smode: smallint; out ap_sname: String; out ap_stype, ap_sid: smallint): smallint;
  35. function appl_getinfo(ap_gtype: smallint; out ap_gout1, ap_gout2, ap_gout3, ap_gout4: smallint): smallint;
  36. function appl_init: smallint;
  37. function evnt_keybd: smallint;
  38. function evnt_button(ev_bclicks: smallint; ev_bmask: smallint; ev_bstate: smallint;
  39. ev_bmx: psmallint; ev_bmy: psmallint; ev_bbutton: psmallint; ev_bkstate: psmallint): smallint;
  40. function evnt_button(ev_bclicks, ev_bmask, ev_bstate: smallint; out ev_bmx, ev_bmy, ev_bbutton, ev_bkstate: smallint): smallint;
  41. function evnt_mouse(ev_moflags: smallint; ev_mox: smallint; ev_moy: smallint; ev_mowidth: smallint; ev_moheight: smallint;
  42. ev_momx: psmallint; ev_momy: psmallint; ev_mobutton: psmallint; ev_mokstate: psmallint): smallint;
  43. function evnt_mouse(ev_moflags, ev_mox, ev_moy, ev_mowidth, ev_moheight: smallint;
  44. out ev_momx, ev_momy, ev_mobutton, ev_mokstate: smallint): smallint;
  45. function evnt_mesag(msg: psmallint): smallint;
  46. function evnt_mesag(out ev_mgpbuff: ARRAY_8): smallint;
  47. function evnt_timer(ev_tlocount: smallint; ev_thicount: smallint): smallint;
  48. function evnt_multi(ev_mflags: smallint; ev_mbclicks: smallint; ev_mbmask: smallint; ev_mbstate: smallint;
  49. ev_mm1flags: smallint; ev_mm1x: smallint; ev_mm1y: smallint; ev_mm1width: smallint; ev_mm1height: smallint;
  50. ev_mm2flags: smallint; ev_mm2x: smallint; ev_mm2y: smallint; ev_mm2width: smallint; ev_mm2height: smallint;
  51. ev_mmgpbuff: psmallint; ev_mtlocount: smallint; ev_mthicount: smallint;
  52. ev_mmox: psmallint; ev_mmoy: psmallint; ev_mmbutton: psmallint; ev_mmokstate: psmallint;
  53. ev_mkreturn: psmallint; ev_mbreturn: psmallint): smallint;
  54. function evnt_multi(ev_mflags, ev_mbclicks, ev_mbmask,
  55. ev_mbstate, ev_mm1flags, ev_mm1x,
  56. ev_mm1y, ev_mm1width, ev_mm1height,
  57. ev_mm2flags, ev_mm2x, ev_mm2y,
  58. ev_mm2width, ev_mm2height: smallint;
  59. out ev_mmgpbuf: ARRAY_8;
  60. ev_mtlocount, ev_mthicount: smallint;
  61. out ev_mmox, ev_mmoy, ev_mmobutton,
  62. ev_mmokstate, ev_mkreturn,
  63. ev_mbreturn: smallint): smallint;
  64. function EvntMulti(var evnt_struct: TEVENT): smallint;
  65. function evnt_dclick(ev_dnew: smallint; ev_dgetset: smallint): smallint;
  66. function menu_bar(me_btree: PAESOBJECT; me_bshow: smallint): smallint; overload;
  67. function menu_icheck(me_ctree: PAESOBJECT; me_citem: smallint; me_ccheck: smallint): smallint; overload;
  68. function menu_ienable(me_etree: PAESOBJECT; me_eitem: smallint; me_eenable: smallint): smallint; overload;
  69. function menu_tnormal(me_ntree: PAESOBJECT; me_ntitle: smallint; me_nnormal: smallint): smallint; overload;
  70. function menu_text(me_ttree: PAESOBJECT; me_titem: smallint; me_ttext: PChar): smallint; overload;
  71. function menu_register(me_rapid: smallint; me_rpstring: PChar): smallint;
  72. function menu_register(me_rapid: smallint; me_rpstring: String): smallint;
  73. function menu_unregister(me_uapid: smallint): smallint;
  74. function menu_popup(me_menu: PMENU; me_xpos, me_ypos: smallint; var me_mdata: TMENU): smallint;
  75. function menu_attach(me_flag: smallint; me_tree: PAESOBJECT; me_item: smallint; me_mdata: PMENU): smallint; overload;
  76. function menu_istart(me_flag: smallint; me_tree: PAESOBJECT; me_imenu, me_item: smallint): smallint; overload;
  77. function menu_settings(me_flag: smallint; me_values: PMN_SET): smallint;
  78. function menu_click(val: smallint; setit: smallint): smallint;
  79. function objc_add(ob_atree: PAESOBJECT; ob_aparent: smallint; ob_achild: smallint): smallint; overload;
  80. function objc_delete(ob_dltree: PAESOBJECT; ob_dlobject: smallint): smallint; overload;
  81. function objc_draw(ob_drtree: PAESOBJECT; ob_drstart: smallint;
  82. ob_drdepth: smallint; ob_drxclip: smallint;
  83. ob_dryclip: smallint; ob_drwclip: smallint;
  84. ob_drhclip: smallint): smallint; overload;
  85. function objc_find(ob_ftree: PAESOBJECT; ob_fstartob: smallint;
  86. ob_fdepth: smallint; ob_fmx: smallint;
  87. ob_fmy: smallint): smallint; overload;
  88. function objc_offset(ob_oftree: PAESOBJECT; ob_ofobject: smallint;
  89. ob_ofxoff: psmallint; ob_ofyoff: psmallint): smallint; overload;
  90. function objc_offset(ob_oftree: PAESOBJECT; ob_ofobject: smallint;
  91. out ob_ofxoff, ob_ofyoff: smallint): smallint; overload;
  92. function objc_order(ob_ortree: PAESOBJECT; ob_orobject: smallint;
  93. ob_ornewpos: smallint): smallint; overload;
  94. function objc_edit(ob_edtree: PAESOBJECT; ob_edobject: smallint;
  95. ob_edchar: smallint; ob_edidx: psmallint;
  96. ob_edkind: smallint): smallint; overload;
  97. function objc_edit(ob_edtree: PAESOBJECT; ob_edobject, ob_edchar: smallint;
  98. var ob_edidx: smallint; ob_edkind: smallint): smallint; overload;
  99. function objc_change(ob_ctree: PAESOBJECT; ob_cobject: smallint;
  100. ob_cresvd: smallint; ob_cxclip: smallint;
  101. ob_cyclip: smallint; ob_cwclip: smallint;
  102. ob_chclip: smallint; ob_cnewstate: smallint;
  103. ob_credraw: smallint): smallint; overload;
  104. function objc_sysvar(ob_svmode, ob_svwhich, ob_svinval1, ob_svinval2: smallint;
  105. out ob_svoutval1, ob_svoutval2: smallint): smallint;
  106. function form_do(fo_dotree: PAESOBJECT; fo_dostartob: smallint): smallint; overload;
  107. function form_dial(fo_diflag: smallint; fo_dilittlx: smallint;
  108. fo_dilittly: smallint; fo_dilittlw: smallint;
  109. fo_dilittlh: smallint; fo_dibigx: smallint;
  110. fo_dibigy: smallint; fo_dibigw: smallint;
  111. fo_dibigh: smallint): smallint;
  112. function form_alert(fo_adefbttn: smallint; alertstr: PChar): smallint;
  113. function form_alert(fo_adefbttn: smallint; fo_astring: String): smallint;
  114. function form_error(error: smallint): smallint;
  115. function form_center(fo_ctree: PAESOBJECT; fo_cx: psmallint;
  116. fo_cy: psmallint; fo_cw: psmallint;
  117. fo_ch: psmallint): smallint; overload;
  118. function form_center(fo_ctree: PAESOBJECT; out fo_cx, fo_cy, fo_cw, fo_ch: smallint): smallint; overload;
  119. function form_keybd(fo_ktree: PAESOBJECT; fo_kobject: smallint;
  120. fo_kobnext: smallint; fo_kchar: smallint;
  121. fo_knxtobject: psmallint; fo_knxtchar: psmallint): smallint; overload;
  122. function form_keybd(fo_ktree: PAESOBJECT; fo_kobject, fo_kobnext, fo_kchar: smallint;
  123. out fo_knxtobject, fo_knxtchar: smallint): smallint; overload;
  124. function form_button(fo_btree: PAESOBJECT; fo_bobject: smallint;
  125. fo_bclicks: smallint; fo_bnxtobj: psmallint): smallint; overload;
  126. function form_button(fo_btree: PAESOBJECT; fo_bobject, fo_bclicks: smallint;
  127. out fo_bnxtobj: smallint): smallint; overload;
  128. function graf_rubbox(gr_rx, gr_ry, gr_rminwidth, gr_rminheight: smallint;
  129. out gr_rlastwidth, gr_rlastheight: smallint): smallint;
  130. function graf_rubberbox(gr_rx, gr_ry, gr_rminwidth, gr_rminheight: smallint;
  131. out gr_rlastwidth, gr_rlastheight: smallint): smallint; external name 'graf_rubberbox';
  132. function graf_dragbox(gr_dwidth, gr_dheight, gr_dstartx, gr_dstarty,
  133. gr_dboundx, gr_dboundy, gr_dboundw, gr_dboundh: smallint;
  134. out gr_dfinishx, gr_dfinishy: smallint): smallint;
  135. function graf_mbox(gr_mwidth, gr_mheight, gr_msourcex, gr_msourcey, gr_mdestx, gr_mdesty: smallint): smallint;
  136. function graf_movebox(gr_mwidth, gr_mheight, gr_msourcex, gr_msourcey, gr_mdestx, gr_mdesty: smallint): smallint; external name 'graf_movebox';
  137. function graf_growbox(gr_gstx, gr_gsty, gr_gstwidth, gr_gstheight,
  138. gr_gfinx, gr_gfiny, gr_gfinwidth, gr_gfinheight :smallint): smallint;
  139. function graf_shrinkbox(gr_sfinx, gr_sfiny, gr_sfinwidth, gr_sfinheight,
  140. gr_sstx, gr_ssty, gr_sstwidth, gr_sstheight: smallint): smallint;
  141. function graf_watchbox(gr_wptree: PAESOBJECT; gr_wobject, gr_winstate, gr_woutstate: smallint): smallint;
  142. function graf_slidebox(gr_slptree: PAESOBJECT; gr_slparent, gr_slobject, gr_slvh: smallint): smallint;
  143. function graf_handle(gr_hwchar: psmallint; gr_hhchar: psmallint; gr_hwbox: psmallint; gr_hhbox: psmallint): smallint;
  144. function graf_handle(out gr_hwchar, gr_hhchar, gr_hwbox, gr_hhbox: smallint): smallint;
  145. function graf_mouse(gr_monumber: smallint; gr_mofaddr: PMFORM): smallint;
  146. function graf_mkstate(gr_mkmx: psmallint; gr_mkmy: psmallint;
  147. gr_mkmstate: psmallint; gr_mkkstate: psmallint): smallint;
  148. function graf_mkstate(out gr_mkmx, gr_mkmy, gr_mkmstate, gr_mkkstate: smallint): smallint;
  149. function scrp_read(sc_rpscrap: pchar): smallint;
  150. function scrp_read(out sc_rpscrap: String): smallint;
  151. function scrp_write(sc_wpscrap: pchar): smallint;
  152. function scrp_write(const sc_wpscrap: String): smallint;
  153. function fsel_input(fs_iinpath: pchar; fs_iinsel: pchar; fs_iexbutton: psmallint): smallint;
  154. function fsel_input(var fs_iinpath, fs_iinsel: String; out fs_iexbutton: smallint): smallint;
  155. function fsel_exinput(fs_einpath: pchar; fs_einsel: pchar; fs_eexbutton: psmallint; elabel: pchar): smallint;
  156. function fsel_exinput(var fs_einpath, fs_einsel: String; out fs_eexbutton: smallint;
  157. const fs_elabel: String): smallint;
  158. function wind_create(kind: smallint; x, y, w, h: smallint): smallint;
  159. function wind_open(handle: smallint; x, y, w, h: smallint): smallint;
  160. function wind_close(wi_clhandle: smallint): smallint;
  161. function wind_delete(handle: smallint): smallint;
  162. function wind_get(wi_ghandle: smallint; wi_gfield: smallint;
  163. wi_gw1: psmallint; wi_gw2: psmallint;
  164. wi_gw3: psmallint; wi_gw4: psmallint): smallint;
  165. function wind_get(wi_ghandle, wi_gfield: smallint;
  166. out wi_gw1, wi_gw2, wi_gw3, wi_gw4: smallint): smallint;
  167. function wind_get(wi_ghandle: smallint; wi_gfield: smallint; gr: PGRECT): smallint;
  168. function wind_set(wi_shandle: smallint; wi_sfield: smallint;
  169. wi_sw1: smallint; wi_sw2: smallint;
  170. wi_sw3: smallint; wi_sw4: smallint): smallint;
  171. function wind_set(wi_shandle: smallint; wi_sfield: smallint; ptr: Pointer): smallint;
  172. function wind_set(wi_shandle: smallint; wi_sfield: smallint; gr: PGRECT): smallint;
  173. function wind_find(wi_fmx: smallint; wi_fmy: smallint): smallint;
  174. function wind_update(wi_ubegend: smallint): smallint;
  175. function wind_calc(wi_ctype: smallint; wi_ckind: smallint;
  176. wi_cinx: smallint; wi_ciny: smallint;
  177. wi_cinw: smallint; wi_cinh: smallint;
  178. coutx: psmallint; couty: psmallint;
  179. coutw: psmallint; couth: psmallint): smallint;
  180. function wind_calc(wi_ctype, wi_ckind, wi_cinx, wi_ciny, wi_cinw, wi_cinh : smallint;
  181. out wi_coutx, wi_couty, wi_coutw, wi_couth: smallint): smallint;
  182. procedure wind_new;
  183. function rsrc_load(re_lpfname: PChar): smallint;
  184. function rsrc_load(re_lpfname: String): smallint;
  185. function rsrc_free: smallint;
  186. function rsrc_gaddr(re_gtype: smallint; re_gindex: smallint; gaddr: ppointer): smallint;
  187. function rsrc_gaddr(re_gtype, re_gindex: smallint; out re_gaddr: Pointer): smallint;
  188. function rsrc_saddr(re_stype: smallint; re_sindex: smallint; saddr: pointer): smallint;
  189. function rsrc_obfix(re_otree: PAESOBJECT; re_oobject: smallint): smallint; overload;
  190. function rsrc_rcfix(rc_header: PRSHDR): smallint;
  191. function shel_read(sh_rpcmd: pchar; sh_rptail: pchar): smallint;
  192. function shel_read(out sh_rpcmd, sh_rptail: String): smallint;
  193. function shel_write(sh_wdoex: smallint; sh_wisgr: smallint;
  194. sh_wiscr: smallint; sh_wpcmd: pchar;
  195. sh_wptail: pchar): smallint;
  196. function shel_write(sh_wdoex, sh_wisgr, sh_wiscr: smallint;
  197. const sh_wpcmd, sh_wptail: String): smallint;
  198. function shel_get(sh_gaddr: pchar; sh_glen: word): smallint;
  199. function shel_put(sh_paddr: pchar; sh_plen: word): smallint;
  200. function shel_find(sh_fpbuff: pchar): smallint;
  201. function shel_find(var sh_fpbuff: String): smallint;
  202. function shel_envrn(sh_epvalue: ppchar; sh_eparm: pchar): smallint;
  203. function shel_envrn(out sh_epvalue: Pointer; const sh_eparm: String): smallint;
  204. function shel_rdef(out sh_rlpcmd, sh_rlpdir: String): smallint;
  205. function shel_wdef(const sh_wlpcmd, sh_wlpdir: String): smallint;
  206. function xgrf_stepcalc(xg_storgw, xg_storgh, xg_stxc, xg_styc, xg_stw, xg_sth : smallint;
  207. out xg_stpcx, xg_stpcy, xg_stpcnt, xg_stpxstep, xg_stpystep: smallint): smallint;
  208. function xgrf_2box(xg_2cnt, xg_2xstep, xg_2ystep, xg_2doubled,
  209. xg_2corners, xg_2xc, xg_2yc, xg_2w, xg_2h: smallint): smallint;
  210. function crys_if(_opcode: dword): smallint;
  211. function vq_aes: smallint;
  212. procedure _crystal(pb: PAESPB);
  213. (*
  214. * NOT YET IMPLEMENTED:
  215. appl_control
  216. objc_xfind
  217. objc_xfind
  218. objc_wchange
  219. objc_wdraw
  220. objc_wedit
  221. objc_xedit
  222. form_wkeybd
  223. form_wbutton
  224. form_popup
  225. form_xdial
  226. form_xdo
  227. form_xerr
  228. xfrm_popup
  229. graf_multirubber
  230. fsel_boxinput
  231. wind_xget
  232. wind_xset
  233. shel_help
  234. xgrf_rbox
  235. wdgl_*
  236. lbox_*
  237. fnts_*
  238. fslx_*
  239. pdlg_*
  240. edit_*
  241. Geneva functions
  242. *)
  243. implementation
  244. type
  245. aesstr = array[0..255] of char;
  246. const
  247. ops_table: array[0..120,0..3] of SmallInt = (
  248. ( 0, 1, 0, 0 ), // 10, appl_init
  249. ( 2, 1, 1, 0 ), // 11, appl_read
  250. ( 2, 1, 1, 0 ), // 12, appl_write
  251. ( 0, 1, 1, 0 ), // 13, appl_find
  252. ( 2, 1, 1, 0 ), // 14, appl_tplay
  253. ( 1, 1, 1, 0 ), // 15, appl_trecord
  254. ( 2, 1, 0, 0 ), // 16, appl_bvset
  255. ( 0, 0, 0, 0 ), // 17, appl_yield
  256. ( 1, 3, 1, 0 ), // 18, appl_search (V4.0)
  257. ( 0, 1, 0, 0 ), // 19, appl_exit
  258. ( 0, 1, 0, 0 ), // 20, evnt_keybd
  259. ( 3, 5, 0, 0 ), // 21, evnt_button
  260. ( 5, 5, 0, 0 ), // 22, evnt_mouse
  261. ( 0, 1, 1, 0 ), // 23, evnt_mesag
  262. ( 2, 1, 0, 0 ), // 24, evnt_timer
  263. (16, 7, 1, 0 ), // 25, evnt_multi
  264. ( 2, 1, 0, 0 ), // 26, evnt_dclick
  265. ( 0, 0, 0, 0 ), // 27
  266. ( 0, 0, 0, 0 ), // 28
  267. ( 0, 0, 0, 0 ), // 29
  268. ( 1, 1, 1, 0 ), // 30, menu_bar
  269. ( 2, 1, 1, 0 ), // 31, menu_icheck
  270. ( 2, 1, 1, 0 ), // 32, menu_ienable
  271. ( 2, 1, 1, 0 ), // 33, menu_tnormal
  272. ( 1, 1, 2, 0 ), // 34, menu_text
  273. ( 1, 1, 1, 0 ), // 35, menu_register
  274. ( 2, 1, 2, 0 ), // 36, menu_unregister/menu_popup (V3.3)
  275. ( 2, 1, 2, 0 ), // 37, menu_attach/menu_click (V3.3)
  276. ( 3, 1, 1, 0 ), // 38, menu_istart (V3.3)
  277. ( 1, 1, 1, 0 ), // 39, menu_settings (V3.3)
  278. ( 2, 1, 1, 0 ), // 40, objc_add
  279. ( 1, 1, 1, 0 ), // 41, objc_delete
  280. ( 6, 1, 1, 0 ), // 42, objc_draw
  281. ( 4, 1, 1, 0 ), // 43, objc_find
  282. ( 1, 3, 1, 0 ), // 44, objc_offset
  283. ( 2, 1, 1, 0 ), // 45, objc_order
  284. ( 4, 2, 1, 0 ), // 46, objc_edit
  285. ( 8, 1, 1, 0 ), // 47, objc_change
  286. ( 4, 3, 0, 0 ), // 48, objc_sysvar (V3.4)
  287. ( 0, 0, 0, 0 ), // 49
  288. ( 1, 1, 1, 0 ), // 50, form_do
  289. ( 9, 1, 0, 0 ), // 51, form_dial
  290. ( 1, 1, 1, 0 ), // 52, form_alert
  291. ( 1, 1, 0, 0 ), // 53, form_error
  292. ( 0, 5, 1, 0 ), // 54, form_center
  293. ( 3, 3, 1, 0 ), // 55, form_keybd
  294. ( 2, 2, 1, 0 ), // 56, form_button
  295. ( 0, 0, 0, 0 ), // 57
  296. ( 0, 0, 0, 0 ), // 58
  297. ( 0, 0, 0, 0 ), // 59
  298. ( 0, 0, 0, 0 ), // 60
  299. ( 0, 0, 0, 0 ), // 61
  300. ( 0, 0, 0, 0 ), // 62
  301. ( 0, 0, 0, 0 ), // 63
  302. ( 0, 0, 0, 0 ), // 64
  303. ( 0, 0, 0, 0 ), // 65
  304. ( 0, 0, 0, 0 ), // 66
  305. ( 0, 0, 0, 0 ), // 67
  306. ( 0, 0, 0, 0 ), // 68
  307. ( 0, 0, 0, 0 ), // 69
  308. ( 4, 3, 0, 0 ), // 70, graf_rubberbox
  309. ( 8, 3, 0, 0 ), // 71, graf_dragbox
  310. ( 6, 1, 0, 0 ), // 72, graf_movebox
  311. ( 8, 1, 0, 0 ), // 73, graf_growbox
  312. ( 8, 1, 0, 0 ), // 74, graf_shrinkbox
  313. ( 4, 1, 1, 0 ), // 75, graf_watchbox
  314. ( 3, 1, 1, 0 ), // 76, graf_slidebox
  315. ( 0, 5, 0, 0 ), // 77, graf_handle
  316. ( 1, 1, 1, 0 ), // 78, graf_mouse
  317. ( 0, 5, 0, 0 ), // 79, graf_mkstate
  318. ( 0, 1, 1, 0 ), // 80, scrp_read
  319. ( 0, 1, 1, 0 ), // 81, scrp_write
  320. ( 0, 1, 0, 0 ), // 82, scrp_clear
  321. ( 0, 0, 0, 0 ), // 83
  322. ( 0, 0, 0, 0 ), // 84
  323. ( 0, 0, 0, 0 ), // 85
  324. ( 0, 0, 0, 0 ), // 86
  325. ( 0, 0, 0, 0 ), // 87
  326. ( 0, 0, 0, 0 ), // 88
  327. ( 0, 0, 0, 0 ), // 89
  328. ( 0, 2, 2, 0 ), // 90, fsel_input
  329. ( 0, 2, 3, 0 ), // 91, fsel_exinput
  330. ( 0, 0, 0, 0 ), // 92
  331. ( 0, 0, 0, 0 ), // 93
  332. ( 0, 0, 0, 0 ), // 94
  333. ( 0, 0, 0, 0 ), // 95
  334. ( 0, 0, 0, 0 ), // 96
  335. ( 0, 0, 0, 0 ), // 97
  336. ( 0, 0, 0, 0 ), // 98
  337. ( 0, 0, 0, 0 ), // 99
  338. ( 5, 1, 0, 0 ), // 100, wind_create
  339. ( 5, 1, 0, 0 ), // 101, wind_open
  340. ( 1, 1, 0, 0 ), // 102, wind_close
  341. ( 1, 1, 0, 0 ), // 103, wind_delete
  342. ( 2, 5, 0, 0 ), // 104, wind_get
  343. ( 6, 1, 0, 0 ), // 105, wind_set
  344. ( 2, 1, 0, 0 ), // 106, wind_find
  345. ( 1, 1, 0, 0 ), // 107, wind_update
  346. ( 6, 5, 0, 0 ), // 108, wind_calc
  347. ( 0, 0, 0, 0 ), // 109, wind_new
  348. ( 0, 1, 1, 0 ), // 110, rsrc_load
  349. ( 0, 1, 0, 0 ), // 111, rsrc_free
  350. ( 2, 1, 0, 1 ), // 112, rsrc_gaddr
  351. ( 2, 1, 1, 0 ), // 113, rsrc_saddr
  352. ( 1, 1, 1, 0 ), // 114, rsrc_obfix
  353. ( 0, 1, 1, 0 ), // 115, rsrc_rcfix (V4.0)
  354. ( 0, 0, 0, 0 ), // 116
  355. ( 0, 0, 0, 0 ), // 117
  356. ( 0, 0, 0, 0 ), // 118
  357. ( 0, 0, 0, 0 ), // 119
  358. ( 0, 1, 2, 0 ), // 120, shel_read
  359. ( 3, 1, 2, 0 ), // 121, shel_write
  360. ( 1, 1, 1, 0 ), // 122, shel_get
  361. ( 1, 1, 1, 0 ), // 123, shel_put
  362. ( 0, 1, 1, 0 ), // 124, shel_find
  363. ( 0, 1, 2, 0 ), // 125, shel_envrn
  364. ( 0, 1, 2, 0 ), // 126, shel_rdef
  365. ( 0, 1, 2, 0 ), // 127, shel_wdef
  366. ( 1, 1, 2, 0 ), // 128, shel_help
  367. ( 2, 1, 1, 0 ), // 129, appl_control
  368. ( 1, 5, 0, 0 ) // 130, appl_getinfo (V4.0)
  369. );
  370. var
  371. _global: TAESGlobal; public name 'aes_global';
  372. var
  373. _contrl: TAESContrl;
  374. _intin: TAESIntIn;
  375. _intout: TAESIntOut;
  376. _addrin: TAESAddrIn;
  377. _addrout: TAESAddrOut;
  378. const
  379. aespb: TAESPB = (
  380. control: @_contrl;
  381. global: @_global;
  382. intin: @_intin;
  383. intout: @_intout;
  384. addrin: @_addrin;
  385. addrout: @_addrout;
  386. ); public name 'aespb';
  387. var menu_register_cstr: aesstr;
  388. function appl_init: smallint;
  389. begin
  390. appl_init:=crys_if(10);
  391. end;
  392. function appl_read(ap_rid: smallint; ap_rlength: smallint; ap_rpbuff: pointer): smallint;
  393. begin
  394. _intin[0]:=ap_rid;
  395. _intin[1]:=ap_rlength;
  396. _addrin[0]:=ap_rpbuff;
  397. appl_read:=crys_if(11);
  398. end;
  399. function appl_write(ap_wid: smallint; ap_wlength: smallint; ap_wpbuff: pointer): smallint;
  400. begin
  401. _intin[0]:=ap_wid;
  402. _intin[1]:=ap_wlength;
  403. _addrin[0]:=ap_wpbuff;
  404. appl_write:=crys_if(12);
  405. end;
  406. function appl_find(fname: PChar): smallint;
  407. begin
  408. _addrin[0]:=fname;
  409. appl_find:=crys_if(13);
  410. end;
  411. function appl_find(ap_fpname: String): smallint;
  412. var s: aesstr;
  413. begin
  414. s := ap_fpname;
  415. _addrin[0]:=@s;
  416. appl_find:=crys_if(13);
  417. end;
  418. function appl_tplay(ap_tpmem: Pointer; ap_tpnum, ap_tpscale: smallint): smallint;
  419. begin
  420. _intin[0]:=ap_tpnum;
  421. _intin[1]:=ap_tpscale;
  422. _addrin[0]:=ap_tpmem;
  423. appl_tplay:=crys_if(14);
  424. end;
  425. function appl_trecord(ap_trmem: Pointer; ap_trcount: smallint): smallint;
  426. begin
  427. _intin[0]:=ap_trcount;
  428. _addrin[0]:=ap_trmem;
  429. appl_trecord:=crys_if(15);
  430. end;
  431. function appl_bvset(ap_bvdisk, ap_bvhard: Word): smallint;
  432. begin
  433. _intin[0]:=ap_bvdisk;
  434. _intin[1]:=ap_bvhard;
  435. appl_bvset:=crys_if(16);
  436. end;
  437. function appl_yield: smallint;
  438. begin
  439. appl_yield:=crys_if(17);
  440. end;
  441. procedure _appl_yield; assembler; nostackframe;
  442. asm
  443. pea.l (a2)
  444. move.w #$c9,d0
  445. trap #2
  446. movea.l (a7)+,a2
  447. end;
  448. function appl_search(ap_smode: smallint; ap_sname: Pchar; out ap_stype, ap_sid: smallint): smallint;
  449. begin
  450. _intin[0]:=ap_smode;
  451. _addrin[0]:=ap_sname;
  452. appl_search:=crys_if(18);
  453. ap_stype:=_intout[1];
  454. ap_sid:=_intout[2];
  455. end;
  456. function appl_search(ap_smode: smallint; out ap_sname: String; out ap_stype, ap_sid: smallint): smallint;
  457. var s: aesstr;
  458. begin
  459. _intin[0]:=ap_smode;
  460. _addrin[0]:=@s[0];
  461. appl_search:=crys_if(18);
  462. ap_sname:=PChar(@s[0]);
  463. ap_stype:=_intout[1];
  464. ap_sid:=_intout[2];
  465. end;
  466. function appl_exit: smallint;
  467. begin
  468. appl_exit:=crys_if(19);
  469. end;
  470. function appl_getinfo(ap_gtype: smallint; out ap_gout1, ap_gout2, ap_gout3, ap_gout4: smallint): smallint;
  471. begin
  472. _intin[0]:=ap_gtype;
  473. appl_getinfo:=crys_if(130);
  474. ap_gout1:=_intout[1];
  475. ap_gout2:=_intout[2];
  476. ap_gout3:=_intout[3];
  477. ap_gout4:=_intout[4];
  478. end;
  479. function evnt_keybd: smallint;
  480. begin
  481. evnt_keybd:=crys_if(20);
  482. end;
  483. function evnt_button(ev_bclicks: smallint; ev_bmask: smallint; ev_bstate: smallint;
  484. ev_bmx: psmallint; ev_bmy: psmallint; ev_bbutton: psmallint; ev_bkstate: psmallint): smallint;
  485. begin
  486. _intin[0]:=ev_bclicks;
  487. _intin[1]:=ev_bmask;
  488. _intin[2]:=ev_bstate;
  489. crys_if(21);
  490. ev_bmx^:=_intout[1];
  491. ev_bmy^:=_intout[2];
  492. ev_bbutton^:=_intout[3];
  493. ev_bkstate^:=_intout[4];
  494. evnt_button:=_intout[0];
  495. end;
  496. function evnt_button(ev_bclicks, ev_bmask, ev_bstate: smallint; out ev_bmx, ev_bmy, ev_bbutton, ev_bkstate: smallint): smallint;
  497. begin
  498. _intin[0]:=ev_bclicks;
  499. _intin[1]:=ev_bmask;
  500. _intin[2]:=ev_bstate;
  501. crys_if(21);
  502. ev_bmx:=_intout[1];
  503. ev_bmy:=_intout[2];
  504. ev_bbutton:=_intout[3];
  505. ev_bkstate:=_intout[4];
  506. evnt_button:=_intout[0];
  507. end;
  508. function evnt_mouse(ev_moflags: smallint; ev_mox: smallint; ev_moy: smallint; ev_mowidth: smallint; ev_moheight: smallint;
  509. ev_momx: psmallint; ev_momy: psmallint; ev_mobutton: psmallint; ev_mokstate: psmallint): smallint;
  510. begin
  511. _intin[0]:=ev_moflags;
  512. _intin[1]:=ev_mox;
  513. _intin[2]:=ev_moy;
  514. _intin[3]:=ev_mowidth;
  515. _intin[4]:=ev_moheight;
  516. crys_if(22);
  517. ev_momx^:=_intout[1];
  518. ev_momy^:=_intout[2];
  519. ev_mobutton^:=_intout[3];
  520. ev_mokstate^:=_intout[4];
  521. evnt_mouse:=_intout[0];
  522. end;
  523. function evnt_mouse(ev_moflags, ev_mox, ev_moy, ev_mowidth, ev_moheight: smallint;
  524. out ev_momx, ev_momy, ev_mobutton, ev_mokstate: smallint): smallint;
  525. begin
  526. _intin[0]:=ev_moflags;
  527. _intin[1]:=ev_mox;
  528. _intin[2]:=ev_moy;
  529. _intin[3]:=ev_mowidth;
  530. _intin[4]:=ev_moheight;
  531. crys_if(22);
  532. ev_momx:=_intout[1];
  533. ev_momy:=_intout[2];
  534. ev_mobutton:=_intout[3];
  535. ev_mokstate:=_intout[4];
  536. evnt_mouse:=_intout[0];
  537. end;
  538. function evnt_mesag(msg: psmallint): smallint;
  539. begin
  540. _addrin[0]:=msg;
  541. evnt_mesag:=crys_if(23);
  542. end;
  543. function evnt_mesag(out ev_mgpbuff: ARRAY_8): smallint;
  544. begin
  545. _addrin[0]:=@ev_mgpbuff;
  546. evnt_mesag:=crys_if(23);
  547. end;
  548. function evnt_timer(ev_tlocount: smallint; ev_thicount: smallint): smallint;
  549. begin
  550. _intin[0]:=ev_tlocount;
  551. _intin[1]:=ev_thicount;
  552. evnt_timer:=crys_if(24);
  553. end;
  554. function evnt_multi(ev_mflags: smallint; ev_mbclicks: smallint; ev_mbmask: smallint; ev_mbstate: smallint;
  555. ev_mm1flags: smallint; ev_mm1x: smallint; ev_mm1y: smallint; ev_mm1width: smallint; ev_mm1height: smallint;
  556. ev_mm2flags: smallint; ev_mm2x: smallint; ev_mm2y: smallint; ev_mm2width: smallint; ev_mm2height: smallint;
  557. ev_mmgpbuff: psmallint; ev_mtlocount: smallint; ev_mthicount: smallint;
  558. ev_mmox: psmallint; ev_mmoy: psmallint; ev_mmbutton: psmallint; ev_mmokstate: psmallint;
  559. ev_mkreturn: psmallint; ev_mbreturn: psmallint): smallint;
  560. begin
  561. _intin[0]:=ev_mflags;
  562. _intin[1]:=ev_mbclicks;
  563. _intin[2]:=ev_mbmask;
  564. _intin[3]:=ev_mbstate;
  565. _intin[4]:=ev_mm1flags;
  566. _intin[5]:=ev_mm1x;
  567. _intin[6]:=ev_mm1y;
  568. _intin[7]:=ev_mm1width;
  569. _intin[8]:=ev_mm1height;
  570. _intin[9]:=ev_mm2flags;
  571. _intin[10]:=ev_mm2x;
  572. _intin[11]:=ev_mm2y;
  573. _intin[12]:=ev_mm2width;
  574. _intin[13]:=ev_mm2height;
  575. _intin[14]:=ev_mtlocount;
  576. _intin[15]:=ev_mthicount;
  577. _addrin[0]:=ev_mmgpbuff;
  578. crys_if(25);
  579. ev_mmox^:=_intout[1];
  580. ev_mmoy^:=_intout[2];
  581. ev_mmbutton^:=_intout[3];
  582. ev_mmokstate^:=_intout[4];
  583. ev_mkreturn^:=_intout[5];
  584. ev_mbreturn^:=_intout[6];
  585. evnt_multi:=_intout[0];
  586. end;
  587. function evnt_multi(ev_mflags, ev_mbclicks, ev_mbmask,
  588. ev_mbstate, ev_mm1flags, ev_mm1x,
  589. ev_mm1y, ev_mm1width, ev_mm1height,
  590. ev_mm2flags, ev_mm2x, ev_mm2y,
  591. ev_mm2width, ev_mm2height: smallint;
  592. out ev_mmgpbuf: ARRAY_8;
  593. ev_mtlocount, ev_mthicount: smallint;
  594. out ev_mmox, ev_mmoy, ev_mmobutton,
  595. ev_mmokstate, ev_mkreturn,
  596. ev_mbreturn: smallint): smallint;
  597. begin
  598. _intin[0]:=ev_mflags;
  599. _intin[1]:=ev_mbclicks;
  600. _intin[2]:=ev_mbmask;
  601. _intin[3]:=ev_mbstate;
  602. _intin[4]:=ev_mm1flags;
  603. _intin[5]:=ev_mm1x;
  604. _intin[6]:=ev_mm1y;
  605. _intin[7]:=ev_mm1width;
  606. _intin[8]:=ev_mm1height;
  607. _intin[9]:=ev_mm2flags;
  608. _intin[10]:=ev_mm2x;
  609. _intin[11]:=ev_mm2y;
  610. _intin[12]:=ev_mm2width;
  611. _intin[13]:=ev_mm2height;
  612. _intin[14]:=ev_mtlocount;
  613. _intin[15]:=ev_mthicount;
  614. _addrin[0]:=@ev_mmgpbuf;
  615. crys_if(25);
  616. ev_mmox:=_intout[1];
  617. ev_mmoy:=_intout[2];
  618. ev_mmobutton:=_intout[3];
  619. ev_mmokstate:=_intout[4];
  620. ev_mkreturn:=_intout[5];
  621. ev_mbreturn:=_intout[6];
  622. evnt_multi:=_intout[0];
  623. end;
  624. function EvntMulti(var evnt_struct: TEVENT): smallint;
  625. begin
  626. _intin[0]:=evnt_struct.ev_mflags;
  627. _intin[1]:=evnt_struct.ev_mbclicks;
  628. _intin[2]:=evnt_struct.ev_bmask;
  629. _intin[3]:=evnt_struct.ev_mbstate;
  630. _intin[4]:=evnt_struct.ev_mm1flags;
  631. _intin[5]:=evnt_struct.ev_mm1x;
  632. _intin[6]:=evnt_struct.ev_mm1y;
  633. _intin[7]:=evnt_struct.ev_mm1width;
  634. _intin[8]:=evnt_struct.ev_mm1height;
  635. _intin[9]:=evnt_struct.ev_mm2flags;
  636. _intin[10]:=evnt_struct.ev_mm2x;
  637. _intin[11]:=evnt_struct.ev_mm2y;
  638. _intin[12]:=evnt_struct.ev_mm2width;
  639. _intin[13]:=evnt_struct.ev_mm2height;
  640. _intin[14]:=evnt_struct.ev_mtlocount;
  641. _intin[15]:=evnt_struct.ev_mthicount;
  642. _addrin[0]:=@evnt_struct.ev_mmgpbuf;
  643. crys_if(25);
  644. evnt_struct.ev_mwich:=_intout[0];
  645. evnt_struct.ev_mmox:=_intout[1];
  646. evnt_struct.ev_mmoy:=_intout[2];
  647. evnt_struct.ev_mmobutton:=_intout[3];
  648. evnt_struct.ev_mmokstate:=_intout[4];
  649. evnt_struct.ev_mkreturn:=_intout[5];
  650. evnt_struct.ev_mbreturn:=_intout[6];
  651. EvntMulti:=_intout[0];
  652. end;
  653. function evnt_dclick(ev_dnew: smallint; ev_dgetset: smallint): smallint;
  654. begin
  655. _intin[0]:=ev_dnew;
  656. _intin[1]:=ev_dgetset;
  657. evnt_dclick:=crys_if(26);
  658. end;
  659. function menu_bar(me_btree: PAESOBJECT; me_bshow: smallint): smallint;
  660. begin
  661. _intin[0]:=me_bshow;
  662. _addrin[0]:=me_btree;
  663. menu_bar:=crys_if(30);
  664. end;
  665. function menu_icheck(me_ctree: PAESOBJECT; me_citem: smallint; me_ccheck: smallint): smallint;
  666. begin
  667. _intin[0]:=me_citem;
  668. _intin[1]:=me_ccheck;
  669. _addrin[0]:=me_ctree;
  670. menu_icheck:=crys_if(31);
  671. end;
  672. function menu_ienable(me_etree: PAESOBJECT; me_eitem: smallint; me_eenable: smallint): smallint;
  673. begin
  674. _intin[0]:=me_eitem;
  675. _intin[1]:=me_eenable;
  676. _addrin[0]:=me_etree;
  677. menu_ienable:=crys_if(32);
  678. end;
  679. function menu_tnormal(me_ntree: PAESOBJECT; me_ntitle: smallint; me_nnormal: smallint): smallint;
  680. begin
  681. _intin[0]:=me_ntitle;
  682. _intin[1]:=me_nnormal;
  683. _addrin[0]:=me_ntree;
  684. menu_tnormal:=crys_if(33);
  685. end;
  686. function menu_text(me_ttree: PAESOBJECT; me_titem: smallint; me_ttext: PChar): smallint;
  687. begin
  688. _intin[0]:=me_titem;
  689. _addrin[0]:=me_ttree;
  690. _addrin[1]:=me_ttext;
  691. menu_text:=crys_if(34);
  692. end;
  693. function menu_register(me_rapid: smallint; me_rpstring: PChar): smallint;
  694. begin
  695. _intin[0]:=me_rapid;
  696. _addrin[0]:=me_rpstring;
  697. menu_register:=crys_if(35);
  698. end;
  699. function menu_register(me_rapid: smallint; me_rpstring: String): smallint;
  700. begin
  701. menu_register_cstr:=me_rpstring;
  702. _intin[0]:=me_rapid;
  703. _addrin[0]:=@menu_register_cstr;
  704. menu_register:=crys_if(35);
  705. end;
  706. function menu_unregister(me_uapid: smallint): smallint;
  707. begin
  708. _intin[0]:=me_uapid;
  709. with _contrl do
  710. begin
  711. opcode:=36;
  712. num_intin:=1;
  713. num_intout:=1;
  714. num_addrin:=0;
  715. num_addrout:=0;
  716. end;
  717. _crystal(@aespb);
  718. menu_unregister:=_intout[0];
  719. end;
  720. function menu_popup(me_menu: PMENU; me_xpos, me_ypos: smallint; var me_mdata: TMENU): smallint;
  721. begin
  722. _intin[0]:=me_xpos;
  723. _intin[1]:=me_ypos;
  724. _addrin[0]:=me_menu;
  725. _addrin[1]:=@me_mdata;
  726. with _contrl do
  727. begin
  728. opcode:=36;
  729. num_intin:=2;
  730. num_intout:=1;
  731. num_addrin:=2;
  732. num_addrout:=0;
  733. end;
  734. _crystal(@aespb);
  735. menu_popup:=_intout[0];
  736. end;
  737. function menu_attach(me_flag: smallint; me_tree: PAESOBJECT; me_item: smallint; me_mdata: PMENU): smallint;
  738. begin
  739. _intin[0]:=me_flag;
  740. _intin[1]:=me_item;
  741. _addrin[0]:=me_tree;
  742. _addrin[1]:=me_mdata;
  743. with _contrl do
  744. begin
  745. opcode:=37;
  746. num_intin:=2;
  747. num_intout:=1;
  748. num_addrin:=2;
  749. num_addrout:=0;
  750. end;
  751. _crystal(@aespb);
  752. menu_attach:=_intout[0];
  753. end;
  754. function menu_click(val: smallint; setit: smallint): smallint;
  755. begin
  756. _intin[0]:=val;
  757. _intin[1]:=setit;
  758. with _contrl do
  759. begin
  760. opcode:=37;
  761. num_intin:=2;
  762. num_intout:=1;
  763. num_addrin:=0;
  764. num_addrout:=0;
  765. end;
  766. _crystal(@aespb);
  767. menu_click:=_intout[0];
  768. end;
  769. function menu_istart(me_flag: smallint; me_tree: PAESOBJECT; me_imenu, me_item: smallint): smallint;
  770. begin
  771. _intin[0]:=me_flag;
  772. _intin[1]:=me_imenu;
  773. _intin[2]:=me_item;
  774. _addrin[0]:=me_tree;
  775. with _contrl do
  776. begin
  777. opcode:=38;
  778. num_intin:=3;
  779. num_intout:=1;
  780. num_addrin:=1;
  781. num_addrout:=0;
  782. end;
  783. _crystal(@aespb);
  784. menu_istart:=_intout[0];
  785. end;
  786. function menu_settings(me_flag: smallint; me_values: PMN_SET): smallint;
  787. begin
  788. _intin[0]:=me_flag;
  789. _addrin[0]:=me_values;
  790. with _contrl do
  791. begin
  792. opcode:=39;
  793. num_intin:=1;
  794. num_intout:=1;
  795. num_addrin:=1;
  796. num_addrout:=0;
  797. end;
  798. _crystal(@aespb);
  799. menu_settings:=_intout[0];
  800. end;
  801. function objc_add(ob_atree: PAESOBJECT; ob_aparent: smallint; ob_achild: smallint): smallint;
  802. begin
  803. _intin[0]:=ob_aparent;
  804. _intin[1]:=ob_achild;
  805. _addrin[0]:=ob_atree;
  806. objc_add:=crys_if(40);
  807. end;
  808. function objc_delete(ob_dltree: PAESOBJECT; ob_dlobject: smallint): smallint;
  809. begin
  810. _intin[0]:=ob_dlobject;
  811. _addrin[0]:=ob_dltree;
  812. objc_delete:=crys_if(41);
  813. end;
  814. function objc_draw(ob_drtree: PAESOBJECT; ob_drstart: smallint;
  815. ob_drdepth: smallint; ob_drxclip: smallint;
  816. ob_dryclip: smallint; ob_drwclip: smallint;
  817. ob_drhclip: smallint): smallint;
  818. begin
  819. _intin[0]:=ob_drstart;
  820. _intin[1]:=ob_drdepth;
  821. _intin[2]:=ob_drxclip;
  822. _intin[3]:=ob_dryclip;
  823. _intin[4]:=ob_drwclip;
  824. _intin[5]:=ob_drhclip;
  825. _addrin[0]:=ob_drtree;
  826. objc_draw:=crys_if(42);
  827. end;
  828. function objc_find(ob_ftree: PAESOBJECT; ob_fstartob: smallint;
  829. ob_fdepth: smallint; ob_fmx: smallint;
  830. ob_fmy: smallint): smallint;
  831. begin
  832. _intin[0]:=ob_fstartob;
  833. _intin[1]:=ob_fdepth;
  834. _intin[2]:=ob_fmx;
  835. _intin[3]:=ob_fmy;
  836. _addrin[0]:=ob_ftree;
  837. objc_find:=crys_if(43);
  838. end;
  839. function objc_offset(ob_oftree: PAESOBJECT; ob_ofobject: smallint;
  840. ob_ofxoff: psmallint; ob_ofyoff: psmallint): smallint;
  841. begin
  842. _intin[0]:=ob_ofobject;
  843. _addrin[0]:=ob_oftree;
  844. crys_if(44);
  845. ob_ofxoff^:=_intout[1];
  846. ob_ofyoff^:=_intout[2];
  847. objc_offset:=_intout[0];
  848. end;
  849. function objc_offset(ob_oftree: PAESOBJECT; ob_ofobject: smallint;
  850. out ob_ofxoff, ob_ofyoff: smallint): smallint;
  851. begin
  852. _intin[0]:=ob_ofobject;
  853. _addrin[0]:=ob_oftree;
  854. crys_if(44);
  855. ob_ofxoff:=_intout[1];
  856. ob_ofyoff:=_intout[2];
  857. objc_offset:=_intout[0];
  858. end;
  859. function objc_order(ob_ortree: PAESOBJECT; ob_orobject: smallint;
  860. ob_ornewpos: smallint): smallint;
  861. begin
  862. _intin[0]:=ob_orobject;
  863. _intin[1]:=ob_ornewpos;
  864. _addrin[0]:=ob_ortree;
  865. objc_order:=crys_if(45);
  866. end;
  867. function objc_edit(ob_edtree: PAESOBJECT; ob_edobject: smallint;
  868. ob_edchar: smallint; ob_edidx: psmallint;
  869. ob_edkind: smallint): smallint;
  870. begin
  871. _intin[0]:=ob_edobject;
  872. _intin[1]:=ob_edchar;
  873. _intin[2]:=ob_edidx^;
  874. _intin[3]:=ob_edkind;
  875. _addrin[0]:=ob_edtree;
  876. crys_if(46);
  877. ob_edidx^:=_intout[1];
  878. objc_edit:=_intout[0];
  879. end;
  880. function objc_edit(ob_edtree: PAESOBJECT; ob_edobject, ob_edchar: smallint;
  881. var ob_edidx: smallint; ob_edkind: smallint): smallint;
  882. begin
  883. _intin[0]:=ob_edobject;
  884. _intin[1]:=ob_edchar;
  885. _intin[2]:=ob_edidx;
  886. _intin[3]:=ob_edkind;
  887. _addrin[0]:=ob_edtree;
  888. crys_if(46);
  889. ob_edidx:=_intout[1];
  890. objc_edit:=_intout[0];
  891. end;
  892. function objc_change(ob_ctree: PAESOBJECT; ob_cobject: smallint;
  893. ob_cresvd: smallint; ob_cxclip: smallint;
  894. ob_cyclip: smallint; ob_cwclip: smallint;
  895. ob_chclip: smallint; ob_cnewstate: smallint;
  896. ob_credraw: smallint): smallint;
  897. begin
  898. _intin[0]:=ob_cobject;
  899. _intin[1]:=ob_cresvd;
  900. _intin[2]:=ob_cxclip;
  901. _intin[3]:=ob_cyclip;
  902. _intin[4]:=ob_cwclip;
  903. _intin[5]:=ob_chclip;
  904. _intin[6]:=ob_cnewstate;
  905. _intin[7]:=ob_credraw;
  906. _addrin[0]:=ob_ctree;
  907. objc_change:=crys_if(47);
  908. end;
  909. function objc_sysvar(ob_svmode, ob_svwhich, ob_svinval1, ob_svinval2: smallint;
  910. out ob_svoutval1, ob_svoutval2: smallint): smallint;
  911. begin
  912. _intin[0]:=ob_svmode;
  913. _intin[1]:=ob_svwhich;
  914. _intin[2]:=ob_svinval1;
  915. _intin[3]:=ob_svinval2;
  916. objc_sysvar:=crys_if(48);
  917. ob_svoutval1:=_intout[1];
  918. ob_svoutval2:=_intout[2];
  919. end;
  920. function form_do(fo_dotree: PAESOBJECT; fo_dostartob: smallint): smallint;
  921. begin
  922. _intin[0]:=fo_dostartob;
  923. _addrin[0]:=fo_dotree;
  924. form_do:=crys_if(50);
  925. end;
  926. function form_dial(fo_diflag: smallint; fo_dilittlx: smallint;
  927. fo_dilittly: smallint; fo_dilittlw: smallint;
  928. fo_dilittlh: smallint; fo_dibigx: smallint;
  929. fo_dibigy: smallint; fo_dibigw: smallint;
  930. fo_dibigh: smallint): smallint;
  931. begin
  932. _intin[0]:=fo_diflag;
  933. _intin[1]:=fo_dilittlx;
  934. _intin[2]:=fo_dilittly;
  935. _intin[3]:=fo_dilittlw;
  936. _intin[4]:=fo_dilittlh;
  937. _intin[5]:=fo_dibigx;
  938. _intin[6]:=fo_dibigy;
  939. _intin[7]:=fo_dibigw;
  940. _intin[8]:=fo_dibigh;
  941. form_dial:=crys_if(51);
  942. end;
  943. function form_alert(fo_adefbttn: smallint; alertstr: PChar): smallint;
  944. begin
  945. _intin[0]:=fo_adefbttn;
  946. _addrin[0]:=alertstr;
  947. form_alert:=crys_if(52);
  948. end;
  949. function form_alert(fo_adefbttn: smallint; fo_astring: String): smallint;
  950. var s: aesstr;
  951. begin
  952. s:=fo_astring;
  953. _intin[0]:=fo_adefbttn;
  954. _addrin[0]:=@s;
  955. form_alert:=crys_if(52);
  956. end;
  957. function form_error(error: smallint): smallint;
  958. begin
  959. _intin[0]:=error;
  960. form_error:=crys_if(53);
  961. end;
  962. function form_center(fo_ctree: PAESOBJECT; fo_cx: psmallint;
  963. fo_cy: psmallint; fo_cw: psmallint;
  964. fo_ch: psmallint): smallint;
  965. begin
  966. _addrin[0]:=fo_ctree;
  967. crys_if(54);
  968. fo_cx^:=_intout[1];
  969. fo_cy^:=_intout[2];
  970. fo_cw^:=_intout[3];
  971. fo_ch^:=_intout[4];
  972. form_center:=_intout[0];
  973. end;
  974. function form_center(fo_ctree: PAESOBJECT; out fo_cx, fo_cy, fo_cw, fo_ch: smallint): smallint;
  975. begin
  976. _addrin[0]:=fo_ctree;
  977. crys_if(54);
  978. fo_cx:=_intout[1];
  979. fo_cy:=_intout[2];
  980. fo_cw:=_intout[3];
  981. fo_ch:=_intout[4];
  982. form_center:=_intout[0];
  983. end;
  984. function form_keybd(fo_ktree: PAESOBJECT; fo_kobject: smallint;
  985. fo_kobnext: smallint; fo_kchar: smallint;
  986. fo_knxtobject: psmallint; fo_knxtchar: psmallint): smallint;
  987. begin
  988. _intin[0]:=fo_kobject;
  989. _intin[1]:=fo_kchar;
  990. _intin[2]:=fo_kobnext;
  991. _addrin[0]:=fo_ktree;
  992. crys_if(55);
  993. fo_knxtobject^:=_intout[1];
  994. fo_knxtchar^:=_intout[2];
  995. form_keybd:=_intout[0];
  996. end;
  997. function form_keybd(fo_ktree: PAESOBJECT; fo_kobject, fo_kobnext, fo_kchar: smallint;
  998. out fo_knxtobject, fo_knxtchar: smallint): smallint;
  999. begin
  1000. _intin[0]:=fo_kobject;
  1001. _intin[1]:=fo_kchar;
  1002. _intin[2]:=fo_kobnext;
  1003. _addrin[0]:=fo_ktree;
  1004. crys_if(55);
  1005. fo_knxtobject:=_intout[1];
  1006. fo_knxtchar:=_intout[2];
  1007. form_keybd:=_intout[0];
  1008. end;
  1009. function form_button(fo_btree: PAESOBJECT; fo_bobject: smallint;
  1010. fo_bclicks: smallint; fo_bnxtobj: psmallint): smallint;
  1011. begin
  1012. _intin[0]:=fo_bobject;
  1013. _intin[1]:=fo_bclicks;
  1014. _addrin[0]:=fo_btree;
  1015. crys_if(56);
  1016. fo_bnxtobj^:=_intout[1];
  1017. form_button:=_intout[0];
  1018. end;
  1019. function form_button(fo_btree: PAESOBJECT; fo_bobject, fo_bclicks: smallint;
  1020. out fo_bnxtobj: smallint): smallint;
  1021. begin
  1022. _intin[0]:=fo_bobject;
  1023. _intin[1]:=fo_bclicks;
  1024. _addrin[0]:=fo_btree;
  1025. crys_if(56);
  1026. fo_bnxtobj:=_intout[1];
  1027. form_button:=_intout[0];
  1028. end;
  1029. function graf_rubbox(gr_rx, gr_ry, gr_rminwidth, gr_rminheight: smallint;
  1030. out gr_rlastwidth, gr_rlastheight: smallint): smallint; alias: 'graf_rubberbox';
  1031. begin
  1032. _intin[0]:=gr_rx;
  1033. _intin[1]:=gr_ry;
  1034. _intin[2]:=gr_rminwidth;
  1035. _intin[3]:=gr_rminheight;
  1036. graf_rubbox:=crys_if(70);
  1037. gr_rlastwidth:=_intout[1];
  1038. gr_rlastheight:=_intout[2];
  1039. end;
  1040. function graf_dragbox(gr_dwidth, gr_dheight, gr_dstartx, gr_dstarty,
  1041. gr_dboundx, gr_dboundy, gr_dboundw, gr_dboundh: smallint;
  1042. out gr_dfinishx, gr_dfinishy: smallint): smallint;
  1043. begin
  1044. _intin[0]:=gr_dwidth;
  1045. _intin[1]:=gr_dheight;
  1046. _intin[2]:=gr_dstartx;
  1047. _intin[3]:=gr_dstarty;
  1048. _intin[4]:=gr_dboundx;
  1049. _intin[5]:=gr_dboundy;
  1050. _intin[6]:=gr_dboundw;
  1051. _intin[7]:=gr_dboundh;
  1052. graf_dragbox:=crys_if(71);
  1053. gr_dfinishx:=_intout[1];
  1054. gr_dfinishy:=_intout[2];
  1055. end;
  1056. function graf_mbox(gr_mwidth, gr_mheight, gr_msourcex, gr_msourcey, gr_mdestx, gr_mdesty: smallint): smallint; alias: 'graf_movebox';
  1057. begin
  1058. _intin[0]:=gr_mwidth;
  1059. _intin[1]:=gr_mheight;
  1060. _intin[2]:=gr_msourcex;
  1061. _intin[3]:=gr_msourcey;
  1062. _intin[4]:=gr_mdestx;
  1063. _intin[5]:=gr_mdesty;
  1064. graf_mbox:=crys_if(72);
  1065. end;
  1066. function graf_growbox(gr_gstx, gr_gsty, gr_gstwidth, gr_gstheight,
  1067. gr_gfinx, gr_gfiny, gr_gfinwidth, gr_gfinheight :smallint): smallint;
  1068. begin
  1069. _intin[0]:=gr_gstx;
  1070. _intin[1]:=gr_gsty;
  1071. _intin[2]:=gr_gstwidth;
  1072. _intin[3]:=gr_gstheight;
  1073. _intin[4]:=gr_gfinx;
  1074. _intin[5]:=gr_gfiny;
  1075. _intin[6]:=gr_gfinwidth;
  1076. _intin[7]:=gr_gfinheight;
  1077. graf_growbox:=crys_if(73);
  1078. end;
  1079. function graf_shrinkbox(gr_sfinx, gr_sfiny, gr_sfinwidth, gr_sfinheight,
  1080. gr_sstx, gr_ssty, gr_sstwidth, gr_sstheight: smallint): smallint;
  1081. begin
  1082. _intin[0]:=gr_sfinx;
  1083. _intin[1]:=gr_sfiny;
  1084. _intin[2]:=gr_sfinwidth;
  1085. _intin[3]:=gr_sfinheight;
  1086. _intin[4]:=gr_sstx;
  1087. _intin[5]:=gr_ssty;
  1088. _intin[6]:=gr_sstwidth;
  1089. _intin[7]:=gr_sstheight;
  1090. graf_shrinkbox:=crys_if(74);
  1091. end;
  1092. function graf_watchbox(gr_wptree: PAESOBJECT; gr_wobject, gr_winstate, gr_woutstate: smallint): smallint;
  1093. begin
  1094. _intin[0]:=0;
  1095. _intin[1]:=gr_wobject;
  1096. _intin[2]:=gr_winstate;
  1097. _intin[3]:=gr_woutstate;
  1098. _addrin[0]:=gr_wptree;
  1099. graf_watchbox:=crys_if(75);
  1100. end;
  1101. function graf_slidebox(gr_slptree: PAESOBJECT; gr_slparent, gr_slobject, gr_slvh: smallint): smallint;
  1102. begin
  1103. _intin[0]:=gr_slparent;
  1104. _intin[1]:=gr_slobject;
  1105. _intin[2]:=gr_slvh;
  1106. _addrin[0]:=gr_slptree;
  1107. graf_slidebox:=crys_if(76);
  1108. end;
  1109. function graf_handle(gr_hwchar: psmallint; gr_hhchar: psmallint; gr_hwbox: psmallint; gr_hhbox: psmallint): smallint;
  1110. begin
  1111. crys_if(77);
  1112. gr_hwchar^:=_intout[1];
  1113. gr_hhchar^:=_intout[2];
  1114. gr_hwbox^:=_intout[3];
  1115. gr_hhbox^:=_intout[4];
  1116. graf_handle:=_intout[0];
  1117. end;
  1118. function graf_handle(out gr_hwchar, gr_hhchar, gr_hwbox, gr_hhbox: smallint): smallint;
  1119. begin
  1120. crys_if(77);
  1121. gr_hwchar:=_intout[1];
  1122. gr_hhchar:=_intout[2];
  1123. gr_hwbox:=_intout[3];
  1124. gr_hhbox:=_intout[4];
  1125. graf_handle:=_intout[0];
  1126. end;
  1127. function graf_mouse(gr_monumber: smallint; gr_mofaddr: PMFORM): smallint;
  1128. begin
  1129. _intin[0]:=gr_monumber;
  1130. _addrin[0]:=gr_mofaddr;
  1131. graf_mouse:=crys_if(78);
  1132. end;
  1133. function graf_mkstate(gr_mkmx: psmallint; gr_mkmy: psmallint;
  1134. gr_mkmstate: psmallint; gr_mkkstate: psmallint): smallint;
  1135. begin
  1136. crys_if(79);
  1137. gr_mkmx^:=_intout[1];
  1138. gr_mkmy^:=_intout[2];
  1139. gr_mkmstate^:=_intout[3];
  1140. gr_mkkstate^:=_intout[4];
  1141. graf_mkstate:=_intout[0];
  1142. end;
  1143. function graf_mkstate(out gr_mkmx, gr_mkmy, gr_mkmstate, gr_mkkstate: smallint): smallint;
  1144. begin
  1145. crys_if(79);
  1146. gr_mkmx:=_intout[1];
  1147. gr_mkmy:=_intout[2];
  1148. gr_mkmstate:=_intout[3];
  1149. gr_mkkstate:=_intout[4];
  1150. graf_mkstate:=_intout[0];
  1151. end;
  1152. function scrp_read(sc_rpscrap: pchar): smallint;
  1153. begin
  1154. _addrin[0]:=sc_rpscrap;
  1155. scrp_read:=crys_if(80);
  1156. end;
  1157. function scrp_read(out sc_rpscrap: String): smallint;
  1158. var s: aesstr;
  1159. begin
  1160. _addrin[0]:=@s;
  1161. scrp_read:=crys_if(80);
  1162. sc_rpscrap:=Pchar(@s[0]);
  1163. end;
  1164. function scrp_write(sc_wpscrap: pchar): smallint;
  1165. begin
  1166. _addrin[0]:=sc_wpscrap;
  1167. scrp_write:=crys_if(81);
  1168. end;
  1169. function scrp_write(const sc_wpscrap: String): smallint;
  1170. var s: aesstr;
  1171. begin
  1172. s:=sc_wpscrap;
  1173. _addrin[0]:=@s;
  1174. scrp_write:=crys_if(81);
  1175. end;
  1176. function scrp_clear: smallint;
  1177. begin
  1178. scrp_clear:=crys_if(82);
  1179. end;
  1180. function fsel_input(fs_iinpath: pchar; fs_iinsel: pchar; fs_iexbutton: psmallint): smallint;
  1181. begin
  1182. _addrin[0]:=fs_iinpath;
  1183. _addrin[1]:=fs_iinsel;
  1184. crys_if(90);
  1185. fs_iexbutton^:=_intout[1];
  1186. fsel_input:=_intout[0];
  1187. end;
  1188. function fsel_input(var fs_iinpath, fs_iinsel: String; out fs_iexbutton: smallint): smallint;
  1189. var s1, s2: aesstr;
  1190. begin
  1191. s1:=fs_iinpath;
  1192. s2:=fs_iinsel;
  1193. _addrin[0]:=@s1;
  1194. _addrin[1]:=@s2;
  1195. fsel_input:=crys_if(90);
  1196. fs_iexbutton:=_intout[1];
  1197. fs_iinpath:=Pchar(@s1[0]);
  1198. fs_iinsel:=Pchar(@s2[0]);
  1199. end;
  1200. function fsel_exinput(fs_einpath: pchar; fs_einsel: pchar; fs_eexbutton: psmallint; elabel: pchar): smallint;
  1201. begin
  1202. _addrin[0]:=fs_einpath;
  1203. _addrin[1]:=fs_einsel;
  1204. _addrin[2]:=elabel;
  1205. crys_if(91);
  1206. fs_eexbutton^:=_intout[1];
  1207. fsel_exinput:=_intout[0];
  1208. end;
  1209. function fsel_exinput(var fs_einpath, fs_einsel: String; out fs_eexbutton: smallint;
  1210. const fs_elabel: String): smallint;
  1211. var s1, s2, s3: aesstr;
  1212. begin
  1213. s1:=fs_einpath;
  1214. s2:=fs_einsel;
  1215. s3:=fs_elabel;
  1216. _addrin[0]:=@s1;
  1217. _addrin[1]:=@s2;
  1218. _addrin[2]:=@s3;
  1219. fsel_exinput:=crys_if(91);
  1220. fs_eexbutton:=_intout[1];
  1221. fs_einpath:=Pchar(@s1[0]);
  1222. fs_einsel:=Pchar(@s2[0]);
  1223. end;
  1224. function wind_create(kind: smallint; x, y, w, h: smallint): smallint;
  1225. begin
  1226. _intin[0]:=kind;
  1227. _intin[1]:=x;
  1228. _intin[2]:=y;
  1229. _intin[3]:=w;
  1230. _intin[4]:=h;
  1231. wind_create:=crys_if(100);
  1232. end;
  1233. function wind_open(handle: smallint; x, y, w, h: smallint): smallint;
  1234. begin
  1235. _intin[0]:=handle;
  1236. _intin[1]:=x;
  1237. _intin[2]:=y;
  1238. _intin[3]:=w;
  1239. _intin[4]:=h;
  1240. wind_open:=crys_if(101);
  1241. end;
  1242. function wind_close(wi_clhandle: smallint): smallint;
  1243. begin
  1244. _intin[0]:=wi_clhandle;
  1245. wind_close:=crys_if(102);
  1246. end;
  1247. function wind_delete(handle: smallint): smallint;
  1248. begin
  1249. _intin[0]:=handle;
  1250. wind_delete:=crys_if(103);
  1251. end;
  1252. function wind_get(wi_ghandle: smallint; wi_gfield: smallint;
  1253. wi_gw1: psmallint; wi_gw2: psmallint;
  1254. wi_gw3: psmallint; wi_gw4: psmallint): smallint;
  1255. begin
  1256. _intin[0]:=wi_ghandle;
  1257. _intin[1]:=wi_gfield;
  1258. with _contrl do
  1259. begin
  1260. opcode:=104;
  1261. num_intin:=2;
  1262. num_intout:=5;
  1263. num_addrin:=0;
  1264. num_addrout:=0;
  1265. end;
  1266. case wi_gfield of
  1267. WF_DCOLOR, WF_COLOR:
  1268. begin
  1269. _intin[2]:=wi_gw1^;
  1270. _contrl.num_intin:=3;
  1271. end;
  1272. WF_INFO, WF_NAME:
  1273. begin
  1274. PPointer(@_intin[2])^:=wi_gw1;
  1275. _contrl.num_intin:=4;
  1276. end;
  1277. end;
  1278. _intout[3]:=0;
  1279. _intout[4]:=0;
  1280. _crystal(@aespb);
  1281. case wi_gfield of
  1282. WF_INFO, WF_NAME:
  1283. begin
  1284. {* special case where W1 shall not be overwritten *}
  1285. end;
  1286. else
  1287. begin
  1288. wi_gw1^:=_intout[1];
  1289. wi_gw2^:=_intout[2];
  1290. wi_gw3^:=_intout[3];
  1291. wi_gw4^:=_intout[4];
  1292. end;
  1293. end;
  1294. wind_get:=_intout[0];
  1295. end;
  1296. function wind_get(wi_ghandle, wi_gfield: smallint;
  1297. out wi_gw1, wi_gw2, wi_gw3, wi_gw4: smallint): smallint;
  1298. begin
  1299. _intin[0]:=wi_ghandle;
  1300. _intin[1]:=wi_gfield;
  1301. with _contrl do
  1302. begin
  1303. opcode:=104;
  1304. num_intin:=2;
  1305. num_intout:=5;
  1306. num_addrin:=0;
  1307. num_addrout:=0;
  1308. end;
  1309. case wi_gfield of
  1310. WF_DCOLOR, WF_COLOR:
  1311. begin
  1312. _intin[2]:=wi_gw1;
  1313. _contrl.num_intin:=3;
  1314. end;
  1315. WF_INFO, WF_NAME:
  1316. begin
  1317. PPointer(@_intin[2])^:=@wi_gw1;
  1318. _contrl.num_intin:=4;
  1319. end;
  1320. end;
  1321. _intout[3]:=0;
  1322. _intout[4]:=0;
  1323. _crystal(@aespb);
  1324. case wi_gfield of
  1325. WF_INFO, WF_NAME:
  1326. begin
  1327. {* special case where W1 shall not be overwritten *}
  1328. end;
  1329. else
  1330. begin
  1331. wi_gw1:=_intout[1];
  1332. wi_gw2:=_intout[2];
  1333. wi_gw3:=_intout[3];
  1334. wi_gw4:=_intout[4];
  1335. end;
  1336. end;
  1337. wind_get:=_intout[0];
  1338. end;
  1339. function wind_get(wi_ghandle: smallint; wi_gfield: smallint; gr: PGRECT): smallint;
  1340. begin
  1341. _intin[0]:=wi_ghandle;
  1342. _intin[1]:=wi_gfield;
  1343. crys_if(104);
  1344. gr^.x:=_intout[1];
  1345. gr^.y:=_intout[2];
  1346. gr^.w:=_intout[3];
  1347. gr^.h:=_intout[4];
  1348. wind_get:=_intout[0];
  1349. end;
  1350. function wind_set(wi_shandle: smallint; wi_sfield: smallint;
  1351. wi_sw1: smallint; wi_sw2: smallint;
  1352. wi_sw3: smallint; wi_sw4: smallint): smallint;
  1353. begin
  1354. _intin[0]:=wi_shandle;
  1355. _intin[1]:=wi_sfield;
  1356. _intin[2]:=wi_sw1;
  1357. _intin[3]:=wi_sw2;
  1358. _intin[4]:=wi_sw3;
  1359. _intin[5]:=wi_sw4;
  1360. wind_set:=crys_if(105);
  1361. end;
  1362. function wind_set(wi_shandle: smallint; wi_sfield: smallint; ptr: Pointer): smallint;
  1363. begin
  1364. _intin[0]:=wi_shandle;
  1365. _intin[1]:=wi_sfield;
  1366. PPointer(@_intin[2])^:=ptr;
  1367. _intin[4]:=0;
  1368. _intin[5]:=0;
  1369. wind_set:=crys_if(105);
  1370. end;
  1371. function wind_set(wi_shandle: smallint; wi_sfield: smallint; gr: PGRECT): smallint;
  1372. begin
  1373. _intin[0]:=wi_shandle;
  1374. _intin[1]:=wi_sfield;
  1375. _intin[2]:=gr^.x;
  1376. _intin[3]:=gr^.y;
  1377. _intin[4]:=gr^.w;
  1378. _intin[5]:=gr^.h;
  1379. wind_set:=crys_if(105);
  1380. end;
  1381. function wind_find(wi_fmx: smallint; wi_fmy: smallint): smallint;
  1382. begin
  1383. _intin[0]:=wi_fmx;
  1384. _intin[1]:=wi_fmy;
  1385. wind_find:=crys_if(106);
  1386. end;
  1387. function wind_update(wi_ubegend: smallint): smallint;
  1388. begin
  1389. _intin[0]:=wi_ubegend;
  1390. wind_update:=crys_if(107);
  1391. end;
  1392. function wind_calc(wi_ctype: smallint; wi_ckind: smallint;
  1393. wi_cinx: smallint; wi_ciny: smallint;
  1394. wi_cinw: smallint; wi_cinh: smallint;
  1395. coutx: psmallint; couty: psmallint;
  1396. coutw: psmallint; couth: psmallint): smallint;
  1397. begin
  1398. _intin[0]:=wi_ctype;
  1399. _intin[1]:=wi_ckind;
  1400. _intin[2]:=wi_cinx;
  1401. _intin[3]:=wi_ciny;
  1402. _intin[4]:=wi_cinw;
  1403. _intin[5]:=wi_cinh;
  1404. crys_if(108);
  1405. coutx^:=_intout[1];
  1406. couty^:=_intout[2];
  1407. coutw^:=_intout[3];
  1408. couth^:=_intout[4];
  1409. wind_calc:=_intout[0];
  1410. end;
  1411. function wind_calc(wi_ctype, wi_ckind, wi_cinx, wi_ciny, wi_cinw, wi_cinh : smallint;
  1412. out wi_coutx, wi_couty, wi_coutw, wi_couth: smallint): smallint;
  1413. begin
  1414. _intin[0]:=wi_ctype;
  1415. _intin[1]:=wi_ckind;
  1416. _intin[2]:=wi_cinx;
  1417. _intin[3]:=wi_ciny;
  1418. _intin[4]:=wi_cinw;
  1419. _intin[5]:=wi_cinh;
  1420. crys_if(108);
  1421. wi_coutx:=_intout[1];
  1422. wi_couty:=_intout[2];
  1423. wi_coutw:=_intout[3];
  1424. wi_couth:=_intout[4];
  1425. wind_calc:=_intout[0];
  1426. end;
  1427. procedure wind_new;
  1428. begin
  1429. crys_if(109);
  1430. end;
  1431. function rsrc_load(re_lpfname: PChar): smallint;
  1432. begin
  1433. _addrin[0]:=re_lpfname;
  1434. rsrc_load:=crys_if(110);
  1435. end;
  1436. function rsrc_load(re_lpfname: String): smallint;
  1437. var s: aesstr;
  1438. begin
  1439. s:=re_lpfname;
  1440. _addrin[0]:=@s;
  1441. rsrc_load:=crys_if(110);
  1442. end;
  1443. function rsrc_free: smallint;
  1444. begin
  1445. rsrc_free:=crys_if(111);
  1446. end;
  1447. function rsrc_gaddr(re_gtype: smallint; re_gindex: smallint; gaddr: ppointer): smallint;
  1448. begin
  1449. _intin[0]:=re_gtype;
  1450. _intin[1]:=re_gindex;
  1451. crys_if(112);
  1452. gaddr^:=_addrout[0];
  1453. rsrc_gaddr:=_intout[0];
  1454. end;
  1455. function rsrc_gaddr(re_gtype, re_gindex: smallint; out re_gaddr: Pointer): smallint;
  1456. begin
  1457. _intin[0]:=re_gtype;
  1458. _intin[1]:=re_gindex;
  1459. crys_if(112);
  1460. re_gaddr:=_addrout[0];
  1461. rsrc_gaddr:=_intout[0];
  1462. end;
  1463. function rsrc_saddr(re_stype: smallint; re_sindex: smallint; saddr: pointer): smallint;
  1464. begin
  1465. _intin[0]:=re_stype;
  1466. _intin[1]:=re_sindex;
  1467. _addrin[0]:=saddr;
  1468. rsrc_saddr:=crys_if(113);
  1469. end;
  1470. function rsrc_obfix(re_otree: PAESOBJECT; re_oobject: smallint): smallint;
  1471. begin
  1472. _intin[0]:=re_oobject;
  1473. _addrin[0]:=re_otree;
  1474. rsrc_obfix:=crys_if(114);
  1475. end;
  1476. function rsrc_rcfix(rc_header: PRSHDR): smallint;
  1477. begin
  1478. _addrin[0]:=rc_header;
  1479. rsrc_rcfix:=crys_if(115);
  1480. end;
  1481. function shel_read(sh_rpcmd: pchar; sh_rptail: pchar): smallint;
  1482. begin
  1483. _addrin[0]:=sh_rpcmd;
  1484. _addrin[1]:=sh_rptail;
  1485. shel_read:=crys_if(120);
  1486. end;
  1487. function shel_read(out sh_rpcmd, sh_rptail: String): smallint;
  1488. var s1, s2: aesstr;
  1489. begin
  1490. _addrin[0]:=@s1;
  1491. _addrin[1]:=@s2;
  1492. shel_read:=crys_if(120);
  1493. sh_rpcmd:=Pchar(@s1[0]);
  1494. sh_rptail:=Pchar(@s2[0]);
  1495. end;
  1496. function shel_write(sh_wdoex: smallint; sh_wisgr: smallint;
  1497. sh_wiscr: smallint; sh_wpcmd: pchar;
  1498. sh_wptail: pchar): smallint;
  1499. begin
  1500. _intin[0]:=sh_wdoex;
  1501. _intin[1]:=sh_wisgr;
  1502. _intin[2]:=sh_wiscr;
  1503. _addrin[0]:=sh_wpcmd;
  1504. _addrin[1]:=sh_wptail;
  1505. shel_write:=crys_if(121);
  1506. end;
  1507. function shel_write(sh_wdoex, sh_wisgr, sh_wiscr: smallint;
  1508. const sh_wpcmd, sh_wptail: String): smallint;
  1509. var s1: aesstr;
  1510. begin
  1511. s1:=sh_wpcmd;
  1512. _intin[0]:=sh_wdoex;
  1513. _intin[1]:=sh_wisgr;
  1514. _intin[2]:=sh_wiscr;
  1515. _addrin[0]:=@s1;
  1516. _addrin[1]:=@sh_wptail[0];
  1517. shel_write:=crys_if(121);
  1518. end;
  1519. function shel_get(sh_gaddr: pchar; sh_glen: word): smallint;
  1520. begin
  1521. _intin[0]:=smallint(sh_glen);
  1522. _addrin[0]:=sh_gaddr;
  1523. shel_get:=crys_if(122);
  1524. end;
  1525. function shel_put(sh_paddr: pchar; sh_plen: word): smallint;
  1526. begin
  1527. _intin[0]:=smallint(sh_plen);
  1528. _addrin[0]:=sh_paddr;
  1529. shel_put:=crys_if(123);
  1530. end;
  1531. function shel_find(sh_fpbuff: pchar): smallint;
  1532. begin
  1533. _addrin[0]:=sh_fpbuff;
  1534. shel_find:=crys_if(124);
  1535. end;
  1536. function shel_find(var sh_fpbuff: String): smallint;
  1537. var s: aesstr;
  1538. begin
  1539. s:=sh_fpbuff;
  1540. _addrin[0]:=@s;
  1541. shel_find:=crys_if(124);
  1542. sh_fpbuff:=Pchar(@s[0]);
  1543. end;
  1544. function shel_envrn(sh_epvalue: ppchar; sh_eparm: pchar): smallint;
  1545. begin
  1546. _addrin[0]:=sh_epvalue;
  1547. _addrin[1]:=sh_eparm;
  1548. shel_envrn:=crys_if(125);
  1549. end;
  1550. function shel_envrn(out sh_epvalue: Pointer; const sh_eparm: String): smallint;
  1551. var s: aesstr;
  1552. begin
  1553. s:=sh_eparm;
  1554. _addrin[0]:=@sh_epvalue;
  1555. _addrin[1]:=@s;
  1556. shel_envrn:=crys_if(125);
  1557. end;
  1558. function shel_rdef(out sh_rlpcmd, sh_rlpdir: String): smallint;
  1559. var s1, s2: aesstr;
  1560. begin
  1561. _addrin[0]:=@s1;
  1562. _addrin[1]:=@s2;
  1563. shel_rdef:=crys_if(126);
  1564. sh_rlpcmd:=Pchar(@s1[0]);
  1565. sh_rlpdir:=Pchar(@s2[0]);
  1566. end;
  1567. function shel_wdef(const sh_wlpcmd, sh_wlpdir: String): smallint;
  1568. var s1, s2: aesstr;
  1569. begin
  1570. s1:=sh_wlpcmd;
  1571. s2:=sh_wlpdir;
  1572. _addrin[0]:=@s1;
  1573. _addrin[1]:=@s2;
  1574. shel_wdef:=crys_if(127);
  1575. end;
  1576. function xgrf_stepcalc(xg_storgw, xg_storgh, xg_stxc, xg_styc, xg_stw, xg_sth : smallint;
  1577. out xg_stpcx, xg_stpcy, xg_stpcnt, xg_stpxstep, xg_stpystep: smallint): smallint;
  1578. begin
  1579. _intin[0]:=xg_storgw;
  1580. _intin[1]:=xg_storgh;
  1581. _intin[2]:=xg_stxc;
  1582. _intin[3]:=xg_styc;
  1583. _intin[4]:=xg_stw;
  1584. _intin[5]:=xg_sth;
  1585. with _contrl do
  1586. begin
  1587. opcode:=130;
  1588. num_intin:=6;
  1589. num_intout:=6;
  1590. num_addrin:=0;
  1591. num_addrout:=0;
  1592. end;
  1593. _crystal(@aespb);
  1594. xgrf_stepcalc:=_intout[0];
  1595. xg_stpcx:=_intout[1];
  1596. xg_stpcy:=_intout[2];
  1597. xg_stpcnt:=_intout[3];
  1598. xg_stpxstep:=_intout[4];
  1599. xg_stpystep:=_intout[5];
  1600. end;
  1601. function xgrf_2box(xg_2cnt, xg_2xstep, xg_2ystep, xg_2doubled,
  1602. xg_2corners, xg_2xc, xg_2yc, xg_2w, xg_2h: smallint): smallint;
  1603. begin
  1604. _intin[0]:=xg_2cnt;
  1605. _intin[1]:=xg_2xstep;
  1606. _intin[2]:=xg_2ystep;
  1607. _intin[3]:=xg_2doubled;
  1608. _intin[4]:=xg_2corners;
  1609. _intin[5]:=xg_2xc;
  1610. _intin[6]:=xg_2yc;
  1611. _intin[7]:=xg_2w;
  1612. _intin[8]:=xg_2h;
  1613. with _contrl do
  1614. begin
  1615. opcode:=131;
  1616. num_intin:=9;
  1617. num_intout:=1;
  1618. num_addrin:=0;
  1619. num_addrout:=0;
  1620. end;
  1621. _crystal(@aespb);
  1622. xgrf_2box:=_intout[0];
  1623. end;
  1624. function vq_aes: smallint;
  1625. begin
  1626. _global[0] := 0;
  1627. vq_aes := appl_init;
  1628. if (_global[0] = 0) then
  1629. vq_aes := -1;
  1630. end;
  1631. function crys_if(_opcode: dword): smallint;
  1632. begin
  1633. with _contrl do
  1634. begin
  1635. opcode:=_opcode;
  1636. nums:=ops_table[_opcode-10];
  1637. end;
  1638. asm
  1639. pea.l (a2)
  1640. lea.l aespb,a0
  1641. move.l a0,d1
  1642. move.w #AES_TRAP_MAGIC,d0
  1643. trap #2
  1644. movea.l (a7)+,a2
  1645. end;
  1646. crys_if:=_intout[0];
  1647. end;
  1648. procedure _crystal(pb: PAESPB); assembler; nostackframe;
  1649. asm
  1650. pea.l (a2)
  1651. move.l pb,a0
  1652. move.l a0,d1
  1653. move.w #AES_TRAP_MAGIC,d0
  1654. trap #2
  1655. movea.l (a7)+,a2
  1656. end;
  1657. end.