vdi.pas 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336
  1. {
  2. Copyright (c) 2017 by Free Pascal development team
  3. VDI 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. {$IFNDEF FPC_DOTTEDUNITS}
  14. unit vdi;
  15. {$ENDIF FPC_DOTTEDUNITS}
  16. interface
  17. {$IFDEF FPC_DOTTEDUNITS}
  18. uses AtariApi.Gemcmmn;
  19. {$ELSE FPC_DOTTEDUNITS}
  20. uses gemcmmn;
  21. {$ENDIF FPC_DOTTEDUNITS}
  22. { The API description of this file is based on the information available
  23. online at: https://freemint.github.io/tos.hyp/en/index.html }
  24. {$I vditypes.inc}
  25. type
  26. ARRAY_8 = gemcmmn.ARRAY_8;
  27. PMFORM = gemcmmn.PMFORM;
  28. TMFORM = gemcmmn.TMFORM;
  29. procedure vdi;
  30. procedure vdi(pb: PVDIPB);
  31. function vq_gdos: smallint;
  32. function vq_vgdos: LongInt;
  33. procedure vdi_str_to_pchar(src: psmallint; des: PAnsiChar; len: smallint);
  34. function pchar_str_to_vdi(src: PAnsiChar; des: psmallint): longint;
  35. procedure v_opnwk(work_in: psmallint; handle: psmallint; work_out: psmallint);
  36. procedure v_clswk(handle: smallint);
  37. procedure v_clrwk(handle: smallint);
  38. procedure v_updwk(handle: smallint);
  39. procedure vq_chcells(handle: smallint; out rows, columns: smallint);
  40. procedure v_exit_cur(handle: smallint);
  41. procedure v_enter_cur(handle: smallint);
  42. procedure v_curup(handle: smallint);
  43. procedure v_curdown(handle: smallint);
  44. procedure v_curright(handle: smallint);
  45. procedure v_curleft(handle: smallint);
  46. procedure v_curhome(handle: smallint);
  47. procedure v_eeos(handle: smallint);
  48. procedure v_eeol(handle: smallint);
  49. procedure v_curaddress(handle, row, column: smallint);
  50. procedure v_curtext(handle: smallint; const outstring: shortstring);
  51. procedure v_rvon(handle: smallint);
  52. procedure v_rvoff(handle: smallint);
  53. procedure vq_curaddress(handle: smallint; out row, column: smallint);
  54. function vq_tabstatus(handle: smallint): smallint;
  55. procedure v_hardcopy(handle: smallint);
  56. procedure v_dspcur(handle, x, y: smallint);
  57. procedure v_rmcur(handle: smallint);
  58. procedure v_form_adv(handle: smallint);
  59. procedure v_output_window(handle: smallint; xyarray: ARRAY_4);
  60. procedure v_clear_disp_list(handle: smallint);
  61. procedure v_bit_image(handle: smallint; const filename: shortstring;
  62. aspect, x_scale, y_scale, h_align, v_align: smallint;
  63. const xyarray: ARRAY_4);
  64. procedure vq_scan(handle: smallint; out g_slice, g_page, a_slice, a_page, div_fac: smallint);
  65. procedure v_alpha_text(handle: smallint; const outstring: shortstring);
  66. function v_orient(handle, orientation: smallint): smallint;
  67. function v_copies(handle, count: smallint): smallint;
  68. procedure v_tray(handle, tray: smallint);
  69. function v_page_size(handle, page_id: smallint): smallint;
  70. function vs_palette(handle, palette: smallint): smallint;
  71. procedure v_sound(handle, frequency, duration: smallint);
  72. function vs_mute(handle, action: smallint): smallint;
  73. procedure vt_resolution(handle, xres, yres: smallint;
  74. out xset, yset: smallint);
  75. procedure vt_axis(handle, xres, yres: smallint;
  76. out xset, yset: smallint);
  77. procedure vt_origin(handle, xorigin, yorigin: smallint);
  78. procedure vq_tdimensions(handle: smallint; out xdimension, ydimension: smallint);
  79. procedure vt_alignment(handle, dx, dy: smallint);
  80. procedure vsp_film(handle, index, lightness: smallint);
  81. function vqp_filmname(handle, index: smallint; out name: shortstring): smallint;
  82. procedure vsc_expose(handle, state: smallint);
  83. procedure v_meta_extents(handle, min_x, min_y, max_x, max_y: smallint);
  84. procedure v_write_meta(handle, num_intin: smallint; a_intin: Pointer;
  85. num_ptsin: smallint;a_ptsin: Pointer);
  86. procedure vm_pagesize(handle, pgwidth, pgheight: smallint);
  87. procedure vm_coords(handle, llx, lly, urx, ury: smallint);
  88. function v_bez_qual(handle, prcnt: smallint; out actual: smallint): smallint;
  89. procedure vm_filename(handle: smallint; const filename: shortstring);
  90. procedure v_offset(handle, offset: smallint);
  91. procedure v_fontinit(handle: smallint; var fh: TFONT_HDR);
  92. procedure v_escape2000(handle, times: smallint);
  93. procedure v_pline(handle: smallint; count: smallint; pxyarray: psmallint);
  94. procedure v_pline(handle, count: smallint; const pxyarray: Array of smallint);
  95. procedure v_bez(handle, count: smallint; xyarr, bezarr: Pointer;
  96. out extent: ARRAY_4;
  97. out totpts, totmoves: smallint);
  98. procedure v_bez_fill(handle, count: smallint;
  99. xyarr, bezarr: Pointer;
  100. out extent: ARRAY_4;
  101. out totpts, totmoves: smallint);
  102. procedure v_pmarker(handle, count: smallint; const pxyarray: Array of smallint);
  103. procedure v_gtext(handle: smallint; x: smallint; y: smallint; outputstring: PAnsiChar);
  104. procedure v_gtext(handle, x, y: smallint; const outputstring: shortstring);
  105. procedure v_fillarea(handle, count: smallint; const pxyarray: Array of smallint);
  106. procedure v_bar(handle: smallint; pxyarray: psmallint);
  107. procedure v_bar(handle: smallint; const pxyarray: ARRAY_4);
  108. procedure v_arc(handle, x, y, radius, begang, endang: smallint);
  109. procedure v_pieslice(handle, x, y, radius, begang, endang: smallint);
  110. procedure v_circle(handle: smallint; x: smallint; y: smallint; radius: smallint);
  111. procedure v_ellipse(handle, x, y, xradius, yradius: smallint);
  112. procedure v_ellarc(handle, x, y, xradius, yradius, begang, endang: smallint);
  113. procedure v_ellpie(handle, x, y, xradius, yradius, begang, endang: smallint);
  114. procedure v_rbox(handle: smallint; const xyarray: ARRAY_4);
  115. procedure v_rfbox(handle: smallint; const xyarray: ARRAY_4);
  116. procedure v_justified(handle, x, y: smallint;
  117. const outputstring: shortstring;
  118. width, wordspace, charspace: smallint);
  119. function v_bez_on(handle: smallint): smallint;
  120. procedure v_bez_off(handle: smallint);
  121. procedure vst_height(handle, height: smallint; out char_width, char_height, cell_width, cell_height: smallint);
  122. function vst_rotation(handle, angle: smallint): smallint;
  123. procedure vs_color(handle: smallint; index: smallint; rgb_in: psmallint);
  124. procedure vs_color(handle, index: smallint; const rgb_in: ARRAY_3);
  125. function vsl_type(handle, style: smallint): smallint;
  126. function vsl_width(handle, width: smallint): smallint;
  127. function vsl_color(handle: smallint; color_index: smallint): smallint;
  128. function vsm_type(handle, symbol: smallint): smallint;
  129. function vsm_height(handle, height: smallint): smallint;
  130. function vsm_color(handle, color_index: smallint): smallint;
  131. function vst_font(handle, font: smallint): smallint;
  132. function vsf_interior(handle, style: smallint): smallint;
  133. function vsf_style(handle, style_index: smallint): smallint;
  134. function vq_color(handle, color_index, set_flag: smallint; out rgb: ARRAY_3): smallint;
  135. procedure vrq_locator(handle, x, y: smallint; out xout, yout, term: smallint);
  136. function vsm_locator(handle, x, y: smallint; out xout, yout, term: smallint): smallint;
  137. procedure vrq_valuator(handle, valuator_in: smallint; out valuator_out, terminator: smallint);
  138. procedure vsm_valuator(handle, val_in: smallint; out val_out, term, status: smallint);
  139. procedure vrq_choice(handle, ch_in: smallint; out ch_out: smallint);
  140. function vsm_choice(handle: smallint; out choice: smallint): smallint;
  141. procedure vrq_string(handle, max_length, echo_mode: smallint; const echo_xy: ARRAY_2; out resstring: shortstring);
  142. function vsm_string(handle, max_length, echo_mode: smallint; const echo_xy: ARRAY_2; out resstring: shortstring): smallint;
  143. function vst_color(handle: smallint; color_index: smallint): smallint;
  144. function vsf_color(handle: smallint; color_index: smallint): smallint;
  145. function vswr_mode(handle: smallint; mode: smallint): smallint;
  146. function vsin_mode(handle, dev_type, mode: smallint): smallint;
  147. procedure vql_attributes(handle: smallint; out attrib: ARRAY_4);
  148. procedure vql_attributes(handle: smallint; out attrib: ARRAY_6);
  149. procedure vqm_attributes(handle: smallint; out attrib: ARRAY_4);
  150. procedure vqf_attributes(handle: smallint; out attrib: ARRAY_5);
  151. procedure vqt_attributes(handle: smallint; out attrib: ARRAY_10);
  152. procedure vst_alignment(handle, hor_in, vert_in: smallint; out hor_out, vert_out: smallint);
  153. procedure v_opnvwk(work_in: psmallint; handle: psmallint; work_out: psmallint); overload;
  154. procedure v_clsvwk(handle: smallint); overload;
  155. procedure vq_extnd(handle, owflag: smallint; WorkOut: psmallint); overload;
  156. procedure vq_scrninfo(handle: smallint; out WorkOut: ARRAY_273);
  157. procedure v_contourfill(handle, x, y, index: smallint);
  158. function vsf_perimeter(handle, per_vis: smallint): smallint;
  159. procedure v_get_pixel(handle: smallint; x: smallint; y: smallint;
  160. pel: psmallint; index: psmallint);
  161. procedure v_get_pixel(handle, x, y: smallint; out pel, index: smallint);
  162. function vst_effects(handle, effect: smallint): smallint;
  163. function vst_point(handle, point: smallint; out char_width, char_height, cell_width, cell_height: smallint): smallint;
  164. procedure vsl_ends(handle, beg_style, end_style: smallint);
  165. procedure vro_cpyfm(handle: smallint; vr_mode: smallint; pxyarray: psmallint; psrcMFDB: PMFDB; pdesMFDB: PMFDB); overload;
  166. procedure vr_trnfm(handle: smallint; psrcMFDB, pdesMFDB: PMFDB);
  167. procedure vr_trnfm(handle: smallint; const psrcMFDB, pdesMFDB: TMFDB);
  168. procedure vsc_form(handle: smallint; pcur_form: PMFORM);
  169. procedure vsf_udpat(handle: smallint; pfill_pat: Pointer; planes: smallint);
  170. procedure vsl_udsty(handle, pattern: smallint);
  171. procedure vr_recfl(handle: smallint; const pxyarray: ARRAY_4);
  172. procedure vqin_mode(handle, dev_type: smallint; out input_mode: smallint);
  173. procedure vqt_extent(handle: smallint; calcshortstring: PAnsiChar; extent: psmallint); overload;
  174. function vqt_width(handle, character: smallint; out cell_width, left_delta, right_delta: smallint): smallint;
  175. procedure vex_timv(handle: smallint; tim_addr: Pointer; out otim_addr: Pointer; out tim_conv: smallint);
  176. function vst_load_fonts(handle, select: smallint): smallint;
  177. procedure vst_unload_fonts(handle, select: smallint);
  178. procedure vrt_cpyfm(handle: smallint; vr_mode: smallint; pxyarray: psmallint; psrcMFDB: PMFDB; pdesMFDB: PMFDB; color_index: psmallint); overload;
  179. procedure v_show_c(handle: smallint; reset: smallint);
  180. procedure v_hide_c(handle: smallint);
  181. procedure vq_mouse(handle: smallint; out pstatus, x, y: smallint);
  182. procedure vex_butv(handle: smallint; pusrcode: Pointer; out psavcode: Pointer);
  183. procedure vex_motv(handle: smallint; pusrcode: Pointer; out psavcode: Pointer);
  184. procedure vex_curv(handle: smallint; pusrcode: Pointer; out psavcode: Pointer);
  185. procedure vex_wheelv(handle: smallint; pusrcode: Pointer; out psavcode: Pointer);
  186. procedure vq_key_s(handle: smallint; out pstatus: smallint);
  187. procedure vs_clip(handle: smallint; clip_flag: smallint; pxyarray: psmallint);
  188. procedure vs_clip(handle, clip_flag: smallint; const pxyarray: ARRAY_4);
  189. procedure vs_clip_off(handle: smallint);
  190. function vqt_name(handle, element_num: smallint; out name: string33): smallint;
  191. procedure vqt_fontinfo(handle: smallint;
  192. out minADE, maxADE: smallint;
  193. out distances: ARRAY_5;
  194. out maxwidth: smallint;
  195. out effects: ARRAY_3);
  196. procedure vqt_justified(handle, x, y: smallint; const outstring: shortstring;
  197. length, word_space, char_space: smallint;
  198. offsets: Pointer);
  199. procedure vst_width(handle, width: smallint; out char_width, char_height, cell_width, cell_height: smallint);
  200. procedure vqt_fontheader(handle: smallint; buffer: Pointer;
  201. out pathname: shortstring);
  202. procedure vqt_trackkern(handle: smallint; out x, y: fix31);
  203. procedure vqt_pairkern(handle, ch1, ch2: smallint; out x, y: fix31);
  204. procedure vst_charmap(handle, mode: smallint);
  205. function vst_map_mode(handle, mode: smallint): smallint;
  206. procedure vst_kern(handle, tmode, pmode: smallint; out tracks, pairs: smallint);
  207. procedure vst_track_offset(handle: smallint; offset: fix31; pairmode: smallint; out tracks, pairs: smallint);
  208. procedure v_getbitmap_info(handle, ch: smallint;
  209. out advx, advy, xoff, yoff: fix31;
  210. out width, height: smallint;
  211. out bitmap: pointer);
  212. procedure v_ftext(handle, x, y: smallint; const str: shortstring);
  213. procedure v_ftext_offset(handle, x, y: smallint;
  214. const outputstring: shortstring;
  215. const offset: Array of smallint);
  216. procedure v_killoutline(handle: smallint; component: Pointer);
  217. procedure v_getoutline(handle, ch: smallint;
  218. const xyarray: Array of smallint;
  219. const bezarray: Array of ShortInt;
  220. maxverts: smallint;
  221. out numverts: smallint);
  222. procedure vst_scratch(handle, mode: smallint);
  223. procedure vst_error(handle, mode: smallint; out errorvar: smallint);
  224. function vst_arbpt(handle, point: smallint;
  225. out chwd, chht, cellwd, cellht: smallint): smallint;
  226. function vst_arbpt32(handle: smallint; point: fix31;
  227. out chwd, chht, cellwd, cellht: smallint): fix31;
  228. procedure vqt_advance(handle, ch: smallint; out advx, advy, remx, remy: smallint);
  229. procedure vqt_advance32(handle, ch: smallint; out advx, advy: fix31);
  230. function vq_devinfo(handle, devnum: smallint;
  231. out devexists: smallint;
  232. out filename: shortstring;
  233. out devicename: shortstring): smallint;
  234. procedure vqt_devinfo(handle, devnum: smallint;
  235. out dev_busy: smallint;
  236. out filename: shortstring;
  237. out devicename: shortstring);
  238. function v_savecache(handle: smallint; const filename: shortstring): smallint;
  239. function v_loadcache(handle: smallint; const filename: shortstring; mode: smallint): smallint;
  240. function v_flushcache(handle: smallint): smallint;
  241. function vst_setsize(handle, point: smallint;
  242. out chwd, chht, cellwd, cellht: smallint): smallint;
  243. function vst_setsize32(handle: smallint; point: fix31;
  244. out chwd, chht, cellwd, cellht: smallint): fix31;
  245. function vst_skew(handle, skew: smallint): smallint;
  246. procedure vqt_get_table(handle: smallint; out map: Pointer);
  247. procedure vqt_cachesize(handle, which_cache: smallint; out size: LongInt);
  248. procedure v_set_app_buff(handle: smallint; address: Pointer; nparagraphs: smallint);
  249. (*
  250. * NOT YET IMPLEMENTED:
  251. fix31_to_point(a) ((_WORD)((((a) + 32768L) >> 16)))
  252. point_to_fix31(a) (((fix31)(a)) << 16)
  253. v_trays
  254. v_ps_halftone
  255. vq_calibrate
  256. vq_page_name
  257. vq_tray_names
  258. vs_calibrate
  259. v_etext
  260. v_setrgbi
  261. v_xbit_image
  262. v_topbot
  263. vs_bkcolor
  264. v_pat_rotate
  265. vs_grayoverride
  266. v_opnbm
  267. v_clsbm
  268. v_get_driver_info
  269. vqt_real_extent
  270. vq_margins
  271. vq_driver_info
  272. vq_bit_image
  273. vs_page_info
  274. vs_crop
  275. vq_image_type
  276. vs_save_disp_list
  277. vs_load_disp_list
  278. vqt_xfntinfo
  279. vq_ext_devinfo
  280. vqt_ext_name
  281. vqt_name_and_id
  282. vst_name
  283. vqt_char_index
  284. vqt_is_char_available
  285. v_color2nearest
  286. v_color2value
  287. v_create_ctab
  288. v_create_itab
  289. v_ctab_idx2value
  290. v_ctab_idx2vdi
  291. v_ctab_vdi2idx
  292. v_delete_ctab
  293. v_delete_itab
  294. v_get_ctab_id
  295. v_get_outline
  296. v_open_bm
  297. v_resize_bm
  298. v_setrgb
  299. v_value2color
  300. vq_ctab
  301. vq_ctab_entry
  302. vq_ctab_id
  303. vq_dflt_ctab
  304. vq_hilite_color
  305. vq_margins
  306. vq_max_color
  307. vq_min_color
  308. vq_prn_scaling
  309. vq_px_format
  310. vq_weight_color
  311. vqf_bg_color
  312. vqf_fg_color
  313. vql_bg_color
  314. vql_fg_color
  315. vqm_bg_color
  316. vqm_fg_color
  317. vqr_bg_color
  318. vqr_fg_color
  319. vqt_bg_color
  320. vqt_fg_color
  321. vr_transfer_bits
  322. vs_ctab
  323. vs_ctab_entry
  324. vs_dflt_ctab
  325. vs_document_info
  326. vs_hilite_color
  327. vs_max_color
  328. vs_min_color
  329. vs_weight_color
  330. vsf_bg_color
  331. vsf_fg_color
  332. vsl_bg_color
  333. vsl_fg_color
  334. vsm_bg_color
  335. vsm_fg_color
  336. vsr_bg_color
  337. vsr_fg_color
  338. vst_bg_color
  339. vst_fg_color
  340. *)
  341. implementation
  342. const
  343. VDI_TRAP_MAGIC = $73;
  344. var
  345. _contrl: TVDIContrl;
  346. _intin: TVDIIntIn;
  347. _intout: TVDIIntOut;
  348. _ptsin: TVDIPtsIn;
  349. _ptsout: TVDIPtsOut;
  350. {$ifndef FPDOC}
  351. const
  352. pblock: TVDIPB = (
  353. control: @_contrl;
  354. intin: @_intin;
  355. ptsin: @_ptsin;
  356. intout: @_intout;
  357. ptsout: @_ptsout;
  358. ); public name 'vdipb';
  359. {$ENDIF}
  360. function string_to_vdi(const src: shortstring; dst: psmallint): smallint;
  361. var
  362. i, len: longint;
  363. begin
  364. len:=length(src);
  365. for i:=0 to len-1 do
  366. dst[i]:=byte(src[i + 1]);
  367. string_to_vdi:=len;
  368. end;
  369. procedure vdi_to_string(src: psmallint; out dst: shortstring; len: longint);
  370. var
  371. i: longint;
  372. begin
  373. for i:=0 to len-1 do
  374. dst[i + 1]:=chr(src[i]);
  375. setlength(dst, len);
  376. end;
  377. procedure vdi; assembler; nostackframe;
  378. asm
  379. pea.l (a2)
  380. lea.l pblock, a0
  381. move.l a0, d1
  382. move.w #VDI_TRAP_MAGIC, d0
  383. trap #2
  384. movea.l (a7)+,a2
  385. end;
  386. procedure vdi(pb: PVDIPB); assembler; nostackframe;
  387. asm
  388. pea.l (a2)
  389. move.l pb,a0
  390. move.l a0,d1
  391. move.w #VDI_TRAP_MAGIC,d0
  392. trap #2
  393. movea.l (a7)+,a2
  394. end;
  395. function vq_gdos: smallint; assembler; nostackframe;
  396. asm
  397. pea.l (a2)
  398. moveq.l #-2,d0
  399. trap #2
  400. addq #2,d0
  401. ext.l d0
  402. movea.l (a7)+,a2
  403. end;
  404. function vq_vgdos: LongInt; assembler; nostackframe;
  405. asm
  406. pea.l (a2)
  407. moveq.l #-2,d0
  408. trap #2
  409. movea.l (a7)+,a2
  410. end;
  411. procedure vdi_str_to_pchar(src: psmallint; des: PAnsiChar; len: smallint);
  412. begin
  413. while len > 0 do
  414. begin
  415. des[0]:=AnsiChar(src[0]); {* Only low byte *}
  416. inc(src);
  417. inc(des);
  418. dec(len);
  419. end;
  420. des[0]:=#0; {* End of shortstring *}
  421. end;
  422. function pchar_str_to_vdi(src: PAnsiChar; des: psmallint): longint;
  423. var
  424. len: longint;
  425. begin
  426. len:=0;
  427. repeat
  428. des[len]:=byte(src[len]);
  429. inc(len);
  430. until (src[len-1] = #0);
  431. pchar_str_to_vdi:=len-1;
  432. end;
  433. procedure v_opnwk(work_in: psmallint; handle: psmallint; work_out: psmallint);
  434. var pb: TVDIPB;
  435. begin
  436. pb.control := @_contrl;
  437. // _intin[0..15] = work_in[0..15];
  438. pb.intin := PVDIIntIn(work_in);
  439. pb.ptsin := @_ptsin;
  440. // work_out[0..44] = intout[0..44];
  441. pb.intout := PVDIIntOut(work_out);
  442. // work_out[45..56] = ptsout[0..11];
  443. pb.ptsout := PVDIPtsOut(@work_out[45]);
  444. _contrl[0]:=1;
  445. _contrl[1]:=0;
  446. _contrl[3]:=16;
  447. _contrl[5]:=0;
  448. _contrl[6]:=0;
  449. vdi(@pb);
  450. handle^:=_contrl[6];
  451. end;
  452. procedure v_clswk(handle: smallint);
  453. begin
  454. _contrl[0]:=2;
  455. _contrl[1]:=0;
  456. _contrl[3]:=0;
  457. _contrl[5]:=0;
  458. _contrl[6]:=handle;
  459. vdi;
  460. end;
  461. procedure v_clrwk(handle: smallint);
  462. begin
  463. _contrl[0]:=3;
  464. _contrl[1]:=0;
  465. _contrl[3]:=0;
  466. _contrl[6]:=handle;
  467. vdi;
  468. end;
  469. procedure v_updwk(handle: smallint);
  470. begin
  471. _contrl[0]:=4;
  472. _contrl[1]:=0;
  473. _contrl[3]:=0;
  474. _contrl[5]:=0;
  475. _contrl[6]:=handle;
  476. vdi;
  477. end;
  478. procedure vq_chcells(handle: smallint; out rows, columns: smallint);
  479. begin
  480. _contrl[0]:=5;
  481. _contrl[1]:=0;
  482. _contrl[3]:=0;
  483. _contrl[5]:=1;
  484. _contrl[6]:=handle;
  485. vdi;
  486. rows:=_intout[0];
  487. columns:=_intout[1];
  488. end;
  489. procedure v_exit_cur(handle: smallint);
  490. begin
  491. _contrl[0]:=5;
  492. _contrl[1]:=0;
  493. _contrl[3]:=0;
  494. _contrl[5]:=2;
  495. _contrl[6]:=handle;
  496. vdi;
  497. end;
  498. procedure v_enter_cur(handle: smallint);
  499. begin
  500. _contrl[0]:=5;
  501. _contrl[1]:=0;
  502. _contrl[3]:=0;
  503. _contrl[5]:=3;
  504. _contrl[6]:=handle;
  505. vdi;
  506. end;
  507. procedure v_curup(handle: smallint);
  508. begin
  509. _contrl[0]:=5;
  510. _contrl[1]:=0;
  511. _contrl[3]:=0;
  512. _contrl[5]:=4;
  513. _contrl[6]:=handle;
  514. vdi;
  515. end;
  516. procedure v_curdown(handle: smallint);
  517. begin
  518. _contrl[0]:=5;
  519. _contrl[1]:=0;
  520. _contrl[3]:=0;
  521. _contrl[5]:=5;
  522. _contrl[6]:=handle;
  523. vdi;
  524. end;
  525. procedure v_curright(handle: smallint);
  526. begin
  527. _contrl[0]:=5;
  528. _contrl[1]:=0;
  529. _contrl[3]:=0;
  530. _contrl[5]:=6;
  531. _contrl[6]:=handle;
  532. vdi;
  533. end;
  534. procedure v_curleft(handle: smallint);
  535. begin
  536. _contrl[0]:=5;
  537. _contrl[1]:=0;
  538. _contrl[3]:=0;
  539. _contrl[5]:=7;
  540. _contrl[6]:=handle;
  541. vdi;
  542. end;
  543. procedure v_curhome(handle: smallint);
  544. begin
  545. _contrl[0]:=5;
  546. _contrl[1]:=0;
  547. _contrl[3]:=0;
  548. _contrl[5]:=8;
  549. _contrl[6]:=handle;
  550. vdi;
  551. end;
  552. procedure v_eeos(handle: smallint);
  553. begin
  554. _contrl[0]:=5;
  555. _contrl[1]:=0;
  556. _contrl[3]:=0;
  557. _contrl[5]:=9;
  558. _contrl[6]:=handle;
  559. vdi;
  560. end;
  561. procedure v_eeol(handle: smallint);
  562. begin
  563. _contrl[0]:=5;
  564. _contrl[1]:=0;
  565. _contrl[3]:=0;
  566. _contrl[5]:=10;
  567. _contrl[6]:=handle;
  568. vdi;
  569. end;
  570. procedure v_curaddress(handle, row, column: smallint);
  571. begin
  572. _intin[0]:=row;
  573. _intin[1]:=column;
  574. _contrl[0]:=5;
  575. _contrl[1]:=0;
  576. _contrl[3]:=2;
  577. _contrl[5]:=11;
  578. _contrl[6]:=handle;
  579. vdi;
  580. end;
  581. procedure v_curtext(handle: smallint; const outstring: shortstring);
  582. var len: longint;
  583. begin
  584. len:=string_to_vdi(outstring, @_intin[0]);
  585. _contrl[0]:=5;
  586. _contrl[1]:=0;
  587. _contrl[3]:=len;
  588. _contrl[5]:=12;
  589. _contrl[6]:=handle;
  590. vdi;
  591. end;
  592. procedure v_rvon(handle: smallint);
  593. begin
  594. _contrl[0]:=5;
  595. _contrl[1]:=0;
  596. _contrl[3]:=0;
  597. _contrl[5]:=13;
  598. _contrl[6]:=handle;
  599. vdi;
  600. end;
  601. procedure v_rvoff(handle: smallint);
  602. begin
  603. _contrl[0]:=5;
  604. _contrl[1]:=0;
  605. _contrl[3]:=0;
  606. _contrl[5]:=14;
  607. _contrl[6]:=handle;
  608. vdi;
  609. end;
  610. procedure vq_curaddress(handle: smallint; out row, column: smallint);
  611. begin
  612. _contrl[0]:=5;
  613. _contrl[1]:=0;
  614. _contrl[3]:=0;
  615. _contrl[5]:=15;
  616. _contrl[6]:=handle;
  617. vdi;
  618. row:=_intout[0];
  619. column:=_intout[1];
  620. end;
  621. function vq_tabstatus(handle: smallint): smallint;
  622. begin
  623. _contrl[0]:=5;
  624. _contrl[1]:=0;
  625. _contrl[3]:=0;
  626. _contrl[5]:=16;
  627. _contrl[6]:=handle;
  628. vdi;
  629. vq_tabstatus:=_intout[0];
  630. end;
  631. procedure v_hardcopy(handle: smallint);
  632. begin
  633. _contrl[0]:=5;
  634. _contrl[1]:=0;
  635. _contrl[3]:=0;
  636. _contrl[5]:=17;
  637. _contrl[6]:=handle;
  638. vdi;
  639. end;
  640. procedure v_dspcur(handle, x, y: smallint);
  641. begin
  642. _ptsin[0]:=x;
  643. _ptsin[1]:=y;
  644. _contrl[0]:=5;
  645. _contrl[1]:=1;
  646. _contrl[3]:=0;
  647. _contrl[5]:=18;
  648. _contrl[6]:=handle;
  649. vdi;
  650. end;
  651. procedure v_rmcur(handle: smallint);
  652. begin
  653. _contrl[0]:=5;
  654. _contrl[1]:=0;
  655. _contrl[3]:=0;
  656. _contrl[5]:=19;
  657. _contrl[6]:=handle;
  658. vdi;
  659. end;
  660. procedure v_form_adv(handle: smallint);
  661. begin
  662. _contrl[0]:=5;
  663. _contrl[1]:=0;
  664. _contrl[3]:=0;
  665. _contrl[5]:=20;
  666. _contrl[6]:=handle;
  667. vdi;
  668. end;
  669. procedure v_output_window(handle: smallint; xyarray: ARRAY_4);
  670. begin
  671. _ptsin[0]:=xyarray[0];
  672. _ptsin[1]:=xyarray[1];
  673. _ptsin[2]:=xyarray[2];
  674. _ptsin[3]:=xyarray[3];
  675. _contrl[0]:=5;
  676. _contrl[1]:=2;
  677. _contrl[3]:=0;
  678. _contrl[5]:=21;
  679. _contrl[6]:=handle;
  680. vdi;
  681. end;
  682. procedure v_clear_disp_list(handle: smallint);
  683. begin
  684. _contrl[0]:=5;
  685. _contrl[1]:=0;
  686. _contrl[3]:=0;
  687. _contrl[5]:=22;
  688. _contrl[6]:=handle;
  689. vdi;
  690. end;
  691. procedure v_bit_image(handle: smallint; const filename: shortstring;
  692. aspect, x_scale, y_scale, h_align, v_align: smallint;
  693. const xyarray: ARRAY_4);
  694. var len: longint;
  695. begin
  696. _ptsin[0]:=xyarray[0];
  697. _ptsin[1]:=xyarray[1];
  698. _ptsin[2]:=xyarray[2];
  699. _ptsin[3]:=xyarray[3];
  700. _intin[0]:=aspect;
  701. _intin[1]:=x_scale;
  702. _intin[2]:=y_scale;
  703. _intin[3]:=h_align;
  704. _intin[4]:=v_align;
  705. len:=string_to_vdi(filename, @_intin[5]);
  706. _contrl[0]:=5;
  707. _contrl[1]:=2;
  708. _contrl[3]:=len+5;
  709. _contrl[5]:=23;
  710. _contrl[6]:=handle;
  711. vdi;
  712. end;
  713. procedure vq_scan(handle: smallint; out g_slice, g_page, a_slice, a_page, div_fac: smallint);
  714. begin
  715. _contrl[0]:=5;
  716. _contrl[1]:=0;
  717. _contrl[3]:=0;
  718. _contrl[5]:=24;
  719. _contrl[6]:=handle;
  720. vdi;
  721. g_slice:=_intout[0];
  722. g_page:=_intout[1];
  723. a_slice:=_intout[2];
  724. a_page:=_intout[3];
  725. div_fac:=_intout[4];
  726. end;
  727. procedure v_alpha_text(handle: smallint; const outstring: shortstring);
  728. var len: longint;
  729. begin
  730. len:=string_to_vdi(outstring, @_intin[0]);
  731. _contrl[0]:=5;
  732. _contrl[1]:=0;
  733. _contrl[3]:=len;
  734. _contrl[5]:=25;
  735. _contrl[6]:=handle;
  736. vdi;
  737. end;
  738. function v_orient(handle, orientation: smallint): smallint;
  739. begin
  740. _intin[0]:=orientation;
  741. _contrl[0]:=5;
  742. _contrl[1]:=0;
  743. _contrl[3]:=1;
  744. _contrl[4]:=0;
  745. _contrl[5]:=27;
  746. _contrl[6]:=handle;
  747. vdi;
  748. if _contrl[4]<>0 then
  749. v_orient:=_intout[0]
  750. else
  751. v_orient:=0;
  752. end;
  753. function v_copies(handle, count: smallint): smallint;
  754. begin
  755. _intin[0]:=count;
  756. _contrl[0]:=5;
  757. _contrl[1]:=0;
  758. _contrl[3]:=1;
  759. _contrl[4]:=0;
  760. _contrl[5]:=28;
  761. _contrl[6]:=handle;
  762. vdi;
  763. if _contrl[4]<>0 then
  764. v_copies:=_intout[0]
  765. else
  766. v_copies:=0;
  767. end;
  768. procedure v_tray(handle, tray: smallint);
  769. begin
  770. _intin[0]:=tray;
  771. _contrl[0]:=5;
  772. _contrl[1]:=0;
  773. _contrl[3]:=1;
  774. _contrl[5]:=29;
  775. _contrl[6]:=handle;
  776. vdi;
  777. end;
  778. function v_page_size(handle, page_id: smallint): smallint;
  779. begin
  780. _intin[0]:=page_id;
  781. _contrl[0]:=5;
  782. _contrl[1]:=0;
  783. _contrl[3]:=1;
  784. _contrl[4]:=0;
  785. _contrl[5]:=37;
  786. _contrl[6]:=handle;
  787. vdi;
  788. if _contrl[4]<>0 then
  789. v_page_size:=_intout[0]
  790. else
  791. v_page_size:=0;
  792. end;
  793. function vs_palette(handle, palette: smallint): smallint;
  794. begin
  795. _intin[0]:=palette;
  796. _contrl[0]:=5;
  797. _contrl[1]:=0;
  798. _contrl[3]:=1;
  799. _contrl[5]:=60;
  800. _contrl[6]:=handle;
  801. vdi;
  802. vs_palette:=_intout[0];
  803. end;
  804. procedure v_sound(handle, frequency, duration: smallint);
  805. begin
  806. _intin[0]:=frequency;
  807. _intin[1]:=duration;
  808. _contrl[0]:=5;
  809. _contrl[1]:=0;
  810. _contrl[3]:=2;
  811. _contrl[5]:=61;
  812. _contrl[6]:=handle;
  813. vdi;
  814. end;
  815. function vs_mute(handle, action: smallint): smallint;
  816. begin
  817. _intin[0]:=action;
  818. _contrl[0]:=5;
  819. _contrl[1]:=0;
  820. _contrl[3]:=1;
  821. _contrl[5]:=62;
  822. _contrl[6]:=handle;
  823. vdi;
  824. vs_mute:=_intout[0];
  825. end;
  826. procedure vt_resolution(handle, xres, yres: smallint;
  827. out xset, yset: smallint);
  828. begin
  829. _intin[0]:=xres;
  830. _intin[1]:=yres;
  831. _contrl[0]:=5;
  832. _contrl[1]:=0;
  833. _contrl[3]:=2;
  834. _contrl[5]:=81;
  835. _contrl[6]:=handle;
  836. vdi;
  837. xset:=_intout[0];
  838. yset:=_intout[1];
  839. end;
  840. procedure vt_axis(handle, xres, yres: smallint;
  841. out xset, yset: smallint);
  842. begin
  843. _intin[0]:=xres;
  844. _intin[1]:=yres;
  845. _contrl[0]:=5;
  846. _contrl[1]:=0;
  847. _contrl[3]:=2;
  848. _contrl[5]:=82;
  849. _contrl[6]:=handle;
  850. vdi;
  851. xset:=_intout[0];
  852. yset:=_intout[1];
  853. end;
  854. procedure vt_origin(handle, xorigin, yorigin: smallint);
  855. begin
  856. _intin[0]:=xorigin;
  857. _intin[1]:=yorigin;
  858. _contrl[0]:=5;
  859. _contrl[1]:=0;
  860. _contrl[3]:=2;
  861. _contrl[5]:=83;
  862. _contrl[6]:=handle;
  863. vdi;
  864. end;
  865. procedure vq_tdimensions(handle: smallint; out xdimension, ydimension: smallint);
  866. begin
  867. _contrl[0]:=5;
  868. _contrl[1]:=0;
  869. _contrl[3]:=0;
  870. _contrl[5]:=84;
  871. _contrl[6]:=handle;
  872. vdi;
  873. xdimension:=_intout[0];
  874. ydimension:=_intout[1];
  875. end;
  876. procedure vt_alignment(handle, dx, dy: smallint);
  877. begin
  878. _intin[0]:=dx;
  879. _intin[1]:=dy;
  880. _contrl[0]:=5;
  881. _contrl[1]:=0;
  882. _contrl[3]:=2;
  883. _contrl[5]:=85;
  884. _contrl[6]:=handle;
  885. vdi;
  886. end;
  887. procedure vsp_film(handle, index, lightness: smallint);
  888. begin
  889. _intin[0]:=index;
  890. _intin[1]:=lightness;
  891. _contrl[0]:=5;
  892. _contrl[1]:=0;
  893. _contrl[3]:=2;
  894. _contrl[5]:=91;
  895. _contrl[6]:=handle;
  896. vdi;
  897. end;
  898. function vqp_filmname(handle, index: smallint; out name: shortstring): smallint;
  899. begin
  900. _intin[0]:=index;
  901. _contrl[0]:=5;
  902. _contrl[1]:=0;
  903. _contrl[3]:=1;
  904. _contrl[5]:=92;
  905. _contrl[6]:=handle;
  906. vdi;
  907. vdi_to_string(@_intout[0], name, _contrl[4]);
  908. vqp_filmname:=_contrl[4];
  909. end;
  910. procedure vsc_expose(handle, state: smallint);
  911. begin
  912. _intin[0]:=state;
  913. _contrl[0]:=5;
  914. _contrl[1]:=0;
  915. _contrl[3]:=1;
  916. _contrl[5]:=93;
  917. _contrl[6]:=handle;
  918. vdi;
  919. end;
  920. procedure v_meta_extents(handle, min_x, min_y, max_x, max_y: smallint);
  921. begin
  922. _ptsin[0]:=min_x;
  923. _ptsin[1]:=min_y;
  924. _ptsin[2]:=max_x;
  925. _ptsin[3]:=max_y;
  926. _contrl[0]:=5;
  927. _contrl[1]:=2;
  928. _contrl[3]:=0;
  929. _contrl[5]:=98;
  930. _contrl[6]:=handle;
  931. vdi;
  932. end;
  933. procedure v_write_meta(handle, num_intin: smallint; a_intin: Pointer;
  934. num_ptsin: smallint;a_ptsin: Pointer);
  935. var pb: TVDIPB;
  936. begin
  937. pb.control := @_contrl;
  938. pb.intin := PVDIIntIn(a_intin);
  939. pb.ptsin := PVDIPtsIn(a_ptsin);
  940. pb.intout := @_intout;
  941. pb.ptsout := @_ptsout;
  942. _contrl[0]:=5;
  943. _contrl[1]:=num_ptsin;
  944. _contrl[3]:=num_intin;
  945. _contrl[5]:=99;
  946. _contrl[6]:=handle;
  947. vdi(@pb);
  948. end;
  949. procedure vm_pagesize(handle, pgwidth, pgheight: smallint);
  950. begin
  951. _intin[0]:=0;
  952. _intin[1]:=pgwidth;
  953. _intin[2]:=pgheight;
  954. _contrl[0]:=5;
  955. _contrl[1]:=0;
  956. _contrl[3]:=3;
  957. _contrl[5]:=99;
  958. _contrl[6]:=handle;
  959. vdi;
  960. end;
  961. procedure vm_coords(handle, llx, lly, urx, ury: smallint);
  962. begin
  963. _intin[0]:=1;
  964. _intin[1]:=llx;
  965. _intin[2]:=lly;
  966. _intin[3]:=urx;
  967. _intin[4]:=ury;
  968. _contrl[0]:=5;
  969. _contrl[1]:=0;
  970. _contrl[3]:=5;
  971. _contrl[5]:=99;
  972. _contrl[6]:=handle;
  973. vdi;
  974. end;
  975. function v_bez_qual(handle, prcnt: smallint; out actual: smallint): smallint;
  976. begin
  977. _intin[0]:=32;
  978. _intin[1]:=1;
  979. _intin[2]:=prcnt;
  980. _contrl[0]:=5;
  981. _contrl[1]:=0;
  982. _contrl[3]:=3;
  983. _contrl[5]:=99;
  984. _contrl[6]:=handle;
  985. vdi;
  986. actual:=_intout[0];
  987. v_bez_qual:=_intout[0];
  988. end;
  989. procedure vm_filename(handle: smallint; const filename: shortstring);
  990. var len: longint;
  991. begin
  992. len:=string_to_vdi(filename, @_intin[0]);
  993. _contrl[0]:=5;
  994. _contrl[1]:=0;
  995. _contrl[3]:=len;
  996. _contrl[5]:=100;
  997. _contrl[6]:=handle;
  998. vdi;
  999. end;
  1000. procedure v_offset(handle, offset: smallint);
  1001. begin
  1002. _intin[0]:=offset;
  1003. _contrl[0]:=5;
  1004. _contrl[1]:=0;
  1005. _contrl[3]:=1;
  1006. _contrl[5]:=101;
  1007. _contrl[6]:=handle;
  1008. vdi;
  1009. end;
  1010. procedure v_fontinit(handle: smallint; var fh: TFONT_HDR);
  1011. begin
  1012. PPointer(@_intin[0])^:=@fh;
  1013. _contrl[0]:=5;
  1014. _contrl[1]:=0;
  1015. _contrl[3]:=2;
  1016. _contrl[5]:=102;
  1017. _contrl[6]:=handle;
  1018. vdi;
  1019. end;
  1020. procedure v_escape2000(handle, times: smallint);
  1021. begin
  1022. _intin[0]:=times;
  1023. _contrl[0]:=5;
  1024. _contrl[1]:=0;
  1025. _contrl[3]:=1;
  1026. _contrl[5]:=2000;
  1027. _contrl[6]:=handle;
  1028. vdi;
  1029. end;
  1030. procedure v_pline(handle: smallint; count: smallint; pxyarray: psmallint);
  1031. var pb: TVDIPB;
  1032. begin
  1033. pb.control := @_contrl;
  1034. pb.intin := @_intin;
  1035. // _ptsin[0..2*count-1] = pxyarray[0..2*count-1];
  1036. pb.ptsin := PVDIPtsIn(pxyarray);
  1037. pb.intout := @_intout;
  1038. pb.ptsout := @_ptsout;
  1039. _contrl[0]:=6;
  1040. _contrl[1]:=count;
  1041. _contrl[3]:=0;
  1042. _contrl[5]:=0;
  1043. _contrl[6]:=handle;
  1044. vdi(@pb);
  1045. end;
  1046. procedure v_pline(handle, count: smallint; const pxyarray: Array of smallint);
  1047. var pb: TVDIPB;
  1048. begin
  1049. pb.control := @_contrl;
  1050. pb.intin := @_intin;
  1051. // _ptsin[0..2*count-1] = pxyarray[0..2*count-1];
  1052. pb.ptsin := @pxyarray;
  1053. pb.intout := @_intout;
  1054. pb.ptsout := @_ptsout;
  1055. _contrl[0]:=6;
  1056. _contrl[1]:=count;
  1057. _contrl[3]:=0;
  1058. _contrl[5]:=0;
  1059. _contrl[6]:=handle;
  1060. vdi(@pb);
  1061. end;
  1062. procedure v_bez(handle, count: smallint; xyarr, bezarr: Pointer;
  1063. out extent: ARRAY_4;
  1064. out totpts, totmoves: smallint);
  1065. var pb: TVDIPB;
  1066. begin
  1067. pb.control := @_contrl;
  1068. pb.intin := PVDIIntIn(bezarr);
  1069. // _ptsin[0..2*count-1] = pxyarray[0..2*count-1];
  1070. pb.ptsin := PVDIPtsIn(xyarr);
  1071. pb.intout := @_intout;
  1072. pb.ptsout := @_ptsout;
  1073. _contrl[0]:=6;
  1074. _contrl[1]:=count;
  1075. _contrl[3]:=(count + 1) shr 1;
  1076. _contrl[5]:=13;
  1077. _contrl[6]:=handle;
  1078. vdi(@pb);
  1079. totpts:=_intout[0];
  1080. totmoves:=_intout[1];
  1081. extent[0]:=_ptsout[0];
  1082. extent[1]:=_ptsout[1];
  1083. extent[2]:=_ptsout[2];
  1084. extent[3]:=_ptsout[3];
  1085. end;
  1086. procedure v_pmarker(handle, count: smallint; const pxyarray: Array of smallint);
  1087. var pb: TVDIPB;
  1088. begin
  1089. pb.control := @_contrl;
  1090. pb.intin := @_intin;
  1091. // _ptsin[0..2*count-1] = pxyarray[0..2*count-1];
  1092. pb.ptsin := @pxyarray;
  1093. pb.intout := @_intout;
  1094. pb.ptsout := @_ptsout;
  1095. _contrl[0]:=7;
  1096. _contrl[1]:=count;
  1097. _contrl[3]:=0;
  1098. _contrl[5]:=0;
  1099. _contrl[6]:=handle;
  1100. vdi(@pb);
  1101. end;
  1102. procedure v_gtext(handle: smallint; x: smallint; y: smallint; outputstring: PAnsiChar);
  1103. var len: smallint;
  1104. begin
  1105. _ptsin[0]:=x;
  1106. _ptsin[1]:=y;
  1107. len:=pchar_str_to_vdi(outputstring, @_intin[0]);
  1108. _contrl[0]:=8;
  1109. _contrl[1]:=1;
  1110. _contrl[3]:=len;
  1111. _contrl[5]:=0;
  1112. _contrl[6]:=handle;
  1113. vdi;
  1114. end;
  1115. procedure v_gtext(handle, x, y: smallint; const outputstring: shortstring);
  1116. var len: smallint;
  1117. begin
  1118. _ptsin[0]:=x;
  1119. _ptsin[1]:=y;
  1120. len:=string_to_vdi(outputstring, @_intin[0]);
  1121. _contrl[0]:=8;
  1122. _contrl[1]:=1;
  1123. _contrl[3]:=len;
  1124. _contrl[5]:=0;
  1125. _contrl[6]:=handle;
  1126. vdi;
  1127. end;
  1128. procedure v_fillarea(handle, count: smallint; const pxyarray: Array of smallint);
  1129. var pb: TVDIPB;
  1130. begin
  1131. pb.control := @_contrl;
  1132. pb.intin := @_intin;
  1133. // _ptsin[0..2*count-1] = pxyarray[0..2*count-1];
  1134. pb.ptsin := @pxyarray;
  1135. pb.intout := @_intout;
  1136. pb.ptsout := @_ptsout;
  1137. _contrl[0]:=9;
  1138. _contrl[1]:=count;
  1139. _contrl[3]:=0;
  1140. _contrl[5]:=0;
  1141. _contrl[6]:=handle;
  1142. vdi(@pb);
  1143. end;
  1144. procedure v_bez_fill(handle, count: smallint;
  1145. xyarr, bezarr: Pointer;
  1146. out extent: ARRAY_4;
  1147. out totpts, totmoves: smallint);
  1148. var pb: TVDIPB;
  1149. begin
  1150. pb.control := @_contrl;
  1151. pb.intin := PVDIIntIn(bezarr);
  1152. // _ptsin[0..2*count-1] = pxyarray[0..2*count-1];
  1153. pb.ptsin := PVDIPtsIn(xyarr);
  1154. pb.intout := @_intout;
  1155. pb.ptsout := @_ptsout;
  1156. _contrl[0]:=9;
  1157. _contrl[1]:=count;
  1158. _contrl[3]:=(count + 1) shr 1;
  1159. _contrl[5]:=13;
  1160. _contrl[6]:=handle;
  1161. vdi(@pb);
  1162. totpts:=_intout[0];
  1163. totmoves:=_intout[1];
  1164. extent[0]:=_ptsout[0];
  1165. extent[1]:=_ptsout[1];
  1166. extent[2]:=_ptsout[2];
  1167. extent[3]:=_ptsout[3];
  1168. end;
  1169. procedure v_bar(handle: smallint; pxyarray: psmallint);
  1170. begin
  1171. // _ptsin[0..3] = pxyarray[0..3];
  1172. _ptsin[0]:=pxyarray[0];
  1173. _ptsin[1]:=pxyarray[1];
  1174. _ptsin[2]:=pxyarray[2];
  1175. _ptsin[3]:=pxyarray[3];
  1176. _contrl[0]:=11;
  1177. _contrl[1]:=2;
  1178. _contrl[3]:=0;
  1179. _contrl[5]:=1;
  1180. _contrl[6]:=handle;
  1181. vdi;
  1182. end;
  1183. procedure v_bar(handle: smallint; const pxyarray: ARRAY_4);
  1184. begin
  1185. // _ptsin[0..3] = pxyarray[0..3];
  1186. _ptsin[0]:=pxyarray[0];
  1187. _ptsin[1]:=pxyarray[1];
  1188. _ptsin[2]:=pxyarray[2];
  1189. _ptsin[3]:=pxyarray[3];
  1190. _contrl[0]:=11;
  1191. _contrl[1]:=2;
  1192. _contrl[3]:=0;
  1193. _contrl[5]:=1;
  1194. _contrl[6]:=handle;
  1195. vdi;
  1196. end;
  1197. procedure v_arc(handle, x, y, radius, begang, endang: smallint);
  1198. begin
  1199. _intin[0]:=begang;
  1200. _intin[1]:=endang;
  1201. _ptsin[0]:=x;
  1202. _ptsin[1]:=y;
  1203. _ptsin[2]:=0;
  1204. _ptsin[3]:=0;
  1205. _ptsin[4]:=0;
  1206. _ptsin[5]:=0;
  1207. _ptsin[6]:=radius;
  1208. _ptsin[7]:=0;
  1209. _contrl[0]:=11;
  1210. _contrl[1]:=4;
  1211. _contrl[3]:=2;
  1212. _contrl[5]:=2;
  1213. _contrl[6]:=handle;
  1214. vdi;
  1215. end;
  1216. procedure v_pieslice(handle, x, y, radius, begang, endang: smallint);
  1217. begin
  1218. _intin[0]:=begang;
  1219. _intin[1]:=endang;
  1220. _ptsin[0]:=x;
  1221. _ptsin[1]:=y;
  1222. _ptsin[2]:=0;
  1223. _ptsin[3]:=0;
  1224. _ptsin[4]:=0;
  1225. _ptsin[5]:=0;
  1226. _ptsin[6]:=radius;
  1227. _ptsin[7]:=0;
  1228. _contrl[0]:=11;
  1229. _contrl[1]:=4;
  1230. _contrl[3]:=2;
  1231. _contrl[5]:=3;
  1232. _contrl[6]:=handle;
  1233. vdi;
  1234. end;
  1235. procedure v_circle (handle: smallint; x: smallint; y: smallint; radius: smallint);
  1236. begin
  1237. _ptsin[0]:=x;
  1238. _ptsin[1]:=y;
  1239. _ptsin[2]:=0;
  1240. _ptsin[3]:=0;
  1241. _ptsin[4]:=radius;
  1242. _ptsin[5]:=0;
  1243. _contrl[0]:=11;
  1244. _contrl[1]:=3;
  1245. _contrl[3]:=0;
  1246. _contrl[5]:=4;
  1247. _contrl[6]:=handle;
  1248. vdi;
  1249. end;
  1250. procedure v_ellipse(handle, x, y, xradius, yradius: smallint);
  1251. begin
  1252. _ptsin[0]:=x;
  1253. _ptsin[1]:=y;
  1254. _ptsin[2]:=xradius;
  1255. _ptsin[3]:=yradius;
  1256. _contrl[0]:=11;
  1257. _contrl[1]:=2;
  1258. _contrl[3]:=0;
  1259. _contrl[5]:=5;
  1260. _contrl[6]:=handle;
  1261. vdi;
  1262. end;
  1263. procedure v_ellarc(handle, x, y, xradius, yradius, begang, endang: smallint);
  1264. begin
  1265. _intin[0]:=begang;
  1266. _intin[1]:=endang;
  1267. _ptsin[0]:=x;
  1268. _ptsin[1]:=y;
  1269. _ptsin[2]:=xradius;
  1270. _ptsin[3]:=yradius;
  1271. _contrl[0]:=11;
  1272. _contrl[1]:=2;
  1273. _contrl[3]:=2;
  1274. _contrl[5]:=6;
  1275. _contrl[6]:=handle;
  1276. vdi;
  1277. end;
  1278. procedure v_ellpie(handle, x, y, xradius, yradius, begang, endang: smallint);
  1279. begin
  1280. _intin[0]:=begang;
  1281. _intin[1]:=endang;
  1282. _ptsin[0]:=x;
  1283. _ptsin[1]:=y;
  1284. _ptsin[2]:=xradius;
  1285. _ptsin[3]:=yradius;
  1286. _contrl[0]:=11;
  1287. _contrl[1]:=2;
  1288. _contrl[3]:=2;
  1289. _contrl[5]:=7;
  1290. _contrl[6]:=handle;
  1291. vdi;
  1292. end;
  1293. procedure v_rbox(handle: smallint; const xyarray: ARRAY_4);
  1294. begin
  1295. _ptsin[0]:=xyarray[0];
  1296. _ptsin[1]:=xyarray[1];
  1297. _ptsin[2]:=xyarray[2];
  1298. _ptsin[3]:=xyarray[3];
  1299. _contrl[0]:=11;
  1300. _contrl[1]:=2;
  1301. _contrl[3]:=0;
  1302. _contrl[5]:=8;
  1303. _contrl[6]:=handle;
  1304. vdi;
  1305. end;
  1306. procedure v_rfbox(handle: smallint; const xyarray: ARRAY_4);
  1307. begin
  1308. _ptsin[0]:=xyarray[0];
  1309. _ptsin[1]:=xyarray[1];
  1310. _ptsin[2]:=xyarray[2];
  1311. _ptsin[3]:=xyarray[3];
  1312. _contrl[0]:=11;
  1313. _contrl[1]:=2;
  1314. _contrl[3]:=0;
  1315. _contrl[5]:=9;
  1316. _contrl[6]:=handle;
  1317. vdi;
  1318. end;
  1319. procedure v_justified(handle, x, y: smallint;
  1320. const outputstring: shortstring;
  1321. width, wordspace, charspace: smallint);
  1322. var len: smallint;
  1323. begin
  1324. {* TODO: handle char_space $8000/$8001 (returns interspace information) *}
  1325. _intin[0]:=wordspace;
  1326. _intin[1]:=charspace;
  1327. _ptsin[0]:=x;
  1328. _ptsin[1]:=y;
  1329. _ptsin[2]:=width;
  1330. _ptsin[3]:=0;
  1331. len:=string_to_vdi(outputstring, @_intin[2]);
  1332. _contrl[0]:=11;
  1333. _contrl[1]:=2;
  1334. _contrl[3]:=len+2;
  1335. _contrl[4]:=0;
  1336. _contrl[5]:=11;
  1337. _contrl[6]:=handle;
  1338. vdi;
  1339. end;
  1340. function v_bez_on(handle: smallint): smallint;
  1341. begin
  1342. _contrl[0]:=11;
  1343. _contrl[1]:=1;
  1344. _contrl[3]:=0;
  1345. _contrl[5]:=13;
  1346. _contrl[6]:=handle;
  1347. _intout[0]:=0;
  1348. vdi;
  1349. v_bez_on:=_intout[0];
  1350. end;
  1351. procedure v_bez_off(handle: smallint);
  1352. begin
  1353. _contrl[0]:=11;
  1354. _contrl[1]:=0;
  1355. _contrl[3]:=0;
  1356. _contrl[5]:=13;
  1357. _contrl[6]:=handle;
  1358. vdi;
  1359. end;
  1360. procedure vst_height(handle, height: smallint; out char_width, char_height, cell_width, cell_height: smallint);
  1361. begin
  1362. _ptsin[0]:=0;
  1363. _ptsin[1]:=height;
  1364. _contrl[0]:=12;
  1365. _contrl[1]:=1;
  1366. _contrl[3]:=0;
  1367. _contrl[5]:=0;
  1368. _contrl[6]:=handle;
  1369. vdi;
  1370. char_width:=_ptsout[0];
  1371. char_height:=_ptsout[1];
  1372. cell_width:=_ptsout[2];
  1373. cell_height:=_ptsout[3];
  1374. end;
  1375. function vst_rotation(handle, angle: smallint): smallint;
  1376. begin
  1377. _intin[0]:=angle;
  1378. _contrl[0]:=13;
  1379. _contrl[1]:=0;
  1380. _contrl[3]:=1;
  1381. _contrl[5]:=0;
  1382. _contrl[6]:=handle;
  1383. vdi;
  1384. vst_rotation:=_intout[0];
  1385. end;
  1386. procedure vs_color(handle: smallint; index: smallint; rgb_in: psmallint);
  1387. begin
  1388. _intin[0]:=index;
  1389. _intin[1]:=rgb_in[0];
  1390. _intin[2]:=rgb_in[1];
  1391. _intin[3]:=rgb_in[2];
  1392. _contrl[0]:=14;
  1393. _contrl[1]:=0;
  1394. _contrl[3]:=4;
  1395. _contrl[5]:=0;
  1396. _contrl[6]:=handle;
  1397. vdi;
  1398. end;
  1399. procedure vs_color(handle, index: smallint; const rgb_in: ARRAY_3);
  1400. begin
  1401. _intin[0]:=index;
  1402. _intin[1]:=rgb_in[0];
  1403. _intin[2]:=rgb_in[1];
  1404. _intin[3]:=rgb_in[2];
  1405. _contrl[0]:=14;
  1406. _contrl[1]:=0;
  1407. _contrl[3]:=4;
  1408. _contrl[5]:=0;
  1409. _contrl[6]:=handle;
  1410. vdi;
  1411. end;
  1412. function vsl_type(handle, style: smallint): smallint;
  1413. begin
  1414. _intin[0]:=style;
  1415. _contrl[0]:=15;
  1416. _contrl[1]:=0;
  1417. _contrl[3]:=1;
  1418. _contrl[5]:=0;
  1419. _contrl[6]:=handle;
  1420. vdi;
  1421. vsl_type:=_intout[0];
  1422. end;
  1423. function vsl_width(handle, width: smallint): smallint;
  1424. begin
  1425. _ptsin[0]:=width;
  1426. _ptsin[1]:=0;
  1427. _contrl[0]:=16;
  1428. _contrl[1]:=1;
  1429. _contrl[3]:=0;
  1430. _contrl[5]:=0;
  1431. _contrl[6]:=handle;
  1432. vdi;
  1433. vsl_width:=_ptsout[0];
  1434. end;
  1435. function vsl_color(handle: smallint; color_index: smallint): smallint;
  1436. begin
  1437. _intin[0]:=color_index;
  1438. _contrl[0]:=17;
  1439. _contrl[1]:=0;
  1440. _contrl[3]:=1;
  1441. _contrl[5]:=0;
  1442. _contrl[6]:=handle;
  1443. vdi;
  1444. vsl_color:=_intout[0];
  1445. end;
  1446. function vsm_type(handle, symbol: smallint): smallint;
  1447. begin
  1448. _intin[0]:=symbol;
  1449. _contrl[0]:=18;
  1450. _contrl[1]:=0;
  1451. _contrl[3]:=1;
  1452. _contrl[5]:=0;
  1453. _contrl[6]:=handle;
  1454. vdi;
  1455. vsm_type:=_intout[0];
  1456. end;
  1457. function vsm_height(handle, height: smallint): smallint;
  1458. begin
  1459. _ptsin[0]:=0;
  1460. _ptsin[1]:=height;
  1461. _contrl[0]:=19;
  1462. _contrl[1]:=1;
  1463. _contrl[3]:=0;
  1464. _contrl[5]:=0;
  1465. _contrl[6]:=handle;
  1466. vdi;
  1467. vsm_height:=_ptsout[1];
  1468. end;
  1469. function vsm_color(handle, color_index: smallint): smallint;
  1470. begin
  1471. _intin[0]:=color_index;
  1472. _contrl[0]:=20;
  1473. _contrl[1]:=0;
  1474. _contrl[3]:=1;
  1475. _contrl[5]:=0;
  1476. _contrl[6]:=handle;
  1477. vdi;
  1478. vsm_color:=_intout[0];
  1479. end;
  1480. function vst_font(handle, font: smallint): smallint;
  1481. begin
  1482. _intin[0]:=font;
  1483. _contrl[0]:=21;
  1484. _contrl[1]:=0;
  1485. _contrl[3]:=1;
  1486. _contrl[5]:=0;
  1487. _contrl[6]:=handle;
  1488. vdi;
  1489. vst_font:=_intout[0];
  1490. end;
  1491. function vst_color(handle: smallint; color_index: smallint): smallint;
  1492. begin
  1493. _intin[0]:=color_index;
  1494. _contrl[0]:=22;
  1495. _contrl[1]:=0;
  1496. _contrl[3]:=1;
  1497. _contrl[5]:=0;
  1498. _contrl[6]:=handle;
  1499. vdi;
  1500. vst_color:=_intout[0];
  1501. end;
  1502. function vsf_interior(handle, style: smallint): smallint;
  1503. begin
  1504. _intin[0]:=style;
  1505. _contrl[0]:=23;
  1506. _contrl[1]:=0;
  1507. _contrl[3]:=1;
  1508. _contrl[5]:=0;
  1509. _contrl[6]:=handle;
  1510. vdi;
  1511. vsf_interior:=_intout[0];
  1512. end;
  1513. function vsf_style(handle, style_index: smallint): smallint;
  1514. begin
  1515. _intin[0]:=style_index;
  1516. _contrl[0]:=24;
  1517. _contrl[1]:=0;
  1518. _contrl[3]:=1;
  1519. _contrl[5]:=0;
  1520. _contrl[6]:=handle;
  1521. vdi;
  1522. vsf_style:=_intout[0];
  1523. end;
  1524. function vsf_color(handle: smallint; color_index: smallint): smallint;
  1525. begin
  1526. _intin[0]:=color_index;
  1527. _contrl[0]:=25;
  1528. _contrl[1]:=0;
  1529. _contrl[3]:=1;
  1530. _contrl[5]:=0;
  1531. _contrl[6]:=handle;
  1532. vdi;
  1533. vsf_color:=_intout[0];
  1534. end;
  1535. function vq_color(handle, color_index, set_flag: smallint; out rgb: ARRAY_3): smallint;
  1536. begin
  1537. _intin[0]:=color_index;
  1538. _intin[1]:=set_flag;
  1539. _contrl[0]:=26;
  1540. _contrl[1]:=0;
  1541. _contrl[3]:=2;
  1542. _contrl[5]:=0;
  1543. _contrl[6]:=handle;
  1544. vdi;
  1545. rgb[0]:=_intout[1];
  1546. rgb[1]:=_intout[2];
  1547. rgb[2]:=_intout[3];
  1548. vq_color:=_intout[0];
  1549. end;
  1550. procedure vrq_locator(handle, x, y: smallint; out xout, yout, term: smallint);
  1551. begin
  1552. _ptsin[0]:=x;
  1553. _ptsin[1]:=y;
  1554. _contrl[0]:=28;
  1555. _contrl[1]:=1;
  1556. _contrl[3]:=0;
  1557. _contrl[5]:=0;
  1558. _contrl[6]:=handle;
  1559. vdi;
  1560. xout:=_ptsout[0];
  1561. yout:=_ptsout[1];
  1562. term:=_intout[0];
  1563. end;
  1564. function vsm_locator(handle, x, y: smallint; out xout, yout, term: smallint): smallint;
  1565. begin
  1566. _ptsin[0]:=x;
  1567. _ptsin[1]:=y;
  1568. _contrl[0]:=28;
  1569. _contrl[1]:=1;
  1570. _contrl[3]:=0;
  1571. _contrl[5]:=0;
  1572. _contrl[6]:=handle;
  1573. vdi;
  1574. xout:=_ptsout[0];
  1575. yout:=_ptsout[1];
  1576. term:=_intout[0];
  1577. vsm_locator:=(_contrl[4] shl 1) or (_contrl[2]);
  1578. end;
  1579. procedure vrq_valuator(handle, valuator_in: smallint; out valuator_out, terminator: smallint);
  1580. begin
  1581. _intin[0]:=valuator_in;
  1582. _contrl[0]:=29;
  1583. _contrl[1]:=0;
  1584. _contrl[3]:=1;
  1585. _contrl[5]:=0;
  1586. _contrl[6]:=handle;
  1587. vdi;
  1588. valuator_out:=_intout[0];
  1589. terminator:=_intout[1];
  1590. end;
  1591. procedure vsm_valuator(handle, val_in: smallint; out val_out, term, status: smallint);
  1592. begin
  1593. _intin[0]:=val_in;
  1594. _contrl[0]:=29;
  1595. _contrl[1]:=0;
  1596. _contrl[3]:=1;
  1597. _contrl[5]:=0;
  1598. _contrl[6]:=handle;
  1599. vdi;
  1600. val_out:=_intout[0];
  1601. term:=_intout[1];
  1602. status:=_contrl[4];
  1603. end;
  1604. procedure vrq_choice(handle, ch_in: smallint; out ch_out: smallint);
  1605. begin
  1606. _intin[0]:=ch_in;
  1607. _contrl[0]:=30;
  1608. _contrl[1]:=0;
  1609. _contrl[3]:=1;
  1610. _contrl[5]:=0;
  1611. _contrl[6]:=handle;
  1612. vdi;
  1613. ch_out:=_intout[0];
  1614. end;
  1615. function vsm_choice(handle: smallint; out choice: smallint): smallint;
  1616. begin
  1617. _contrl[0]:=30;
  1618. _contrl[1]:=0;
  1619. _contrl[3]:=0;
  1620. _contrl[5]:=0;
  1621. _contrl[6]:=handle;
  1622. vdi;
  1623. choice:=_intout[0];
  1624. vsm_choice:=_contrl[4];
  1625. end;
  1626. procedure vrq_string(handle, max_length, echo_mode: smallint; const echo_xy: ARRAY_2; out resstring: shortstring);
  1627. begin
  1628. _intin[0]:=max_length;
  1629. _intin[1]:=echo_mode;
  1630. _ptsin[0]:=echo_xy[0];
  1631. _ptsin[1]:=echo_xy[1];
  1632. _contrl[0]:=31;
  1633. _contrl[1]:=1;
  1634. _contrl[3]:=2;
  1635. _contrl[4]:=0;
  1636. _contrl[5]:=0;
  1637. _contrl[6]:=handle;
  1638. vdi;
  1639. vdi_to_string(@_intout, resstring, _contrl[4]);
  1640. end;
  1641. function vsm_string(handle, max_length, echo_mode: smallint; const echo_xy: ARRAY_2; out resstring: shortstring): smallint;
  1642. begin
  1643. _intin[0]:=max_length;
  1644. _intin[1]:=echo_mode;
  1645. _ptsin[0]:=echo_xy[0];
  1646. _ptsin[1]:=echo_xy[1];
  1647. _contrl[0]:=31;
  1648. _contrl[1]:=1;
  1649. _contrl[3]:=2;
  1650. _contrl[4]:=0;
  1651. _contrl[5]:=0;
  1652. _contrl[6]:=handle;
  1653. vdi;
  1654. vdi_to_string(@_intout, resstring, _contrl[4]);
  1655. vsm_string:=_contrl[4];
  1656. end;
  1657. function vswr_mode(handle: smallint; mode: smallint): smallint;
  1658. begin
  1659. _intin[0]:=mode;
  1660. _contrl[0]:=32;
  1661. _contrl[1]:=0;
  1662. _contrl[3]:=1;
  1663. _contrl[5]:=0;
  1664. _contrl[6]:=handle;
  1665. vdi;
  1666. vswr_mode:=_intout[0];
  1667. end;
  1668. function vsin_mode(handle, dev_type, mode: smallint): smallint;
  1669. begin
  1670. _intin[0]:=mode;
  1671. _intin[1]:=dev_type;
  1672. _contrl[0]:=33;
  1673. _contrl[1]:=0;
  1674. _contrl[3]:=2;
  1675. _contrl[5]:=0;
  1676. _contrl[6]:=handle;
  1677. vdi;
  1678. vsin_mode:=_intout[0];
  1679. end;
  1680. procedure vql_attributes(handle: smallint; out attrib: ARRAY_4);
  1681. begin
  1682. _contrl[0]:=35;
  1683. _contrl[1]:=0;
  1684. _contrl[3]:=0;
  1685. _contrl[5]:=0;
  1686. _contrl[6]:=handle;
  1687. vdi;
  1688. attrib[0]:=_intout[0];
  1689. attrib[1]:=_intout[1];
  1690. attrib[2]:=_intout[2];
  1691. attrib[3]:=_ptsout[0];
  1692. end;
  1693. procedure vql_attributes(handle: smallint; out attrib: ARRAY_6);
  1694. begin
  1695. _contrl[0]:=35;
  1696. _contrl[1]:=0;
  1697. _contrl[3]:=0;
  1698. _contrl[5]:=0;
  1699. _contrl[6]:=handle;
  1700. vdi;
  1701. attrib[0]:=_intout[0];
  1702. attrib[1]:=_intout[1];
  1703. attrib[2]:=_intout[2];
  1704. attrib[3]:=_ptsout[0];
  1705. {* TOS/EmuTOS do not return the line end styles in intout[3/4] *}
  1706. if (_contrl[4] >= 5) then
  1707. begin
  1708. attrib[4]:=_intout[3];
  1709. attrib[5]:=_intout[4];
  1710. end else begin
  1711. attrib[4]:=0;
  1712. attrib[5]:=0;
  1713. end;
  1714. end;
  1715. procedure vqm_attributes(handle: smallint; out attrib: ARRAY_4);
  1716. begin
  1717. _contrl[0]:=36;
  1718. _contrl[1]:=0;
  1719. _contrl[3]:=0;
  1720. _contrl[5]:=0;
  1721. _contrl[6]:=handle;
  1722. vdi;
  1723. attrib[0]:=_intout[0];
  1724. attrib[1]:=_intout[1];
  1725. attrib[2]:=_intout[2];
  1726. attrib[3]:=_ptsout[0];
  1727. end;
  1728. procedure vqf_attributes(handle: smallint; out attrib: ARRAY_5);
  1729. begin
  1730. _contrl[0]:=37;
  1731. _contrl[1]:=0;
  1732. _contrl[3]:=0;
  1733. _contrl[5]:=0;
  1734. _contrl[6]:=handle;
  1735. vdi;
  1736. attrib[0]:=_intout[0];
  1737. attrib[1]:=_intout[1];
  1738. attrib[2]:=_intout[2];
  1739. attrib[3]:=_intout[3];
  1740. attrib[4]:=_intout[4];
  1741. end;
  1742. procedure vqt_attributes(handle: smallint; out attrib: ARRAY_10);
  1743. begin
  1744. _contrl[0]:=38;
  1745. _contrl[1]:=0;
  1746. _contrl[3]:=0;
  1747. _contrl[5]:=0;
  1748. _contrl[6]:=handle;
  1749. vdi;
  1750. attrib[0]:=_intout[0];
  1751. attrib[1]:=_intout[1];
  1752. attrib[2]:=_intout[2];
  1753. attrib[3]:=_intout[3];
  1754. attrib[4]:=_intout[4];
  1755. attrib[5]:=_intout[5];
  1756. attrib[6]:=_ptsout[0];
  1757. attrib[7]:=_ptsout[1];
  1758. attrib[8]:=_ptsout[2];
  1759. attrib[9]:=_ptsout[3];
  1760. end;
  1761. procedure vst_alignment(handle, hor_in, vert_in: smallint; out hor_out, vert_out: smallint);
  1762. begin
  1763. _intin[0]:=hor_in;
  1764. _intin[1]:=vert_in;
  1765. _contrl[0]:=39;
  1766. _contrl[1]:=0;
  1767. _contrl[3]:=2;
  1768. _contrl[5]:=0;
  1769. _contrl[6]:=handle;
  1770. vdi;
  1771. hor_out:=_intout[0];
  1772. vert_out:=_intout[1];
  1773. end;
  1774. procedure v_opnvwk(work_in: psmallint; handle: psmallint; work_out: psmallint);
  1775. var pb: TVDIPB;
  1776. begin
  1777. pb.control := @_contrl;
  1778. // _intin[0..10] = work_in[0..10];
  1779. pb.intin := PVDIIntIn(work_in);
  1780. pb.ptsin := @_ptsin;
  1781. // work_out[0..44] = intout[0..44];
  1782. pb.intout := PVDIIntOut(work_out);
  1783. // work_out[45..56] = ptsout[0..11];
  1784. pb.ptsout := PVDIPtsOut(@work_out[45]);
  1785. _contrl[0]:=100;
  1786. _contrl[1]:=0;
  1787. _contrl[3]:=11;
  1788. _contrl[5]:=0;
  1789. _contrl[6]:=handle^;
  1790. vdi(@pb);
  1791. handle^:=_contrl[6];
  1792. end;
  1793. procedure v_clsvwk(handle: smallint);
  1794. begin
  1795. _contrl[0]:=101;
  1796. _contrl[1]:=0;
  1797. _contrl[3]:=0;
  1798. _contrl[5]:=0;
  1799. _contrl[6]:=handle;
  1800. vdi;
  1801. end;
  1802. procedure vq_extnd(handle, owflag: smallint; WorkOut: psmallint);
  1803. var pb: TVDIPB;
  1804. begin
  1805. pb.control := @_contrl;
  1806. pb.intin := @_intin;
  1807. pb.ptsin := @_ptsin;
  1808. // work_out[0..44] = intout[0..44];
  1809. pb.intout := PVDIIntOut(workout);
  1810. // work_out[45..56] = ptsout[0..11];
  1811. pb.ptsout := PVDIPtsOut(@workout[45]);
  1812. _intin[0]:=owflag;
  1813. _contrl[0]:=102;
  1814. _contrl[1]:=0;
  1815. _contrl[3]:=1;
  1816. _contrl[5]:=0;
  1817. _contrl[6]:=handle;
  1818. vdi(@pb);
  1819. end;
  1820. procedure vq_scrninfo(handle: smallint; out WorkOut: ARRAY_273);
  1821. var pb: TVDIPB;
  1822. begin
  1823. pb.control := @_contrl;
  1824. pb.intin := @_intin;
  1825. pb.ptsin := @_ptsin;
  1826. pb.intout := @workout;
  1827. pb.ptsout := @_ptsout;
  1828. _intin[0]:=2;
  1829. _contrl[0]:=102;
  1830. _contrl[1]:=0;
  1831. _contrl[3]:=1;
  1832. _contrl[5]:=1;
  1833. _contrl[6]:=handle;
  1834. vdi(@pb);
  1835. end;
  1836. procedure v_contourfill(handle, x, y, index: smallint);
  1837. begin
  1838. _intin[0]:=index;
  1839. _ptsin[0]:=x;
  1840. _ptsin[1]:=y;
  1841. _contrl[0]:=103;
  1842. _contrl[1]:=1;
  1843. _contrl[3]:=1;
  1844. _contrl[5]:=0;
  1845. _contrl[6]:=handle;
  1846. vdi;
  1847. end;
  1848. function vsf_perimeter(handle, per_vis: smallint): smallint;
  1849. begin
  1850. _intin[0]:=per_vis;
  1851. _contrl[0]:=104;
  1852. _contrl[1]:=0;
  1853. _contrl[3]:=1;
  1854. _contrl[5]:=0;
  1855. _contrl[6]:=handle;
  1856. vdi;
  1857. vsf_perimeter:=_intout[0];
  1858. end;
  1859. procedure v_get_pixel(handle: smallint; x: smallint; y: smallint;
  1860. pel: psmallint; index: psmallint);
  1861. begin
  1862. _ptsin[0]:=x;
  1863. _ptsin[1]:=y;
  1864. _contrl[0]:=105;
  1865. _contrl[1]:=1;
  1866. _contrl[3]:=0;
  1867. _contrl[5]:=0;
  1868. _contrl[6]:=handle;
  1869. vdi;
  1870. pel^:=_intout[0];
  1871. index^:=_intout[1];
  1872. end;
  1873. procedure v_get_pixel(handle, x, y: smallint; out pel, index: smallint);
  1874. begin
  1875. _ptsin[0]:=x;
  1876. _ptsin[1]:=y;
  1877. _contrl[0]:=105;
  1878. _contrl[1]:=1;
  1879. _contrl[3]:=0;
  1880. _contrl[5]:=0;
  1881. _contrl[6]:=handle;
  1882. vdi;
  1883. pel:=_intout[0];
  1884. index:=_intout[1];
  1885. end;
  1886. function vst_effects(handle, effect: smallint): smallint;
  1887. begin
  1888. _intin[0]:=effect;
  1889. _contrl[0]:=106;
  1890. _contrl[1]:=0;
  1891. _contrl[3]:=1;
  1892. _contrl[5]:=0;
  1893. _contrl[6]:=handle;
  1894. vdi;
  1895. vst_effects:=_intout[0];
  1896. end;
  1897. function vst_point(handle, point: smallint; out char_width, char_height, cell_width, cell_height: smallint): smallint;
  1898. begin
  1899. _intin[0]:=point;
  1900. _contrl[0]:=107;
  1901. _contrl[1]:=0;
  1902. _contrl[3]:=1;
  1903. _contrl[5]:=0;
  1904. _contrl[6]:=handle;
  1905. vdi;
  1906. char_width:=_ptsout[0];
  1907. char_height:=_ptsout[1];
  1908. cell_width:=_ptsout[2];
  1909. cell_height:=_ptsout[3];
  1910. vst_point:=_intout[0];
  1911. end;
  1912. procedure vsl_ends(handle, beg_style, end_style: smallint);
  1913. begin
  1914. _intin[0]:=beg_style;
  1915. _intin[1]:=end_style;
  1916. _contrl[0]:=108;
  1917. _contrl[1]:=0;
  1918. _contrl[3]:=2;
  1919. _contrl[5]:=0;
  1920. _contrl[6]:=handle;
  1921. vdi;
  1922. end;
  1923. procedure vro_cpyfm(handle: smallint; vr_mode: smallint; pxyarray: psmallint; psrcMFDB: PMFDB; pdesMFDB: PMFDB);
  1924. begin
  1925. _intin[0]:=vr_mode;
  1926. _ptsin[0]:=pxyarray[0];
  1927. _ptsin[1]:=pxyarray[1];
  1928. _ptsin[2]:=pxyarray[2];
  1929. _ptsin[3]:=pxyarray[3];
  1930. _ptsin[4]:=pxyarray[4];
  1931. _ptsin[5]:=pxyarray[5];
  1932. _ptsin[6]:=pxyarray[6];
  1933. _ptsin[7]:=pxyarray[7];
  1934. PPointer(@_contrl[7])^:=psrcMFDB;
  1935. PPointer(@_contrl[9])^:=pdesMFDB;
  1936. _contrl[0]:=109;
  1937. _contrl[1]:=4;
  1938. _contrl[3]:=1;
  1939. _contrl[5]:=0;
  1940. _contrl[6]:=handle;
  1941. vdi;
  1942. end;
  1943. procedure vr_trnfm(handle: smallint; psrcMFDB, pdesMFDB: PMFDB);
  1944. begin
  1945. PPointer(@_contrl[7])^:=psrcMFDB;
  1946. PPointer(@_contrl[9])^:=pdesMFDB;
  1947. _contrl[0]:=110;
  1948. _contrl[1]:=0;
  1949. _contrl[3]:=0;
  1950. _contrl[5]:=0;
  1951. _contrl[6]:=handle;
  1952. vdi;
  1953. end;
  1954. procedure vr_trnfm(handle: smallint; const psrcMFDB, pdesMFDB: TMFDB);
  1955. begin
  1956. PPointer(@_contrl[7])^:=@psrcMFDB;
  1957. PPointer(@_contrl[9])^:=@pdesMFDB;
  1958. _contrl[0]:=110;
  1959. _contrl[1]:=0;
  1960. _contrl[3]:=0;
  1961. _contrl[5]:=0;
  1962. _contrl[6]:=handle;
  1963. vdi;
  1964. end;
  1965. procedure vsc_form(handle: smallint; pcur_form: PMFORM);
  1966. var pb: TVDIPB;
  1967. begin
  1968. {* TODO: NVDI also returns current form in intout *}
  1969. pb.control := @_contrl;
  1970. pb.intin := PVDIIntIn(pcur_form);
  1971. pb.ptsin := @_ptsin;
  1972. pb.intout := @_intout;
  1973. pb.ptsout := @_ptsout;
  1974. _contrl[0]:=111;
  1975. _contrl[1]:=0;
  1976. _contrl[3]:=37;
  1977. _contrl[5]:=0;
  1978. _contrl[6]:=handle;
  1979. vdi(@pb);
  1980. end;
  1981. procedure vsf_udpat(handle: smallint; pfill_pat: Pointer; planes: smallint);
  1982. var pb: TVDIPB;
  1983. begin
  1984. pb.control := @_contrl;
  1985. pb.intin := PVDIIntIn(pfill_pat);
  1986. pb.ptsin := @_ptsin;
  1987. pb.intout := @_intout;
  1988. pb.ptsout := @_ptsout;
  1989. _contrl[0]:=112;
  1990. _contrl[1]:=0;
  1991. _contrl[3]:=planes*16;
  1992. _contrl[5]:=0;
  1993. _contrl[6]:=handle;
  1994. vdi(@pb);
  1995. end;
  1996. procedure vsl_udsty(handle, pattern: smallint);
  1997. begin
  1998. _intin[0]:=pattern;
  1999. _contrl[0]:=113;
  2000. _contrl[1]:=0;
  2001. _contrl[3]:=1;
  2002. _contrl[5]:=0;
  2003. _contrl[6]:=handle;
  2004. vdi;
  2005. end;
  2006. procedure vr_recfl(handle: smallint; const pxyarray: ARRAY_4);
  2007. begin
  2008. _ptsin[0]:=pxyarray[0];
  2009. _ptsin[1]:=pxyarray[1];
  2010. _ptsin[2]:=pxyarray[2];
  2011. _ptsin[3]:=pxyarray[3];
  2012. _contrl[0]:=114;
  2013. _contrl[1]:=2;
  2014. _contrl[3]:=0;
  2015. _contrl[5]:=0;
  2016. _contrl[6]:=handle;
  2017. vdi;
  2018. end;
  2019. procedure vqin_mode(handle, dev_type: smallint; out input_mode: smallint);
  2020. begin
  2021. _intin[0]:=dev_type;
  2022. _contrl[0]:=115;
  2023. _contrl[1]:=0;
  2024. _contrl[3]:=1;
  2025. _contrl[5]:=0;
  2026. _contrl[6]:=handle;
  2027. vdi;
  2028. input_mode:=_intout[0];
  2029. end;
  2030. procedure vqt_extent(handle: smallint; calcshortstring: PAnsiChar; extent: psmallint);
  2031. var len: smallint;
  2032. begin
  2033. len:=pchar_str_to_vdi(calcshortstring, @_intin[0]);
  2034. _contrl[0]:=116;
  2035. _contrl[1]:=0;
  2036. _contrl[3]:=len;
  2037. _contrl[5]:=0;
  2038. _contrl[6]:=handle;
  2039. vdi;
  2040. extent[0]:=_ptsout[0];
  2041. extent[1]:=_ptsout[1];
  2042. extent[2]:=_ptsout[2];
  2043. extent[3]:=_ptsout[3];
  2044. extent[4]:=_ptsout[4];
  2045. extent[5]:=_ptsout[5];
  2046. extent[6]:=_ptsout[6];
  2047. extent[7]:=_ptsout[7];
  2048. end;
  2049. function vqt_width(handle, character: smallint; out cell_width, left_delta, right_delta: smallint): smallint;
  2050. begin
  2051. _intin[0]:=character;
  2052. _contrl[0]:=117;
  2053. _contrl[1]:=0;
  2054. _contrl[3]:=1;
  2055. _contrl[5]:=0;
  2056. _contrl[6]:=handle;
  2057. vdi;
  2058. cell_width:=_ptsout[0];
  2059. left_delta:=_ptsout[2];
  2060. right_delta:=_ptsout[4];
  2061. vqt_width:=_intout[0];
  2062. end;
  2063. procedure vex_timv(handle: smallint; tim_addr: Pointer; out otim_addr: Pointer; out tim_conv: smallint);
  2064. begin
  2065. _contrl[0]:=118;
  2066. _contrl[1]:=0;
  2067. _contrl[3]:=0;
  2068. _contrl[5]:=0;
  2069. _contrl[6]:=handle;
  2070. PPointer(@_contrl[7])^:=tim_addr;
  2071. vdi;
  2072. otim_addr:=PPointer(@_contrl[9])^;
  2073. tim_conv:=_intout[0];
  2074. end;
  2075. function vst_load_fonts(handle, select: smallint): smallint;
  2076. begin
  2077. _intin[0]:=select;
  2078. _contrl[0]:=119;
  2079. _contrl[1]:=0;
  2080. _contrl[3]:=1;
  2081. _contrl[5]:=0;
  2082. _contrl[6]:=handle;
  2083. vdi;
  2084. vst_load_fonts:=_intout[0];
  2085. end;
  2086. procedure vst_unload_fonts(handle, select: smallint);
  2087. begin
  2088. _intin[0]:=select;
  2089. _contrl[0]:=120;
  2090. _contrl[1]:=0;
  2091. _contrl[3]:=1;
  2092. _contrl[5]:=0;
  2093. _contrl[6]:=handle;
  2094. vdi;
  2095. end;
  2096. procedure vrt_cpyfm(handle: smallint; vr_mode: smallint; pxyarray: psmallint; psrcMFDB: PMFDB; pdesMFDB: PMFDB; color_index: psmallint);
  2097. begin
  2098. _intin[0]:=vr_mode;
  2099. _intin[1]:=color_index[0];
  2100. _intin[2]:=color_index[1];
  2101. _ptsin[0]:=pxyarray[0];
  2102. _ptsin[1]:=pxyarray[1];
  2103. _ptsin[2]:=pxyarray[2];
  2104. _ptsin[3]:=pxyarray[3];
  2105. _ptsin[4]:=pxyarray[4];
  2106. _ptsin[5]:=pxyarray[5];
  2107. _ptsin[6]:=pxyarray[6];
  2108. _ptsin[7]:=pxyarray[7];
  2109. PPointer(@_contrl[7])^:=psrcMFDB;
  2110. PPointer(@_contrl[9])^:=pdesMFDB;
  2111. _contrl[0]:=121;
  2112. _contrl[1]:=4;
  2113. _contrl[3]:=3;
  2114. _contrl[5]:=0;
  2115. _contrl[6]:=handle;
  2116. vdi;
  2117. end;
  2118. procedure v_show_c(handle: smallint; reset: smallint);
  2119. begin
  2120. _intin[0]:=reset;
  2121. _contrl[0]:=122;
  2122. _contrl[1]:=0;
  2123. _contrl[3]:=1;
  2124. _contrl[5]:=0;
  2125. _contrl[6]:=handle;
  2126. vdi;
  2127. end;
  2128. procedure v_hide_c(handle: smallint);
  2129. begin
  2130. _contrl[0]:=123;
  2131. _contrl[1]:=0;
  2132. _contrl[3]:=0;
  2133. _contrl[5]:=0;
  2134. _contrl[6]:=handle;
  2135. vdi;
  2136. end;
  2137. procedure vq_mouse(handle: smallint; out pstatus, x, y: smallint);
  2138. begin
  2139. _contrl[0]:=124;
  2140. _contrl[1]:=0;
  2141. _contrl[3]:=0;
  2142. _contrl[5]:=0;
  2143. _contrl[6]:=handle;
  2144. vdi;
  2145. pstatus:=_intout[0];
  2146. x:=_ptsout[0];
  2147. y:=_ptsout[1];
  2148. end;
  2149. procedure vex_butv(handle: smallint; pusrcode: Pointer; out psavcode: Pointer);
  2150. begin
  2151. _contrl[0]:=125;
  2152. _contrl[1]:=0;
  2153. _contrl[3]:=0;
  2154. _contrl[5]:=0;
  2155. _contrl[6]:=handle;
  2156. PPointer(@_contrl[7])^:=pusrcode;
  2157. vdi;
  2158. psavcode:=PPointer(@_contrl[9])^;
  2159. end;
  2160. procedure vex_motv(handle: smallint; pusrcode: Pointer; out psavcode: Pointer);
  2161. begin
  2162. _contrl[0]:=126;
  2163. _contrl[1]:=0;
  2164. _contrl[3]:=0;
  2165. _contrl[5]:=0;
  2166. _contrl[6]:=handle;
  2167. PPointer(@_contrl[7])^:=pusrcode;
  2168. vdi;
  2169. psavcode:=PPointer(@_contrl[9])^;
  2170. end;
  2171. procedure vex_curv(handle: smallint; pusrcode: Pointer; out psavcode: Pointer);
  2172. begin
  2173. _contrl[0]:=127;
  2174. _contrl[1]:=0;
  2175. _contrl[3]:=0;
  2176. _contrl[5]:=0;
  2177. _contrl[6]:=handle;
  2178. PPointer(@_contrl[7])^:=pusrcode;
  2179. vdi;
  2180. psavcode:=PPointer(@_contrl[9])^;
  2181. end;
  2182. procedure vq_key_s(handle: smallint; out pstatus: smallint);
  2183. begin
  2184. _contrl[0]:=128;
  2185. _contrl[1]:=0;
  2186. _contrl[3]:=0;
  2187. _contrl[5]:=0;
  2188. _contrl[6]:=handle;
  2189. vdi;
  2190. pstatus:=_intout[0];
  2191. end;
  2192. procedure vs_clip(handle: smallint; clip_flag: smallint; pxyarray: psmallint);
  2193. begin
  2194. _intin[0]:=clip_flag;
  2195. _ptsin[0]:=pxyarray[0];
  2196. _ptsin[1]:=pxyarray[1];
  2197. _ptsin[2]:=pxyarray[2];
  2198. _ptsin[3]:=pxyarray[3];
  2199. _contrl[0]:=129;
  2200. _contrl[1]:=2;
  2201. _contrl[3]:=1;
  2202. _contrl[5]:=0;
  2203. _contrl[6]:=handle;
  2204. vdi;
  2205. end;
  2206. procedure vs_clip(handle, clip_flag: smallint; const pxyarray: ARRAY_4);
  2207. begin
  2208. _intin[0]:=clip_flag;
  2209. _ptsin[0]:=pxyarray[0];
  2210. _ptsin[1]:=pxyarray[1];
  2211. _ptsin[2]:=pxyarray[2];
  2212. _ptsin[3]:=pxyarray[3];
  2213. _contrl[0]:=129;
  2214. _contrl[1]:=2;
  2215. _contrl[3]:=1;
  2216. _contrl[5]:=0;
  2217. _contrl[6]:=handle;
  2218. vdi;
  2219. end;
  2220. procedure vs_clip_off(handle: smallint);
  2221. begin
  2222. _intin[0]:=0;
  2223. _ptsin[0]:=0;
  2224. _ptsin[1]:=0;
  2225. _ptsin[2]:=0;
  2226. _ptsin[3]:=0;
  2227. _contrl[0]:=129;
  2228. _contrl[1]:=2;
  2229. _contrl[3]:=1;
  2230. _contrl[5]:=0;
  2231. _contrl[6]:=handle;
  2232. vdi;
  2233. end;
  2234. function vqt_name(handle, element_num: smallint; out name: string33): smallint;
  2235. begin
  2236. _intin[0]:=element_num;
  2237. _contrl[0]:=130;
  2238. _contrl[1]:=0;
  2239. _contrl[3]:=1;
  2240. _contrl[5]:=0;
  2241. _contrl[6]:=handle;
  2242. vdi;
  2243. vdi_to_string(@_intout[1], name, _contrl[4] - 1);
  2244. vqt_name:=_intout[0];
  2245. end;
  2246. procedure vqt_fontinfo(handle: smallint;
  2247. out minADE, maxADE: smallint;
  2248. out distances: ARRAY_5;
  2249. out maxwidth: smallint;
  2250. out effects: ARRAY_3);
  2251. begin
  2252. _contrl[0]:=131;
  2253. _contrl[1]:=0;
  2254. _contrl[3]:=0;
  2255. _contrl[5]:=0;
  2256. _contrl[6]:=handle;
  2257. vdi;
  2258. minADE:=_intout[0];
  2259. maxADE:=_intout[1];
  2260. maxwidth:=_ptsout[0];
  2261. distances[0]:=_ptsout[1];
  2262. distances[1]:=_ptsout[3];
  2263. distances[2]:=_ptsout[5];
  2264. distances[3]:=_ptsout[7];
  2265. distances[4]:=_ptsout[9];
  2266. effects[0]:=_ptsout[2];
  2267. effects[1]:=_ptsout[4];
  2268. effects[2]:=_ptsout[6];
  2269. end;
  2270. procedure vqt_justified(handle, x, y: smallint; const outstring: shortstring;
  2271. length, word_space, char_space: smallint;
  2272. offsets: Pointer);
  2273. var len: smallint;
  2274. var pb: TVDIPB;
  2275. begin
  2276. pb.control := @_contrl;
  2277. pb.intin := @_intin;
  2278. pb.ptsin := @_ptsin;
  2279. pb.intout := @_intout;
  2280. pb.ptsout := PVDIPtsOut(offsets);
  2281. _intin[0]:=word_space;
  2282. _intin[1]:=char_space;
  2283. len:=string_to_vdi(outstring, @_intin[2]);
  2284. _ptsin[0]:=x;
  2285. _ptsin[1]:=y;
  2286. _ptsin[2]:=length;
  2287. _ptsin[3]:=0;
  2288. _contrl[0]:=132;
  2289. _contrl[1]:=2;
  2290. _contrl[3]:=len+2;
  2291. _contrl[5]:=0;
  2292. _contrl[6]:=handle;
  2293. vdi(@pb);
  2294. end;
  2295. procedure vex_wheelv(handle: smallint; pusrcode: Pointer; out psavcode: Pointer);
  2296. begin
  2297. _contrl[0]:=134;
  2298. _contrl[1]:=0;
  2299. _contrl[3]:=0;
  2300. _contrl[5]:=0;
  2301. _contrl[6]:=handle;
  2302. PPointer(@_contrl[7])^:=pusrcode;
  2303. vdi;
  2304. psavcode:=PPointer(@_contrl[9])^;
  2305. end;
  2306. procedure vst_width(handle, width: smallint; out char_width, char_height, cell_width, cell_height: smallint);
  2307. begin
  2308. _intin[0]:=width;
  2309. _contrl[0]:=231;
  2310. _contrl[1]:=0;
  2311. _contrl[3]:=1;
  2312. _contrl[5]:=0;
  2313. _contrl[6]:=handle;
  2314. vdi;
  2315. char_width:=_intout[0];
  2316. char_height:=_intout[1];
  2317. cell_width:=_intout[2];
  2318. cell_height:=_intout[3];
  2319. end;
  2320. procedure vqt_fontheader(handle: smallint; buffer: Pointer;
  2321. out pathname: shortstring);
  2322. begin
  2323. Ppointer(@_intin[0])^:=buffer;
  2324. _contrl[0]:=232;
  2325. _contrl[1]:=0;
  2326. _contrl[3]:=2;
  2327. _contrl[5]:=0;
  2328. _contrl[6]:=handle;
  2329. vdi;
  2330. vdi_to_string(@_intout[0], pathname, _contrl[4]);
  2331. end;
  2332. procedure vqt_trackkern(handle: smallint; out x, y: fix31);
  2333. begin
  2334. _contrl[0]:=234;
  2335. _contrl[1]:=0;
  2336. _contrl[3]:=0;
  2337. _contrl[5]:=0;
  2338. _contrl[6]:=handle;
  2339. vdi;
  2340. x:=PLongint(@_intout[0])^;
  2341. y:=PLongint(@_intout[2])^;
  2342. end;
  2343. procedure vqt_pairkern(handle, ch1, ch2: smallint; out x, y: fix31);
  2344. begin
  2345. _intin[0]:=ch1;
  2346. _intin[2]:=ch2;
  2347. _contrl[0]:=235;
  2348. _contrl[1]:=0;
  2349. _contrl[3]:=2;
  2350. _contrl[5]:=0;
  2351. _contrl[6]:=handle;
  2352. vdi;
  2353. x:=PLongint(@_intout[0])^;
  2354. y:=PLongint(@_intout[2])^;
  2355. end;
  2356. procedure vst_charmap(handle, mode: smallint);
  2357. begin
  2358. _intin[0]:=mode;
  2359. _contrl[0]:=236;
  2360. _contrl[1]:=0;
  2361. _contrl[3]:=1;
  2362. _contrl[5]:=0;
  2363. _contrl[6]:=handle;
  2364. vdi;
  2365. end;
  2366. function vst_map_mode(handle, mode: smallint): smallint;
  2367. begin
  2368. _intin[0]:=mode;
  2369. _intin[1]:=1;
  2370. _contrl[0]:=236;
  2371. _contrl[1]:=0;
  2372. _contrl[3]:=2;
  2373. _contrl[5]:=0;
  2374. _contrl[6]:=handle;
  2375. vdi;
  2376. vst_map_mode:=_intout[0];
  2377. end;
  2378. procedure vst_kern(handle, tmode, pmode: smallint; out tracks, pairs: smallint);
  2379. begin
  2380. _intin[0]:=tmode;
  2381. _intin[1]:=pmode;
  2382. _contrl[0]:=237;
  2383. _contrl[1]:=0;
  2384. _contrl[3]:=2;
  2385. _contrl[5]:=0;
  2386. _contrl[6]:=handle;
  2387. vdi;
  2388. tracks:=_intout[0];
  2389. pairs:=_intout[0];
  2390. end;
  2391. procedure vst_track_offset(handle: smallint; offset: fix31; pairmode: smallint; out tracks, pairs: smallint);
  2392. begin
  2393. _intin[0]:=255;
  2394. _intin[1]:=pairmode;
  2395. PLongint(@_intin[2])^:=offset;
  2396. _contrl[0]:=237;
  2397. _contrl[1]:=0;
  2398. _contrl[3]:=4;
  2399. _contrl[5]:=0;
  2400. _contrl[6]:=handle;
  2401. vdi;
  2402. tracks:=_intout[0];
  2403. pairs:=_intout[0];
  2404. end;
  2405. procedure v_getbitmap_info(handle, ch: smallint;
  2406. out advx, advy, xoff, yoff: fix31;
  2407. out width, height: smallint;
  2408. out bitmap: pointer);
  2409. begin
  2410. _intin[0]:=ch;
  2411. _contrl[0]:=239;
  2412. _contrl[1]:=0;
  2413. _contrl[3]:=1;
  2414. _contrl[5]:=0;
  2415. _contrl[6]:=handle;
  2416. vdi;
  2417. width:=_intout[0];
  2418. height:=_intout[1];
  2419. advx:=PLongint(@_intout[2])^;
  2420. advy:=PLongint(@_intout[4])^;
  2421. xoff:=PLongint(@_intout[6])^;
  2422. yoff:=PLongint(@_intout[8])^;
  2423. bitmap:=PPointer(@_intout[10])^;
  2424. end;
  2425. procedure v_ftext(handle, x, y: smallint; const str: shortstring);
  2426. var len: longint;
  2427. begin
  2428. len:=string_to_vdi(str, @_intin[0]);
  2429. _ptsin[0]:=x;
  2430. _ptsin[1]:=y;
  2431. _contrl[0]:=241;
  2432. _contrl[1]:=1;
  2433. _contrl[3]:=len;
  2434. _contrl[5]:=0;
  2435. _contrl[6]:=handle;
  2436. vdi;
  2437. end;
  2438. procedure v_ftext_offset(handle, x, y: smallint;
  2439. const outputstring: shortstring;
  2440. const offset: Array of smallint);
  2441. var i, len: longint;
  2442. src, dst: psmallint;
  2443. begin
  2444. len:=string_to_vdi(outputstring, @_intin[0]);
  2445. _ptsin[0]:=x;
  2446. _ptsin[1]:=y;
  2447. src:=offset;
  2448. dst:=@_ptsin[2];
  2449. for i:=0 to len-1 do
  2450. begin
  2451. dst^:=src^;
  2452. inc(dst);
  2453. inc(src);
  2454. dst^:=src^;
  2455. inc(dst);
  2456. inc(src);
  2457. end;
  2458. _contrl[0]:=241;
  2459. _contrl[1]:=len+1;
  2460. _contrl[3]:=len;
  2461. _contrl[5]:=0;
  2462. _contrl[6]:=handle;
  2463. vdi;
  2464. end;
  2465. procedure v_killoutline(handle: smallint; component: Pointer);
  2466. begin
  2467. PPointer(@_intin[0])^:=component;
  2468. _contrl[0]:=242;
  2469. _contrl[1]:=0;
  2470. _contrl[3]:=2;
  2471. _contrl[5]:=0;
  2472. _contrl[6]:=handle;
  2473. vdi;
  2474. end;
  2475. procedure v_getoutline(handle, ch: smallint;
  2476. const xyarray: Array of smallint;
  2477. const bezarray: Array of ShortInt;
  2478. maxverts: smallint;
  2479. out numverts: smallint);
  2480. begin
  2481. _intin[0]:=ch;
  2482. _intin[1]:=maxverts;
  2483. PPointer(@_intin[2])^:=@xyarray;
  2484. PPointer(@_intin[4])^:=@bezarray;
  2485. _contrl[0]:=243;
  2486. _contrl[1]:=0;
  2487. _contrl[3]:=6;
  2488. _contrl[5]:=0;
  2489. _contrl[6]:=handle;
  2490. vdi;
  2491. numverts:=_intout[0];
  2492. end;
  2493. procedure vst_scratch(handle, mode: smallint);
  2494. begin
  2495. _intin[0]:=mode;
  2496. _contrl[0]:=244;
  2497. _contrl[1]:=0;
  2498. _contrl[3]:=1;
  2499. _contrl[5]:=0;
  2500. _contrl[6]:=handle;
  2501. vdi;
  2502. end;
  2503. procedure vst_error(handle, mode: smallint; out errorvar: smallint);
  2504. begin
  2505. _intin[0]:=mode;
  2506. PPointer(@_intin[1])^:=@errorvar;
  2507. _contrl[0]:=245;
  2508. _contrl[1]:=0;
  2509. _contrl[3]:=3;
  2510. _contrl[5]:=0;
  2511. _contrl[6]:=handle;
  2512. vdi;
  2513. end;
  2514. function vst_arbpt(handle, point: smallint;
  2515. out chwd, chht, cellwd, cellht: smallint): smallint;
  2516. begin
  2517. _intin[0]:=point;
  2518. _contrl[0]:=246;
  2519. _contrl[1]:=0;
  2520. _contrl[3]:=1;
  2521. _contrl[5]:=0;
  2522. _contrl[6]:=handle;
  2523. vdi;
  2524. chwd:=_ptsout[0];
  2525. chht:=_ptsout[1];
  2526. cellwd:=_ptsout[2];
  2527. cellht:=_ptsout[3];
  2528. vst_arbpt:=_intout[0];
  2529. end;
  2530. function vst_arbpt32(handle: smallint; point: fix31;
  2531. out chwd, chht, cellwd, cellht: smallint): fix31;
  2532. begin
  2533. PLongint(@_intin[0])^:=point;
  2534. _contrl[0]:=246;
  2535. _contrl[1]:=0;
  2536. _contrl[3]:=2;
  2537. _contrl[5]:=0;
  2538. _contrl[6]:=handle;
  2539. vdi;
  2540. chwd:=_ptsout[0];
  2541. chht:=_ptsout[1];
  2542. cellwd:=_ptsout[2];
  2543. cellht:=_ptsout[3];
  2544. vst_arbpt32:=PLongint(@_intout[0])^;
  2545. end;
  2546. procedure vqt_advance(handle, ch: smallint; out advx, advy, remx, remy: smallint);
  2547. begin
  2548. _intin[0]:=ch;
  2549. _contrl[0]:=247;
  2550. _contrl[1]:=0;
  2551. _contrl[3]:=1;
  2552. _contrl[5]:=0;
  2553. _contrl[6]:=handle;
  2554. vdi;
  2555. advx:=_ptsout[0];
  2556. advy:=_ptsout[1];
  2557. remx:=_ptsout[2];
  2558. remy:=_ptsout[3];
  2559. end;
  2560. procedure vqt_advance32(handle, ch: smallint; out advx, advy: fix31);
  2561. begin
  2562. _intin[0]:=ch;
  2563. _contrl[0]:=247;
  2564. _contrl[1]:=0;
  2565. _contrl[3]:=1;
  2566. _contrl[5]:=0;
  2567. _contrl[6]:=handle;
  2568. vdi;
  2569. advx:=PLongint(@_ptsout[4])^;
  2570. advy:=PLongint(@_ptsout[6])^;
  2571. end;
  2572. function vq_devinfo(handle, devnum: smallint;
  2573. out devexists: smallint;
  2574. out filename: shortstring;
  2575. out devicename: shortstring): smallint;
  2576. var i, len: smallint;
  2577. ch: AnsiChar;
  2578. begin
  2579. _intin[0]:=devnum;
  2580. _contrl[0]:=248;
  2581. _contrl[1]:=0;
  2582. _contrl[3]:=1;
  2583. _contrl[5]:=0;
  2584. _contrl[6]:=handle;
  2585. vdi;
  2586. if (_contrl[4] = 0) or (_intout[4] = 0) then
  2587. begin
  2588. devexists:= 0;
  2589. filename := '';
  2590. devicename := '';
  2591. vq_devinfo:=0;
  2592. end
  2593. else
  2594. begin
  2595. (* here, the driver exists *)
  2596. devexists:=1;
  2597. (* set the filename. The value in vdi_intout may be "DRIVER.SYS"
  2598. * or "DRIVER SYS". vdi_intout is not a nul-terminated shortstring.
  2599. * In both cases, this binding returns a valid filename: "DRIVER.SYS"
  2600. * with a null-character to ended the shortstring.
  2601. *)
  2602. len := 0;
  2603. for i:=0 to _contrl[4]-1 do
  2604. begin
  2605. ch := chr(_intout[i]);
  2606. inc(len);
  2607. filename[len]:=ch;
  2608. if (ch = ' ') and (chr(_intout[i+1]) <> ' ') then
  2609. begin
  2610. inc(len);
  2611. filename[len]:='.';
  2612. end
  2613. else
  2614. begin
  2615. inc(len);
  2616. filename[len]:=ch;
  2617. end
  2618. end;
  2619. setlength(filename, len);
  2620. (* device name in ptsout is a C-shortstring, (a nul-terminated shortstring with 8bits per characters)
  2621. * each short value (vdi_ptsout[x]) contains 2 characters.
  2622. * When ptsout contains a device name, NVDI/SpeedoGDOS seems to always write the value "13"
  2623. * in vdi_control[1] (hey! this should be a read only value from the VDI point of view!!!),
  2624. * and SpeedoGDOS 5 may set vdi_control[2] == 1 (intead of the size of vdi_ptsout, including
  2625. * the device_name). It's seems that this value "13" (written in vdi_control[1]) has missed
  2626. * its target (vdi_control[2]). So, here is a workaround:
  2627. *)
  2628. if (_contrl[2] = 1) and (_contrl[1] > 0) then
  2629. len := _contrl[1] * 2
  2630. else
  2631. len := (_contrl[2] - 1) * 2;
  2632. setlength(devicename, len);
  2633. move(_ptsout[1], devicename[1], len);
  2634. vq_devinfo:=_intout[0];;
  2635. end;
  2636. end;
  2637. procedure vqt_devinfo(handle, devnum: smallint;
  2638. out dev_busy: smallint;
  2639. out filename: shortstring;
  2640. out devicename: shortstring);
  2641. var dummy: smallint;
  2642. begin
  2643. dev_busy:=vq_devinfo(handle, devnum, dummy, filename, devicename);
  2644. end;
  2645. function v_savecache(handle: smallint; const filename: shortstring): smallint;
  2646. var len: longint;
  2647. begin
  2648. len:=string_to_vdi(filename, @_intin[0]);
  2649. _contrl[0]:=249;
  2650. _contrl[1]:=0;
  2651. _contrl[3]:=len;
  2652. _contrl[5]:=0;
  2653. _contrl[6]:=handle;
  2654. vdi;
  2655. v_savecache:=_intout[0];
  2656. end;
  2657. function v_loadcache(handle: smallint; const filename: shortstring; mode: smallint): smallint;
  2658. var len: longint;
  2659. begin
  2660. len:=string_to_vdi(filename, @_intin[1]);
  2661. _intin[0]:=mode;
  2662. _contrl[0]:=250;
  2663. _contrl[1]:=0;
  2664. _contrl[3]:=len+1;
  2665. _contrl[5]:=0;
  2666. _contrl[6]:=handle;
  2667. vdi;
  2668. v_loadcache:=_intout[0];
  2669. end;
  2670. function v_flushcache(handle: smallint): smallint;
  2671. begin
  2672. _contrl[0]:=251;
  2673. _contrl[1]:=0;
  2674. _contrl[3]:=0;
  2675. _contrl[5]:=0;
  2676. _contrl[6]:=handle;
  2677. vdi;
  2678. v_flushcache:=_intout[0];
  2679. end;
  2680. function vst_setsize(handle, point: smallint;
  2681. out chwd, chht, cellwd, cellht: smallint): smallint;
  2682. begin
  2683. _intin[0]:=point;
  2684. _contrl[0]:=252;
  2685. _contrl[1]:=0;
  2686. _contrl[3]:=1;
  2687. _contrl[5]:=0;
  2688. _contrl[6]:=handle;
  2689. vdi;
  2690. chwd:=_ptsout[0];
  2691. chht:=_ptsout[1];
  2692. cellwd:=_ptsout[2];
  2693. cellht:=_ptsout[3];
  2694. vst_setsize:=_intout[0];
  2695. end;
  2696. function vst_setsize32(handle: smallint; point: fix31;
  2697. out chwd, chht, cellwd, cellht: smallint): fix31;
  2698. begin
  2699. PLongint(@_intin[0])^:=point;
  2700. _contrl[0]:=252;
  2701. _contrl[1]:=0;
  2702. _contrl[3]:=2;
  2703. _contrl[5]:=0;
  2704. _contrl[6]:=handle;
  2705. vdi;
  2706. chwd:=_ptsout[0];
  2707. chht:=_ptsout[1];
  2708. cellwd:=_ptsout[2];
  2709. cellht:=_ptsout[3];
  2710. vst_setsize32:=PLongint(@_intout[0])^;
  2711. end;
  2712. function vst_skew(handle, skew: smallint): smallint;
  2713. begin
  2714. _intin[0]:=skew;
  2715. _contrl[0]:=253;
  2716. _contrl[1]:=0;
  2717. _contrl[3]:=1;
  2718. _contrl[5]:=0;
  2719. _contrl[6]:=handle;
  2720. vdi;
  2721. vst_skew:=_intout[0];
  2722. end;
  2723. procedure vqt_get_table(handle: smallint; out map: Pointer);
  2724. begin
  2725. _contrl[0]:=254;
  2726. _contrl[1]:=0;
  2727. _contrl[3]:=0;
  2728. _contrl[5]:=0;
  2729. _contrl[6]:=handle;
  2730. vdi;
  2731. map:=PPointer(@_intout[0])^;
  2732. end;
  2733. procedure vqt_cachesize(handle, which_cache: smallint; out size: LongInt);
  2734. begin
  2735. _intin[0]:=which_cache;
  2736. _contrl[0]:=255;
  2737. _contrl[1]:=0;
  2738. _contrl[3]:=0;
  2739. _contrl[5]:=0;
  2740. _contrl[6]:=handle;
  2741. vdi;
  2742. size:=PLongint(@_intout[0])^;
  2743. end;
  2744. procedure v_set_app_buff(handle: smallint; address: Pointer; nparagraphs: smallint);
  2745. begin
  2746. PPointer(@_intin[0])^:=address;
  2747. _intin[2]:=nparagraphs;
  2748. _contrl[0]:=-1;
  2749. _contrl[1]:=0;
  2750. _contrl[3]:=3;
  2751. _contrl[5]:=6;
  2752. _contrl[6]:=handle;
  2753. vdi;
  2754. end;
  2755. end.