    
Function ucLoadStringLibInFMP Alias "ucLoadStringLibInFMP" (Optional ByVal tHandle As Long) Export As Long
   ' This file auto-generated on 08/14/14 using uCalc Transform 3.0

   OriginalDefaultThread = uCalc(%uc_GetDefaultThread)
   If tHandle = 0 Then tHandle = OriginalDefaultThread    
   uCalc(%uc_SetDefaultThread, "", tHandle)
   uCalcFMP = tHandle ' uCalc(%uc_NewThread, "", tHandle)
   
   StringLibInit()

   ucDefine("NativeCall~~Address:"+Str$(ucAddr(%uc_StringLibNum))+"~~Func: StringLib(Routine, Options=0, MainString As String='', Pattern As String='', Replace As String='', Num1, Num2)")
   ucDefine("NativeCall~~Address:"+Str$(ucAddr(%uc_StringLibStr))+"~~Func: StringLibStr(Routine, Options=0, MainString As String='', Pattern As String='', Replace As String='', Num1, Num2) As String")
   

   ucDefine("Var: ucByte = 1")

   ucDefine("Var: ucChar = 2")

   ucDefine("Var: ucWord = 4")

   ucDefine("Var: ucToken = 8")

   ucDefine("Var: ucBlock = 16")

   ucDefine("Var: ucExpr = 32")

   ucDefine("Var: ucQuote = 64")

   ucDefine("Var: ucSpace = 128")

   ucDefine("Var: ucCase = 256")


   ucDefine("Func: Between(a, b) = StringLib("+Str$(%ucs_Between)+", 00, '', '', '', a, b)")
   ucDefine("Func: Compare(String1 As String, String2 As String, Options=0) = StringLib("+Str$(%ucs_Compare)+", Options, String1, String2, '', 0, 0)")
   ucDefine("Func: Count() = StringLib("+Str$(%ucs_Count)+", 00, '', '', '', 0, 0)")
   ucDefine("Func: CountSkipped() = StringLib("+Str$(%ucs_CountSkipped)+", 00, '', '', '', 0, 0)")
   ucDefine("Func: Delim(Delim As String, L As String='', R As String='') = StringLib("+Str$(%ucs_Delim)+", 00, Delim, L, R, 0, 0)")
   ucDefine("Func: Equals(String1 As String, String2 As String, Options=0) = StringLib("+Str$(%ucs_Equals)+", Options, String1, String2, '', 0, 0)")
   ucDefine("Func: Extract(MainString As String, Pattern As String, Options=0) As String = StringLibStr("+Str$(%ucs_Extract)+", Options, MainString, Pattern, '', 0, 0)")
   ucDefine("Func: File(NameOfFile As String) As String = StringLibStr("+Str$(%ucs_File)+", 00, NameOfFile, '', '', 0, 0)")
   ucDefine("Func: InStr(Start, MainString As String, Pattern As String, Options=0) = StringLib("+Str$(%ucs_InStr)+", Options, MainString, Pattern, '', Start, 0)")
   ucDefine("Func: LCase(MainString As String, Pattern As String='', Options=0) As String = StringLibStr("+Str$(%ucs_LCase)+", Options, MainString, Pattern, '', 0, 0)")
   ucDefine("Func: Left(MainString As String, Number, Options=0) As String = StringLibStr("+Str$(%ucs_Left)+", Options, MainString, '', '', Number, 0)")
   ucDefine("Func: Len(MainString As String, Options=0) = StringLib("+Str$(%ucs_Len)+", Options, MainString, '', '', 0, 0)")
   ucDefine("Func: Length(x=0) = StringLib("+Str$(%ucs_Length)+", 00, '', '', '', x, 0)")
   ucDefine("Func: Limit(Limit) = StringLib("+Str$(%ucs_Limit)+", 00, '', '', '', Limit, 0)")
   ucDefine("Func: MCase(MainString As String, Pattern As String='', Options=0) As String = StringLibStr("+Str$(%ucs_MCase)+", Options, MainString, Pattern, '', 0, 0)")
   ucDefine("Func: Mid(MainString As String, Start, Length = -1, Options=0) As String = StringLibStr("+Str$(%ucs_Mid)+", Options, MainString, '', '', Start, Length)")
   ucDefine("Func: Nth(Number) = StringLib("+Str$(%ucs_Nth)+", 00, '', '', '', Number, 0)")
   ucDefine("Func: Pos(x=0) = StringLib("+Str$(%ucs_Pos)+", 00, '', '', '', x, 0)")
   ucDefine("Func: Range(Start, Finish, Expression As String, Options=0) As String = StringLibStr("+Str$(%ucs_Range)+", Options, Expression, '', '', Start, Finish)")
   ucDefine("Func: Remain(MainString As String, Pattern As String, Options=0) As String = StringLibStr("+Str$(%ucs_Remain)+", Options, MainString, Pattern, '', 0, 0)")
   ucDefine("Func: Remove(MainString As String, Pattern As String, Options=0) As String = StringLibStr("+Str$(%ucs_Remove)+", Options, MainString, Pattern, '', 0, 0)")
   ucDefine("Func: Replace(MainString As String, Pattern As String, Replacement As String='', Options=0) As String = StringLibStr("+Str$(%ucs_Replace)+", Options, MainString, Pattern, Replacement, 0, 0)")
   ucDefine("Func: Retain(MainString As String, Pattern As String, Filter As String='', Options=0) As String = StringLibStr("+Str$(%ucs_Retain)+", Options, MainString, Pattern, Filter, 0, 0)")
   ucDefine("Func: Right(MainString As String, Number, Options=0) As String = StringLibStr("+Str$(%ucs_Right)+", Options, MainString, '', '', Number, 0)")
   ucDefine("Func: SetStringDefaults(Options) = StringLib("+Str$(%ucs_SetStringDefaults)+", Options, '', '', '', 0, 0)")
   ucDefine("Func: Skip(MainString As String) = StringLib("+Str$(%ucs_Skip)+", 00, MainString, '', '', 0, 0)")
   ucDefine("Func: Split(MainString As String, Delim As String='', Options=0) = StringLib("+Str$(%ucs_Split)+", Options, MainString, Delim, '', 0, 0)")
   ucDefine("Func: Start(Position) = StringLib("+Str$(%ucs_Start)+", 00, '', '', '', Position, 0)")
   ucDefine("Func: StartAfter(Number) = StringLib("+Str$(%ucs_StartAfter)+", 00, '', '', '', Number, 0)")
   ucDefine("Func: StopAfter(Number) = StringLib("+Str$(%ucs_StopAfter)+", 00, '', '', '', Number, 0)")
   ucDefine("Func: StringItem(Index) As String = StringLibStr("+Str$(%ucs_StringItem)+", 00, '', '', '', Index, 0)")
   ucDefine("Func: StringItemCount() = StringLib("+Str$(%ucs_StringItemCount)+", 00, '', '', '', 0, 0)")
   ucDefine("Func: Tally(MainString As String, Pattern As String, Options=0) = StringLib("+Str$(%ucs_Tally)+", Options, MainString, Pattern, '', 0, 0)")
   ucDefine("Func: UCase(MainString As String, Pattern As String='', Options=0) As String = StringLibStr("+Str$(%ucs_UCase)+", Options, MainString, Pattern, '', 0, 0)")
   ucDefine("Func:InStr(MainString As String, Pattern As String, Options=0) = InStr(1, MainString, Pattern, Options)")
   ucDefine("Func:Retain(MainString As String, Pattern As String, Options=0) As String = Retain(MainString, Pattern, '{Self}', Options)")
   ucInstr(1, "a", "a") ' +++ Temp solution
   ucInstr(1, "a", "a") ' +++ Temp solution

   uCalc(%uc_SetDefaultThread, "", OriginalDefaultThread)
