Building An Executable: Difference between revisions

From NARS2000
Jump to navigationJump to search
(→‎Downloads: rev'd NARS code repository location to SourceForge.net; some synch'd fmt'g)
 
(85 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div style="float:right; padding-left:5px;">
{| style="text-align:left; border:1px solid #aaaaaa; background-color:#f9f9f9;width: 200px;font-family: Verdana, sans-serif;"
|- padding:5px;padding-top:0.5em;font-size: 95%;
|
----
<div style="border:1px solid #ccc; background: #fff; border-right:3px solid #ccc; border-bottom:3px solid #ccc; text-align: center; padding:3px; float:right; font-size: smaller; line-height: 1.3; margin-right: 4px;">
<div style="width:100%">{{CURRENTDAYNAME}}</div>
<div style="font-size: x-large; width: 100%;">{{CURRENTDAY}}</div>
<div style="width: 100%;"> {{CURRENTMONTHNAME}}</div>
<div style="width: 100%;">{{CURRENTYEAR}}</div>
<div style="background: #aaa; color: #000;">'''{{CURRENTTIME}}''' UTC</div>
</div>
<big>'''NARS2000 Building The Executable'''</big>
----
<div style="text-align:center;">
</div>
|-
|
__TOC__
|}
</div>
==Update Notice==
<font color=blue>Although it is not the "ONLY compiler - IDE (integrated developer's environment) choice", the below uses '''Visual Studio 2013''' as its designated C/C++ Compiler and IDE(Integrated Developer's Environment, GUI/Graphical User Interface for programming).  All source code compiles correctly and multiple APL workspaces have been tested for correct APL/NARS functionality.  This page is current, up-to-date re NARS working with VS2013's compiler and standards.  The conversion to VS2013 resulted in a more up-to-date (5 years[2008 to 2013] more current software technology) program for the GUI Builder and Compiler interface, including newer C/C++ programming standards.  This has represented a major cyclical software upgrade and results in greater APL user functionality via improved C coding.  Recent releases of NARS2000.exe (32 and 64-bit versions) are fully functional.</font>
<div align="right"><span class="plainlinks" style="font-size:70%">v---- '''Useful Developer links:''' ----v<br>[http://svnbook.red-bean.com Version Control with Subversioning - Conceptual Gen Bkgnd.]<br>[http://sourceforge.net/p/forge/documentation/svn/ Source Forge Versioning Documentation] <br>[http://sourceforge.net/p/nars2000/code/HEAD/tree/trunk/ Source Forge NARS2000 Source Code]</span></div>
==Why Build Your Own==
==Why Build Your Own==


Why not?  Many people think and believe Kenneth Iverson's work remains that of a true genius, a bright light among some very bright intellectual lights, both from a theoretical as well as a software implementation perspective.  Here's your opportunity to attempt to improve upon some very substantive, preexisting software development work - to further it, to make it even better, and perhaps best of all - '''it's free'''.
First of all, you do not have to build your own.  NARS has already created a great existing Nested Arrays Research System APL interpreter.  NARS2000.exe is freely available at [http://www.nars2000.org/download/Download.html NARS Downloads].  Downloads includes Beta releases for APLers so inclined.
 
On the other hand, why not expand your programming/software and computer skill horizons?  Many people think and believe '''Kenneth Iverson's''' work remains that of a true genius, a bright light among some very bright intellectual lights, both from a theoretical as well as a software implementation perspective.  Here's your opportunity to attempt to improve upon some very substantive, preexisting software development work - to further it, to make it even better, and perhaps best of all - '''it's free'''.


Personalize some already pretty amazing software for yourself, or share it with others and get '''their feedback''' for even greater insight and subsequent improvement.  NARS version of APL already has over a quarter million lines of source code, subroutines, macros, functions, etc. - 50 years of sometimes intense and continuing evolution, so you are <u>not</u> creating something from undeveloped scratch, but inheriting and working from already highly evolved, rigidly disciplined concepts and rigorously debugged software over time.
Personalize some already pretty amazing software for yourself, or share it with others and get '''their feedback''' for even greater insight and subsequent improvement.  NARS version of APL already has over a quarter million lines of source code, subroutines, macros, functions, etc. - 50 years of sometimes intense and continuing evolution, so you are <u>not</u> creating something from undeveloped scratch, but inheriting and working from already highly evolved, rigidly disciplined concepts and rigorously debugged software over time.


APL has been used in physics, science, robotics, engineering, artificial intelligence, VLSI, financial, statistical and social science applications.  NASA and Astronomy have used it.
'''APL/2''' has been used in physics, science, genetic engineering-DNA studies, advanced mathematics, robotics, engineering, artificial intelligence, image processing, bio-medicine, VLSI, financial, statistical and social science applications.  NASA and Astronomers have used APL.
 
Now APL/2 is 100% customizable.  Perhaps you will be the first to customize APL to safely drive a vehicle, help save a life, make new discoveries or make some process(es) more efficient.


Now APL is 100% customizablePerhaps you will be the first to customize APL to safely drive a vehicle, help save a life, make new discoveries or make some process(es) more efficient.
It's '''free'''. It's <u>'''evolved'''</u>Once you start examining NARS/APL/APL2 source code you'll find it is comprehensive, elegant, process-symbol-efficient, focused toward the end-user, evolved over some fifty years of use, structurally enigmatic, tirelessly debugged <u>and</u> rich with coding techniques - a great learning tool, even if absolutely nothing else - and NARS believes it is far, far better than just a learning tool.  You'll learn about Bison Parsing, how it helps define compilers and interpreters.  Further, NARS is a tremendous opportunity to learn more about the human-machine interface; how machine hardware operates and - better understand how software and hardware interact together.


It's '''free'''. It's '''evolved'''.  And it is a great opportunity to learn more about the human-machine interface; how machine hardware operates and better understand how software and hardware interact together.  One of the magnificent aspects of APL is how fully it spans the breadth of hardware functionality including - instructions running core processor chip(s) and peripheral devices.  This is not your grandparents' punch card software program run on a room-sized computer that may have taken him/her several days to get results back for in an introductory chemistry or math lab course.  On the other hand, [http://phys.org/news/2015-03-quantum-unexpected-ways.html data structures influence speed of quantum search in unexpected ways].
One of the stellar, intellectually expansive aspects of APL/2 is - how fully the language embraces the <u>breadth of hardware functionality</u>.  This includes instructions running core processor chip(s) and peripheral devices.  This is not your grandparents' punch-card software program run on a room-sized computer, although that was marvelous at its time, but it may have taken him/her several days to get results back for in an introductory chemistry or math lab course.  Today '''[http://phys.org/news/2015-03-quantum-unexpected-ways.html data structures influence speed of quantum search in unexpected ways]'''.


==Platforms==
==Platforms==


The current version of NARS2000 may be built on Windows platforms only, however a goal is to enable it to built on Linux, Mac OS, etc. as per user requests and developer interests.  As such, for the moment, the following description for building an executable is necessarily biased towards Windows.
The current version of NARS2000 may be run and built on a variety of Windows platforms, including most or all post-Windows-98 OS versions.  Furthermore, a long-term goal is to enable NARS to be built on Linux, Mac OS, etc. as per user requests and Developer interests.  If you do not have a Windows machine, the following may be helpful to you:
 
'''[http://www.howtogeek.com/187359/5-ways-to-run-windows-software-on-a-mac/ Five ways to run Windows software on a Mac.]''' From HowToGeek.com, methods include 1)Virtual Machines, 2)Boot Camp, 3)Wine, 4)CrossOver Mac (not free) and 5)Remote Desktop.
 
'''[http://www.howtogeek.com/133515/4-ways-to-run-windows-software-on-linux/ Four ways to run Windows software on Linux.]''' Again from HowToGeek.com, methods include 1)Use Wine, 2)Run Windows in a Virtual Machine, 3)Try Crossover (not free) and 4)Remote Desktop.  A fifth way per [http://www.pcworld.com/article/2900497/how-to-run-windows-software-in-linux-everything-you-need-to-know.html PC World] is dual booting both Linux and Windows on your machine.  This essentially involves partitioning hard drives with a portion reserved for Linux and a portion reserved for Windows.  With costs of external hard drives continuing to decline, buying an external or network hard drive may free up hard drive storage space requirements.
 
'''[http://www.howtogeek.com/173353/how-to-run-windows-software-on-a-chromebook/ How to Run Windows Software on a Chromebook {notebook or tablet PC}.]''' Again from HowToGeek.com, methods include 1)Access a Windows Desktop Remotely, 2)Use Developer Mode and Install Wine (not available for all Chromebooks), 3)Use Developer Mode and Install a Virtual Machine (may require an Intel Chromebook).
 
Furthermore, if you work using a tablet or other computing device which supports remote desktop software such as '''[http://teamviewer.com Team Viewer]''' and you have a home or work computer running Windows - then you can remotely use NARS over your network and internet using that computer as a host and your local device as a client. Network and internet speeds are sufficiently fast and TeamViewer, for instance, is very good at making your remote desktop seem and respond as if virtually right in front of you.
 
For the present, the following sections detail descriptions for building the executable with bias towards Windows.


