Update scripts to reflect capability of the mscript interpreter right now. No set within loops. Resolves #10
This commit is contained in:
parent
c365eff6a7
commit
b51b7e8481
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.136",
|
"version": "1.8.137",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -510,8 +510,8 @@ class Mscript {
|
||||||
* @param line {string} String containing set statement
|
* @param line {string} String containing set statement
|
||||||
*/
|
*/
|
||||||
set_state(line) {
|
set_state(line) {
|
||||||
//console.log(`set_state called: ${line}`);
|
|
||||||
const update = {};
|
const update = {};
|
||||||
|
let dist = 0;
|
||||||
if (line.startsWith('SET CAM2')) {
|
if (line.startsWith('SET CAM2')) {
|
||||||
update.cam2 = parseInt(line.split('SET CAM2')[1]);
|
update.cam2 = parseInt(line.split('SET CAM2')[1]);
|
||||||
}
|
}
|
||||||
|
@ -530,19 +530,14 @@ class Mscript {
|
||||||
else if (line.startsWith('SET PROJ')) {
|
else if (line.startsWith('SET PROJ')) {
|
||||||
update.proj = parseInt(line.split('SET PROJ')[1]);
|
update.proj = parseInt(line.split('SET PROJ')[1]);
|
||||||
}
|
}
|
||||||
//console.log(JSON.stringify(update));
|
|
||||||
if (this.rec > -1) {
|
if (this.rec > -1) {
|
||||||
for (let key of Object.keys(update)) {
|
this.fail(`Line "${line}" is invalid inside of a loop`);
|
||||||
this.loops[this.rec][key] = update[key];
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (let key of Object.keys(update)) {
|
for (let key of Object.keys(update)) {
|
||||||
this[key] = update[key];
|
this[key] = update[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.dir(JSON.stringify(this));
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Return the last loop
|
* Return the last loop
|
||||||
*
|
*
|
||||||
|
@ -669,7 +664,8 @@ class Mscript {
|
||||||
*/
|
*/
|
||||||
update(cmd, val = 1) {
|
update(cmd, val = 1) {
|
||||||
if (cmd === 'END') {
|
if (cmd === 'END') {
|
||||||
//I don't understand this loop
|
//squashes down loops into the previous one until
|
||||||
|
//the base is reached. val is never not 1, though.
|
||||||
for (let i = 0; i < val; i++) {
|
for (let i = 0; i < val; i++) {
|
||||||
if (this.rec === 0) {
|
if (this.rec === 0) {
|
||||||
this.cam += this.loops[this.rec].cam;
|
this.cam += this.loops[this.rec].cam;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.136",
|
"version": "1.8.137",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.136",
|
"version": "1.8.137",
|
||||||
"description": "GUI for the mcopy small gauge film optical printer platform",
|
"description": "GUI for the mcopy small gauge film optical printer platform",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.136",
|
"version": "1.8.137",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.136",
|
"version": "1.8.137",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.136",
|
"version": "1.8.137",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"alert": "file:app/lib/alert",
|
"alert": "file:app/lib/alert",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.136",
|
"version": "1.8.137",
|
||||||
"description": "Small gauge film optical printer platform",
|
"description": "Small gauge film optical printer platform",
|
||||||
"main": "build.js",
|
"main": "build.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.136",
|
"version": "1.8.137",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -577,8 +577,8 @@ export default class Mscript {
|
||||||
* @param line {string} String containing set statement
|
* @param line {string} String containing set statement
|
||||||
*/
|
*/
|
||||||
private set_state (line : string) {
|
private set_state (line : string) {
|
||||||
//console.log(`set_state called: ${line}`);
|
|
||||||
const update : MscriptUpdatedState = {};
|
const update : MscriptUpdatedState = {};
|
||||||
|
let dist : number = 0;
|
||||||
if (line.startsWith('SET CAM2')) {
|
if (line.startsWith('SET CAM2')) {
|
||||||
update.cam2 = parseInt(line.split('SET CAM2')[1]);
|
update.cam2 = parseInt(line.split('SET CAM2')[1]);
|
||||||
} else if (line.startsWith('SET CAMERA2')) {
|
} else if (line.startsWith('SET CAMERA2')) {
|
||||||
|
@ -592,18 +592,14 @@ export default class Mscript {
|
||||||
} else if (line.startsWith('SET PROJ')) {
|
} else if (line.startsWith('SET PROJ')) {
|
||||||
update.proj = parseInt(line.split('SET PROJ')[1]);
|
update.proj = parseInt(line.split('SET PROJ')[1]);
|
||||||
}
|
}
|
||||||
//console.log(JSON.stringify(update));
|
|
||||||
if (this.rec > -1) {
|
if (this.rec > -1) {
|
||||||
for (let key of Object.keys(update)) {
|
this.fail(`Line "${line}" is invalid inside of a loop`);
|
||||||
(this.loops[this.rec] as any)[key] = (update as any)[key];
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (let key of Object.keys(update)) {
|
for (let key of Object.keys(update)) {
|
||||||
(this as any)[key] = (update as any)[key];
|
(this as any)[key] = (update as any)[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.dir(JSON.stringify(this));
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Return the last loop
|
* Return the last loop
|
||||||
*
|
*
|
||||||
|
@ -730,7 +726,8 @@ export default class Mscript {
|
||||||
*/
|
*/
|
||||||
private update (cmd : string, val : number = 1) {
|
private update (cmd : string, val : number = 1) {
|
||||||
if (cmd === 'END') {
|
if (cmd === 'END') {
|
||||||
//I don't understand this loop
|
//squashes down loops into the previous one until
|
||||||
|
//the base is reached. val is never not 1, though.
|
||||||
for (let i = 0; i < val; i++) {
|
for (let i = 0; i < val; i++) {
|
||||||
if (this.rec === 0) {
|
if (this.rec === 0) {
|
||||||
this.cam += this.loops[this.rec].cam;
|
this.cam += this.loops[this.rec].cam;
|
||||||
|
|
Loading…
Reference in New Issue