tcalvar6.pp 20 KB

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