tcalvar7.pp 20 KB

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