tcalvar1.pp 19 KB

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