home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 038 / pmd110.zip / BBSTRRES.PAS < prev    next >
Pascal/Delphi Source File  |  1994-11-14  |  3KB  |  58 lines

  1. (* This file was mangled by Mangler 1.35 (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 ;
  51. {$ENDIF}{$IFDEF Windows}FUNCTION RSGET (SKEY:WORD):STRING ;VAR OO1O:STRING ;OIO0O1I11lO:INTEGER;BEGIN OIO0O1I11lO :=
  52. LOADSTRING (HINSTANCE , SKEY , @ OO1O [ 1 ] , 255 );OO1O [ 0 ] := CHR (OIO0O1I11lO );RSGET := OO1O ;END ;
  53. {$ELSE}FUNCTION RSGET (SKEY:WORD):STRING ;BEGIN IF STRINGS =NIL THEN RSGET := '<strings not loaded!>'ELSE RSGET :=
  54. STRINGS ^. GET (SKEY );END ;{$ENDIF}FUNCTION RSGET1 (SKEY:WORD;PARAM1:LONGINT):STRING ;VAR OO1O:STRING ;OO01:LONGINT;
  55. BEGIN OO01 := PARAM1 ;FORMATSTR (OO1O , RSGET (SKEY ), OO01 );RSGET1 := OO1O ;END ;FUNCTION RSGET2 (SKEY:WORD;
  56. PARAM1,PARAM2:LONGINT):STRING ;VAR OO1O,OO1l:STRING ;OO01:ARRAY [ 0 .. 1 ]  OF LONGINT;BEGIN OO01 [ 0 ] := PARAM1 ;OO01 [
  57. 1 ] := PARAM2 ;OO1l := RSGET (SKEY );FORMATSTR (OO1O , OO1l , OO01 );RSGET2 := OO1O ;END ;END .
  58.