tcalcst3.pp 22 KB

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