tcalvar3.pp 20 KB

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