-
Notifications
You must be signed in to change notification settings - Fork 4
Hello World
To run these example you have to install binaries or run in M2000.Vbp in one VB6 ide (use Greek fonts, from editor options before loading this Vbp) and then run it, then open in a second VB6 ide the mexe.Vbp and run it (this call the M2000.dll which the first make available).
Open M2000 interpreter by running M2000.exe (this use M2000.dll, the interpreter). Intepreter can be used as a script language inside other programs. Program M2000.exe use this to call M2000.
1. Using a Module HelloWorld
Module HelloWorld { Print "Hello World" } : HelloWorld2. Using a Function HelloWorld
Function HelloWorld$ { ="Hello World" } : Print HelloWorld$()3. Using a Group HelloWorld calling a module inside group
Group HelloWorld { Module Hello {Print "Hello World" } } : HelloWorld.Hello4.Using a Group HelloWorld using a function inside group
Group HelloWorld { Function Print$ {= "Hello World" } } : Print HelloWorld.Print$()5. From manual mode just execute the command
Print "Hello World"All examples above can run from command line interpreter, or from any module or function.
Advanced Examples I
6. Using Lambda Function
A$=lambda$->"Hello World"
Print A$()7. Using Event (multi cast)
Event A {
Read What$
Function {
Print "Hello "+What$
}
}
Function Delegate {
Read What$
Print "Again Hello "+What$
}
Event A new Delegate()
Call Event A, "World"Advanced Examples II
11. Using Inventory
Inventory alfa = "Hello":="Hello World"
Print alfa$("Hello")12. Using Stack Object
A=Stack:="Hello World"
\\ Print Len(A)
Stack A { Print Letter$}
\\ Print Len(A)13. Using Buffer
Buffer Clear alfa As Byte* 100
Return alfa, 20:="Hello World"
Print Eval$(alfa, 20,30)14. Using Pointer to Array
A=("Hello World",)
Link A to A$()
Print A, Len(A), A$(0)15. Using Array in Array
Dim A$(10)="Hello World", B$(2)
B$(0)=A$() : Print B$(0)(0)16. Using Form
Declare Hello Form
With Hello, "Title","Hello World", "top", 3000, "left", 2000
Method Hello, "Show", 1
Declare Hello NothingAll advanced examples need to open editor inside M2000:
Write Edit A and press Enter to open editor for module A. Then paste the code, then press Esc to exit. Now you can write A and press Enter to run it. You can have many modules, just make some other with names like B or C or whatever (letter first).
Use these from M2000 console:
Settings or use Ctrl+U to open Settings Dialog
Help
Help All (if nothing happen (no form popup) then you have to install Access2007 runtime)
End to exit M2000 console
Modules ? to see modules by name
Save examples to save them as examples.gsb
New to erase all modules in memory
Load examples to load examples.gsb with all modules
Remove remove last module (as we see in Modules ?)
Dir to check current dir. Write Module to check only for gsb files.
Edit “examples.gsb” to edit modules from file in disk
Cls,0 Clear screen and set split screen to first line (0)
Form 60,40 Change character size to fit 60 chars per line in 40 lines
Form to cut background form in same size as console. This used in Linux if you can’t get the Ubuntu menu.
Window 16, 12000,8000; Center console with 16pt font size, in a form 12000X8000 twips.
Clear Clear global variables and static variables.
Flush Flush stack of values
Test A run module A opening Control Form.
Esc, Break, Ctrl+C can be used for controling by keyboard the execution of programs in M2000.
Ctrl+N Execute Modules ?
Ctrl+M Execute Modules
Ctrl+A save all modules to disk (if there was a load or save before)
Ctr+V to paste code in command line
Use arrows up and down to see previous inputs. Use Edit without parameters to open these inputs as a text in editor.