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 23/02/10 22:27

Plugins are analog of external tools in jasshelper, but:
  • run it before processing code (when I started writing adi˝helper I could not do it with external tools, and I had to edit Lua)
  • when writing a preprocessor you no need to open the map, extract script, repack it, look it your tags, etc.
  • You can pass more than one command line in external
You can write a plugin in any language, which compiles to the *.dll (C, Delphi, basic, asm, etc.)
writing a specific plugin may be necessary in rare cases, so much not to think about)

posted at 23/02/10 21:52
Dark Dragon

yeah it seems really powerfull, but i dont know asm so i need help to learn it.
can u plz make some basic .w3x map to show me how to use plugins. thanks!

posted at 23/02/10 21:25

When plugins is necessary:
  • create your own zinc with syntax sugar
  • write own specific preprocessors
  • create database of terrain (read war3map.w3e) or placed doodads
  • ...

posted at 23/02/10 21:06
	_dCstCodeStart		dd	?
	_dCstCodeSize		dd	?
	_dCstCodeDest		dd	?
	_dCstCodeFinalSize	dd	?
	_sCstArguments		dd	?
	_sCstMapPath		dd	?
Added _sCstMapPath to cjpluginfo - now you may work with map in your plugin.

posted at 23/02/10 18:58
Dark Dragon

i dl-d the new ver of cjass but i dont know how to use this new feature "plugins" and for what are they used for.
i do not want to be misunderstanded, i did test the code and it generated global string s. however i want to say i dont know how to code a single thing in "#custom" block.

i created plugins folder and all that in my cjass folder... i placed this code in my test map:
#custom test (command line)
	_dCstCodeStart		dd	;; addr of input code
	_dCstCodeSize		dd	;; size in bytes of input code
	_dCstCodeDest		dd	;; addr of dest
	_dCstCodeFinalSize	dd	;; parsed code size
	_dCstArguments		dd	;; null term string, arguments to plugin
what i understand or think is this:
#custom and #endcustom block is used for asm code like _asm {} in visual c++.
custom however loads dll (test) "asm library" from plugins...
(command line) that argument "line" nor "command" type is smth i understand... i have no idea what it does!
everything else i do not understand at all! i did learn lua just from files in JNGP, but asm is different story i never give it a try. this is the first time i will try to learn asm but i really need Van Damm or u to explain me some basics... i dont know how to code a single thing and what is it usefull for nor anything else.
does this asm allow me to work with pointers or maybe create my own cjass syntax @ ADOLF "asm is compiled before cjass!"
currently i dont know how to use this plugins nor for what are they used for! i feel they are powerfull but i would need some help from u guys!

about lambda funcs to work with any type of funcs, will it be done in next cjass ver? or any time soon? i really need this feature coz i have a lot of funcs which have 1-3 lines of code but require me to code whole funcs... it looks like "omg"!
anyway thanks for all help and hard work guys! Greets by DD!

posted at 23/02/10 15:49

+ Added plugins (beta)
#custom test (command line)
code there
It load %adic_helper_dir%\plugins\test.dll and call _stdcall cjplugresult ParseCode (*cjpluginfo arg)
It run before cJass parser, so you may use cJass syntax, or add (temporary) //! lua ... //! endlua - then cJass parser ingone your code.
cjplugresult - is windows exit code analog:
0x00000000 - succesfull!
0x00000001 ... 0xfffffffe - error, plug display information about error to user
0xffffffff - error, cJass display [21] Critical error: unknown error in plugin
Struct cjpluginfo is:
	_dCstCodeStart		dd	;; addr of input code
	_dCstCodeSize		dd	;; size in bytes of input code
	_dCstCodeDest		dd	;; addr of dest
	_dCstCodeFinalSize	dd	;; parsed code size
	_dCstArguments		dd	;; null term string, arguments to plugin
cjass himself will take care of memory allocation, all you need to - write your code to the specified address (_dCstCodeDest) and set it size (_dCstCodeFinalSize)
There is demo plugin with source, which add string s="Hello from plugin!" to code. Create plugins directory, place it there and try parse code from this post...

posted at 22/02/10 07:41

can you add a mark that can replace "the contents of the code"
i think this mark will not be useless
i wanna to fulfill such a function
like :void d (){};timestart(a,b,c,d);
timestart(a,b,c, void d(){} )
Added a long time, just need to update the tutorial
TimerStart(CreateTimer(), .5, false, lambda nothing () {} )

posted at 22/02/10 02:05

Nice work on the txt2 markup :D
void boo() {
    DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "hello")


struct Test

library Brown
So, did you do it for cjass or just vJASS or just JASS o-o. We shall soon find out ; )

posted at 16/02/10 21:24

[wait for control types]

posted at 13/02/10 21:24
Dark Dragon

i was wondering do u think enum should be a bit changed after ur done with anonym funcs!
enum (type) { private ID1, private ID2 }
can u allow this?
private enum (type) { ID1, ID2 }
now both id1 & 2 are private.
Regards and hope to see anonym funcs work with all function types asap! ofc take ur time ;)

