Comments are closed

cJass on the Google Code.
Our BugTracker (recommend to post bugreports and features request there).
Beta tester notes.

all times are GMT +04:00
Latest posts

Pages: 1 2 3 [4] 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

posted at 07/08/11 10:07
ADOLF

2 *Master-chan*
Да, несоответствие есть, но тут даже сложно сказать, чья это беда. То, что макросы заменяют аргументы даже в строках - я лично считаю неправильным. И сейчас сложно переделать движок дефайнов, поэтому я скорее всего введу //! nocjass инструкцию, что бы такие моменты обходить.
Либо используйте дефайны (обратите внимание, что в сЖасс, если Вы хотите, что бы замена шла и в строках надо использовать ``):
#define ARGB_CHAR (int, chr) = {
    for (int i = 0; i < 16; i++) {
        set i2cc [int * 16 + i] = `chr` + i2cc[int * 16 + i]
        set i2cc [i * 16 + int] = i2cc[i * 16 + int] + `chr`
    }
}
//
ARGB_CHAR (0, 0)

posted at 07/08/11 05:02
Master-chan

Столкнулся с проблемой в том что AdicParser странным образом реагирует на textmacro. В частности в буржуйской либе ARGB. Приведу пример:
    //! textmacro ARGB_CHAR takes int, chr
        set i=0
        loop
            exitwhen i==16
            set i2cc[$int$*16+i]="$chr$"+i2cc[$int$*16+i]
            set i2cc[i*16+$int$]=i2cc[i*16+$int$]+"$chr$"
            set i=i+1
        endloop
    //! endtextmacro
    //! runtextmacro ARGB_CHAR( "0","0")
При компиляции без AdicParser получаем следующее:
//textmacro instance: ARGB_CHAR( "0","0")
        set i=0
        loop
            exitwhen i == 16
            set ARGB___i2cc[0 * 16 + i]="0" + ARGB___i2cc[0 * 16 + i]
            set ARGB___i2cc[i * 16 + 0]=ARGB___i2cc[i * 16 + 0] + "0"
            set i=i + 1
        endloop
//end of: ARGB_CHAR( "0","0")
При включенном парсере на выходе во всех инстансах получается вот это:
loop
exitwhen       i==16
set ARGB___i2cc[0*16+i]="$chr$"+ARGB___i2cc[0*16+i]
set ARGB___i2cc[i*16+0]=ARGB___i2cc[i*16+0]+"$chr$"
set i=i+1
endloop
Т.е. $chr$ записывается в строку вместо обработки.

posted at 06/08/11 19:07
ADOLF

btw how flush locals work? how to use it?
It scan functions code and set all leakable locals variables to null. Also you may add /alf flag (check in menu "Locals auto flush") and cJass automaticly flush all locals.
Look the code:
#if !AUTOFLUSH_LOCALS
	#error ("...")
#endif

unit fx () {
	unit foo = SomeUnit ()
	int i
	if (b) {
		unit bar = AnothieUnit ()
		return null
	}
	return foo
}
// --->
function fx takes nothing returns unit
    local unit foo=SomeUnit()
    local int i
    local unit cjlocgn_00000000
    if (b) then
        set cjlocgn_00000000=AnothieUnit()
        set cjlocgn_00000000=null
        set foo=null
        return null
    endif
    set cj_v666_unit=foo
    set foo=null
    return cj_v666_unit
endfunction
globals
    unit cj_v666_unit
endglobals

posted at 06/08/11 18:51
Sebra

It tries to clear leaks by assigning local handle vars to null.

posted at 06/08/11 18:14
Guest

btw how flush locals work? how to use it?

posted at 06/08/11 14:27
ADOLF

