Releases: M2000Interpreter/Environment
Version 12, Revision 34
- Remove a bug from rev 33, so now eertree module run as expected.
- Now print to One Note for Windows 10 works. I found the need for placing a document name to printer, which some other printers not needed - like "Microsoft Print to PDF" which works with empty document name. So now M2000 insert a dummy documen name "M2000 printing" and we get the printout.
Version 12, Revision 32
- Remove bug at Stack Stack(a) where Stack( not trated as function but as array (which didn't exist). See example ranking in info.gsb (now works fine).
- Update info.gsb for (1) and for two modules:
2.1 Module Pyth (now adjust Pythagorian Tree better for any screen ratio scale.x/scale.y).
2.2 Module machinecode2 correct a typo at first label (M200 to M2000).
module showme {
flush // stack tems now are 9, for current stack
dim a(10)
a(4)=stack:=1,2,3,4 // place at a(4) as stack object
stack stack(a(4)) // get a copy of stack object of a(4)
stack // display stack items
flush
print a(4) // display stack items from a(4)
stack a(4) // place stack items from a(4) to current stack - not a copy
print len(a(4))=0 // empty stack object
clear // clear variables fro this point
flush
dim a(10)
a(4)="1 2 3 4" // now a(4) has a string value in a format which statement stack can handle
stack a(4), "NN" // get 2 numbers from a string value
stack
print stack.size
print len(a(4))
flush
dim a$(10)
a$(4)=stack$(1,2,"hello",4) // make a string for numbers/strings for statement stack
stack a$(4) // all
stack
print stack.size=4
print len(a$(4))
flush
}
showme
Version 12, Revision 31
Most of modules on Info.gsb checked, plus all programs from GreekManual.pdf. All bugs removed.
Ver12rev29: Revision 29 Version 12
Fix some bugs (from revision 25). Setup file has two pdf files, one English and one Greek.
z=lambda (x)->x**2
group alfa {
private:
inventory a= "ok":=z
public:
module testme {
print .a("ok")(3)
}
}
alfa.testme
Version 12 Revision 27
Latest release:
fix using array for string values without using suffix $, for Read, for operator +=, for variant type (testB) and string type (testA)
Module testA {
dim a(10) as string
push "ok"
read a(3)
print a(3)
a(3)+="..."
Print a(3)
module check(&z) {
z+="..."
}
check &a(2)
print a(2)
}
testA
Module testB {
dim a(10)
push "ok"
read a(3)
print a(3)
a(3)+="..."
a(2)+="..."
Print a(3), a(2)
a(1)="" // without "" we get z as number so we get error
module check(&z) {
z+="..."
}
check &a(1)
print a(1)
}
testB
Version 12, Revision 24
- Fix a bug introduced on latest revisions, which prevent the gates AND/OR/XOR to operate after the use of programmable logic operator on groups:
class AType {
private:
x=1
public:
operator "<=" (z as Atype) {
push .x<=z.x
}
class:
module Atype(.x) {
}
}
B=Atype(1)
C=Atype(1)
Print (B <= C) and true ' now is ok
Print B <= C and true ' now is ok
- Fix LINE INPUT to work with string variables without suffix $ (also added for arrays without suffix$).
string buf
open "d.txt" for output as #F
print #F, "123213 123 12 312 3123"
close #F
open "d.txt" for input as #F
line input #F, buf
close #F
print buf="123213 123 12 312 3123" ' true
dim buf(10) as string
open "d.txt" for output as #F
print #F, "123213 123 12 312 3123"
close #F
open "d.txt" for input as #F
line input #F, buf(1)
close #F
print buf(1)="123213 123 12 312 3123" ' true
- More modules in info.gsb: STRLEN, BIG
Version 12, Revision 23
We can use enum type for properties:
class ALFA {
enum aaa {
yes="yes"
no="no"
}
property a {
value, set
}
module what {
? type$(.[a])
}
class:
module alfa {
.[a]<=.yes
}
}
aGroup=alfa()
? aGroup.a
aGroup.a=aGroup.no
? aGroup.a
aGroup.what
push eval$(aGroup.yes)
read aGroup.a
? aGroup.a
input aGroup.a // take no or yes but anything else return error
? aGroup.a
The same for numeric type enum type:
class ALFA {
enum aaa {
yes=100
no=200
}
property a {
value, set
}
module what {
? type$(.[a])
}
class:
module alfa {
.[a]<=.yes
}
}
aGroup=alfa()
aGroup.what
? aGroup.a
aGroup.a=aGroup.no
? aGroup.a
aGroup.what
push aGroup.no
read aGroup.a
? aGroup.a
aGroup.what
input aGroup.a
? aGroup.a
Version 12, Revision 22
New module: OCTAL (octal counter).
Version 12, Revision 20
Repaired evaluator parser (had a mistake: eg at 2/3^(3-4) the operator / executed as *). Also there is a better module Evaluator, and a new one Eval2 on Info.gsb.
Version 12, Revision 16
Date type. Suffix for byte ub, so 0x1Aub, 0x1A_ub, &h1Aub, &h1A_ub, 200ub are bytes.
Suffix for date, for number literal ud, so 44978ud is same as date("21/2/2023"), return date type.
Enumeration statement can use other enumerations (and we can make private at Group level):
Interpreter extract information from object (which is a enum type variable), and can deal with members of enum although the actual objects are out of scope (we can see that using Try {Print Type$(aaa)} can't work, the aaa not exist at the scope of module, but at the scope of class, as private member. Only m and mm are public. Here Interpreter before raise error check the lastenum (internal variable at local storage of the running object) and find it. This not happen at Type$(), so there we get error.
About running object: modules and functions run by a running object. This object hold some information, among other the layer where the print statement prints. Threads/Events run on separate running objects, although they have same scope as the scope of the module/function where we create/handle them. Subs and simple functions run on parent's running object. Running objects may have static variables, and at the end of execution leave a collection of static variables to the caller's running object, so at the next call this collection attach to running object and the static variables can be used. Threads may have own static variables too. A global module can called from anywhere, but the collection of static variables will be different because each entry from different calling chain, use specific collection of static variables.
class zeta {
private:
enum beta {
kkk
aaa=100
bbb
}
enum alfa {
beta ' add member of beta to alfa
epsilon
}
public:
m as alfa=aaa
mm as beta=bbb
}
zeta=zeta()
? zeta.m, zeta.mm
select case zeta.m
case aaa
? "yes"
end select
select case zeta.mm
case bbb
? "yes"
end select
Try {Print type$(bbb)} // nothing displayed
zeta.m=bbb
? zeta.m=101
We can use pointer to object (so the object's life depends of number of pointers to it). The previous example use a static object, zeta which erased at the exit of module. If we do this zeta2=zeta, we get a copy of zeta, to another static object. But with pointer a zeta2=zeta make an new pointer. We can make pointers to static objects, and internal is just a weak reference (so actually this pointer has nothing to do with life of this object).
zeta->zeta() // this is the same as zeta=pointer(zeta()) // pointer() is the null pointer (which is an object).
? zeta=>m, zeta=>mm
select case zeta=>m
case aaa
? "yes"
end select
select case zeta=>mm
case bbb
? "yes"
end select
Try {Print type$(bbb)}
zeta=>m=bbb
? zeta=>m=101