posted at 13/02/10 07:33

scope xx { #define private { a = b } }
like "define private" only can do
#define private a = b
#define private c = d

posted at 12/02/10 01:50

Wait... nevermind, I think my code is just off. Apologies!

posted at 12/02/10 01:47

Anonymous functions do not work within structs. A function is created that is not static.

posted at 11/02/10 18:35

please ignore me that posted at 11/02/10 17:58
i do something useless

posted at 11/02/10 17:58

nothing a {u=XXX}
function a takes nothing returns nothing
local unit u = xxx
can add "set u = null" when "u" is local??

posted at 10/02/10 13:55
Dark Dragon

i figgured out that it might be hard to implement that math stuff with anonym funcs...
so maybe
code c = lambda nothing() {} // function cj_anonym_x
math m = real(real x) {return x} // cj_anonym_x
or some other keyword...
everything is same just keyword function should be removed!

posted at 10/02/10 13:52
Dark Dragon

seems to work just fine now!
it would be great if this would work now!
math m = real(real x) { return x*x }
once u have time i would really be happy to finally be able to convert my code to lambda funcs!

posted at 10/02/10 09:26
Dark Dragon

omg sry i have no idea how does it compile, so i tested it and it really does compile... stuff is that in my libs i actually coded it other way around so thats why it does not work...
please check this :)

define {
ForGroup(g, f) = For##Group(g, f)
ForGroup(g, f, v) = { temp = v; For##Group(g, f) }
integer temp = 0
nothing f() {
group g = null
ForGroup(g, lambda nothing() {})


posted at 10/02/10 05:14

Here's an example of the lexical preprocessor concept I keep talking about-
if true then
if true then

block[0] = if true then
block[0][0] = if true then
block[0][0][0] = printf("")
block[0][1] = else
block[0][1][0] = printf("")
block[0][2] = endif
block[1] = endif
And really those would be lists
The operations would be the simple operations from collections for lists and dynamic memory-
I hope I am very clear now : )
Using a preprocessing language like Euphoria or Lua for manipulating that block among other things would be a major plus, but I'd honestly be happy if there were at least preprocessing directives ; P.

posted at 10/02/10 01:15

@ADOLF, I haven't been able to duplicate the error since I changed the code... but the fact is it ran with cjass disabled and didn't with cjass enabled, meaning 0 errors. I looked through the code and it wasn't replacing every other //! endtextmacro ^^.
Like I said, haven't been able to get it to do that again, might have been a very rare error when only a certain thing happens ;o.

posted at 09/02/10 23:31

@Dark Dragon

define ForGroup(g, f) = For##Group(g, f)
define ForGroup(g, f, v) = { temp = v; For##Group(g, f) }
nothing f () {
ForGroup(g, lambda nothing() {})

Parsed sucess. If the error is - let's just wrong code, where I could easily repeat it.
Nestharus macros is too concerned)

posted at 08/02/10 18:33

In case a) you cannot transtate
if (true)
if (true) then
You must search for nearest "endif" which can be several lines later.
In case b) you will lost backward compatibility. With cjass-only blocks too.
Underscores? I tryed to indent by underscores because spaces are cut out.
Will we able to use code-blocks here?

posted at 08/02/10 13:11

Woops, on the blocks I had it backwards...
(type reference)<OPERATOR><NAME>(ARGS) : type {code}
<OPERATOR><NAME>(ARGS) : type {code}

posted at 08/02/10 13:06

I just wanted to point out the problem of using {} with defines...
define test = {
if true {
define test2 = {
Furthermore, this doesn't work..
define test = {
if true
define test2 = {
test {
test2 {
Which makes me a little sad : \.
Oh, and extending an object syntax ^^
type : (type reference)<OPERATOR><NAME>(ARGS) {code}
type : <OPERATOR><NAME>(ARGS) {code}
meaning no ref passed
struct Test : [] {}
Test : (Test this)<.><test>() {
unit : (unit this)<.><x>() {
Test tester = 0
unit u = CreateUnit(...)
I know that last suggestion didn't follow any C Syntax stuff.. but it would be quite awesome : ).
Also, generic blocks { } should auto run in main based on found order ^^.
Library should change into namespace and scopes should be eliminated. Things with same namespace merged and namespaces include other namespaces.
namespace Rawr {
include Boo
printf("RAN AT MAIN 2")
namespace Boo {
printf("RAN AT MAIN!!")
That's my wishlist at the moment, and ofc ternary operators and fix the mass of bugs ^^.
Oh, the textmacros magically started working again... not sure what's going on, but it's a funky error. Good luck finding it, lol.
Oh yea, //insert random preprocessor block comments and cJASS only syntax comments

posted at 08/02/10 10:42

This is the collection library I wold love you to implement as a part of the regular cJASS library. The implementation I wrote is pure vJASS, but it can be modified to cJASS with the same idea of the three API layers per struct/namespace : ).
If you look through the developer API, you'll see that it has massive amounts of flexibility. If you look through the actual code, you'll see that it's extremely efficient : ).

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]