View Single Post
Old 11-12-2006, 06:37 PM   #3
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Version 0.8.0 has got a new feature which complements scopes pretty well, this is a quick example:

Collapse JASS:
    //! textmacro STACK takes NAME, TYPE, TYPE2STRING
    //! scope $NAME$
    globals
        private $TYPE$ array V
        private integer N=0
    endglobals
    public function push takes $TYPE$ val returns nothing
        set V[N]=val
        set N=N+1
    endfunction

    public function pop takes nothing returns $TYPE$
        set N=N-1
        return V[N]
    endfunction

    public function print takes nothing returns nothing
     local integer a=N-1
        call BJDebugMsg("Contents of $TYPE$ stack $NAME$:")
        loop
            exitwhen a<0
            call BJDebugMsg(" "+$TYPE2STRING$(V[a]))
            set a=a-1
        endloop
    endfunction
    //! endscope
    //! endtextmacro

    //! runtextmacro STACK("StackA","integer","I2S")
    //! runtextmacro STACK("StackB","integer","I2S")
    //! runtextmacro STACK("StackC","string","")
    function Test takes nothing returns nothing
        call StackA_push(4)
        call StackA_push(5)
        call StackB_push(StackA_pop())
        call StackA_push(7)
        call StackA_print()
        call StackB_print()
        call StackC_push("A")
        call StackC_push("B")
        call StackC_push("C")
        call StackC_print()
    endfunction
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote