olety / cjass

Preserving cjass code from code.google.com/p/cjass
0 stars 0 forks source link

add onInit block #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
onInit {
    //code
}

translates to

library cjuniqueid3
module cjuniqueid
    private static method onInit takes nothing returns nothing
        //code
    endmethod
endmodule
struct cjunieid2
    implement cjuniqueid1
endstruct
endlibrary

library C
    onInit.after {
    }
endlibrary

translates to
library C initializer cjuniqueid
    private function cjuniqueid takes nothing returns nothing
    endfunction
endlibrary

onInit.after {
}

translates to

scope cjuniqueid initializer cjuniqueid2
    private function cjuniqueid2 takes nothing returns nothing
    endfunction
endscope

scope A
    onInit.after {
    }
endscope

translates to

scope A initializer cjuniqueid
    private function cjuniqueid takes nothing returns nothing
    endfunction
endscope

This way it can be inside of scopes or libraries or anywhere =).

onInit would be module initializer and onInit.after would be block initializer 
(library, scope, w/e).

Original issue reported on code.google.com by mrasolo...@gmail.com on 26 Aug 2011 at 7:15

GoogleCodeExporter commented 9 years ago
It is a bug or feature request?) I did't understand at all.

// also you may use this (I'm not sure that works inside the modules):
callback onInit () { ... }

Original comment by adi...@gmail.com on 26 Aug 2011 at 7:48

GoogleCodeExporter commented 9 years ago
oh, feature request : )

like just having onInit() { } and having it translate for fast onInit ; P

Original comment by mrasolo...@gmail.com on 27 Aug 2011 at 1:33

GoogleCodeExporter commented 9 years ago

Original comment by shadow.d...@gmail.com on 29 Aug 2011 at 7:13