Skip to content

Commit ac82f87

Browse files
committed
class unions.
1 parent 6812968 commit ac82f87

File tree

17 files changed

+184
-62
lines changed

17 files changed

+184
-62
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
- [Pointers](doc/pointers.md)
7474
- [Quiet function call](doc/quiet.md)
7575
- [Register variables](doc/register.md)
76+
- [Class unions](doc/union.md)
7677

7778
### Other info
7879

doc/directives.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Example:
2222

2323
```cpp
24-
new.int,undeftest=1
24+
new[int]undeftest=1
2525

2626
if.equ,defined?undeftest,1->console.println.log("undeftest is defined")
2727

@@ -70,31 +70,31 @@ var=73
7070
- Changes a return value.
7171

7272
```cpp
73-
new.int,ADDRESSOFTEST=0
73+
new[int]ADDRESSOFTEST=0
7474
#emit:addrset,addressof?ADDRESSOFTEST
7575
#emit:vlset,23746
7676

7777
console.cout.log(ADDRESSOFTEST)
7878

79-
new.bool,ADDRESSOFTEST2=false
79+
new[bool]ADDRESSOFTEST2=false
8080
#emit:addrset,addressof?ADDRESSOFTEST2
8181
#emit:vlset,true
8282

8383
console.cout.log(ADDRESSOFTEST2)
8484

85-
new.str,ADDRESSOFTEST3="000"
85+
new[str]ADDRESSOFTEST3="000"
8686
#emit:addrset,addressof?ADDRESSOFTEST3
8787
#emit:vlset,"#emit works!"
8888

8989
console.println.log(ADDRESSOFTEST3)
9090

91-
new.double,ADDRESSOFTEST4=0.0
91+
new[double]ADDRESSOFTEST4=0.0
9292
#emit:addrset,addressof?ADDRESSOFTEST4
9393
#emit:vlset,23.746
9494

9595
console.cout.log(ADDRESSOFTEST4)
9696

97-
new.char,ADDRESSOFTEST5='0'
97+
new[char]ADDRESSOFTEST5='0'
9898
#emit:addrset,addressof?ADDRESSOFTEST5
9999
#emit:vlset,'K'
100100

@@ -131,7 +131,7 @@ true
131131
- Create an integer variable, change its data type to `char`, set a value, and then print the value.
132132

133133
```cpp
134-
new.int,ADDRESSOFTEST6=1
134+
new[int]ADDRESSOFTEST6=1
135135
#emit:addrset,addressof?ADDRESSOFTEST6
136136
#emit:dtyp,5
137137
#emit:vlset,'Z'
@@ -150,7 +150,7 @@ Output:
150150
- Change the symbol name.
151151

152152
```cpp
153-
new.int,ADDRESSOFTEST7=364
153+
new[int]ADDRESSOFTEST7=364
154154
#emit:addrset,addressof?ADDRESSOFTEST7
155155
#emit:csnm,__ADDRESSOFTEST7
156156

@@ -168,7 +168,7 @@ Output:
168168
- Set the value of the primary register to the value stored inside the loaded address.
169169

170170
```cpp
171-
new.int,var=1
171+
new[int]var=1
172172
#emit:addrset,addressof?var
173173
#emit:load.pri
174174
```
@@ -180,7 +180,7 @@ new.int,var=1
180180
- Set the value of the alternate register to the value stored inside the loaded address.
181181

182182
```cpp
183-
new.int,var=1
183+
new[int]var=1
184184
#emit:addrset,addressof?var
185185
#emit:load.alt
186186
```
@@ -211,10 +211,10 @@ new.int,var=1
211211

212212
### `stor.pri`
213213

214-
- Set the value of the primary register to a constant value not loaded with `addrset`.
214+
- Store the value of the primary register into a loaded address.
215215

216216
```cpp
217-
new.int,var=1
217+
new[int]var=1
218218
#emit:addrset,addressof?var
219219
#emit:const.pri,6
220220
#emit:stor.pri
@@ -229,7 +229,7 @@ new.int,var=1
229229
- Store the value of the alternate register into a loaded address.
230230

231231
```cpp
232-
new.int,var=1
232+
new[int]var=1
233233
#emit:addrset,addressof?var
234234
#emit:const.alt,6
235235
#emit:stor.alt