End Function

' uCalc String Library Routine Exports

Function ucBetween Alias "ucBetween" (ByVal a As Long, ByVal b As Long) Export As Long
   Function = StringLib(%ucs_Between, 00, "", "", "", a, b)
End Function

Function ucCompare Alias "ucCompare" (ByRef String1 As String, ByRef String2 As String, Optional ByVal Options As Long) Export As Long
   Function = StringLib(%ucs_Compare, Options, String1, String2, "", 0, 0)
End Function

Function ucCount Alias "ucCount" () Export As Long
   Function = StringLib(%ucs_Count, 00, "", "", "", 0, 0)
End Function

Function ucCountSkipped Alias "ucCountSkipped" () Export As Long
   Function = StringLib(%ucs_CountSkipped, 00, "", "", "", 0, 0)
End Function

Function ucDelim Alias "ucDelim" (ByRef Delim As String, Optional ByRef L As String, Optional ByRef R As String) Export As Long
   Function = StringLib(%ucs_Delim, 00, Delim, CheckStrArg(L), CheckStrArg(R), 0, 0)
End Function

Function ucEquals Alias "ucEquals" (ByRef String1 As String, ByRef String2 As String, Optional ByVal Options As Long) Export As Long
   Function = StringLib(%ucs_Equals, Options, String1, String2, "", 0, 0)
End Function

Function ucInStr Alias "ucInStr" (ByVal Start As Long, ByRef MainString As String, ByRef Pattern As String, Optional ByVal Options As Long) Export As Long
   Function = StringLib(%ucs_InStr, Options, MainString, Pattern, "", Start, 0)
End Function

Function ucLen Alias "ucLen" (ByRef MainString As String, Optional ByVal Options As Long) Export As Long
   Function = StringLib(%ucs_Len, Options, MainString, "", "", 0, 0)
End Function

Function ucLength Alias "ucLength" (Optional ByVal x As Long) Export As Long
   Function = StringLib(%ucs_Length, 00, "", "", "", x, 0)
End Function

Function ucLimit Alias "ucLimit" (ByVal Limit As Long) Export As Long
   Function = StringLib(%ucs_Limit, 00, "", "", "", Limit, 0)
End Function

Function ucNth Alias "ucNth" (ByVal Number As Long) Export As Long
   Function = StringLib(%ucs_Nth, 00, "", "", "", Number, 0)
End Function

