tcalvar6.pp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. {****************************************************************}
  2. { CODE GENERATOR TEST PROGRAM }
  3. { By Carl Eric Codere }
  4. {****************************************************************}
  5. { NODE TESTED : secondcallparan() }
  6. {****************************************************************}
  7. { PRE-REQUISITES: secondload() }
  8. { secondassign() }
  9. { secondtypeconv() }
  10. { secondtryexcept() }
  11. { secondcalln() }
  12. { secondadd() }
  13. {****************************************************************}
  14. { DEFINES: }
  15. { FPC = Target is FreePascal compiler }
  16. {****************************************************************}
  17. { REMARKS: This tests a subset of the secondcalln() node }
  18. { (var parameters with safecall calling convention) }
  19. {****************************************************************}
  20. program tcalvar6;
  21. {$ifdef fpc}
  22. {$mode objfpc}
  23. {$INLINE ON}
  24. {$endif}
  25. {$R+}
  26. {$P-}
  27. {$V+}
  28. {$ifdef VER70}
  29. {$define tp}
  30. {$endif}
  31. { REAL should map to single or double }
  32. { so it is not checked, since single }
  33. { double nodes are checked. }
  34. { assumes that enumdef is the same as orddef (same storage format) }
  35. const
  36. { should be defined depending on CPU target }
  37. {$ifdef fpc}
  38. {$ifdef cpu68k}
  39. BIG_INDEX = 8000;
  40. SMALL_INDEX = 13;
  41. {$else}
  42. BIG_INDEX = 33000;
  43. SMALL_INDEX = 13; { value should not be aligned! }
  44. {$endif}
  45. {$else}
  46. BIG_INDEX = 33000;
  47. SMALL_INDEX = 13; { value should not be aligned! }
  48. {$endif}
  49. RESULT_U8BIT = $55;
  50. RESULT_U16BIT = $500F;
  51. RESULT_S32BIT = $500F0000;
  52. RESULT_S64BIT = $500F0000;
  53. RESULT_S32REAL = 1777.12;
  54. RESULT_S64REAL = 3444.24;
  55. RESULT_BOOL8BIT = 1;
  56. RESULT_BOOL16BIT = 1;
  57. RESULT_BOOL32BIT = 1;
  58. RESULT_PCHAR = 'Hello world';
  59. RESULT_BIGSTRING = 'Hello world';
  60. RESULT_SMALLSTRING = 'H';
  61. RESULT_CHAR = 'I';
  62. RESULT_BOOLEAN = TRUE;
  63. type
  64. {$ifdef fpc}
  65. pbytearr=^byte;
  66. {$else}
  67. pbytearr=^tbytearr;
  68. tbytearr=array[0..$fffffff] of byte;
  69. {$endif}
  70. tclass1 = class
  71. end;
  72. tprocedure = procedure;
  73. tsmallrecord = packed record
  74. b: byte;
  75. w: word;
  76. end;
  77. tlargerecord = packed record
  78. b: array[1..BIG_INDEX] of byte;
  79. end;
  80. tsmallarray = packed array[1..SMALL_INDEX] of byte;
  81. tsmallsetenum =
  82. (A_A,A_B,A_C,A_D);
  83. tsmallset = set of tsmallsetenum;
  84. tlargeset = set of char;
  85. tsmallstring = string[2];
  86. var
  87. global_u8bit : byte;
  88. global_u16bit : word;
  89. global_s32bit : longint;
  90. global_s64bit : int64;
  91. global_s32real : single;
  92. global_s64real : double;
  93. global_ptr : pchar;
  94. global_proc : tprocedure;
  95. global_class : tclass1;
  96. global_bigstring : shortstring;
  97. global_boolean : boolean;
  98. global_char : char;
  99. value_u8bit : byte;
  100. value_u16bit : word;
  101. value_s32bit : longint;
  102. value_s64bit : int64;
  103. value_s32real : single;
  104. value_s64real : double;
  105. value_proc : tprocedure;
  106. value_ptr : pchar;
  107. value_class : tclass1;
  108. value_smallrec : tsmallrecord;
  109. value_largerec : tlargerecord;
  110. value_smallset : tsmallset;
  111. value_smallstring : tsmallstring;
  112. value_bigstring : shortstring;
  113. value_largeset : tlargeset;
  114. value_smallarray : tsmallarray;
  115. value_boolean : boolean;
  116. value_char : char;
  117. procedure fail;
  118. begin
  119. WriteLn('Failure.');
  120. halt(1);
  121. end;
  122. procedure clear_globals;
  123. begin
  124. global_u8bit := 0;
  125. global_u16bit := 0;
  126. global_s32bit := 0;
  127. global_s64bit := 0;
  128. global_s32real := 0.0;
  129. global_s64real := 0.0;
  130. global_ptr := nil;
  131. global_proc := nil;
  132. global_class := nil;
  133. global_bigstring := '';
  134. global_boolean := false;
  135. global_char := #0;
  136. end;
  137. procedure clear_values;
  138. begin
  139. value_u8bit := 0;
  140. value_u16bit := 0;
  141. value_s32bit := 0;
  142. value_s64bit := 0;
  143. value_s32real := 0.0;
  144. value_s64real := 0.0;
  145. value_proc := nil;
  146. value_ptr := nil;
  147. value_class := nil;
  148. fillchar(value_smallrec, sizeof(value_smallrec), #0);
  149. fillchar(value_largerec, sizeof(value_largerec), #0);
  150. value_smallset := [];
  151. value_smallstring := '';
  152. value_bigstring := '';
  153. value_largeset := [];
  154. fillchar(value_smallarray, sizeof(value_smallarray), #0);
  155. value_boolean := false;
  156. value_char:=#0;
  157. end;
  158. procedure testprocedure;
  159. begin
  160. end;
  161. function getu8bit : byte;
  162. begin
  163. getu8bit:=RESULT_U8BIT;
  164. end;
  165. function getu16bit: word;
  166. begin
  167. getu16bit:=RESULT_U16BIT;
  168. end;
  169. function gets32bit: longint;
  170. begin
  171. gets32bit:=RESULT_S32BIT;
  172. end;
  173. function gets64bit: int64;
  174. begin
  175. gets64bit:=RESULT_S64BIT;
  176. end;
  177. function gets32real: single;
  178. begin
  179. gets32real:=RESULT_S32REAL;
  180. end;
  181. function gets64real: double;
  182. begin
  183. gets64real:=RESULT_S64REAL;
  184. end;
  185. {************************************************************************}
  186. { VAR PARAMETERS }
  187. {************************************************************************}
  188. procedure proc_var_s32bit(var v : longint);safecall;
  189. begin
  190. v:=RESULT_S32BIT;
  191. end;
  192. procedure proc_var_s64bit(var v: int64);safecall;
  193. begin
  194. v:=RESULT_S64BIT;
  195. end;
  196. procedure proc_var_u8bit(var v: byte);safecall;
  197. begin
  198. v:=RESULT_U8BIT;
  199. end;
  200. procedure proc_var_smallrecord(var smallrec : tsmallrecord);safecall;
  201. begin
  202. smallrec.b := RESULT_U8BIT;
  203. smallrec.w := RESULT_U16BIT;
  204. end;
  205. procedure proc_var_largerecord(var largerec : tlargerecord);safecall;
  206. begin
  207. largerec.b[1] := RESULT_U8BIT;
  208. largerec.b[2] := RESULT_U8BIT;
  209. end;
  210. procedure proc_var_smallset(var smallset : tsmallset);safecall;
  211. begin
  212. smallset := [A_A,A_D];
  213. end;
  214. procedure proc_var_largeset(var largeset : tlargeset);safecall;
  215. begin
  216. largeset:= largeset + ['I'];
  217. end;
  218. procedure proc_var_smallstring(var s:tsmallstring);safecall;
  219. begin
  220. s:=RESULT_SMALLSTRING;
  221. end;
  222. procedure proc_var_bigstring(var s:shortstring);safecall;
  223. begin
  224. s:=RESULT_BIGSTRING;
  225. end;
  226. procedure proc_var_openstring(var s: OpenString);safecall;
  227. begin
  228. global_u8bit := high(s);
  229. s:=RESULT_SMALLSTRING;
  230. end;
  231. procedure proc_var_smallarray(var arr : tsmallarray);safecall;
  232. begin
  233. arr[SMALL_INDEX] := RESULT_U8BIT;
  234. arr[1] := RESULT_U8BIT;
  235. end;
  236. procedure proc_var_smallarray_open(var arr : array of byte);safecall;
  237. begin
  238. arr[high(arr)] := RESULT_U8BIT;
  239. arr[low(arr)] := RESULT_U8BIT;
  240. end;
  241. procedure proc_var_smallarray_const_1(var arr : array of const);safecall;
  242. var
  243. i: integer;
  244. begin
  245. for i:=0 to high(arr) do
  246. begin
  247. case arr[i].vtype of
  248. vtInteger : arr[i].vinteger := RESULT_U8BIT;
  249. vtBoolean : arr[i].vboolean := RESULT_BOOLEAN;
  250. else
  251. RunError(255);
  252. end;
  253. end; {endfor}
  254. end;
  255. procedure proc_var_smallarray_const_2(var arr : array of const);safecall;
  256. var
  257. i: integer;
  258. begin
  259. if high(arr)<0 then
  260. global_u8bit := RESULT_U8BIT;
  261. end;
  262. procedure proc_var_formaldef_array(var buf);safecall;
  263. var
  264. p: pbytearr;
  265. begin
  266. { array is indexed from 1 }
  267. p := @buf;
  268. p[SMALL_INDEX-1] := RESULT_U8BIT;
  269. p[0] := RESULT_U8BIT;
  270. end;
  271. procedure proc_var_formaldef_string(var buf);safecall;
  272. var
  273. p: pbytearr;
  274. begin
  275. { array is indexed from 1 }
  276. p := @buf;
  277. p[SMALL_INDEX-1] := RESULT_U8BIT;
  278. p[0] := RESULT_U8BIT;
  279. end;
  280. {************************************************************************}
  281. { MIXED VAR PARAMETERS }
  282. {************************************************************************}
  283. procedure proc_var_s32bit_mixed(b1 : byte;var v : longint; b2: byte);safecall;
  284. begin
  285. v:=RESULT_S32BIT;
  286. value_u8bit := RESULT_U8BIT;
  287. end;
  288. procedure proc_var_s64bit_mixed(b1 : byte;var v: int64; b2: byte);safecall;
  289. begin
  290. v:=RESULT_S64BIT;
  291. value_u8bit := RESULT_U8BIT;
  292. end;
  293. procedure proc_var_u8bit_mixed(b1 : byte;var v: byte; b2: byte);safecall;
  294. begin
  295. v:=RESULT_U8BIT;
  296. value_u8bit := RESULT_U8BIT;
  297. end;
  298. procedure proc_var_smallrecord_mixed(b1 : byte; var smallrec : tsmallrecord; b2: byte);safecall;
  299. begin
  300. smallrec.b := RESULT_U8BIT;
  301. smallrec.w := RESULT_U16BIT;
  302. value_u8bit := RESULT_U8BIT;
  303. end;
  304. procedure proc_var_largerecord_mixed(b1 : byte; var largerec : tlargerecord; b2: byte);safecall;
  305. begin
  306. largerec.b[1] := RESULT_U8BIT;
  307. largerec.b[2] := RESULT_U8BIT;
  308. value_u8bit := RESULT_U8BIT;
  309. end;
  310. procedure proc_var_smallset_mixed(b1 : byte; var smallset : tsmallset; b2: byte);safecall;
  311. begin
  312. smallset := [A_A,A_D];
  313. value_u8bit := RESULT_U8BIT;
  314. end;
  315. procedure proc_var_largeset_mixed(b1 : byte; var largeset : tlargeset; b2: byte);safecall;
  316. begin
  317. largeset:= largeset + ['I'];
  318. value_u8bit := RESULT_U8BIT;
  319. end;
  320. procedure proc_var_smallstring_mixed(b1 : byte; var s:tsmallstring; b2: byte);safecall;
  321. begin
  322. s:=RESULT_SMALLSTRING;
  323. value_u8bit := RESULT_U8BIT;
  324. end;
  325. procedure proc_var_bigstring_mixed(b1 : byte; var s:shortstring; b2: byte);safecall;
  326. begin
  327. s:=RESULT_BIGSTRING;
  328. value_u8bit := RESULT_U8BIT;
  329. end;
  330. procedure proc_var_openstring_mixed(b1 : byte; var s: OpenString; b2: byte);safecall;
  331. begin
  332. global_u8bit := high(s);
  333. s:=RESULT_SMALLSTRING;
  334. value_u8bit := RESULT_U8BIT;
  335. end;
  336. procedure proc_var_smallarray_mixed(b1 : byte; var arr : tsmallarray; b2: byte);safecall;
  337. begin
  338. arr[SMALL_INDEX] := RESULT_U8BIT;
  339. arr[1] := RESULT_U8BIT;
  340. value_u8bit := RESULT_U8BIT;
  341. end;
  342. procedure proc_var_smallarray_open_mixed(b1 : byte; var arr : array of byte; b2: byte);safecall;
  343. begin
  344. arr[high(arr)] := RESULT_U8BIT;
  345. arr[low(arr)] := RESULT_U8BIT;
  346. value_u8bit := RESULT_U8BIT;
  347. end;
  348. procedure proc_var_smallarray_const_1_mixed(b1 : byte; var arr : array of const; b2: byte);safecall;
  349. var
  350. i: integer;
  351. begin
  352. for i:=0 to high(arr) do
  353. begin
  354. case arr[i].vtype of
  355. vtInteger : arr[i].vinteger := RESULT_U8BIT;
  356. vtBoolean : arr[i].vboolean := RESULT_BOOLEAN;
  357. else
  358. RunError(255);
  359. end;
  360. end; {endfor}
  361. value_u8bit := RESULT_U8BIT;
  362. end;
  363. procedure proc_var_smallarray_const_2_mixed(b1 : byte; var arr : array of const; b2: byte);safecall;
  364. var
  365. i: integer;
  366. begin
  367. if high(arr)<0 then
  368. global_u8bit := RESULT_U8BIT;
  369. value_u8bit := RESULT_U8BIT;
  370. end;
  371. procedure proc_var_formaldef_array_mixed(b1 : byte; var buf; b2: byte);safecall;
  372. var
  373. p: pbytearr;
  374. begin
  375. { array is indexed from 1 }
  376. p := @buf;
  377. p[SMALL_INDEX-1] := RESULT_U8BIT;
  378. p[0] := RESULT_U8BIT;
  379. value_u8bit := RESULT_U8BIT;
  380. end;
  381. procedure proc_var_formaldef_string_mixed(b1 : byte; var buf; b2: byte);safecall;
  382. var
  383. p: pbytearr;
  384. begin
  385. { array is indexed from 1 }
  386. p := @buf;
  387. p[SMALL_INDEX-1] := RESULT_U8BIT;
  388. p[0] := RESULT_U8BIT;
  389. value_u8bit := RESULT_U8BIT;
  390. end;
  391. var
  392. failed: boolean;
  393. pp : ^pchar;
  394. begin
  395. {***************************** NORMAL TESTS *******************************}
  396. clear_globals;
  397. clear_values;
  398. failed:=false;
  399. write('Var parameter test (src : LOC_REFERENCE (orddef)))...');
  400. proc_var_s32bit(global_s32bit);
  401. if global_s32bit <> RESULT_S32BIT then
  402. failed:=true;
  403. clear_globals;
  404. clear_values;
  405. proc_var_s64bit(global_s64bit);
  406. if global_s64bit <> RESULT_S64BIT then
  407. failed:=true;
  408. clear_globals;
  409. clear_values;
  410. proc_var_u8bit(global_u8bit);
  411. if global_u8bit <> RESULT_U8BIT then
  412. failed:=true;
  413. if failed then
  414. fail
  415. else
  416. WriteLn('Passed!');
  417. write('Var parameter test (src : LOC_REFERENCE (recorddef)))...');
  418. clear_globals;
  419. clear_values;
  420. failed := false;
  421. proc_var_smallrecord(value_smallrec);
  422. if (value_smallrec.b <> RESULT_U8BIT) or (value_smallrec.w <> RESULT_U16BIT) then
  423. failed := true;
  424. clear_globals;
  425. clear_values;
  426. proc_var_largerecord(value_largerec);
  427. if (value_largerec.b[1] <> RESULT_U8BIT) or (value_largerec.b[2] <> RESULT_U8BIT) then
  428. failed := true;
  429. if failed then
  430. fail
  431. else
  432. WriteLn('Passed!');
  433. write('var parameter test (src : LOC_REFERENCE (setdef)))...');
  434. clear_globals;
  435. clear_values;
  436. failed := false;
  437. proc_var_smallset(value_smallset);
  438. if (not (A_A in value_smallset)) or (not (A_D in value_smallset)) then
  439. failed := true;
  440. clear_globals;
  441. clear_values;
  442. proc_var_largeset(value_largeset);
  443. if not ('I' in value_largeset) then
  444. failed := true;
  445. if failed then
  446. fail
  447. else
  448. WriteLn('Passed!');
  449. write('var parameter test (src : LOC_REFERENCE (stringdef)))...');
  450. clear_globals;
  451. clear_values;
  452. failed := false;
  453. proc_var_smallstring(value_smallstring);
  454. if value_smallstring <> RESULT_SMALLSTRING then
  455. failed := true;
  456. clear_globals;
  457. clear_values;
  458. proc_var_bigstring(value_bigstring);
  459. if value_bigstring <> RESULT_BIGSTRING then
  460. failed := true;
  461. clear_globals;
  462. clear_values;
  463. proc_var_openstring(value_smallstring);
  464. if (value_smallstring <> RESULT_SMALLSTRING) or (global_u8bit <> high(value_smallstring)) then
  465. failed := true;
  466. if failed then
  467. fail
  468. else
  469. WriteLn('Passed!');
  470. write('Var parameter test (src : LOC_REFERENCE (formaldef)))...');
  471. clear_globals;
  472. clear_values;
  473. failed:=false;
  474. proc_var_formaldef_array(value_smallarray);
  475. if (value_smallarray[SMALL_INDEX] <> RESULT_U8BIT) or (value_smallarray[1] <> RESULT_U8BIT) then
  476. failed := true;
  477. if failed then
  478. fail
  479. else
  480. WriteLn('Passed!');
  481. write('Var parameter test (src : LOC_REFERENCE (arraydef)))...');
  482. clear_globals;
  483. clear_values;
  484. failed:=false;
  485. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  486. proc_var_smallarray(value_smallarray);
  487. if (value_smallarray[SMALL_INDEX] <> RESULT_U8BIT) or (value_smallarray[1] <> RESULT_U8BIT) then
  488. failed := true;
  489. clear_globals;
  490. clear_values;
  491. proc_var_smallarray_open(value_smallarray);
  492. if (value_smallarray[SMALL_INDEX] <> RESULT_U8BIT) or (value_smallarray[1] <> RESULT_U8BIT) then
  493. failed := true;
  494. (* HOW CAN ARRAY OF CONST VAR PARAMETERS BE TESTED?
  495. clear_globals;
  496. clear_values;
  497. value_u8bit := RESULT_U8BIT;
  498. value_ptr := RESULT_PCHAR;
  499. value_s64bit := RESULT_S64BIT;
  500. value_smallstring := RESULT_SMALLSTRING;
  501. value_class := tclass1.create;
  502. value_boolean := RESULT_BOOLEAN;
  503. value_char := RESULT_CHAR;
  504. value_s64real:=RESULT_S64REAL;
  505. proc_var_smallarray_var_1([value_u8bit,value_ptr,value_s64bit,value_char,value_smallstring,value_s64real,value_boolean,value_class]);
  506. if global_u8bit <> RESULT_U8BIT then
  507. failed := true;
  508. if global_char <> RESULT_CHAR then
  509. failed := true;
  510. if global_boolean <> RESULT_BOOLEAN then
  511. failed:=true;
  512. if trunc(global_s64real) <> trunc(RESULT_S64REAL) then
  513. failed := true;
  514. if global_bigstring <> RESULT_SMALLSTRING then
  515. failed := true;
  516. if global_ptr <> value_ptr then
  517. failed := true;
  518. { if value_class <> global_class then
  519. failed := true;!!!!!!!!!!!!!!!!!!!!}
  520. if global_s64bit <> RESULT_S64BIT then
  521. failed := true;
  522. if assigned(value_class) then
  523. value_class.destroy;
  524. global_u8bit := 0;
  525. proc_var_smallarray_const_2([]);
  526. if global_u8bit <> RESULT_U8BIT then
  527. failed := true;
  528. *)
  529. if failed then
  530. fail
  531. else
  532. WriteLn('Passed!');
  533. {***************************** MIXED TESTS *******************************}
  534. clear_globals;
  535. clear_values;
  536. failed:=false;
  537. write('Var parameter test (src : LOC_REFERENCE (orddef)))...');
  538. proc_var_s32bit_mixed(RESULT_U8BIT, global_s32bit, RESULT_U8BIT);
  539. if global_s32bit <> RESULT_S32BIT then
  540. failed:=true;
  541. if value_u8bit <> RESULT_U8BIT then
  542. failed := true;
  543. clear_globals;
  544. clear_values;
  545. proc_var_s64bit_mixed(RESULT_U8BIT, global_s64bit, RESULT_U8BIT);
  546. if global_s64bit <> RESULT_S64BIT then
  547. failed:=true;
  548. if value_u8bit <> RESULT_U8BIT then
  549. failed := true;
  550. clear_globals;
  551. clear_values;
  552. proc_var_u8bit_mixed(RESULT_U8BIT, global_u8bit, RESULT_U8BIT);
  553. if global_u8bit <> RESULT_U8BIT then
  554. failed:=true;
  555. if value_u8bit <> RESULT_U8BIT then
  556. failed := true;
  557. if failed then
  558. fail
  559. else
  560. WriteLn('Passed!');
  561. write('Var parameter test (src : LOC_REFERENCE (recorddef)))...');
  562. clear_globals;
  563. clear_values;
  564. failed := false;
  565. proc_var_smallrecord_mixed(RESULT_U8BIT,value_smallrec, RESULT_U8BIT);
  566. if (value_smallrec.b <> RESULT_U8BIT) or (value_smallrec.w <> RESULT_U16BIT) then
  567. failed := true;
  568. if value_u8bit <> RESULT_U8BIT then
  569. failed := true;
  570. clear_globals;
  571. clear_values;
  572. proc_var_largerecord_mixed(RESULT_U8BIT, value_largerec, RESULT_U8BIT);
  573. if (value_largerec.b[1] <> RESULT_U8BIT) or (value_largerec.b[2] <> RESULT_U8BIT) then
  574. failed := true;
  575. if value_u8bit <> RESULT_U8BIT then
  576. failed := true;
  577. if failed then
  578. fail
  579. else
  580. WriteLn('Passed!');
  581. write('var parameter test (src : LOC_REFERENCE (setdef)))...');
  582. clear_globals;
  583. clear_values;
  584. failed := false;
  585. proc_var_smallset_mixed(RESULT_U8BIT, value_smallset, RESULT_U8BIT);
  586. if (not (A_A in value_smallset)) or (not (A_D in value_smallset)) then
  587. failed := true;
  588. if value_u8bit <> RESULT_U8BIT then
  589. failed := true;
  590. clear_globals;
  591. clear_values;
  592. proc_var_largeset_mixed(RESULT_U8BIT, value_largeset, RESULT_U8BIT);
  593. if not ('I' in value_largeset) then
  594. failed := true;
  595. if value_u8bit <> RESULT_U8BIT then
  596. failed := true;
  597. if failed then
  598. fail
  599. else
  600. WriteLn('Passed!');
  601. write('var parameter test (src : LOC_REFERENCE (stringdef)))...');
  602. clear_globals;
  603. clear_values;
  604. failed := false;
  605. proc_var_smallstring_mixed(RESULT_U8BIT, value_smallstring, RESULT_U8BIT);
  606. if value_smallstring <> RESULT_SMALLSTRING then
  607. failed := true;
  608. if value_u8bit <> RESULT_U8BIT then
  609. failed := true;
  610. clear_globals;
  611. clear_values;
  612. proc_var_bigstring_mixed(RESULT_U8BIT, value_bigstring,RESULT_U8BIT);
  613. if value_bigstring <> RESULT_BIGSTRING then
  614. failed := true;
  615. if value_u8bit <> RESULT_U8BIT then
  616. failed := true;
  617. clear_globals;
  618. clear_values;
  619. proc_var_openstring_mixed(RESULT_U8BIT, value_smallstring, RESULT_U8BIT);
  620. if (value_smallstring <> RESULT_SMALLSTRING) or (global_u8bit <> high(value_smallstring)) then
  621. failed := true;
  622. if value_u8bit <> RESULT_U8BIT then
  623. failed := true;
  624. if failed then
  625. fail
  626. else
  627. WriteLn('Passed!');
  628. write('Var parameter test (src : LOC_REFERENCE (formaldef)))...');
  629. clear_globals;
  630. clear_values;
  631. failed:=false;
  632. proc_var_formaldef_array_mixed(RESULT_U8BIT, value_smallarray, RESULT_U8BIT);
  633. if (value_smallarray[SMALL_INDEX] <> RESULT_U8BIT) or (value_smallarray[1] <> RESULT_U8BIT) then
  634. failed := true;
  635. if value_u8bit <> RESULT_U8BIT then
  636. failed := true;
  637. if failed then
  638. fail
  639. else
  640. WriteLn('Passed!');
  641. write('Var parameter test (src : LOC_REFERENCE (arraydef)))...');
  642. clear_globals;
  643. clear_values;
  644. failed:=false;
  645. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  646. proc_var_smallarray_mixed(RESULT_U8BIT, value_smallarray, RESULT_U8BIT);
  647. if (value_smallarray[SMALL_INDEX] <> RESULT_U8BIT) or (value_smallarray[1] <> RESULT_U8BIT) then
  648. failed := true;
  649. if value_u8bit <> RESULT_U8BIT then
  650. failed := true;
  651. clear_globals;
  652. clear_values;
  653. proc_var_smallarray_open_mixed(RESULT_U8BIT, value_smallarray, RESULT_U8BIT);
  654. if (value_smallarray[SMALL_INDEX] <> RESULT_U8BIT) or (value_smallarray[1] <> RESULT_U8BIT) then
  655. failed := true;
  656. if value_u8bit <> RESULT_U8BIT then
  657. failed := true;
  658. if failed then
  659. fail
  660. else
  661. WriteLn('Passed!');
  662. end.
  663. {
  664. $Log$
  665. Revision 1.5 2003-04-22 10:24:29 florian
  666. * fixed defines for powerpc
  667. Revision 1.4 2002/09/22 09:08:41 carl
  668. * gets64bit was not returning an int64!
  669. Revision 1.3 2002/09/07 15:40:55 peter
  670. * old logs removed and tabs fixed
  671. Revision 1.2 2002/05/13 13:45:38 peter
  672. * updated to compile tests with kylix
  673. Revision 1.1 2002/04/13 17:51:00 carl
  674. + var parameter passing for different calling conventions
  675. }