tcalvar5.pp 20 KB

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