From e337c2b6763bb08d871cff4342907349c75a5743 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Mon, 1 Apr 2013 01:08:04 -0400 Subject: [PATCH] Too much to list --- mdl/m_crypt.pas | 10 ---------- mdl/m_fileio.pas | 12 ++++++++++++ mdl/m_ops.pas | 2 -- mdl/m_strings.pas | 20 ++++++++++++++------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/mdl/m_crypt.pas b/mdl/m_crypt.pas index deee9d7..c5a7592 100644 --- a/mdl/m_crypt.pas +++ b/mdl/m_crypt.pas @@ -65,16 +65,6 @@ Begin Result := sayi; End; -Function Byte2Hex (numb: Byte) : String; -Const - HexChars : Array[0..15] of Char = '0123456789abcdef'; -begin -// setlength(result, 2); - Byte2Hex[0] := #2; - Byte2Hex[1] := HexChars[numb shr 4]; - Byte2Hex[2] := HexChars[numb and 15]; -end; - Function Digest2String (Digest: String) : String; var count : byte; diff --git a/mdl/m_fileio.pas b/mdl/m_fileio.pas index 6b6d101..9669e39 100644 --- a/mdl/m_fileio.pas +++ b/mdl/m_fileio.pas @@ -35,6 +35,7 @@ Function WildMatch (WildCard, FName: String; IgnoreCase: Boolean) : Boole Function DirCreate (Str: String) : Boolean; Function DirExists (Str: String) : Boolean; Function DirSlash (Str: String) : String; +Function DirLast (CurPath: String) : String; Function DirChange (Dir: String) : Boolean; Procedure DirClean (Path: String; Exempt: String); Function DirFiles (Str: String) : LongInt; @@ -359,6 +360,17 @@ Begin Result := Str; End; +Function DirLast (CurPath: String) : String; +Begin + If CurPath[Length(CurPath)] = PathSep Then + Delete (CurPath, Length(CurPath), 1); + + While (CurPath[Length(CurPath)] <> PathSep) and (CurPath <> '') Do + Delete (CurPath, Length(CurPath), 1); + + Result := DirSlash(CurPath); +End; + Function JustPath (Str: String) : String; Var Count : Byte; diff --git a/mdl/m_ops.pas b/mdl/m_ops.pas index 8b4e40b..99af9e6 100644 --- a/mdl/m_ops.pas +++ b/mdl/m_ops.pas @@ -28,8 +28,6 @@ ------------------------------------------------------------------------- } -{$DEFINE NEWEDITOR} - {.$DEFINE DEBUG} {$DEFINE RELEASE} {.$DEFINE LOGGING} diff --git a/mdl/m_strings.pas b/mdl/m_strings.pas index 6a1eea6..d9c73cd 100644 --- a/mdl/m_strings.pas +++ b/mdl/m_strings.pas @@ -14,7 +14,7 @@ Function strZero (Num: LongInt) : String; Function strComma (Num: LongInt) : String; Function strI2S (Num: LongInt) : String; Function strH2I (Str: String) : LongInt; -Function strI2H (Num: LongInt) : String; +Function strI2H (Num: LongInt; Idx: Byte) : String; Function strS2I (Str: String) : LongInt; Function strI2O (Num: LongInt) : String; Function strR2S (Num: Real; Deci: Byte) : String; @@ -34,6 +34,7 @@ Function strReplace (Str, OldStr, NewStr: String) : String; Function strWide2Str (Var Str: String; MaxLen: Byte) : String; Function strYN (Bol: Boolean) : String; Function LoCase (Ch: Char) : Char; +Function Byte2Hex (Num: Byte) : String; Implementation @@ -161,13 +162,11 @@ Begin End; End; -Function strI2H (Num: LongInt) : String; +Function strI2H (Num: LongInt; Idx: Byte) : String; Var - Ch : Char; - Idx : Byte; + Ch : Char; Begin - Result := '00000000'; - Idx := 8; + Result := strRep('0', Idx); While Num <> 0 Do Begin Ch := Chr(48 + Byte(Num) AND $0F); @@ -427,4 +426,13 @@ Begin If Bol Then Result := 'Yes' Else Result := 'No'; End; +Function Byte2Hex (Num: Byte) : String; +Const + HexChars : Array[0..15] of Char = '0123456789abcdef'; +Begin + Byte2Hex[0] := #2; + Byte2Hex[1] := HexChars[Num SHR 4]; + Byte2Hex[2] := HexChars[Num AND 15]; +End; + End.