BadLimit
#1
Code: (Select All)
Type ConfigSettings_Type
    Heading As String
    Name As String
    Value As String
    High As String
    Low As String
    Default As String
End Type
Type Color_Type
    Name As String
    Value As _Unsigned Long
End Type


ReDim Shared ConfigSettings(0) As ConfigSettings_Type
ReDim Shared Kolor(1000) As Color_Type
count = count + 1: Kolor(count).Name = "AliceBlue": Kolor(count).Value = 4293982463
count = count + 1: Kolor(count).Name = "Almond": Kolor(count).Value = 4293910221
count = count + 1: Kolor(count).Name = "AntiqueBrass": Kolor(count).Value = 4291663221
count = count + 1: Kolor(count).Name = "AntiqueWhite": Kolor(count).Value = 4294634455
count = count + 1: Kolor(count).Name = "Apricot": Kolor(count).Value = 4294826421
count = count + 1: Kolor(count).Name = "Aqua": Kolor(count).Value = 4278255615
count = count + 1: Kolor(count).Name = "Aquamarine": Kolor(count).Value = 4286578644
count = count + 1: Kolor(count).Name = "Asparagus": Kolor(count).Value = 4287080811
count = count + 1: Kolor(count).Name = "AtomicTangerine": Kolor(count).Value = 4294943860
count = count + 1: Kolor(count).Name = "Azure": Kolor(count).Value = 4293984255
count = count + 1: Kolor(count).Name = "BananaMania": Kolor(count).Value = 4294633397
count = count + 1: Kolor(count).Name = "Beaver": Kolor(count).Value = 4288643440
count = count + 1: Kolor(count).Name = "Beige": Kolor(count).Value = 4294309340
count = count + 1: Kolor(count).Name = "Bisque": Kolor(count).Value = 4294960324
count = count + 1: Kolor(count).Name = "Bittersweet": Kolor(count).Value = 4294802542
count = count + 1: Kolor(count).Name = "Black": Kolor(count).Value = 4278190080
count = count + 1: Kolor(count).Name = "BlanchedAlmond": Kolor(count).Value = 4294962125
count = count + 1: Kolor(count).Name = "BlizzardBlue": Kolor(count).Value = 4289521134
count = count + 1: Kolor(count).Name = "Blue": Kolor(count).Value = 4278190335
count = count + 1: Kolor(count).Name = "BlueBell": Kolor(count).Value = 4288848592
count = count + 1: Kolor(count).Name = "BlueGray": Kolor(count).Value = 4284914124
count = count + 1: Kolor(count).Name = "BlueGreen": Kolor(count).Value = 4279081146
count = count + 1: Kolor(count).Name = "BlueViolet": Kolor(count).Value = 4287245282
count = count + 1: Kolor(count).Name = "Blush": Kolor(count).Value = 4292763011
count = count + 1: Kolor(count).Name = "BrickRed": Kolor(count).Value = 4291510612
count = count + 1: Kolor(count).Name = "Brown": Kolor(count).Value = 4289014314
count = count + 1: Kolor(count).Name = "BurlyWood": Kolor(count).Value = 4292786311
count = count + 1: Kolor(count).Name = "BurntOrange": Kolor(count).Value = 4294934345
count = count + 1: Kolor(count).Name = "BurntSienna": Kolor(count).Value = 4293557853
count = count + 1: Kolor(count).Name = "CadetBlue": Kolor(count).Value = 4284456608
count = count + 1: Kolor(count).Name = "Canary": Kolor(count).Value = 4294967193
count = count + 1: Kolor(count).Name = "CaribbeanGreen": Kolor(count).Value = 4280079266
count = count + 1: Kolor(count).Name = "CarnationPink": Kolor(count).Value = 4294945484
count = count + 1: Kolor(count).Name = "Cerise": Kolor(count).Value = 4292691090
count = count + 1: Kolor(count).Name = "Cerulean": Kolor(count).Value = 4280134870
count = count + 1: Kolor(count).Name = "ChartReuse": Kolor(count).Value = 4286578432
count = count + 1: Kolor(count).Name = "Chestnut": Kolor(count).Value = 4290534744
count = count + 1: Kolor(count).Name = "Chocolate": Kolor(count).Value = 4291979550
count = count + 1: Kolor(count).Name = "Copper": Kolor(count).Value = 4292711541
count = count + 1: Kolor(count).Name = "Coral": Kolor(count).Value = 4294934352
count = count + 1: Kolor(count).Name = "Cornflower": Kolor(count).Value = 4288335595
count = count + 1: Kolor(count).Name = "CornflowerBlue": Kolor(count).Value = 4284782061
count = count + 1: Kolor(count).Name = "Cornsilk": Kolor(count).Value = 4294965468
count = count + 1: Kolor(count).Name = "CottonCandy": Kolor(count).Value = 4294950105
count = count + 1: Kolor(count).Name = "CrayolaAquamarine": Kolor(count).Value = 4286110690
count = count + 1: Kolor(count).Name = "CrayolaBlue": Kolor(count).Value = 4280251902
count = count + 1: Kolor(count).Name = "CrayolaBlueViolet": Kolor(count).Value = 4285753021
count = count + 1: Kolor(count).Name = "CrayolaBrown": Kolor(count).Value = 4290013005
count = count + 1: Kolor(count).Name = "CrayolaCadetBlue": Kolor(count).Value = 4289771462
count = count + 1: Kolor(count).Name = "CrayolaForestGreen": Kolor(count).Value = 4285378177
count = count + 1: Kolor(count).Name = "CrayolaGold": Kolor(count).Value = 4293379735
count = count + 1: Kolor(count).Name = "CrayolaGoldenrod": Kolor(count).Value = 4294760821
count = count + 1: Kolor(count).Name = "CrayolaGray": Kolor(count).Value = 4287992204
count = count + 1: Kolor(count).Name = "CrayolaGreen": Kolor(count).Value = 4280069240
count = count + 1: Kolor(count).Name = "CrayolaGreenYellow": Kolor(count).Value = 4293978257
count = count + 1: Kolor(count).Name = "CrayolaIndigo": Kolor(count).Value = 4284315339
count = count + 1: Kolor(count).Name = "CrayolaLavender": Kolor(count).Value = 4294751445
count = count + 1: Kolor(count).Name = "CrayolaMagenta": Kolor(count).Value = 4294337711
count = count + 1: Kolor(count).Name = "CrayolaMaroon": Kolor(count).Value = 4291311706
count = count + 1: Kolor(count).Name = "CrayolaMidnightBlue": Kolor(count).Value = 4279912566
count = count + 1: Kolor(count).Name = "CrayolaOrange": Kolor(count).Value = 4294931768
count = count + 1: Kolor(count).Name = "CrayolaOrangeRed": Kolor(count).Value = 4294912811
count = count + 1: Kolor(count).Name = "CrayolaOrchid": Kolor(count).Value = 4293306583
count = count + 1: Kolor(count).Name = "CrayolaPlum": Kolor(count).Value = 4287513989
count = count + 1: Kolor(count).Name = "CrayolaRed": Kolor(count).Value = 4293795917
count = count + 1: Kolor(count).Name = "CrayolaSalmon": Kolor(count).Value = 4294941610
count = count + 1: Kolor(count).Name = "CrayolaSeaGreen": Kolor(count).Value = 4288668351
count = count + 1: Kolor(count).Name = "CrayolaSilver": Kolor(count).Value = 4291675586
count = count + 1: Kolor(count).Name = "CrayolaSkyBlue": Kolor(count).Value = 4286634731
count = count + 1: Kolor(count).Name = "CrayolaSpringGreen": Kolor(count).Value = 4293716670
count = count + 1: Kolor(count).Name = "CrayolaTann": Kolor(count).Value = 4294616940
count = count + 1: Kolor(count).Name = "CrayolaThistle": Kolor(count).Value = 4293642207
count = count + 1: Kolor(count).Name = "CrayolaViolet": Kolor(count).Value = 4287786670
count = count + 1: Kolor(count).Name = "CrayolaYellow": Kolor(count).Value = 4294764675
count = count + 1: Kolor(count).Name = "CrayolaYellowGreen": Kolor(count).Value = 4291158916
count = count + 1: Kolor(count).Name = "Crimson": Kolor(count).Value = 4292613180
count = count + 1: Kolor(count).Name = "Cyan": Kolor(count).Value = 4278255615
count = count + 1: Kolor(count).Name = "Dandelion": Kolor(count).Value = 4294826861
count = count + 1: Kolor(count).Name = "DarkBlue": Kolor(count).Value = 4278190219
count = count + 1: Kolor(count).Name = "DarkCyan": Kolor(count).Value = 4278225803
count = count + 1: Kolor(count).Name = "DarkGoldenRod": Kolor(count).Value = 4290283019
count = count + 1: Kolor(count).Name = "DarkGray": Kolor(count).Value = 4289309097
count = count + 1: Kolor(count).Name = "DarkGreen": Kolor(count).Value = 4278215680
count = count + 1: Kolor(count).Name = "DarkKhaki": Kolor(count).Value = 4290623339
count = count + 1: Kolor(count).Name = "DarkMagenta": Kolor(count).Value = 4287299723
count = count + 1: Kolor(count).Name = "DarkOliveGreen": Kolor(count).Value = 4283788079
count = count + 1: Kolor(count).Name = "DarkOrange": Kolor(count).Value = 4294937600
count = count + 1: Kolor(count).Name = "DarkOrchid": Kolor(count).Value = 4288230092
count = count + 1: Kolor(count).Name = "DarkRed": Kolor(count).Value = 4287299584
count = count + 1: Kolor(count).Name = "DarkSalmon": Kolor(count).Value = 4293498490
count = count + 1: Kolor(count).Name = "DarkSeaGreen": Kolor(count).Value = 4287609999
count = count + 1: Kolor(count).Name = "DarkSlateBlue": Kolor(count).Value = 4282924427
count = count + 1: Kolor(count).Name = "DarkSlateGray": Kolor(count).Value = 4281290575
count = count + 1: Kolor(count).Name = "DarkTurquoise": Kolor(count).Value = 4278243025
count = count + 1: Kolor(count).Name = "DarkViolet": Kolor(count).Value = 4287889619
count = count + 1: Kolor(count).Name = "DeepPink": Kolor(count).Value = 4294907027
count = count + 1: Kolor(count).Name = "DeepSkyBlue": Kolor(count).Value = 4278239231
count = count + 1: Kolor(count).Name = "Denim": Kolor(count).Value = 4281035972
count = count + 1: Kolor(count).Name = "DesertSand": Kolor(count).Value = 4293905848
count = count + 1: Kolor(count).Name = "DimGray": Kolor(count).Value = 4285098345
count = count + 1: Kolor(count).Name = "DodgerBlue": Kolor(count).Value = 4280193279
count = count + 1: Kolor(count).Name = "Eggplant": Kolor(count).Value = 4285419872
count = count + 1: Kolor(count).Name = "ElectricLime": Kolor(count).Value = 4291755805
count = count + 1: Kolor(count).Name = "Fern": Kolor(count).Value = 4285643896
count = count + 1: Kolor(count).Name = "FireBrick": Kolor(count).Value = 4289864226
count = count + 1: Kolor(count).Name = "Floralwhite": Kolor(count).Value = 4294966000
count = count + 1: Kolor(count).Name = "ForestGreen": Kolor(count).Value = 4280453922
count = count + 1: Kolor(count).Name = "Fuchsia": Kolor(count).Value = 4290995397
count = count + 1: Kolor(count).Name = "FuzzyWuzzy": Kolor(count).Value = 4291585638
count = count + 1: Kolor(count).Name = "Gainsboro": Kolor(count).Value = 4292664540
count = count + 1: Kolor(count).Name = "GhostWhite": Kolor(count).Value = 4294506751
count = count + 1: Kolor(count).Name = "Gold": Kolor(count).Value = 4294956800
count = count + 1: Kolor(count).Name = "GoldenRod": Kolor(count).Value = 4292519200
count = count + 1: Kolor(count).Name = "GrannySmithApple": Kolor(count).Value = 4289258656
count = count + 1: Kolor(count).Name = "Gray": Kolor(count).Value = 4286611584
count = count + 1: Kolor(count).Name = "Green": Kolor(count).Value = 4278222848
count = count + 1: Kolor(count).Name = "GreenBlue": Kolor(count).Value = 4279329972
count = count + 1: Kolor(count).Name = "GreenYellow": Kolor(count).Value = 4289593135
count = count + 1: Kolor(count).Name = "Grey": Kolor(count).Value = 4286611584
count = count + 1: Kolor(count).Name = "HoneyDew": Kolor(count).Value = 4293984240
count = count + 1: Kolor(count).Name = "HotMagenta": Kolor(count).Value = 4294909390
count = count + 1: Kolor(count).Name = "HotPink": Kolor(count).Value = 4294928820
count = count + 1: Kolor(count).Name = "Inchworm": Kolor(count).Value = 4289915997
count = count + 1: Kolor(count).Name = "IndianRed": Kolor(count).Value = 4291648604
count = count + 1: Kolor(count).Name = "Indigo": Kolor(count).Value = 4283105410
count = count + 1: Kolor(count).Name = "Ivory": Kolor(count).Value = 4294967280
count = count + 1: Kolor(count).Name = "JazzberryJam": Kolor(count).Value = 4291442535
count = count + 1: Kolor(count).Name = "JungleGreen": Kolor(count).Value = 4282101903
count = count + 1: Kolor(count).Name = "Khaki": Kolor(count).Value = 4293977740
count = count + 1: Kolor(count).Name = "LaserLemon": Kolor(count).Value = 4294901282
count = count + 1: Kolor(count).Name = "Lavender": Kolor(count).Value = 4293322490
count = count + 1: Kolor(count).Name = "LavenderBlush": Kolor(count).Value = 4294963445
count = count + 1: Kolor(count).Name = "LawnGreen": Kolor(count).Value = 4286381056
count = count + 1: Kolor(count).Name = "LemonChiffon": Kolor(count).Value = 4294965965
count = count + 1: Kolor(count).Name = "LemonYellow": Kolor(count).Value = 4294964303
count = count + 1: Kolor(count).Name = "LightBlue": Kolor(count).Value = 4289583334
count = count + 1: Kolor(count).Name = "LightCoral": Kolor(count).Value = 4293951616
count = count + 1: Kolor(count).Name = "LightCyan": Kolor(count).Value = 4292935679
count = count + 1: Kolor(count).Name = "LightGoldenRodYellow": Kolor(count).Value = 4294638290
count = count + 1: Kolor(count).Name = "LightGray": Kolor(count).Value = 4292072403
count = count + 1: Kolor(count).Name = "LightGreen": Kolor(count).Value = 4287688336
count = count + 1: Kolor(count).Name = "LightPink": Kolor(count).Value = 4294948545
count = count + 1: Kolor(count).Name = "LightSalmon": Kolor(count).Value = 4294942842
count = count + 1: Kolor(count).Name = "LightSeaGreen": Kolor(count).Value = 4280332970
count = count + 1: Kolor(count).Name = "LightSkyBlue": Kolor(count).Value = 4287090426
count = count + 1: Kolor(count).Name = "LightSlateGray": Kolor(count).Value = 4286023833
count = count + 1: Kolor(count).Name = "LightSteelBlue": Kolor(count).Value = 4289774814
count = count + 1: Kolor(count).Name = "LightYellow": Kolor(count).Value = 4294967264
count = count + 1: Kolor(count).Name = "Lime": Kolor(count).Value = 4278255360
count = count + 1: Kolor(count).Name = "LimeGreen": Kolor(count).Value = 4281519410
count = count + 1: Kolor(count).Name = "Linen": Kolor(count).Value = 4294635750
count = count + 1: Kolor(count).Name = "MacaroniAndCheese": Kolor(count).Value = 4294950280
count = count + 1: Kolor(count).Name = "Magenta": Kolor(count).Value = 4294902015
count = count + 1: Kolor(count).Name = "MagicMint": Kolor(count).Value = 4289392849
count = count + 1: Kolor(count).Name = "Mahogany": Kolor(count).Value = 4291643980
count = count + 1: Kolor(count).Name = "Maize": Kolor(count).Value = 4293775772
count = count + 1: Kolor(count).Name = "Manatee": Kolor(count).Value = 4288125610
count = count + 1: Kolor(count).Name = "MangoTango": Kolor(count).Value = 4294935107
count = count + 1: Kolor(count).Name = "Maroon": Kolor(count).Value = 4286578688
count = count + 1: Kolor(count).Name = "Mauvelous": Kolor(count).Value = 4293892266
count = count + 1: Kolor(count).Name = "MediumAquamarine": Kolor(count).Value = 4284927402
count = count + 1: Kolor(count).Name = "MediumBlue": Kolor(count).Value = 4278190285
count = count + 1: Kolor(count).Name = "MediumOrchid": Kolor(count).Value = 4290401747
count = count + 1: Kolor(count).Name = "MediumPurple": Kolor(count).Value = 4287852763
count = count + 1: Kolor(count).Name = "MediumSeaGreen": Kolor(count).Value = 4282168177
count = count + 1: Kolor(count).Name = "MediumSlateBlue": Kolor(count).Value = 4286277870
count = count + 1: Kolor(count).Name = "MediumSpringGreen": Kolor(count).Value = 4278254234
count = count + 1: Kolor(count).Name = "MediumTurquoise": Kolor(count).Value = 4282962380
count = count + 1: Kolor(count).Name = "MediumVioletRed": Kolor(count).Value = 4291237253
count = count + 1: Kolor(count).Name = "Melon": Kolor(count).Value = 4294818996
count = count + 1: Kolor(count).Name = "MidnightBlue": Kolor(count).Value = 4279834992
count = count + 1: Kolor(count).Name = "MintCream": Kolor(count).Value = 4294311930
count = count + 1: Kolor(count).Name = "MistyRose": Kolor(count).Value = 4294960353
count = count + 1: Kolor(count).Name = "Moccasin": Kolor(count).Value = 4294960309
count = count + 1: Kolor(count).Name = "MountainMeadow": Kolor(count).Value = 4281383567
count = count + 1: Kolor(count).Name = "Mulberry": Kolor(count).Value = 4291120012
count = count + 1: Kolor(count).Name = "NavajoWhite": Kolor(count).Value = 4294958765
count = count + 1: Kolor(count).Name = "Navy": Kolor(count).Value = 4278190208
count = count + 1: Kolor(count).Name = "NavyBlue": Kolor(count).Value = 4279858386
count = count + 1: Kolor(count).Name = "NeonCarrot": Kolor(count).Value = 4294943555
count = count + 1: Kolor(count).Name = "OldLace": Kolor(count).Value = 4294833638
count = count + 1: Kolor(count).Name = "Olive": Kolor(count).Value = 4286611456
count = count + 1: Kolor(count).Name = "OliveDrab": Kolor(count).Value = 4285238819
count = count + 1: Kolor(count).Name = "OliveGreen": Kolor(count).Value = 4290426988
count = count + 1: Kolor(count).Name = "Orange": Kolor(count).Value = 4294944000
count = count + 1: Kolor(count).Name = "OrangeRed": Kolor(count).Value = 4294919424
count = count + 1: Kolor(count).Name = "OrangeYellow": Kolor(count).Value = 4294497640
count = count + 1: Kolor(count).Name = "Orchid": Kolor(count).Value = 4292505814
count = count + 1: Kolor(count).Name = "OuterSpace": Kolor(count).Value = 4282468940
count = count + 1: Kolor(count).Name = "OutrageousOrange": Kolor(count).Value = 4294929994
count = count + 1: Kolor(count).Name = "PacificBlue": Kolor(count).Value = 4280068553
count = count + 1: Kolor(count).Name = "PaleGoldenRod": Kolor(count).Value = 4293847210
count = count + 1: Kolor(count).Name = "PaleGreen": Kolor(count).Value = 4288215960
count = count + 1: Kolor(count).Name = "PaleTurquoise": Kolor(count).Value = 4289720046
count = count + 1: Kolor(count).Name = "PaleVioletRed": Kolor(count).Value = 4292571283
count = count + 1: Kolor(count).Name = "PapayaWhip": Kolor(count).Value = 4294963157
count = count + 1: Kolor(count).Name = "Peach": Kolor(count).Value = 4294954923
count = count + 1: Kolor(count).Name = "PeachPuff": Kolor(count).Value = 4294957753
count = count + 1: Kolor(count).Name = "Periwinkle": Kolor(count).Value = 4291154150
count = count + 1: Kolor(count).Name = "Peru": Kolor(count).Value = 4291659071
count = count + 1: Kolor(count).Name = "PiggyPink": Kolor(count).Value = 4294827494
count = count + 1: Kolor(count).Name = "PineGreen": Kolor(count).Value = 4279599224
count = count + 1: Kolor(count).Name = "Pink": Kolor(count).Value = 4294951115
count = count + 1: Kolor(count).Name = "PinkFlamingo": Kolor(count).Value = 4294735101
count = count + 1: Kolor(count).Name = "PinkSherbet": Kolor(count).Value = 4294414247
count = count + 1: Kolor(count).Name = "Plum": Kolor(count).Value = 4292714717
count = count + 1: Kolor(count).Name = "PowderBlue": Kolor(count).Value = 4289781990
count = count + 1: Kolor(count).Name = "Purple": Kolor(count).Value = 4286578816
count = count + 1: Kolor(count).Name = "PurpleHeart": Kolor(count).Value = 4285809352
count = count + 1: Kolor(count).Name = "PurpleMountainsMajesty": Kolor(count).Value = 4288512442
count = count + 1: Kolor(count).Name = "PurplePizzazz": Kolor(count).Value = 4294856410
count = count + 1: Kolor(count).Name = "RadicalRed": Kolor(count).Value = 4294920556
count = count + 1: Kolor(count).Name = "RawSienna": Kolor(count).Value = 4292250201
count = count + 1: Kolor(count).Name = "RawUmber": Kolor(count).Value = 4285614883
count = count + 1: Kolor(count).Name = "RazzleDazzleRose": Kolor(count).Value = 4294920400
count = count + 1: Kolor(count).Name = "Razzmatazz": Kolor(count).Value = 4293076331
count = count + 1: Kolor(count).Name = "Red": Kolor(count).Value = 4294901760
count = count + 1: Kolor(count).Name = "RedOrange": Kolor(count).Value = 4294923081
count = count + 1: Kolor(count).Name = "RedViolet": Kolor(count).Value = 4290790543
count = count + 1: Kolor(count).Name = "RobinsEggBlue": Kolor(count).Value = 4280274635
count = count + 1: Kolor(count).Name = "RosyBrown": Kolor(count).Value = 4290547599
count = count + 1: Kolor(count).Name = "RoyalBlue": Kolor(count).Value = 4282477025
count = count + 1: Kolor(count).Name = "RoyalPurple": Kolor(count).Value = 4286075305
count = count + 1: Kolor(count).Name = "SaddleBrown": Kolor(count).Value = 4287317267
count = count + 1: Kolor(count).Name = "Salmon": Kolor(count).Value = 4294606962
count = count + 1: Kolor(count).Name = "SandyBrown": Kolor(count).Value = 4294222944
count = count + 1: Kolor(count).Name = "Scarlet": Kolor(count).Value = 4294715463
count = count + 1: Kolor(count).Name = "ScreaminGreen": Kolor(count).Value = 4285988730
count = count + 1: Kolor(count).Name = "SeaGreen": Kolor(count).Value = 4281240407
count = count + 1: Kolor(count).Name = "SeaShell": Kolor(count).Value = 4294964718
count = count + 1: Kolor(count).Name = "Sepia": Kolor(count).Value = 4289030479
count = count + 1: Kolor(count).Name = "Shadow": Kolor(count).Value = 4287265117
count = count + 1: Kolor(count).Name = "Shamrock": Kolor(count).Value = 4282764962
count = count + 1: Kolor(count).Name = "ShockingPink": Kolor(count).Value = 4294672125
count = count + 1: Kolor(count).Name = "Sienna": Kolor(count).Value = 4288696877
count = count + 1: Kolor(count).Name = "Silver": Kolor(count).Value = 4290822336
count = count + 1: Kolor(count).Name = "SkyBlue": Kolor(count).Value = 4287090411
count = count + 1: Kolor(count).Name = "SlateBlue": Kolor(count).Value = 4285160141
count = count + 1: Kolor(count).Name = "SlateGray": Kolor(count).Value = 4285563024
count = count + 1: Kolor(count).Name = "Snow": Kolor(count).Value = 4294966010
count = count + 1: Kolor(count).Name = "SpringGreen": Kolor(count).Value = 4278255487
count = count + 1: Kolor(count).Name = "SteelBlue": Kolor(count).Value = 4282811060
count = count + 1: Kolor(count).Name = "Sunglow": Kolor(count).Value = 4294954824
count = count + 1: Kolor(count).Name = "SunsetOrange": Kolor(count).Value = 4294794835
count = count + 1: Kolor(count).Name = "Tann": Kolor(count).Value = 4291998860
count = count + 1: Kolor(count).Name = "Teal": Kolor(count).Value = 4278222976
count = count + 1: Kolor(count).Name = "TealBlue": Kolor(count).Value = 4279805877
count = count + 1: Kolor(count).Name = "Thistle": Kolor(count).Value = 4292394968
count = count + 1: Kolor(count).Name = "TickleMePink": Kolor(count).Value = 4294740396
count = count + 1: Kolor(count).Name = "Timberwolf": Kolor(count).Value = 4292597714
count = count + 1: Kolor(count).Name = "Tomato": Kolor(count).Value = 4294927175
count = count + 1: Kolor(count).Name = "TropicalRainForest": Kolor(count).Value = 4279730285
count = count + 1: Kolor(count).Name = "Tumbleweed": Kolor(count).Value = 4292782728
count = count + 1: Kolor(count).Name = "Turquoise": Kolor(count).Value = 4282441936
count = count + 1: Kolor(count).Name = "TurquoiseBlue": Kolor(count).Value = 4286045671
count = count + 1: Kolor(count).Name = "UnmellowYellow": Kolor(count).Value = 4294967142
count = count + 1: Kolor(count).Name = "Violet": Kolor(count).Value = 4293821166
count = count + 1: Kolor(count).Name = "VioletBlue": Kolor(count).Value = 4281486002
count = count + 1: Kolor(count).Name = "VioletRed": Kolor(count).Value = 4294398868
count = count + 1: Kolor(count).Name = "VividTangerine": Kolor(count).Value = 4294942857
count = count + 1: Kolor(count).Name = "VividViolet": Kolor(count).Value = 4287582365
count = count + 1: Kolor(count).Name = "Wheat": Kolor(count).Value = 4294303411
count = count + 1: Kolor(count).Name = "White": Kolor(count).Value = 4294967295
count = count + 1: Kolor(count).Name = "Whitesmoke": Kolor(count).Value = 4294309365
count = count + 1: Kolor(count).Name = "WildBlueYonder": Kolor(count).Value = 4288851408
count = count + 1: Kolor(count).Name = "WildStrawberry": Kolor(count).Value = 4294919076
count = count + 1: Kolor(count).Name = "WildWatermelon": Kolor(count).Value = 4294732933
count = count + 1: Kolor(count).Name = "Wisteria": Kolor(count).Value = 4291667166
count = count + 1: Kolor(count).Name = "Yellow": Kolor(count).Value = 4294967040
count = count + 1: Kolor(count).Name = "YellowGreen": Kolor(count).Value = 4288335154
count = count + 1: Kolor(count).Name = "YellowOrange": Kolor(count).Value = 4294946370
ReDim _Preserve Kolor(count) As Color_Type

