From a0fa3890db0988c4df706823fb04a4cbfa68f38d Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Fri, 22 Mar 2013 23:17:15 -0400 Subject: [PATCH] Too much to document --- mdl/m_fileio.pas | 34 +++++++++++++++++++++++++++++++++- mdl/m_inireader.pas | 14 +++++++++++--- mdl/m_ops.pas | 2 +- mdl/m_sdlcrt.pas | 7 ++++--- 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/mdl/m_fileio.pas b/mdl/m_fileio.pas index 6f55747..6b6d101 100644 --- a/mdl/m_fileio.pas +++ b/mdl/m_fileio.pas @@ -31,6 +31,7 @@ Function JustFileName (Str: String) : String; Function JustFile (Str: String) : String; Function JustFileExt (Str: String) : String; Function JustPath (Str: String) : String; +Function WildMatch (WildCard, FName: String; IgnoreCase: Boolean) : Boolean; Function DirCreate (Str: String) : Boolean; Function DirExists (Str: String) : Boolean; Function DirSlash (Str: String) : String; @@ -409,6 +410,37 @@ Begin End; End; +Function WildMatch (WildCard, FName: String; IgnoreCase: Boolean) : Boolean; +Begin + Result := False; + + If FName = '' Then Exit; + + If IgnoreCase Then Begin + WildCard := strUpper(WildCard); + FName := strUpper(FName); + End; + + Case Wildcard[1] of + '*' : Begin + If FName[1] = '.' Then Exit; + If Length(Wildcard) = 1 Then Result := True; + If (Length(Wildcard) > 1) and (Wildcard[2] = '.') and (Length(FName) > 0) Then + Result := WildMatch(Copy(Wildcard, 3, Length(Wildcard) - 2), Copy(FName, Pos('.', FName) + 1, Length(FName)-Pos('.', FName)), False); + End; + '?' : If Ord(Wildcard[0]) = 1 Then + Result := True + Else + Result := WildMatch(Copy(Wildcard, 2, Length(Wildcard) - 1), Copy(FName, 2, Length(FName) - 1), False); + Else + If FName[1] = Wildcard[1] Then + If Length(Wildcard) > 1 Then + Result := WildMatch(Copy(Wildcard, 2, Length(Wildcard) - 1), Copy(FName, 2, Length(FName) - 1), False) + Else + Result := (Length(FName) = 1) And (Length(Wildcard) = 1); + End; +End; + {$IFDEF WINDOWS} Function FileErase (Str: String) : Boolean; Begin @@ -762,7 +794,7 @@ Function FileByteSize (FN: String) : Int64; Var Dir : SearchRec; Begin - Result := -1; + Result := 0; FindFirst (FN, AnyFile, Dir); diff --git a/mdl/m_inireader.pas b/mdl/m_inireader.pas index bb58391..d93d405 100644 --- a/mdl/m_inireader.pas +++ b/mdl/m_inireader.pas @@ -15,9 +15,10 @@ Type Constructor Create (FN: String); Destructor Destroy; Override; - Function ReadString (Category, Value, DefValue: String) : String; - Function ReadInteger (Category, Value: String; DefValue: LongInt) : LongInt; - Function ReadBoolean (Category, Value: String; DefValue: Boolean) : Boolean; + Procedure SetSequential (S: Boolean); + Function ReadString (Category, Value, DefValue: String) : String; + Function ReadInteger (Category, Value: String; DefValue: LongInt) : LongInt; + Function ReadBoolean (Category, Value: String; DefValue: Boolean) : Boolean; End; Implementation @@ -44,6 +45,13 @@ Begin If Opened Then Close(IniFile); End; +Procedure TIniReader.SetSequential (S: Boolean); +Begin + Sequential := S; + + If Opened Then Reset(IniFile); +End; + Function TIniReader.ReadString (Category, Value, DefValue: String) : String; Var RawStr : String; diff --git a/mdl/m_ops.pas b/mdl/m_ops.pas index 352c1e2..8b4e40b 100644 --- a/mdl/m_ops.pas +++ b/mdl/m_ops.pas @@ -28,7 +28,7 @@ ------------------------------------------------------------------------- } -{.$DEFINE NEWEDITOR} +{$DEFINE NEWEDITOR} {.$DEFINE DEBUG} {$DEFINE RELEASE} diff --git a/mdl/m_sdlcrt.pas b/mdl/m_sdlcrt.pas index 00ccaee..7aa1b73 100644 --- a/mdl/m_sdlcrt.pas +++ b/mdl/m_sdlcrt.pas @@ -56,8 +56,8 @@ Const AppInputSize = 128; SDLAppWindowX : Word = 800; SDLAppWindowY : Word = 600; - SDLFontSize : Byte = 16; - SDLFontSpace : Byte = 16; + SDLFontSize : Byte = 17; + SDLFontSpace : Byte = 0; Type TSDLScreenMode = (mode_80x25, mode_80x50, mode_132x50); @@ -147,7 +147,8 @@ Begin SDL_INIT(SDL_INIT_VIDEO); - Screen := SDL_SetVideoMode(SDLAppWindowX, SDLAppWindowY, 32, SDL_HWSURFACE or SDL_FULLSCREEN); +// Screen := SDL_SetVideoMode(SDLAppWindowX, SDLAppWindowY, 32, SDL_HWSURFACE or SDL_FULLSCREEN); + Screen := SDL_SetVideoMode(SDLAppWindowX, SDLAppWindowY, 32, SDL_HWSURFACE); If Screen = NIL Then Halt;