Author Topic: Advanced Script Compiler for NWN1 release thread  (Read 7367 times)

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #30 on: August 15, 2011, 04:54:04 pm »


               This (spawning multiple processes) is exactly what we were doing with the PRC compiler. We can't seem to make it work with the new build. More as it comes...

Funky
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #31 on: August 16, 2011, 12:21:20 am »


               

FunkySwerve wrote...

This (spawning multiple processes) is exactly what we were doing with the PRC compiler. We can't seem to make it work with the new build. More as it comes...

Funky


There should be no issue with running multiple instances simultaneously; I would be curious to understand what error conditions you're running into here.
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #32 on: August 16, 2011, 12:23:38 am »


               

Baaleos wrote...

Well,
My own investigations into doing the multi-threaded compiling went bust.
I would be interested in seeing someone releasing a prototype just to see if it is feasible.


Eg - For each nss in ListOfNSS
{
while(CURRENT_THREADS >= MAX_THREADS) //Prevents us from going mad
{
Thread.Sleep(100);
}
DoCompile(nss);
}

This is how I would visualize it in C#, of course, I have no idea how to impliment this in a C++ Project.


Baaleos, this assumes that the underlying compiler logic is thread-safe (it isn't).  You would need to rework the parts of the compiler that aren't thread safe to either acquire brief synchronization (best choice for the resource management logic) or use thread local storage (e.g. the various handler routines called by the bison generated parser).

An alternative option would be to run the existing code in multiple processes and provide some multiplexing mechanism to bridge the resource system in the toolset to those processes.
               
               

               
            

Legacy_Mavrixio

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #33 on: August 20, 2011, 03:04:36 pm »


               When i try : NWNScriptCompiler -1ceglo -n C:/NeverwinterNights/NWN test.nss

i get: "WARNING: Failed to open .key archive 'C:/NeverwinterNights/NWN//xp1patch.key': exception 'Failed to open KEY file.'."
(It is adding 2 "/" intead of 1)
               
               

               


                     Modifié par Mavrixio, 20 août 2011 - 02:04 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #34 on: August 20, 2011, 06:52:05 pm »


               You can disregard that warning - the compile will still work. It's my understanding that the 1 parameter indicating you're building a NWN1 script has yet to be implemented. I'm guessing that will remove that error.

Funky
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #35 on: August 20, 2011, 10:45:30 pm »


               No, the -1 argument is implemented. The extra / character shouldn't cause the file open to fail; do you really have an xp1patch.key?

[It's not a fatal error if a particular .key file doesn't exist so long as the resources that scripts ask for can still be found.  The compiler will still look for the other .key files in its list.]
               
               

               


                     Modifié par SkywingvL, 20 août 2011 - 09:47 .
                     
                  


            

Legacy_Mavrixio

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #36 on: August 20, 2011, 11:13:16 pm »


               Oh, right, i dont have it... i guess its a nwn2 only file.

Is it still possible to remove this warning, if the parameter -1 is set? I would like to run the compiler many time for different group of scripts and then ouput all in a log file with the silent mode and get only the error in it, currently it get filled by this warning.
               
               

               


                     Modifié par Mavrixio, 20 août 2011 - 10:14 .
                     
                  


            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #37 on: August 21, 2011, 02:20:13 am »


               It's a NWN1 file that's in the list searched by nwserver.exe.

I could remove the warning entirely.
               
               

               
            

Legacy_Mavrixio

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #38 on: August 21, 2011, 02:42:39 am »


               Thanks!
               
               

               
            

Legacy_Mavrixio

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #39 on: August 24, 2011, 01:38:36 am »


               Any news ? I can't wait to implement it in our development system '<img'>
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #40 on: August 24, 2011, 01:53:24 am »


               I'll see about putting an updated build out this evening.
               
               

               
            

Legacy_Mavrixio

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #41 on: September 01, 2011, 05:44:29 am »


               Bump '<img'>
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #42 on: September 03, 2011, 06:18:33 pm »


               <fades in just long enough...>

ditto :-)

<...to lurk>
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #43 on: September 15, 2011, 07:57:51 am »


               Release 6 posted.  This release turns off the warnings about missing .key files, changes the compiler to stop at the first file that fails to compile by default (continue to all files with the -y option, which lists the number of files that failed at the end if used), and significantly revamps the error and warning message reporting system for the compiler.  Additionally, new non-standard extensions are available by request.

--


Release 6:
----------

- The compiler now correctly issues an error diagnostic if a script program
 attempts to call a function that has been declared but never defined, instead
 of raising an internal compiler assertion.

- The compiler provides support for 'default functions' in extensions mode,
 if -e is supplied on the compiler command line.  A default function can have
 no body and if called, the compiler will automatically substitute a default
 implementation that throws the arguments away and returns the appropriate
 default value for any return value(s) as appropriate.  This feature can be
 activated via a #pragma default_function(function-identifier) directive after
 a prototype for "function-identifier" is observed, but before the function is
 defined.  If a default function is defined as normal, the script program's
 explicit definition is used as the function body instead of the default
 definition.

