tcalvar3.pp 20 KB

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