tcalvar7.pp 20 KB

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