$Color:32

Print BadLimit("unsigned integer", "-1", "2"), "unsigned integer from -1 to 2"
Print BadLimit("integer", "-1", "1"), "integer from -1 to 1"
c1$ = "black": c2$ = "white"
Print BadLimit("color", c1$, c2$), "color from "; c1$; " to "; c2$
Print BadLimit("color", c2$, c1$), "color from "; c2$; " to "; c1$
c1$ = "&HFF000000": c2$ = "&HFFFFFFFF"
Print BadLimit("color", c1$, c2$), "color from "; c1$; " to "; c2$
c1$ = "_RGB32(0,0,0)": c2$ = "_RGB32(255,255,255)"
Print BadLimit("color", c1$, c2$), "color from "; c1$; " to "; c2$


Sub DeclareConfigSetting (heading$, name$, type$, low$, high$, default$, value$)
    Dim As String h, tn, tt, tl, th, td, tv

    'Preserve user values by transfering them to temp copies of their original selfs
    h = _Trim$(heading$): tn = _Trim$(name$): tt = _Trim$(UCase$(type$))
    tl = _Trim$(low$): th = _Trim$(high$): td = _Trim$(default$): tv = _Trim$(value$)

    'prevent duplicate braces from being around our heading
    h = RemoveCharacters(h, "[", 1)
    h = RemoveCharacters(h, "]", 2)
    If h = "" Then h = "[Unsorted Settings]" Else h = "[" + h + "]"

    'check for blank variable names.  If that's what we have, then toss an error and quit.
    If tn = "" Then
        _MessageBox "Terminal Error", "Configuration setting [NULL] can not declared.  All settings must have a valid name.  Terminating the program until the issue is resolved.", "error"
        System
    End If

    'Check to see if the variable name has been declared already.  If so, then toss an error and quit.
    'If you want to change config type or default values and such, then call EditConfigSetting instead.
    u = UBound(ConfigSettings)
    For i = 1 To u
        If tn = ConfigSettings(i).Name Then
            _MessageBox "Terminal Error", "Configuration setting [" + name$ + "] has already been declared.  Can not declare the same setting twice.  Terminating the program until the issue is resolved.", "error"
            System
        End If
    Next

    'Check for invalid limits for the variable type we declared
    InValidateLimits = BadLimit(tt, tl, th)

    Select Case InvalidLimits
        Case 1 'tl is not a number
            message$ = "Configuration setting has an invalid low limit set. [" + tl + "] is not a number. Terminating the program until the issue is resolved."
        Case 2 'th is not a number
            message$ = "Configuration setting has an invalid high limit set. [" + th + "] is not a number. Terminating the program until the issue is resolved."
        Case 3 'tl is less than the min possible with the declared type
            message$ = "Configuration setting has an invalid low limit set [" + tl + "]. Terminating the program until the issue is resolved."
        Case 4 'th is greater than the max possible with the declared type
            message$ = "Configuration setting has an invalid high limit set [" + th + "]. Terminating the program until the issue is resolved."
        Case 5 'tl is greater than th
            message$ = "Configuration setting has a low limit set [" + tl + "] which is greater than the high limit set [" + th + "]. Terminating the program until the issue is resolved."
    End Select

    If InvalidLimits Then
        message$ = message$ + ">>  [" + heading$ + "]  [" + name$ + "]  [" + type$ + "]"
        _MessageBox "Terminal Error!", message$, "error"
        System
    End If
