HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

jasshelper 2011-12-11

12-11-2011, 03:10 PM#1
cohadar
Latest jasshelper: 2012-01-14

This is the thread for new jasshelper versions.
I have taken over development since Vex has ridden into the sunset.

New versions are intended to be absolutely backwards compatible with JassHelper 0.A.2.B
(I made very good automatic tests so this is all but guarantied)

I did a lot of code refactoring and comment writing.
Than I added better loops

Collapse JASS:
// while unit has some buff do some healing
while GetUnitAbilityLevel(whichUnit, 'Bhea') > 0
    call SetWidgetLife(whichUnit, GetWidgetLife(whichUnit) + 10.)
    call TriggerSleepAction(0.1)
endwhile

// print out numbers from 1 to 10 with for loop
for i = 1 to 10
    call BJDebugMsg(I2S(i))
endfor

// print only 1 2 3
for i = 1 to 10
    call BJDebugMsg(I2S(i))
    if i == 3 then
        break
    endif
endfor

// print out numbers from 10 downto 1
for i = 10 downto 1
    call BJDebugMsg(I2S(i))
endfor

// kill all units in a group
for enumUnit in someGroup
    call KillUnit(enumUnit)
endfor
// WARNING: groups are empty after for loop

Changelog:
Quote:
//=====================================
// 2012-01-14
//=====================================
* fixed a bug that prevented new loops to be used with function interfaces

//=====================================
// 2012-01-07
//=====================================
* removed WEWarlock support (outdated)
* more speed improvements
* added full display of external tool calls (ObjectMerger)

//=====================================
// 2012-01-06
//=====================================
* removed FILEPP preprocessor (not enough public support for it)
* done some optimizations, jasshelper is now about 3x faster
* progress bar now shows global progres

//=====================================
// 2011-12-25
//=====================================
* included #bigdef and #foreach modules with FILEPP

//=====================================
// 2011-12-24
//=====================================
* added FILEPP preprocessor (executes before everything else in the map script)
* optimized for group loop as suggested by Troll-Brain.

//=====================================
// 2011-12-19
//=====================================
* added 3 for loops
* added while loop
* added break
Check out this section in jasshelpermanual:
Better looping: for, while, break

//=====================================
// 2011-12-17
//=====================================
* jasshelper now displays full textual progress when used from WE.
* jasshelper will now warn you to reopen your map if you used //! external command
Attached Images
File type: pngJHProgress.png (40.6 KB)
File type: gifclear.gif (43 bytes)
12-14-2011, 09:10 AM#2
Barade
Hey,
it would be great if you're going to continue development of the JassHelper although a complete rewrite would be better in the end.
Is there any special reason why GOLD parser/JassHelper can show one single error only which is one of the most annoying things since you have to reparse everything over and over again until it becomes clear JASS code.
Another question, especially important for myself: Is it possible to compile this on GNU/Linux (maybe using wine)?

I've already read that you're going to add for loops. As many vJass users I have a small list of things which could be improved, so if this thread becomes the new JassHelper thread I could post it here but only if you're interested.
12-14-2011, 09:27 AM#3
cohadar
I am doing a complete refactoring. (breaking down vexorians 13000 lines one-file-monster into multiple files)

Jasshelper is not a real compiler, that is it does not use GOLD in the way it should.
(it parses code only line-by-line)

It is possible to compile this under linux, vexorian is on linux.

Post any ideas you have, ideas are always welcome.
12-14-2011, 04:08 PM#4
Barade
Alright, so are you going to change to use of GOLD that it could show more then one line error or would this be a huge amount of work? I am sorry that I can't help without learning Pascal etc.
The thing about Windows is that I really never compiled any Pascal written program and I only know the gpc but it shouldn't make any difference for now since I couldn't contribute anyway.

