Creating New System Functions

From NARS2000
Revision as of 15:54, 10 August 2015 by Robert Wallick (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Who Should Be Reading This Page

If you are an APL'er, an APL programmer or APL developer - this page may not be right for you. This page is for Developers who want to implement a new Quad or command using the C/C++ language in NARS source code. Given that NARS source code is over a quarter million lines of highly evolved source code, it is helpful to have several starting points to work from, whether you are a gifted C++/C programmer, PHP programmer, Bison programmer or a relative newcomer to NARS source code. The basic premise is that you have an idea for a new Quad system function command for APL/NARS and wish to implement it, add it to NARS functionality. This page is a starting conceptual and reference point.

Helpful Starting Point Perspectives

Visually scan or browse the Build notes found in the ReleaseNotes subfolder, normally located in C:\NARS2000\trunk\ReleaseNotes using a text or string scanner program such as Windows File Explorer with its Search text box. Multiple time-lapsed prior examples of adding system functions should appear in those previous Build notes. Search for the specific text string, "system function" and there should be a number of references found/listed. These references give an idea of which files frequently need to be modified, including much about what you will need to do. For example, file <sysvars.c> contains code locations where all system variables and functions hook into the system - a primary symbol tables reference, an interpreter-table-of-contents file. You will further need to define a new c file for your system function, e.g. <qf_cmd.c> or <qf_menus.c> or <qf_grfx.c> or a similar name. Defining any new file also requires some specific changes such as new entries in <compro.h>, <makefile.src>, and <makefile.inc>. You'll also need to change <NARS2000.vcxproj> which you can do through Visual Studios 20xx GUI or IDE(integrated developer's environment). Try to maintain a list of the various files you edit/change because if NARS subsequently moves to a new release and you need to synch with it, it is helpful to know which files you modified - to synch plus reinstate, to bring forward your local changes.

For example, in C:\NARS2000\trunk\ReleaseNotes\Notes-1295.txt system function Quad T or T was created and implemented, to return a Tick Count for time-sensitive APL subroutine stop-watch timing purposes. The following seven files were edited/affected by the addition of system function T into NARS2000.exe. Listed below are edited notations extracted from <Notes-1295.txt>:

COMPRO.H:   #1
  Include <qf_t.pro> in the list of prototype files.

MAKEFILE.INC:   #2
MAKEFILE.SRC:   #3
NARS2000.32.VCPROJ:   #4
NARS2000.64.VCPROJ:   #5
  Include <qf_t.c> in the list of source files.   #6

QF_T.C   #6(again)
  Implement []T.

SYSVARS.C:   #7
  Include []T in the list of niladic system functions.

Note above how filenames edited/changed were kept track of, including general notes on what was performed including the purpose of the revision/edit-change by the System Developer. This filename + purpose tracking along with associated note keeping is considered good programming, a best developer practice. Such detailed record-keeping makes program flow and source-code maintenance much easier to follow and subsequently revise as needed.