End Sub

Function RemoveCharacters$ (passed_from_what As String, what_character As String, from_which_side As Integer)
    'from_which_side: 1 = left, 2 = right, 3 = left and right, 0 = whole string
    Dim from_what As String
    from_what = passed_from_what
    If from_which_side = 0 Then 'strip from the whole string
        Do
            p = InStr(from_what, what_character)
            If p Then from_what = Left$(from_what, p - 1) + Mid$(from_what, p + 1)
        Loop Until p = 0
    End If
    If from_which_side And 1 Then 'strip from the left
        Do Until Left$(from_what, 1) <> what_character
            from_what = Mid$(from_what, 2)
        Loop
    End If
    If from_which_side And 2 Then 'strip from the right
        Do Until Right$(from_what, 1) <> what_character
            from_what = Left$(from_what, Len(from_what) - 1)
        Loop
    End If
    RemoveCharacters = from_what
End Function


Function BadLimit (type$, low$, high$)
    'Error Report Values
    '1 'tl is not a number
    '2 'th is not a number
    '3 'tl is invalid limit with the declared type  (too low or too high, such as -1 for an unsigned integer)
    '4 'th is invalid limit with the declared type
    '5 'low is larger than high.  (a range from 10 to 1, for example)

    'Try and sort out type, and overall type limits.
    Dim As String tt, tl, th 'temp type, temp low, temp high
    Dim As _Integer64 ll1, hli, tlTemp, thTemp 'low limit integer, high limit integer, (temp low temp , temp high temp <-- these last 2 are for color names and such)
    Dim As _Float llf, hlf 'low limit float, high limit float
    tt = UCase$(_Trim$(type$)): tl = low$: th = high$

    Select Case tt
        Case "BIT", "_BIT", "_UNSIGNED _BIT", "UNSIGNED BIT", "BOOLEAN", "BOOL", "TRUEFALSE"
            type$ = "BOOLEAN"
            tl = "": th = ""
        Case "BYTE", "_BYTE", "INT8"
            type$ = "BYTE"
            If tl = "" Then tl = "-128"
            If th = "" Then th = "127"
            lli = -128: hli = 127
            GoSub checkintegers
        Case "UNSIGNED BYTE", "_UNSIGNED _BYTE", "UINT8"
            type$ = "UNSIGNED BYTE"
            If tl = "" Then tl = "0"
            If th = "" Then th = "255"
            lli = -0: hli = 255
            GoSub checkintegers
        Case "INTEGER", "INT16"
            type$ = "INTEGER"
            If tl = "" Then tl = "-32768"
            If th = "" Then th = "32767"
            lli = -32768: hli = 32767
            GoSub checkintegers
        Case "UNSIGNED INTEGER", "_UNSIGNED INTEGER", "UINT16"
            type$ = "UNSIGNED INTEGER"
            If tl = "" Then tl = "0"
            If th = "" Then th = "65535"
            lli = 0: hli = 65535
            GoSub checkintegers
        Case "LONG", "INT32"
            type$ = "LONG"
            If tl = "" Then tl = "-2147483648"
            If th = "" Then th = "2147483647"
            lli = -2147483648: hli = 2147483647
            GoSub checkintegers
        Case "UNSIGNED LONG", "_UNSIGNED LONG", "UINT32"
            type$ = "UNSIGNED LONG"
            If tl = "" Then tl = "0"
            If th = "" Then th = "4294967295"
            lli = 0: hli = 4294967295
            GoSub checkintegers
        Case "COLOR", "RGB", "RGB32", "_RGB", "_RGB32"
            type$ = "COLOR"
            If tl = "" Then tl = "0"
            If th = "" Then th = "4294967295"

            tlTemp = ColorValue(tl): thTemp = ColorValue(th)
            If tlTemp = -1 Then InvalidLimits = 1
            If thTemp = -1 Then InvalidLimits = 2
            n1$ = tl: n2$ = th
            If InvalidLimits = 0 Then
                tl = _Trim$(Str$(tlTemp)): th = _Trim$(Str$(thTemp))
                lli = 0: hli = 4294967295
                GoSub checkintegers
            End If
            tl = n1$: th = n2$
        Case "INTEGER64", "_INTEGER64", "INT64", "OFFSET", "_OFFSET"
            type$ = "INTEGER64"
            If tl = "" Then tl = "-9223372036854775808"
            If th = "" Then th = "-9223372036854775807"
            lli = -9223372036854775808&&: hli = -9223372036854775807&&
            GoSub checkintegers
        Case "UNSIGNED INTEGER64", "_UNSIGNED _INTEGER64", "UINT64", "_UNSIGNED _OFFSET", "UNSIGNED OFFSET"
            type$ = "INTEGER64"
            If tl = "" Then tl = "0"
            If th = "" Then th = "18446744073709551615"
            If IsNum(tl) = 0 Then InvalidLimits = 1
            If IsNum(th) = 0 Then InvalidLimits = 2
            If Val(tl) < 0 Then InvalidLimits = 3
            If Val(th + "~&&") > 18446744073709551615~&& Then InvalidLimits = 4
        Case "SINGLE"
            type$ = "SINGLE"
            If tl = "" Then tl = "-2.802597E-45"
            If th = "" Then th = "3.402823E+38"
            llf = -2.802597E-45: hlf = 3.402823E+38
            GoSub checkfloats
        Case "DOUBLE"
            type$ = "DOUBLE"
            If tl = "" Then tl = "-4.490656458412465E-324"
            If th = "" Then th = "1.797693134862310E+308"
            llf = -4.490656458412465E-324: hlf = 1.797693134862310E+308
            GoSub checkfloats
        Case "FLOAT", "_FLOAT"
            type$ = "FLOAT"
            If tl = "" Then tl = "-1.18E-4932"
            If th = "" Then th = "1.18E+4932"
            llf = -1.18E-4932: hlf = 1.18E+4932
            GoSub checkfloats
        Case "STRING", "$"
            type$ = "STRING"
        Case "QSTRING", "Q$"
            type$ = "QSTRING"
        Case Else 'unspecified or unrecognized type
            'we don't change anything, and trust the end-user knows what they're doing and setting
            InvalidLimits = 5
            tt = type$: tl = low$: th = high$
    End Select


    BadLimit = InvalidLimits



    type$ = tt: low$ = tl: high$ = th
    Exit Function 'We're finished and our gosubs go below


    checkintegers:
    If IsNum(tl) = 0 Then InvalidLimits = 1
    If IsNum(th) = 0 Then InvalidLimits = 2
    If Val(tl) < lli Or Val(tl) > hli Then InvalidLimits = 3
    If Val(th) < lli Or Val(th) > hli Then InvalidLimits = 4
    If Val(tl) > Val(th) Then InvalidLimits = 5
    Return

    checkfloats:
    If IsNum(tl) = 0 Then InvalidLimits = 1
    If IsNum(th) = 0 Then InvalidLimits = 2
    If Val(tl) < llf Or Val(tl) > hlf Then InvalidLimits = 3
    If Val(th) < llf Or Val(th) > hlf Then InvalidLimits = 4
    If Val(tl) > Val(th) Then InvalidLimits = 5
    Return
