March 21, 2017

BASIC Command Options

BASIC

The MV# BASIC command creates executable code for use by the Microsoft .NET or Mono Common Language Runtime (CLR).

Syntax

BASIC filename [programs|*] [(options]

Results

The BASIC command converts MV# BASIC source code into C# and compiles it using the C# compiler to create a managed DLL. MVON# names the resulting DLL progname.dll where progname is the name of the program being compiled. The DLL record is written to the file filename.Lib. If filename.Lib does not exist, then it is created.

If there is an active select list present, then the programs in the list will be compiled.

filename  is the name of the file containing the program or programs to be compiled, the file must be a DIRECTORY type file.

programs is a list of one or more programs to be compiled. If a select list is active, then the programs in the list will be compiled.

* specifies all programs in a file

options       G – The G option generates the C# source code for the MV# program and the output is written to the directory /src in the filename.Lib file with a name of progname.src

                  D – compiles the program for debug mode, creating a Program Debug Database file (.pdb) in the form progrname.pdb.

The following MV# code segment:

 >ED BP EXECUTE
 4 lines long.
 ----: P 
Top. 
0001: EXECUTE 'COUNT VOC' RETURNING ERRORS CAPTURING OUTPUT 
0002: CRT 'ERRORS = ':ERRORS 
0003: DEBUG 
0004: CRT 'OUTPUT = ':OUTPUT 
Bottom at line 4.

When compiled with the G option, generates the following C# code segment:

using System;
using System.Collections.Generic;
using System.Collections;

using System.Text;
using BasicRuntime;
using HashedFile;
using ExtensionMethods;
using DynArray;
using DimArray;
using BasicDebugger;
namespace EXECUTE
{
 public class _Program
 {
 DynamicArray ERRORS = new DynamicArray();
 DynamicArray OUTPUT = new DynamicArray();
 dynamic _print = "";
 object[] _args;
 DynamicArray _subrArg = new DynamicArray();
 DynamicArray _execstring;
 DynamicArray _capturing;
 DynamicArray _passlist;
 DynamicArray _returning;
 DynamicArray _rtnlist;
 DynamicArray _setting;
 bool _returnToSet = false;
 bool _CommonSet = false;
 string __routine = "";
 public bool __debuggerOn = false;
 public Session _session
 {
 get { return _internalSession; }
 set { _internalSession = value; }
 }
 Session _internalSession = null;
 // Source code for EXECUTE
 public void main()
 {
 if (!_CommonSet)
 {
 _CommonSet = true;

}

_process("_main:");
 }
 private void _process(string _routine)
 {
 _start:
 if (__routine != "")
 {
 _routine = __routine;
 __routine = "";
 }
 switch (_routine)
 {
 case "_main:":
 ;
 _execstring = "COUNT VOC";
 _capturing = OUTPUT;
 _passlist = null;
 _rtnlist = null;
 _setting = ERRORS;
 Functions.EXECUTE(_execstring, ref _capturing, _passlist, ref _rtnlist, ref _setting);
 OUTPUT = _capturing;
 ERRORS.SetValue(_setting); ;
 _print = (("ERRORS = ").Append(ERRORS));
 Functions.CRT(_print, false);
 _print = (("OUTPUT = ").Append(OUTPUT));
 Functions.CRT(_print, false);
 _print = (("HELLO"));
 Functions.CRT(_print, false);

break;

}
 _exit1:;
 }
 public void initialise()
 {
 ERRORS.Clear();
 OUTPUT.Clear();

}

}
}

Compiled with both the D and G options, the following code segment is generated:

using System;
using System.Collections.Generic;
using System.Collections;

using System.Text;
using BasicRuntime;
using HashedFile;
using ExtensionMethods;
using DynArray;
using DimArray;
using BasicDebugger;
namespace EXECUTE
{
 public class _Program : BasicDebugger.BasicDebugger
 {
 DynamicArray ERRORS = new DynamicArray();
 DynamicArray OUTPUT = new DynamicArray();
 dynamic _print = "";
 object[] _args;
 DynamicArray _subrArg = new DynamicArray();
 DynamicArray _execstring;
 DynamicArray _capturing;
 DynamicArray _passlist;
 DynamicArray _returning;
 DynamicArray _rtnlist;
 DynamicArray _setting;
 bool _returnToSet = false;
 bool _CommonSet = false;
 string __routine = "";
 string __sourceLine = "";
 string __routineName = "EXECUTE";
 string __sourcePath = @"BP";
 string __accountName = "PETER";
 public bool __debuggerOn = false;
 public Session _session
 {
 get { return _internalSession; }
 set { _internalSession = value; }
 }
 Session _internalSession = null;
 // Source code for EXECUTE
 public void main()
 {
 if (!_CommonSet)
 {
 _CommonSet = true;

}

this.GetSourceCode(__routineName, __sourcePath);
 __debuggerOn = _session.debugIsOn;
 _process("_main:");
 }
 private void _process(string _routine)
 {
 _start:
 if (__routine != "")
 {
 _routine = __routine;
 __routine = "";
 }
 switch (_routine)
 {
 case "_main:":
 ;
 _session.CurrentLine = "1";
 if (__debuggerOn) { Debug("1", __routineName, this, _session.DebugIgnore); }
 _execstring = "COUNT VOC";
 _capturing = OUTPUT;
 _passlist = null;
 _rtnlist = null;
 _setting = ERRORS;
 Functions.EXECUTE(_execstring, ref _capturing, _passlist, ref _rtnlist, ref _setting);
 OUTPUT = _capturing;
 ERRORS.SetValue(_setting); ;
 _session.CurrentLine = "2";
 if (__debuggerOn) { Debug("2", __routineName, this, _session.DebugIgnore); }
 _print = (("ERRORS = ").Append(ERRORS));
 Functions.CRT(_print, false);
 _session.CurrentLine = "3";
 if (__debuggerOn) { Debug("3", __routineName, this, _session.DebugIgnore); }
 __debuggerOn = true;
 _session.CurrentLine = "4";
 if (__debuggerOn) { Debug("4", __routineName, this, _session.DebugIgnore); }
 _print = (("OUTPUT = ").Append(OUTPUT));
 Functions.CRT(_print, false);
 _session.CurrentLine = "5";
 if (__debuggerOn) { Debug("5", __routineName, this, _session.DebugIgnore); }
 _print = (("HELLO"));
 Functions.CRT(_print, false);

break;

}
 _exit1:;
 }
 public void initialise()
 {
 ERRORS.Clear();
 OUTPUT.Clear();

}

}
}

In the above sample MV# program, when the DEBUG statement is encountered, and the program has been compiled with the D option, a :: prompt is displayed.

? will display the current program name and line number

S will step to the next line

G continues program execution

About dwolthuis

https://www.linkedin.com/in/dawnwolthuis

Category

Documentation, MV#

Tags

, ,