Continuing with the formation or genesis process re system function T example just above, viewing(using a standard text editor such as notepad.exe) file <qf_t.c> which is the central T function-defining c file, you will note that the mnemonic(see #General Reference Notes) for T is SysFnT_EM_YY. A File Explorer search for string SysFnT_EM_YY will bring up primarily two found-in files, <qf_t.c> and <sysvars.c>.

Therefore we may conclude or determine - that operational functionality for this particular system function T was contained in just two files. The other five affected files, and not to be ignored, were impacted for overall programming structural integrity, potential debugging/compilation, and NARS2000 overall modeling purposes. Not every System Function impacts or requires so few files, but T is a solid 'minimal impact elsewhere' System Function example.

Source Code Conventions and Abbreviations Dictionary

NARS C source code contains many abbreviations. To better understand NARS source code and or to better understand a source code process, particularly if you are new to looking at or working with its C source code, view C Source Code Conventions and Abbreviations Dictionary here.


<sysvars.c> Reference Table

All System Variables and System Functions, per system reference table (7 column table) are listed/defined within file <sysvars.c>. Quad T's entry is extracted just below. The sysvars table helps APL's interpreter understand "how" to handle each quad system variable and function, how each is "supposed to operate"; thus helping the Interpreter identify syntax errors, valence errors, domain errors, etc.
T's entry(within niladic system functions grouping) in table:

SysName Valence Var? Std? Exec Routine(name) Sys_Vars Descr
QUAD L"t" 0 FALSE FALSE SysFnT_EM_YY 0 High Resolution Time

Every APL/APL2 Quad System Variable and Quad System Function(niladic, monadic and dyadic) has an entry in the <sysvars.c> table. System function T, because it is niladic, has a zero valence; it is not a System Variable(False); it has a function mnemonic or calling name = SysFnT_EM_YY; it uses zero system variables.

Frequently Used TypeDef Structures and Variables

NARS has multiple frequently used TypeDefs, Structures and Variables. Familiarity with these structures and the variables employed is essential to gain a better understanding of how NARS C source code works and comprehending program flow, view Frequently Used TypeDef Structures and Variables here.

⎕EC as System Function Coding Example, Returning a Nested Array

System Function ⎕EC is useful to APLers for testing purposes, but it also is useful for NARS source code analysis purposes precisely because - it illustrates how to return a nested vector back to APL, view Quad EC C Source Code Analysis here.

Setting Up for Cross-Reference Call To Another APL or System Function

In creating a new System Function or even a new APL function, it can be useful to call another already established APL or system function to perform part of the new pre-processing-configuration-setup or post-close-done requirements. One of the frequently encountered parameters to nearly every function call is a parameter usually named lptkFunc or tkFcn - known variously as line pointer to a token function or just token function. tkFcn will be potentially needed in the soon-to-be-called function in case it mandates use for something else; it represents sort of a dynamically changing location-operation recognition tracker. As an analogy, Windows operating system uses program registrations(ref. software installs and regedit) so Windows will "know" each program when it runs and can report errors and abends; NARS uses token-function structures so its APL Interpreter will know each APL and system function as it in turn runs.

From file <pf_uarrow.c>, the following lines were edit-extracted:

     TOKEN        tkFcn = {0};   // tkFcn token function struct. var defined, initialized to zero in vars declaration section of uarrow function.
     [...]                       // Intermediary unrelated code
     // Setup token structure for use in calling rho {the shape of} function (which uarrow i.e. APL's "take" now needs):
     tkFcn.tkFlags.TknType   = TKT_FCNIMMED;
     tkFcn.tkFlags.ImmType   = IMMTYPE_PRIMFCN;
////tkFcn.tkFlags.NoDisplay = FALSE;       // Commented out because already zero from = {0}
     tkFcn.tkData.tkChar     = UTF16_RHO;  // Unicode transformation format, 16-bit-coding for Rho - identifies function/operator being called.
     tkFcn.tkCharIndex       = lptkFunc->tkCharIndex;   // Standard caret pointer

In order to cross calculate ⍴R(the shape of right hand argument variable R - tkFcn/UTF16_RHO (shortly will be processing inside function Rho) is passed in the above example from call-from up-arrow code(file <pf_uarrow.c>) - the APL take function). Another reference to <lptkFunc> would be similar to function tokening use above, but say to the LeftShoe symbol (UTF16_LEFTSHOE or APL's ⊂ enclose symbol). An often used element of the function token is <tkCharIndex> which is used as the caret pointer in case an error occurs and an error message would then be formed into ⎕DM and )SI, workspace state indicator would get set. The function token structure is key to allowing APL's interpreter know how to keep track of where the program is processing-at and, as needed, correctly report errors.

For the full list of available UTF16_* variables, see file <symbolnames.h>. To search in Visual Studio 2013 (load NARS2000 project first) - for existing NARS examples of where tkFcn is used, i.e. set up, in VS2013 - Edit - FindAndReplace - FindInFiles use search string "tkFcn." and note the dot as the rightmost "search on" char; and click the [Find All] button.

Source Code Derived List of APL System Functions

Source Code List of NARS Quad System Functions, per qf_*.c Files Derivative. Sys Fcn Ct=31. Snapshot as of 7/26/15:

QuadFcn c FileName APL System Function Mnemonic Exec Name c FileSize Subordinate Monadic-Dyadic Name Cross Refs, Magic Functions, Misc. Function Type (sysvars.c) Description (sysvars.c)
C:\NARS2000\trunk\qf_a.c - ⎕A SysFnA_EM_YY 3,151 Niladic Alphabet
C:\NARS2000\trunk\qf_at.c - ⎕AT SysFnAT_EM_YY 44,356 SysFnMonAT_EM_YY SysFnDydAT_EM_YY Monadic or Dyadic Attributes
C:\NARS2000\trunk\qf_av.c - ⎕AV SysFnAV_EM_YY 5,188 Niladic Atomic Vector
C:\NARS2000\trunk\qf_cr.c - ⎕CR SysFnCR_EM_YY 33,687 SysFnMonCR_EM_YY SysFnDydCR_EM_YY SysFnCR_Common_EM_YY SysFnMon_CR_EM_YY SysFnCR_Copy_EM_YY Monadic or Dyadic Canonical Representation
C:\NARS2000\trunk\qf_d.c - ⎕D SysFnD_EM_YY 3,149 Niladic Digits
C:\NARS2000\trunk\qf_dl.c - ⎕DL SysFnDL_EM_YY 8,265 SysFnMonDL_EM_YY SysFnDydDL_EM_YY Monadic or Dyadic Delay Execution
C:\NARS2000\trunk\qf_dr.c - ⎕DR SysFnDR_EM_YY 49,334 SysFnMonDR_EM_YY SysFnDydDR_EM_YY SysFnDR_Show_EM_YY SysFnDR_Convert_EM_YY Monadic or Dyadic Data Representation
C:\NARS2000\trunk\qf_ea.c - ⎕EA SysFnEA_EM_YY 9,565 SysFnMonEA_EM_YY SysFnDydEA_EM_YY PrimFnMonUpTackJotCommon_EM_YY Monadic or Dyadic Execute Alternate
C:\NARS2000\trunk\qf_ec.c - ⎕EC SysFnEC_EM_YY 17,469 SysFnMonEC_EM_YY SysFnDydEC_EM_YY PrimFnMonUpTackJotCommon_EM_YY Monadic or Dyadic Execute Controlled
C:\NARS2000\trunk\qf_em.c - ⎕EM SysFnEM_EM_YY 3,106 Niladic Event Message
C:\NARS2000\trunk\qf_error.c - ⎕ERROR SysFnERROR_EM_YY 7,129 SysFnMonERROR_EM_YY SysFnDydERROR_EM_YY Monadic or Dyadic Signal Error
C:\NARS2000\trunk\qf_es.c - ⎕ES SysFnES_EM_YY 18,322 SysFnMonES_EM_YY SysFnDydES_EM_YY Monadic or Dyadic Event Simulate
C:\NARS2000\trunk\qf_et.c - ⎕ET SysFnET_EM_YY 6,645 Niladic Event Type
C:\NARS2000\trunk\qf_ex.c - ⎕EX SysFnEX_EM_YY 23,537 SysFnMonEX_EM_YY SysFnDydEX_EM_YY Monadic or Dyadic Expunge Names
C:\NARS2000\trunk\qf_fmt.c - ⎕FMT SysFnFMT_EM_YY 108,506 SysFnMonFMT_EM_YY SysFnDydFMT_EM_YY ExecuteMagicFunction_EM_YY Monadic or Dyadic Format
C:\NARS2000\trunk\qf_fx.c - ⎕FX SysFnFX_EM_YY 18,028 SysFnMonFX_EM_YY SysFnDydFX_EM_YY SysFnMon_FX_EM_YY Monadic or Dyadic Function Fix
C:\NARS2000\trunk\qf_host.c - ⎕HOST SysFnHOST_EM_YY 10,905 SysFnMonHOST_EM_YY SysFnDydHOST_EM_YY Monadic or Dyadic Launch Programs on Host OS
C:\NARS2000\trunk\qf_lc.c - ⎕LC SysFnLC_EM_YY 5,679 Niladic Line Counter
C:\NARS2000\trunk\qf_mf.c - ⎕MF SysFnMF_EM_YY 38,096 SysFnMonMF_EM_YY SysFnDydMF_EM_YY Monadic or Dyadic Monitor Function
C:\NARS2000\trunk\qf_nc.c - ⎕NC SysFnNC_EM_YY 20,952 SysFnMonNC_EM_YY SysFnDydNC_EM_YY <SysFnDydNL_EM_YY Monadic or Dyadic Name Classification
C:\NARS2000\trunk\qf_nfns.c - ⎕NFNS SysFnNAPPEND_EM_YY 260,952 SysFnNAPPEND_EM_YY SysFnMonNAPPEND_EM_YY SysFnDydNAPPEND_EM_YY SysFnNCREATE_EM_YY SysFnMonNCREATE_EM_YY SysFnDydNCREATE_EM_YY SysFnCreateTie_EM_YY SysFnNERASE_EM_YY SysFnMonNERASE_EM_YY SysFnDydNERASE_EM_YY SysFnNLOCK_EM_YY SysFnMonNLOCK_EM_YY SysFnDydNLOCK_EM_YY SysFnNNAMES_EM_YY SysFnNNUMS_EM_YY SysFnNREAD_EM_YY SysFnMonNREAD_EM_YY SysFnDydNREAD_EM_YY SysFnNRENAME_EM_YY SysFnMonNRENAME_EM_YY SysFnDydNRENAME_EM_YY SysFnNREPLACE_EM_YY SysFnMonNREPLACE_EM_YY SysFnDydNREPLACE_EM_YY SysFnNRESIZE_EM_YY SysFnMonNRESIZE_EM_YY SysFnDydNRESIZE_EM_YY SysFnNSIZE_EM_YY SysFnMonNSIZE_EM_YY SysFnDydNSIZE_EM_YY SysFnNTIE_EM_YY SysFnMonNTIE_EM_YY SysFnDydNTIE_EM_YY SysFnNUNTIE_EM_YY SysFnMonNUNTIE_EM_YY SysFnDydNUNTIE_EM_YY Monadic or Dyadic Append Data To An Open Native File
C:\NARS2000\trunk\qf_nl.c - ⎕NL SysFnNL_EM_YY 17,698 SysFnMonNL_EM_YY SysFnDydNL_EM_YY Monadic or Dyadic Name List
C:\NARS2000\trunk\qf_sysid.c - ⎕SYSID SysFnSYSID_EM_YY 4,826 Niladic System Identifier
C:\NARS2000\trunk\qf_sysver.c - ⎕SYSVER SysFnSYSVER_EM_YY 8,556 Niladic System Version
C:\NARS2000\trunk\qf_t.c - ⎕T SysFnT_EM_YY 3,542 SysFnD_EM_YY Niladic High Resolution Time
C:\NARS2000\trunk\qf_tc.c - ⎕TC SysFnTC_EM_YY 12,390 SysFnTCCom_EM_YY SysFnTCCOM_EM_YY SysFnTCBEL_EM_YY SysFnTCBS_EM_YY SysFnTCESC_EM_YY SysFnTCFF_EM_YY SysFnTCHT_EM_YY SysFnTCLF_EM_YY SysFnTCNL_EM_YY SysFnTCNUL_EM_YY Niladic Terminal Control Characters
C:\NARS2000\trunk\qf_tf.c - ⎕TF SysFnTF_EM_YY 53,263 SysFnMonTF_EM_YY SysFnDydTF_EM_YY SysFnDydTF1_EM_YY SysFnDydTF2_EM_YY Monadic or Dyadic Transfer Form
C:\NARS2000\trunk\qf_ts.c - ⎕TS SysFnTS_EM_YY 5,165 Niladic Time Stamp
C:\NARS2000\trunk\qf_ucs.c - ⎕UCS SysFnUCS_EM_YY 23,003 SysFnMonUCS_EM_YY SysFnDydUCS_EM_YY SysnMonUCS_EM_YY Monadic or Dyadic Universal Character Set
C:\NARS2000\trunk\qf_vr.c - ⎕VR SysFnVR_EM_YY 5,624 SysFnMonVR_EM_YY SysFnDydVR_EM_YY ExecuteMagicFunction_EM_YY Monadic or Dyadic Vector Representation of a Function
C:\NARS2000\trunk\qf_wa.c - ⎕WA SysFnWA_EM_YY 3,367 Niladic Workspace Available

Magic Function C Header File vs APL - a Comparison

Extract from NARS file C:\NARS2000\trunk\mf_quadvr.h for System Function VR (C source code header file, just below):

//***************************************************************************
//  Magic function/operator for Monadic []VR
//
//  Monadic []VR -- Visual Representation
//
//  Return a visual representation of a user-defined function/operator
//***************************************************************************

static APLCHAR MonHeaderVR[] =
  L"Z←" MFON_MonVR L" R;L;⎕IO";

static APLCHAR MonLineVR1[] =  
  L"⎕IO←0 ⋄ Z←1 ##.⎕CR R";
  
static APLCHAR MonLineVR2[] =  
  L"→(0≠⍴Z)/L1 ⋄ Z←'' ⋄ →0";
  
static APLCHAR MonLineVR3[] =  
  L"L1:→(1=≡Z)/0";
  
static APLCHAR MonLineVR4[] =  
  L"L←'∇'∊0⊃Z";
  
static APLCHAR MonLineVR5[] =  
  L"Z←(∊((⊂[1]'LO<    ∇>P<[>Q<]>I6' ⎕FMT⍳⍴Z),¨Z),¨⎕TCNL),'    ∇'";
  
static APLCHAR MonLineVR6[] =  
  L"→L/0 ⋄ Z←Z,(' ',⍕2 ##.⎕AT R),' (UTC)'";

static LPAPLCHAR MonBodyVR[] =
{MonLineVR1,
 MonLineVR2,
 MonLineVR3,
 MonLineVR4,
 MonLineVR5,
 MonLineVR6,
};

MAGIC_FCNOPR MFO_MonVR =
{MonHeaderVR,
 MonBodyVR,
 countof (MonBodyVR),
};


VR - APL monadic function named MFON_MonVR(just below):

      ⎕CR 'MFON_MonVR'
Z←MFON_MonVR R;L;⎕IO                                        
⎕IO←0 ⋄ Z←1 ##.⎕CR R                                        
→(0≠⍴Z)/L1 ⋄ Z←'' ⋄ →0                                      
L1:→(1=≡Z)/0                                                
L←'∇'∊0⊃Z                                                   
Z←(∊((⊂[1]'LO<    ∇>P<[>Q<]>I6' ⎕FMT⍳⍴Z),¨Z),¨⎕TCNL),'    ∇'
→L/0 ⋄ Z←Z,(' ',⍕2 ##.⎕AT R),' (UTC)'

Note the displaced lines yes, but great/identical similarity exists between the UTF-8 C source code header file and the actual APL function MFON_MonVR. In a very real sense, APL source code was imported directly into C source code via a header file, using a magic function. Hence the term magic since APL magically gets executed inside a compiled C program. This is somewhat code-wise equivalent to using the (execute) function in APL. Technically the APL simulation in C was made possible and accomplished via re-formatting the ⎕CR representation of an APL function, placing it into a C source code header file, and using PHP in the NARS2000 project model. Also technically, note the use of L" in the header file at the front of several lines - the presence of the prefix L in C source code indicates Unicode string to the C compiler.

Ref. also System Function ⎕VR and System Function ⎕CR

For Magic Functions: In addition to creating a header file such as mf_quadvr.h, magic function header files need reference via a caller file such as qf_vr.c. Also, referencing table entries may frequently be required in files execmfn.h and execmfn.c within the \trunk folder.


C Source List of APL Functions

C Source List of APL Functions with Cross References (per C:\NARS2000\trunk\pf_*.c) as of 7/26/15:

NARS C Source File APL Name C Funct Name Subordinate Monadic and or Dyadic Name Cross References, Protos and Renames
pf_bar.c Bar PrimFnBar_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_circle.c Circle PrimFnCircle_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_colonbar.c ColonBar PrimFnColonBar_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_comma.c Comma PrimFnComma_EM_YY PrimFnMonComma_EM_YY, PrimFnDydComma_EM_YY, PrimIdentFnComma_EM_YY, PrimFnMonCommaScalar_EM_YY, PrimFnMonCommaGlb_EM_YY PrimProtoFnComma_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnDydSlash_EM_YY
pf_cslope.c CircleSlope PrimFnCircleSlope_EM_YY PrimFnMonCircleSlope_EM_YY, PrimFnDydCircleSlope_EM_YY, PrimIdentFnCircleSlope_EM_YY PrimProtoFnCircleSlope_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnMonIota_EM_YY
pf_cstar.c CircleStar PrimFnCircleStar_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_cstile.c CircleStile PrimFnCircleStile_EM_YY PrimFnMonCircleStile_EM_YY, PrimFnDydCircleStile_EM_YY, PrimIdentFnCircleStile_EM_YY PrimProtoFnCircleStile_EM_YY, PrimProtoFnMixed_EM_YY
pf_darrow.c DownArrow PrimFnDownArrow_EM_YY PrimFnMonDownArrow_EM_YY, PrimFnDydDownArrow_EM_YY, PrimIdentFnDownArrow_EM_YY, PrimIdentDownArrow_EM_YY PrimProtoFnDownArrow_EM_YY, PrimProtoFnMixed_EM_YY
pf_dcaret.c DownCaret PrimFnDownCaret_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_deltastile.c DeltaStile PrimFnDeltaStile_EM_YY PrimFnMonGradeCommon_EM_YY, PrimFnDydGradeCommon_EM_YY, PrimFnDelStile_EM_YY, PrimProtoFnDeltaStile_EM_YY, PrimProtoFnMixed_EM_YY, PrimProtoFnDelStile_EM_YY
pf_domino.c Domino PrimFnDomino_EM_YY PrimFnMonDomino_EM_YY, PrimFnDydDomino_EM_YY, PrimIdentFnDomino_EM_YY PrimProtoFnDomino_EM_YY, PrimProtoFnMixed_EM_YY, ExecuteMagicFunction_EM_YY
pf_dotdot.c DotDot PrimFnDotDot_EM_YY PrimFnMonDotDot_EM_YY, PrimFnDydDotDot_EM_YY, PrimFnDydDotDotNested_EM_YY PrimProtoFnDotDot_EM_YY, PrimProtoFnMixed_EM_YY, ExecuteMagicFunction_EM_YY
pf_dshoe.c DownShoe PrimFnDownShoe_EM_YY PrimFnMonDownShoe_EM_YY, PrimFnDydDownShoe_EM_YY, PrimIdentFnDownShoe_EM_YY PrimProtoFnDownShoe_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnMonGradeCommon_EM_YY, ExecuteMagicFunction_EM_YY
pf_dstile.c DownStile PrimFnDownStile_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_dtack.c DownTack PrimFnDownTack_EM_YY PrimFnMonDownTack_EM_YY, PrimFnDydDownTack_EM_YY, PrimIdentFnDownTack_EM_YY PrimProtoFnDownTack_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnDydUpTack_EM_YY
pf_dtackjot.c DownTackJot PrimFnDownTackJot_EM_YY PrimFnMonDownTackJot_EM_YY, PrimFnDydDownTackJot_EM_YY, PrimFnDydDownTackJotFBE_EM_YY PrimProtoFnDownTackJot_EM_YY, PrimProtoFnMixed_EM_YY
pf_epsilon.c Epsilon PrimFnEpsilon_EM_YY PrimFnMonEpsilon_EM_YY, PrimFnDydEpsilon_EM_YY, PrimFnMonEpsilonGlb_EM_YY, PrimFnMonEpsilonImm_EM_YY PrimProtoFnEpsilon_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnMonGradeCommon_EM_YY, PrimFnDydEqualUnderbar_EM_YY
pf_epsund.c EpsilonUnderbar PrimFnEpsilonUnderbar_EM_YY PrimFnMonEpsilonUnderbar_EM_YY, PrimFnDydEpsilonUnderbar_EM_YY PrimProtoFnEpsilonUnderbar_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnDydEqualUnderbar_EM_YY, ExecuteMagicFunction_EM_YY
pf_equal.c Equal PrimFnEqual_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_equalund.c EqualUnderbar NotEqualUnderbar PrimFnEqualUnderbar_EM_YY, PrimFnNotEqualUnderbar_EM_YY PrimFnMonEqualUnderbar_EM_YY, PrimFnDydEqualUnderbar_EM_YY, PrimFnMonNotEqualUnderbar_EM_YY, PrimFnDydNotEqualUnderbar_EM_YY PrimProtoFnEqualUnderbar_EM_YY, PrimProtoFnMixed_EM_YY, PrimProtoFnNotEqualUnderbar_EM_YY
pf_index.c Assignment ArrayIndexRef_EM_YY ArrayIndexRef_EM_YY, ArrayIndexRefLstImm_EM_YY, ArrayIndexRefLstSimpGlb_EM_YY, ArrayIndexRefNamImmed_EM_YY, PrimFnDydSquadGlb_EM_YY, PrimFnMonRightShoe_EM_YY, PrimFnDydRightShoeGlbGlb_EM_YY, ArrayIndexRefRect_EM_YY, ListIndexRef_EM_YY, PrimFnMonLeftShoeGlb_EM_YY, PrimFnMonRho_EM_YY, PrimFnDydRho_EM_YY, ExecFuncStr_EM_YY
pf_iota.c Iota PrimFnIota_EM_YY PrimFnMonIota_EM_YY, PrimFnDydIota_EM_YY, PrimFnMonIotaVector_EM_YY PrimProtoFnIota_EM_YY, PrimProtoFnMixed_EM_YY, ExecuteMagicFunction_EM_YY, PrimFnMonGradeCommon_EM_YY, PrimFnDydEqualUnderbar_EM_YY
pf_iotaund.c IotaUnderbar PrimFnIotaUnderbar_EM_YY PrimFnMonIotaUnderbar_EM_YY, PrimFnDydIotaUnderbar_EM_YY PrimProtoFnIotaUnderbar_EM_YY, PrimProtoFnMixed_EM_YY, ExecuteMagicFunction_EM_YY
pf_lcaret.c LeftCaret PrimFnLeftCaret_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_lcaretund.c LeftCaretUnderbar PrimFnLeftCaretUnderbar_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_lshoe.c LeftShoe PrimFnLeftShoe_EM_YY PrimFnMonLeftShoe_EM_YY, PrimFnDydLeftShoe_EM_YY, PrimFnMonLeftShoeGlb_EM_YY, PrimFnMonLeftShoeCon_EM_YY, PrimFnDydLeftShoeGlb_EM_YY PrimProtoFnLeftShoe_EM_YY, PrimProtoFnMixed_EM_YY
pf_lshoeund.c LeftShoeUnderbar PrimFnLeftShoeUnderbar_EM_YY PrimFnMonLeftShoeUnderbar_EM_YY, PrimFnDydLeftShoeUnderbar_EM_YY PrimProtoFnLeftShoeUnderbar_EM_YY, PrimProtoFnMixed_EM_YY, ExecuteMagicFunction_EM_YY
pf_ltack.c LeftTack PrimFnLeftTack_EM_YY PrimFnMonLeftTack_EM_YY, PrimFnDydLeftTack_EM_YY PrimProtoFnLeftTack_EM_YY, PrimProtoFnMixed_EM_YY
pf_ndcaret.c DownCaretTilde PrimFnDownCaretTilde_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_nequal.c NotEqual PrimFnNotEqual_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_nucaret.c UpCaretTilde PrimFnUpCaretTilde_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_pi.c Pi PrimFnPi_EM_YY PrimFnMonPi_EM_YY, PrimFnDydPi_EM_YY PrimProtoFnPi_EM_YY, PrimProtoFnScalar_EM_YY, PrimProtoFnMixed_EM_YY
pf_plus.c Plus PrimFnPlus_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_qdot.c QuoteDot PrimFnQuoteDot_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_query.c Query PrimFnQuery_EM_YY PrimFnDydQuery_EM_YY PrimFnMon_EM_YY, PrimProtoFnQuery_EM_YY, PrimProtoFnScalar_EM_YY, PrimProtoFnMixed_EM_YY
pf_rcaret.c RightCaret PrimFnRightCaret_EM_YY PrimFnMonRightCaret_EM_YY PrimFnDyd_EM_YY
pf_rcaretund.c RightCaretUnderbar PrimFnRightCaretUnderbar_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_rho.c Rho PrimFnRho_EM_YY PrimFnMonRho_EM_YY, PrimFnDydRho_EM_YY, PrimIdentFnRho_EM_YY, PrimFnMonRhoGlb_EM_YY, PrimFnMonRhoCon_EM_YY PrimProtoFnRho_EM_YY, PrimProtoFnMixed_EM_YY
pf_root.c Root PrimFnRoot_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_rshoe.c RightShoe PrimFnRightShoe_EM_YY PrimFnMonRightShoe_EM_YY, PrimFnDydRightShoe_EM_YY, PrimIdentFnRightShoe_EM_YY, PrimFnMonRightShoeGlb_EM_YY, PrimFnMonRightShoeCon_EM_YY, PrimFnDydRightShoeGlb_EM_YY, PrimFnDydRightShoeImm_EM_YY, PrimFnDydRightShoeImmGlb_EM_YY, PrimFnDydRightShoeGlbGlb_EM_YY PrimProtoFnRightShoe_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnDydCircleSlope_EM_YY
pf_rshoeund.c RightShoeUnderbar PrimFnRightShoeUnderbar_EM_YY PrimFnMonRightShoeUnderbar_EM_YY, PrimFnDydRightShoeUnderbar_EM_YY PrimProtoFnRightShoeUnderbar_EM_YY, PrimProtoFnMixed_EM_YY, ExecuteMagicFunction_EM_YY
pf_rtack.c RightTack PrimFnRightTack_EM_YY PrimFnMonRightTack_EM_YY, PrimFnDydRightTack_EM_YY PrimProtoFnRightTack_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnDydUpTack_EM_YY, PrimFnDydDownTack_EM_YY
pf_section.c Section PrimFnSection_EM_YY PrimFnMonSection_EM_YY, PrimFnDydSection_EM_YY, PrimIdentFnSection_EM_YY PrimProtoFnSection_EM_YY, PrimProtoFnMixed_EM_YY, ExecuteMagicFunction_EM_YY
pf_slash.c Slash PrimFnSlash_EM_YY PrimFnMonSlash_EM_YY, PrimFnDydSlash_EM_YY PrimProtoFnSlash_EM_YY, PrimProtoFnMixed_EM_YY
pf_slope.c Slope PrimFnSlope_EM_YY PrimFnMonSlope_EM_YY, PrimFnDydSlope_EM_YY PrimProtoFnSlope_EM_YY, PrimProtoFnMixed_EM_YY
pf_squad.c Squad PrimFnSquad_EM_YY PrimFnMonSquad_EM_YY, PrimFnDydSquad_EM_YY, PrimIdentFnSquad_EM_YY, PrimFnDydSquadGlb_EM_YY PrimProtoFnSquad_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnMonRho_EM_YY, ArrayIndexRef_EM_YY, PrimFnMonIota_EM_YY
pf_star.c Star PrimFnStar_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_stile.c Stile PrimFnStile_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_tilde.c Tilde PrimFnTilde_EM_YY PrimFnDydTilde_EM_YY, PrimIdentFnTilde_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY, PrimProtoFnTilde_EM_YY, PrimProtoFnScalar_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnDydEpsilon_EM_YY, PrimFnDydSlash_EM_YY
pf_times.c Times PrimFnTimes_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_uarrow.c UpArrow PrimFnUpArrow_EM_YY PrimFnMonUpArrow_EM_YY, PrimFnDydUpArrow_EM_YY, PrimIdentFnUpArrow_EM_YY PrimProtoFnUpArrow_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnMonRho_EM_YY, ArrayIndexRef_EM_YY
pf_ucaret.c UpCaret PrimFnUpCaret_EM_YY PrimFnDyd_EM_YY, PrimFnMon_EM_YY
pf_ushoe.c UpShoe PrimFnUpShoe_EM_YY PrimFnMonUpShoe_EM_YY, PrimFnDydUpShoe_EM_YY PrimProtoFnUpShoe_EM_YY, PrimProtoFnMixed_EM_YY, ExecuteMagicFunction_EM_YY
pf_ustile.c UpStile PrimFnUpStile_EM_YY PrimFnMon_EM_YY, PrimFnDyd_EM_YY
pf_utack.c UpTack PrimFnUpTack_EM_YY PrimFnMonUpTack_EM_YY, PrimFnDydUpTack_EM_YY PrimProtoFnUpTack_EM_YY, PrimProtoFnMixed_EM_YY
pf_utackjot.c UpTackJot PrimFnUpTackJot_EM_YY PrimFnMonUpTackJot_EM_YY, PrimFnDydUpTackJot_EM_YY, PrimFnMonUpTackJotImm_EM_YY, PrimFnMonUpTackJotGlb_EM_YY, PrimFnMonUpTackJotCommon_EM_YY PrimProtoFnUpTackJot_EM_YY, PrimProtoFnMixed_EM_YY, PrimFnMonUpTackGlb_EM_YY


General Reference Notes

Notation Convention on this wiki page: Unless otherwise specified all file names used on this page will exclude their path which is C:\NARS2000\trunk\.

Every programming language uses at least two primary concepts 1) mnemonics and 2) a syntax to implement that language. NARS is no different. Every NARS quad system command has an associated mnemonic or reference name. For example, Quad CR or CR - Canononical Representation - uses mnemonic SysFnCR_EM_YY, as found in its definition file qf_cr.c. Quad FX or FX - Fix or Function eXecute - uses mnemonic SysFnFX_EM_YY, per file qf_fx.c. Note the similarity in file naming conventions for both c files.

Several Quad functions have been implemented using PHP magic functions, for example Quad VR or VR - Visual Representation - uses mnemonic SysFnVR_EM_YY, per definition file qf_vr.c. However, Quad VR also has an additional PHP magic header file called in this case mf_quadvr.h. Quad FMT is similarly coded using a PHP magic function header file.