tcalvar1.pp 21 KB

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