tcalcst9.pp 21 KB

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