tcalcst5.pp 21 KB

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