objpas.pp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2000 by the Free Pascal development team
  4. This unit makes Free Pascal as much as possible Delphi compatible
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$Mode ObjFpc}
  12. {$I-}
  13. {$ifndef Unix}
  14. {$S-}
  15. {$endif}
  16. unit objpas;
  17. interface
  18. { first, in object pascal, the integer type must be redefined }
  19. const
  20. MaxInt = MaxLongint;
  21. type
  22. Integer = longint;
  23. PInteger = ^Integer;
  24. { Ansistring are the default }
  25. PString = PAnsiString;
  26. { array types }
  27. {$ifdef CPU16}
  28. IntegerArray = array[0..$eff] of Integer;
  29. {$else CPU16}
  30. IntegerArray = array[0..$effffff] of Integer;
  31. {$endif CPU16}
  32. TIntegerArray = IntegerArray;
  33. PIntegerArray = ^IntegerArray;
  34. {$ifdef CPU16}
  35. PointerArray = array [0..16*1024-2] of Pointer;
  36. {$else CPU16}
  37. PointerArray = array [0..512*1024*1024-2] of Pointer;
  38. {$endif CPU16}
  39. TPointerArray = PointerArray;
  40. PPointerArray = ^PointerArray;
  41. TBoundArray = array of integer;
  42. {$ifdef FPC_HAS_FEATURE_CLASSES}
  43. Var
  44. ExceptionClass: TClass; { Exception base class (must actually be Exception, defined in sysutils ) }
  45. {$endif FPC_HAS_FEATURE_CLASSES}
  46. {****************************************************************************
  47. Compatibility routines.
  48. ****************************************************************************}
  49. {$ifdef FPC_HAS_FEATURE_FILEIO}
  50. { Untyped file support }
  51. {$ifdef FPC_UNICODE_RTL}
  52. Procedure AssignFile(out f:File;const Name:UnicodeString);
  53. Procedure AssignFile(out f:File;const Name:RawByteString);
  54. {$else}
  55. Procedure AssignFile(out f:File;const Name:string);
  56. Procedure AssignFile(out f:File;p:pchar);
  57. Procedure AssignFile(out f:File;c:char);
  58. {$endif}
  59. Procedure CloseFile(var f:File);
  60. {$endif FPC_HAS_FEATURE_FILEIO}
  61. {$ifdef FPC_HAS_FEATURE_TEXTIO}
  62. { Text file support }
  63. {$ifdef FPC_UNICODE_RTL}
  64. Procedure AssignFile(out f:Text;const Name:UnicodeString);
  65. Procedure AssignFile(out f:Text;const Name:RawByteString);
  66. {$else}
  67. Procedure AssignFile(out t:Text;const s:string);
  68. Procedure AssignFile(out t:Text;p:pchar);
  69. Procedure AssignFile(out t:Text;c:char);
  70. {$endif}
  71. Procedure CloseFile(Var t:Text);
  72. {$endif FPC_HAS_FEATURE_TEXTIO}
  73. {$ifdef FPC_HAS_FEATURE_FILEIO}
  74. { Typed file supoort }
  75. {$ifdef FPC_UNICODE_RTL}
  76. Procedure AssignFile(out f:TypedFile;const Name:UnicodeString);
  77. Procedure AssignFile(out f:TypedFile;const Name:RawByteString);
  78. {$else}
  79. Procedure AssignFile(out f:TypedFile;const Name:string);
  80. Procedure AssignFile(out f:TypedFile;p:pchar);
  81. Procedure AssignFile(out f:TypedFile;c:char);
  82. {$endif}
  83. {$endif FPC_HAS_FEATURE_FILEIO}
  84. {$if defined(FPC_HAS_FEATURE_COMMANDARGS) and not defined(FPC_UNICODE_RTL)}
  85. { ParamStr should return also an ansistring }
  86. Function ParamStr(Param : Integer) : Ansistring;
  87. {$endif FPC_HAS_FEATURE_COMMANDARGS}
  88. {$if defined(FPC_HAS_FEATURE_FILEIO) and defined(FPC_HAS_FEATURE_ANSISTRINGS) and not defined(FPC_UNICODE_RTL)}
  89. Procedure MkDir(s:ansistring);overload;
  90. Procedure RmDir(s:ansistring);overload;
  91. Procedure ChDir(s:ansistring);overload;
  92. {$endif defined(FPC_HAS_FEATURE_FILEIO) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
  93. {****************************************************************************
  94. Resource strings.
  95. ****************************************************************************}
  96. {$ifdef FPC_HAS_FEATURE_RESOURCES}
  97. type
  98. TResourceIterator = Function (Name,Value : AnsiString; Hash : Longint; arg:pointer) : AnsiString;
  99. Function Hash(S : AnsiString) : LongWord;
  100. Procedure ResetResourceTables;
  101. Procedure FinalizeResourceTables;
  102. Procedure SetResourceStrings (SetFunction : TResourceIterator;arg:pointer);
  103. Procedure SetUnitResourceStrings (const UnitName:string;SetFunction : TResourceIterator;arg:pointer);
  104. {$ifndef RESSTRSECTIONS}
  105. Function ResourceStringTableCount : Longint;
  106. Function ResourceStringCount(TableIndex : longint) : longint;
  107. Function GetResourceStringName(TableIndex,StringIndex : Longint) : Ansistring;
  108. Function GetResourceStringHash(TableIndex,StringIndex : Longint) : Longint;
  109. Function GetResourceStringDefaultValue(TableIndex,StringIndex : Longint) : AnsiString;
  110. Function GetResourceStringCurrentValue(TableIndex,StringIndex : Longint) : AnsiString;
  111. Function SetResourceStringValue(TableIndex,StringIndex : longint; Value : Ansistring) : Boolean;
  112. {$endif RESSTRSECTIONS}
  113. { Delphi compatibility }
  114. type
  115. PResStringRec=^AnsiString;
  116. TResStringRec=AnsiString;
  117. Function LoadResString(p:PResStringRec):AnsiString;
  118. {$endif FPC_HAS_FEATURE_RESOURCES}
  119. implementation
  120. {****************************************************************************
  121. Compatibility routines.
  122. ****************************************************************************}
  123. {$ifdef FPC_HAS_FEATURE_FILEIO}
  124. {$ifndef FPC_UNICODE_RTL}
  125. Procedure MkDirpchar(s: pchar;len:sizeuint);[IOCheck]; external name 'FPC_SYS_MKDIR';
  126. Procedure ChDirpchar(s: pchar;len:sizeuint);[IOCheck]; external name 'FPC_SYS_CHDIR';
  127. Procedure RmDirpchar(s: pchar;len:sizeuint);[IOCheck]; external name 'FPC_SYS_RMDIR';
  128. {$endif}
  129. { Untyped file support }
  130. {$ifdef FPC_UNICODE_RTL}
  131. Procedure AssignFile(out f:File;const Name:RawBytestring);
  132. begin
  133. System.Assign (F,Name);
  134. end;
  135. Procedure AssignFile(out f:File;const Name:UnicodeString);
  136. begin
  137. System.Assign (F,Name);
  138. end;
  139. {$else}
  140. Procedure AssignFile(out f:File;const Name:string);
  141. begin
  142. System.Assign (F,Name);
  143. end;
  144. Procedure AssignFile(out f:File;p:pchar);
  145. begin
  146. System.Assign (F,P);
  147. end;
  148. Procedure AssignFile(out f:File;c:char);
  149. begin
  150. System.Assign (F,C);
  151. end;
  152. {$endif}
  153. Procedure CloseFile(Var f:File); [IOCheck];
  154. begin
  155. { Catch Runtime error/Exception }
  156. System.Close(f);
  157. end;
  158. {$endif FPC_HAS_FEATURE_FILEIO}
  159. {$ifdef FPC_HAS_FEATURE_TEXTIO}
  160. { Text file support }
  161. {$ifdef FPC_UNICODE_RTL}
  162. Procedure AssignFile(out f:Text;const Name:RawBytestring);
  163. begin
  164. System.Assign (F,Name);
  165. end;
  166. Procedure AssignFile(out f:Text;const Name:UnicodeString);
  167. begin
  168. System.Assign (F,Name);
  169. end;
  170. {$else}
  171. Procedure AssignFile(out t:Text;const s:string);
  172. begin
  173. System.Assign (T,S);
  174. end;
  175. Procedure AssignFile(out t:Text;p:pchar);
  176. begin
  177. System.Assign (T,P);
  178. end;
  179. Procedure AssignFile(out t:Text;c:char);
  180. begin
  181. System.Assign (T,C);
  182. end;
  183. {$endif}
  184. Procedure CloseFile(Var t:Text); [IOCheck];
  185. begin
  186. { Catch Runtime error/Exception }
  187. System.Close(T);
  188. end;
  189. {$endif FPC_HAS_FEATURE_TEXTIO}
  190. {$ifdef FPC_HAS_FEATURE_FILEIO}
  191. { Typed file support }
  192. {$ifdef FPC_UNICODE_RTL}
  193. Procedure AssignFile(out f:TypedFile;const Name:RawBytestring);
  194. begin
  195. System.Assign (F,Name);
  196. end;
  197. Procedure AssignFile(out f:TypedFile;const Name:UnicodeString);
  198. begin
  199. System.Assign (F,Name);
  200. end;
  201. {$else}
  202. Procedure AssignFile(out f:TypedFile;const Name:string);
  203. begin
  204. system.Assign(F,Name);
  205. end;
  206. Procedure AssignFile(out f:TypedFile;p:pchar);
  207. begin
  208. system.Assign (F,p);
  209. end;
  210. Procedure AssignFile(out f:TypedFile;c:char);
  211. begin
  212. system.Assign (F,C);
  213. end;
  214. {$endif}
  215. {$endif FPC_HAS_FEATURE_FILEIO}
  216. {$if defined(FPC_HAS_FEATURE_COMMANDARGS) and not defined(FPC_UNICODE_RTL)}
  217. Function ParamStr(Param : Integer) : Ansistring;
  218. Var Len : longint;
  219. begin
  220. {
  221. Paramstr(0) should return the name of the binary.
  222. Since this functionality is included in the system unit,
  223. we fetch it from there.
  224. Normally, pathnames are less than 255 chars anyway,
  225. so this will work correct in 99% of all cases.
  226. In time, the system unit should get a GetExeName call.
  227. }
  228. if (Param=0) then
  229. Result:=System.Paramstr(0)
  230. else if (Param>0) and (Param<argc) then
  231. begin
  232. Len:=0;
  233. While Argv[Param][Len]<>#0 do
  234. Inc(len);
  235. SetLength(Result,Len);
  236. If Len>0 then
  237. Move(Argv[Param][0],Result[1],Len);
  238. end
  239. else
  240. paramstr:='';
  241. end;
  242. {$endif FPC_HAS_FEATURE_COMMANDARGS}
  243. {$if defined(FPC_HAS_FEATURE_FILEIO) and defined(FPC_HAS_FEATURE_ANSISTRINGS) and not defined(FPC_UNICODE_RTL)}
  244. { xxDirPChar procedures can adjust directory separators in supplied string (at least
  245. Windows implementation does so). Therefore full copy of argument is needed,
  246. just passing by value isn't enough because it won't copy a string literal. }
  247. Procedure MkDir(s:ansistring);[IOCheck];
  248. begin
  249. UniqueString(s);
  250. mkdirpchar(pchar(s),length(s));
  251. end;
  252. Procedure RmDir(s:ansistring);[IOCheck];
  253. begin
  254. UniqueString(s);
  255. RmDirpchar(pchar(s),length(s));
  256. end;
  257. Procedure ChDir(s:ansistring);[IOCheck];
  258. begin
  259. UniqueString(s);
  260. ChDirpchar(pchar(s),length(s));
  261. end;
  262. {$endif defined(FPC_HAS_FEATURE_FILEIO) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
  263. {$ifdef FPC_HAS_FEATURE_RESOURCES}
  264. { ---------------------------------------------------------------------
  265. ResourceString support
  266. ---------------------------------------------------------------------}
  267. Function Hash(S : AnsiString) : LongWord;
  268. Var
  269. thehash,g,I : LongWord;
  270. begin
  271. thehash:=0;
  272. For I:=1 to Length(S) do { 0 terminated }
  273. begin
  274. thehash:=thehash shl 4;
  275. inc(theHash,Ord(S[i]));
  276. g:=thehash and LongWord($f shl 28);
  277. if g<>0 then
  278. begin
  279. thehash:=thehash xor (g shr 24);
  280. thehash:=thehash xor g;
  281. end;
  282. end;
  283. If theHash=0 then
  284. Hash:=$ffffffff
  285. else
  286. Hash:=TheHash;
  287. end;
  288. {$ifdef RESSTRSECTIONS}
  289. Type
  290. PResourceStringRecord = ^TResourceStringRecord;
  291. TResourceStringRecord = Packed Record
  292. Name,
  293. CurrentValue,
  294. DefaultValue : AnsiString;
  295. HashValue : LongWord;
  296. {$ifdef cpu64}
  297. Dummy : LongWord; // alignment
  298. {$endif cpu64}
  299. end;
  300. TResourceStringTableList = Packed Record
  301. Count : ptrint;
  302. Tables : Array[{$ifdef cpu16}Byte{$else cpu16}Word{$endif cpu16}] of record
  303. TableStart,
  304. TableEnd : PResourceStringRecord;
  305. end;
  306. end;
  307. { Support for string constants initialized with resourcestrings }
  308. {$ifdef FPC_HAS_RESSTRINITS}
  309. PResStrInitEntry = ^TResStrInitEntry;
  310. TResStrInitEntry = record
  311. Addr: PPointer;
  312. Data: PResourceStringRecord;
  313. end;
  314. TResStrInitTable = packed record
  315. Count: longint;
  316. Tables: packed array[1..{$ifdef cpu16}8191{$else cpu16}32767{$endif cpu16}] of PResStrInitEntry;
  317. end;
  318. var
  319. ResStrInitTable : TResStrInitTable; external name 'FPC_RESSTRINITTABLES';
  320. procedure UpdateResourceStringRefs;
  321. var
  322. i: Longint;
  323. ptable: PResStrInitEntry;
  324. begin
  325. for i:=1 to ResStrInitTable.Count do
  326. begin
  327. ptable:=ResStrInitTable.Tables[i];
  328. while Assigned(ptable^.Addr) do
  329. begin
  330. AnsiString(ptable^.Addr^):=ptable^.Data^.CurrentValue;
  331. Inc(ptable);
  332. end;
  333. end;
  334. end;
  335. {$endif FPC_HAS_RESSTRINITS}
  336. Var
  337. ResourceStringTable : TResourceStringTableList; External Name 'FPC_RESOURCESTRINGTABLES';
  338. Procedure SetResourceStrings (SetFunction : TResourceIterator;arg:pointer);
  339. Var
  340. ResStr : PResourceStringRecord;
  341. i : Longint;
  342. s : AnsiString;
  343. begin
  344. With ResourceStringTable do
  345. begin
  346. For i:=0 to Count-1 do
  347. begin
  348. ResStr:=Tables[I].TableStart;
  349. { Skip first entry (name of the Unit) }
  350. inc(ResStr);
  351. while ResStr<Tables[I].TableEnd do
  352. begin
  353. s:=SetFunction(ResStr^.Name,ResStr^.DefaultValue,Longint(ResStr^.HashValue),arg);
  354. if s<>'' then
  355. ResStr^.CurrentValue:=s;
  356. inc(ResStr);
  357. end;
  358. end;
  359. end;
  360. {$ifdef FPC_HAS_RESSTRINITS}
  361. UpdateResourceStringRefs;
  362. {$endif FPC_HAS_RESSTRINITS}
  363. end;
  364. Procedure SetUnitResourceStrings (const UnitName:string;SetFunction : TResourceIterator;arg:pointer);
  365. Var
  366. ResStr : PResourceStringRecord;
  367. i : Longint;
  368. s,
  369. UpUnitName : AnsiString;
  370. begin
  371. With ResourceStringTable do
  372. begin
  373. UpUnitName:=UpCase(UnitName);
  374. For i:=0 to Count-1 do
  375. begin
  376. ResStr:=Tables[I].TableStart;
  377. { Check name of the Unit }
  378. if ResStr^.Name<>UpUnitName then
  379. continue;
  380. inc(ResStr);
  381. while ResStr<Tables[I].TableEnd do
  382. begin
  383. s:=SetFunction(ResStr^.Name,ResStr^.DefaultValue,Longint(ResStr^.HashValue),arg);
  384. if s<>'' then
  385. ResStr^.CurrentValue:=s;
  386. inc(ResStr);
  387. end;
  388. end;
  389. end;
  390. {$ifdef FPC_HAS_RESSTRINITS}
  391. { Resourcestrings of one unit may be referenced from other units,
  392. so updating everything is the only option. }
  393. UpdateResourceStringRefs;
  394. {$endif FPC_HAS_RESSTRINITS}
  395. end;
  396. Procedure ResetResourceTables;
  397. Var
  398. ResStr : PResourceStringRecord;
  399. i : Longint;
  400. begin
  401. With ResourceStringTable do
  402. begin
  403. For i:=0 to Count-1 do
  404. begin
  405. ResStr:=Tables[I].TableStart;
  406. { Skip first entry (name of the Unit) }
  407. inc(ResStr);
  408. while ResStr<Tables[I].TableEnd do
  409. begin
  410. ResStr^.CurrentValue:=ResStr^.DefaultValue;
  411. inc(ResStr);
  412. end;
  413. end;
  414. end;
  415. end;
  416. Procedure FinalizeResourceTables;
  417. Var
  418. ResStr : PResourceStringRecord;
  419. i : Longint;
  420. begin
  421. With ResourceStringTable do
  422. begin
  423. For i:=0 to Count-1 do
  424. begin
  425. ResStr:=Tables[I].TableStart;
  426. { Skip first entry (name of the Unit) }
  427. inc(ResStr);
  428. while ResStr<Tables[I].TableEnd do
  429. begin
  430. ResStr^.CurrentValue:='';
  431. inc(ResStr);
  432. end;
  433. end;
  434. end;
  435. end;
  436. {$else RESSTRSECTIONS}
  437. Type
  438. PResourceStringRecord = ^TResourceStringRecord;
  439. TResourceStringRecord = Packed Record
  440. DefaultValue,
  441. CurrentValue : AnsiString;
  442. HashValue : LongWord;
  443. Name : AnsiString;
  444. end;
  445. TResourceStringTable = Packed Record
  446. Count : longint;
  447. Resrec : Array[Word] of TResourceStringRecord;
  448. end;
  449. PResourceStringTable = ^TResourceStringTable;
  450. TResourceTableList = Packed Record
  451. Count : longint;
  452. Tables : Array[Word] of PResourceStringTable;
  453. end;
  454. Var
  455. ResourceStringTable : TResourceTablelist; External Name 'FPC_RESOURCESTRINGTABLES';
  456. Function GetResourceString(Const TheTable: TResourceStringTable;Index : longint) : AnsiString;[Public,Alias : 'FPC_GETRESOURCESTRING'];
  457. begin
  458. If (Index>=0) and (Index<TheTAble.Count) then
  459. Result:=TheTable.ResRec[Index].CurrentValue
  460. else
  461. Result:='';
  462. end;
  463. Procedure SetResourceStrings (SetFunction : TResourceIterator;arg:pointer);
  464. Var I,J : longint;
  465. begin
  466. With ResourceStringTable do
  467. For I:=0 to Count-1 do
  468. With Tables[I]^ do
  469. For J:=0 to Count-1 do
  470. With ResRec[J] do
  471. CurrentValue:=SetFunction(Name,DefaultValue,Longint(HashValue),arg);
  472. end;
  473. Procedure SetUnitResourceStrings (const UnitName:string;SetFunction : TResourceIterator;arg:pointer);
  474. begin
  475. SetResourceStrings (SetFunction,arg);
  476. end;
  477. Procedure ResetResourceTables;
  478. Var I,J : longint;
  479. begin
  480. With ResourceStringTable do
  481. For I:=0 to Count-1 do
  482. With Tables[I]^ do
  483. For J:=0 to Count-1 do
  484. With ResRec[J] do
  485. CurrentValue:=DefaultValue;
  486. end;
  487. Procedure FinalizeResourceTables;
  488. Var I,J : longint;
  489. begin
  490. With ResourceStringTable do
  491. For I:=0 to Count-1 do
  492. With Tables[I]^ do
  493. For J:=0 to Count-1 do
  494. With ResRec[J] do
  495. CurrentValue:='';
  496. end;
  497. Function ResourceStringTableCount : Longint;
  498. begin
  499. Result:=ResourceStringTable.Count;
  500. end;
  501. Function CheckTableIndex (Index: longint) : Boolean;
  502. begin
  503. Result:=(Index<ResourceStringTable.Count) and (Index>=0)
  504. end;
  505. Function CheckStringIndex (TableIndex,Index: longint) : Boolean;
  506. begin
  507. Result:=(TableIndex<ResourceStringTable.Count) and (TableIndex>=0) and
  508. (Index<ResourceStringTable.Tables[TableIndex]^.Count) and (Index>=0)
  509. end;
  510. Function ResourceStringCount(TableIndex : longint) : longint;
  511. begin
  512. If not CheckTableIndex(TableIndex) then
  513. Result:=-1
  514. else
  515. Result:=ResourceStringTable.Tables[TableIndex]^.Count;
  516. end;
  517. Function GetResourceStringName(TableIndex,StringIndex : Longint) : Ansistring;
  518. begin
  519. If not CheckStringIndex(Tableindex,StringIndex) then
  520. Result:=''
  521. else
  522. result:=ResourceStringTable.Tables[TableIndex]^.ResRec[StringIndex].Name;
  523. end;
  524. Function GetResourceStringHash(TableIndex,StringIndex : Longint) : Longint;
  525. begin
  526. If not CheckStringIndex(Tableindex,StringIndex) then
  527. Result:=0
  528. else
  529. result:=ResourceStringTable.Tables[TableIndex]^.ResRec[StringIndex].HashValue;
  530. end;
  531. Function GetResourceStringDefaultValue(TableIndex,StringIndex : Longint) : AnsiString;
  532. begin
  533. If not CheckStringIndex(Tableindex,StringIndex) then
  534. Result:=''
  535. else
  536. result:=ResourceStringTable.Tables[TableIndex]^.ResRec[StringIndex].DefaultValue;
  537. end;
  538. Function GetResourceStringCurrentValue(TableIndex,StringIndex : Longint) : AnsiString;
  539. begin
  540. If not CheckStringIndex(Tableindex,StringIndex) then
  541. Result:=''
  542. else
  543. result:=ResourceStringTable.Tables[TableIndex]^.ResRec[StringIndex].CurrentValue;
  544. end;
  545. Function SetResourceStringValue(TableIndex,StringIndex : longint; Value : Ansistring) : Boolean;
  546. begin
  547. Result:=CheckStringIndex(Tableindex,StringIndex);
  548. If Result then
  549. ResourceStringTable.Tables[TableIndex]^.ResRec[StringIndex].CurrentValue:=Value;
  550. end;
  551. {$endif RESSTRSECTIONS}
  552. Function LoadResString(p:PResStringRec):AnsiString;
  553. begin
  554. Result:=p^;
  555. end;
  556. {$endif FPC_HAS_FEATURE_RESOURCES}
  557. {$ifdef FPC_HAS_FEATURE_RESOURCES}
  558. Initialization
  559. { ResetResourceTables;}
  560. finalization
  561. FinalizeResourceTables;
  562. {$endif FPC_HAS_FEATURE_RESOURCES}
  563. end.