| 01-11-2004, 12:44 PM | #61 |
Thanks for the new version. There are some things that do not work properly yet. 1) The syntax replacements are done in string literals too. So something like set x = "Come if you like" is replaced. I removed that for now. 2) %row is increased for every line in the output, not only for every table row. With this change it works: my $condtrue = 0; foreach my $format (@line) { my $con = "($cond)"; if (row($table,$format, $k, $kalt, $con)) { print; $condtrue = 1; } } $k++; $kalt++ if $condtrue; (Note that I do not really know Perl so I don't know if this is correct but it works) It's a bit strange that the condition is evaluated for each line of the output instead of only for each table row. Changing that should improve performance (although it is fast enough as it is now). |
| 01-11-2004, 02:01 PM | #62 |
I have to confess that the code for table-inclusion isn't optimal at all, it will be rewritten though. I will look into the %row problem... |
| 01-11-2004, 02:28 PM | #63 |
You did the best solution possible without more serious rewriting of code. The condition is evaluated a bit much, true. I wont rewrite until I rewrite the complete program though, but that is probably soon anyway. I applied your patch, and removed syntactic short-cuts. Those who want short-cuts, should apply the file syntax, after having applied ejass... I am open for suggestions regarding which new features are needed. |
| 01-15-2004, 05:14 PM | #64 |
The precompiler works really fine now :) . I have over 100 tables that are included in AMAI now (okay, a lot of that are not really tables but a sequence of chat lines). For inclusion I very often have something like the following piece of code: #IFDEF TFT #INCLUDETABLE <ElfStrategyTFT.txt> #COND %1 ne "Strategy Function Name" set stratname[%row-1] = "%2" set stratreport[%row-1] = "%3" #ENDINCLUDE #ELSE #INCLUDETABLE <ElfStrategyRoC.txt> #COND %1 ne "Strategy Function Name" set stratname[%row-1] = "%2" set stratreport[%row-1] = "%3" #ENDINCLUDE #ENDIF As you can see the only difference is TFT and RoC. Now it would be nice if there would be a precompiler variable that could be set and would then be inserted in #INCLUDE and #INCLUDETABLE at a marked position in the file name. Something like the following: #IFDEF TFT #DEFINE $ending$ TFT #ELSE #DEFINE $ending$ RoC #ENDIF ... #INCLUDETABLE <ElfStrategy$ending$.txt> #COND %1 ne "Strategy Function Name" set stratname[%row-1] = "%2" set stratreport[%row-1] = "%3" #ENDINCLUDE Also the #EFR feature (exclude first row of the table, so there can be headers) would be nice to be able to remove this condition workaround. Then the #EVAL feature (evaluate static expressions that are generated through usage of %row) to make the created code faster and more beatiful. Then the code from up there would look like: #INCLUDETABLE <ElfStrategy$ending$.txt> #EFR set stratname[#EVAL{%row-1}] = "%2" set stratreport[#EVAL{%row-1}] = "%3" #ENDINCLUDE and the created code would look like: set stratname[0] = "..." set stratreport[0] = "..." set stratname[1] = "..." ... instead of: set stratname[1-1] = "..." set stratreport[1-1] = "..." set stratname[2-1] = "..." ... Another feature that would be useful is to be able to write a line using the last value of %row right after the #INCLUDETABLE to store the number of rows in a variable for example. Code example as it is now: set chat_greet_length = -1 #INCLUDETABLE <ChatEnglishGreet.txt> set chat_e_greet[%row-1] = "%1" set chat_greet_length = chat_greet_length + 1 #ENDINCLUDE It generates a lot of set chat_greet_length = chat_greet_length + 1 to compute the number of rows at runtime. This would be nicer: #INCLUDETABLE <ChatEnglishGreet.txt> set chat_e_greet[%row-1] = "%1" #AFTERINCLUDE set chat_greet_length = %row-1 #ENDINCLUDE EDIT: The "variable in inclusion file name" feature would be especially useful as it would allow me to easily put all the races .ai files in one .eai file extremely reducing the duplication of code. Without that feature it would require a lot of #IFDEF. |
| 01-19-2004, 02:13 AM | #65 |
I'll look into it... you should definitely not have to write a lot of unnecessary code. |
| 01-19-2004, 08:32 AM | #66 |
I must say this precompiler really comes in handy, first I was not sure what it was good for but after AIAndy explained and we made some progress with it and AMAI it's really nice. Really amazing how it all worked after it compiled over 100 tables into 10 .ai files without a single error. But the arrays starting with [1-1] instead of [0] is a bit irritating to see. :) Keep up the good work! |
| 01-19-2004, 10:19 AM | #67 |
If you do not really have the time to do these features right now, tell me. I have looked into the code and I think I can do them myself too. BTW, it is not really the amount of code that is the problem with the lots of #IFDEFs. It is the duplication of the code and that it looks a lot more complex than it is. That reminds me that I added another small feature to the Precompiler. To interpret all arguments except the first as definitions. So with perl ejass.pl common.eai TFT > common.ai he precompiles common.eai as if there was #DEFINE TFT as first line. That allowed for an easy Make.bat file to precompile all of AMAI. |
| 01-19-2004, 12:56 PM | #68 |
Don't count with updates until Sunday... Please post any updates you do (that includes all of you), and I will try to include them. |
| 01-23-2004, 05:21 PM | #69 |
Hmm, my post here disappeared too. Here it is again: I have implemented the features I mentioned into the Precompiler. As a new feature I also put in Multi Level #INCLUDETABLE (so you can use #INCLUDETABLE in #INCLUDETABLE). |
| 01-24-2004, 05:08 AM | #70 |
Now add in structures and classes, utilizing a heap driven by a global array swap used for taking values in and out of the game cache ;) |
| 01-24-2004, 08:29 AM | #71 |
Could you define a nice syntax for it? ;) |
| 02-15-2004, 11:17 PM | #72 |
There has not been much work on the precompiler lately as some of you might have noticed and it will probably stay that way several mote weeks, unfortunately. It would be good if we could discuss what extensions are needed, and these should be implemented before I start actively working on it again. If there is someone wanting to take active part in the development, please step forward. There have been lots of talk regarding implementing objects and classes and about wheter Jass is object-oriented or not. If we could decide on how we want Jass syntax for creating classes and objects should look, I am pretty convinced that it is possible to convert this to normal Jass code. Do you have any special needs for any futher AMAI version Andy? |
| 03-10-2004, 05:15 PM | #73 |
Hey, I'm a perl scripter, and I'm quite interested in eJass. I suggest you set up some means for multiple developers to share work, so that others can more easily contribute code, at least I'd be interested in helping you develop :-) Posting all the modifications to one thread is a bit cluttered etc. |
| 03-10-2004, 11:00 PM | #74 |
Hm. Last dated post is two months old ^_^ Oh well, I'd just like to inform you that I've started coding my own pre-processor script (mine is in perl too). Currently it's got #defines, #includes, #ifs, #warns and #dies. Planned to implement is #endifs (*snicker*), #elseifs, #elses, global variable grouping (to top of file). I'm also thinking about including the #includetable-stuff that Vidstige has in his script. It supports nested #ifs / #elseifs and perl expressions in them, and also provides basic measures to stop infinite recursive #includes and duplicate #includes. It's currently VERY work in progress, the whole thing has been made in the last few hours ;-) I'd like some feedback on other features you want or comments ;) *heads to bed* (The reason I decided to make my own was because the work Vidstige has done only takes a small amount of time to replicate and because there were some parts of his script's design that I didnt like (matter of taste)) |
| 03-11-2004, 01:03 AM | #75 |
I can't say that I like the design myself really either. I must confess that I can understand that you want to build a new version, rather than try to understand why the nested #ifs seems to work in my code. I also agree that posting updates in this thread isn't the best way for multiple developers. I haven't abandoned this project, even if little work has been done lately, but it will take a few more weeks before I will spend time on it. Feel free to post or pm thoughts on how to design a precompiler properly. |