==Downloads==
==Downloads==
Line 35: Line 75:
<br />All of the tools you'll need are '''freely available'''.  Some of them happen to be Microsoft-specific. Bill Gates while at Harvard actually worked a bit on/with APL, obviously he discovered the importance of working with arrays and symbolic notation. At the same time there is no reason more generic tools (such as [http://www.delorie.com/djgpp/ DJGPP], [http://www.cygwin.com/ Cygwin] or [http://www.mingw.org/ MinGW]) can't be used, a task NARS is hoping someone will volunteer to investigate.  In particular, the '''tools currently used''' to create the APL Executable, <u>in detail</u>, are as follows:
<br />All of the tools you'll need are '''freely available'''.  Some of them happen to be Microsoft-specific. Bill Gates while at Harvard actually worked a bit on/with APL, obviously he discovered the importance of working with arrays and symbolic notation. At the same time there is no reason more generic tools (such as [http://www.delorie.com/djgpp/ DJGPP], [http://www.cygwin.com/ Cygwin] or [http://www.mingw.org/ MinGW]) can't be used, a task NARS is hoping someone will volunteer to investigate.  In particular, the '''tools currently used''' to create the APL Executable, <u>in detail</u>, are as follows:
<br />
<br />
# '''C''' (need '''Visual C++ 2008''' = C++ GUI development environment and compiler for the C language, which much of APL is written in). Compiler and Linker:  '''[http://download.microsoft.com/download/8/B/5/8B5804AD-4990-40D0-A6AA-CE894CBBB3DC/VS2008ExpressENUX1397868.iso Microsoft Visual Studio 2008 Express] (requires Windows XP or later)''' &mdash; includes Link, Make, a Resource Compiler, and an SDK (among others).  Installation Note: Does NOT Install to a mapped or network drive, must be Installed on a local PC drive (e.g. C:\...) and Unmapped directory - Microsoft apparently requires this.
# <u>'''C'''</u> (needed for this NARS2000 project is '''Visual C++ 2013''' = C++ <u>GUI development environment and compiler for the C language</u>, which much of APL's interpreter is written in). Compiler and Linker:  '''[https://app.vssps.visualstudio.com/profile/review?download=true&family=VisualStudioExpressDesktop&release=VisualStudio2013Upd4&type=web&slcid=0x409 Microsoft Visual Studio 2013 Express for Desktop Windows]''' (download requires a FREE Microsoft/Visual Studio account) OS requires Windows XP or later &mdash; includes Link, Make, a Resource Compiler, and an SDK (among others).  Download/Installation Notes: The '''downloaded file''' may be double-clicked in Windows Explorer. VS 2013 does NOT Install to a mapped or network drive(but to something like C:\Program Files\...).  It must be Installed on a local PC drive (e.g. C:\...) and '''unmapped directory''' (but you can map to it later) - Microsoft apparently requires installation to a local machine drive letter such as "C:\...". &nbsp; VS2013 Desktop is free '''and''' it includes a GUI or graphical user interface (icon-based IDE or integrated developer's environment), which is geometrically easier to use than a command-line interface.  Windows 8.1 SDK (does NOT require Windows 8.1, but does update for some 8.1 capabilities, especially useful for using Visual Studio 2013; '''[https://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx?f=255&MSPPError=-2147217396 download is available at Microsoft]'''.  <span class="plainlinks" style="font-size:60%">'''Windows SDK''' (the following MAY NOT BE NECESSARY, SDK=Software Developers Kit, sometimes needed for '''64-bit installations''', usually choose download file GRMSDKX_EN_DVD.iso even for Intel machines) '''[http://www.microsoft.com/en-us/download/details.aspx?id=18950 download here]''', with '''installation instructions [https://github.com/enGits/engrid/wiki/Configure-Microsoft-Visual-Studio-2008-Express-to-also-build-for-Windows-x64 here]'''.</span>
# '''Parser Generator''':  '''[https://cygwin.com/install.html Bison]''', a Cygwin package, (Save and run either '''setup-x86.exe''' or '''setup-x86_64.exe''' as appropriate to your system, '''Choose A Download Source''':  Install from Internet, '''Select Root Install Directory''', '''Select Local Package Directory''', '''Select Your Internet Connection''', '''Choose A Download Site''', '''Select Packages''':  Leave alone '''All (Default)''' - first time through, just click [Next], '''Devel''', and '''bison''', other dependent packages will be installed along with '''bison''')
# '''Parser Generator''':  '''[https://cygwin.com/install.html Bison]''', a Cygwin package, Save and run either '''setup-x86.exe''' (32-bit systems) or '''setup-x86_64.exe''' (64-bit systems) as appropriate to your system, '''Choose A Download Source''':  Install from Internet, '''Select Root Install Directory''', '''Select Local Package Directory''', '''Select Your Internet Connection''', '''Choose A Download Site''', '''Select Packages''':  Leave alone '''All (Default)''' - first time through, just click [Next], '''Devel''', and '''bison''', other dependent packages may be installed along with '''bison''', if not then '''after first''' Cygwin installation finishes, double-click the downloaded Cygwin file in Windows Explorer, downloaded filename should be something like '''setup-x86_64.exe''' and the '''second time through''' do specifically download and install '''Dev''', '''Bison''' - informally note the '''tree structure''' during the Bison download/install since '''creating parse trees''' is '''very much''' a ''Bison program specialty'', a strength.  Compilers and even APL itself relies heavily on correct statement type recognition and parsing.  To make sure you successfully downloaded and installed '''bison.exe''', the file should be '''found''' or reside in the C:\Cygwin\bin or C:\cygwin64\bin folder.  Make note of the folder location since you will need it when setting the PARGEN environment variable shortly, below.
# '''Zip Utility''':  '''[http://www.7-zip.org/ 7-Zip]''' (Latest version, 32- or 64-bit, as appropriate to your system)
# '''Zip Utility''':  '''[http://www.7-zip.org/ 7-Zip]''' (Latest version, 32- or 64-bit, as appropriate to your system; needed to Extract/Unzip the files and folders you are downloading for this project.) If you already have a Zip utility program on your PC, Tablet or Server such as WinZip, you can normally skip the 7-Zip download/install.
# '''PHP''' (Hypertext Preprocessor):  '''[http://www.php.net/downloads.php Downloads]''' (<u>Windows downloads</u> for Windows systems.) (Windows binaries/VC9 x86 Thread Safe/Latest version/Zip or Installer, your choice) (Items to Install: Entire '''Script Executable''', and entire '''Extras'''). Place the unzipped file's contents into something like "C:\PHP". The executable file "php.exe" needs to be "on your directory or environmental path" when later compiling or building the APL executable.
# '''PHP''' (Hypertext Preprocessor):  '''[http://www.php.net/downloads.php Downloads]''' (<u>Windows downloads</u> for Windows systems.) (Windows binaries/VC9 x86 Thread Safe/Latest version/Zip or Installer, your choice) (Items to Install: Entire '''Script Executable''', and entire '''Extras'''). Place the unzipped file's contents into something like "C:\PHP". The executable file "php.exe" needs to be "on your directory or environmental path" when later compiling or building the APL executable.
# '''NARS2000 Source Code''':  Click on '''[http://sourceforge.net/projects/nars2000/ Browse Code] button''' at '''NARS''' SourceForge.net '''code repository'''. You may also use a Version Control program, e.g. see Tortoise SVN below and [http://tortoisesvn.net/ here, see their download page]. <span class="plainlinks" style="font-size:70%"><br><u>'''Prior'''</u> non-current NARS Source Code versions available at [http://code.google.com/p/nars2000/source/checkout Code Google].</span>
# '''NARS2000 Source Code''':  Click on '''[http://sourceforge.net/projects/nars2000/ Browse Code] button''' at '''NARS''' SourceForge.net '''code repository'''.  
# '''NARS2000 External Libraries''':  [http://www.nars2000.org/download/binaries/misc.zip Miscellaneous Library], [http://www.nars2000.org/download/binaries/qdebug.zip qdebug Library], [http://www.nars2000.org/download/binaries/gsldir.zip gsl Library], and [http://www.nars2000.org/download/binaries/mplibs.zip MPIR/MPFR/ECM Libraries]
## You also likely need a Version Control program for SourceForge code 'checkouts', e.g. see '''Tortoise SVN''' below and '''[http://tortoisesvn.net/ here, visit Tortoise SVN's download page]''', then download and install Tortoise SVN's 64-bit or 32-bit version depending on your operating system to subsequently be able to auto-check-out NARS source code. <span class="plainlinks" style="font-size:70%"><br><u>'''Prior'''</u> non-current NARS Source Code versions available at [http://code.google.com/p/nars2000/source/checkout Code Google].</span>
# Multi-precision Library Source Code:  [http://www.nars2000.org/download/binaries/mpfns.zip MPIR/MPFR/ECM Source].  This zipped download is large (467MB) and is needed <u>only</u> to reproduce the files in the MPIR/MPFR/ECM Library download so as to satisfy the requirements of the GNU General Public License (GPL) v3.  For more details on using the files in the download, look in the zipped file for <b><code>readme.txt</code></b>.  If you are happy to use the binary libraries in [http://www.nars2000.org/download/binaries/mplibs.zip MPIR/MPFR/ECM Libraries], you don't need the MPIR/MPFR/ECM Source Code..
# '''NARS2000 External Libraries''':  [http://www.nars2000.org/download/binaries/misc.zip Miscellaneous Library] (misc.zip, which contains 4 .php files and 1 .ttf file - all directly unzipped into C:\NARS2000) and the following NARS libraries:
# [http://msinttypes.googlecode.com/svn/trunk/stdint.h STDINT.H] header file installed in the MS VS 2008 Express include directory (V:\VC\include -- see below)
## [http://www.nars2000.org/download/binaries/mplibs.zip '''MPIR/MPFR/ECM Libraries'''] - These libraries(mplibs.zip) should be directly extracted or unzipped into the C:\NARS2000 folder such that three(3) distinct sub-directories are '''directly''' created: \ecm, \mpfr and \mpir, e.g. C:\NARS2000\ecm.
# Version Control program:  [http://tortoisesvn.net/downloads Tortoise SVN] (Current version, 32- or 64-bit depending upon your OS)
## [http://www.nars2000.org/download/binaries/gsldir.zip '''gsl Library'''] - This library(gsldir.zip) should be directly un-zipped into the C:\NARS2000 folder such that it becomes '''C:\NARS2000\gsl'''.  Folder structure "C:\NARS2000\gsldir\gsl" would be invalid.
# '''Doctor Dump SDK''':  [https://drdump.com/public/DoctorDumpSDK/DoctorDumpSDK.zip Doctor Dump SDK]
## [http://www.nars2000.org/download/binaries/qdebug.zip '''qdebug Library'''] - This library(qdebug.zip) should also be directly un-zipped into the C:\NARS2000 folder such that it becomes '''C:\NARS2000\qdebug'''.  Make sure it is NOT double-enclosed when unzipped, for example the following would be an invalid folder setup structure: C:\NARS2000\qdebug\qdebug.
# File Differencing/Merge program:  [http://winmerge.org/ WinMerge] (Latest stable version)
# '''Multi-precision Library Source Code:  [http://www.nars2000.org/download/binaries/mpfns-src.zip MPIR/MPFR/ECM Source]'''.  This zipped download is large (roughly 0.5GB) and is needed primarily to reproduce files in the MPIR/MPFR/ECM Library download so as to satisfy requirements of the GNU General Public License (GPL) v3.  For more details on using the files in the download, look in the zipped file for <b><code>readme.txt</code></b>.  If you are content to use the already-compiled existing binary libraries in [http://www.nars2000.org/download/binaries/mplibs.zip MPIR/MPFR/ECM Libraries], you may not immediately need the MPIR/MPFR/ECM Source Code; on the other hand - 128-bit CPU chips are in manufacturing production pipelines, quadruple-precision 128-bit floating-point format has been standardized by the IEEE and ultra-precise calculations are already needed in such fields as quantum physics, ref. [http://phys.org/news/2014-06-physicists-quantum-ultra-precise.html Physicists take quantum leap toward ultra-precise measurement], 6/2/2014.  One of APL's strengths is its handling of mathematically precise calculations and the '''large size''' of the multi-precision source code library reinforces that.
# [http://msinttypes.googlecode.com/svn/trunk/stdint.h STDINT.H] header file installed in the MS Visual Studio 2013 include directory (V:\VC\include -- see below)
# '''SubVersion Control program''':  [http://tortoisesvn.net/downloads Tortoise SVN] (Current version, 32- or 64-bit depending upon your OS)
# '''Doctor Dump SDK''':  [https://drdump.com/public/DoctorDumpSDK/DoctorDumpSDK.zip Doctor Dump SDK] - e.g. DoctorDumpSDK.zip.
# '''File Differencing/Merge program''':  [http://winmerge.org/ WinMerge] ('''Latest stable version''', usually downloads to something like WinMerge-k.m.n-Setup.exe where k, m and n are version/sub-version numbers.)


==Install Tools==
==Install Tools==


To install the Microsoft Visual Studio 2008 Express C compiler, run the '''vcsetup.exe''' program.  Afterwards, the files '''msobj80.dll''', '''mspdb80.dll''', '''mspdbcore.dll''', and '''mspdbsrv.exe''' all need to be copied from '''V:\Common7\IDE''' to '''V:\VC\bin''', where the '''V''' drive is a substitute for '''C:\Program Files\Microsoft Visual Studio 9.0'''.  See the discussion below on [[#Set_Up_Makefile_Environment_Variables|Set Up Makefile Environment Variables]].
'''Preface''', Convention: '''x86''' generally refers to '''32-bit''' software installations while 64 (or blank) represents 64-bit software installations on a Windows OS machine.  NARS works on '''both''' 32-bit and 64-bit systems, but you should decide '''in advance''' which type of install you want 64 vs. 32-bit - ditto for all tool installs.  Installation examples:
# C:\Program Files (x86)\ &nbsp; &nbsp; &nbsp; &nbsp;Represents 32-bit software program installation, normal folder location.
# C:\Program Files\ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Represents 64-bit software program installation, normal folder location.
Also, '''both''' folder locations just above frequently and even always exist on most machines, but for consistency and integration purposes the software should be 32 '''<u>or</u>''' 64-bit.  Most people choose 64-bit installs if their Windows OS supports the 64-bit architecture, with 32-bit available for backward software compatibility in conjunction with less current systems.  If you don't know which architecture your system uses, go to the Control Panel, System Information.  Downloads usually get placed into a Downloads folder.  Several of the unzipped NARS tools get placed directly into the C:\NARS2000 folder, see individual tools for exact locations.<br><br>
 
To install the Microsoft '''Visual Studio 2013 Express C compiler''', see Downloads(<u>detail</u>, #1 above).  Visual C++ 2013 usually installs into something like, "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe" (64-bit loc) and you may want to place a '''Shortcut''' to '''VCExpress.exe''' on your Desktop by right-clicking on that VCExpress.exe file in Windows Explorer and Send To - Desktop (create shortcut). (Windows 8 Users: You can also '''Pin VCExpress.exe To your Taskbar''' for quick, easy access.)  (Prior/obs. Microsoft setup routine name: run the vcsetup.exe program.) Afterwards including after drive plus folder remapping - the files '''msobj80.dll''', '''mspdb80.dll''', '''mspdbcore.dll''', and '''mspdbsrv.exe''' all need to be copied from '''V:\Common7\IDE''' to '''V:\VC\bin''', where the '''V''' drive is a substitute/mapping for '''C:\Program Files\Microsoft Visual Studio 9.0'''.  See the discussion below on [[#Set_Up_Makefile_Environment_Variables|Set Up Makefile Environment Variables]].


To install the Parser Generator (Bison), see the instructions above.  When the Cygwin setup program asks you to choose a '''Default Text File Type''', choose '''DOS/text''' so any committed files are the same as in the version control repository.
To install the Parser Generator (Bison), see the instructions above.  When the Cygwin setup program asks you to choose a '''Default Text File Type''', choose '''DOS/text''' so any committed files are the same as in the version control repository.


To install the Doctor Dump SDK, unzip it in any directory at or above %NARSROOT%.  See the discussion below on [[#Set_Up_Makefile_Environment_Variables|Set Up Makefile Environment Variables]].
To install Doctor Dump SDK, unzip it in a directory at or above %NARSROOT%, this usually means unzipping into folder C:\DoctorDumpSDK.  See also discussion below on [[#Set_Up_Makefile_Environment_Variables|Set Up Makefile Environment Variables]].


Install the rest of the tools as per their separate instructions.
Install the rest of the tools as per their instructions above, in the Downloads section.


==Install The Source Code==
==Install The Source Code==


<ol>
<ol>
   <li>First create a '''root folder''' somewhere on one of your hard drives, perhaps calling it '''NARS2000''', as in '''C:\NARS2000''' or perhaps at some lower level.  The source code and external libraries are installed at or below this level.</li>
   <li>First create a NARS2000 '''root folder''' somewhere on one of your hard drives, perhaps calling it '''NARS2000''', as in '''C:\NARS2000''' (most common) or perhaps at some lower level.  The source code and external libraries are typically installed at or into this level, e.g. qdebug.zip into C:\NARS2000 as C:\NARS2000\qdebug.</li>
   <li>Under the root folder make two folders:  '''trunk''' and '''msieve'''.  The first folder holds the main body of code.  The latter is used for the code used to factor numbers.</li>
   <li>Under the root folder make three folders:  '''trunk''', '''msieve''', and '''branches'''.  The first folder ('''trunk''') will hold the main body of NARS/APL built exe interpreter '''source''' code.  The second ('''msieve''') will be utilized for code used to '''factor numbers''', and the third ('''branches''') will contain individual developer branches of the main code not as yet ready for release, but made public for other developers to see.</li>
   <li>Using a Version Control program such as '''TortoiseSVN''', download the source code (see [[#Check_Out_The_Source_Code|Check Out The Source Code]]),</li>
   <li>Using a Version Control program such as '''TortoiseSVN''', download-checkout the source code (see [[#Check_Out_The_Source_Code|Check Out The Source Code]]),</li>
   <li>Download the '''misc.zip''', '''qdebug.zip''', '''gsldir.zip''', and '''mplibs.zip''' files into the root folder and unzip them using '''7z.exe''' as in '''7z x misc.zip''', '''7z x qdebug.zip''', '''7z x gsldir.zip''', and '''7z x mplibs.zip'''.</li>
   <li>Download the '''misc.zip''', '''qdebug.zip''', '''gsldir.zip''', and '''mplibs.zip''' files into the root folder and unzip them (directly into that root folder, e.g. C:\NARS2000) using e.g. '''7z.exe''' (unzip/extract program used) as in '''7z x misc.zip''', '''7z x qdebug.zip''', '''7z x gsldir.zip''', and '''7z x mplibs.zip''' - or double-click on those downloaded zip file names using Windows File Explorer and Extract All (again typically directly into NARS root folder previously set up).</li>
</ol>
</ol>


==Check Out The Source Code==
==Check Out The Source Code==


An easy way to initialize your copy of the source code for the first time is to use a version control program such as '''TortoiseSVN''' mentioned above.  After installing this program, there are two directories you'll need to install.
An easy way to initialize your copy of the source code for the first time, although it may initially appear cumbersome to an SVN newcomer, is to use a version control program such as TortoiseSVN, mentioned above.  One very helpful feature of TortoiseSVN is that it integrates well with Windows File Explorer.  After downloading and installing TortoiseSVN and then rebooting your PC, there are two directories you will need to Install/initialize-checkout/TortoiseSVN-on.
* First, bring up Windows Explorer, right-click on the '''trunk''' folder, and choose '''SVN Checkout...'''.  The '''URL of repository:''' is '''https://nars2000.googlecode.com/svn/trunk''' and the '''Checkout directory:''' is '''C:\NARS2000\trunk''' (or wherever your '''trunk''' folder is) &mdash; quite likely you will have to edit this field as the default text inserted by TortoiseSVN usually ends with '''NARS2000'''.
# '''First''' bring up Windows Explorer, right-click on the '''trunk''' folder you manually created, and choose '''SVN Checkout'''.
* Second, bring up Windows Explorer, right-click on the '''msieve''' folder, and choose '''SVN Checkout...'''.  The '''URL of repository:''' is '''https://nars2000.googlecode.com/svn/msieve''' and the '''Checkout directory:''' is '''C:\NARS2000\msieve''' (or wherever your '''msieve''' folder is)
## If you do not see "SVN Checkout" when you right-click on the '''trunk''' folder, download '''Tortoise SVN''' per the '''Tortoise SVN link above'''([[#Downloads|Downloads-NARS2000 Source Code-Tortoise SVN]].  The online NARS SourceForge URL of source code repository: is '''svn://svn.code.sf.net/p/nars2000/code/trunk''' and your local Checkout directory: is '''C:\NARS2000\trunk''' (or wherever your trunk folder is) - quite likely you will have to edit the TortoiseSVN repository field or program local folder field because default text inserted by TortoiseSVN usually does not match folder location(s) identically.  Depth should show Fully recursive, the default.
## To begin source code downloading/checkout into your locally created '''trunk''' folder click the '''OK''' button. Code downloading/checkout should then begin. With a high-speed Internet connection, time required to TortoiseSVN download/checkout NARS code is on the order of roughly two minutes.  When successfully complete, you should get a return message at the end of the downloads list, like '''Completed at revision nnnn'''.
# '''Second''' (and this is a similar repeat step but using folder '''msieve''' instead of trunk), bring up Windows Explorer, right-click on the '''msieve''' folder you likewise manually created - and choose '''SVN Checkout...'''.  This time online NARS '''URL of repository:''' is '''svn://svn.code.sf.net/p/nars2000/code/msieve''' (this address is slightly different than step 1) and your local '''Checkout directory:''' is '''C:\NARS2000\msieve''' (or wherever your '''msieve''' folder is).  Again, depth should be fully recursive and click the '''OK''' button to begin.  This step two normally completes in under five seconds, downloading far fewer files than the trunk download.  Normally, the <u>same</u> msieve <u>revision</u> number should appear after finishing this download as per trunk download in step 1.


In both cases, the '''Checkout Depth''' should be '''Fully recursive'''. Click on '''OK''' to initialize your copy of the source code.
The above '''two''' steps/distinct-folders need be initialized this first checkout time through - in order to establish the special hidden SVN directories for subversion "synching" between your local source code and NARS online code repository. As a brief check that your '''local''' NARS source code files match NARS, there should be green check marks on folders trunk and msieve on your PC, placed there by TortoiseSVN. [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-wcstatus.html  TortoiseSVN Status Information.]


The above steps need be done only once in order to establish the special hidden SVN directories.
You will still or now need to download and unzip '''qdebug.zip''', '''misc.zip''', '''gsldir.zip''', and '''mplibs.zip''' as described above.


You will still need to download and unzip '''qdebug.zip''', '''misc.zip''', '''gsldir.zip''', and '''mplibs.zip''' as described above.
Subsequently, you may quickly and easily update your local copy of NARS source code by right-clicking on the '''trunk''' and/or '''msieve''' folders and choose '''SVN Update'''.  One useful feature of sub-versioning programs such as TortoiseSVN is that only '''changed files''' from the online latest official version will need to be subsequently downloaded as changes are made in futuro, re subsequent NARS revisions.


Subsequently, you may update your copy of the source code by right-clicking on the '''trunk''' and/or '''msieve''' folders and choose '''SVN Update'''.
Since you may be unfamiliar with the download process your first time through, it make take slightly longer; however, the second or third time you <u>Check Out The Source Code</u>, over time, the entire "update to most current NARS source code revision" process will probably take under 3 to 5 minutes total, depending however on your (high-speed) Internet service provider's(ISP) download speed.


==Folders==
==Folders==


After unzipping the above files, the structure under the root folder should look something like the following where some of the lower level directories have been omitted:
After unzipping the above files, the structure under the '''NARS2000 root folder''' should look very much like the following('''leftmost column'''), where lower level sub-directories and individual sub-folder file names have been omitted:
<pre>
{|class="wikitable"| style="width: 40%; border:1px dotted blue;"
branches\
!<u>'''NARS2000''' SubFolder:</u>
ecm\
! <u>Downloaded Zip '''Source''' File or Checkout Process:</u>
gsl\
|-
mpfr\
| branches\
mpir\
| class="Unicode" style="text-align:center;" | Created manually(1)
msieve\
|-
qdebug\
| ecm\
trunk\
| class="Unicode" style="text-align:center;" | '''mplibs'''.zip
trunk\binaries\
|-
trunk\Extensions\
| gsl\
trunk\htdocs\
| class="Unicode" style="text-align:center;" | '''gsldir'''.zip
trunk\images\
|-
trunk\MediaWiki\
| mpfr\
trunk\ReleaseNotes\
| class="Unicode" style="text-align:center;" | '''mplibs'''.zip
trunk\WineHQ\
|-
</pre>
| mpir\
| class="Unicode" style="text-align:center;" | '''mplibs'''.zip
|-
| msieve\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''msieve'''
|-
| qdebug\
| class="Unicode" style="text-align:center;" | '''qdebug'''.zip
|-
| trunk\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''trunk'''
|-
| trunk\binaries\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''trunk'''
|-
| trunk\Extensions\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''trunk'''
|-
| trunk\htdocs\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''trunk'''
|-
| trunk\images\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''trunk'''
|-
| trunk\MediaWiki\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''trunk'''
|-
| trunk\ReleaseNotes\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''trunk'''
|-
| trunk\WineHQ\
| class="Unicode" style="text-align:center;" | TortoiseSVN Checkout '''trunk'''
|-
|}
(1) Subfolder '''\branches''' should be '''created manually''' (e.g. Windows Explorer, right-click, New, Folder).  It is used to hold subprojects you may develop.  For example if your name is Bill Gates, you might have the following subfolders, each representing a NARS subproject:<br>
C:\NARS2000\branches\bgates\NARS_Spreadsheets<br>
C:\NARS2000\branches\bgates\NARS_WordProcPlusAPLEdits<br>
C:\NARS2000\branches\bgates\EZMenus<br>
C:\NARS2000\branches\bgates\Graphics<br>


==Choose How To Build==
==Choose How To Build==
Line 107: Line 196:
==Set Up VC++ Express==
==Set Up VC++ Express==


If you are using VC++ Express, the project file is in the '''trunk''' folder and is called '''NARS2000.vcproj'''.  You may load it manually every time you invoke VC++ Express, or you may load it automatically by placing the path to the project file on the command line in the VC++ Express shortcut as in '''"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe" C:\NARS2000\trunk\NARS2000.vcproj''' or wherever you defined your NARS2000 root folder.
If you are using Visual Studio 2013/VC++ Express, the project file is in the '''trunk''' folder and is called '''NARS2000.vcproj'''.  You may load it manually every time you invoke VC++ Express, or you may load it automatically by placing the path to the project file on the command line in the VC++ Express shortcut as in '''"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe" C:\NARS2000\trunk\NARS2000.vcproj''' or wherever you defined your NARS2000 root folder.


The vast majority of the project settings are found in the above file with some exceptions.
The vast majority of the project settings are found in the above file with some exceptions.
Line 115: Line 204:
<hr width=25%>
<hr width=25%>
'''Windows 8''': Setting up Environment and Path Variable(s):
'''Windows 8''': Setting up Environment and Path Variable(s):
Under Settings, Control Panel, System and Security, System, Advanced System Settings, Advanced (Tab),
Under Settings, Control Panel, System and Security, System, Advanced System Settings, Advanced (Tab) '''or''' in Control Panel <u>Search</u> for '''Environment Variables''',
* Click '''Environment Variables''' button - There is both a '''Temp Variable''' and '''Path Variable'''.
* Click '''Environment Variables''' button - There is both a '''Temp Variable''' and '''Path Variable'''.
* Try adding a '''New''' variable (var Name plus Value) for each of the '''Set''' commands listed below, vars such as NARSROOT, CS_DIR, ZIPPRG, . . .
:: There are 2 sections, User Account Variables and System Variables.  You normally want to add new '''System Variables'''.
::: Click '''[New]''' button for a <u>New</u> System Variable:
:::: Variable name &nbsp; &nbsp; &nbsp; '''PARGEN'''
:::: Variable value &nbsp; &nbsp; &nbsp; '''C:\cygwin64\bin\bison''' &nbsp; &nbsp; &nbsp; << typical for a 64 bit install(for bison.exe in subfolder bin), for 32 bits installs see below for variable '''set''' values.
* Normally add a '''New''' variable (var Name plus Value) for each of the '''eight Set''' vars commands listed below, 8 environment variable names - such as NARSROOT, CS_DIR, ZIPPRG, PARGEN, etc.
* If you need to add another Path to an existing variable, each new or added path is separated with a semi-colon.
* If you need to add another Path to an existing variable, each new or added path is separated with a semi-colon.
* After updating any Environment/Path variable(s) you apparently need to reboot since the above variable changes only affect changes in the Registry until PC is rebooted.
* After updating any Environment/Path variable(s) you apparently need to reboot since the above variable changes only affect changes in the Registry until PC is rebooted.
* The instructions below should also or alternatively work.
* The instructions below should also or alternatively work.
<hr width=25%>
<hr width=25%>
If you are building from the '''makefile''', you'll need to set some environment variables in your '''autoexec.bat''' file:
If you are building from the '''makefile''' or working with the GUI C++ Compiler, you'll need to set '''eight environment variables''' in your '''autoexec.bat''' file ('''or''' see just above for setting Environment Variables via '''Windows Control Panel'''). Note that ''Environment variable #n's'' just below are shown only for helpful reference purposes.
 
<pre>
<pre>REM Path of the root of the NARS2000 project *ending with a backslash*
REM Path of the root of the NARS2000 project *ending with a backslash*
Set NARSROOT=C:\NARS2000^\
Set NARSROOT=C:\NARS2000^\ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Environment variable #1


REM Path to Doctor Dump SDK root
REM Path to Doctor Dump SDK root
Set CS_DIR=C:\DoctorDumpSDK^\
Set CS_DIR=C:\DoctorDumpSDK^\ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Environment variable #2


REM Path and name of zip program (7-Zip)
REM Path and name of zip program (7-Zip)
Set ZIPPRG="C:\Program Files\7-Zip\7z"
Set ZIPPRG="C:\Program Files\7-Zip\7z" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Environment variable #3


REM Path and name of parser generator (bison)
REM Path and name of parser generator (bison) &nbsp; &nbsp; &nbsp;Environment variable #4 (next line)
Set PARGEN=C:\Cygwin\bin\bison
Set PARGEN=C:\Cygwin\bin\bison &nbsp; &nbsp; &nbsp; &nbsp; OR for a 64-bit install >> &nbsp; Set PARGEN=C:\cygwin64\bin\bison


REM Path and name of makedep program
REM Path and name of makedep program
Set MAKEDEP=%NARSROOT%makedep.php
Set MAKEDEP=%NARSROOT%makedep.php &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; Environment variable #5


REM Path and name of the <makepro.php> program
REM Path and name of the <makepro.php> program
Set MAKEPRO=%NARSROOT%makepro.php
Set MAKEPRO=%NARSROOT%makepro.php &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Environment variable #6


REM Folder of SDK ("C:\Program Files\Microsoft SDKs\Windows\v7.0A")
REM Folder of SDK ("C:\Program Files\Microsoft SDKs\Windows\v7.0A")
Set SDK=U:^\
Set SDK=U:^\ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Environment variable #7


REM MSVC compiler ("C:\Program Files\Microsoft Visual Studio 9.0")
REM MSVC compiler ("C:\Program Files\Microsoft Visual Studio 9.0")
Set MSVC=V:\VC^\
Set MSVC=V:\VC^\ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Environment variable #8
</pre>
</pre>
<hr width="75%">
<u>'''Mapping Virtual Drive Letters:'''</u><br>
You will be using Windows '''subst''' command to map drive letters as references to drives '''U:''' and '''V:''' that several of the above '''environment variables''' refer to.  Microsoft explanation of <span class="plainlinks">'''[https://technet.microsoft.com/en-us/library/bb491006.aspx subst command here]'''.</span><br>
Modify your C:\AutoExec.bat file to include something approximating the following highlighted text(version#/32/64 bit installs each vary), '''include''' the enclosing quote chars just below:<br><br>
'''subst U: "C:\Program Files\Microsoft SDKs\Windows\v7.0A"''' &nbsp; &nbsp; &nbsp;(or whatever your current version is)<br>
'''subst V: "C:\Program Files\Microsoft Visual Studio 9.0"''' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (ditto re version  9.0=Visual Studio 2008)
<br><br>
If you do <u>not have</u> an '''AutoExec.bat''' file (many '''Windows 7 and 8''' users may not):
: Create a <u>new text document</u> using Windows File Explorer, rename it as AutoExec.bat and move(or copy) it to the '''C:\''' drive folder '''with the above two subst''' commands in it.
: Windows 7 and 8 users: File AutoExec.bat no longer automatically gets run at system-user boot-up so '''place a Shortcut to AutoExec.bat''' in the Program files '''Startup''' folder location(navigate Windows File Explorer to '''one''' of the below locations, right-click, '''New''', '''Shortcut''', '''AutoExec.bat''').  The Windows 7/8 Startup Folder usually is located as follows:
:: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (general/all users Startup folder) '''OR'''
:: C:\Users\'''UserName'''\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup &nbsp; &nbsp; &nbsp; (single user Startup folder, '''UserName varies''')
'''IMPORTANT''': A successfully mapped '''V''' drive should contain a sub-sub-subfolder which then contains the '''amd64\nmake.exe''' (64-bit systems) file or '''bin\nmake.exe''' (32-bit systems), e.g. '''typical''' 64-bit configuration/location:<br>'''C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\nmake.exe'''.
:The V drive map would '''only''' include linking through subfolder '''\Visual Studio 9.0'''.  After creating the linked drives, just '''check''' to make sure your mapped '''V''' drive has the '''nmake.exe''' contained one or several subfolder levels below it. The NARS2000.exe automated Compile/Build uses '''nmake.exe''' during exe construction.  64-bit installs require the '''amd64\nmake.exe''' file - paradoxically even if your machine's chipset is Intel, a minor Microsoft variation.<br><br>
Typical mapped configurations just below, but again each install/version# may vary:<br>
'''U''' = &nbsp; &nbsp; '''C:\Program Files\Microsoft SDKs\Windows\v7.0A''' &nbsp; &nbsp; (or v6.0A or whatever your downloaded/current version is)<br>
'''V''' = &nbsp; &nbsp; '''C:\Program Files\Microsoft Visual Studio 9.0''' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (or '''C:\Program Files (x86)\Microsoft Studio 9.0''' for 64-bit installs, again look for nmake.exe in a subfolder)<br>
As a '''check''' to make sure the '''subst''' commands worked, there should now be '''2 new drive letters visible in Windows Explorer, in the leftmost window for virtual drives/mapped folders - U and V'''.  ''To avoid having to reboot'' at present, just '''open'''(not edit but run) '''AutoExec.bat AFTER''' making sure it is 100% correctly configured.  Having a correctly configured AutoExec.bat file will ensure not having to manually link drives U and V each time the NARS2000.exe is built-rebuilt.
<hr width="40%">
If you install NARS project tools in other folders, make appropriate changes to the above mappings.
'''Lastly don't forget:''' To append three folders: '''C:\cygwin64\bin''' , '''V:\Common7\IDE''' and '''C:\PHP''' to your '''Path''' variable '''PATH=%PATH%;C:\cygwin64\bin;V:\Common7\IDE;C:\PHP''' or see '''Control Panel''' search for '''Path''', then '''Edit''' System Environment Variables for your account, system variable named '''Path'''; append to that '''Path''' variable &nbsp; ''';C:\cygwin64\bin;V:\Common7\IDE;C:\PHP''' &nbsp; - (three additional paths, semicolon separated) so Visual C's '''Make''' plus '''Compiler''' can find DLLs, exe's and Tools you have so diligently downloaded, then installed.


I find it convenient to use the Windows '''subst''' command to map drive letters as in the references to drives '''U:''' and '''V:''' above.
==Pre First Compile and Localization Notes==


<pre>subst U: "C:\Program Files\Microsoft SDKs\Windows\v7.0A" (or whatever the current version is)
Make/Compile local Environment Variable '''%NARSROOT%''' is presently set using file '''C:\NARS2000\trunk\wcustomize.bat'''.  This bat file is called by other major trigger-compile bat files such as mk32.bat, mk64.bat, w32.bat and w64.bat - which oversee-initiate compilation.  The %NARSROOT% environment variable is important in indicating <u>where</u> Make/Compilation will occur. <u>Before</u> first locally compiling NARS2000, you likely need to manually edit (using Notepad or a local text file editor) file <u>'''trunk\wcustomize.bat'''</u> and make sure the following are initially correct per your 'local PC NARS installation' i.e. within wcustomize.bat:<br>
subst V: "C:\Program Files\Microsoft Visual Studio 9.0" (...)
'''Set NARSROOT=C:\NARS2000^\''' &nbsp; &nbsp; &nbsp; (Note: '''No %''' symbols are needed in <u>set/specification</u> rows in wcustomize.bat, e.g. replace 'R:\NARS2000' to 'C:\NARS2000' as shown at left)<br>
</pre>
'''Set CS_DIR=C:\DoctorDumpSDK^\''' &nbsp; &nbsp; (again R:\ was changed to C:\)<br>
The additional hat(^) symbol in the above bat commands is needed for directory/folder recombination purposes, essentially sub-directory parse-point identification and or recombination point, where NARS may use subdirectories/parsing.


If you install the above tools in other folders, make the appropriate changes to the above lines.
'''Prior''' to using '''Visual Studio''' and its '''IDE'''(integrated developer's environment) for NARS Building/Compilation purposes a first time, and to help ensure the proper installation of NARS source code - it is very helpful/necessary to open a CMD.EXE window using <big>'''Windows Start''', '''CMD.EXE'''</big>.  This will open up a small CMD window.  While <big>inside the opened CMD.EXE window</big>, navigate to your local C:\NARS2000\trunk folder, using <big>'''cd C:\NARS2000\trunk'''</big> where cd represents change directory.  Now run <big>'''mk32.bat'''</big> by typing it in, to compile NARS2000's 32-bit executable.  If mk32.bat is successful and if your installation is 100% correct, two identical files in separate folders will be created(built and compiled) using bat commands from inside that CMD window/session:<br>
'''C:\NARS2000\trunk\RET\ND32\NARS2000.exe'''<br>
'''C:\NARS2000\trunk\binaries\ND32\NARS2000.exe'''<br><br>
If that 32-bit NARS make/build was successful, then from the same CMD.EXE window, type <big>'''mk64.bat'''</big>. This should likewise compile locally the '''64-bit''' NARS Executable, with again two resulting '''exe output files:'''<br>
'''C:\NARS2000\trunk\RET\ND64\NARS2000.exe'''<br>
'''C:\NARS2000\trunk\binaries\ND64\NARS2000.exe'''


You will also have to append the folders '''C:\Cygwin\bin''' and '''V:\Common7\IDE''' to your path ('''PATH=%PATH%;C:\Cygwin\bin;V:\Common7\IDE''') so the C compiler can find some of its DLLs and tools.
Successfully completing mk32.bat and mk64.bat along with presence of their respective '''NARS2000.exe''' output files generally confirm successful installation of NARS source code, as well as correct installation for several associated tandem utility tools re compiling NARS2000.exe on your server, PC, notebook or tablet computer.


==Building The Executable==
==Building The Executable==


At this point you should be ready to build the executable.  To do this from VC++ Express (having already opened the project file), click on the menu item '''Build | Build Solution''' or press '''F7'''.  To do this from a '''makefile''', type '''mkn'''.
Congratulations, if you've successfully arrived at this section, your resume now includes such useful terms as software installation wizard and relentless software engineering candidate.  You are part of an elite group - the few, the proud, NARS geek marines; also known as tomorrow's APL-symbol-set event-horizon squad.  You've managed to easily or otherwise cross several potentially deep programming ravines in the process.
 
At this point you should be ready to build the executable, again - this time however from inside Visual Studio's IDE(integrated developer's environment).  There are two general ways to build NARS executable.  Method one: Involves the time-honored command-line batch file compile mode using files mk32.bat or mk64.bat - as you should have previously discovered in the section '''[[#Pre_First_Compile_and_Localization_Notes|Pre First Compile and Localization Notes]]''' while using Windows CMD.EXE.
 
Method two: Involves again first opening a (Windows Start button) '''CMD.EXE''' window and running '''w32.bat start''' (all one command) or '''w64.bat start'''.  Immediately or shortly, you should see Visual Studio 2013's program visualize, load and run - with either the 32-bit or 64-bit NARS2000 project/program loaded.  After Visual Studio 2013 finishes loading - simply click Build.  Full use of Visual Studio 2013's IDE (integrated developer's environment) should now be available for you to experiment with, develop code on, debug and customize APL as you may choose.  Your first time through with running '''w32.bat start''' and '''w64.bat start''':
* There is usually a Visual Studio '''One Way Migration''' message which displays.  This is normal, TBE(to be expected), and yes you DO at that point want to migrate the NARS2000 project to Visual Studio 2013.  There are usually roughly 20 migration warnings which also show up in an Internet Browser page re the Migration Report - again, all normally to be expected.  However, there should be '''<u>zero errors</u>''' in the migration report.
* If all went satisfactorily well with the Migration, you should be able to select/choose/Click '''Build Solution''' under Build in VS2013's IDE to fully compile NARS2000 executable.  After Build, there should likewise be zero errors.
 
Special note regarding '''w32.bat start''' and '''w64.bat start''' while in Visual Studio's IDE for the NARS2000 project:
When <u>switching</u> between 32 and 64-bit versions, i.e. w32.bat start '''versus''' w64.bat start: There is a '''Property''' adjustment required when using Visual Studio's IDE.  After Visual Studio opens up and in the Solution Explorer window (usually on the upper right hand side of your screen) click on "Solution 'nars2000' (1 project)."  This should then show a Properties Window just below it.  Look for a line which reads: '''Active config'''.  If you ran w32.bat start then Active config should have a value of '''Debug32|Win32'''.  If you ran w64.bat start then Active config should have a value of '''Debug64|Win32'''.
 
== NARS Systems Developer Suggested Knowledge Prequisites ==
 
For a strongly recommended set of knowledge prerequisites - in order to effectively understand, maintain or improve NARS functionality - please see '''[[NARS System Developer Suggested Knowledge Prerequisites|NARS System Developer Suggested Knowledge Prerequisites]]'''.
 
==Developer Experiments with NARS Source Code==
 
This section is for Developers who have successfully downloaded NARS source code and want to Experiment with it, or further develop NARS APL Interpreter's source code.
 
For development and debugging purposes: You as APL Interpreter developer normally want to want to <u>first</u> write new source code/model using the <u>32-bit version</u> of NARS2000 (w32.bat start).  This is because the 32-bit version is easier to debug than the 64-bit version; error messages can be less complexMigrating '''correct source code''' forward from the 32-bit version to the 64-bit version is also easier than a reverse migration.
 
You will also at some point still need to be synched-with or later synch-back-to NARS online source code - i.e. after experimenting/changing local PC source code.  This is equivalent to a ChemLab 101 at home/home-office and cleaning up all experiments at the end of the chemistry class, except as it applies to software developers, NARS software developers, and or those inclined to experiment safely.
 
Here is where Tortoise SVN provides excellent and time-tested source-code clean-up tools for your local PC, including '''Resolve, Revert, Clean up, and Undo changes'''.  Pull up these TortoiseSVN utilities by navigating Windows File Explorer to directory C:\NARS2000.  If you successfully previously downloaded and Installed TortoiseSVN and NARS2000 source code, as outlined earlier/above, you may right click on say the \trunk subfolder in C:\NARS2000.  A mouse right-click on \trunk should show an option labeled TortoiseSVN.  Further choosing/selecting TortoiseSVN should then reveal multiple clean up options - Resolve, Revert, Clean up and Undo changes.<br>'''TortoiseSVN Documentation on:'''<br>[http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-cleanup.html Clean up.]<br>[http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-revert.html Undo Changes.]<br>[http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-conflicts.html Resolving Conflicts.]<br>
 
At least one method to safely synch-back-to NARS is to:
# Select '''TortoiseSVN''' after right-clicking on the trunk folder
# Select '''Revert''', click '''OK''', let it run.
# Select '''Clean up''', check '''Refresh shell overlays''', click '''OK''', let it run.
Per TortoiseSVN there should again be green check marks appearing on your trunk folder as well as your msieve folder.
 
For revision tracking and long-term software program maintenance purposes: '''Keep track of which files (file names) you personally modify, including a brief purpose''' for that edit.  You will need to this information later for Release Notes purposes (see folder C:\NARS2000\trunk\ReleaseNotes for best-practice-examples of developer note-taking) and if you later synch to a new online NARS version, you may have to carry-forward your edit changes into a newly downloaded set of NARS source code files which may or may not reflect your prior local computer edit changes.
 
==Periodic NARS Updates==
 
<u>Incremental Update</u> - Method 1:<br>
Periodically, NARS APL interpreter developers should ensure changes done by other developers get incorporated into their local machine's source code working copy. This is the process of integrating/downloading changes from NARS SourceForge server '''<u>to</u>''' your local copy. Updating may be performed on single files, a set of selected files, or recursively on entire directory hierarchies. To update, select the files and/or '''directories''' you want (usually \trunk and or \msieve), right click and select '''TortoiseSVN → Update''' in the explorer context menu for that trunk or msieve folder. A window will pop up displaying the progress of the update as it runs. Changes done by other developers will be merged into your local files, '''keeping''' any changes you may have done to the same files - if you did not want to keep your local changes but do want to keep the downloaded changes, select TortoiseSVN and Revert '''prior''' to running TortoiseSVN Update. NARS repository at SourceForge is '''not''' affected by an update to your local copy. [http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-update.html Update Your Working Copy With Changes From Others]
 
<u>Total Source Code Replacement</u> - Method 2:<br>
For example from version r1325 to say version r1364 (note a significant revision/datetime gap between 1325 and 1364, hypothetically), whatever NARS latest revision number is.  Total code replacement may be preferred over incremental updating when major structural changes or significant source code changes are newly in situ.<br><br>
Total Replacement Process: Visually scan NARS source code page at http://sourceforge.net/p/nars2000/code/HEAD/tree/trunk/ and review the top 25 to 40 file entries or so, while mentally keeping track of the '''highest revision number found'''(e.g. r1379). If after your last/earlier TortoiseSVN Update, your local version number is lower than the latest revision number visually found online, then perform the following to update to the most recent NARS revision:
# Rename your existing NARS folder to something approximating C:\NARS2000_old_rev
# Create an entirely new C:\NARS2000 folder
# '''Copy all folders and files at the <u>top level</u>''' from C:\NARS2000_old_rev folder into C:\NARS2000 '''EXCEPT \trunk and \msieve subfolders (and their contents)'''.  The \trunk and \msieve folders will shortly be downloaded from SourceForge.
# Create '''new empty folders called \trunk and \msieve''' in the new C:\NARS2000 folder.
# Revisit the section above called '''[[#Check_Out_The_Source_Code|Check Out The Source Code]]''' to again checkout/download to the absolute latest NARS version number, for both \trunk and \msieve folders.
# Also revisit '''[[#Pre_First_Compile_and_Localization_Notes|Pre First Compile and Localization Notes]]''' and text edit file \trunk\wcustomize.bat to localize the new version.
# Folder C:\NARS2000_old_rev may be '''Recycled''' after you are done copying non-trunk and non-msieve files/folders from it into your new C:\NARS2000 folder.  If disk space is not restrictive and for 100% safety purposes, keep your prior folder available until after successfully '''Building/Compiling''' the newly downloaded 32-bit and 64-bit versions, and making sure you did not have any local personal changes now potentially being recycled.
 
[[Category:NARS 2000]]

Latest revision as of 17:09, 13 October 2019

Update Notice

Although it is not the "ONLY compiler - IDE (integrated developer's environment) choice", the below uses Visual Studio 2013 as its designated C/C++ Compiler and IDE(Integrated Developer's Environment, GUI/Graphical User Interface for programming). All source code compiles correctly and multiple APL workspaces have been tested for correct APL/NARS functionality. This page is current, up-to-date re NARS working with VS2013's compiler and standards. The conversion to VS2013 resulted in a more up-to-date (5 years[2008 to 2013] more current software technology) program for the GUI Builder and Compiler interface, including newer C/C++ programming standards. This has represented a major cyclical software upgrade and results in greater APL user functionality via improved C coding. Recent releases of NARS2000.exe (32 and 64-bit versions) are fully functional.

Why Build Your Own

First of all, you do not have to build your own. NARS has already created a great existing Nested Arrays Research System APL interpreter. NARS2000.exe is freely available at NARS Downloads. Downloads includes Beta releases for APLers so inclined.

On the other hand, why not expand your programming/software and computer skill horizons? Many people think and believe Kenneth Iverson's work remains that of a true genius, a bright light among some very bright intellectual lights, both from a theoretical as well as a software implementation perspective. Here's your opportunity to attempt to improve upon some very substantive, preexisting software development work - to further it, to make it even better, and perhaps best of all - it's free.

Personalize some already pretty amazing software for yourself, or share it with others and get their feedback for even greater insight and subsequent improvement. NARS version of APL already has over a quarter million lines of source code, subroutines, macros, functions, etc. - 50 years of sometimes intense and continuing evolution, so you are not creating something from undeveloped scratch, but inheriting and working from already highly evolved, rigidly disciplined concepts and rigorously debugged software over time.

APL/2 has been used in physics, science, genetic engineering-DNA studies, advanced mathematics, robotics, engineering, artificial intelligence, image processing, bio-medicine, VLSI, financial, statistical and social science applications. NASA and Astronomers have used APL.

Now APL/2 is 100% customizable. Perhaps you will be the first to customize APL to safely drive a vehicle, help save a life, make new discoveries or make some process(es) more efficient.

It's free. It's evolved. Once you start examining NARS/APL/APL2 source code you'll find it is comprehensive, elegant, process-symbol-efficient, focused toward the end-user, evolved over some fifty years of use, structurally enigmatic, tirelessly debugged and rich with coding techniques - a great learning tool, even if absolutely nothing else - and NARS believes it is far, far better than just a learning tool. You'll learn about Bison Parsing, how it helps define compilers and interpreters. Further, NARS is a tremendous opportunity to learn more about the human-machine interface; how machine hardware operates and - better understand how software and hardware interact together.

One of the stellar, intellectually expansive aspects of APL/2 is - how fully the language embraces the breadth of hardware functionality. This includes instructions running core processor chip(s) and peripheral devices. This is not your grandparents' punch-card software program run on a room-sized computer, although that was marvelous at its time, but it may have taken him/her several days to get results back for in an introductory chemistry or math lab course. Today data structures influence speed of quantum search in unexpected ways.

Platforms

The current version of NARS2000 may be run and built on a variety of Windows platforms, including most or all post-Windows-98 OS versions. Furthermore, a long-term goal is to enable NARS to be built on Linux, Mac OS, etc. as per user requests and Developer interests. If you do not have a Windows machine, the following may be helpful to you:

Five ways to run Windows software on a Mac. From HowToGeek.com, methods include 1)Virtual Machines, 2)Boot Camp, 3)Wine, 4)CrossOver Mac (not free) and 5)Remote Desktop.

Four ways to run Windows software on Linux. Again from HowToGeek.com, methods include 1)Use Wine, 2)Run Windows in a Virtual Machine, 3)Try Crossover (not free) and 4)Remote Desktop. A fifth way per PC World is dual booting both Linux and Windows on your machine. This essentially involves partitioning hard drives with a portion reserved for Linux and a portion reserved for Windows. With costs of external hard drives continuing to decline, buying an external or network hard drive may free up hard drive storage space requirements.

How to Run Windows Software on a Chromebook {notebook or tablet PC}. Again from HowToGeek.com, methods include 1)Access a Windows Desktop Remotely, 2)Use Developer Mode and Install Wine (not available for all Chromebooks), 3)Use Developer Mode and Install a Virtual Machine (may require an Intel Chromebook).

Furthermore, if you work using a tablet or other computing device which supports remote desktop software such as Team Viewer and you have a home or work computer running Windows - then you can remotely use NARS over your network and internet using that computer as a host and your local device as a client. Network and internet speeds are sufficiently fast and TeamViewer, for instance, is very good at making your remote desktop seem and respond as if virtually right in front of you.

For the present, the following sections detail descriptions for building the executable with bias towards Windows.

Downloads

To build the executable in summary you'll need the following:

  1. C Compiler and Linker
    1. Make program
    2. Resource Compiler
    3. Windows SDK
  2. Parser Generator
  3. Zip Utility
  4. PHP (Hypertext Preprocessor)
  5. NARS2000 Source Code
  6. NARS2000 External Libraries
  7. Optionally, Multi-precision Library Source
  8. STDINT.H header file
  9. Version Control program
  10. Doctor Dump SDK
  11. Optionally, a File Differencing/Merge program


All of the tools you'll need are freely available. Some of them happen to be Microsoft-specific. Bill Gates while at Harvard actually worked a bit on/with APL, obviously he discovered the importance of working with arrays and symbolic notation. At the same time there is no reason more generic tools (such as DJGPP, Cygwin or MinGW) can't be used, a task NARS is hoping someone will volunteer to investigate. In particular, the tools currently used to create the APL Executable, in detail, are as follows:

  1. C (needed for this NARS2000 project is Visual C++ 2013 = C++ GUI development environment and compiler for the C language, which much of APL's interpreter is written in). Compiler and Linker: Microsoft Visual Studio 2013 Express for Desktop Windows (download requires a FREE Microsoft/Visual Studio account) OS requires Windows XP or later — includes Link, Make, a Resource Compiler, and an SDK (among others). Download/Installation Notes: The downloaded file may be double-clicked in Windows Explorer. VS 2013 does NOT Install to a mapped or network drive(but to something like C:\Program Files\...). It must be Installed on a local PC drive (e.g. C:\...) and unmapped directory (but you can map to it later) - Microsoft apparently requires installation to a local machine drive letter such as "C:\...".   VS2013 Desktop is free and it includes a GUI or graphical user interface (icon-based IDE or integrated developer's environment), which is geometrically easier to use than a command-line interface. Windows 8.1 SDK (does NOT require Windows 8.1, but does update for some 8.1 capabilities, especially useful for using Visual Studio 2013; download is available at Microsoft. Windows SDK (the following MAY NOT BE NECESSARY, SDK=Software Developers Kit, sometimes needed for 64-bit installations, usually choose download file GRMSDKX_EN_DVD.iso even for Intel machines) download here, with installation instructions here.
  2. Parser Generator: Bison, a Cygwin package, Save and run either setup-x86.exe (32-bit systems) or setup-x86_64.exe (64-bit systems) as appropriate to your system, Choose A Download Source: Install from Internet, Select Root Install Directory, Select Local Package Directory, Select Your Internet Connection, Choose A Download Site, Select Packages: Leave alone All (Default) - first time through, just click [Next], Devel, and bison, other dependent packages may be installed along with bison, if not then after first Cygwin installation finishes, double-click the downloaded Cygwin file in Windows Explorer, downloaded filename should be something like setup-x86_64.exe and the second time through do specifically download and install Dev, Bison - informally note the tree structure during the Bison download/install since creating parse trees is very much a Bison program specialty, a strength. Compilers and even APL itself relies heavily on correct statement type recognition and parsing. To make sure you successfully downloaded and installed bison.exe, the file should be found or reside in the C:\Cygwin\bin or C:\cygwin64\bin folder. Make note of the folder location since you will need it when setting the PARGEN environment variable shortly, below.
  3. Zip Utility: 7-Zip (Latest version, 32- or 64-bit, as appropriate to your system; needed to Extract/Unzip the files and folders you are downloading for this project.) If you already have a Zip utility program on your PC, Tablet or Server such as WinZip, you can normally skip the 7-Zip download/install.
  4. PHP (Hypertext Preprocessor): Downloads (Windows downloads for Windows systems.) (Windows binaries/VC9 x86 Thread Safe/Latest version/Zip or Installer, your choice) (Items to Install: Entire Script Executable, and entire Extras). Place the unzipped file's contents into something like "C:\PHP". The executable file "php.exe" needs to be "on your directory or environmental path" when later compiling or building the APL executable.
  5. NARS2000 Source Code: Click on Browse Code button at NARS SourceForge.net code repository.
    1. You also likely need a Version Control program for SourceForge code 'checkouts', e.g. see Tortoise SVN below and here, visit Tortoise SVN's download page, then download and install Tortoise SVN's 64-bit or 32-bit version depending on your operating system to subsequently be able to auto-check-out NARS source code.
      Prior non-current NARS Source Code versions available at Code Google.
  6. NARS2000 External Libraries: Miscellaneous Library (misc.zip, which contains 4 .php files and 1 .ttf file - all directly unzipped into C:\NARS2000) and the following NARS libraries:
    1. MPIR/MPFR/ECM Libraries - These libraries(mplibs.zip) should be directly extracted or unzipped into the C:\NARS2000 folder such that three(3) distinct sub-directories are directly created: \ecm, \mpfr and \mpir, e.g. C:\NARS2000\ecm.
    2. gsl Library - This library(gsldir.zip) should be directly un-zipped into the C:\NARS2000 folder such that it becomes C:\NARS2000\gsl. Folder structure "C:\NARS2000\gsldir\gsl" would be invalid.
    3. qdebug Library - This library(qdebug.zip) should also be directly un-zipped into the C:\NARS2000 folder such that it becomes C:\NARS2000\qdebug. Make sure it is NOT double-enclosed when unzipped, for example the following would be an invalid folder setup structure: C:\NARS2000\qdebug\qdebug.
  7. Multi-precision Library Source Code: MPIR/MPFR/ECM Source. This zipped download is large (roughly 0.5GB) and is needed primarily to reproduce files in the MPIR/MPFR/ECM Library download so as to satisfy requirements of the GNU General Public License (GPL) v3. For more details on using the files in the download, look in the zipped file for readme.txt. If you are content to use the already-compiled existing binary libraries in MPIR/MPFR/ECM Libraries, you may not immediately need the MPIR/MPFR/ECM Source Code; on the other hand - 128-bit CPU chips are in manufacturing production pipelines, quadruple-precision 128-bit floating-point format has been standardized by the IEEE and ultra-precise calculations are already needed in such fields as quantum physics, ref. Physicists take quantum leap toward ultra-precise measurement, 6/2/2014. One of APL's strengths is its handling of mathematically precise calculations and the large size of the multi-precision source code library reinforces that.
  8. STDINT.H header file installed in the MS Visual Studio 2013 include directory (V:\VC\include -- see below)
  9. SubVersion Control program: Tortoise SVN (Current version, 32- or 64-bit depending upon your OS)
  10. Doctor Dump SDK: Doctor Dump SDK - e.g. DoctorDumpSDK.zip.
  11. File Differencing/Merge program: WinMerge (Latest stable version, usually downloads to something like WinMerge-k.m.n-Setup.exe where k, m and n are version/sub-version numbers.)

Install Tools

Preface, Convention: x86 generally refers to 32-bit software installations while 64 (or blank) represents 64-bit software installations on a Windows OS machine. NARS works on both 32-bit and 64-bit systems, but you should decide in advance which type of install you want 64 vs. 32-bit - ditto for all tool installs. Installation examples:

  1. C:\Program Files (x86)\        Represents 32-bit software program installation, normal folder location.
  2. C:\Program Files\                 Represents 64-bit software program installation, normal folder location.

Also, both folder locations just above frequently and even always exist on most machines, but for consistency and integration purposes the software should be 32 or 64-bit. Most people choose 64-bit installs if their Windows OS supports the 64-bit architecture, with 32-bit available for backward software compatibility in conjunction with less current systems. If you don't know which architecture your system uses, go to the Control Panel, System Information. Downloads usually get placed into a Downloads folder. Several of the unzipped NARS tools get placed directly into the C:\NARS2000 folder, see individual tools for exact locations.

To install the Microsoft Visual Studio 2013 Express C compiler, see Downloads(detail, #1 above). Visual C++ 2013 usually installs into something like, "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe" (64-bit loc) and you may want to place a Shortcut to VCExpress.exe on your Desktop by right-clicking on that VCExpress.exe file in Windows Explorer and Send To - Desktop (create shortcut). (Windows 8 Users: You can also Pin VCExpress.exe To your Taskbar for quick, easy access.) (Prior/obs. Microsoft setup routine name: run the vcsetup.exe program.) Afterwards including after drive plus folder remapping - the files msobj80.dll, mspdb80.dll, mspdbcore.dll, and mspdbsrv.exe all need to be copied from V:\Common7\IDE to V:\VC\bin, where the V drive is a substitute/mapping for C:\Program Files\Microsoft Visual Studio 9.0. See the discussion below on Set Up Makefile Environment Variables.

To install the Parser Generator (Bison), see the instructions above. When the Cygwin setup program asks you to choose a Default Text File Type, choose DOS/text so any committed files are the same as in the version control repository.

To install Doctor Dump SDK, unzip it in a directory at or above %NARSROOT%, this usually means unzipping into folder C:\DoctorDumpSDK. See also discussion below on Set Up Makefile Environment Variables.

Install the rest of the tools as per their instructions above, in the Downloads section.

Install The Source Code

  1. First create a NARS2000 root folder somewhere on one of your hard drives, perhaps calling it NARS2000, as in C:\NARS2000 (most common) or perhaps at some lower level. The source code and external libraries are typically installed at or into this level, e.g. qdebug.zip into C:\NARS2000 as C:\NARS2000\qdebug.
  2. Under the root folder make three folders: trunk, msieve, and branches. The first folder (trunk) will hold the main body of NARS/APL built exe interpreter source code. The second (msieve) will be utilized for code used to factor numbers, and the third (branches) will contain individual developer branches of the main code not as yet ready for release, but made public for other developers to see.
  3. Using a Version Control program such as TortoiseSVN, download-checkout the source code (see Check Out The Source Code),
  4. Download the misc.zip, qdebug.zip, gsldir.zip, and mplibs.zip files into the root folder and unzip them (directly into that root folder, e.g. C:\NARS2000) using e.g. 7z.exe (unzip/extract program used) as in 7z x misc.zip, 7z x qdebug.zip, 7z x gsldir.zip, and 7z x mplibs.zip - or double-click on those downloaded zip file names using Windows File Explorer and Extract All (again typically directly into NARS root folder previously set up).

Check Out The Source Code

An easy way to initialize your copy of the source code for the first time, although it may initially appear cumbersome to an SVN newcomer, is to use a version control program such as TortoiseSVN, mentioned above. One very helpful feature of TortoiseSVN is that it integrates well with Windows File Explorer. After downloading and installing TortoiseSVN and then rebooting your PC, there are two directories you will need to Install/initialize-checkout/TortoiseSVN-on.

  1. First bring up Windows Explorer, right-click on the trunk folder you manually created, and choose SVN Checkout.
    1. If you do not see "SVN Checkout" when you right-click on the trunk folder, download Tortoise SVN per the Tortoise SVN link above(Downloads-NARS2000 Source Code-Tortoise SVN. The online NARS SourceForge URL of source code repository: is svn://svn.code.sf.net/p/nars2000/code/trunk and your local Checkout directory: is C:\NARS2000\trunk (or wherever your trunk folder is) - quite likely you will have to edit the TortoiseSVN repository field or program local folder field because default text inserted by TortoiseSVN usually does not match folder location(s) identically. Depth should show Fully recursive, the default.
    2. To begin source code downloading/checkout into your locally created trunk folder click the OK button. Code downloading/checkout should then begin. With a high-speed Internet connection, time required to TortoiseSVN download/checkout NARS code is on the order of roughly two minutes. When successfully complete, you should get a return message at the end of the downloads list, like Completed at revision nnnn.
  2. Second (and this is a similar repeat step but using folder msieve instead of trunk), bring up Windows Explorer, right-click on the msieve folder you likewise manually created - and choose SVN Checkout.... This time online NARS URL of repository: is svn://svn.code.sf.net/p/nars2000/code/msieve (this address is slightly different than step 1) and your local Checkout directory: is C:\NARS2000\msieve (or wherever your msieve folder is). Again, depth should be fully recursive and click the OK button to begin. This step two normally completes in under five seconds, downloading far fewer files than the trunk download. Normally, the same msieve revision number should appear after finishing this download as per trunk download in step 1.

The above two steps/distinct-folders need be initialized this first checkout time through - in order to establish the special hidden SVN directories for subversion "synching" between your local source code and NARS online code repository. As a brief check that your local NARS source code files match NARS, there should be green check marks on folders trunk and msieve on your PC, placed there by TortoiseSVN. TortoiseSVN Status Information.

You will still or now need to download and unzip qdebug.zip, misc.zip, gsldir.zip, and mplibs.zip as described above.

Subsequently, you may quickly and easily update your local copy of NARS source code by right-clicking on the trunk and/or msieve folders and choose SVN Update. One useful feature of sub-versioning programs such as TortoiseSVN is that only changed files from the online latest official version will need to be subsequently downloaded as changes are made in futuro, re subsequent NARS revisions.

Since you may be unfamiliar with the download process your first time through, it make take slightly longer; however, the second or third time you Check Out The Source Code, over time, the entire "update to most current NARS source code revision" process will probably take under 3 to 5 minutes total, depending however on your (high-speed) Internet service provider's(ISP) download speed.

Folders

After unzipping the above files, the structure under the NARS2000 root folder should look very much like the following(leftmost column), where lower level sub-directories and individual sub-folder file names have been omitted:

NARS2000 SubFolder: Downloaded Zip Source File or Checkout Process:
branches\ Created manually(1)
ecm\ mplibs.zip
gsl\ gsldir.zip
mpfr\ mplibs.zip
mpir\ mplibs.zip
msieve\ TortoiseSVN Checkout msieve
qdebug\ qdebug.zip
trunk\ TortoiseSVN Checkout trunk
trunk\binaries\ TortoiseSVN Checkout trunk
trunk\Extensions\ TortoiseSVN Checkout trunk
trunk\htdocs\ TortoiseSVN Checkout trunk
trunk\images\ TortoiseSVN Checkout trunk
trunk\MediaWiki\ TortoiseSVN Checkout trunk
trunk\ReleaseNotes\ TortoiseSVN Checkout trunk
trunk\WineHQ\ TortoiseSVN Checkout trunk

(1) Subfolder \branches should be created manually (e.g. Windows Explorer, right-click, New, Folder). It is used to hold subprojects you may develop. For example if your name is Bill Gates, you might have the following subfolders, each representing a NARS subproject:
C:\NARS2000\branches\bgates\NARS_Spreadsheets
C:\NARS2000\branches\bgates\NARS_WordProcPlusAPLEdits
C:\NARS2000\branches\bgates\EZMenus
C:\NARS2000\branches\bgates\Graphics

Choose How To Build

The following sections describe two alternate ways to build the executable. One is the GUI interface of VC++ Express, the other is a command line interface using a makefile.

Set Up VC++ Express

If you are using Visual Studio 2013/VC++ Express, the project file is in the trunk folder and is called NARS2000.vcproj. You may load it manually every time you invoke VC++ Express, or you may load it automatically by placing the path to the project file on the command line in the VC++ Express shortcut as in "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe" C:\NARS2000\trunk\NARS2000.vcproj or wherever you defined your NARS2000 root folder.

The vast majority of the project settings are found in the above file with some exceptions.

Set Up Makefile and Environment Variables


Windows 8: Setting up Environment and Path Variable(s): Under Settings, Control Panel, System and Security, System, Advanced System Settings, Advanced (Tab) or in Control Panel Search for Environment Variables,

  • Click Environment Variables button - There is both a Temp Variable and Path Variable.
There are 2 sections, User Account Variables and System Variables. You normally want to add new System Variables.
Click [New] button for a New System Variable:
Variable name       PARGEN
Variable value       C:\cygwin64\bin\bison       << typical for a 64 bit install(for bison.exe in subfolder bin), for 32 bits installs see below for variable set values.
  • Normally add a New variable (var Name plus Value) for each of the eight Set vars commands listed below, 8 environment variable names - such as NARSROOT, CS_DIR, ZIPPRG, PARGEN, etc.
  • If you need to add another Path to an existing variable, each new or added path is separated with a semi-colon.
  • After updating any Environment/Path variable(s) you apparently need to reboot since the above variable changes only affect changes in the Registry until PC is rebooted.
  • The instructions below should also or alternatively work.

If you are building from the makefile or working with the GUI C++ Compiler, you'll need to set eight environment variables in your autoexec.bat file (or see just above for setting Environment Variables via Windows Control Panel). Note that Environment variable #n's just below are shown only for helpful reference purposes.

REM Path of the root of the NARS2000 project *ending with a backslash*
Set NARSROOT=C:\NARS2000^\                         Environment variable #1

REM Path to Doctor Dump SDK root
Set CS_DIR=C:\DoctorDumpSDK^\                      Environment variable #2

REM Path and name of zip program (7-Zip)
Set ZIPPRG="C:\Program Files\7-Zip\7z"             Environment variable #3

REM Path and name of parser generator (bison)      Environment variable #4 (next line)
Set PARGEN=C:\Cygwin\bin\bison         OR for a 64-bit install >>   Set PARGEN=C:\cygwin64\bin\bison

REM Path and name of makedep program
Set MAKEDEP=%NARSROOT%makedep.php                  Environment variable #5

REM Path and name of the <makepro.php> program
Set MAKEPRO=%NARSROOT%makepro.php                  Environment variable #6

REM Folder of SDK ("C:\Program Files\Microsoft SDKs\Windows\v7.0A")
Set SDK=U:^\                                       Environment variable #7

REM MSVC compiler ("C:\Program Files\Microsoft Visual Studio 9.0")
Set MSVC=V:\VC^\                                   Environment variable #8

Mapping Virtual Drive Letters:
You will be using Windows subst command to map drive letters as references to drives U: and V: that several of the above environment variables refer to. Microsoft explanation of subst command here.
Modify your C:\AutoExec.bat file to include something approximating the following highlighted text(version#/32/64 bit installs each vary), include the enclosing quote chars just below:

subst U: "C:\Program Files\Microsoft SDKs\Windows\v7.0A"      (or whatever your current version is)
subst V: "C:\Program Files\Microsoft Visual Studio 9.0"             (ditto re version 9.0=Visual Studio 2008)

If you do not have an AutoExec.bat file (many Windows 7 and 8 users may not):

Create a new text document using Windows File Explorer, rename it as AutoExec.bat and move(or copy) it to the C:\ drive folder with the above two subst commands in it.
Windows 7 and 8 users: File AutoExec.bat no longer automatically gets run at system-user boot-up so place a Shortcut to AutoExec.bat in the Program files Startup folder location(navigate Windows File Explorer to one of the below locations, right-click, New, Shortcut, AutoExec.bat). The Windows 7/8 Startup Folder usually is located as follows:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup                                         (general/all users Startup folder) OR
C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup       (single user Startup folder, UserName varies)

IMPORTANT: A successfully mapped V drive should contain a sub-sub-subfolder which then contains the amd64\nmake.exe (64-bit systems) file or bin\nmake.exe (32-bit systems), e.g. typical 64-bit configuration/location:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\nmake.exe.

The V drive map would only include linking through subfolder \Visual Studio 9.0. After creating the linked drives, just check to make sure your mapped V drive has the nmake.exe contained one or several subfolder levels below it. The NARS2000.exe automated Compile/Build uses nmake.exe during exe construction. 64-bit installs require the amd64\nmake.exe file - paradoxically even if your machine's chipset is Intel, a minor Microsoft variation.

Typical mapped configurations just below, but again each install/version# may vary:
U =     C:\Program Files\Microsoft SDKs\Windows\v7.0A     (or v6.0A or whatever your downloaded/current version is)
V =     C:\Program Files\Microsoft Visual Studio 9.0           (or C:\Program Files (x86)\Microsoft Studio 9.0 for 64-bit installs, again look for nmake.exe in a subfolder)
As a check to make sure the subst commands worked, there should now be 2 new drive letters visible in Windows Explorer, in the leftmost window for virtual drives/mapped folders - U and V. To avoid having to reboot at present, just open(not edit but run) AutoExec.bat AFTER making sure it is 100% correctly configured. Having a correctly configured AutoExec.bat file will ensure not having to manually link drives U and V each time the NARS2000.exe is built-rebuilt.


If you install NARS project tools in other folders, make appropriate changes to the above mappings.

Lastly don't forget: To append three folders: C:\cygwin64\bin , V:\Common7\IDE and C:\PHP to your Path variable PATH=%PATH%;C:\cygwin64\bin;V:\Common7\IDE;C:\PHP or see Control Panel search for Path, then Edit System Environment Variables for your account, system variable named Path; append to that Path variable   ;C:\cygwin64\bin;V:\Common7\IDE;C:\PHP   - (three additional paths, semicolon separated) so Visual C's Make plus Compiler can find DLLs, exe's and Tools you have so diligently downloaded, then installed.

Pre First Compile and Localization Notes

Make/Compile local Environment Variable %NARSROOT% is presently set using file C:\NARS2000\trunk\wcustomize.bat. This bat file is called by other major trigger-compile bat files such as mk32.bat, mk64.bat, w32.bat and w64.bat - which oversee-initiate compilation. The %NARSROOT% environment variable is important in indicating where Make/Compilation will occur. Before first locally compiling NARS2000, you likely need to manually edit (using Notepad or a local text file editor) file trunk\wcustomize.bat and make sure the following are initially correct per your 'local PC NARS installation' i.e. within wcustomize.bat:
Set NARSROOT=C:\NARS2000^\       (Note: No % symbols are needed in set/specification rows in wcustomize.bat, e.g. replace 'R:\NARS2000' to 'C:\NARS2000' as shown at left)
Set CS_DIR=C:\DoctorDumpSDK^\     (again R:\ was changed to C:\)
The additional hat(^) symbol in the above bat commands is needed for directory/folder recombination purposes, essentially sub-directory parse-point identification and or recombination point, where NARS may use subdirectories/parsing.

Prior to using Visual Studio and its IDE(integrated developer's environment) for NARS Building/Compilation purposes a first time, and to help ensure the proper installation of NARS source code - it is very helpful/necessary to open a CMD.EXE window using Windows Start, CMD.EXE. This will open up a small CMD window. While inside the opened CMD.EXE window, navigate to your local C:\NARS2000\trunk folder, using cd C:\NARS2000\trunk where cd represents change directory. Now run mk32.bat by typing it in, to compile NARS2000's 32-bit executable. If mk32.bat is successful and if your installation is 100% correct, two identical files in separate folders will be created(built and compiled) using bat commands from inside that CMD window/session:
C:\NARS2000\trunk\RET\ND32\NARS2000.exe
C:\NARS2000\trunk\binaries\ND32\NARS2000.exe

If that 32-bit NARS make/build was successful, then from the same CMD.EXE window, type mk64.bat. This should likewise compile locally the 64-bit NARS Executable, with again two resulting exe output files:
C:\NARS2000\trunk\RET\ND64\NARS2000.exe
C:\NARS2000\trunk\binaries\ND64\NARS2000.exe

Successfully completing mk32.bat and mk64.bat along with presence of their respective NARS2000.exe output files generally confirm successful installation of NARS source code, as well as correct installation for several associated tandem utility tools re compiling NARS2000.exe on your server, PC, notebook or tablet computer.

Building The Executable

Congratulations, if you've successfully arrived at this section, your resume now includes such useful terms as software installation wizard and relentless software engineering candidate. You are part of an elite group - the few, the proud, NARS geek marines; also known as tomorrow's APL-symbol-set event-horizon squad. You've managed to easily or otherwise cross several potentially deep programming ravines in the process.

At this point you should be ready to build the executable, again - this time however from inside Visual Studio's IDE(integrated developer's environment). There are two general ways to build NARS executable. Method one: Involves the time-honored command-line batch file compile mode using files mk32.bat or mk64.bat - as you should have previously discovered in the section Pre First Compile and Localization Notes while using Windows CMD.EXE.

Method two: Involves again first opening a (Windows Start button) CMD.EXE window and running w32.bat start (all one command) or w64.bat start. Immediately or shortly, you should see Visual Studio 2013's program visualize, load and run - with either the 32-bit or 64-bit NARS2000 project/program loaded. After Visual Studio 2013 finishes loading - simply click Build. Full use of Visual Studio 2013's IDE (integrated developer's environment) should now be available for you to experiment with, develop code on, debug and customize APL as you may choose. Your first time through with running w32.bat start and w64.bat start:

  • There is usually a Visual Studio One Way Migration message which displays. This is normal, TBE(to be expected), and yes you DO at that point want to migrate the NARS2000 project to Visual Studio 2013. There are usually roughly 20 migration warnings which also show up in an Internet Browser page re the Migration Report - again, all normally to be expected. However, there should be zero errors in the migration report.
  • If all went satisfactorily well with the Migration, you should be able to select/choose/Click Build Solution under Build in VS2013's IDE to fully compile NARS2000 executable. After Build, there should likewise be zero errors.

Special note regarding w32.bat start and w64.bat start while in Visual Studio's IDE for the NARS2000 project: When switching between 32 and 64-bit versions, i.e. w32.bat start versus w64.bat start: There is a Property adjustment required when using Visual Studio's IDE. After Visual Studio opens up and in the Solution Explorer window (usually on the upper right hand side of your screen) click on "Solution 'nars2000' (1 project)." This should then show a Properties Window just below it. Look for a line which reads: Active config. If you ran w32.bat start then Active config should have a value of Debug32|Win32. If you ran w64.bat start then Active config should have a value of Debug64|Win32.

NARS Systems Developer Suggested Knowledge Prequisites

For a strongly recommended set of knowledge prerequisites - in order to effectively understand, maintain or improve NARS functionality - please see NARS System Developer Suggested Knowledge Prerequisites.

Developer Experiments with NARS Source Code

This section is for Developers who have successfully downloaded NARS source code and want to Experiment with it, or further develop NARS APL Interpreter's source code.

For development and debugging purposes: You as APL Interpreter developer normally want to want to first write new source code/model using the 32-bit version of NARS2000 (w32.bat start). This is because the 32-bit version is easier to debug than the 64-bit version; error messages can be less complex. Migrating correct source code forward from the 32-bit version to the 64-bit version is also easier than a reverse migration.

You will also at some point still need to be synched-with or later synch-back-to NARS online source code - i.e. after experimenting/changing local PC source code. This is equivalent to a ChemLab 101 at home/home-office and cleaning up all experiments at the end of the chemistry class, except as it applies to software developers, NARS software developers, and or those inclined to experiment safely.

Here is where Tortoise SVN provides excellent and time-tested source-code clean-up tools for your local PC, including Resolve, Revert, Clean up, and Undo changes. Pull up these TortoiseSVN utilities by navigating Windows File Explorer to directory C:\NARS2000. If you successfully previously downloaded and Installed TortoiseSVN and NARS2000 source code, as outlined earlier/above, you may right click on say the \trunk subfolder in C:\NARS2000. A mouse right-click on \trunk should show an option labeled TortoiseSVN. Further choosing/selecting TortoiseSVN should then reveal multiple clean up options - Resolve, Revert, Clean up and Undo changes.
TortoiseSVN Documentation on:
Clean up.
Undo Changes.
Resolving Conflicts.

At least one method to safely synch-back-to NARS is to:

  1. Select TortoiseSVN after right-clicking on the trunk folder
  2. Select Revert, click OK, let it run.
  3. Select Clean up, check Refresh shell overlays, click OK, let it run.

Per TortoiseSVN there should again be green check marks appearing on your trunk folder as well as your msieve folder.

For revision tracking and long-term software program maintenance purposes: Keep track of which files (file names) you personally modify, including a brief purpose for that edit. You will need to this information later for Release Notes purposes (see folder C:\NARS2000\trunk\ReleaseNotes for best-practice-examples of developer note-taking) and if you later synch to a new online NARS version, you may have to carry-forward your edit changes into a newly downloaded set of NARS source code files which may or may not reflect your prior local computer edit changes.

Periodic NARS Updates

Incremental Update - Method 1:
Periodically, NARS APL interpreter developers should ensure changes done by other developers get incorporated into their local machine's source code working copy. This is the process of integrating/downloading changes from NARS SourceForge server to your local copy. Updating may be performed on single files, a set of selected files, or recursively on entire directory hierarchies. To update, select the files and/or directories you want (usually \trunk and or \msieve), right click and select TortoiseSVN → Update in the explorer context menu for that trunk or msieve folder. A window will pop up displaying the progress of the update as it runs. Changes done by other developers will be merged into your local files, keeping any changes you may have done to the same files - if you did not want to keep your local changes but do want to keep the downloaded changes, select TortoiseSVN and Revert prior to running TortoiseSVN Update. NARS repository at SourceForge is not affected by an update to your local copy. Update Your Working Copy With Changes From Others

Total Source Code Replacement - Method 2:
For example from version r1325 to say version r1364 (note a significant revision/datetime gap between 1325 and 1364, hypothetically), whatever NARS latest revision number is. Total code replacement may be preferred over incremental updating when major structural changes or significant source code changes are newly in situ.

Total Replacement Process: Visually scan NARS source code page at http://sourceforge.net/p/nars2000/code/HEAD/tree/trunk/ and review the top 25 to 40 file entries or so, while mentally keeping track of the highest revision number found(e.g. r1379). If after your last/earlier TortoiseSVN Update, your local version number is lower than the latest revision number visually found online, then perform the following to update to the most recent NARS revision:

  1. Rename your existing NARS folder to something approximating C:\NARS2000_old_rev
  2. Create an entirely new C:\NARS2000 folder
  3. Copy all folders and files at the top level from C:\NARS2000_old_rev folder into C:\NARS2000 EXCEPT \trunk and \msieve subfolders (and their contents). The \trunk and \msieve folders will shortly be downloaded from SourceForge.
  4. Create new empty folders called \trunk and \msieve in the new C:\NARS2000 folder.
  5. Revisit the section above called Check Out The Source Code to again checkout/download to the absolute latest NARS version number, for both \trunk and \msieve folders.
  6. Also revisit Pre First Compile and Localization Notes and text edit file \trunk\wcustomize.bat to localize the new version.
  7. Folder C:\NARS2000_old_rev may be Recycled after you are done copying non-trunk and non-msieve files/folders from it into your new C:\NARS2000 folder. If disk space is not restrictive and for 100% safety purposes, keep your prior folder available until after successfully Building/Compiling the newly downloaded 32-bit and 64-bit versions, and making sure you did not have any local personal changes now potentially being recycled.