Function ucPos Alias "ucPos" (Optional ByVal x As Long) Export As Long
   Function = StringLib(%ucs_Pos, 00, "", "", "", x, 0)
End Function

Function ucSetStringDefaults Alias "ucSetStringDefaults" (ByVal Options As Long) Export As Long
   Function = StringLib(%ucs_SetStringDefaults, Options, "", "", "", 0, 0)
End Function

Function ucSkip Alias "ucSkip" (ByRef MainString As String) Export As Long
   Function = StringLib(%ucs_Skip, 00, MainString, "", "", 0, 0)
End Function

Function ucSplit Alias "ucSplit" (ByRef MainString As String, Optional ByRef Delim As String, Optional ByVal Options As Long) Export As Long
   Function = StringLib(%ucs_Split, Options, MainString, CheckStrArg(Delim), "", 0, 0)
End Function

Function ucStart Alias "ucStart" (ByVal Position As Long) Export As Long
   Function = StringLib(%ucs_Start, 00, "", "", "", Position, 0)
End Function

Function ucStartAfter Alias "ucStartAfter" (ByVal Number As Long) Export As Long
   Function = StringLib(%ucs_StartAfter, 00, "", "", "", Number, 0)
End Function

Function ucStopAfter Alias "ucStopAfter" (ByVal Number As Long) Export As Long
   Function = StringLib(%ucs_StopAfter, 00, "", "", "", Number, 0)
End Function

Function ucStringItemCount Alias "ucStringItemCount" () Export As Long
   Function = StringLib(%ucs_StringItemCount, 00, "", "", "", 0, 0)
End Function

Function ucTally Alias "ucTally" (ByRef MainString As String, ByRef Pattern As String, Optional ByVal Options As Long) Export As Long
   Function = StringLib(%ucs_Tally, Options, MainString, Pattern, "", 0, 0)
End Function

Sub ucExtract_ Alias "ucExtract" (ByRef ReturnStr As String, ByRef MainString As String, ByRef Pattern As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Extract, Options, MainString, Pattern, "", 0, 0)
End Sub

Sub ucFile_ Alias "ucFile" (ByRef ReturnStr As String, ByRef NameOfFile As String) Export
   ReturnStr = StringLib_Str(%ucs_File, 00, NameOfFile, "", "", 0, 0)
End Sub

Sub ucLCase_ Alias "ucLCase" (ByRef ReturnStr As String, ByRef MainString As String, Optional ByRef Pattern As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_LCase, Options, MainString, CheckStrArg(Pattern), "", 0, 0)
End Sub

Sub ucLeft_ Alias "ucLeft" (ByRef ReturnStr As String, ByRef MainString As String, ByVal Number As Long, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Left, Options, MainString, "", "", Number, 0)
End Sub

Sub ucMCase_ Alias "ucMCase" (ByRef ReturnStr As String, ByRef MainString As String, Optional ByRef Pattern As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_MCase, Options, MainString, CheckStrArg(Pattern), "", 0, 0)
End Sub

Sub ucMid_ Alias "ucMid" (ByRef ReturnStr As String, ByRef MainString As String, ByVal Start As Long, Optional ByVal Length As Long, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Mid, Options, MainString, "", "", Start, Length)
End Sub

Sub ucRange_ Alias "ucRange" (ByRef ReturnStr As String, ByVal Start As Long, ByVal Finish As Long, ByRef Expression As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Range, Options, Expression, "", "", Start, Finish)
End Sub

Sub ucRemain_ Alias "ucRemain" (ByRef ReturnStr As String, ByRef MainString As String, ByRef Pattern As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Remain, Options, MainString, Pattern, "", 0, 0)
End Sub

Sub ucRemove_ Alias "ucRemove" (ByRef ReturnStr As String, ByRef MainString As String, ByRef Pattern As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Remove, Options, MainString, Pattern, "", 0, 0)
End Sub

Sub ucReplace_ Alias "ucReplace" (ByRef ReturnStr As String, ByRef MainString As String, ByRef Pattern As String, Optional ByRef Replacement As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Replace, Options, MainString, Pattern, CheckStrArg(Replacement), 0, 0)
End Sub

Sub ucRetain_ Alias "ucRetain" (ByRef ReturnStr As String, ByRef MainString As String, ByRef Pattern As String, Optional ByRef Filter As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Retain, Options, MainString, Pattern, CheckStrArg(Filter), 0, 0)
End Sub

Sub ucRight_ Alias "ucRight" (ByRef ReturnStr As String, ByRef MainString As String, ByVal Number As Long, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_Right, Options, MainString, "", "", Number, 0)
End Sub

Sub ucStringItem_ Alias "ucStringItem" (ByRef ReturnStr As String, ByVal Index As Long) Export
   ReturnStr = StringLib_Str(%ucs_StringItem, 00, "", "", "", Index, 0)
End Sub

Sub ucUCase_ Alias "ucUCase" (ByRef ReturnStr As String, ByRef MainString As String, Optional ByRef Pattern As String, Optional ByVal Options As Long) Export
   ReturnStr = StringLib_Str(%ucs_UCase, Options, MainString, CheckStrArg(Pattern), "", 0, 0)
End Sub