home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / ptgenr2.zip / BBSTRRES.PAS < prev    next >
Pascal/Delphi Source File  |  1994-08-01  |  2KB  |  57 lines

  1. (* This file was mangled by Mangler 1.32 (c) Copyright 1993-1994 by Berend de Boer *)
  2. { Created : 1993-03-06
  3.  
  4. Unit for handling string resources
  5.  
  6. Last changes :
  7. 94-05-16  Adapted to the Windows environment
  8. }
  9.  
  10.  
  11. {$IFDEF DPMI}
  12. {$X+,S-}
  13. {$ELSE}
  14. {$X+,F+,O+,R-,Q-}
  15. {$ENDIF}
  16. unit BBStrRes;
  17.  
  18. interface
  19.  
  20. uses Objects;
  21.  
  22.  
  23. {$IFNDEF Windows}
  24. const
  25.   StrResBufSize:word = 4096;
  26.   Strings:PStringList = nil;
  27. {$ENDIF}
  28.  
  29.  
  30. {$IFNDEF Windows}
  31. procedure LoadStrings;
  32. procedure DoneStrings;
  33. {$ENDIF}
  34.  
  35. function rsGet(sKey : word) : string;
  36. function rsGet1(sKey : word; Param1 : longint) : string;
  37. function rsGet2(sKey : word; Param1, Param2 : longint) : string;
  38.  
  39.  
  40.  IMPLEMENTATION USES {$IFDEF Windows}WINDOS , WINPROCS , {$ELSE}DOS , {$ENDIF}BBGUI , BBFILE , BBUTIL ;
  41. {$IFNDEF Windows}CONST O1lOIl0IIIIO:PRESOURCEFILE=NIL ;{$ENDIF}{$IFNDEF Windows}PROCEDURE LOADSTRINGS ;VAR OIOO:DIRSTR;
  42. OO0O:NAMESTR;OIOl:EXTSTR;BEGIN FSPLIT (PARAMSTR (0 ), OIOO , OO0O , OIOl );IF NOT FILEEXIST (OIOO + 'STRINGS.TVR')THEN
  43. BEGIN PRINTERROR ('File '+ OIOO + ' STRINGS.TVR could not be found.', 0 );HALT (1 );END ;O1lOIl0IIIIO := NEW
  44. (PRESOURCEFILE , INIT (NEW (PBUFSTREAM , INIT (OIOO + 'STRINGS.TVR', STOPENREAD , STRRESBUFSIZE ))));IF O1lOIl0IIIIO ^.
  45. STREAM ^. STATUS =STOK THEN STRINGS := PSTRINGLIST (O1lOIl0IIIIO ^. GET ('Strings'));CASE O1lOIl0IIIIO ^. STREAM ^.
  46. STATUS  OF STOK :EXIT ;STGETERROR :PRINTERROR
  47. ('TStringList not registered. Unable to load Strings from resource file STRINGS.TVR.', 0 );STINITERROR :PRINTERROR
  48. ('Cannot initialize stream. Unable to load Strings from resource file STRINGS.TVR.', 0 );ELSE PRINTERROR
  49. ('Unable to load Strings from resource file STRINGS.TVR.', 0 );END ;HALT (1 );END ;PROCEDURE DONESTRINGS ;BEGIN DISPOSE
  50. (STRINGS , DONE );DISPOSE (O1lOIl0IIIIO , DONE );STRINGS := NIL ;O1lOIl0IIIIO := NIL ;END ;{$ENDIF}FUNCTION RSGET
  51. (SKEY:WORD):STRING ;{$IFDEF Windows}VAR OO1O:STRING ;{$ENDIF}BEGIN {$IFDEF Windows}LOADSTRING (HINSTANCE , SKEY , @ OO1O
  52. [ 1 ] , 255 );{$ELSE}RSGET := STRINGS ^. GET (SKEY );{$ENDIF}END ;FUNCTION RSGET1 (SKEY:WORD;PARAM1:LONGINT):STRING ;
  53. VAR OO1O:STRING ;OO01:LONGINT;BEGIN OO01 := PARAM1 ;FORMATSTR (OO1O , RSGET (SKEY ), OO01 );RSGET1 := OO1O ;END ;
  54. FUNCTION RSGET2 (SKEY:WORD;PARAM1,PARAM2:LONGINT):STRING ;VAR OO1O,OO1l:STRING ;OO01:ARRAY [ 0 .. 1 ]  OF LONGINT;
  55. BEGIN OO01 [ 0 ] := PARAM1 ;OO01 [ 1 ] := PARAM2 ;OO1l := RSGET (SKEY );FORMATSTR (OO1O , OO1l , OO01 );RSGET2 := OO1O ;
  56. END ;END .
  57.