ElseIf (liPtr Or DWORDMostSignificantBit) < -liDelimLen Then
liPtr = liPtr + liDelimLen
Else
liPtr = (liPtr + DWORDMostSignificantBit) + _
(liDelimLen + DWORDMostSignificantBit)
End If
End If
Next
End If
End Function
Public Sub GetStringMap(ByRef pyMap() As Byte, _
ByRef psString As String, _
ByRef ptSafeArray As tSafeArray1D, _
ByRef piOldDescriptor As Long)
'This is one of the few helper procedures in this module because it is not called
'from inside loops, so this will only have a negligable effect on performance.
Dim liArrPtr As Long
With ptSafeArray
.BytesPerElement = 1& 'This is a byte array
.Dimensions = 1 '1 Dimensional
.Attributes = SAFEARRAY_AUTO Or SAFEARRAY_FIXEDSIZE 'Cannot REDIM the array
.DataPointer = StrPtr(psString) 'Point to the string data as the first element
.Elements = LenB(psString) 'As many elements as the string has bytes
End With
liArrPtr = ArrPtr(pyMap)
CopyMemory piOldDescriptor, ByVal liArrPtr, 4& 'Store the original descriptor
CopyMemory ByVal liArrPtr, VarPtr(ptSafeArray), 4& 'Replace original descriptor
End Sub
Private Sub CharLower(ByRef pyChar1 As Byte, ByRef pyChar2 As Byte)
'This is the only procedure called from in the loops, b/c I don't want to put it inline!
'If this this all seems completely random, well that's unicode for you!
'The alternative to this sub is to convert the bytes to a string with ChrW$(),
'Then call LCase$(), then call AscW(). To make these three calls is a bit faster
'with P-Code and in the IDE, but is slower with native code.
Const MakeLCase As Byte = 32
Const UpperA As Byte = vbKeyA
Const UpperZ As Byte = vbKeyZ
Const Zero As Byte = 0
Const One As Byte = 1
Const Two As Byte = 2
Const Three As Byte = 3
Const Four As Byte = 4
Const Five As Byte = 5
Const Eight As Byte = 8
Const Thirteen As Byte = 13
Const Fifteen As Byte = 15
Const Sixteen As Byte = 16
Const TwentyTwo As Byte = 22
Const TwentyFour As Byte = 24
Const TwentySix As Byte = 26
Const TwentyNine As Byte = 29
Const Thirty As Byte = 30
Const ThirtyOne As Byte = 31
Const ThirtyThree As Byte = 33
Const ThirtySix As Byte = 36
Const ThirtySeven As Byte = 37
Const ThirtyEight As Byte = 38
Const ThirtyNine As Byte = 39
Const Forty As Byte = 40
Const FortyTwo As Byte = 42
Const FortyThree As Byte = 43
Const FortyFive As Byte = 45
Const FortySix As Byte = 46
Const FortySeven As Byte = 47
Const FortyEight As Byte = 48
Const FortyNine As Byte = 49
Const Fifty As Byte = 50
Const FiftyOne As Byte = 51
Const FiftyThree As Byte = 53
Const FiftyFour As Byte = 54
Const FiftySix As Byte = 56
Const FiftySeven As Byte = 57
Const FiftyEight As Byte = 58
Const SixtyThree As Byte = 63
Const SeventyOne As Byte = 71
Const SeventyTwo As Byte = 72
Const SeventyFour As Byte = 74
Const SeventySeven As Byte = 77
Const SeventyNine As Byte = 79
Const Eighty As Byte = 80
Const EightyTwo As Byte = 82
Const EightyThree As Byte = 83
Const EightyFour As Byte = 84
Const EightySix As Byte = 86
Const EightySeven As Byte = 87
Const EightyNine As Byte = 89
Const NinetyOne As Byte = 91
Const NinetyThree As Byte = 93
Const NinetyFive As Byte = 95
Const NinetySix As Byte = 96
Const NinetyNine As Byte = 99
Const OneHundred As Byte = 100
Const OneOhFour As Byte = 104
Const OneOhFive As Byte = 105
Const OneEleven As Byte = 111
Const OneTwelve As Byte = 112
Const OneFourteen As Byte = 114
Const OneSeventeen As Byte = 117
Const OneEightteen As Byte = 118
Const OneNineteen As Byte = 119
Const OneTwenty As Byte = 120
Const OneTwentyOne As Byte = 121
Const OneTwentyThree As Byte = 123
Const OneTwentyFive As Byte = 125
Const OneTwentySix As Byte = 126
Const OneTwentyEight As Byte = 128
Const OneTwentyNine As Byte = 129
Const OneThirty As Byte = 130
Const OneThirtyOne As Byte = 131
Const OneThirtyTwo As Byte = 132
Const OneThirtyFour As Byte = 134
Const OneThirtyFive As Byte = 135
Const OneThirtySix As Byte = 136
Const OneThirtySeven As Byte = 137
Const OneThirtyEight As Byte = 138
Const OneThirtyNine As Byte = 139
Const OneForty As Byte = 140
Const OneFortyTwo As Byte = 142
Const OneFortyThree As Byte = 143
Const OneFortyFour As Byte = 144
Const OneFortyFive As Byte = 145
Const OneFortySix As Byte = 146
Const OneFortySeven As Byte = 147
Const OneFortyEight As Byte = 148
Const OneFifty As Byte = 150
Const OneFiftyOne As Byte = 151
Const OneFiftyTwo As Byte = 152
Const OneFiftySix As Byte = 156
Const OneFiftySeven As Byte = 157
Const OneFiftyNine As Byte = 159
Const OneSixty As Byte = 160
Const OneSixtyTwo As Byte = 162
Const OneSixtyFour As Byte = 164
Const OneSixtySeven As Byte = 167
Const OneSixtyNine As Byte = 169
Const OneSeventyOne As Byte = 171
Const OneSeventyTwo As Byte = 172
Const OneSeventyFour As Byte = 174
Const OneSeventyFive As Byte = 175
Const OneSeventySeven As Byte = 177
Const OneSeventyEight As Byte = 178
Const OneSeventyNine As Byte = 179
Const OneEightyOne As Byte = 181
Const OneEightyTwo As Byte = 182
Const OneEightyThree As Byte = 183
Const OneEightyFour As Byte = 184
Const OneEightyFive As Byte = 185
Const OneEightySix As Byte = 186
Const OneEightySeven As Byte = 187
Const OneEightyEight As Byte = 188
Const OneNinety As Byte = 190
Const OneNinetyTwo As Byte = 192
Const OneNinetyThree As Byte = 193
Const OneNinetyFive As Byte = 195
Const OneNinetySix As Byte = 196
Const OneNinetySeven As Byte = 197
Const OneNinetyNine As Byte = 199
Const TwoHundred As Byte = 200
Const TwoOhTwo As Byte = 202
Const TwoOhThree As Byte = 203
Const TwoOhFour As Byte = 204
Const TwoOhFive As Byte = 205
Const TwoOhSix As Byte = 206
Const TwoOhSeven As Byte = 207
Const TwoOhEight As Byte = 208
Const TwoFifteen As Byte = 215
Const TwoSixteen As Byte = 216
Const TwoSeventeen As Byte = 217
Const TwoEightteen As Byte = 218
Const TwoNineteen As Byte = 219
Const TwoTwentyOne As Byte = 221
Const TwoTwentyTwo As Byte = 222
Const TwoTwentySix As Byte = 226
Const TwoTwentyNine As Byte = 229
Const TwoThirtyTwo As Byte = 232
Const TwoThirtyThree As Byte = 233
Const TwoThirtyFour As Byte = 234
Const TwoThirtyFive As Byte = 235
Const TwoThirtySix As Byte = 236
Const TwoThirtyEight As Byte = 238
Const TwoForty As Byte = 240
Const TwoFortyOne As Byte = 241
Const TwoFortyTwo As Byte = 242
Const TwoFortyThree As Byte = 243
Const TwoFortySix As Byte = 246
Const TwoFortyEight As Byte = 248
Const TwoFortyNine As Byte = 249
Const TwoFifty As Byte = 250
Const TwoFiftyOne As Byte = 251
Const TwoFiftyFive As Byte = 255
If pyChar2 = Zero Then
If UpperA <= pyChar1 And pyChar1 <= UpperZ Then
pyChar1 = pyChar1 + MakeLCase
ElseIf OneNinetyTwo <= pyChar1 And pyChar1 <= TwoTwentyTwo Then
If pyChar1 <> TwoFifteen Then pyChar1 = pyChar1 + MakeLCase
End If
ElseIf pyChar2 = One Then
If pyChar1 = NinetySix Or pyChar1 = EightyTwo Or pyChar1 = OneTwentyFive Then
pyChar1 = pyChar1 + 1
ElseIf pyChar1 = OneTwenty Then
pyChar1 = TwoFiftyFive
pyChar2 = Zero
ElseIf (Zero <= pyChar1 And pyChar1 <= FiftyFour) Or (SeventyFour <= pyChar1 And pyChar1 <= OneEightteen) Then
If pyChar1 Mod Two = Zero And pyChar1 <> FortyEight Then pyChar1 = pyChar1 + 1
ElseIf FiftySeven <= pyChar1 And pyChar1 <= SeventyOne Then
If pyChar1 Mod Two = One Then pyChar1 = pyChar1 + 1
ElseIf TwoOhFive <= pyChar1 And pyChar1 <= TwoNineteen Then
If pyChar1 Mod Two = One Then pyChar1 = pyChar1 + 1
ElseIf TwoTwentyTwo <= pyChar1 And pyChar1 < TwoFiftyFive Then
If Not (pyChar1 = TwoForty Or pyChar1 = TwoFortyTwo Or pyChar1 = TwoFortySix Or pyChar1 = TwoFortyEight) Then
If pyChar1 <> TwoFortyOne Then
If pyChar1 Mod Two = Zero Then pyChar1 = pyChar1 + 1
Else
pyChar1 = TwoFortyThree
End If
End If
Else
If pyChar1 = OneTwenty Then
pyChar1 = TwoFiftyFive
pyChar2 = Zero
ElseIf pyChar1 = OneTwentyOne Or pyChar1 = OneTwentyThree Or pyChar1 = OneTwentyFive Or pyChar1 = OneThirty Or pyChar1 = OneThirtyTwo Or pyChar1 = OneThirtyFive Or pyChar1 = OneThirtyNine Or pyChar1 = OneFortyFive Or pyChar1 = OneFiftyTwo Or pyChar1 = OneSixty Or pyChar1 = OneSixtyTwo Or pyChar1 = OneSixtyFour Or pyChar1 = OneSixtySeven Or pyChar1 = OneSeventyTwo Or pyChar1 = OneSeventyFive Or pyChar1 = OneSeventyNine e Or pyChar1 = Ot ByReteemost non-space character
f3CwoHundrr1 = TwoFortytr1 = 5woFortyThree
e.tAnd r pyChar1ar1 = Onr Const Tw9 Cons 5wod Two = One Then pyChar1 =etyFive
pyChar2 = Zero
Eg = 46
ConiChar1 = Ot ByRetwo As Byte = 142
Const OneFoooooooooooooo completely random, well V ConsttaThree Or pr1 Mod Two = Zero Then pyChar1 = pyChar1 + 1
Else
Tan/ben pyCho liSt28 Eg =AOr pyChar1 , j
End If
Else
ReDim psResult(0& TTTTTTTSst Tw9 Cons 5wod Two = One Then pyChar1 =etyFitive then lcase() them
If lbIgnoreCase Then CharLower lyByte1, lyByte2
llocStdSr0em
st NinetyNine As B
Pm'Temp v End IIf lbIgTwoFortytr1 CoO8te =tAs Byte = 24Copy=ace oyChAs Byte = 241 = OneThirtyFive
Gettep 2&
Ot ByRetwo As Byt
If pyChar1 <> TwoFortyOne Then
IIf lbI CtyNUwo As pyChar1 = OneThirtyFivto see if they matchByte = 21 (liLastPlace + DWORDMostSignificantBit)!tyO7Place + DWORDMostSignificantBiThen
)ar1 + MakeLCase
yVal VB(psString) 'Get the length
c TwoNineteen As Byte = 219
Const TwoTByte = 248
Const TwoFortyNine As Byte Const OneFortySevenlF2Agbuths1 Mod Two = Zero And pyChar1 <> FortyEight Then p
SSoOt s st ae = Oney7yt Until0n A FortyFLCsitionXi Ot st 2 pi Twoyt st Odi
8ey7yt U st a8y7yt Un FoN2 = yte ied addNinw6fwo Or pyCh FoN2 Ms so O)st inw6fic
For st ae = Oney7yted ie - pyCeOneNit sySevenl ue
ouaaaaaa
82Char1 addNinw6fwo Or pyCsfwo Or pyCh FoN2 82evenl yCeOByte = 2 Ms so2Thrr)
82Char1,t 6fic
For st nhe pse d If Wt 0i- so2Thrr)
82Char1s4ee
1 deOByte = t SSElslbIx By) d) pyChar1 =
L oOne u d ntilandom, ta iSt d nt addNinw6fwo Or pyCh FoN2 Ms so O)st inw6ft ae = Oney nt addNinw6fwo Or pyCh FoN2 Ms syte =GSixtyTw iaChar1 7 st l0neNiner
As Boolea addNinw6f- so2Thrr)
82Char1s4ee
so O)st inw6 End If
Char1 = On = Ons_e = 234
oVal lring As Strs By,Vnt addNinw6fwo Or pyCh Fo1gar1 7etyNine l' l0nd smit=rRa9lando_e = 234
oVal lring As Stwo Or pyCh Fr Foons irimSingneNiner
As Booles_e As Long 'Lengs 6fic
Foo)/p0
,5 st wr0emyte2
s iaChar1 7 st l0neNe l' 234
oVal lringm s -crement tho ReDim psResult(0& TTTTT'1gar1 7ety st l0neNe l' 23te -OR pRe▐g
"""" Ne l' 23te L= 234
oVal nreCasi' wr0e=ote -OR pRe▐g
"""" Ns +d0neNe l'VEr Foo)/p0
,5u"" Ns +d0neNeB <IenyFLCsitionXi Ot st aee
1 = OnSthreeStrs By,V!= b st ds<IenyFLCsitionXi Ot st as ReDicrement tho ReDwoFortyNight As 'LntyFwentyTwr1 = turn - liCMs so2ThrrSthree as e l'VEr Foo'VErl nreCasi' wr0e=liCtf.en > 0& Then 'If there were any non-zero length strings oongringm s ererèEr FLLLLLLLL" Ns +d0neNeBRdtednd If With ptSaf FLLLLLLLL" Ns +th stringfeo"
nP
s Bg
.y6 s Bg
.ys Bofpr = SysAllocStrine
nwio= For st ae = Oney7yted ie - pyetSaf FLLLLLLLLLL 23"" = SysAllocStrineb5
Const ObC,= Oney7yt Until0n A = ted ieicantBiThen
pyMau l0Ch 169
ar1 ngfeo"
nP
s BwTaf ult
Err.Rwioco55(34
oVal nreCasi' wr0e=ote -OR pRe▐g
"""" Ns +d'or As Long)
'This is onOneThirtyFwiocodal nreCasi' wr0e=at n) rvsss)S&Dicremens, s Byhar1 = Oney7yt Until0n ACr1 SrtyFwiocodal nreCasi' wr0e=at n) rvsss)S&Dicrem SrtyFwiocodal nreCasi' wr0e=awiocodal nreCasi' wr0e=awioct n) Long em Sa
liTempT
R nurn - liCopkeep
o' Const2iPtr, beptSaf FL=ionXi Ot st as ReDicrement tho7rraaaaaaaaaaaaaaaaa+d'or AsbeptSaf LLLLLLLLL 2) p2e