doc/enum.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace Me
7979
console.rawout(Me::Family.Mom+Me::Family.Dad)
8080
```
8181

82-
### `constexpr enum` and `using enum`
82+
### `final enum` and `using enum`
8383

8484
```cpp
8585
console.println("Const expr enum test:")
@@ -92,7 +92,7 @@ namespace ConstexprTest
9292
w
9393
e
9494
}
95-
constexpr enum MyConstEnum
95+
final enum MyConstEnum
9696
{
9797
q
9898
w

doc/errors.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ new.int,hey=9; // Error.
6262

6363
```cpp
6464
@hook=j
65-
constexpr=namespace UUUUU+class+enum
65+
final=namespace UUUUU+class+enum
6666
inT func() publex{
6767
retern,0
6868
}
69+
union str[int]
6970
```

doc/for.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Example
66

77
```cpp
8-
new.int,forlooptestvar=0
8+
new[int]forlooptestvar=0
99
if.equ,1,1->for.int,forlooptestvar,10->console.println("For loop id {forlooptestvar}")
1010
```
1111

doc/misc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exit
1212
- You can format any string argument in any form.
1313

1414
```cpp
15-
new.str,test="Test string"
15+
new[str]test="Test string"
1616

1717
console.println("{test}")
1818
```
@@ -39,7 +39,7 @@ Test string
3939
## `defined` instruction
4040
4141
```cpp
42-
new.int,variable=1
42+
new[int]variable=1
4343
4444
if.equ,defined?variable,1->console.println("'variable' is defined!")
4545
if.equ,defined?dummyvar,1->console.println("This should not be printed!!")

doc/objclass.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ class TestClass
99
new[double]TestClassDouble=364.234
1010
}
1111

12-
object TestObj=TestClass
13-
console.cout.log(TestObj.ClassTestVar)
14-
console.cout.log(TestObj.TestClassDouble)
12+
TestClass<explicit>TestObj
13+
console.rawout.log(TestObj.ClassTestVar)
14+
console.rawout.log(TestObj.TestClassDouble)
1515
console.println.log("#1 {TestObj.ClassTestVar} & {TestObj.TestClassDouble}")
1616

17-
object TestObj2=TestClass
17+
TestClass<explicit>TestObj2
1818
TestObj2.ClassTestVar=9376216
1919
TestObj2.TestClassDouble=314.159267243
20-
console.cout.log(TestObj2.ClassTestVar)
21-
console.cout.log(TestObj2.TestClassDouble)
20+
console.rawout.log(TestObj2.ClassTestVar)
21+
console.rawout.log(TestObj2.TestClassDouble)
2222
console.println.log("#2 {TestObj2.ClassTestVar} & {TestObj2.TestClassDouble}")
2323

2424
class TestClass2
@@ -28,9 +28,9 @@ class TestClass2
2828
new[bool]TestClassBool=false
2929
}
3030

31-
object TestObj3=TestClass2
32-
console.cout.log(TestObj3.ClassTestVar)
33-
console.cout.log(TestObj3.TestClassDouble)
31+
TestClass2<explicit>TestObj3
32+
console.rawout.log(TestObj3.ClassTestVar)
33+
console.rawout.log(TestObj3.TestClassDouble)
3434
console.println.log("#3 {TestObj3.ClassTestVar} & {TestObj3.TestClassDouble} & {TestObj3.TestClassBool}")
3535
```
3636
@@ -58,7 +58,7 @@ namespace testnamespace
5858
}
5959
}
6060
61-
object Obj=testnamespace::testclass
61+
testnamespace::testclass<explicit>Obj
6262
Obj.testinteger=13
6363
std::writeln("{Obj.testinteger}")
6464
```
@@ -94,7 +94,7 @@ class HumanBeing
9494
public eat2=>test::__eat2
9595
}
9696

97-
object MeAgain=HumanBeing
97+
HumanBeing<explicit>MeAgain
9898

9999
MeAgain.eat()
100100
console.println.log("MeAgain.name is {MeAgain.name}")

doc/oper.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ class MyFuncs
145145
private myFunc=>myBluePrint
146146
}
147147

148-
object MyObj=MyFuncs
148+
MyFuncs<explicit>MyObj
149149
// This will do foo and return 4:
150-
MyFuncs.myFunc()
150+
MyObj.myFunc()
151151
```
152152
153153
### Operator: `|`

doc/private.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void myPrivateFunc() private
1111
Doing this in your Pawn script will not work:
1212
```pawn
1313
#include <open.mp>
14-
#include <a_pawnscript>
14+
#include <pawnscript_sdk>
1515
1616
main()
1717
{

doc/retref.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
```cpp
66
#pragma:reqref,true
77

8-
new.int.unsigned,ReturnReference__=9283
8+
new[int.unsigned]ReturnReference__=9283
99

1010
console.println("Heyy"); // This will give a warning.
1111

0 commit comments

Comments
 (0)