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