Would this be useful to anyone?

Vestras

Retired
Reaction score
249
JASS:
library DataHandler initializer Initialization
globals
    private constant integer A=65
    private constant integer B=66
    private constant integer C=67
    private constant integer D=68
    private constant integer E=69
    private constant integer F=70
    private constant integer G=71
    private constant integer H=72
    private constant integer I=73
    private constant integer J=74
    private constant integer K=75
    private constant integer L=76
    private constant integer M=77
    private constant integer N=78
    private constant integer O=79
    private constant integer P=80
    private constant integer Q=81
    private constant integer R=82
    private constant integer S=83
    private constant integer T=84
    private constant integer U=85
    private constant integer V=86
    private constant integer W=87
    private constant integer X=88
    private constant integer Y=89
    private constant integer Z=90
    private string array Letter
endglobals
private function Initialization takes nothing returns nothing
    set Letter[A]="A"
    set Letter<b>=&quot;B&quot;
    set Letter[C]=&quot;C&quot;
    set Letter[D]=&quot;D&quot;
    set Letter[E]=&quot;E&quot;
    set Letter[F]=&quot;F&quot;
    set Letter[G]=&quot;G&quot;
    set Letter[H]=&quot;H&quot;
    set Letter<i>=&quot;I&quot;
    set Letter[J]=&quot;J&quot;
    set Letter[K]=&quot;K&quot;
    set Letter[L]=&quot;L&quot;
    set Letter[M]=&quot;M&quot;
    set Letter[N]=&quot;N&quot;
    set Letter[O]=&quot;O&quot;
    set Letter[P]=&quot;P&quot;
    set Letter[Q]=&quot;Q&quot;
    set Letter[R]=&quot;R&quot;
    set Letter<s>=&quot;S&quot;
    set Letter[T]=&quot;T&quot;
    set Letter<u>=&quot;U&quot;
    set Letter[V]=&quot;V&quot;
    set Letter[W]=&quot;W&quot;
    set Letter[X]=&quot;X&quot;
    set Letter[Y]=&quot;Y&quot;
    set Letter[Z]=&quot;Z&quot;
endfunction

function DH_H2I takes handle h returns integer
    return h
    return 0
endfunction
function DH_H2S takes handle h returns string
    return I2S(DH_H2I(h))
endfunction
function DH_GetHandleName takes handle h returns string
    local integer hj=DH_H2I(h)-0x100000
    local string basic=&quot;&quot;
    local string s=&quot;&quot;
    local integer n=A-1
    local integer j=-1
    if hj&gt;Z then
        loop
            set j=j+1
            exitwhen hj&lt;=Z
                set hj=hj-1
        endloop
    endif
    set basic=I2S(hj)
    loop
        set n=n+1
        exitwhen n&gt;Z
            if n==hj then
                set s=s+Letter[n]
                set n=Z+1
            endif
    endloop
    debug call BJDebugMsg(&quot;basic == &quot;+basic)
    debug call BJDebugMsg(&quot;s == &quot;+s)
    return s
endfunction

//! textmacro DH_Create takes NAME,TYPE
private struct stringex$TYPE$
    string sxname
    string sx$TYPE$
    string sxfull
endstruct
globals
    private stringex$TYPE$ array str$TYPE$[400000]
    private $TYPE$ array $TYPE$store[400000]
endglobals

function Insert$NAME$Data takes $TYPE$ xx returns string // stores $TYPE$ data in a string
    local integer i=DH_H2I(xx)
    set str$TYPE$<i>=stringex$TYPE$.create()
    set str$TYPE$<i>.sxname=DH_GetHandleName(xx)
    set str$TYPE$<i>.sx$TYPE$=DH_H2S(xx)
    set str$TYPE$<i>.sxfull=str$TYPE$<i>.sxname+str$TYPE$<i>.sx$TYPE$
    debug call BJDebugMsg(str$TYPE$<i>.sxfull)
    set $TYPE$store[S2I(str$TYPE$<i>.sxfull)]=xx
    return str$TYPE$<i>.sxfull
endfunction
function Get$NAME$Data takes string sxfull returns $TYPE$ // gets $TYPE$ data in a string and converts it into a $TYPE$
    return $TYPE$store[S2I(sxfull)]
endfunction
//! endtextmacro
//! runtextmacro DH_Create(&quot;Unit&quot;,&quot;unit&quot;)
//! runtextmacro DH_Create(&quot;Timer&quot;,&quot;timer&quot;)
//! runtextmacro DH_Create(&quot;Trigger&quot;,&quot;trigger&quot;)
//! runtextmacro DH_Create(&quot;Group&quot;,&quot;group&quot;)
endlibrary</i></i></i></i></i></i></i></i></i></u></s></i></b>


What it does? Stores things via strings.
Got the idea from Toadcop a long time ago. Didn't know if this was useful to anyone, but if it is, I'll optimize it and release it.
 

Viikuna

No Marlo no game.
Reaction score
265
Some of those array index letters in initializer function are not supposed to be lower case letters right?

EDIT. Well anyways, it doesnt matter if you are going to optimize it. I wont probably use this, but Id like to know how fast it is.
 

Vestras

Retired
Reaction score
249
Some of those array index letters in initializer function are not supposed to be lower case letters right?

No, they aren't. And they aren't in the library.

EDIT. Well anyways, it doesnt matter if you are going to optimize it. I wont probably use this, but Id like to know how fast it is.

So would I. :)

You might want to rethink both the idea and the implementation a few times...

Why? What's wrong with it?
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Why? What's wrong with it?
That was what I suggested you to think about.

Here is a few hints:
Doesn't work as intended. Leaks both structs and strings. Slow. Lots of implementation oddities that makes it even stranger, eg
JASS:
    if hj&gt;Z then
        loop
            set j=j+1
            exitwhen hj&lt;=Z
                set hj=hj-1
        endloop
    endif

which happens to be the same thing as
JASS:
set hj = IMaxBJ(hj, Z)

and note that you don't even use j after that loop.

And all this for a system that does, what exactly? Nothing relevant as far as I can tell. I guess I just don't get it...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top