So here are some things which would great to see in vJass:
  • add keyword "protected"
  • size-specified structures should be able to extend interfaces
  • size-specified structures should be able to extend structures with the same or a bigger size
  • one struct should be able tot extend multiple interfaces
  • constants should be usable as sizes of array struct members (maybe this doesn't work for constants from "common.j" and "Blizzard.j" only)
  • "static if" should be considered by "//! import" statements or something similar like "//! if" should be added
  • private destructors aren't private actually (useful for static structs)
  • you can not define the size of an array struct (struct bla extends array[10])
  • add better scoping rules (maybe nested libraries)
  • drop "optional" stuff and get everything done by static ifs (maybe add something like .exists() for libraries, as well)
  • text macro runs inside text macros would be great
  • maybe add stronger type casting rules for integers to structs (a JassHelper option for requiring explicit casts would be nice)
  • report errors on using TriggerSleepAction on evaluated functions (conditions as well): this helps users which do not use option [forcemethodevaluate]
  • report errors on adding functions using TriggerAddAction which are declared afterwards in code (not sure if this bug is still present)

Additionally, I have stored most links of my bug reports/feature requests (it's mostly the same like above):
http://www.wc3c.net/showpost.php?p=1...postcount=3566
http://www.wc3c.net/showpost.php?p=1...postcount=3556
http://www.wc3c.net/showpost.php?p=1...postcount=3220
http://www.wc3c.net/showpost.php?p=1...postcount=3084
http://www.wc3c.net/showpost.php?p=1...postcount=2036
http://www.wc3c.net/showpost.php?p=1...postcount=3090
http://www.wc3c.net/showpost.php?p=1...postcount=3511
http://www.wc3c.net/showpost.php?p=1...postcount=3152
http://www.wc3c.net/showpost.php?p=1...postcount=3144
http://www.wc3c.net/showpost.php?p=1...postcount=3147
http://www.wc3c.net/showpost.php?p=1...postcount=3107
http://www.wc3c.net/showpost.php?p=1...postcount=3119
http://www.wc3c.net/showpost.php?p=1...postcount=3630
http://www.wc3c.net/showpost.php?p=1...postcount=3632

Btw. I don't care about Zinc, too. Once I wanted to move to Zinc and had to revert it since Zinc support was very bugged at that time.
It would be great even if you would only support one single item of my huge list since I do still maintain my custom vJass script collection.
12-14-2011, 05:31 PM#5
cohadar
I will not do any of the stuff you mentioned.
Before you get disappointed let me explain.

Vexorian made a huge mistake when he tried to make vjass into object oriented language.
jass is a functional language and map scripting is a functional job in nature.

Object paradigm is not inherently better than functional paradigm,
and half-ass object paradigm is simply idiotic.

Ok so why Vexorian did it?
Because he was programming jasshelper in object pascal and he got under the influence of that language.
Literally 80% of junk in jasshelper are language constructs from pascal.

This was really unfortunate because functional paradigm is a lot more suited to jass,
for example one of the most used and valuable advanced features in jass are function interfaces.

And while Vex was adding unnecessary things like inheritances he neglected basic functional constructs that would be 100 times more useful and 100 times more be actually used by members of community.

Compare next 2 scripts for example:
Collapse JASS:
set i = 1
loop
    exitwhen i > 4
    call DoSomething()
    set i = i + 1
endloop

Collapse JASS:
for i = 1 to 4 do
    call DoSomething()
endfor

Notice how much more simpler, easier to understand and easier to write is the second script. THAT will be a real contribution to the community, and not some obscure inheritance feature that will be used by 1 maybe 2 crazy ass people.
12-14-2011, 06:43 PM#6
Barade
That might be true for some small systems and newcomers but when you're at the point where you have to create custom data types with properties you'll need at least structs. Otherwise you have to store everything in arrays or hashtables and you'll get much more errors with those ids/indices.
And if you have structs some people might want to extend their functionality which was almost not possible until Vexorian added the "stub" keyword except you had some interfaces.
I agree with you that Vexorian added many unnecessary things but in my opinion it's not that bad for all people to have some JASS based syntax.
I myself moved from JASS to vJass a long time ago since I needed .evaluate()/.execute() because of the declaration order problem. Before I used vJass I wrote systems using integer based ids for custom types which was really annoying.
The problem about your idea is that some people might use systems which are already written in JASS or vJass, so they will have to understand both. Even if you're just using an API I don't believe that this will really help people. For loops you can create macros in your favorite editor, for instance.
12-15-2011, 03:40 AM#7
cohadar
You misunderstand.
structs are functional data types, objects are object data types.
structs are ok, struct interfaces & inheritance is useless.

execute/evaluate are functional paradigm (they execute functions no?)

I have no intention of breaking any backwards compatibility.
I just don't plan on adding any more unnecessarry object stuff.
12-16-2011, 11:24 AM#8
Barade
Quote:
Originally Posted by cohadar
You misunderstand.
structs are functional data types, objects are object data types.
structs are ok, struct interfaces & inheritance is useless.

execute/evaluate are functional paradigm (they execute functions no?)

I have no intention of breaking any backwards compatibility.
I just don't plan on adding any more unnecessarry object stuff.
I didn't say that execute/evaluate aren't functional paradigm. You might be right about structs are functional data types.
Not breaking backwards compatibility is just useless if the language has a clear lack of features which prevents people who do OOP from using the language.
12-16-2011, 11:42 AM#9
cohadar
Yeah, I might be right:
http://en.wikipedia.org/wiki/Struct_...ng_language%29

Not breaking backwards compatibility is ALWAYS GOOD.

No one ever did any OOP in vjass because vjass has no OOP.
For OOP you need this:
http://en.wikipedia.org/wiki/Polymor...ed_programming

Anyways I broke jasshelper down into parts:
  • Preprocessor - 1646
  • Structs - 5003
  • ReturnFix - 375
  • ShadowHelper - 339
  • Inliner - 883

Now I need to break preprocessor into: //! textmacros, //! imports, libraries and scopes

Structs unit also needs to be broken but I have no idea into how many pieces, all I know is that it actually has a function with 2287 lines of code
12-16-2011, 05:47 PM#10
cohadar
I attached new version if anyone is interested, still only refactoring.
(Well I did add much better console reports, )

Collapse JASS:
==================================================
== input\4vsUndead.j
==================================================


common.j
  Opening: OK
  Loading: ...................OK
  Parsing: ...................OK

Blizzard.j
  Opening: OK
  Loading: ...................OK
  Parsing: ...................OK

PREPROCESSOR:
  Loading: OK
  Importing: ...................OK
  TextMacros Loading: ...................OK
  Textmacros Parsing: ...................OK
  Textmacros Writing: ...................OK
  Zinc: ...................OK
  Libraries Parsing: ...................OK
  Libraries Writing: ..................OK
  Time: 141

STRUCTS:
  Loading: ...................OK
  Modules Parse: ...................OK
  Modules Implement: ...................OK
  Conditional Blocks: ...................OK
  Parsing: ..................OK
  Evaluating: ..................OK
  Writing: ...................OK
  Time: 296

RETURN FIXER:
  Loading: ...................OK
  Processing: ...................OK
  Time: 47

SHADOW HELPER:
  Loading: ...................OK
  Processing: ...................OK
  Time: 31

INLINER:
  Loading: ...................OK
  Processing:...................OK
  Time: 47

ALL OK.
12-16-2011, 09:19 PM#11
BBQ
You may want to check cJass out for some features (the project itself is, unfortunately, dead). I personally think that the JASS2 syntax is way too verbose, but I guess that's just me. Well, I don't plan on doing any WC3 project, so you are free to ignore my opinion.
12-17-2011, 12:11 PM#12
cohadar
New Version: 2011-12-17

You might actually want to update to this one.
It has much better progress display inside WE.
It also knows to tells you to close & reopen your map if you used ObjectMerger or similar..

(see the picture in first post)
12-17-2011, 03:16 PM#13
Here-b-Trollz
The green on black progress text is annoying. The background should be fuchsia or melon.
12-17-2011, 11:26 PM#14
Ignitedstar
Quote:
Originally Posted by cohadar
Collapse JASS:
set i = 1
loop
    exitwhen i > 4
    call DoSomething()
    set i = i + 1
endloop

Collapse JASS:
for i = 1 to 4 do
    call DoSomething()
endfor
Ever since I started coding in VB Studio, I've been wondering why we don't have the latter.

I'm afraid of updating to this JassHelper simply because I don't want to see my map malfunction... but as you say, it should be completely backwards compatible. If this version of JassHelper goes crazy on me, it should be easy to copy the old JassHelper and use that if I want to, right? So long as the file executables are the same, I think?
12-18-2011, 12:11 AM#15
Here-b-Trollz
Just move the three files you are replacing somewhere else, so you don't overwrite them. If cohadar sucks (I haven't experienced any problems thus far except lame colors and what appears to be a longer compile time) you can just delete his files and move vex's back in.