tcalcst9.pp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  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. { (const parameters with saveregisters }
  19. { calling convention) }
  20. {****************************************************************}
  21. program tcalcst9;
  22. {$ifdef fpc}
  23. {$mode objfpc}
  24. {$INLINE ON}
  25. {$endif}
  26. {$R+}
  27. {$ifdef VER70}
  28. {$define tp}
  29. {$endif}
  30. { REAL should map to single or double }
  31. { so it is not checked, since single }
  32. { double nodes are checked. }
  33. { assumes that enumdef is the same as orddef (same storage format) }
  34. const
  35. { should be defined depending on CPU target }
  36. {$ifdef fpc}
  37. {$ifdef cpu68k}
  38. BIG_INDEX = 8000;
  39. SMALL_INDEX = 13;
  40. {$else}
  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. {$ifndef tp}
  64. tclass1 = class
  65. end;
  66. {$else}
  67. shortstring = string;
  68. {$endif}
  69. tprocedure = procedure;
  70. tsmallrecord = packed record
  71. b: byte;
  72. w: word;
  73. end;
  74. tlargerecord = packed record
  75. b: array[1..BIG_INDEX] of byte;
  76. end;
  77. tsmallarray = packed array[1..SMALL_INDEX] of byte;
  78. tsmallsetenum =
  79. (A_A,A_B,A_C,A_D);
  80. tsmallset = set of tsmallsetenum;
  81. tlargeset = set of char;
  82. tsmallstring = string[2];
  83. var
  84. global_u8bit : byte;
  85. global_u16bit : word;
  86. global_s32bit : longint;
  87. global_s32real : single;
  88. global_s64real : double;
  89. global_ptr : pchar;
  90. global_proc : tprocedure;
  91. global_bigstring : shortstring;
  92. global_boolean : boolean;
  93. global_char : char;
  94. value_u8bit : byte;
  95. value_u16bit : word;
  96. value_s32bit : longint;
  97. {$ifndef tp}
  98. global_class : tclass1;
  99. global_s64bit : int64;
  100. value_s64bit : int64;
  101. value_class : tclass1;
  102. {$endif}
  103. value_s32real : single;
  104. value_s64real : double;
  105. value_proc : tprocedure;
  106. value_ptr : pchar;
  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_s32real := 0.0;
  127. global_s64real := 0.0;
  128. global_ptr := nil;
  129. global_proc := nil;
  130. global_bigstring := '';
  131. global_boolean := false;
  132. global_char := #0;
  133. {$ifndef tp}
  134. global_s64bit := 0;
  135. global_class := nil;
  136. {$endif}
  137. end;
  138. procedure clear_values;
  139. begin
  140. value_u8bit := 0;
  141. value_u16bit := 0;
  142. value_s32bit := 0;
  143. value_s32real := 0.0;
  144. value_s64real := 0.0;
  145. value_proc := nil;
  146. value_ptr := nil;
  147. {$ifndef tp}
  148. value_s64bit := 0;
  149. value_class := nil;
  150. {$endif}
  151. fillchar(value_smallrec, sizeof(value_smallrec), #0);
  152. fillchar(value_largerec, sizeof(value_largerec), #0);
  153. value_smallset := [];
  154. value_smallstring := '';
  155. value_bigstring := '';
  156. value_largeset := [];
  157. fillchar(value_smallarray, sizeof(value_smallarray), #0);
  158. value_boolean := false;
  159. value_char:=#0;
  160. end;
  161. procedure testprocedure;
  162. begin
  163. end;
  164. function getu8bit : byte;
  165. begin
  166. getu8bit:=RESULT_U8BIT;
  167. end;
  168. function getu16bit: word;
  169. begin
  170. getu16bit:=RESULT_U16BIT;
  171. end;
  172. function gets32bit: longint;
  173. begin
  174. gets32bit:=RESULT_S32BIT;
  175. end;
  176. function gets64bit: int64;
  177. begin
  178. gets64bit:=RESULT_S64BIT;
  179. end;
  180. function gets32real: single;
  181. begin
  182. gets32real:=RESULT_S32REAL;
  183. end;
  184. function gets64real: double;
  185. begin
  186. gets64real:=RESULT_S64REAL;
  187. end;
  188. {************************************************************************}
  189. { CONST PARAMETERS }
  190. {************************************************************************}
  191. procedure proc_const_s32bit(const v : longint);saveregisters;
  192. begin
  193. global_s32bit := v;
  194. end;
  195. {$ifndef tp}
  196. procedure proc_const_s64bit(const v: int64);saveregisters;
  197. begin
  198. global_s64bit:= v;
  199. end;
  200. procedure proc_const_smallarray_const_1(const arr : array of const);saveregisters;
  201. var
  202. i: integer;
  203. begin
  204. for i:=0 to high(arr) do
  205. begin
  206. case arr[i].vtype of
  207. vtInteger : global_u8bit := arr[i].vinteger and $ff;
  208. vtBoolean : global_boolean := arr[i].vboolean;
  209. vtChar : global_char := arr[i].vchar;
  210. vtExtended : global_s64real := arr[i].VExtended^;
  211. vtString : global_bigstring := arr[i].VString^;
  212. vtPointer : ;
  213. vtPChar : global_ptr := arr[i].VPchar;
  214. vtObject : ;
  215. { vtClass : global_class := (arr[i].VClass) as tclass1;}
  216. vtAnsiString : ;
  217. vtInt64 : global_s64bit := arr[i].vInt64^;
  218. else
  219. RunError(255);
  220. end;
  221. end; {endfor}
  222. end;
  223. procedure proc_const_smallarray_const_2(const arr : array of const);saveregisters;
  224. var
  225. i: integer;
  226. begin
  227. if high(arr)<0 then
  228. global_u8bit := RESULT_U8BIT;
  229. end;
  230. {$endif}
  231. procedure proc_const_smallrecord(const smallrec : tsmallrecord);saveregisters;
  232. begin
  233. if (smallrec.b = RESULT_U8BIT) and (smallrec.w = RESULT_U16BIT) then
  234. global_u8bit := RESULT_U8BIT;
  235. end;
  236. procedure proc_const_largerecord(const largerec : tlargerecord);saveregisters;
  237. begin
  238. if (largerec.b[1] = RESULT_U8BIT) and (largerec.b[2] = RESULT_U8BIT) then
  239. global_u8bit := RESULT_U8BIT;
  240. end;
  241. procedure proc_const_smallset(const smallset : tsmallset);saveregisters;
  242. begin
  243. if A_D in smallset then
  244. global_u8bit := RESULT_U8BIT;
  245. end;
  246. procedure proc_const_largeset(const largeset : tlargeset);saveregisters;
  247. begin
  248. if 'I' in largeset then
  249. global_u8bit := RESULT_U8BIT;
  250. end;
  251. procedure proc_const_smallstring(const s:tsmallstring);saveregisters;
  252. begin
  253. if s = RESULT_SMALLSTRING then
  254. global_u8bit := RESULT_u8BIT;
  255. end;
  256. procedure proc_const_bigstring(const s:shortstring);saveregisters;
  257. begin
  258. if s = RESULT_BIGSTRING then
  259. global_u8bit := RESULT_u8BIT;
  260. end;
  261. procedure proc_const_smallarray(const arr : tsmallarray);saveregisters;
  262. begin
  263. if arr[SMALL_INDEX] = RESULT_U8BIT then
  264. global_u8bit := RESULT_U8BIT;
  265. end;
  266. procedure proc_const_smallarray_open(const arr : array of byte);saveregisters;
  267. begin
  268. { form 0 to N-1 indexes in open arrays }
  269. if arr[SMALL_INDEX-1] = RESULT_U8BIT then
  270. global_u8bit := RESULT_U8BIT;
  271. end;
  272. procedure proc_const_formaldef_array(const buf);saveregisters;
  273. var
  274. p: pchar;
  275. begin
  276. { array is indexed from 1 }
  277. p := @buf;
  278. global_u8bit := byte(p[SMALL_INDEX-1]);
  279. end;
  280. {************************************************************************}
  281. { MIXED CONST PARAMETERS }
  282. {************************************************************************}
  283. procedure proc_const_s32bit_mixed(b1: byte; const v : longint; b2: byte);saveregisters;
  284. begin
  285. global_s32bit := v;
  286. value_u8bit := b2;
  287. end;
  288. {$ifndef tp}
  289. procedure proc_const_s64bit_mixed(b1 : byte; const v: int64; b2: byte);saveregisters;
  290. begin
  291. global_s64bit:= v;
  292. value_u8bit := b2;
  293. end;
  294. procedure proc_const_smallarray_const_1_mixed(b1 : byte; const arr : array of const; b2: byte);saveregisters;
  295. var
  296. i: integer;
  297. begin
  298. for i:=0 to high(arr) do
  299. begin
  300. case arr[i].vtype of
  301. vtInteger : global_u8bit := arr[i].vinteger and $ff;
  302. vtBoolean : global_boolean := arr[i].vboolean;
  303. vtChar : global_char := arr[i].vchar;
  304. vtExtended : global_s64real := arr[i].VExtended^;
  305. vtString : global_bigstring := arr[i].VString^;
  306. vtPointer : ;
  307. vtPChar : global_ptr := arr[i].VPchar;
  308. vtObject : ;
  309. { vtClass : global_class := (arr[i].VClass) as tclass1;}
  310. vtAnsiString : ;
  311. vtInt64 : global_s64bit := arr[i].vInt64^;
  312. else
  313. RunError(255);
  314. end;
  315. end; {endfor}
  316. value_u8bit := b2;
  317. end;
  318. procedure proc_const_smallarray_const_2_mixed(b1: byte; const arr : array of const; b2: byte);saveregisters;
  319. var
  320. i: integer;
  321. begin
  322. if high(arr)<0 then
  323. global_u8bit := RESULT_U8BIT;
  324. value_u8bit := b2;
  325. end;
  326. {$endif}
  327. procedure proc_const_smallrecord_mixed(b1 : byte; const smallrec : tsmallrecord; b2: byte);saveregisters;
  328. begin
  329. if (smallrec.b = RESULT_U8BIT) and (smallrec.w = RESULT_U16BIT) then
  330. global_u8bit := RESULT_U8BIT;
  331. value_u8bit := b2;
  332. end;
  333. procedure proc_const_largerecord_mixed(b1: byte; const largerec : tlargerecord; b2: byte);saveregisters;
  334. begin
  335. if (largerec.b[1] = RESULT_U8BIT) and (largerec.b[2] = RESULT_U8BIT) then
  336. global_u8bit := RESULT_U8BIT;
  337. value_u8bit := b2;
  338. end;
  339. procedure proc_const_smallset_mixed(b1: byte; const smallset : tsmallset; b2: byte);saveregisters;
  340. begin
  341. if A_D in smallset then
  342. global_u8bit := RESULT_U8BIT;
  343. value_u8bit := b2;
  344. end;
  345. procedure proc_const_largeset_mixed(b1: byte; const largeset : tlargeset; b2: byte);saveregisters;
  346. begin
  347. if 'I' in largeset then
  348. global_u8bit := RESULT_U8BIT;
  349. value_u8bit := b2;
  350. end;
  351. procedure proc_const_smallstring_mixed(b1: byte; const s:tsmallstring; b2: byte);saveregisters;
  352. begin
  353. if s = RESULT_SMALLSTRING then
  354. global_u8bit := RESULT_u8BIT;
  355. value_u8bit := b2;
  356. end;
  357. procedure proc_const_bigstring_mixed(b1: byte; const s:shortstring; b2: byte);saveregisters;
  358. begin
  359. if s = RESULT_BIGSTRING then
  360. global_u8bit := RESULT_u8BIT;
  361. value_u8bit := b2;
  362. end;
  363. procedure proc_const_smallarray_mixed(b1: byte; const arr : tsmallarray; b2: byte);saveregisters;
  364. begin
  365. if arr[SMALL_INDEX] = RESULT_U8BIT then
  366. global_u8bit := RESULT_U8BIT;
  367. value_u8bit := b2;
  368. end;
  369. procedure proc_const_smallarray_open_mixed(b1: byte; const arr : array of byte; b2: byte);saveregisters;
  370. begin
  371. { form 0 to N-1 indexes in open arrays }
  372. if arr[high(arr)] = RESULT_U8BIT then
  373. global_u8bit := RESULT_U8BIT;
  374. value_u8bit := b2;
  375. end;
  376. procedure proc_const_formaldef_array_mixed(b1: byte; const buf; b2: byte);saveregisters;
  377. var
  378. p: pchar;
  379. begin
  380. { array is indexed from 1 }
  381. p := @buf;
  382. global_u8bit := byte(p[SMALL_INDEX-1]);
  383. value_u8bit := b2;
  384. end;
  385. var
  386. failed: boolean;
  387. pp : ^pchar;
  388. begin
  389. {***************************** NORMAL TESTS *******************************}
  390. write('Const parameter test (src : LOC_REGISTER (orddef)))...');
  391. clear_globals;
  392. clear_values;
  393. failed:=false;
  394. proc_const_s32bit(gets32bit);
  395. if global_s32bit <> RESULT_S32BIT then
  396. failed:=true;
  397. {$ifndef tp}
  398. proc_const_s64bit(gets64bit);
  399. if global_s64bit <> RESULT_S64BIT then
  400. failed:=true;
  401. {$endif}
  402. if failed then
  403. fail
  404. else
  405. WriteLn('Passed!');
  406. write('Const parameter test (src : LOC_REFERENCE (recorddef)))...');
  407. clear_globals;
  408. clear_values;
  409. failed := false;
  410. value_smallrec.b := RESULT_U8BIT;
  411. value_smallrec.w := RESULT_U16BIT;
  412. proc_const_smallrecord(value_smallrec);
  413. if global_u8bit <> RESULT_U8BIT then
  414. failed := true;
  415. clear_globals;
  416. clear_values;
  417. fillchar(value_largerec,sizeof(value_largerec),RESULT_U8BIT);
  418. proc_const_largerecord(value_largerec);
  419. if global_u8bit <> RESULT_U8BIT then
  420. failed := true;
  421. if failed then
  422. fail
  423. else
  424. WriteLn('Passed!');
  425. write('const parameter test (src : LOC_REFERENCE (setdef)))...');
  426. clear_globals;
  427. clear_values;
  428. failed := false;
  429. value_smallset := [A_A,A_D];
  430. proc_const_smallset(value_smallset);
  431. if global_u8bit <> RESULT_U8BIT then
  432. failed := true;
  433. clear_globals;
  434. clear_values;
  435. value_largeset := ['I'];
  436. proc_const_largeset(value_largeset);
  437. if global_u8bit <> RESULT_U8BIT then
  438. failed := true;
  439. if failed then
  440. fail
  441. else
  442. WriteLn('Passed!');
  443. write('const parameter test (src : LOC_REFERENCE (stringdef)))...');
  444. clear_globals;
  445. clear_values;
  446. failed := false;
  447. value_smallstring := RESULT_SMALLSTRING;
  448. proc_const_smallstring(value_smallstring);
  449. if global_u8bit <> RESULT_U8BIT then
  450. failed := true;
  451. clear_globals;
  452. clear_values;
  453. value_bigstring := RESULT_BIGSTRING;
  454. proc_const_bigstring(value_bigstring);
  455. if global_u8bit <> RESULT_U8BIT then
  456. failed := true;
  457. if failed then
  458. fail
  459. else
  460. WriteLn('Passed!');
  461. write('Const parameter test (src : LOC_REFERENCE (formaldef)))...');
  462. clear_globals;
  463. clear_values;
  464. failed:=false;
  465. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  466. proc_const_formaldef_array(value_smallarray);
  467. if global_u8bit <> RESULT_U8BIT then
  468. failed := true;
  469. if failed then
  470. fail
  471. else
  472. WriteLn('Passed!');
  473. write('Const parameter test (src : LOC_REFERENCE (arraydef)))...');
  474. clear_globals;
  475. clear_values;
  476. failed:=false;
  477. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  478. proc_const_smallarray(value_smallarray);
  479. if global_u8bit <> RESULT_U8BIT then
  480. failed := true;
  481. clear_globals;
  482. clear_values;
  483. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  484. proc_const_smallarray_open(value_smallarray);
  485. if global_u8bit <> RESULT_U8BIT then
  486. failed := true;
  487. {$ifndef tp}
  488. clear_globals;
  489. clear_values;
  490. value_u8bit := RESULT_U8BIT;
  491. value_ptr := RESULT_PCHAR;
  492. value_s64bit := RESULT_S64BIT;
  493. value_smallstring := RESULT_SMALLSTRING;
  494. value_class := tclass1.create;
  495. value_boolean := RESULT_BOOLEAN;
  496. value_char := RESULT_CHAR;
  497. value_s64real:=RESULT_S64REAL;
  498. proc_const_smallarray_const_1([value_u8bit,value_ptr,value_s64bit,value_char,value_smallstring,value_s64real,
  499. value_boolean,value_class]);
  500. if global_u8bit <> RESULT_U8BIT then
  501. failed := true;
  502. if global_char <> RESULT_CHAR then
  503. failed := true;
  504. if global_boolean <> RESULT_BOOLEAN then
  505. failed:=true;
  506. if trunc(global_s64real) <> trunc(RESULT_S64REAL) then
  507. failed := true;
  508. if global_bigstring <> RESULT_SMALLSTRING then
  509. failed := true;
  510. if global_ptr <> value_ptr then
  511. failed := true;
  512. { if value_class <> global_class then
  513. failed := true;!!!!!!!!!!!!!!!!!!!!}
  514. if global_s64bit <> RESULT_S64BIT then
  515. failed := true;
  516. if assigned(value_class) then
  517. value_class.destroy;
  518. global_u8bit := 0;
  519. proc_const_smallarray_const_2([]);
  520. if global_u8bit <> RESULT_U8BIT then
  521. failed := true;
  522. {$endif}
  523. if failed then
  524. fail
  525. else
  526. WriteLn('Passed!');
  527. {***************************** MIXED TESTS *******************************}
  528. write('Mixed const parameter test (src : LOC_REGISTER (orddef)))...');
  529. clear_globals;
  530. clear_values;
  531. failed:=false;
  532. proc_const_s32bit_mixed(RESULT_U8BIT,gets32bit,RESULT_U8BIT);
  533. if global_s32bit <> RESULT_S32BIT then
  534. failed:=true;
  535. if value_u8bit <> RESULT_U8BIT then
  536. failed := true;
  537. {$ifndef tp}
  538. proc_const_s64bit_mixed(RESULT_U8BIT,gets64bit,RESULT_U8BIT);
  539. if global_s64bit <> RESULT_S64BIT then
  540. failed:=true;
  541. if value_u8bit <> RESULT_U8BIT then
  542. failed := true;
  543. {$endif}
  544. if failed then
  545. fail
  546. else
  547. WriteLn('Passed!');
  548. write('Mixed const parameter test (src : LOC_REFERENCE (recorddef)))...');
  549. clear_globals;
  550. clear_values;
  551. failed := false;
  552. value_smallrec.b := RESULT_U8BIT;
  553. value_smallrec.w := RESULT_U16BIT;
  554. proc_const_smallrecord_mixed(RESULT_U8BIT,value_smallrec,RESULT_U8BIT);
  555. if global_u8bit <> RESULT_U8BIT then
  556. failed := true;
  557. if value_u8bit <> RESULT_U8BIT then
  558. failed := true;
  559. clear_globals;
  560. clear_values;
  561. fillchar(value_largerec,sizeof(value_largerec),RESULT_U8BIT);
  562. proc_const_largerecord_mixed(RESULT_U8BIT,value_largerec,RESULT_U8BIT);
  563. if global_u8bit <> RESULT_U8BIT then
  564. failed := true;
  565. if value_u8bit <> RESULT_U8BIT then
  566. failed := true;
  567. if failed then
  568. fail
  569. else
  570. WriteLn('Passed!');
  571. write('Mixed const parameter test (src : LOC_REFERENCE (setdef)))...');
  572. clear_globals;
  573. clear_values;
  574. failed := false;
  575. value_smallset := [A_A,A_D];
  576. proc_const_smallset_mixed(RESULT_U8BIT,value_smallset,RESULT_U8BIT);
  577. if global_u8bit <> RESULT_U8BIT then
  578. failed := true;
  579. if value_u8bit <> RESULT_U8BIT then
  580. failed := true;
  581. clear_globals;
  582. clear_values;
  583. value_largeset := ['I'];
  584. proc_const_largeset_mixed(RESULT_U8BIT,value_largeset,RESULT_U8BIT);
  585. if global_u8bit <> RESULT_U8BIT 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('Mixed const parameter test (src : LOC_REFERENCE (stringdef)))...');
  594. clear_globals;
  595. clear_values;
  596. failed := false;
  597. value_smallstring := RESULT_SMALLSTRING;
  598. proc_const_smallstring_mixed(RESULT_U8BIT,value_smallstring,RESULT_U8BIT);
  599. if global_u8bit <> RESULT_U8BIT then
  600. failed := true;
  601. if value_u8bit <> RESULT_U8BIT then
  602. failed := true;
  603. clear_globals;
  604. clear_values;
  605. value_bigstring := RESULT_BIGSTRING;
  606. proc_const_bigstring_mixed(RESULT_U8BIT,value_bigstring,RESULT_U8BIT);
  607. if global_u8bit <> RESULT_U8BIT then
  608. failed := true;
  609. if value_u8bit <> RESULT_U8BIT then
  610. failed := true;
  611. if failed then
  612. fail
  613. else
  614. WriteLn('Passed!');
  615. write('Mixed const parameter test (src : LOC_REFERENCE (formaldef)))...');
  616. clear_globals;
  617. clear_values;
  618. failed:=false;
  619. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  620. proc_const_formaldef_array_mixed(RESULT_U8BIT,value_smallarray,RESULT_U8BIT);
  621. if global_u8bit <> RESULT_U8BIT then
  622. failed := true;
  623. if value_u8bit <> RESULT_U8BIT then
  624. failed := true;
  625. if failed then
  626. fail
  627. else
  628. WriteLn('Passed!');
  629. write('Mixed const parameter test (src : LOC_REFERENCE (arraydef)))...');
  630. clear_globals;
  631. clear_values;
  632. failed:=false;
  633. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  634. proc_const_smallarray_mixed(RESULT_U8BIt,value_smallarray,RESULT_U8BIT);
  635. if global_u8bit <> RESULT_U8BIT then
  636. failed := true;
  637. if value_u8bit <> RESULT_U8BIT then
  638. failed := true;
  639. clear_globals;
  640. clear_values;
  641. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  642. proc_const_smallarray_open_mixed(RESULT_U8BIT,value_smallarray,RESULT_U8BIT);
  643. if global_u8bit <> RESULT_U8BIT then
  644. failed := true;
  645. if value_u8bit <> RESULT_U8BIT then
  646. failed := true;
  647. {$ifndef tp}
  648. clear_globals;
  649. clear_values;
  650. value_u8bit := RESULT_U8BIT;
  651. value_ptr := RESULT_PCHAR;
  652. value_s64bit := RESULT_S64BIT;
  653. value_smallstring := RESULT_SMALLSTRING;
  654. value_class := tclass1.create;
  655. value_boolean := RESULT_BOOLEAN;
  656. value_char := RESULT_CHAR;
  657. value_s64real:=RESULT_S64REAL;
  658. proc_const_smallarray_const_1_mixed(RESULT_U8BIT, [value_u8bit,value_ptr,value_s64bit,value_char,value_smallstring,
  659. value_s64real,value_boolean,value_class],RESULT_U8BIT);
  660. if global_u8bit <> RESULT_U8BIT then
  661. failed := true;
  662. if global_char <> RESULT_CHAR then
  663. failed := true;
  664. if global_boolean <> RESULT_BOOLEAN then
  665. failed:=true;
  666. if trunc(global_s64real) <> trunc(RESULT_S64REAL) then
  667. failed := true;
  668. if global_bigstring <> RESULT_SMALLSTRING then
  669. failed := true;
  670. if global_ptr <> value_ptr then
  671. failed := true;
  672. { if value_class <> global_class then
  673. failed := true;!!!!!!!!!!!!!!!!!!!!}
  674. if global_s64bit <> RESULT_S64BIT then
  675. failed := true;
  676. if assigned(value_class) then
  677. value_class.destroy;
  678. if value_u8bit <> RESULT_U8BIT then
  679. failed := true;
  680. global_u8bit := 0;
  681. proc_const_smallarray_const_2_mixed(RESULT_U8BIT,[],RESULT_U8BIT);
  682. if global_u8bit <> RESULT_U8BIT then
  683. failed := true;
  684. if value_u8bit <> RESULT_U8BIT then
  685. failed := true;
  686. {$endif}
  687. if failed then
  688. fail
  689. else
  690. WriteLn('Passed!');
  691. end.
  692. {
  693. $Log$
  694. Revision 1.5 2003-04-22 10:24:29 florian
  695. * fixed defines for powerpc
  696. Revision 1.4 2002/09/22 09:08:41 carl
  697. * gets64bit was not returning an int64!
  698. Revision 1.3 2002/09/07 15:40:51 peter
  699. * old logs removed and tabs fixed
  700. Revision 1.2 2002/05/13 13:45:36 peter
  701. * updated to compile tests with kylix
  702. Revision 1.1 2002/04/13 17:47:06 carl
  703. + constant parameter passing for different calling conventions
  704. }