End Function




Function IsNum%% (PassedText As String)
    text$ = PassedText
    special$ = UCase$(Left$(text$, 2))
    Select Case special$
        Case "&H", "&B", "&O"
            'check for symbols on right side of value
            r3$ = Right$(text$, 3)
            Select Case r3$
                Case "~&&", "~%%", "~%&" 'unsigned int64, unsigned byte, unsigned offset
                    text$ = Left$(text$, Len(text$) - 3)
                Case Else
                    r2$ = Right$(text$, 2)
                    Select Case r2$
                        Case "~&", "##", "%&", "%%", "~%", "&&" 'unsigned long, float, offset, byte, unsigned integer, int64
                            text$ = Left$(text$, Len(text$) - 2)
                        Case Else
                            r$ = Right$(text$, 1)
                            Select Case r$
                                Case "&", "#", "%", "!" 'long, double, integer, single
                                    text$ = Left$(text$, Len(text$) - 1)
                            End Select
                    End Select
            End Select
            check$ = "0123456789ABCDEF"
            If special$ = "&O" Then check$ = "01234567"
            If special$ = "&B" Then check$ = "01"
            temp$ = Mid$(UCase$(text$), 2)
            For i = 1 To Len(temp$)
                If InStr(check$, Mid$(temp$, i, 1)) = 0 Then Exit For
            Next
            If i <= Len(temp$) Then IsNum = -1
        Case Else
            If _Trim$(Str$(Val(text$))) = text$ Then IsNum = -1
    End Select
