Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

CSlint in WSL - A quick How-to

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Campaign Series: Vietnam >> Scenario Design and Modding >> CSlint in WSL - A quick How-to Page: [1]
Login
Message << Older Topic   Newer Topic >>
CSlint in WSL - A quick How-to - 1/29/2022 8:54:37 AM   
Crossroads


Posts: 17372
Joined: 7/5/2009
Status: offline
This is the very first version of how to install and use CSlint utilities under Windows Subsystem for Linux. Any questions, errata, please let us know!




How-To: CSlint in Windows 10 or higher

The purpose of this thread is to describe how-to

  • Install the "Windows Subsystem for Linux", or "WSL", in Windows 10 or higher
  • Install, setup, and use the CSlint quality assurance tools in WSL
  • Install Lua for being able to QA your Lua scripts as well in WSL
  • Run any other helpful Bash shell scripts there

    To get started, here's the Microsoft Windows Subsystem for Linux Documentation home page. Have a look so that you get an overall idea for what WSL is, if you're not already familiar with it.

    Now that Windows 10 comes with a full blown Linux subsystem, there is no longer a mandatory reason to install Cygwin on Windows systems. Do note that Berto developed CSlint under Cygwin, so while I for one am solely using WSL to run CSlint nowadays, it is not necessary 100% compliant with Cygwin.

    Any questions or comments please post here




    What is CSlint?

    quote:

    ORIGINAL: berto

    Akin to the well-known C programming language utility lint. ("Lint: A Unix C language processor which carries out more thorough checks on the code than is usual with C compilers. Lint is named after the bits of fluff it supposedly picks from programs.")

    Similarly, CSlint is a toolkit of programs designed to discover and report bugs, problems, glitches, anomalies in the Campaign Series game data files.





    Table of Contents

  • Installing WSL
  • Installing CSlint
  • Adding Lua to WSL
  • How to use CSlint tools
  • Known CSlint anomalies under WSL (As noted above, CSlint was developed in Cygwin. A short list, though!)



    Useful links

  • Windows Subsystem for Linux Documentation
  • HowToGeek 37 Important Linux Commands You Should Know





    < Message edited by Crossroads -- 2/4/2022 10:33:25 AM >


    _____________________________

  • Post #: 1
    RE: CSlint in WSL - A quick How-to - 1/29/2022 8:54:50 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    Installing Windows Subsystem for Linux on your W10 or higher

    First, you must have an up-to-date Windows 10 or higher to do this. Anything older, for instance Windows 7 or Windows 8, you need to install Cygwin instead to be able to run CSlint scripts and Bash shell commands on your Windows rig.

    That said:




    STEP 1 - To install the subsystem, follow the steps described in this page: Install on Windows.

  • Use the install method Windows 10 Fall Creators Update and later: Install from the Microsoft Store as specified there (the first option)
  • Select Ubuntu as your Linux distribution on your computer ( I need to talk with Berto if this is still important, or if you'd just choose your favourite distro instead)







    STEP 2 - Once you've completed those steps and installed Ubuntu per above, initialize your new installation as described here.

  • keep your username and password very simple, as you do not (!) want to forget them later on.






    STEP 3 - update the Ubuntu package with latest updates

    At this stage, update the Ubuntu package with latest updates by typing in the following command:


    $ sudo apt update && sudo apt upgrade

    quote:

    ORIGINAL: berto

    That is the procedure for doing a "WSL Update". This is similar to a Windows Update, but unlike Windows Update, any WSL (Linux) update is not automatic; you must initiate it manually. The Linux maintainers update Linux bits and pieces constantly. For security and other reasons, it is important that you issue the above command regularly, once per week or at minimum once per month, say.

    After your initial WSL install, your new install will be substantially out of date. When you issue the above command, the "package list" will be updated. You will then be prompted (type 'y' for "yes") to do the actual upgrades. (Somewhere along the way, you might be prompted for a preferred "character encoding". If so, just select the default UTF-8. On one of my Ubuntu WSL installs, I was prompted for this. On the other, I was not. YMMV.)

    (In the above command, 'sudo' -- "super user do [something]" -- is the wrapper command to elevate your privileges to "root" or "super user" status. "super user", aka "root", is the equivalent of Windows' Administrator. You will need to enter your user password when prompted for it by sudo. You are asked for your user password at the end of the WSL install. You do remember your WSL user password, right? )








    Attachment (1)

    < Message edited by Crossroads -- 1/29/2022 10:03:52 AM >


    _____________________________


    (in reply to Crossroads)
  • Post #: 2
    RE: CSlint in WSL - A quick How-to - 1/29/2022 8:54:58 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    Install the latest CSlint utily package to your WSL home.

  • As of now, the latest package will always be included with all games, in their /Tools/CSlint folder




    STEP 1 - Configure your folder structure to CSlint environment settings, available in a file called cslint.conf.

    To do so:

  • Locate and open cslint.conf at your game's \Tools\CSlint folder.
  • Open it up with Notepad, Notepad++, jEdit, ..., and edit it as follows


    Note the syntax: your C-drive is /mnt/c your D-drive is /mnt/d and so on. Also, UPPER and lower cases MATTER here! Be careful!

    The folders you need to specify are:

  • cslintroot - the folder where you have your CSlint package. We will soon have it at our WSL home directory. Simply: "~/CSlint"

  • gameroot - the base folder for your games. My install location for all my Matrix Games is C:\Matrix Games. Your path may differ from this.


  • vndir - CS Vietnam location.
  • medir - CS Middle East location but commented out! This is what you'd add once Middle East 3.0 with full CS Event Engine Lua implementation becomes available.

  • Note the commented-out rows as those begin with the hash symbol #

    Here's mine, and this is the default cslint.conf tempalte on the Tools\CSlint folder as well as of 1.01 UPDATE:

    quote:

    # cslint.conf -- default CSlint configurations

    # for the following configs, may be any of:
    #
    # yes|YES|true|TRUE|on|ON
    # no|NO|false|FALSE|off|OFF
    #
    # omitting any config (perhaps by commenting out) defaults its setting to 'no'

    show_notice no
    show_warning no
    show_error yes
    show_files yes
    show_linenos yes
    test no
    debug no

    # for the following configs, set the appropriate directory (folder) path
    # cslintroot & gameroot are required

    cslintroot "~/CSlint"

    gameroot "/mnt/c/Matrix Games/"

    # Change the following configs as needed

    vndir "Campaign Series Vietnam"

    # medir "Campaign Series Middle East"






    STEP 2 - Copy the CSlint package to your WSL home directory

    Be careful here, and copy the following commands exactly as they appear!

  • Fire up your new Bash Shell, and one by one, run the commands exactly as they appear below.
  • Only alter your game folder location, if it differs from mine (the fourth line, where you first cd there)
  • You might want to copy them from here and paste them to Bash Shell

    cp -p .profile .profile.orig

    echo "" >> .profile

    echo "export PERL5LIB=~/CSlint" >> .profile

    cd "/mnt/c/Matrix Games/Campaign Series Vietnam/Tools"

    rsync -vap CSlint ~


    Here's how this played out on my computer:





    For further information for each command, see e.g. Ubuntu command listing.




    STEP 3 - Test your new CSlint install

    Finally, let us quickly test our CSlint intall by running one of the provided utilities.

    First, cd to your new CSlint directory, right under your WSL home directory which is marked ~

    Then, run say Orders-of-Battle reporting tool csoobrpt.pl with g -vn -h parameters (game = Vietnam, help).


    I did this in above screenshot, you should get a similar result under your new install.






    Attachment (1)

    < Message edited by Crossroads -- 1/29/2022 10:05:09 AM >


    _____________________________


    (in reply to Crossroads)
  • Post #: 3
    RE: CSlint in WSL - A quick How-to - 1/29/2022 8:55:13 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    Add Lua to your WSL install

    Nicking Berto's internal post for this one:






    Everybody, please do the following.



    You check for the existence of the lua & luac EXEs in your WSL install with



    $ which lua luac
    [nil]



    Most likely, you will get no output, indicating that indeed they are not installed.

    You effect the install via



    $ sudo apt install lua5.2
    ...



    The above will prompt you to enter your password.

    After installation, you can check for successful install by



    $ lua -v
    Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio



    In fact, the game engine EXE uses the more recent 5.3.4, but for our purposes, the discrepancy shouldn't matter.

    With luac (also lua etc.) installed on your system, you can now do direct .lua file syntax checks by, for example



    $ luac -p "$VN"/scenarios/VN_510327_Mao_Khe_H.lua
    [nil]



    If there is no output, there are no issues; the file syntax checks cleanly.

    Since csluachk.pl invokes luac from within, you are now fully set up for csluachk.pl operation also.




    < Message edited by Crossroads -- 1/29/2022 9:56:00 AM >


    _____________________________


    (in reply to Crossroads)
    Post #: 4
    RE: CSlint in WSL - A quick How-to - 1/29/2022 8:59:29 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    How to use CSlint tools

    I will leave it for Berto to introduce each CSlint utility here once he has the time to do so.

    However, that said, here's a most basic guidline to use the utilities:




    CSlint utilities included with Vietnam 1.0

  • cslint.conf - CSlint settings

  • csaichk.pl -- a program to check Adaptive AI (.ai) files
  • csaiprpt.pl -- a program to report A/I parameters in the .ai files
  • csflags.pl -- a program to do .oob file parameter conversions
  • csflgrpt.pl -- a program to report units with the specified attribute flags
  • csluachk.pl -- a program to check Lua EE (.lua) files
  • csmapchk.pl -- a program to check map files
  • csmkai.pl -- a program to create scenario specific adaptive ai files (it is recommended to set these from lua instead)
  • csmklua.pl -- a program to generate Lua EE (.lua) files
  • csoobchk.pl -- a program to check order of battle .oob files
  • csoobrpt.pl -- a program to report parameters in the .oob files
  • csorgchk.pl -- a program to check organization files
  • csrptflags.pl -- a program to report all unit flags
  • csscnchk.pl -- a program to check scenario files
  • cssndchk.pl -- a program to check sound files
  • csutxchk.pl -- a program to check unittext.txt
  • cswpnchk.pl -- a program to check weapon.pdt





    Usage

    g - vn For now, just take a habit to always indicate the game you are using the tool for, in this case Vietnam. These utilities were first created for internal use, and we have several BETA builds for various games under development.

    - h Then, use the -help command to get command line parameters specific to utility you are using printed out.

    For instance:

    quote:

    petrin@elvis-v:~/CSlint$ ./csoobrpt.pl g -vn -h

    Usage: csoobrpt.pl [-h|-help] [{+|-}i|{+|-}insensitive] [{+|-}G|-debug] -g[ame] {me|vn|cw|ef|wf|pf} [{+|-}F|{+|-}show_files] [{+|-}N|{+|-}show_linenos] [-s<char>|-separator<char>] [-m "<string>"|-match "<string>"] [<parameters list>|-ALL]

    parameters list:
    -1 or -id
    -2 or -strength
    -3 or -assault
    -4 or -defend
    -5 or -firingcost
    -6 or -loadingcost
    -7 or -unloadingcost
    -8 or -speed
    -9 or -xcspeed
    -10 or -weight
    -11 or -pressure
    -12 or -concealment
    -13 or -movesound
    -14 or -firesound
    -15 or -countercell2d
    -16 or -basecell3d
    -17 or -animate
    -18 or -type1d (NATO symbol)
    -19 or -type2d (unit icon)
    -20 or -bitmap3d
    -21 or -points
    -22 or -moveflags
    -23 or -carryflags
    -24 or -fireflags
    -25 or -otherflags
    -26 or -moreflags
    -27 or -morefireflags
    -28 or -startyear
    -29 or -startmonth
    -30 or -stopyear
    -31 or -stopmonth
    -32 or -frontmod
    -33 or -sidemod
    -34 or -rearmod
    -35 or -name
    -36 or -short
    -37 or -nick

    petrin@elvis-v:~/CSlint$


    < Message edited by Crossroads -- 1/29/2022 10:24:45 AM >


    _____________________________


    (in reply to Crossroads)
  • Post #: 5
    RE: CSlint in WSL - A quick How-to - 1/29/2022 9:47:09 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    And that's it for now! Please allow us more time to get more details out for using CSlint here. Until that, I hope this proves useful.

    Any questions, comments, please ask.

    Good luck using CSlint utilities under your system!



    < Message edited by Crossroads -- 1/29/2022 10:25:50 AM >


    _____________________________


    (in reply to Crossroads)
    Post #: 6
    RE: CSlint in WSL - A quick How-to - 1/29/2022 10:46:45 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    Known anomalies when running CSlint under WSL


    quote:

    ORIGINAL: Crossroads

    Now that Windows 10 comes with a full blown Linux subsystem, there is no longer a mandatory reason to install Cygwin on our systems. Do note that Berto developed CSlint under Cygwin, so while I for one am solely using WSL to run CSlint nowadays, it is not necessary 100% compliant with Cygwin.


    KNOWN ANOMALIES




    csmklua.pl

  • Recommended parameters: Use -a Abbreviate -p Prune -b Blocks parameters for Lua file genereation.

  • Error: under WSL when creating those ever importan Lua templates for your new scenario: curly brackets thrown an error and prevent the Lua file from being generated.
  • Solution: find and replace curly brackets in ORG file (typically aircraft ordnance descriptions) and replace with something else for duration of running csmklua.pl



    quote:

    petrin@elvis-v:~/CSlint$ ./csmklua.pl -g vn -h

    Usage: csmklua.pl [-h|-help] [{+|-}G|-debug] [-a[bbreviate]] [-p[rune]] [-r[everse]] [-b[locks]] -g[ame] {me|vn|cw|ef|wf|pf} -f <scenario file> -o <lua file>

    petrin@elvis-v:~/CSlint$ ./csmklua.pl -g vn -a -p -b -f VN_651117_LZ_Albany.scn -o VN_651117_LZ_Albany_TEST.lua

    Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/<([pcbrdgka])>Douglas A-1 Skyraider { <-- HERE Guns} 188</ at ./csmklua.pl line 1093, <CSLINT> line 185.



    For some reason, the curly brackets are an issue. To run csmklua.pl in WSL, you need to go the scenario file, and for duration of csmklua, replace them with something else.

    LZ_Albany ORG file:

    quote:

    P105014 188 6 Douglas A-1 Skyraider {Guns}
    P105014 189 6 Douglas A-1 Skyraider {Guns}
    P105014 190 6 Douglas A-1 Skyraider {Guns}
    P105062 191 6 Douglas A-1 Skyraider {Rockets}
    P105062 192 6 Douglas A-1 Skyraider {Rockets}
    P105062 193 6 Douglas A-1 Skyraider {Rockets}
    P105062 194 6 Douglas A-1 Skyraider {Rockets}
    P105063 195 6 Douglas A-1 Skyraider {Bombs}
    P105063 196 6 Douglas A-1 Skyraider {Bombs}
    P105063 197 6 Douglas A-1 Skyraider {Bombs}
    P105063 198 6 Douglas A-1 Skyraider {Bombs}
    P105064 199 6 Douglas A-1 Skyraider {Napalm}
    P105064 200 6 Douglas A-1 Skyraider {Napalm}


    For instance:

    quote:

    P105014 188 6 Douglas A-1 Skyraider ---Guns---
    P105014 189 6 Douglas A-1 Skyraider ---Guns---
    P105014 190 6 Douglas A-1 Skyraider ---Guns---
    P105062 191 6 Douglas A-1 Skyraider ---Rockets---
    P105062 192 6 Douglas A-1 Skyraider ---Rockets---
    P105062 193 6 Douglas A-1 Skyraider ---Rockets---
    P105062 194 6 Douglas A-1 Skyraider ---Rockets---
    P105063 195 6 Douglas A-1 Skyraider ---Bombs---
    P105063 196 6 Douglas A-1 Skyraider ---Bombs---
    P105063 197 6 Douglas A-1 Skyraider ---Bombs---
    P105063 198 6 Douglas A-1 Skyraider ---Bombs---
    P105064 199 6 Douglas A-1 Skyraider ---Napalm---
    P105064 200 6 Douglas A-1 Skyraider ---Napalm---


    Save, run csmklua.pl, undo changes, save again to original.

    Note there is no need to do anything in the Lua file generated, especially if using the -a Abbreviate parameter as recommended to do.




    < Message edited by Crossroads -- 2/2/2022 8:51:24 AM >


    _____________________________


    (in reply to Crossroads)
  • Post #: 7
    Page:   [1]
    All Forums >> [New Releases from Matrix Games] >> Campaign Series: Vietnam >> Scenario Design and Modding >> CSlint in WSL - A quick How-to Page: [1]
    Jump to:





    New Messages No New Messages
    Hot Topic w/ New Messages Hot Topic w/o New Messages
    Locked w/ New Messages Locked w/o New Messages
     Post New Thread
     Reply to Message
     Post New Poll
     Submit Vote
     Delete My Own Post
     Delete My Own Thread
     Rate Posts


    Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

    0.984