Difference between revisions of "Batch to JS conversion guide"

From MSX Game Library

Line 20: Line 20:
 
#** String: Enclose the value in parenthesis. For example, '<tt>ProjName=template</tt>' become '<tt>ProjName = "template"</tt>' ''(space are not mandatory)''.
 
#** String: Enclose the value in parenthesis. For example, '<tt>ProjName=template</tt>' become '<tt>ProjName = "template"</tt>' ''(space are not mandatory)''.
 
#** Array: The array values must be converted according to their type (number, string, ...) but the array itself must be encapsulated with the '<tt>[]</tt>' characters. For example, '<tt>LibModules=system,bios,vdp</tt>' become '<tt>LibModules = [ "system", "bios", "vdp" ]</tt>' ''(space are not mandatory)''.
 
#** Array: The array values must be converted according to their type (number, string, ...) but the array itself must be encapsulated with the '<tt>[]</tt>' characters. For example, '<tt>LibModules=system,bios,vdp</tt>' become '<tt>LibModules = [ "system", "bios", "vdp" ]</tt>' ''(space are not mandatory)''.
 +
 +
=== Example ===

Revision as of 18:41, 22 December 2022

Historically, MSXGL was designed on Windows PC, for users of this platform. The Build tool was therefore written in Batch language (.bat).

To open the library to users of other platforms (Linux and macOS) and overcome the limitations of the Batch language, the Build tool has been entirely rewritten in Java Script and executed via Node.js. Everything necessary for the execution of these new scripts being packaged with MSXgl on Windows, the user has no other software to install. For Linux, SDCC and Node.js must be installed separately.

This guide is intended for users who have already created an MSXgl project and who would like to convert their project configuration to benefit from the new version of the Build tool (which I strongly recommend).

Convert Batch project to JS

  1. Rename your build.bat to project_config.js (You can duplicate the file if you want to keep the batch file as a backup)
  2. Open project_config.js an start the Batch to JS converion:
    • Convert comment:
      • Replace any '::' by '//'.
      • Replace any 'REM' by '//'.
    • Remove '@echo off', 'call ..\default_config.cmd %0' and the final 'call %LibDir%\script\build.cmd'.
    • Remove all the 'set ' before the parameter name.
    • Convert parameter value depends on the value type:
      • Number: Nothing to do.
      • Boolean: You can keep '0' and '1' value but for a better readability, it is recommended to use the values 'true' and 'false' instead.
      • String: Enclose the value in parenthesis. For example, 'ProjName=template' become 'ProjName = "template"' (space are not mandatory).
      • Array: The array values must be converted according to their type (number, string, ...) but the array itself must be encapsulated with the '[]' characters. For example, 'LibModules=system,bios,vdp' become 'LibModules = [ "system", "bios", "vdp" ]' (space are not mandatory).

Example