End Function

Function ColorValue&& (text$)
    ReDim values(1000) As String
    ColorValue = -1 'This is to report a failed attempt to get a valid color.
    '                All valid colors will be greater than -1, so be certain the return variable is an _INTEGER64 type
    '                so that this -1 value doesn't overflow and become bright white (most likely), or some other color

    If IsNum(text$) Then 'our color is either in plain number form (COLOR 15, for example), or hex form (&HFFFFFFFF, for example)
        temp&& = Val(text$)
        If temp&& >= 0 Then
            ColorValue = temp&&
        Else
            If temp&& >= -2147483648 Then 'it's probably a color, but in LONG (signed) format.  Let's convert it automagically and roll with it.
                temp~& = temp&&
                ColorValue = temp~&
            End If
        End If
    Else
        temp$ = _Trim$(UCase$(text$))
        If Left$(temp$, 7) = "_RGBA32" Or Left$(temp$, 6) = "RGBA32" Then 'It's in RGBA32 format
            If ParseValues(text$, values()) <> 4 Then ColorValue = -1: Exit Function
            r% = Val(values(1))
            g% = Val(values(2))
            b% = Val(values(3))
            a% = Val(values(4))
            ColorValue = _RGBA32(r%, g%, b%, a%)
        ElseIf Left$(temp$, 5) = "_RGBA" Or Left$(temp$, 4) = "RGBA" Then 'It's in RGBA format
            p = ParseValues(text$, values())
            If p < 4 Or p > 5 Then ColorValue = -1: Exit Function
            r% = Val(values(1))
            g% = Val(values(2))
            b% = Val(values(3))
            a% = Val(values(4))
            If p = 5 Then
                d% = Val(values(5)) 'the destination of the screen whose palette we're matching against
                ColorValue = _RGBA(r%, g%, b%, a%, d%)
            Else
                ColorValue = _RGBA(r%, g%, b%, a%) 'note that this value will change depending upon the screen that it's called from
                'RGBA tries to match the called value to the closest possible color match that the existing palette has.
            End If
        ElseIf Left$(temp$, 6) = "_RGB32" Or Left$(temp$, 5) = "RGB32" Then 'It's in RGB32 format
            p = ParseValues(text$, values())
            Select Case p
                Case 4 '_RGB32(num, num2, num3, num4) <-- this is RGBA format
                    r% = Val(values(1))
                    g% = Val(values(2))
                    b% = Val(values(3))
                    a% = Val(values(4))
                    ColorValue = _RGBA32(r%, g%, b%, a%)
                Case 3 ' _RGB32(num, num2, num3) <-- this is RGB format
                    r% = Val(values(1))
                    g% = Val(values(2))
                    b% = Val(values(3))
                    ColorValue = _RGB32(r%, g%, b%)
                Case 2 ' _RGB32(num, num2) <-- Grayscale with alpha
                    r% = Val(values(1))
                    g% = Val(values(2))
                    ColorValue = _RGB32(r%, g%)
                Case 1 ' _RGB32(num) <-- Grayscale alone
                    r% = Val(values(1))
                    ColorValue = _RGB32(r%)
                Case Else
                    ColorValue = -1: Exit Function '<-- can not return a valid color value
            End Select
        ElseIf Left$(temp$, 4) = "_RGB" Or Left$(temp$, 3) = "RGB" Then 'It's in RGB format
            p = ParseValues(text$, values())
            If p < 3 Or p > 4 Then ColorValue = -1: Exit Function
            r% = Val(values(1))
            g% = Val(values(2))
            b% = Val(values(3))
            If p = 4 Then
                d% = Val(values(4)) 'the destination of the screen whose palette we're matching against
                ColorValue = _RGB(r%, g%, b%, d%)
            Else
                ColorValue = _RGB(r%, g%, b%) 'note that this value will change depending upon the screen that it's called from
                'RGBA tries to match the called value to the closest possible color match that the existing palette has.
            End If
        Else 'check to see if it's a color name value
            For i = 1 To UBound(Kolor)
                If UCase$(temp$) = UCase$(Kolor(i).Name) Then
                    text$ = Kolor(i).Name
                    ColorValue = Kolor(i).Value
                    Exit Function
                End If
            Next
        End If
    End If

