aboutsummaryrefslogtreecommitdiffstats
path: root/Modis/SDK/StrUtils.pas
diff options
context:
space:
mode:
authormogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-10-09 00:47:22 +0000
committermogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-10-09 00:47:22 +0000
commit06727bfa7cbb7f2f5b1f986c409f7737c2f5286f (patch)
treed11843b86d87a5d0e040b8d04b8bedf592e041ce /Modis/SDK/StrUtils.pas
downloadusdx-06727bfa7cbb7f2f5b1f986c409f7737c2f5286f.tar.gz
usdx-06727bfa7cbb7f2f5b1f986c409f7737c2f5286f.tar.xz
usdx-06727bfa7cbb7f2f5b1f986c409f7737c2f5286f.zip
New branch, for the upcoming 1.01 release which will fix several issues that were reported, already fixed a typo in the English language file. Review Jira for other issues that should get fixed for that release.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.01@475 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Modis/SDK/StrUtils.pas')
-rw-r--r--Modis/SDK/StrUtils.pas70
1 files changed, 70 insertions, 0 deletions
diff --git a/Modis/SDK/StrUtils.pas b/Modis/SDK/StrUtils.pas
new file mode 100644
index 00000000..276d95a2
--- /dev/null
+++ b/Modis/SDK/StrUtils.pas
@@ -0,0 +1,70 @@
+unit StrUtils;
+
+interface
+uses ModiSDK;
+
+//function StrToAChar(Str: String): AChar;
+function CreateStr(Str: PChar): PChar;
+procedure FreeStr(Str: PChar);
+
+implementation
+
+{function StrToAChar(Str: String): AChar;
+var
+ L, I: Integer;
+begin
+ L := Length(Str);
+ For I := 0 to L-1 do
+ AChar[I] := Str[I+1];
+
+ For I := L to 254 do
+ AChar[I] := #0;
+end; }
+
+function StrCopy(Dest, Source: PChar): PChar; assembler;
+asm
+ PUSH EDI
+ PUSH ESI
+ MOV ESI,EAX
+ MOV EDI,EDX
+ MOV ECX,0FFFFFFFFH
+ XOR AL,AL
+ REPNE SCASB
+ NOT ECX
+ MOV EDI,ESI
+ MOV ESI,EDX
+ MOV EDX,ECX
+ MOV EAX,EDI
+ SHR ECX,2
+ REP MOVSD
+ MOV ECX,EDX
+ AND ECX,3
+ REP MOVSB
+ POP ESI
+ POP EDI
+end;
+
+function StrLen(Str: PChar): Cardinal; assembler;
+asm
+ MOV EDX,EDI
+ MOV EDI,EAX
+ MOV ECX,0FFFFFFFFH
+ XOR AL,AL
+ REPNE SCASB
+ MOV EAX,0FFFFFFFEH
+ SUB EAX,ECX
+ MOV EDI,EDX
+end;
+
+function CreateStr(Str: PChar): PChar;
+begin
+ GetMem(Result, StrLen(Str) + 1);
+ StrCopy(Result, Str);
+end;
+
+procedure FreeStr(Str: PChar);
+begin
+ FreeMem(Str);
+end;
+
+end. \ No newline at end of file