Any Ideas?
Please wait (don't post issues) a day until I copy my todo list.
Done =/

posted at 06/08/11 14:04
ADOLF

How about august? :)
I'm not sure)
For example, google project hosting tracker
Great idea!
Please wait (don't post issues) a day until I copy my todo list.
(I also know russian :D )
It's cool! Вы случайно не из русскоязычной вар3 тусовки (хгм, бру, вар3инфо) ?.

posted at 06/08/11 12:35
Raffy

How about august? :)
Hey and I can help with the manual, I think I would be able to keep the original style of it. (I also know russian :D )
I have too many suggestions, so I'd appreciate, if there was something like an issue tracker.
Where you can easily make a "request topic".

posted at 06/08/11 11:42
ADOLF

Question: when are we gonna get a stable release ?
I hope somewhere in September. I want to upgrade the standard library, to rewrite the manual, VanDamm promised to update the syntax highlighting.

posted at 06/08/11 05:21
Guest

Question: when are we gonna get a stable release ?

posted at 05/08/11 18:58
ADOLF

=========
1.4.2.25 * just fixes
for(int i = 0, i <= 16, i++)
{
    // Do actions.
}

for(i = 10, i > 0, i--)
/*  Notice that I wrote
 *  "i = 10" instead of
 *  "int i = 10", because
 *  "i" was already declared
 *  by the previous for-loop.
 */
{
    // Do more actions.
}
Variable i declared in the first for block - you can't use it outside (look my post about reworking locals variables processing).
nothing foo () {
    for (int i = 0; i <= 16; i++) {
        DoNothing ()
    }
    for (int i = 0; i <= 16; i++) {
        DoNothing ()
    }
}

nothing bar () {
    int i
    for (i = 0; i <= 16; i++) {
        DoNothing ()
    }
    for (i = 0; i <= 16; i++) {
        DoNothing ()
    }
}
// --->
function foo takes nothing returns nothing
    local int cjlocgn_00000000=0
    loop
        exitwhen   not (cjlocgn_00000000<=16)
        call DoNothing()
        set cjlocgn_00000000=cjlocgn_00000000+1
    endloop
    set cjlocgn_00000000=0
    loop
        exitwhen   not (cjlocgn_00000000<=16)
        call DoNothing()
        set cjlocgn_00000000=cjlocgn_00000000+1
    endloop
endfunction
function bar takes nothing returns nothing
    local int i
    set i=0
    loop
        exitwhen   not (i<=16)
        call DoNothing()
        set i=i+1
    endloop
    set i=0
    loop
        exitwhen   not (i<=16)
        call DoNothing()
        set i=i+1
    endloop