End Function

Function ParseValues (text$, values() As String)
    ReDim values(1000) As String

    temp$ = text$ 'preserve without changing our text
    lp = InStr(temp$, "("): temp$ = Mid$(temp$, lp + 1) 'strip off any left sided parenthesis, such as _RGB32(
    rp = _InStrRev(temp$, ")"): If rp Then temp$ = Left$(temp$, rp - 1) 'strip off the right sided parenthesis )

    Do
        p = InStr(temp$, ",")
        If p Then
            eval$ = Left$(temp$, p - 1)
            If IsNum(eval$) = 0 Then ParseValues = -1: Exit Function
            count = count + 1
            If count > UBound(values) Then ReDim _Preserve values(UBound(values) + 1000) As String
            values(count) = eval$
            temp$ = Mid$(temp$, p + 1)
        Else
            eval$ = temp$
            If IsNum(eval$) = 0 Then ParseValues = -1: Exit Function
            count = count + 1
            If count > UBound(values) Then ReDim _Preserve values(UBound(values) + 1) As String
            values(count) = eval$
            temp$ = ""
        End If
    Loop Until temp$ = ""
    ReDim _Preserve values(count) As String
    ParseValues = count
End Function


Much like my little routine to get color values from strings the other day, this is also part of an enhanced config system that I'm working up for a long running personal project of mine.  What we have here, that I'm highlighting, is the BadLimit routine which is an essential part of the overall roadmap to what I'm doing.  Wink

