summaryrefslogtreecommitdiff
path: root/tests/examplefiles/test.bmx
blob: 17b9adaedeedeb304da4158315405d9f9e33acbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

Rem
foobar
EndRem

Rem
	foobar!
End Rem

Rem
End Rem

SuperStrict

Framework brl.blitz
Import brl.standardio

'Import "blah.bmx"
'Import "blah/blah.bmx"
'Include "blurg/blurg.bmx"

Const ca:Long = $10000000 ' Hex
Const cb:Int = %10101010 ' Binary
Global ga:String = "blargh"
Local a:Int = 124, b$ = "abcdef"
?Not Debug
Print(_name123(ga, a, 100.2))
?

Function _name123  : Float  (zorp:String, ll:Int = False, blah#, waffles% = 100)
	Return 235.7804 ' Single-line comment
End Function
Function TestString:String()
End Function
Function TestByte:Byte()
End Function

Function hub(blah:String, ..
				abc:Int = Pi)
End Function
Function Blar%()
	Local aa !, ab @ ,ac @@, ad# ,ae$,af% ' Intentional mangling
	Local ba:Double, bb :Byte, bc: Short,bd:Float,be: String,ff:Int = True
End Function

?Win32
abc()
?Linux
abc()
?

Function abc()
	Print "abc"	' I cannot find a way to parse these as function calls without messing something up
	Print		' Anyhow, they're generally not used in this way
	Goto Eww_Goto
	#Eww_Goto
End Function

Type TBlarf Abstract
End Type

Type TFooBar
End Type

New MyClass.TestMethod()
New(MyClass).TestMethod()
Local myinst:MyClass = New MyClass
myinst.TestMethod()

Type MyClass Extends TFooBar
	
	Field m_foo:MyClass
	Field m_bar:MyClass
	
	Rem
		abc
		def
	End Rem
	Method New()
		Rem
			abcdef
		endrem
	End Method
	
	Method TestMethod() ' foobar
		m_foo = Self
		m_bar = MyClass(m_foo)
		m_foo.m_bar.m_foo.m_bar.Yell()
	End Method
	
	Method Yell()
		Print("huzzah!")
	End Method
	
	Function Wakka$(foo:String)
		Return foo + "bar"
	End Function
	
End Type

Extern "c"
	Function vesper!(a:Int) = "vesper@4"
	Function bubbles@@(a%)
End Extern

Print("blah " + ..
	"blah " + ..
	"blah.")

Try
	Throw("blar!")
Catch exception:String
	Print("Caught: " + exception)
End Try

For Local i:Int = 0 To 10 Step 1
	Print("Index: " + i)
Next
Local array:String[] = ["foo", "bar", "11", "22", "33"]
For Local value:String = EachIn array
	Print("Value: " + value)
Next

Local foobar:Int = Not (1 Or (2 And (4 Shl 5 Shr 6)) Sar 7) Mod (8+2)
Local az:Int = 1234567890
az : + 1
az: - 2
az :* 3
az:/ 4
az:& 5
az:| 6
az: ~ 7
az : Shl 8
az:  Shr 9
az :Sar 10
az:Mod 11
az = ((10-5+2/4*2)>(((8^2)) < 2)) & 12|2

Function flub(fah Ptr, eah:Int Ptr, blu@@ Ptr)
End Function
Function Foob:Int Ptr(blar:Byte Ptr, Saffon@Ptr, blaus#Ptr)
End Function
Function zauus@Ptr()
End Function