- The compiler now supports automatic analysis and verification of scripts
 as a compilation post-step in order to check for various inconsistencies.
 Script analysis and verification can be enabled via the -a command line
 option at a modest (10-20%) cost to compile time on most scripts.

- The compiler supports __FILE__, __LINE__, __COUNTER__, __FUNCTION__,
 __NSC_COMPILER_DATE__, and __NSC_COMPILER_TIME__ predefined macros.  The
 macros work the same as their typical C counterparts (with the compiler
 macros reflecting the build time for the compiler itself).  These macros are
 only enabled in extensions mode.

- The compiler now supports #error and #warning to issue diagnostics to the
 programmer.  These directives are only enabled in extensions mode.

- The compiler now has limited #if/#elif/#ifdef/#ifndef/#else/#endif support.
 Only literal integers and macros can currently be tested; there is no support
 for expressions on preprocessor #ifs constructs.  The preprocessor #if
 constructs are only enabled in extensions mode.

- The compiler no longer generates bad code when optimizations are enabled, a
 global variable is initialized with a function call expression, and the
 global variable in question is never written to after assignment.

- In compatibility mode, a warning is now issued if a script program contains a
 for statement with an initializer or increment block whose type is not an
 integer.

- Compiler error and warning messages now have easily searchable identifiers
 associated with them (for example, NSC1001 or NSC6018).
               
               

               
            

Legacy_Mavrixio

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #44 on: September 20, 2011, 01:36:57 am »


               Hi SkywingvL

Thanks for the update!

I installed it on our development system and have a few more requests concerning the output.

Here's one of the command line that i use:

wine /home/sinfar/nwn/../nwn_tools/NWNScriptCompiler.exe -1cegloyq -n /home/sinfar/nwn -i '/home/sinfar/nwn/modules/temp/tests3On09;/home/sinfar/nwn/modules/resources/agl_;/home/sinfar/nwn/modules/resources/agn_;/home/sinfar/nwn/modules/resources/apt_;/home/sinfar/nwn/modules/resources/aquatic_;/home/sinfar/nwn/modules/resources/banker_;/home/sinfar/nwn/modules/resources/barmaid_;/home/sinfar/nwn/modules/resources/bdsm_;/home/sinfar/nwn/modules/resources/bequip_;/home/sinfar/nwn/modules/resources/bi_;/home/sinfar/nwn/modules/resources/bindtl_;/home/sinfar/nwn/modules/resources/bkstore_;/home/sinfar/nwn/modules/resources/bstone_;/home/sinfar/nwn/modules/resources/cac_;/home/sinfar/nwn/modules/resources/cchall_;/home/sinfar/nwn/modules/resources/chess_;/home/sinfar/nwn/modules/resources/chloe_;/home/sinfar/nwn/modules/resources/cmbtz_;/home/sinfar/nwn/modules/resources/craft_;/home/sinfar/nwn/modules/resources/ctf_;/home/sinfar/nwn/modules/resources/deadz_;/home/sinfar/nwn/modules/resources/dm_;/home/sinfar/nwn/modules/resources/dms_;/home/sinfar/nwn/modules/resources/dmsl_;/home/sinfar/nwn/modules/resources/drink_;/home/sinfar/nwn/modules/resources/drow_;/home/sinfar/nwn/modules/resources/ee_;/home/sinfar/nwn/modules/resources/elc_;/home/sinfar/nwn/modules/resources/ele_;/home/sinfar/nwn/modules/resources/emo_;/home/sinfar/nwn/modules/resources/fa_;/home/sinfar/nwn/modules/resources/feternal_;/home/sinfar/nwn/modules/resources/g_;/home/sinfar/nwn/modules/resources/gmbl_;/home/sinfar/nwn/modules/resources/hench_;/home/sinfar/nwn/modules/resources/holo_;/home/sinfar/nwn/modules/resources/home_;/home/sinfar/nwn/modules/resources/hub_;/home/sinfar/nwn/modules/resources/icf_;/home/sinfar/nwn/modules/resources/inc_;/home/sinfar/nwn/modules/resources/jdj_;/home/sinfar/nwn/modules/resources/jewel_;/home/sinfar/nwn/modules/resources/jj_;/home/sinfar/nwn/modules/resources/joust_;/home/sinfar/nwn/modules/resources/kaala_;/home/sinfar/nwn/modules/resources/lil_;/home/sinfar/nwn/modules/resources/lu_;/home/sinfar/nwn/modules/resources/lwjb_;/home/sinfar/nwn/modules/resources/lwpt_;/home/sinfar/nwn/modules/resources/magi_;/home/sinfar/nwn/modules/resources/mappin_;/home/sinfar/nwn/modules/resources/mbm_;/home/sinfar/nwn/modules/resources/mcloth_;/home/sinfar/nwn/modules/resources/mforge_;/home/sinfar/nwn/modules/resources/mkey_;/home/sinfar/nwn/modules/resources/mkpc_;/home/sinfar/nwn/modules/resources/mm_;/home/sinfar/nwn/modules/resources/mmat_;/home/sinfar/nwn/modules/resources/mmm_;/home/sinfar/nwn/modules/resources/mob_;/home/sinfar/nwn/modules/resources/mod_;/home/sinfar/nwn/modules/resources/mons_;/home/sinfar/nwn/modules/resources/msds_;/home/sinfar/nwn/modules/resources/mtm_;/home/sinfar/nwn/modules/resources/mtss_;/home/sinfar/nwn/modules/resources/mystc_;/home/sinfar/nwn/modules/resources/nboard_;/home/sinfar/nwn/modules/resources/nurse_;/home/sinfar/nwn/modules/resources/nw_;/home/sinfar/nwn/modules/resources/ooc_;/home/sinfar/nwn/modules/resources/oz_;/home/sinfar/nwn/modules/resources/pc_;/home/sinfar/nwn/modules/resources/pcman_;/home/sinfar/nwn/modules/resources/pcplc_;/home/sinfar/nwn/modules/resources/ph_;/home/sinfar/nwn/modules/resources/pj_;/home/sinfar/nwn/modules/resources/plcvfx_;/home/sinfar/nwn/modules/resources/possess_;/home/sinfar/nwn/modules/resources/pvpisld_;/home/sinfar/nwn/modules/resources/pwstore_;/home/sinfar/nwn/modules/resources/pzl_;/home/sinfar/nwn/modules/resources/rentrm_;/home/sinfar/nwn/modules/resources/rp_;/home/sinfar/nwn/modules/resources/s_;/home/sinfar/nwn/modules/resources/sail_;/home/sinfar/nwn/modules/resources/sc_;/home/sinfar/nwn/modules/resources/scroll_;/home/sinfar/nwn/modules/resources/sex_;/home/sinfar/nwn/modules/resources/sge_;/home/sinfar/nwn/modules/resources/shckle_;/home/sinfar/nwn/modules/resources/sinfar_;/home/sinfar/nwn/modules/resources/sinstab_;/home/sinfar/nwn/modules/resources/skl_;/home/sinfar/nwn/modules/resources/social_;/home/sinfar/nwn/modules/resources/ssm_;/home/sinfar/nwn/modules/resources/sss_;/home/sinfar/nwn/modules/resources/sstrip_;/home/sinfar/nwn/modules/resources/ssv_;/home/sinfar/nwn/modules/resources/tl_;/home/sinfar/nwn/modules/resources/tnb_;/home/sinfar/nwn/modules/resources/toys_;/home/sinfar/nwn/modules/resources/tpetshp_;/home/sinfar/nwn/modules/resources/tpvp_;/home/sinfar/nwn/modules/resources/txtedit_;/home/sinfar/nwn/modules/resources/vc_;/home/sinfar/nwn/modules/resources/vg_;/home/sinfar/nwn/modules/resources/wastes_;/home/sinfar/nwn/modules/resources/wbook_;/home/sinfar/nwn/modules/resources/welcm_;/home/sinfar/nwn/modules/resources/wstc_;/home/sinfar/nwn/modules/resources/wz_;/home/sinfar/nwn/modules/resources/xs_;/home/sinfar/nwn/modules/resources/yasm_;/home/sinfar/nwn/modules/resources/zep_;/home/sinfar/nwn/modules/resources/zz_' "/home/sinfar/nwn/modules/temp/tests3On09/*.nss" >> /tmp/test_changelogLIlF0U

So yea, its on linux with wine which may explain the weird bug that i get bellow.
This is the output:

test_debug.nss(8): Error: NSC1040: Syntax error at "}"

Compilation aborted with errors.

Error: Failed to process file "/home/sinfar/nwn/modules/temp/testrjqrHM/test_debug.nss".

test_disturb.nss(15): Error: NSC1040: Syntax error at "SendMessageToPC"

Compilation aborted with errors.

Error: Failed to process file "/home/sinfar/nwn/modules/temp/testrjqrHM/test_disturb.nss".

3339736249 error(s); see above for context.

- The number of errors seem wrong.
- Use one new line instead of 2.
- Output the "Compilation aborted with errors." and "3339736249 error(s); see above for context." only in normal mode but not in quiet mode as those can be interpreted.

Other than that, the script errors are volontary and all the scripts get compiled correctly.
               
               

               


                     Modifié par Mavrixio, 20 septembre 2011 - 12:39 .