BadLimit is a rather complex little piece of code, that simply lets us pass it a variable type and then two values which we want to set to become valid limits for that variable type, and then it checks to see if those two limits are valid or not for that type.

For example, pass it:  "Integer", "-1", "10", and it'll pass back a 0 for you.  There's nothing bad about a limit from -1 to 10 for an integer.

Pass it, "Unsigned Integer", "-1", "10", and it'll pass back a 3 for you.  Error code 3 says you have an invalid low limit.  0 is as low as an unsigned integer can go, so you can't set a limit of -1 for one!

The end goal, is to eventually cobble all the pieces together, so that I can validate and read and write such entries as the following in my config file:

BackGround AS Color FROM Black TO White Default Black = Red
XPos AS INTEGER FROM -32000 TO 32000 DEFAULT 0 = 150

And so on...

(And the above isn't as confusing as it first might seem.  For example, the first entry would be for the BackGround color which has to be in a range from full alpha Black to full alpha White, with the default color being Black, but which is current set to being Red.)

I don't know if anyone else would ever need a limit checker, but if someone does, there's one here now that anyone can feel free to use if desired.  Wink
Reply
#2
Thumbs Up 
I have written something similar for Lua, along the lines of:

Code: (Select All)
tbl = table_fill("5 to 100 by 5")
tbl2 = table_fill("2;50;2")

Now I have to look at my own code to find out if I also supported an offset to add.
The "table_fill()" created a table (array) having elements with the requested values. The request was made inside a string. It also shuffled the elements of the table but it was a frill I added.

If the "BadLimit" isn't going to be part of QB64PE or a separate BASIC-like interpreter, why set a "default" value if another value is assigned on RHS?
Reply
#3
(12-16-2022, 11:01 AM)mnrvovrfc Wrote: If the "BadLimit" isn't going to be part of QB64PE or a separate BASIC-like interpreter, why set a "default" value if another value is assigned on RHS?

The default is our fallback value, in case the user edits the config file and puts something invalid as the value.

For example:  KeyCode AS Integer From 0 to 255 Default 0 = O

Now, in case it's not obvious with the browser font there, the default is ZERO, while the user set the value as the capital letter "O".  Now, when reading in the setting, our check tells us that "O" is an invalid value, so it reverts back to the default value of 0 (zero).

And, before you start wondering if the user can mess with the limits or default values, they can't -- we don't actually read those back from the config file.  We set them when we declare a config setting with Sub DeclareConfigSetting. They're mainly just there in the config file for user reference, to help them know what the acceptable ranges are, and the fallback value is, in case they do something wrong with the file.
Reply
#4
I'd almost agree with you about the unsigned integer bad limit with -1.
Code: (Select All)
Dim As _Unsigned Integer i: i = -1
Print i
Ask me about Windows API and maybe some Linux stuff
Reply
#5
(12-21-2022, 02:53 PM)Spriggsy Wrote: I'd almost agree with you about the unsigned integer bad limit with -1.
Code: (Select All)
Dim As _Unsigned Integer i: i = -1
Print i

Try it with any integer type:

Code: (Select All)
Dim As _Unsigned _Byte b: b = -1
Print b
Dim As _Unsigned Integer i: i = -1
Print i
Dim As _Unsigned Long l: l = -1
Print l
Dim As _Unsigned _Integer64 i64: i64 = -1
Print i64
Reply
#6
This caused someone to scream, "Oh noes so QB64 is buggy? Should have returned out-of-range runtime error!" The mentality of using QuickBASIC or QBasic set them like that because there was no such thing as "_UNSIGNED"; actually that "keyword" is a hint to the C++ compiler. A hint that could bite very hard if the programmer expected a negative value for some reason but was surprised by a positive value which was the result of wrap-around. Only to guard against that, this "BadLimit" is a good idea.
Reply
#7
I didn't think it was a bug. Just that this BadLimit is actually unnecessary. As long as you keep your typing consistent, you'll not have any issues.
Ask me about Windows API and maybe some Linux stuff
Reply
#8
You can even compare -1 unsigned integer to -1 signed integer and it will show that they are equal.
Ask me about Windows API and maybe some Linux stuff
Reply
#9
George posted a routine written in C to remove characters from a string, which I was going to use to compare performance between it and my own routine inside the BadLimit stuff above.  Much as I expected, the pure C routine was quite a bit faster than what I had, so I thought I'd try and redo my routine to make it a little faster.  The result of that attempt is below:

Code: (Select All)
check$ = "This is a string that we're going to check to see how long it would take to remove the spaces from."
For i = 1 To 12
    check$ = check$ + check$
Next
Print "The length of our test string is:"; Len(check$)
t# = Timer
new$ = RemoveCharacters$(check$, " ", 0)
t1# = Timer

Print Len(new$)
Print Using "###.#### seconds"; t1# - t#
Do: _Limit 10: Loop Until _KeyDown(27)
Print new$

Function RemoveCharacters$ (passed_from_what As String, what_character As String, from_which_side As Integer)
    'from_which_side: 1 = left, 2 = right, 3 = left and right, 0 = whole string
    Dim from_what As String: from_what = passed_from_what
    If Len(from_what) = 0 Then Exit Function
    Dim m As _MEM, p As _Offset, l As _Offset, a As _Unsigned _Byte
    a = Asc(what_character)
    If from_which_side = 0 Then
        $Checking:Off
        m = _MemNew(Len(from_what))
        _MemPut m, m.OFFSET, from_what
        l = m.SIZE
        Do Until o >= l
            If _MemGet(m, m.OFFSET + o, _Unsigned _Byte) = a Then
                _MemCopy m, m.OFFSET + o + 1, l - o - 1 To m, m.OFFSET + o
                l = l - 1
            Else
                o = o + 1
            End If
        Loop
        from_what = Space$(l)
        _MemGet m, m.OFFSET, from_what
        $Checking:On
    Else
        If from_which_side And 1 Then
            i = 1
            Do Until Asc(from_what, i) <> a
                i = i + 1
            Loop
            from_what = Mid$(from_what, i)
        End If
        If from_which_side And 2 Then
            i = Len(from_what)
            Do Until Asc(from_what, i) <> a Or i = 0
                i = i - 1
            Loop
            from_what = Left$(from_what, i)
        End If
    End If
    RemoveCharacters = from_what
End Function


My old function took about 10 times longer to run and do its thing, than the newly mem-powered version here.  If there's a way for us to eeek out any more performance, just using QB64 commands alone, I'm not seeing it at the moment.  George's routine with headers and all might be faster (I'll wait for him to get a few little glitches out before running any speed comparison tests between the routines), but this is quick enough for my needs.  It's not all that often that I need to strip massive amounts of characters from a string, after all.  Wink
Reply
#10
okay. I admit I wouldnt have thought of this, as a routine.

I would just *check* a specific case, in this example the background color data points.
I guess I could see if there were going to be a bunch of different situations in a program system, this would be useful.

with one or a few cases, I would be thinking inline code.
with a zillion cases? yeah... useful...

I'm assuming this will be used in the code to make QB64 programming easier, eh? working on the code base or IDE base, I mean.
Reply




Users browsing this thread: 8 Guest(s)