HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

vJass compiling to Jass

11-21-2007, 10:31 PM#1
inkken
After reading and searching thru the Scripts and Trigger section for sometime now, i noticed an interesting extension to JASS you guys are using called vJass. Wanting to learn it, i went thru the vJass for Spell Makers, Textmacros in vJass, How to Properly Inline Stuff, Create a New Object Type [vJass], and Scopes tutorial. I also read the readme.txt for JASSHelper.

During my reading and searching, i came upon this interesting thread: http://www.wc3campaigns.net/showpost...67&postcount=4.

Here are my questions:
  • What is the theory or idea behind vJass compiling into Jass? In other words, how does vJass work? I'm not asking how to use vJass.

    What does the s__structdata__allocate() function look like?
    Why are integer si__structdata_F=0 and integer si__structdata_I=0 not used?

  • Can you guys give me more example similar to Malf's vJass compile example, so i can analyze it?

To me, vJass's struct looks like a clever way to use globals to pass multiple data under a single variable type to another function. So, i'm curious, how do you guys do it from Jass?
11-21-2007, 11:07 PM#2
PitzerMike
The jass code that the guy posted is incomplete where he put the ... in his example.

You can check out easily how it works by writing a small vJass script, compiling it with JassHelper and then opening war3map.j (which then contains the compiled jass) in a text editor.
11-22-2007, 01:49 AM#3
inkken
Thanks! just what i was looking for.
Funny, making a test vJass Script didn't seem to work the first time i tried it..., but then again, that was with a certain third party program.
11-22-2007, 02:07 AM#4
PipeDream
The basic idea is you have parallel arrays which you parcel out an index at a time. To recycle indices, you push them onto a stack. When you allocate a new struct you first try to pop that stack before creating a new index.
11-22-2007, 03:04 AM#5
MaD[Lion]
well but that is just for struct. :P vJass is a tool for the lazy jassers :P But also keep things more readable and organized
11-22-2007, 10:15 AM#6
Toadcop
structs and global declaration are nice ^^ (structs allows to short the code (while typing it) and it's imho very handy)