endfunction
Allow setting custom initial value to constants from enums, like this:
I want to do this a long time, but first I'll fix the form.
for (unit u; UnitsInRangeOfLoc(someLoc, 100)) {
Thx, I'll fix it as sonn as posible)
define CleanLoc(loc) = {
    RemoveLocation(loc)
    set loc = null
}
Just new locals flushing demo:
#if !AUTOFLUSH_LOCALS
	#error ("...")
#endif

unit fx () {
	unit foo = SomeUnit ()
	int i
	if (b) {
		unit bar = AnothieUnit ()
		return null
	}
	return foo
}
// --->
function fx takes nothing returns unit
    local unit foo=SomeUnit()
    local int i
    local unit cjlocgn_00000000
    if (b) then
        set cjlocgn_00000000=AnothieUnit()
        set cjlocgn_00000000=null
        set foo=null
        return null
    endif
    set cj_v666_unit=foo
    set foo=null
    return cj_v666_unit
endfunction
globals
    unit cj_v666_unit
endglobals

posted at 05/08/11 18:46
ADOLF

2 Русский from Українець
Привет! Да, про баг с точкой слышал и уже вроде испрвавил. С this тоже что то придумаю.
Переименовка - их так легче обрабатывать, они же "склеиваются"
Спасибо за репорты.

posted at 05/08/11 18:19
Русский

Баг с переименованием локальных переменных, которые объявлены не в начале функции.
Вот пример:
Начальный код
scope Test initializer Init{

include "cj_types_priv.j"

private struct A{
 
 unit u
 
 static void New(bool b){
    if (b) {
      thistype this=thistype.allocate()
      unit u = CreateUnit (Player(0), 'Hamg', 100., 0., 0.)
      this.u = CreateUnit (Player(0), 'Hpal', 0., 0., 0.)
      BJDebugMsg(GetUnitName(u))
      BJDebugMsg(GetUnitName(this.u))
    }  
 }
 
}
 
 private void Init(){
      A.New(true)
 }

 
}
Скомпилировано на Jass:
// scope Test begins
struct Test___A

unit u

static method New takes boolean b returns nothing
   local thistype cjlocgn_00000000
   local unit cjlocgn_00000001
   if (b) then
     set cjlocgn_00000000=thistype.allocate()
     set cjlocgn_00000001=CreateUnit(Player(0),0x48616D67,100.,0.,0.)
     set cjlocgn_00000000.cjlocgn_00000001=CreateUnit(Player(0),0x4870616C,0.,0.,0.) //А должно быть set s__Test___A_u[cjlocgn_00000000]=CreateUnit(Player(0), 0x4870616C, 0., 0., 0.)
     call BJDebugMsg(GetUnitName(cjlocgn_00000001))
     call BJDebugMsg(GetUnitName(cjlocgn_00000000.cjlocgn_00000001)) //А должно быть call BJDebugMsg(GetUnitName(s__Test___A_u[cjlocgn_00000000]))
   endif
endmethod

endstruct


function Test___Init takes nothing returns nothing
      call Test___A.New(true)
endfunction
// scope Test ends
Еще с обращением к переменным структуры префиксом <.> (подразумевающий <this.>) :
...
static void New(bool b){
   if (b) {
     thistype this=thistype.allocate()
     .u = CreateUnit (Player(0), 'Hpal', 0., 0., 0.)
     BJDebugMsg(GetUnitName(.u))
   }  
}
...
Скомпилировано на Jass:
...
function s__Test___A_New takes boolean b returns nothing
   local integer cjlocgn_00000000
   if ( b ) then
     set cjlocgn_00000000=s__Test___A__allocate()
     set s__Test___A_u[this]=CreateUnit(Player(0), 0x4870616C, 0., 0., 0.)
     call BJDebugMsg(GetUnitName(s__Test___A_u[this]))
   endif
   endfunction
...
То бишь не найдена переменная this, а вообще просвети для чего это переименование?

posted at 05/08/11 16:10
doc

also, initial values in enums are allowed, dunno what are you talking about.

posted at 05/08/11 16:09
doc

Seems like some natives aren't supported by for group.
because UnitsInRangeOfLoc sux :3

posted at 05/08/11 14:04
Guest

This isnt possible, variables declared in header of the loop are only visible in that loop. (Same for C++)
Seems like some natives aren't supported by for group.
For example, the following code tries to compile to normal for loop ...
==
for (unit u; UnitsInRangeOfLoc(someLoc, 100)) {
//
}
==
Suggestion about enums.
Allow setting custom initial value to constants from enums, like this:
==
enum (someEnum) {
ACTION_GET_BALL = 0
ACTION_GAME_PAUSED = 0
ACTION_SHORT_PASS = 1
}
==

posted at 05/08/11 03:15
Guest

About the for loop, is is possible to do the following:
for(int i = 0, i <= 16, i++)
{
    // Do actions.
}

for(i = 10, i > 0, i--)
/*  Notice that I wrote
 *  "i = 10" instead of
 *  "int i = 10", because
 *  "i" was already declared
 *  by the previous for-loop.
 */
{
    // Do more actions.
}
If it is not, then I think that it should be.

posted at 05/08/11 00:33
doc

because it's should be wehack.lua

posted at 04/08/11 23:38
Guest

Look root directory of NewGenWE. Just Lua script. It's part of NewGenWE engine.
There are only exehack.exe and exehack.txt

posted at 04/08/11 22:55
ADOLF

Please add support for more group-enum natives (UnitsInRange not enough).
You may use any of it (without GroupEnum prefix and first (group) and last (filter) arguments).
What about add support for any function that returns group, or any group variable?
I'll add it soon.
exehack.lua? I don't have this file anywhere. And what is this edit for?
Look root directory of NewGenWE. Just Lua script. It's part of NewGenWE engine.

posted at 04/08/11 22:29
Guest

I also do not have exehack.lua

posted at 04/08/11 22:02
Guest

Please add support for more group-enum natives (UnitsInRange not enough).
Here is list from common.j:
native GroupEnumUnitsOfType                 takes group whichGroup, string unitname, boolexpr filter returns nothing
native GroupEnumUnitsOfPlayer               takes group whichGroup, player whichPlayer, boolexpr filter returns nothing
native GroupEnumUnitsOfTypeCounted          takes group whichGroup, string unitname, boolexpr filter, integer countLimit returns nothing
native GroupEnumUnitsInRect                 takes group whichGroup, rect r, boolexpr filter returns nothing
native GroupEnumUnitsInRectCounted          takes group whichGroup, rect r, boolexpr filter, integer countLimit returns nothing
native GroupEnumUnitsInRange                takes group whichGroup, real x, real y, real radius, boolexpr filter returns nothing
native GroupEnumUnitsInRangeOfLoc           takes group whichGroup, location whichLocation, real radius, boolexpr filter returns nothing
native GroupEnumUnitsInRangeCounted         takes group whichGroup, real x, real y, real radius, boolexpr filter, integer countLimit returns nothing
native GroupEnumUnitsInRangeOfLocCounted    takes group whichGroup, location whichLocation, real radius, boolexpr filter, integer countLimit returns nothing
native GroupEnumUnitsSelected               takes group whichGroup, player whichPlayer, boolexpr filter returns nothing
Sample:
for (unit u; UnitsInRangeOfLoc(loc, 320) {
    // actions
}
What about add support for any function that returns group, or any group variable?
Idea: add forg loop specially for use with groups.
Example:
group g = CreateGroup()
forg(unit u, g) {
    // actions
}
=====
> Also recommend to edit exehack.lua:
exehack.lua? I don't have this file anywhere. And what is this edit for?

posted at 04/08/11 19:51
ADOLF

Just a question - does this still bug with the textmacros of vJass (I can't test at the moment)?
I think I fix the errors with textmacros in dev build. if errors occur - show me the code, and I'll fix them.
========
1.4.2.24
download
* Added callback functions:
// This is not a substitute for  initializing libraries,
// because you can not specify which of these
// functions will be called earlier.
//
// Also it will be called after all libs and scopes init.
callback onInit () {
    printf ("Hello World!")
}

// Be called on every spells cast.
callback onUnitSpellCast () {
    printf ("foo")
}

// Be called on 'AHfs' spell cast.
callback onUnitSpellCast ('AHfs') {
    printf ("bar")
}
Callbacks list:
// (? arg name) - optional arg

onInit                  ()
onUnitAttacked          ()
onUnitDeath             ()
onUnitDecay             ()
onUnitIssuedOrder       (?int order_id)
onUnitIssuedPointOrder  (?int order_id)
onUnitIssuedTargetOrder (?int order_id)
onHeroLevel             ()
onHeroSkill             (?int skill_id)
onUnitSpellChannel      (?int abill_id)
onUnitSpellCast         (?int abill_id)
onUnitSpellEffect       (?int abill_id)
onUnitSpellFinish       (?int abill_id)
onUnitSpellEndcast      (?int abill_id)
onGameLoad              ()
onGameSave              ()

posted at 04/08/11 16:43
Guest

Just a question - does this still bug with the textmacros of vJass (I can't test at the moment)?
Otherwise, mad props for constantly working on this thing, it's awesome.

posted at 04/08/11 10:11
ADOLF

2 Raffy :
Thanks! Indeed there is a bug, and I'll fix it today.

Pages: 1 2 3 [4] 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

[back to top]