Compare commits
167 Commits
dev
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
0127237c37 | ||
|
0ff101d2b9 | ||
|
5ac36a1ad5 | ||
|
0c19a9ac12 | ||
|
7dafeb2ba7 | ||
|
4262836191 | ||
|
2fcbdadc89 | ||
|
891d3e32a3 | ||
|
aa2a2d36d9 | ||
|
4a75b5daf2 | ||
|
1885928a90 | ||
|
9e14e72fc9 | ||
|
e87d2de342 | ||
|
d67f277a74 | ||
|
32b74d95c5 | ||
|
654ffb2a55 | ||
|
91adc1a764 | ||
|
db02851040 | ||
|
280b4a4670 | ||
|
a385156f8a | ||
|
ecb9574fc3 | ||
|
5c5c4a32db | ||
|
b7abc97c06 | ||
|
bc966e5a89 | ||
|
1641e4c1e1 | ||
|
ec340df654 | ||
|
73e6f83ad1 | ||
|
1b923784fc | ||
|
c4dcd0165e | ||
|
908564a182 | ||
|
c1eb9b0c9b | ||
|
900fe95462 | ||
|
40f9e5a4b2 | ||
|
1b72759cf5 | ||
|
5b0867f218 | ||
|
a433dda772 | ||
|
f85be26ba9 | ||
|
1a127eb342 | ||
|
d3690ff006 | ||
|
cb339d6ae3 | ||
|
68ff757f96 | ||
|
e0dacaab85 | ||
|
d27653ad9c | ||
|
456258604e | ||
|
d62f9e2c8a | ||
|
89a6429913 | ||
|
fc1ddeb4e7 | ||
|
b81f96d209 | ||
|
e69ab1ae9f | ||
|
a599f04ea7 | ||
|
164b125bf2 | ||
|
8423d296ad | ||
|
8e7170d058 | ||
|
99fb7f24ba | ||
|
4f83e351d8 | ||
|
8ccd22131a | ||
|
6ce07d7ff3 | ||
|
576b613188 | ||
|
1c31089351 | ||
|
f99a56542a | ||
|
817c07dabf | ||
|
18d2b89358 | ||
|
a05cadf843 | ||
|
e108b537e0 | ||
|
ed35ad9c73 | ||
|
db0bf9af24 | ||
|
ccdf404feb | ||
|
1307897a1f | ||
|
b2d5efad0b | ||
|
1dac9413ac | ||
|
742a7bf2e9 | ||
|
1581bac571 | ||
|
5693d3fcd0 | ||
|
bf92756d2b | ||
|
f7f3a33d0e | ||
|
5297742d6a | ||
|
b844c7154b | ||
|
8d9bb51039 | ||
|
9059f3b04f | ||
|
b6f089d115 | ||
|
8643771f66 | ||
|
d755f7788b | ||
|
105297aeaa | ||
|
0682199e84 | ||
|
87a36d75a6 | ||
|
492c5e7347 | ||
|
7357fef577 | ||
|
bff02e6a75 | ||
|
ce69051956 | ||
|
ad29da7bf3 | ||
|
17a0b789c4 | ||
|
57ef733af4 | ||
|
996aebef38 | ||
|
6986b49547 | ||
|
92dd3eaec4 | ||
|
14b9b4c4da | ||
|
c285027144 | ||
|
3e4818c026 | ||
|
e9245fdb79 | ||
|
bf169d78fd | ||
|
04684d4324 | ||
|
fe1889b243 | ||
|
d433fd7d7b | ||
|
5093173549 | ||
|
caef54f50d | ||
|
d59404b67c | ||
|
92ad066565 | ||
|
a42c4fa625 | ||
|
7c07251b8c | ||
|
fba2b92bda | ||
|
3c57eb9e2e | ||
|
2b870a9791 | ||
|
49c770414a | ||
|
79016a997e | ||
|
089895281f | ||
|
a286f52fed | ||
|
71818f0aa3 | ||
|
d8a651a844 | ||
|
f3c707a769 | ||
|
508e0b769f | ||
|
34f530b7ab | ||
|
080a87ba6e | ||
|
53824824c0 | ||
|
5ab159d5f6 | ||
|
f1d75f329c | ||
|
04d9e4848f | ||
|
b04434a3cb | ||
|
3b53157c6d | ||
|
828bce678a | ||
|
475c0c323c | ||
|
71a3e25be4 | ||
|
9f465644d4 | ||
|
baf3f227f1 | ||
|
ed6137a7d7 | ||
|
c9986cc25a | ||
|
7b1fdea6b7 | ||
|
c0580ef14a | ||
|
f197fb160d | ||
|
d8498adbc2 | ||
|
ec4c23cc7b | ||
|
7d79fa1d91 | ||
|
55021cb3ec | ||
|
628749631b | ||
|
18db7e071a | ||
|
15f76542b1 | ||
|
73ed709fed | ||
|
4fec6cda20 | ||
|
66b5c82840 | ||
|
a16c70bd54 | ||
|
328961ee83 | ||
|
8e5cea1af7 | ||
|
4d6d9916bf | ||
|
1a5e39fa0e | ||
|
de254a1293 | ||
|
dcff855efb | ||
|
bbce74f47a | ||
|
2c0a5dce18 | ||
|
89e34cd3a1 | ||
|
7eed6f45f8 | ||
|
5eb63e3284 | ||
|
05fc8a7421 | ||
|
ec91109cc3 | ||
|
0ec0b4d6f5 | ||
|
6a0419b5bf | ||
|
f53fb4fe47 | ||
|
b6777295a1 | ||
|
b1ad170030 |
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "gitsubmodule"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
open-pull-requests-limit: 10
|
@ -1,4 +1,4 @@
|
||||
name: Main
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -69,7 +69,7 @@ jobs:
|
||||
|
||||
build-macos:
|
||||
name: Build macOS
|
||||
runs-on: macos-13
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@ -86,16 +86,6 @@ jobs:
|
||||
fetch-depth: 0
|
||||
lfs: false
|
||||
|
||||
- name: Set up Homebrew
|
||||
uses: Homebrew/actions/setup-homebrew@master
|
||||
|
||||
- name: Install LLVM
|
||||
run: brew install llvm
|
||||
|
||||
- name: Add LLVM to PATH
|
||||
run: |
|
||||
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Add premake5 to PATH
|
||||
uses: abel0b/setup-premake@v2.3
|
||||
with:
|
||||
@ -129,7 +119,7 @@ jobs:
|
||||
- release
|
||||
arch:
|
||||
- x64
|
||||
# - arm64
|
||||
- arm64
|
||||
steps:
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v4
|
||||
@ -138,15 +128,11 @@ jobs:
|
||||
fetch-depth: 0
|
||||
lfs: false
|
||||
|
||||
- name: Install LLVM
|
||||
- name: Install dependencies (arm64)
|
||||
if: matrix.arch == 'arm64'
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 17
|
||||
|
||||
# - name: Install dependencies (arm64)
|
||||
# if: matrix.arch == 'arm64'
|
||||
# run: sudo apt-get install crossbuild-essential-arm64 -y
|
||||
sudo apt-get update
|
||||
sudo apt-get install crossbuild-essential-arm64 -y
|
||||
|
||||
- name: Add premake5 to PATH
|
||||
uses: abel0b/setup-premake@v2.3
|
||||
@ -164,8 +150,8 @@ jobs:
|
||||
pushd build
|
||||
make config=${{matrix.config}}_${{matrix.arch}} -j$(nproc)
|
||||
env:
|
||||
CC: clang-17
|
||||
CXX: clang++-17
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
|
||||
- name: Upload ${{matrix.arch}} ${{matrix.config}} binaries
|
||||
uses: actions/upload-artifact@v3.1.3
|
||||
@ -178,28 +164,15 @@ jobs:
|
||||
name: Deploy Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build-windows, build-macos, build-linux ]
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
if: startsWith(github.ref, 'refs/tags/') && (github.event.base_ref == 'refs/heads/prod' || github.event.base_ref == 'refs/heads/dev')
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
Dockerfile
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Download Binaries
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
- name: Compress Binaries
|
||||
run: |
|
||||
for dir in */; do
|
||||
if [[ $dir == *"windows"* ]]; then
|
||||
cd "$dir" && zip -r "../${dir%/}.zip" . && cd ..
|
||||
else
|
||||
tar -czvf "${dir%/}.tar.gz" -C "$dir" .
|
||||
fi
|
||||
done
|
||||
shell: bash
|
||||
uses: actions/download-artifact@v3.0.2
|
||||
with:
|
||||
name: windows-x64-release
|
||||
|
||||
- name: Create Release
|
||||
uses: "marvinpinto/action-automatic-releases@latest"
|
||||
@ -208,13 +181,4 @@ jobs:
|
||||
prerelease: false
|
||||
draft: true
|
||||
files: |
|
||||
*.zip
|
||||
*.tar.gz
|
||||
|
||||
- name: Build and Publish Docker Image
|
||||
uses: VaultVulp/gp-docker-action@1.6.0
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
image-name: gsc-tool
|
||||
extract-git-tag: true
|
||||
additional-image-tags: latest
|
||||
gsc-tool.exe
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -2,6 +2,6 @@
|
||||
path = deps/zlib
|
||||
url = https://github.com/madler/zlib
|
||||
branch = master
|
||||
[submodule "deps/cxxopts"]
|
||||
path = deps/cxxopts
|
||||
url = https://github.com/jarro2783/cxxopts.git
|
||||
[submodule "deps/fmt"]
|
||||
path = deps/fmt
|
||||
url = https://github.com/fmtlib/fmt
|
||||
|
10
Dockerfile
10
Dockerfile
@ -1,10 +0,0 @@
|
||||
FROM alpine:3.19
|
||||
|
||||
RUN apk add --no-cache gcompat libstdc++
|
||||
|
||||
COPY --chmod=755 ./linux-x64-release/gsc-tool /usr/local/bin/
|
||||
|
||||
RUN addgroup -S gsc-tool && adduser -S gsc-tool -G gsc-tool
|
||||
USER gsc-tool
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/gsc-tool"]
|
42
README.md
42
README.md
@ -1,7 +1,6 @@
|
||||
[![sonar](https://sonarcloud.io/api/project_badges/measure?project=xensik_gsc-tool&metric=alert_status)](https://sonarcloud.io/summary/overall?id=xensik_gsc-tool)
|
||||
[![build](https://github.com/xensik/gsc-tool/workflows/Build/badge.svg)](https://github.com/xensik/gsc-tool/actions)
|
||||
![license](https://img.shields.io/github/license/xensik/gsc-tool.svg)
|
||||
[![issues](https://img.shields.io/github/issues/xensik/gsc-tool)](https://github.com/xensik/gsc-tool/issues)
|
||||
[![license](https://img.shields.io/github/license/xensik/gsc-tool.svg)](https://github.com/xensik/gsc-tool/blob/dev/LICENSE)
|
||||
[![releases](https://img.shields.io/github/v/release/xensik/gsc-tool)](https://github.com/xensik/gsc-tool/releases)
|
||||
[![paypal](https://img.shields.io/badge/PayPal-support-blue.svg?logo=paypal)](https://www.paypal.me/xensik)
|
||||
|
||||
@ -23,30 +22,20 @@ A utility to compile & decompile IW engine game scripts.
|
||||
- **T7** *(Call of Duty: Black Ops III)* `PC` *(Decompiler)*
|
||||
- **T8** *(Call of Duty: Black Ops 4)* ***\*WIP\****
|
||||
- **T9** *(Call of Duty: Black Ops Cold War)* ***\*WIP\****
|
||||
- **JUP** *(Call of Duty: Modern Warfare III (2023)* ***\*WIP\****
|
||||
|
||||
## Usage
|
||||
``gsc-tool [OPTIONS..] <path>``
|
||||
``./gsc-tool.exe <mode> <game> <system> <path>``
|
||||
|
||||
- **path**: file or directory to process
|
||||
**mode**: `asm`, `disasm`, `comp`, `decomp`, `parse`
|
||||
- *note:* zonetool files (*.cgsc*, *.cgsc.stack*) use: `zasm`, `zdisasm`, `zcomp`, `zdecomp` modes
|
||||
|
||||
- **options:**
|
||||
**game**: `iw5`, `iw6`, `iw7`, `iw8`, `iw9`, `s1`, `s2`, `s4`, `h1`, `h2`, `t6` `t7` `t8` `t9`
|
||||
|
||||
``-m, --mode <mode>`` [REQUIRED] one of: `asm`, `disasm`, `comp`, `decomp`, `parse`
|
||||
**system**: `pc`, `ps3`, `ps4`, `ps5`, `xb2` (*360*), `xb3` (*One*), `xb4` (*Series X|S*), `wiiu`
|
||||
|
||||
``-g, --game <game>`` [REQUIRED] one of: `iw5`, `iw6`, `iw7`, `iw8`, `iw9`, `s1`, `s2`, `s4`, `h1`, `h2`, `t6` `t7` `t8` `t9` `jup`
|
||||
**path**: `file` or `directory` (recursive process all files inside the directory)
|
||||
|
||||
``-s, --system <system>`` [REQUIRED] one of: `pc`, `ps3`, `ps4`, `ps5`, `xb2` (*360*), `xb3` (*One*), `xb4` (*Series X|S*), `wiiu`
|
||||
|
||||
``-d, --dev`` Enable developer mode (dev blocks & generate bytecode map).
|
||||
|
||||
``-z, --zonetool`` Enable zonetool mode (use .cgsc files).
|
||||
|
||||
``-h, --help`` Display help.
|
||||
|
||||
``-v, --version`` Display version.
|
||||
|
||||
Example: ``gsc-tool -m comp -g iw5 -s pc ./data/iw5/my_fancy_script.gsc``
|
||||
Example: ``./gsc-tool.exe comp iw5 pc ./data/iw5/my_fancy_script.gsc``
|
||||
|
||||
| Mode |Description | Output |
|
||||
|:---------|:--------------------------|:------------|
|
||||
@ -59,14 +48,13 @@ Example: ``gsc-tool -m comp -g iw5 -s pc ./data/iw5/my_fancy_script.gsc``
|
||||
## File Format
|
||||
If you need to extract scripts from fastfiles or game memory, use [Zonetool](https://github.com/ZoneTool/zonetool) or [Jekyll](https://github.com/EthanC/Jekyll).
|
||||
|
||||
- gsc-tool `.gscbin` binary format is a serialized ScriptFile struct: <br/>
|
||||
|
||||
- ***magic***: `"GSC\0"` 4 byte <br/>
|
||||
- ***compressedLen***: 4 byte usigned integer <br/>
|
||||
- ***len***: 4 byte usigned integer <br/>
|
||||
- ***bytecodeLen***: 4 byte usigned integer <br/>
|
||||
- ***buffer***: byte array[compressedLen] <br/>
|
||||
- ***bytecode***: byte array[bytecodeLen] <br/>
|
||||
- gsc-tool `.gscbin` format is a serialized ScriptFile struct: <br/>
|
||||
***name***: null-terminated string <br/>
|
||||
***compressedLen***: 4 byte uint <br/>
|
||||
***len***: 4 byte uint <br/>
|
||||
***bytecodeLen***: 4 byte uint <br/>
|
||||
***buffer***: byte array[compressedLen] <br/>
|
||||
***bytecode***: byte array[bytecodeLen] <br/>
|
||||
|
||||
note: for PS3 & Xbox 360 `.gscbin` files *(compressedLen, len, bytecodeLen)* are saved as little-endian!!
|
||||
|
||||
|
1
deps/cxxopts
vendored
1
deps/cxxopts
vendored
@ -1 +0,0 @@
|
||||
Subproject commit eb787304d67ec22f7c3a184ee8b4c481d04357fd
|
11
deps/cxxopts.lua
vendored
11
deps/cxxopts.lua
vendored
@ -1,11 +0,0 @@
|
||||
cxxopts = { base = path.join(dependencies.base, "cxxopts") }
|
||||
|
||||
function cxxopts:include()
|
||||
includedirs { path.join(cxxopts.base, "include") }
|
||||
end
|
||||
|
||||
function cxxopts:link()
|
||||
self:include()
|
||||
end
|
||||
|
||||
table.insert(dependencies, cxxopts)
|
1
deps/fmt
vendored
Submodule
1
deps/fmt
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit f5750892436a667fe622e5ecc8a02c15a5d9bc88
|
31
deps/fmt.lua
vendored
Normal file
31
deps/fmt.lua
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
fmt = { base = path.join(dependencies.base, "fmt") }
|
||||
|
||||
function fmt:include()
|
||||
includedirs { path.join(fmt.base, "include") }
|
||||
end
|
||||
|
||||
function fmt:link()
|
||||
links { "fmt" }
|
||||
self:include()
|
||||
end
|
||||
|
||||
function fmt:project()
|
||||
project "fmt"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
|
||||
self:include()
|
||||
|
||||
files
|
||||
{
|
||||
path.join(fmt.base, "include/fmt/*.h"),
|
||||
path.join(fmt.base, "src/*.cc")
|
||||
}
|
||||
|
||||
removefiles
|
||||
{
|
||||
path.join(fmt.base, "src/fmt.cc")
|
||||
}
|
||||
end
|
||||
|
||||
table.insert(dependencies, fmt)
|
24
deps/zlib.lua
vendored
24
deps/zlib.lua
vendored
@ -15,24 +15,24 @@ function zlib:project()
|
||||
language "C"
|
||||
warnings "off"
|
||||
|
||||
if os.istarget("linux") or os.istarget("macosx") then
|
||||
defines {
|
||||
"HAVE_UNISTD_H"
|
||||
self:include()
|
||||
|
||||
files
|
||||
{
|
||||
path.join(zlib.base, "*.h"),
|
||||
path.join(zlib.base, "*.c")
|
||||
}
|
||||
elseif os.istarget("windows") then
|
||||
defines {
|
||||
|
||||
defines
|
||||
{
|
||||
"_CRT_SECURE_NO_WARNINGS",
|
||||
"_CRT_NONSTDC_NO_DEPRECATE",
|
||||
"_CRT_SECURE_NO_DEPRECATE",
|
||||
}
|
||||
|
||||
if os.istarget("darwin") then
|
||||
defines "HAVE_UNISTD_H"
|
||||
end
|
||||
|
||||
self:include()
|
||||
|
||||
files {
|
||||
path.join(zlib.base, "*.h"),
|
||||
path.join(zlib.base, "*.c")
|
||||
}
|
||||
end
|
||||
|
||||
table.insert(dependencies, zlib)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2024 xensik. All rights reserved.
|
||||
/* Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -63,7 +63,6 @@ namespace xsk::arc
|
||||
%token ENDON "endon"
|
||||
%token NOTIFY "notify"
|
||||
%token WAIT "wait"
|
||||
%token WAITREALTIME "waitrealtime"
|
||||
%token WAITTILL "waittill"
|
||||
%token WAITTILLMATCH "waittillmatch"
|
||||
%token WAITTILLFRAMEEND "waittillframeend"
|
||||
@ -184,7 +183,6 @@ namespace xsk::arc
|
||||
%type <stmt_endon::ptr> stmt_endon
|
||||
%type <stmt_notify::ptr> stmt_notify
|
||||
%type <stmt_wait::ptr> stmt_wait
|
||||
%type <stmt_waitrealtime::ptr> stmt_waitrealtime
|
||||
%type <stmt_waittill::ptr> stmt_waittill
|
||||
%type <stmt_waittillmatch::ptr> stmt_waittillmatch
|
||||
%type <stmt_waittillframeend::ptr> stmt_waittillframeend
|
||||
@ -359,7 +357,6 @@ stmt
|
||||
| stmt_endon { $$ = std::move($1); }
|
||||
| stmt_notify { $$ = std::move($1); }
|
||||
| stmt_wait { $$ = std::move($1); }
|
||||
| stmt_waitrealtime { $$ = std::move($1); }
|
||||
| stmt_waittill { $$ = std::move($1); }
|
||||
| stmt_waittillmatch { $$ = std::move($1); }
|
||||
| stmt_waittillframeend { $$ = std::move($1); }
|
||||
@ -465,11 +462,6 @@ stmt_wait
|
||||
{ $$ = stmt_wait::make(@$, std::move($2)); }
|
||||
;
|
||||
|
||||
stmt_waitrealtime
|
||||
: WAITREALTIME expr SEMICOLON
|
||||
{ $$ = stmt_waitrealtime::make(@$, std::move($2)); }
|
||||
;
|
||||
|
||||
stmt_waittill
|
||||
: expr_object WAITTILL LPAREN expr COMMA expr_arguments_no_empty RPAREN SEMICOLON
|
||||
{ $$ = stmt_waittill::make(@$, std::move($1), std::move($4), std::move($6)); }
|
||||
@ -517,13 +509,13 @@ stmt_for
|
||||
stmt_foreach
|
||||
: FOREACH LPAREN expr_identifier IN expr RPAREN stmt
|
||||
{
|
||||
auto array = expr_identifier::make(@$, std::format("_a{}", ++index));
|
||||
auto key = expr_identifier::make(@$, std::format("_k{}", ++index));
|
||||
auto array = expr_identifier::make(@$, fmt::format("_a{}", ++index));
|
||||
auto key = expr_identifier::make(@$, fmt::format("_k{}", ++index));
|
||||
$$ = stmt_foreach::make(@$, std::move($5), std::move($3), std::move(array), std::move(key), std::move($7), false);
|
||||
}
|
||||
| FOREACH LPAREN expr_identifier COMMA expr_identifier IN expr RPAREN stmt
|
||||
{
|
||||
auto array = expr_identifier::make(@$, std::format("_a{}", ++index));
|
||||
auto array = expr_identifier::make(@$, fmt::format("_a{}", ++index));
|
||||
$$ = stmt_foreach::make(@$, std::move($7), std::move($5), std::move(array), std::move($3), std::move($9), true);
|
||||
}
|
||||
;
|
||||
@ -1161,7 +1153,7 @@ auto map_token(context const* ctx_, token& tok) -> parser::symbol_type
|
||||
}
|
||||
}
|
||||
|
||||
throw error(std::format("unmapped token! {}", (u8)tok.type));
|
||||
throw error(fmt::format("unmapped token! {}", (u8)tok.type));
|
||||
}
|
||||
|
||||
auto ARClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type
|
||||
@ -1238,7 +1230,6 @@ std::unordered_map<token::kind, parser::token::token_kind_type> const tok_to_par
|
||||
{ token::ENDON, parser::token::ENDON },
|
||||
{ token::NOTIFY, parser::token::NOTIFY },
|
||||
{ token::WAIT, parser::token::WAIT },
|
||||
{ token::WAITREALTIME, parser::token::WAITREALTIME },
|
||||
{ token::WAITTILL, parser::token::WAITTILL },
|
||||
{ token::WAITTILLMATCH, parser::token::WAITTILLMATCH },
|
||||
{ token::WAITTILLFRAMEEND, parser::token::WAITTILLFRAMEEND },
|
||||
@ -1298,7 +1289,6 @@ std::unordered_map<std::string_view, parser::token::token_kind_type> const keywo
|
||||
{ "endon", parser::token::ENDON },
|
||||
{ "notify", parser::token::NOTIFY },
|
||||
{ "wait", parser::token::WAIT },
|
||||
{ "waitrealtime", parser::token::WAITREALTIME},
|
||||
{ "waittill", parser::token::WAITTILL },
|
||||
{ "waittillmatch", parser::token::WAITTILLMATCH },
|
||||
{ "waittillframeend", parser::token::WAITTILLFRAMEEND },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2024 xensik. All rights reserved.
|
||||
/* Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -321,7 +321,7 @@ decl_constant
|
||||
: expr_identifier ASSIGN expr SEMICOLON
|
||||
{
|
||||
ppr.ban_header(@$); $$ = decl_constant::make(@$, std::move($1), std::move($3));
|
||||
printf("%s" , std::format("{}: constants deprecated, use #define instead\n", @$.print()).data());
|
||||
printf("%s" , fmt::format("{}: constants deprecated, use #define instead\n", @$.print()).data());
|
||||
}
|
||||
;
|
||||
|
||||
@ -496,14 +496,14 @@ stmt_for
|
||||
stmt_foreach
|
||||
: FOREACH LPAREN expr_identifier IN expr RPAREN stmt
|
||||
{
|
||||
auto array = expr_identifier::make(@$, std::format("_temp_{}", ++index));
|
||||
auto key = expr_identifier::make(@$, std::format("_temp_{}", ++index));
|
||||
auto array = expr_identifier::make(@$, fmt::format("_temp_{}", ++index));
|
||||
auto key = expr_identifier::make(@$, fmt::format("_temp_{}", ++index));
|
||||
$$ = stmt_foreach::make(@$, std::move($5), std::move($3), expr_empty::make(@$), std::move(array), std::move(key), std::move($7), false);
|
||||
}
|
||||
| FOREACH LPAREN expr_identifier COMMA expr_identifier IN expr RPAREN stmt
|
||||
{
|
||||
auto array = expr_identifier::make(@$, std::format("_temp_{}", ++index));
|
||||
expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(@$, std::format("_temp_{}", ++index)) : std::move($3);
|
||||
auto array = expr_identifier::make(@$, fmt::format("_temp_{}", ++index));
|
||||
expr::ptr key = (ctx_->props() & props::foreach) ? expr_identifier::make(@$, fmt::format("_temp_{}", ++index)) : std::move($3);
|
||||
$$ = stmt_foreach::make(@$, std::move($7), std::move($5), (ctx_->props() & props::foreach) ? std::move($3) : (expr::ptr)expr_empty::make(@$), std::move(array), std::move(key), std::move($9), true);
|
||||
}
|
||||
;
|
||||
@ -821,7 +821,7 @@ expr_tuple
|
||||
: LBRACKET expr_tuple_arguments RBRACKET
|
||||
{
|
||||
$$ = std::move($2);
|
||||
$$->as<expr_tuple>().temp = expr_identifier::make($$->loc(), std::format("_temp_{}", ++index));
|
||||
$$->as<expr_tuple>().temp = expr_identifier::make($$->loc(), fmt::format("_temp_{}", ++index));
|
||||
}
|
||||
;
|
||||
|
||||
@ -1088,7 +1088,7 @@ auto map_token(context const* ctx_, token& tok) -> parser::symbol_type
|
||||
}
|
||||
}
|
||||
|
||||
throw error(std::format("unmapped token! {}", (u8)tok.type));
|
||||
throw error(fmt::format("unmapped token! {}", (u8)tok.type));
|
||||
}
|
||||
|
||||
auto GSClex(context const* ctx_, preprocessor& ppr) -> parser::symbol_type
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -17,17 +17,15 @@ class assembler
|
||||
function const* func_;
|
||||
assembly const* assembly_;
|
||||
utils::writer script_;
|
||||
utils::writer devmap_;
|
||||
std::unordered_map<std::string, u16> strpool_;
|
||||
std::vector<export_ref> exports_;
|
||||
std::vector<import_ref> imports_;
|
||||
std::vector<string_ref> strings_;
|
||||
std::vector<animtree_ref> anims_;
|
||||
u32 devmap_count_;
|
||||
|
||||
public:
|
||||
assembler(context const* ctx);
|
||||
auto assemble(assembly const& data, std::string const& name = {}) -> std::pair<buffer, buffer>;
|
||||
auto assemble(assembly const& data, std::string const& name = {}) -> buffer;
|
||||
|
||||
private:
|
||||
auto assemble_function(function& func) -> void;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -158,19 +158,12 @@ enum class opcode : u8
|
||||
OP_Count,
|
||||
};
|
||||
|
||||
struct sourcepos
|
||||
{
|
||||
u16 line;
|
||||
u16 column;
|
||||
};
|
||||
|
||||
struct instruction
|
||||
{
|
||||
using ptr = std::unique_ptr<instruction>;
|
||||
|
||||
u32 index;
|
||||
u32 size;
|
||||
sourcepos pos;
|
||||
opcode opcode;
|
||||
std::vector<std::string> data;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -88,10 +88,10 @@ struct node
|
||||
stmt_endon,
|
||||
stmt_notify,
|
||||
stmt_wait,
|
||||
stmt_waitrealtime,
|
||||
stmt_waittill,
|
||||
stmt_waittillmatch,
|
||||
stmt_waittillframeend,
|
||||
stmt_waitrealtime,
|
||||
stmt_if,
|
||||
stmt_ifelse,
|
||||
stmt_while,
|
||||
@ -1001,16 +1001,6 @@ struct stmt_wait : public stmt
|
||||
XSK_ARC_AST_MAKE(stmt_wait)
|
||||
};
|
||||
|
||||
struct stmt_waitrealtime : public stmt
|
||||
{
|
||||
using ptr = std::unique_ptr<stmt_waitrealtime>;
|
||||
|
||||
expr::ptr time;
|
||||
|
||||
stmt_waitrealtime(location const& loc, expr::ptr time);
|
||||
XSK_ARC_AST_MAKE(stmt_waitrealtime)
|
||||
};
|
||||
|
||||
struct stmt_waittill : public stmt
|
||||
{
|
||||
using ptr = std::unique_ptr<stmt_waittill>;
|
||||
@ -1043,6 +1033,16 @@ struct stmt_waittillframeend : public stmt
|
||||
XSK_ARC_AST_MAKE(stmt_waittillframeend)
|
||||
};
|
||||
|
||||
struct stmt_waitrealtime : public stmt
|
||||
{
|
||||
using ptr = std::unique_ptr<stmt_waitrealtime>;
|
||||
|
||||
expr::ptr time;
|
||||
|
||||
stmt_waitrealtime(location const& loc, expr::ptr time);
|
||||
XSK_ARC_AST_MAKE(stmt_waitrealtime)
|
||||
};
|
||||
|
||||
struct stmt_if : public stmt
|
||||
{
|
||||
using ptr = std::unique_ptr<stmt_if>;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -14,7 +14,6 @@ struct directive
|
||||
|
||||
kind type;
|
||||
bool skip;
|
||||
bool exec;
|
||||
};
|
||||
|
||||
} // namespace xsk::arc
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -12,7 +12,7 @@ class position
|
||||
{
|
||||
public:
|
||||
typedef const std::string filename_type;
|
||||
typedef u16 counter_type;
|
||||
typedef int counter_type;
|
||||
|
||||
filename_type *filename;
|
||||
counter_type line;
|
||||
@ -119,12 +119,12 @@ public:
|
||||
|
||||
auto print() const -> std::string
|
||||
{
|
||||
return std::format("{}:{}:{}", *begin.filename, begin.line, begin.column);
|
||||
return fmt::format("{}:{}:{}", *begin.filename, begin.line, begin.column);
|
||||
}
|
||||
|
||||
auto label() const -> std::string
|
||||
{
|
||||
return std::format("loc_{:X}", begin.line);
|
||||
return fmt::format("loc_{:X}", begin.line);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -20,9 +20,9 @@ struct token
|
||||
NAME, PATH, STRING, ISTRING, HASHSTR, INT, FLT,
|
||||
|
||||
DEVBEGIN, DEVEND, INLINE, INCLUDE, USINGTREE, ANIMTREE, AUTOEXEC, CODECALL, PRIVATE,
|
||||
ENDON, NOTIFY, WAIT, WAITREALTIME, WAITTILL, WAITTILLMATCH, WAITTILLFRAMEEND, IF, ELSE,
|
||||
DO, WHILE, FOR, FOREACH, IN, SWITCH, CASE, DEFAULT, BREAK, CONTINUE, RETURN, PROFBEGIN,
|
||||
PROFEND, THREAD, TRUE, FALSE, UNDEFINED, SIZE, GAME, SELF, ANIM, LEVEL,
|
||||
ENDON, NOTIFY, WAIT, WAITTILL, WAITTILLMATCH, WAITTILLFRAMEEND, IF, ELSE, DO, WHILE,
|
||||
FOR, FOREACH, IN, SWITCH, CASE, DEFAULT, BREAK, CONTINUE, RETURN, PROFBEGIN, PROFEND,
|
||||
THREAD, TRUE, FALSE, UNDEFINED, SIZE, GAME, SELF, ANIM, LEVEL,
|
||||
CONST, ISDEFINED, VECTORSCALE, ANGLESTOUP, ANGLESTORIGHT, ANGLESTOFORWARD, ANGLECLAMP180,
|
||||
VECTORTOANGLES, ABS, GETTIME, GETDVAR, GETDVARINT, GETDVARFLOAT, GETDVARVECTOR, GETDVARCOLORRED,
|
||||
GETDVARCOLORGREEN, GETDVARCOLORBLUE, GETDVARCOLORALPHA, GETFIRSTARRAYKEY, GETNEXTARRAYKEY,
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -29,17 +29,10 @@ enum class instance : u8
|
||||
|
||||
enum class build : u8
|
||||
{
|
||||
prod = 0,
|
||||
dev_blocks = 1 << 0,
|
||||
dev_maps = 1 << 1,
|
||||
dev = dev_blocks | dev_maps,
|
||||
dev,
|
||||
prod,
|
||||
};
|
||||
|
||||
inline build operator&(build lhs, build rhs)
|
||||
{
|
||||
return static_cast<build>(static_cast<std::underlying_type<build>::type>(lhs) & static_cast<std::underlying_type<build>::type>(rhs));
|
||||
}
|
||||
|
||||
enum class endian : u8
|
||||
{
|
||||
little,
|
||||
@ -64,14 +57,13 @@ enum class engine : u8
|
||||
t7,
|
||||
t8,
|
||||
t9,
|
||||
jup
|
||||
};
|
||||
|
||||
struct props
|
||||
{
|
||||
enum values : u32
|
||||
{
|
||||
none = 0,
|
||||
none = 0 << 0,
|
||||
v2 = 1 << 0,
|
||||
v3 = 1 << 1,
|
||||
header64 = 1 << 2,
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -20,7 +20,6 @@ class compiler
|
||||
std::vector<scope> scopes_;
|
||||
std::unordered_map<std::string, expr const*> constants_;
|
||||
std::string animtree_;
|
||||
sourcepos debug_pos_;
|
||||
u32 index_;
|
||||
u32 label_idx_;
|
||||
bool can_break_;
|
||||
@ -46,7 +45,6 @@ private:
|
||||
auto emit_stmt_endon(stmt_endon const& stm) -> void;
|
||||
auto emit_stmt_notify(stmt_notify const& stm) -> void;
|
||||
auto emit_stmt_wait(stmt_wait const& stm) -> void;
|
||||
auto emit_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void;
|
||||
auto emit_stmt_waittill(stmt_waittill const& stm) -> void;
|
||||
auto emit_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void;
|
||||
auto emit_stmt_waittillframeend(stmt_waittillframeend const& stm) -> void;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -65,9 +65,9 @@ private:
|
||||
auto process_stmt_endon(stmt_endon& stm) -> void;
|
||||
auto process_stmt_notify(stmt_notify& stm) -> void;
|
||||
auto process_stmt_wait(stmt_wait& stm) -> void;
|
||||
auto process_stmt_waitrealtime(stmt_waitrealtime& stm) -> void;
|
||||
auto process_stmt_waittill(stmt_waittill& stm) -> void;
|
||||
auto process_stmt_waittillmatch(stmt_waittillmatch& stm) -> void;
|
||||
auto process_stmt_waitrealtime(stmt_waitrealtime& stm) -> void;
|
||||
auto process_stmt_if(stmt_if& stm) -> void;
|
||||
auto process_stmt_ifelse(stmt_ifelse& stm) -> void;
|
||||
auto process_stmt_while(stmt_while& stm) -> void;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,24 +0,0 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "xsk/stdinc.hpp"
|
||||
#include "xsk/arc/context.hpp"
|
||||
|
||||
namespace xsk::arc::jup
|
||||
{
|
||||
|
||||
constexpr usize code_count = 0;
|
||||
constexpr usize hash_count = 0;
|
||||
constexpr u64 header_magic = 0x38000A0D43534780;
|
||||
|
||||
class context : public arc::context
|
||||
{
|
||||
public:
|
||||
context();
|
||||
};
|
||||
|
||||
} // namespace xsk::arc::jup
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -679,20 +679,17 @@ namespace xsk { namespace arc {
|
||||
// stmt_wait
|
||||
char dummy78[sizeof (stmt_wait::ptr)];
|
||||
|
||||
// stmt_waitrealtime
|
||||
char dummy79[sizeof (stmt_waitrealtime::ptr)];
|
||||
|
||||
// stmt_waittill
|
||||
char dummy80[sizeof (stmt_waittill::ptr)];
|
||||
char dummy79[sizeof (stmt_waittill::ptr)];
|
||||
|
||||
// stmt_waittillframeend
|
||||
char dummy81[sizeof (stmt_waittillframeend::ptr)];
|
||||
char dummy80[sizeof (stmt_waittillframeend::ptr)];
|
||||
|
||||
// stmt_waittillmatch
|
||||
char dummy82[sizeof (stmt_waittillmatch::ptr)];
|
||||
char dummy81[sizeof (stmt_waittillmatch::ptr)];
|
||||
|
||||
// stmt_while
|
||||
char dummy83[sizeof (stmt_while::ptr)];
|
||||
char dummy82[sizeof (stmt_while::ptr)];
|
||||
};
|
||||
|
||||
/// The size of the largest semantic type.
|
||||
@ -758,117 +755,116 @@ namespace xsk { namespace arc {
|
||||
ENDON = 13, // "endon"
|
||||
NOTIFY = 14, // "notify"
|
||||
WAIT = 15, // "wait"
|
||||
WAITREALTIME = 16, // "waitrealtime"
|
||||
WAITTILL = 17, // "waittill"
|
||||
WAITTILLMATCH = 18, // "waittillmatch"
|
||||
WAITTILLFRAMEEND = 19, // "waittillframeend"
|
||||
IF = 20, // "if"
|
||||
ELSE = 21, // "else"
|
||||
DO = 22, // "do"
|
||||
WHILE = 23, // "while"
|
||||
FOR = 24, // "for"
|
||||
FOREACH = 25, // "foreach"
|
||||
IN = 26, // "in"
|
||||
SWITCH = 27, // "switch"
|
||||
CASE = 28, // "case"
|
||||
DEFAULT = 29, // "default"
|
||||
BREAK = 30, // "break"
|
||||
CONTINUE = 31, // "continue"
|
||||
RETURN = 32, // "return"
|
||||
PROFBEGIN = 33, // "prof_begin"
|
||||
PROFEND = 34, // "prof_end"
|
||||
THREAD = 35, // "thread"
|
||||
TRUE = 36, // "true"
|
||||
FALSE = 37, // "false"
|
||||
UNDEFINED = 38, // "undefined"
|
||||
SIZE = 39, // "size"
|
||||
GAME = 40, // "game"
|
||||
SELF = 41, // "self"
|
||||
ANIM = 42, // "anim"
|
||||
LEVEL = 43, // "level"
|
||||
CONST = 44, // "const"
|
||||
GETNEXTARRAYKEY = 45, // "getnextarraykey"
|
||||
GETFIRSTARRAYKEY = 46, // "getfirstarraykey"
|
||||
GETDVARCOLORALPHA = 47, // "getdvarcoloralpha"
|
||||
GETDVARCOLORBLUE = 48, // "getdvarcolorblue"
|
||||
GETDVARCOLORGREEN = 49, // "getdvarcolorgreen"
|
||||
GETDVARCOLORRED = 50, // "getdvarcolorred"
|
||||
GETDVARVECTOR = 51, // "getdvarvector"
|
||||
GETDVARFLOAT = 52, // "getdvarfloat"
|
||||
GETDVARINT = 53, // "getdvarint"
|
||||
GETDVAR = 54, // "getdvar"
|
||||
GETTIME = 55, // "gettime"
|
||||
ABS = 56, // "abs"
|
||||
VECTORTOANGLES = 57, // "vectortoangles"
|
||||
ANGLECLAMP180 = 58, // "angleclamp180"
|
||||
ANGLESTOFORWARD = 59, // "anglestoforward"
|
||||
ANGLESTORIGHT = 60, // "anglestoright"
|
||||
ANGLESTOUP = 61, // "anglestoup"
|
||||
VECTORSCALE = 62, // "vectorscale"
|
||||
ISDEFINED = 63, // "isdefined"
|
||||
LPAREN = 64, // "("
|
||||
RPAREN = 65, // ")"
|
||||
LBRACE = 66, // "{"
|
||||
RBRACE = 67, // "}"
|
||||
LBRACKET = 68, // "["
|
||||
RBRACKET = 69, // "]"
|
||||
COMMA = 70, // ","
|
||||
DOT = 71, // "."
|
||||
DOUBLEDOT = 72, // ".."
|
||||
ELLIPSIS = 73, // "..."
|
||||
DOUBLECOLON = 74, // "::"
|
||||
COLON = 75, // ":"
|
||||
SEMICOLON = 76, // ";"
|
||||
QMARK = 77, // "?"
|
||||
INCREMENT = 78, // "++"
|
||||
DECREMENT = 79, // "--"
|
||||
LSHIFT = 80, // "<<"
|
||||
RSHIFT = 81, // ">>"
|
||||
OR = 82, // "||"
|
||||
AND = 83, // "&&"
|
||||
EQUALITY = 84, // "=="
|
||||
INEQUALITY = 85, // "!="
|
||||
LESS_EQUAL = 86, // "<="
|
||||
GREATER_EQUAL = 87, // ">="
|
||||
LESS = 88, // "<"
|
||||
GREATER = 89, // ">"
|
||||
NOT = 90, // "!"
|
||||
COMPLEMENT = 91, // "~"
|
||||
ASSIGN = 92, // "="
|
||||
ASSIGN_ADD = 93, // "+="
|
||||
ASSIGN_SUB = 94, // "-="
|
||||
ASSIGN_MUL = 95, // "*="
|
||||
ASSIGN_DIV = 96, // "/="
|
||||
ASSIGN_MOD = 97, // "%="
|
||||
ASSIGN_BW_OR = 98, // "|="
|
||||
ASSIGN_BW_AND = 99, // "&="
|
||||
ASSIGN_BW_EXOR = 100, // "^="
|
||||
ASSIGN_RSHIFT = 101, // ">>="
|
||||
ASSIGN_LSHIFT = 102, // "<<="
|
||||
BITWISE_OR = 103, // "|"
|
||||
BITWISE_AND = 104, // "&"
|
||||
BITWISE_EXOR = 105, // "^"
|
||||
ADD = 106, // "+"
|
||||
SUB = 107, // "-"
|
||||
MUL = 108, // "*"
|
||||
DIV = 109, // "/"
|
||||
MOD = 110, // "%"
|
||||
PATH = 111, // "path"
|
||||
IDENTIFIER = 112, // "identifier"
|
||||
STRING = 113, // "string literal"
|
||||
ISTRING = 114, // "localized string"
|
||||
HASHSTR = 115, // "hash string"
|
||||
FLOAT = 116, // "float"
|
||||
INTEGER = 117, // "integer"
|
||||
SIZEOF = 118, // SIZEOF
|
||||
THEN = 119, // THEN
|
||||
TERN = 120, // TERN
|
||||
NEG = 121, // NEG
|
||||
ANIMREF = 122, // ANIMREF
|
||||
PREINC = 123, // PREINC
|
||||
PREDEC = 124, // PREDEC
|
||||
POSTINC = 125, // POSTINC
|
||||
POSTDEC = 126 // POSTDEC
|
||||
WAITTILL = 16, // "waittill"
|
||||
WAITTILLMATCH = 17, // "waittillmatch"
|
||||
WAITTILLFRAMEEND = 18, // "waittillframeend"
|
||||
IF = 19, // "if"
|
||||
ELSE = 20, // "else"
|
||||
DO = 21, // "do"
|
||||
WHILE = 22, // "while"
|
||||
FOR = 23, // "for"
|
||||
FOREACH = 24, // "foreach"
|
||||
IN = 25, // "in"
|
||||
SWITCH = 26, // "switch"
|
||||
CASE = 27, // "case"
|
||||
DEFAULT = 28, // "default"
|
||||
BREAK = 29, // "break"
|
||||
CONTINUE = 30, // "continue"
|
||||
RETURN = 31, // "return"
|
||||
PROFBEGIN = 32, // "prof_begin"
|
||||
PROFEND = 33, // "prof_end"
|
||||
THREAD = 34, // "thread"
|
||||
TRUE = 35, // "true"
|
||||
FALSE = 36, // "false"
|
||||
UNDEFINED = 37, // "undefined"
|
||||
SIZE = 38, // "size"
|
||||
GAME = 39, // "game"
|
||||
SELF = 40, // "self"
|
||||
ANIM = 41, // "anim"
|
||||
LEVEL = 42, // "level"
|
||||
CONST = 43, // "const"
|
||||
GETNEXTARRAYKEY = 44, // "getnextarraykey"
|
||||
GETFIRSTARRAYKEY = 45, // "getfirstarraykey"
|
||||
GETDVARCOLORALPHA = 46, // "getdvarcoloralpha"
|
||||
GETDVARCOLORBLUE = 47, // "getdvarcolorblue"
|
||||
GETDVARCOLORGREEN = 48, // "getdvarcolorgreen"
|
||||
GETDVARCOLORRED = 49, // "getdvarcolorred"
|
||||
GETDVARVECTOR = 50, // "getdvarvector"
|
||||
GETDVARFLOAT = 51, // "getdvarfloat"
|
||||
GETDVARINT = 52, // "getdvarint"
|
||||
GETDVAR = 53, // "getdvar"
|
||||
GETTIME = 54, // "gettime"
|
||||
ABS = 55, // "abs"
|
||||
VECTORTOANGLES = 56, // "vectortoangles"
|
||||
ANGLECLAMP180 = 57, // "angleclamp180"
|
||||
ANGLESTOFORWARD = 58, // "anglestoforward"
|
||||
ANGLESTORIGHT = 59, // "anglestoright"
|
||||
ANGLESTOUP = 60, // "anglestoup"
|
||||
VECTORSCALE = 61, // "vectorscale"
|
||||
ISDEFINED = 62, // "isdefined"
|
||||
LPAREN = 63, // "("
|
||||
RPAREN = 64, // ")"
|
||||
LBRACE = 65, // "{"
|
||||
RBRACE = 66, // "}"
|
||||
LBRACKET = 67, // "["
|
||||
RBRACKET = 68, // "]"
|
||||
COMMA = 69, // ","
|
||||
DOT = 70, // "."
|
||||
DOUBLEDOT = 71, // ".."
|
||||
ELLIPSIS = 72, // "..."
|
||||
DOUBLECOLON = 73, // "::"
|
||||
COLON = 74, // ":"
|
||||
SEMICOLON = 75, // ";"
|
||||
QMARK = 76, // "?"
|
||||
INCREMENT = 77, // "++"
|
||||
DECREMENT = 78, // "--"
|
||||
LSHIFT = 79, // "<<"
|
||||
RSHIFT = 80, // ">>"
|
||||
OR = 81, // "||"
|
||||
AND = 82, // "&&"
|
||||
EQUALITY = 83, // "=="
|
||||
INEQUALITY = 84, // "!="
|
||||
LESS_EQUAL = 85, // "<="
|
||||
GREATER_EQUAL = 86, // ">="
|
||||
LESS = 87, // "<"
|
||||
GREATER = 88, // ">"
|
||||
NOT = 89, // "!"
|
||||
COMPLEMENT = 90, // "~"
|
||||
ASSIGN = 91, // "="
|
||||
ASSIGN_ADD = 92, // "+="
|
||||
ASSIGN_SUB = 93, // "-="
|
||||
ASSIGN_MUL = 94, // "*="
|
||||
ASSIGN_DIV = 95, // "/="
|
||||
ASSIGN_MOD = 96, // "%="
|
||||
ASSIGN_BW_OR = 97, // "|="
|
||||
ASSIGN_BW_AND = 98, // "&="
|
||||
ASSIGN_BW_EXOR = 99, // "^="
|
||||
ASSIGN_RSHIFT = 100, // ">>="
|
||||
ASSIGN_LSHIFT = 101, // "<<="
|
||||
BITWISE_OR = 102, // "|"
|
||||
BITWISE_AND = 103, // "&"
|
||||
BITWISE_EXOR = 104, // "^"
|
||||
ADD = 105, // "+"
|
||||
SUB = 106, // "-"
|
||||
MUL = 107, // "*"
|
||||
DIV = 108, // "/"
|
||||
MOD = 109, // "%"
|
||||
PATH = 110, // "path"
|
||||
IDENTIFIER = 111, // "identifier"
|
||||
STRING = 112, // "string literal"
|
||||
ISTRING = 113, // "localized string"
|
||||
HASHSTR = 114, // "hash string"
|
||||
FLOAT = 115, // "float"
|
||||
INTEGER = 116, // "integer"
|
||||
SIZEOF = 117, // SIZEOF
|
||||
THEN = 118, // THEN
|
||||
TERN = 119, // TERN
|
||||
NEG = 120, // NEG
|
||||
ANIMREF = 121, // ANIMREF
|
||||
PREINC = 122, // PREINC
|
||||
PREDEC = 123, // PREDEC
|
||||
POSTINC = 124, // POSTINC
|
||||
POSTDEC = 125 // POSTDEC
|
||||
};
|
||||
/// Backward compatibility alias (Bison 3.6).
|
||||
typedef token_kind_type yytokentype;
|
||||
@ -885,7 +881,7 @@ namespace xsk { namespace arc {
|
||||
{
|
||||
enum symbol_kind_type
|
||||
{
|
||||
YYNTOKENS = 127, ///< Number of tokens.
|
||||
YYNTOKENS = 126, ///< Number of tokens.
|
||||
S_YYEMPTY = -2,
|
||||
S_YYEOF = 0, // "end of file"
|
||||
S_YYerror = 1, // error
|
||||
@ -903,219 +899,217 @@ namespace xsk { namespace arc {
|
||||
S_ENDON = 13, // "endon"
|
||||
S_NOTIFY = 14, // "notify"
|
||||
S_WAIT = 15, // "wait"
|
||||
S_WAITREALTIME = 16, // "waitrealtime"
|
||||
S_WAITTILL = 17, // "waittill"
|
||||
S_WAITTILLMATCH = 18, // "waittillmatch"
|
||||
S_WAITTILLFRAMEEND = 19, // "waittillframeend"
|
||||
S_IF = 20, // "if"
|
||||
S_ELSE = 21, // "else"
|
||||
S_DO = 22, // "do"
|
||||
S_WHILE = 23, // "while"
|
||||
S_FOR = 24, // "for"
|
||||
S_FOREACH = 25, // "foreach"
|
||||
S_IN = 26, // "in"
|
||||
S_SWITCH = 27, // "switch"
|
||||
S_CASE = 28, // "case"
|
||||
S_DEFAULT = 29, // "default"
|
||||
S_BREAK = 30, // "break"
|
||||
S_CONTINUE = 31, // "continue"
|
||||
S_RETURN = 32, // "return"
|
||||
S_PROFBEGIN = 33, // "prof_begin"
|
||||
S_PROFEND = 34, // "prof_end"
|
||||
S_THREAD = 35, // "thread"
|
||||
S_TRUE = 36, // "true"
|
||||
S_FALSE = 37, // "false"
|
||||
S_UNDEFINED = 38, // "undefined"
|
||||
S_SIZE = 39, // "size"
|
||||
S_GAME = 40, // "game"
|
||||
S_SELF = 41, // "self"
|
||||
S_ANIM = 42, // "anim"
|
||||
S_LEVEL = 43, // "level"
|
||||
S_CONST = 44, // "const"
|
||||
S_GETNEXTARRAYKEY = 45, // "getnextarraykey"
|
||||
S_GETFIRSTARRAYKEY = 46, // "getfirstarraykey"
|
||||
S_GETDVARCOLORALPHA = 47, // "getdvarcoloralpha"
|
||||
S_GETDVARCOLORBLUE = 48, // "getdvarcolorblue"
|
||||
S_GETDVARCOLORGREEN = 49, // "getdvarcolorgreen"
|
||||
S_GETDVARCOLORRED = 50, // "getdvarcolorred"
|
||||
S_GETDVARVECTOR = 51, // "getdvarvector"
|
||||
S_GETDVARFLOAT = 52, // "getdvarfloat"
|
||||
S_GETDVARINT = 53, // "getdvarint"
|
||||
S_GETDVAR = 54, // "getdvar"
|
||||
S_GETTIME = 55, // "gettime"
|
||||
S_ABS = 56, // "abs"
|
||||
S_VECTORTOANGLES = 57, // "vectortoangles"
|
||||
S_ANGLECLAMP180 = 58, // "angleclamp180"
|
||||
S_ANGLESTOFORWARD = 59, // "anglestoforward"
|
||||
S_ANGLESTORIGHT = 60, // "anglestoright"
|
||||
S_ANGLESTOUP = 61, // "anglestoup"
|
||||
S_VECTORSCALE = 62, // "vectorscale"
|
||||
S_ISDEFINED = 63, // "isdefined"
|
||||
S_LPAREN = 64, // "("
|
||||
S_RPAREN = 65, // ")"
|
||||
S_LBRACE = 66, // "{"
|
||||
S_RBRACE = 67, // "}"
|
||||
S_LBRACKET = 68, // "["
|
||||
S_RBRACKET = 69, // "]"
|
||||
S_COMMA = 70, // ","
|
||||
S_DOT = 71, // "."
|
||||
S_DOUBLEDOT = 72, // ".."
|
||||
S_ELLIPSIS = 73, // "..."
|
||||
S_DOUBLECOLON = 74, // "::"
|
||||
S_COLON = 75, // ":"
|
||||
S_SEMICOLON = 76, // ";"
|
||||
S_QMARK = 77, // "?"
|
||||
S_INCREMENT = 78, // "++"
|
||||
S_DECREMENT = 79, // "--"
|
||||
S_LSHIFT = 80, // "<<"
|
||||
S_RSHIFT = 81, // ">>"
|
||||
S_OR = 82, // "||"
|
||||
S_AND = 83, // "&&"
|
||||
S_EQUALITY = 84, // "=="
|
||||
S_INEQUALITY = 85, // "!="
|
||||
S_LESS_EQUAL = 86, // "<="
|
||||
S_GREATER_EQUAL = 87, // ">="
|
||||
S_LESS = 88, // "<"
|
||||
S_GREATER = 89, // ">"
|
||||
S_NOT = 90, // "!"
|
||||
S_COMPLEMENT = 91, // "~"
|
||||
S_ASSIGN = 92, // "="
|
||||
S_ASSIGN_ADD = 93, // "+="
|
||||
S_ASSIGN_SUB = 94, // "-="
|
||||
S_ASSIGN_MUL = 95, // "*="
|
||||
S_ASSIGN_DIV = 96, // "/="
|
||||
S_ASSIGN_MOD = 97, // "%="
|
||||
S_ASSIGN_BW_OR = 98, // "|="
|
||||
S_ASSIGN_BW_AND = 99, // "&="
|
||||
S_ASSIGN_BW_EXOR = 100, // "^="
|
||||
S_ASSIGN_RSHIFT = 101, // ">>="
|
||||
S_ASSIGN_LSHIFT = 102, // "<<="
|
||||
S_BITWISE_OR = 103, // "|"
|
||||
S_BITWISE_AND = 104, // "&"
|
||||
S_BITWISE_EXOR = 105, // "^"
|
||||
S_ADD = 106, // "+"
|
||||
S_SUB = 107, // "-"
|
||||
S_MUL = 108, // "*"
|
||||
S_DIV = 109, // "/"
|
||||
S_MOD = 110, // "%"
|
||||
S_PATH = 111, // "path"
|
||||
S_IDENTIFIER = 112, // "identifier"
|
||||
S_STRING = 113, // "string literal"
|
||||
S_ISTRING = 114, // "localized string"
|
||||
S_HASHSTR = 115, // "hash string"
|
||||
S_FLOAT = 116, // "float"
|
||||
S_INTEGER = 117, // "integer"
|
||||
S_SIZEOF = 118, // SIZEOF
|
||||
S_THEN = 119, // THEN
|
||||
S_TERN = 120, // TERN
|
||||
S_NEG = 121, // NEG
|
||||
S_ANIMREF = 122, // ANIMREF
|
||||
S_PREINC = 123, // PREINC
|
||||
S_PREDEC = 124, // PREDEC
|
||||
S_POSTINC = 125, // POSTINC
|
||||
S_POSTDEC = 126, // POSTDEC
|
||||
S_YYACCEPT = 127, // $accept
|
||||
S_root = 128, // root
|
||||
S_program = 129, // program
|
||||
S_inline = 130, // inline
|
||||
S_include = 131, // include
|
||||
S_declaration = 132, // declaration
|
||||
S_decl_usingtree = 133, // decl_usingtree
|
||||
S_decl_function = 134, // decl_function
|
||||
S_stmt = 135, // stmt
|
||||
S_stmt_or_dev = 136, // stmt_or_dev
|
||||
S_stmt_list = 137, // stmt_list
|
||||
S_stmt_or_dev_list = 138, // stmt_or_dev_list
|
||||
S_stmt_dev = 139, // stmt_dev
|
||||
S_stmt_comp = 140, // stmt_comp
|
||||
S_stmt_expr = 141, // stmt_expr
|
||||
S_stmt_call = 142, // stmt_call
|
||||
S_stmt_const = 143, // stmt_const
|
||||
S_stmt_assign = 144, // stmt_assign
|
||||
S_stmt_endon = 145, // stmt_endon
|
||||
S_stmt_notify = 146, // stmt_notify
|
||||
S_stmt_wait = 147, // stmt_wait
|
||||
S_stmt_waitrealtime = 148, // stmt_waitrealtime
|
||||
S_stmt_waittill = 149, // stmt_waittill
|
||||
S_stmt_waittillmatch = 150, // stmt_waittillmatch
|
||||
S_stmt_waittillframeend = 151, // stmt_waittillframeend
|
||||
S_stmt_if = 152, // stmt_if
|
||||
S_stmt_ifelse = 153, // stmt_ifelse
|
||||
S_stmt_while = 154, // stmt_while
|
||||
S_stmt_dowhile = 155, // stmt_dowhile
|
||||
S_stmt_for = 156, // stmt_for
|
||||
S_stmt_foreach = 157, // stmt_foreach
|
||||
S_stmt_switch = 158, // stmt_switch
|
||||
S_stmt_case = 159, // stmt_case
|
||||
S_stmt_default = 160, // stmt_default
|
||||
S_stmt_break = 161, // stmt_break
|
||||
S_stmt_continue = 162, // stmt_continue
|
||||
S_stmt_return = 163, // stmt_return
|
||||
S_stmt_prof_begin = 164, // stmt_prof_begin
|
||||
S_stmt_prof_end = 165, // stmt_prof_end
|
||||
S_expr = 166, // expr
|
||||
S_expr_or_empty = 167, // expr_or_empty
|
||||
S_expr_increment = 168, // expr_increment
|
||||
S_expr_decrement = 169, // expr_decrement
|
||||
S_expr_assign = 170, // expr_assign
|
||||
S_expr_ternary = 171, // expr_ternary
|
||||
S_expr_binary = 172, // expr_binary
|
||||
S_expr_primitive = 173, // expr_primitive
|
||||
S_expr_complement = 174, // expr_complement
|
||||
S_expr_negate = 175, // expr_negate
|
||||
S_expr_not = 176, // expr_not
|
||||
S_expr_call = 177, // expr_call
|
||||
S_expr_method = 178, // expr_method
|
||||
S_expr_function = 179, // expr_function
|
||||
S_expr_pointer = 180, // expr_pointer
|
||||
S_expr_parameters = 181, // expr_parameters
|
||||
S_expr_parameters_default = 182, // expr_parameters_default
|
||||
S_expr_arguments = 183, // expr_arguments
|
||||
S_expr_arguments_no_empty = 184, // expr_arguments_no_empty
|
||||
S_expr_getnextarraykey = 185, // expr_getnextarraykey
|
||||
S_expr_getfirstarraykey = 186, // expr_getfirstarraykey
|
||||
S_expr_getdvarcoloralpha = 187, // expr_getdvarcoloralpha
|
||||
S_expr_getdvarcolorblue = 188, // expr_getdvarcolorblue
|
||||
S_expr_getdvarcolorgreen = 189, // expr_getdvarcolorgreen
|
||||
S_expr_getdvarcolorred = 190, // expr_getdvarcolorred
|
||||
S_expr_getdvarvector = 191, // expr_getdvarvector
|
||||
S_expr_getdvarfloat = 192, // expr_getdvarfloat
|
||||
S_expr_getdvarint = 193, // expr_getdvarint
|
||||
S_expr_getdvar = 194, // expr_getdvar
|
||||
S_expr_gettime = 195, // expr_gettime
|
||||
S_expr_abs = 196, // expr_abs
|
||||
S_expr_vectortoangles = 197, // expr_vectortoangles
|
||||
S_expr_angleclamp180 = 198, // expr_angleclamp180
|
||||
S_expr_anglestoforward = 199, // expr_anglestoforward
|
||||
S_expr_anglestoright = 200, // expr_anglestoright
|
||||
S_expr_anglestoup = 201, // expr_anglestoup
|
||||
S_expr_vectorscale = 202, // expr_vectorscale
|
||||
S_expr_isdefined = 203, // expr_isdefined
|
||||
S_expr_reference = 204, // expr_reference
|
||||
S_expr_array = 205, // expr_array
|
||||
S_expr_field = 206, // expr_field
|
||||
S_expr_size = 207, // expr_size
|
||||
S_expr_paren = 208, // expr_paren
|
||||
S_expr_object = 209, // expr_object
|
||||
S_expr_empty_array = 210, // expr_empty_array
|
||||
S_expr_undefined = 211, // expr_undefined
|
||||
S_expr_game = 212, // expr_game
|
||||
S_expr_self = 213, // expr_self
|
||||
S_expr_anim = 214, // expr_anim
|
||||
S_expr_level = 215, // expr_level
|
||||
S_expr_animation = 216, // expr_animation
|
||||
S_expr_animtree = 217, // expr_animtree
|
||||
S_expr_identifier_nosize = 218, // expr_identifier_nosize
|
||||
S_expr_identifier = 219, // expr_identifier
|
||||
S_expr_path = 220, // expr_path
|
||||
S_expr_istring = 221, // expr_istring
|
||||
S_expr_string = 222, // expr_string
|
||||
S_expr_vector = 223, // expr_vector
|
||||
S_expr_hash = 224, // expr_hash
|
||||
S_expr_float = 225, // expr_float
|
||||
S_expr_integer = 226, // expr_integer
|
||||
S_expr_false = 227, // expr_false
|
||||
S_expr_true = 228 // expr_true
|
||||
S_WAITTILL = 16, // "waittill"
|
||||
S_WAITTILLMATCH = 17, // "waittillmatch"
|
||||
S_WAITTILLFRAMEEND = 18, // "waittillframeend"
|
||||
S_IF = 19, // "if"
|
||||
S_ELSE = 20, // "else"
|
||||
S_DO = 21, // "do"
|
||||
S_WHILE = 22, // "while"
|
||||
S_FOR = 23, // "for"
|
||||
S_FOREACH = 24, // "foreach"
|
||||
S_IN = 25, // "in"
|
||||
S_SWITCH = 26, // "switch"
|
||||
S_CASE = 27, // "case"
|
||||
S_DEFAULT = 28, // "default"
|
||||
S_BREAK = 29, // "break"
|
||||
S_CONTINUE = 30, // "continue"
|
||||
S_RETURN = 31, // "return"
|
||||
S_PROFBEGIN = 32, // "prof_begin"
|
||||
S_PROFEND = 33, // "prof_end"
|
||||
S_THREAD = 34, // "thread"
|
||||
S_TRUE = 35, // "true"
|
||||
S_FALSE = 36, // "false"
|
||||
S_UNDEFINED = 37, // "undefined"
|
||||
S_SIZE = 38, // "size"
|
||||
S_GAME = 39, // "game"
|
||||
S_SELF = 40, // "self"
|
||||
S_ANIM = 41, // "anim"
|
||||
S_LEVEL = 42, // "level"
|
||||
S_CONST = 43, // "const"
|
||||
S_GETNEXTARRAYKEY = 44, // "getnextarraykey"
|
||||
S_GETFIRSTARRAYKEY = 45, // "getfirstarraykey"
|
||||
S_GETDVARCOLORALPHA = 46, // "getdvarcoloralpha"
|
||||
S_GETDVARCOLORBLUE = 47, // "getdvarcolorblue"
|
||||
S_GETDVARCOLORGREEN = 48, // "getdvarcolorgreen"
|
||||
S_GETDVARCOLORRED = 49, // "getdvarcolorred"
|
||||
S_GETDVARVECTOR = 50, // "getdvarvector"
|
||||
S_GETDVARFLOAT = 51, // "getdvarfloat"
|
||||
S_GETDVARINT = 52, // "getdvarint"
|
||||
S_GETDVAR = 53, // "getdvar"
|
||||
S_GETTIME = 54, // "gettime"
|
||||
S_ABS = 55, // "abs"
|
||||
S_VECTORTOANGLES = 56, // "vectortoangles"
|
||||
S_ANGLECLAMP180 = 57, // "angleclamp180"
|
||||
S_ANGLESTOFORWARD = 58, // "anglestoforward"
|
||||
S_ANGLESTORIGHT = 59, // "anglestoright"
|
||||
S_ANGLESTOUP = 60, // "anglestoup"
|
||||
S_VECTORSCALE = 61, // "vectorscale"
|
||||
S_ISDEFINED = 62, // "isdefined"
|
||||
S_LPAREN = 63, // "("
|
||||
S_RPAREN = 64, // ")"
|
||||
S_LBRACE = 65, // "{"
|
||||
S_RBRACE = 66, // "}"
|
||||
S_LBRACKET = 67, // "["
|
||||
S_RBRACKET = 68, // "]"
|
||||
S_COMMA = 69, // ","
|
||||
S_DOT = 70, // "."
|
||||
S_DOUBLEDOT = 71, // ".."
|
||||
S_ELLIPSIS = 72, // "..."
|
||||
S_DOUBLECOLON = 73, // "::"
|
||||
S_COLON = 74, // ":"
|
||||
S_SEMICOLON = 75, // ";"
|
||||
S_QMARK = 76, // "?"
|
||||
S_INCREMENT = 77, // "++"
|
||||
S_DECREMENT = 78, // "--"
|
||||
S_LSHIFT = 79, // "<<"
|
||||
S_RSHIFT = 80, // ">>"
|
||||
S_OR = 81, // "||"
|
||||
S_AND = 82, // "&&"
|
||||
S_EQUALITY = 83, // "=="
|
||||
S_INEQUALITY = 84, // "!="
|
||||
S_LESS_EQUAL = 85, // "<="
|
||||
S_GREATER_EQUAL = 86, // ">="
|
||||
S_LESS = 87, // "<"
|
||||
S_GREATER = 88, // ">"
|
||||
S_NOT = 89, // "!"
|
||||
S_COMPLEMENT = 90, // "~"
|
||||
S_ASSIGN = 91, // "="
|
||||
S_ASSIGN_ADD = 92, // "+="
|
||||
S_ASSIGN_SUB = 93, // "-="
|
||||
S_ASSIGN_MUL = 94, // "*="
|
||||
S_ASSIGN_DIV = 95, // "/="
|
||||
S_ASSIGN_MOD = 96, // "%="
|
||||
S_ASSIGN_BW_OR = 97, // "|="
|
||||
S_ASSIGN_BW_AND = 98, // "&="
|
||||
S_ASSIGN_BW_EXOR = 99, // "^="
|
||||
S_ASSIGN_RSHIFT = 100, // ">>="
|
||||
S_ASSIGN_LSHIFT = 101, // "<<="
|
||||
S_BITWISE_OR = 102, // "|"
|
||||
S_BITWISE_AND = 103, // "&"
|
||||
S_BITWISE_EXOR = 104, // "^"
|
||||
S_ADD = 105, // "+"
|
||||
S_SUB = 106, // "-"
|
||||
S_MUL = 107, // "*"
|
||||
S_DIV = 108, // "/"
|
||||
S_MOD = 109, // "%"
|
||||
S_PATH = 110, // "path"
|
||||
S_IDENTIFIER = 111, // "identifier"
|
||||
S_STRING = 112, // "string literal"
|
||||
S_ISTRING = 113, // "localized string"
|
||||
S_HASHSTR = 114, // "hash string"
|
||||
S_FLOAT = 115, // "float"
|
||||
S_INTEGER = 116, // "integer"
|
||||
S_SIZEOF = 117, // SIZEOF
|
||||
S_THEN = 118, // THEN
|
||||
S_TERN = 119, // TERN
|
||||
S_NEG = 120, // NEG
|
||||
S_ANIMREF = 121, // ANIMREF
|
||||
S_PREINC = 122, // PREINC
|
||||
S_PREDEC = 123, // PREDEC
|
||||
S_POSTINC = 124, // POSTINC
|
||||
S_POSTDEC = 125, // POSTDEC
|
||||
S_YYACCEPT = 126, // $accept
|
||||
S_root = 127, // root
|
||||
S_program = 128, // program
|
||||
S_inline = 129, // inline
|
||||
S_include = 130, // include
|
||||
S_declaration = 131, // declaration
|
||||
S_decl_usingtree = 132, // decl_usingtree
|
||||
S_decl_function = 133, // decl_function
|
||||
S_stmt = 134, // stmt
|
||||
S_stmt_or_dev = 135, // stmt_or_dev
|
||||
S_stmt_list = 136, // stmt_list
|
||||
S_stmt_or_dev_list = 137, // stmt_or_dev_list
|
||||
S_stmt_dev = 138, // stmt_dev
|
||||
S_stmt_comp = 139, // stmt_comp
|
||||
S_stmt_expr = 140, // stmt_expr
|
||||
S_stmt_call = 141, // stmt_call
|
||||
S_stmt_const = 142, // stmt_const
|
||||
S_stmt_assign = 143, // stmt_assign
|
||||
S_stmt_endon = 144, // stmt_endon
|
||||
S_stmt_notify = 145, // stmt_notify
|
||||
S_stmt_wait = 146, // stmt_wait
|
||||
S_stmt_waittill = 147, // stmt_waittill
|
||||
S_stmt_waittillmatch = 148, // stmt_waittillmatch
|
||||
S_stmt_waittillframeend = 149, // stmt_waittillframeend
|
||||
S_stmt_if = 150, // stmt_if
|
||||
S_stmt_ifelse = 151, // stmt_ifelse
|
||||
S_stmt_while = 152, // stmt_while
|
||||
S_stmt_dowhile = 153, // stmt_dowhile
|
||||
S_stmt_for = 154, // stmt_for
|
||||
S_stmt_foreach = 155, // stmt_foreach
|
||||
S_stmt_switch = 156, // stmt_switch
|
||||
S_stmt_case = 157, // stmt_case
|
||||
S_stmt_default = 158, // stmt_default
|
||||
S_stmt_break = 159, // stmt_break
|
||||
S_stmt_continue = 160, // stmt_continue
|
||||
S_stmt_return = 161, // stmt_return
|
||||
S_stmt_prof_begin = 162, // stmt_prof_begin
|
||||
S_stmt_prof_end = 163, // stmt_prof_end
|
||||
S_expr = 164, // expr
|
||||
S_expr_or_empty = 165, // expr_or_empty
|
||||
S_expr_increment = 166, // expr_increment
|
||||
S_expr_decrement = 167, // expr_decrement
|
||||
S_expr_assign = 168, // expr_assign
|
||||
S_expr_ternary = 169, // expr_ternary
|
||||
S_expr_binary = 170, // expr_binary
|
||||
S_expr_primitive = 171, // expr_primitive
|
||||
S_expr_complement = 172, // expr_complement
|
||||
S_expr_negate = 173, // expr_negate
|
||||
S_expr_not = 174, // expr_not
|
||||
S_expr_call = 175, // expr_call
|
||||
S_expr_method = 176, // expr_method
|
||||
S_expr_function = 177, // expr_function
|
||||
S_expr_pointer = 178, // expr_pointer
|
||||
S_expr_parameters = 179, // expr_parameters
|
||||
S_expr_parameters_default = 180, // expr_parameters_default
|
||||
S_expr_arguments = 181, // expr_arguments
|
||||
S_expr_arguments_no_empty = 182, // expr_arguments_no_empty
|
||||
S_expr_getnextarraykey = 183, // expr_getnextarraykey
|
||||
S_expr_getfirstarraykey = 184, // expr_getfirstarraykey
|
||||
S_expr_getdvarcoloralpha = 185, // expr_getdvarcoloralpha
|
||||
S_expr_getdvarcolorblue = 186, // expr_getdvarcolorblue
|
||||
S_expr_getdvarcolorgreen = 187, // expr_getdvarcolorgreen
|
||||
S_expr_getdvarcolorred = 188, // expr_getdvarcolorred
|
||||
S_expr_getdvarvector = 189, // expr_getdvarvector
|
||||
S_expr_getdvarfloat = 190, // expr_getdvarfloat
|
||||
S_expr_getdvarint = 191, // expr_getdvarint
|
||||
S_expr_getdvar = 192, // expr_getdvar
|
||||
S_expr_gettime = 193, // expr_gettime
|
||||
S_expr_abs = 194, // expr_abs
|
||||
S_expr_vectortoangles = 195, // expr_vectortoangles
|
||||
S_expr_angleclamp180 = 196, // expr_angleclamp180
|
||||
S_expr_anglestoforward = 197, // expr_anglestoforward
|
||||
S_expr_anglestoright = 198, // expr_anglestoright
|
||||
S_expr_anglestoup = 199, // expr_anglestoup
|
||||
S_expr_vectorscale = 200, // expr_vectorscale
|
||||
S_expr_isdefined = 201, // expr_isdefined
|
||||
S_expr_reference = 202, // expr_reference
|
||||
S_expr_array = 203, // expr_array
|
||||
S_expr_field = 204, // expr_field
|
||||
S_expr_size = 205, // expr_size
|
||||
S_expr_paren = 206, // expr_paren
|
||||
S_expr_object = 207, // expr_object
|
||||
S_expr_empty_array = 208, // expr_empty_array
|
||||
S_expr_undefined = 209, // expr_undefined
|
||||
S_expr_game = 210, // expr_game
|
||||
S_expr_self = 211, // expr_self
|
||||
S_expr_anim = 212, // expr_anim
|
||||
S_expr_level = 213, // expr_level
|
||||
S_expr_animation = 214, // expr_animation
|
||||
S_expr_animtree = 215, // expr_animtree
|
||||
S_expr_identifier_nosize = 216, // expr_identifier_nosize
|
||||
S_expr_identifier = 217, // expr_identifier
|
||||
S_expr_path = 218, // expr_path
|
||||
S_expr_istring = 219, // expr_istring
|
||||
S_expr_string = 220, // expr_string
|
||||
S_expr_vector = 221, // expr_vector
|
||||
S_expr_hash = 222, // expr_hash
|
||||
S_expr_float = 223, // expr_float
|
||||
S_expr_integer = 224, // expr_integer
|
||||
S_expr_false = 225, // expr_false
|
||||
S_expr_true = 226 // expr_true
|
||||
};
|
||||
};
|
||||
|
||||
@ -1487,10 +1481,6 @@ namespace xsk { namespace arc {
|
||||
value.move< stmt_wait::ptr > (std::move (that.value));
|
||||
break;
|
||||
|
||||
case symbol_kind::S_stmt_waitrealtime: // stmt_waitrealtime
|
||||
value.move< stmt_waitrealtime::ptr > (std::move (that.value));
|
||||
break;
|
||||
|
||||
case symbol_kind::S_stmt_waittill: // stmt_waittill
|
||||
value.move< stmt_waittill::ptr > (std::move (that.value));
|
||||
break;
|
||||
@ -2622,20 +2612,6 @@ namespace xsk { namespace arc {
|
||||
{}
|
||||
#endif
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
basic_symbol (typename Base::kind_type t, stmt_waitrealtime::ptr&& v, location_type&& l)
|
||||
: Base (t)
|
||||
, value (std::move (v))
|
||||
, location (std::move (l))
|
||||
{}
|
||||
#else
|
||||
basic_symbol (typename Base::kind_type t, const stmt_waitrealtime::ptr& v, const location_type& l)
|
||||
: Base (t)
|
||||
, value (v)
|
||||
, location (l)
|
||||
{}
|
||||
#endif
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
basic_symbol (typename Base::kind_type t, stmt_waittill::ptr&& v, location_type&& l)
|
||||
: Base (t)
|
||||
@ -3051,10 +3027,6 @@ switch (yykind)
|
||||
value.template destroy< stmt_wait::ptr > ();
|
||||
break;
|
||||
|
||||
case symbol_kind::S_stmt_waitrealtime: // stmt_waitrealtime
|
||||
value.template destroy< stmt_waitrealtime::ptr > ();
|
||||
break;
|
||||
|
||||
case symbol_kind::S_stmt_waittill: // stmt_waittill
|
||||
value.template destroy< stmt_waittill::ptr > ();
|
||||
break;
|
||||
@ -3473,21 +3445,6 @@ switch (yykind)
|
||||
return symbol_type (token::WAIT, l);
|
||||
}
|
||||
#endif
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
static
|
||||
symbol_type
|
||||
make_WAITREALTIME (location_type l)
|
||||
{
|
||||
return symbol_type (token::WAITREALTIME, std::move (l));
|
||||
}
|
||||
#else
|
||||
static
|
||||
symbol_type
|
||||
make_WAITREALTIME (const location_type& l)
|
||||
{
|
||||
return symbol_type (token::WAITREALTIME, l);
|
||||
}
|
||||
#endif
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
static
|
||||
symbol_type
|
||||
@ -5482,8 +5439,8 @@ switch (yykind)
|
||||
/// Constants.
|
||||
enum
|
||||
{
|
||||
yylast_ = 3307, ///< Last index in yytable_.
|
||||
yynnts_ = 102, ///< Number of nonterminal symbols.
|
||||
yylast_ = 3330, ///< Last index in yytable_.
|
||||
yynnts_ = 101, ///< Number of nonterminal symbols.
|
||||
yyfinal_ = 28 ///< Termination state number.
|
||||
};
|
||||
|
||||
@ -5847,10 +5804,6 @@ switch (yykind)
|
||||
value.copy< stmt_wait::ptr > (YY_MOVE (that.value));
|
||||
break;
|
||||
|
||||
case symbol_kind::S_stmt_waitrealtime: // stmt_waitrealtime
|
||||
value.copy< stmt_waitrealtime::ptr > (YY_MOVE (that.value));
|
||||
break;
|
||||
|
||||
case symbol_kind::S_stmt_waittill: // stmt_waittill
|
||||
value.copy< stmt_waittill::ptr > (YY_MOVE (that.value));
|
||||
break;
|
||||
@ -6233,10 +6186,6 @@ switch (yykind)
|
||||
value.move< stmt_wait::ptr > (YY_MOVE (s.value));
|
||||
break;
|
||||
|
||||
case symbol_kind::S_stmt_waitrealtime: // stmt_waitrealtime
|
||||
value.move< stmt_waitrealtime::ptr > (YY_MOVE (s.value));
|
||||
break;
|
||||
|
||||
case symbol_kind::S_stmt_waittill: // stmt_waittill
|
||||
value.move< stmt_waittill::ptr > (YY_MOVE (s.value));
|
||||
break;
|
||||
@ -6320,7 +6269,7 @@ switch (yykind)
|
||||
|
||||
#line 13 "parser.ypp"
|
||||
} } // xsk::arc
|
||||
#line 6324 "parser.hpp"
|
||||
#line 6273 "parser.hpp"
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -49,10 +49,10 @@ private:
|
||||
auto dump_stmt_endon(stmt_endon const& stm) -> void;
|
||||
auto dump_stmt_notify(stmt_notify const& stm) -> void;
|
||||
auto dump_stmt_wait(stmt_wait const& stm) -> void;
|
||||
auto dump_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void;
|
||||
auto dump_stmt_waittill(stmt_waittill const& stm) -> void;
|
||||
auto dump_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void;
|
||||
auto dump_stmt_waittillframeend(stmt_waittillframeend const& stm) -> void;
|
||||
auto dump_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void;
|
||||
auto dump_stmt_if(stmt_if const& stm) -> void;
|
||||
auto dump_stmt_ifelse(stmt_ifelse const& stm) -> void;
|
||||
auto dump_stmt_while(stmt_while const& stm) -> void;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -18,12 +18,10 @@ class assembler
|
||||
assembly const* assembly_;
|
||||
utils::writer script_;
|
||||
utils::writer stack_;
|
||||
utils::writer devmap_;
|
||||
u32 devmap_count_;
|
||||
|
||||
public:
|
||||
assembler(context const* ctx);
|
||||
auto assemble(assembly const& data) -> std::tuple<buffer, buffer, buffer>;
|
||||
auto assemble(assembly const& data) -> std::pair<buffer, buffer>;
|
||||
|
||||
private:
|
||||
auto assemble_function(function const& func) -> void;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -220,19 +220,12 @@ enum class opcode : u8
|
||||
OP_count,
|
||||
};
|
||||
|
||||
struct sourcepos
|
||||
{
|
||||
u16 line;
|
||||
u16 column;
|
||||
};
|
||||
|
||||
struct instruction
|
||||
{
|
||||
using ptr = std::unique_ptr<instruction>;
|
||||
|
||||
u32 index;
|
||||
u32 size;
|
||||
sourcepos pos;
|
||||
opcode opcode;
|
||||
std::vector<std::string> data;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -14,7 +14,6 @@ struct directive
|
||||
|
||||
kind type;
|
||||
bool skip;
|
||||
bool exec;
|
||||
};
|
||||
|
||||
} // namespace xsk::gsc
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -12,7 +12,7 @@ class position
|
||||
{
|
||||
public:
|
||||
typedef const std::string filename_type;
|
||||
typedef u16 counter_type;
|
||||
typedef int counter_type;
|
||||
|
||||
filename_type *filename;
|
||||
counter_type line;
|
||||
@ -119,12 +119,12 @@ public:
|
||||
|
||||
auto print() const -> std::string
|
||||
{
|
||||
return std::format("{}:{}:{}", *begin.filename, begin.line, begin.column);
|
||||
return fmt::format("{}:{}:{}", *begin.filename, begin.line, begin.column);
|
||||
}
|
||||
|
||||
auto label() const -> std::string
|
||||
{
|
||||
return std::format("loc_{:X}", begin.line);
|
||||
return fmt::format("loc_{:X}", begin.line);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -29,17 +29,10 @@ enum class instance : u8
|
||||
|
||||
enum class build : u8
|
||||
{
|
||||
prod = 0,
|
||||
dev_blocks = 1 << 0,
|
||||
dev_maps = 1 << 1,
|
||||
dev = dev_blocks | dev_maps,
|
||||
dev,
|
||||
prod,
|
||||
};
|
||||
|
||||
inline build operator&(build lhs, build rhs)
|
||||
{
|
||||
return static_cast<build>(static_cast<std::underlying_type<build>::type>(lhs) & static_cast<std::underlying_type<build>::type>(rhs));
|
||||
}
|
||||
|
||||
enum class endian : u8
|
||||
{
|
||||
little,
|
||||
@ -71,7 +64,7 @@ struct props
|
||||
{
|
||||
enum values : u32
|
||||
{
|
||||
none = 0,
|
||||
none = 0 << 0,
|
||||
str4 = 1 << 0, // strings size 4
|
||||
tok4 = 1 << 1, // tokenid size 4
|
||||
waitframe = 1 << 2, // waitframe opcode
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -22,7 +22,6 @@ class compiler
|
||||
std::vector<scope*> break_blks_;
|
||||
std::vector<scope*> continue_blks_;
|
||||
std::string animname_;
|
||||
sourcepos debug_pos_;
|
||||
u32 index_;
|
||||
u32 label_idx_;
|
||||
bool can_break_;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -18,7 +18,7 @@ namespace xsk::gsc
|
||||
class context
|
||||
{
|
||||
public:
|
||||
using fs_callback = std::function<std::pair<buffer, std::vector<u8>>(context const*, std::string const&)>;
|
||||
using fs_callback = std::function<std::pair<buffer, std::vector<u8>>(std::string const&)>;
|
||||
|
||||
context(props props, engine engine, endian endian, system system, u32 str_count);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -13,7 +13,6 @@
|
||||
#include <array>
|
||||
#include <deque>
|
||||
#include <filesystem>
|
||||
#include <format>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
@ -32,6 +31,13 @@
|
||||
#include <vector>
|
||||
#include <version>
|
||||
|
||||
#ifdef __cpp_lib_format
|
||||
#include <format>
|
||||
namespace fmt = std;
|
||||
#else
|
||||
#include <fmt/core.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS_
|
||||
#undef ERROR
|
||||
#undef IN
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
22
premake5.lua
22
premake5.lua
@ -84,7 +84,7 @@ workspace "gsc-tool"
|
||||
|
||||
configurations { "debug", "release" }
|
||||
|
||||
if os.istarget("linux") or os.istarget("macosx") then
|
||||
if os.istarget("linux") or os.istarget("darwin") then
|
||||
platforms { "x64", "arm64" }
|
||||
else
|
||||
platforms { "x86", "x64", "arm64" }
|
||||
@ -119,15 +119,20 @@ workspace "gsc-tool"
|
||||
staticruntime "On"
|
||||
warnings "Extra"
|
||||
|
||||
filter "system:linux"
|
||||
linkoptions "-fuse-ld=lld"
|
||||
filter { "system:linux", "system:macosx" }
|
||||
buildoptions "-pthread"
|
||||
linkoptions "-pthread"
|
||||
filter {}
|
||||
|
||||
filter { "system:linux", "platforms:arm64" }
|
||||
if os.istarget("linux") then
|
||||
filter { "platforms:arm64" }
|
||||
buildoptions "--target=arm64-linux-gnu"
|
||||
linkoptions "--target=arm64-linux-gnu"
|
||||
filter {}
|
||||
|
||||
linkoptions "-fuse-ld=lld"
|
||||
end
|
||||
|
||||
filter { "system:macosx", "platforms:arm64" }
|
||||
buildoptions "-arch arm64"
|
||||
linkoptions "-arch arm64"
|
||||
@ -156,7 +161,6 @@ project "xsk-tool"
|
||||
dependson "xsk-gsc"
|
||||
|
||||
files {
|
||||
"./include/*.hpp",
|
||||
"./src/tool/**.h",
|
||||
"./src/tool/**.hpp",
|
||||
"./src/tool/**.cpp"
|
||||
@ -172,7 +176,7 @@ project "xsk-tool"
|
||||
"./include",
|
||||
}
|
||||
|
||||
cxxopts:link()
|
||||
fmt:link()
|
||||
zlib:link()
|
||||
|
||||
project "xsk-utils"
|
||||
@ -189,6 +193,7 @@ project "xsk-utils"
|
||||
"./include",
|
||||
}
|
||||
|
||||
fmt:include()
|
||||
zlib:include()
|
||||
|
||||
project "xsk-arc"
|
||||
@ -205,6 +210,8 @@ project "xsk-arc"
|
||||
"./include",
|
||||
}
|
||||
|
||||
fmt:include()
|
||||
|
||||
project "xsk-gsc"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
@ -219,5 +226,8 @@ project "xsk-gsc"
|
||||
"./include",
|
||||
}
|
||||
|
||||
fmt:include()
|
||||
|
||||
group "Dependencies"
|
||||
zlib:project()
|
||||
fmt:project()
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -14,20 +14,17 @@ assembler::assembler(context const* ctx) : ctx_{ ctx }, script_{ ctx->endian() =
|
||||
{
|
||||
}
|
||||
|
||||
auto assembler::assemble(assembly const& data, std::string const& name) -> std::pair<buffer, buffer>
|
||||
auto assembler::assemble(assembly const& data, std::string const& name) -> buffer
|
||||
{
|
||||
assembly_ = &data;
|
||||
script_.clear();
|
||||
devmap_.clear();
|
||||
strpool_.clear();
|
||||
exports_.clear();
|
||||
imports_.clear();
|
||||
strings_.clear();
|
||||
anims_.clear();
|
||||
devmap_count_ = 0;
|
||||
auto head = header{};
|
||||
|
||||
devmap_.pos(sizeof(u32));
|
||||
script_.pos((ctx_->props() & props::headerxx) ? 0 : (ctx_->props() & props::header72) ? 72 : 64);
|
||||
process_string(name);
|
||||
|
||||
@ -188,7 +185,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std::
|
||||
head.flags = 0;
|
||||
head.name = resolve_string(name);
|
||||
|
||||
auto const endpos = script_.pos();
|
||||
auto endpos = script_.pos();
|
||||
|
||||
script_.pos(0);
|
||||
script_.write<u64>(ctx_->magic());
|
||||
@ -226,12 +223,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> std::
|
||||
script_.write<u8>(head.flags);
|
||||
script_.pos(endpos);
|
||||
|
||||
auto const dev_endpos = devmap_.pos();
|
||||
devmap_.pos(0);
|
||||
devmap_.write<u32>(devmap_count_);
|
||||
devmap_.pos(dev_endpos);
|
||||
|
||||
return { buffer{ script_.data(), script_.pos() }, buffer{ devmap_.data(), devmap_.pos() } };
|
||||
return buffer{ script_.data(), script_.pos() };
|
||||
}
|
||||
|
||||
auto assembler::assemble_function(function& func) -> void
|
||||
@ -280,14 +272,6 @@ auto assembler::assemble_instruction(instruction const& inst) -> void
|
||||
{
|
||||
script_.write<u8>(static_cast<u8>(ctx_->opcode_id(inst.opcode)));
|
||||
|
||||
if ((ctx_->build() & build::dev_maps) != build::prod)
|
||||
{
|
||||
devmap_.write<u32>(script_.pos());
|
||||
devmap_.write<u16>(inst.pos.line);
|
||||
devmap_.write<u16>(inst.pos.column);
|
||||
devmap_count_++;
|
||||
}
|
||||
|
||||
switch (inst.opcode)
|
||||
{
|
||||
case opcode::OP_End:
|
||||
@ -467,7 +451,7 @@ auto assembler::assemble_instruction(instruction const& inst) -> void
|
||||
assemble_end_switch(inst);
|
||||
break;
|
||||
default:
|
||||
throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
|
||||
throw asm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
|
||||
}
|
||||
}
|
||||
|
||||
@ -533,7 +517,7 @@ auto assembler::assemble_end_switch(instruction const& inst) -> void
|
||||
}
|
||||
else
|
||||
{
|
||||
throw asm_error(std::format("invalid switch case {}", inst.data[1 + (3 * i)]));
|
||||
throw asm_error(fmt::format("invalid switch case {}", inst.data[1 + (3 * i)]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -846,7 +830,7 @@ auto assembler::align_instruction(instruction& inst) -> void
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw asm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
|
||||
throw asm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,7 +844,7 @@ auto assembler::resolve_label(std::string const& name) -> i32
|
||||
}
|
||||
}
|
||||
|
||||
throw asm_error(std::format("couldn't resolve label address of {}", name));
|
||||
throw asm_error(fmt::format("couldn't resolve label address of {}", name));
|
||||
}
|
||||
|
||||
auto assembler::resolve_string(std::string const& name) -> u16
|
||||
@ -872,7 +856,7 @@ auto assembler::resolve_string(std::string const& name) -> u16
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
throw asm_error(std::format("couldn't resolve string address of {}", name));
|
||||
throw asm_error(fmt::format("couldn't resolve string address of {}", name));
|
||||
}
|
||||
|
||||
void assembler::add_stringref(std::string const& str, string_type type, u32 ref)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -104,6 +104,7 @@ auto node::is_boolean() -> bool
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -410,10 +411,10 @@ XSK_ARC_STMT_IS(stmt_expr)
|
||||
XSK_ARC_STMT_IS(stmt_endon)
|
||||
XSK_ARC_STMT_IS(stmt_notify)
|
||||
XSK_ARC_STMT_IS(stmt_wait)
|
||||
XSK_ARC_STMT_IS(stmt_waitrealtime)
|
||||
XSK_ARC_STMT_IS(stmt_waittill)
|
||||
XSK_ARC_STMT_IS(stmt_waittillmatch)
|
||||
XSK_ARC_STMT_IS(stmt_waittillframeend)
|
||||
XSK_ARC_STMT_IS(stmt_waitrealtime)
|
||||
XSK_ARC_STMT_IS(stmt_if)
|
||||
XSK_ARC_STMT_IS(stmt_ifelse)
|
||||
XSK_ARC_STMT_IS(stmt_while)
|
||||
@ -741,10 +742,6 @@ stmt_wait::stmt_wait(location const& loc, expr::ptr time) : stmt{ type::stmt_wai
|
||||
{
|
||||
}
|
||||
|
||||
stmt_waitrealtime::stmt_waitrealtime(location const& loc, expr::ptr time) : stmt{ type::stmt_waitrealtime, loc }, time{ std::move(time) }
|
||||
{
|
||||
}
|
||||
|
||||
stmt_waittill::stmt_waittill(location const& loc, expr::ptr obj, expr::ptr event, expr_arguments::ptr args) : stmt{ type::stmt_waittill, loc }, obj{ std::move(obj) }, event{ std::move(event) }, args{ std::move(args) }
|
||||
{
|
||||
}
|
||||
@ -757,6 +754,10 @@ stmt_waittillframeend::stmt_waittillframeend(location const& loc) : stmt{ type::
|
||||
{
|
||||
}
|
||||
|
||||
stmt_waitrealtime::stmt_waitrealtime(location const& loc, expr::ptr time) : stmt{ type::stmt_waitrealtime, loc }, time{ std::move(time) }
|
||||
{
|
||||
}
|
||||
|
||||
stmt_if::stmt_if(location const& loc, expr::ptr test, stmt::ptr body) : stmt{ type::stmt_if, loc }, test{ std::move(test) }, body{ std::move(body) }
|
||||
{
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -10,27 +10,27 @@
|
||||
namespace xsk::arc
|
||||
{
|
||||
|
||||
error::error(std::string const& what) : std::runtime_error(std::format("[ERROR]: {}", what))
|
||||
error::error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]: {}", what))
|
||||
{
|
||||
}
|
||||
|
||||
asm_error::asm_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:assembler: {}", what))
|
||||
asm_error::asm_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:assembler: {}", what))
|
||||
{
|
||||
}
|
||||
|
||||
disasm_error::disasm_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:disassembler: {}", what))
|
||||
disasm_error::disasm_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:disassembler: {}", what))
|
||||
{
|
||||
}
|
||||
|
||||
ppr_error::ppr_error(location const& loc, std::string const& what) : std::runtime_error(std::format("[ERROR]:preprocessor:{}: {}", loc.print(), what))
|
||||
ppr_error::ppr_error(location const& loc, std::string const& what) : std::runtime_error(fmt::format("[ERROR]:preprocessor:{}: {}", loc.print(), what))
|
||||
{
|
||||
}
|
||||
|
||||
comp_error::comp_error(location const& loc, std::string const& what) : std::runtime_error(std::format("[ERROR]:compiler:{}: {}", loc.print(), what))
|
||||
comp_error::comp_error(location const& loc, std::string const& what) : std::runtime_error(fmt::format("[ERROR]:compiler:{}: {}", loc.print(), what))
|
||||
{
|
||||
}
|
||||
|
||||
decomp_error::decomp_error(std::string const& what) : std::runtime_error(std::format("[ERROR]:decompiler: {}", what))
|
||||
decomp_error::decomp_error(std::string const& what) : std::runtime_error(fmt::format("[ERROR]:decompiler: {}", what))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -83,7 +83,6 @@ auto token::to_string() -> std::string
|
||||
case token::ENDON: return "endon";
|
||||
case token::NOTIFY: return "notify";
|
||||
case token::WAIT: return "wait";
|
||||
case token::WAITREALTIME: return "waitrealtime";
|
||||
case token::WAITTILL: return "waittill";
|
||||
case token::WAITTILLMATCH: return "waittillmatch";
|
||||
case token::WAITTILLFRAMEEND: return "waittillframeend";
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -33,7 +33,6 @@ auto compiler::emit_program(program const& prog) -> void
|
||||
developer_thread_ = false;
|
||||
animtree_ = {};
|
||||
index_ = 0;
|
||||
debug_pos_ = { 0, 0 };
|
||||
|
||||
for (auto const& include : prog.includes)
|
||||
{
|
||||
@ -49,7 +48,7 @@ auto compiler::emit_program(program const& prog) -> void
|
||||
for (auto const& entry : localfuncs_)
|
||||
{
|
||||
if (entry == name)
|
||||
throw comp_error(dec->loc(), std::format("function name '{}' already defined as local function", name));
|
||||
throw comp_error(dec->loc(), fmt::format("function name '{}' already defined as local function", name));
|
||||
}
|
||||
|
||||
localfuncs_.push_back(dec->as<decl_function>().name->value);
|
||||
@ -70,7 +69,7 @@ auto compiler::emit_include(include const& inc) -> void
|
||||
{
|
||||
if (entry == path)
|
||||
{
|
||||
throw comp_error(inc.loc(), std::format("duplicated include file {}", path));
|
||||
throw comp_error(inc.loc(), fmt::format("duplicated include file {}", path));
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,8 +138,6 @@ auto compiler::emit_decl_function(decl_function const& func) -> void
|
||||
|
||||
auto compiler::emit_stmt(stmt const& stm) -> void
|
||||
{
|
||||
debug_pos_ = { stm.loc().begin.line, stm.loc().begin.column };
|
||||
|
||||
switch (stm.kind())
|
||||
{
|
||||
case node::stmt_list:
|
||||
@ -164,9 +161,6 @@ auto compiler::emit_stmt(stmt const& stm) -> void
|
||||
case node::stmt_wait:
|
||||
emit_stmt_wait(stm.as<stmt_wait>());
|
||||
break;
|
||||
case node::stmt_waitrealtime:
|
||||
emit_stmt_waitrealtime(stm.as<stmt_waitrealtime>());
|
||||
break;
|
||||
case node::stmt_waittill:
|
||||
emit_stmt_waittill(stm.as<stmt_waittill>());
|
||||
break;
|
||||
@ -241,17 +235,7 @@ auto compiler::emit_stmt_comp(stmt_comp const& stm) -> void
|
||||
|
||||
auto compiler::emit_stmt_dev(stmt_dev const& stm) -> void
|
||||
{
|
||||
auto end = create_label();
|
||||
developer_thread_ = true;
|
||||
emit_opcode(opcode::OP_DevblockBegin, end);
|
||||
|
||||
auto& paren = scopes_.back();
|
||||
scopes_.push_back(scope(paren.brk, paren.cnt));
|
||||
emit_stmt_list(*stm.block);
|
||||
scopes_.pop_back();
|
||||
|
||||
insert_label(end);
|
||||
developer_thread_ = false;
|
||||
}
|
||||
|
||||
auto compiler::emit_stmt_expr(stmt_expr const& stm) -> void
|
||||
@ -310,12 +294,6 @@ auto compiler::emit_stmt_wait(stmt_wait const& stm) -> void
|
||||
emit_opcode(opcode::OP_Wait);
|
||||
}
|
||||
|
||||
auto compiler::emit_stmt_waitrealtime(stmt_waitrealtime const& stm) -> void
|
||||
{
|
||||
emit_expr(*stm.time);
|
||||
emit_opcode(opcode::OP_RealWait);
|
||||
}
|
||||
|
||||
auto compiler::emit_stmt_waittill(stmt_waittill const& stm) -> void
|
||||
{
|
||||
emit_expr(*stm.event);
|
||||
@ -327,7 +305,7 @@ auto compiler::emit_stmt_waittill(stmt_waittill const& stm) -> void
|
||||
if (entry->is<expr_undefined>())
|
||||
emit_opcode(opcode::OP_SafeDecTop);
|
||||
else
|
||||
emit_opcode(opcode::OP_SafeSetWaittillVariableFieldCached, std::format("{}", variable_access(entry->as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_SafeSetWaittillVariableFieldCached, fmt::format("{}", variable_access(entry->as<expr_identifier>())));
|
||||
}
|
||||
|
||||
emit_opcode(opcode::OP_ClearParams);
|
||||
@ -338,7 +316,7 @@ auto compiler::emit_stmt_waittillmatch(stmt_waittillmatch const& stm) -> void
|
||||
emit_expr_arguments(*stm.args);
|
||||
emit_expr(*stm.event);
|
||||
emit_expr(*stm.obj);
|
||||
emit_opcode(opcode::OP_WaitTillMatch, std::format("{}", stm.args->list.size()));
|
||||
emit_opcode(opcode::OP_WaitTillMatch, fmt::format("{}", stm.args->list.size()));
|
||||
emit_opcode(opcode::OP_ClearParams);
|
||||
}
|
||||
|
||||
@ -532,7 +510,7 @@ auto compiler::emit_stmt_foreach(stmt_foreach const& stm) -> void
|
||||
can_continue_ = true;
|
||||
|
||||
emit_expr_variable(*stm.key);
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(stm.array->as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(stm.array->as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_EvalArray);
|
||||
emit_expr_variable_ref(*stm.value, true);
|
||||
|
||||
@ -570,7 +548,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void
|
||||
can_break_ = true;
|
||||
|
||||
auto data = std::vector<std::string>{};
|
||||
data.push_back(std::format("{}", stm.body->block->list.size()));
|
||||
data.push_back(fmt::format("{}", stm.body->block->list.size()));
|
||||
|
||||
auto type = switch_type::none;
|
||||
auto loc_default = std::string{};
|
||||
@ -640,7 +618,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm) -> void
|
||||
data.push_back(loc_default);
|
||||
}
|
||||
|
||||
data.push_back(std::format("{}", static_cast<std::underlying_type_t<switch_type>>(type)));
|
||||
data.push_back(fmt::format("{}", static_cast<std::underlying_type_t<switch_type>>(type)));
|
||||
|
||||
insert_label(table_loc);
|
||||
emit_opcode(opcode::OP_EndSwitch, data);
|
||||
@ -708,8 +686,6 @@ auto compiler::emit_stmt_prof_end(stmt_prof_end const&) -> void
|
||||
|
||||
auto compiler::emit_expr(expr const& exp) -> void
|
||||
{
|
||||
debug_pos_ = { exp.loc().begin.line, exp.loc().begin.column };
|
||||
|
||||
switch (exp.kind())
|
||||
{
|
||||
case node::expr_paren:
|
||||
@ -868,10 +844,10 @@ auto compiler::emit_expr_const(expr_const const& exp) -> void
|
||||
auto const itr = constants_.find(exp.lvalue->value);
|
||||
|
||||
if (itr != constants_.end())
|
||||
throw comp_error(exp.loc(), std::format("duplicated constant '{}'", exp.lvalue->value));
|
||||
throw comp_error(exp.loc(), fmt::format("duplicated constant '{}'", exp.lvalue->value));
|
||||
|
||||
if (std::find(stackframe_.begin(), stackframe_.end(), exp.lvalue->value) != stackframe_.end())
|
||||
throw comp_error(exp.loc(), std::format("constant already defined as local variable '{}'", exp.lvalue->value));
|
||||
throw comp_error(exp.loc(), fmt::format("constant already defined as local variable '{}'", exp.lvalue->value));
|
||||
|
||||
constants_.insert({ exp.lvalue->value, exp.rvalue.get() });
|
||||
}
|
||||
@ -1125,7 +1101,7 @@ auto compiler::emit_expr_call_pointer(expr_pointer const& exp, bool is_stmt) ->
|
||||
emit_expr_arguments(*exp.args);
|
||||
emit_expr(*exp.func);
|
||||
|
||||
auto argcount = std::format("{}", exp.args->list.size());
|
||||
auto argcount = fmt::format("{}", exp.args->list.size());
|
||||
|
||||
switch (exp.mode)
|
||||
{
|
||||
@ -1178,18 +1154,18 @@ auto compiler::emit_expr_call_function(expr_function const& exp, bool is_stmt) -
|
||||
emit_opcode(opcode::OP_PreScriptCall);
|
||||
emit_expr_arguments(*exp.args);
|
||||
|
||||
auto argcount = std::format("{}", exp.args->list.size());
|
||||
auto argcount = fmt::format("{}", exp.args->list.size());
|
||||
auto flags = developer_thread_ ? static_cast<u8>(import_flags::developer) : 0;
|
||||
|
||||
switch (exp.mode)
|
||||
{
|
||||
case call::mode::normal:
|
||||
flags |= static_cast<u8>(import_flags::func_call);
|
||||
emit_opcode(opcode::OP_ScriptFunctionCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) });
|
||||
emit_opcode(opcode::OP_ScriptFunctionCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) });
|
||||
break;
|
||||
case call::mode::thread:
|
||||
flags |= static_cast<u8>(import_flags::func_call_thread);
|
||||
emit_opcode(opcode::OP_ScriptThreadCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) });
|
||||
emit_opcode(opcode::OP_ScriptThreadCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1222,7 +1198,7 @@ auto compiler::emit_expr_method_pointer(expr_pointer const& exp, expr const& obj
|
||||
emit_expr(obj);
|
||||
emit_expr(*exp.func);
|
||||
|
||||
auto argcount = std::format("{}", exp.args->list.size());
|
||||
auto argcount = fmt::format("{}", exp.args->list.size());
|
||||
|
||||
switch (exp.mode)
|
||||
{
|
||||
@ -1265,18 +1241,18 @@ auto compiler::emit_expr_method_function(expr_function const& exp, expr const& o
|
||||
emit_expr_arguments(*exp.args);
|
||||
emit_expr(obj);
|
||||
|
||||
auto argcount = std::format("{}", exp.args->list.size());
|
||||
auto argcount = fmt::format("{}", exp.args->list.size());
|
||||
auto flags = developer_thread_ ? static_cast<u8>(import_flags::developer) : 0;
|
||||
|
||||
switch (exp.mode)
|
||||
{
|
||||
case call::mode::normal:
|
||||
flags |= static_cast<u8>(import_flags::meth_call);
|
||||
emit_opcode(opcode::OP_ScriptMethodCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) });
|
||||
emit_opcode(opcode::OP_ScriptMethodCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) });
|
||||
break;
|
||||
case call::mode::thread:
|
||||
flags |= static_cast<u8>(import_flags::meth_call_thread);
|
||||
emit_opcode(opcode::OP_ScriptMethodThreadCall, { exp.path->value, exp.name->value, argcount, std::format("{}", flags) });
|
||||
emit_opcode(opcode::OP_ScriptMethodThreadCall, { exp.path->value, exp.name->value, argcount, fmt::format("{}", flags) });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1461,7 +1437,7 @@ auto compiler::emit_expr_reference(expr_reference const& exp) -> void
|
||||
auto flags = developer_thread_ ? static_cast<u8>(import_flags::developer) : 0;
|
||||
flags |= static_cast<u8>(import_flags::func_reference);
|
||||
|
||||
emit_opcode(opcode::OP_GetFunction, { exp.path->value, exp.name->value, "0", std::format("{}", flags) });
|
||||
emit_opcode(opcode::OP_GetFunction, { exp.path->value, exp.name->value, "0", fmt::format("{}", flags) });
|
||||
}
|
||||
|
||||
auto compiler::emit_expr_size(expr_size const& exp) -> void
|
||||
@ -1547,7 +1523,7 @@ auto compiler::emit_expr_field_ref(expr_field const& exp, bool set) -> void
|
||||
if (set) emit_opcode(opcode::OP_SetVariableField);
|
||||
break;
|
||||
case node::expr_identifier:
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.obj->as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.obj->as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_CastFieldObject);
|
||||
emit_opcode(opcode::OP_EvalFieldVariableRef, field);
|
||||
if (set) emit_opcode(opcode::OP_SetVariableField);
|
||||
@ -1575,10 +1551,10 @@ auto compiler::emit_expr_local_ref(expr_identifier const& exp, bool set) -> void
|
||||
|
||||
if (it != constants_.end())
|
||||
{
|
||||
throw comp_error(exp.loc(), std::format("variable name already defined as constant '{}'", exp.value));
|
||||
throw comp_error(exp.loc(), fmt::format("variable name already defined as constant '{}'", exp.value));
|
||||
}
|
||||
|
||||
emit_opcode(opcode::OP_EvalLocalVariableRefCached, std::format("{}", variable_access(exp)));
|
||||
emit_opcode(opcode::OP_EvalLocalVariableRefCached, fmt::format("{}", variable_access(exp)));
|
||||
|
||||
if (set)
|
||||
{
|
||||
@ -1650,7 +1626,7 @@ auto compiler::emit_expr_field(expr_field const& exp) -> void
|
||||
emit_opcode(opcode::OP_EvalFieldVariable, field);
|
||||
break;
|
||||
case node::expr_identifier:
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.obj->as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.obj->as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_CastFieldObject);
|
||||
emit_opcode(opcode::OP_EvalFieldVariable, field);
|
||||
break;
|
||||
@ -1666,7 +1642,7 @@ auto compiler::emit_expr_local(expr_identifier const& exp) -> void
|
||||
if (it != constants_.end())
|
||||
emit_expr(*it->second);
|
||||
else
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp)));
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp)));
|
||||
}
|
||||
|
||||
auto compiler::emit_expr_object(expr const& exp) -> void
|
||||
@ -1699,7 +1675,7 @@ auto compiler::emit_expr_object(expr const& exp) -> void
|
||||
emit_opcode(opcode::OP_CastFieldObject);
|
||||
break;
|
||||
case node::expr_identifier:
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, std::format("{}", variable_access(exp.as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_EvalLocalVariableCached, fmt::format("{}", variable_access(exp.as<expr_identifier>())));
|
||||
emit_opcode(opcode::OP_CastFieldObject);
|
||||
break;
|
||||
default:
|
||||
@ -1790,7 +1766,7 @@ auto compiler::emit_expr_vector(expr_vector const& exp) -> void
|
||||
|
||||
if (isconst)
|
||||
{
|
||||
emit_opcode(opcode::OP_VectorConstant, std::format("{}", flags));
|
||||
emit_opcode(opcode::OP_VectorConstant, fmt::format("{}", flags));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1890,7 +1866,6 @@ auto compiler::emit_opcode(opcode op) -> void
|
||||
inst->opcode = op;
|
||||
inst->size = ctx_->opcode_size(op);
|
||||
inst->index = index_;
|
||||
inst->pos = debug_pos_;
|
||||
|
||||
index_ += inst->size;
|
||||
}
|
||||
@ -1904,7 +1879,6 @@ auto compiler::emit_opcode(opcode op, std::string const& data) -> void
|
||||
inst->size = ctx_->opcode_size(op);
|
||||
inst->index = index_;
|
||||
inst->data.push_back(data);
|
||||
inst->pos = debug_pos_;
|
||||
|
||||
index_ += inst->size;
|
||||
}
|
||||
@ -1918,7 +1892,6 @@ auto compiler::emit_opcode(opcode op, std::vector<std::string> const& data) -> v
|
||||
inst->size = ctx_->opcode_size(op);
|
||||
inst->index = index_;
|
||||
inst->data = data;
|
||||
inst->pos = debug_pos_;
|
||||
|
||||
index_ += inst->size;
|
||||
}
|
||||
@ -1972,7 +1945,6 @@ auto compiler::process_stmt(stmt const& stm) -> void
|
||||
case node::stmt_endon:
|
||||
case node::stmt_notify:
|
||||
case node::stmt_wait:
|
||||
case node::stmt_waitrealtime:
|
||||
case node::stmt_waittillmatch:
|
||||
case node::stmt_waittillframeend:
|
||||
case node::stmt_case:
|
||||
@ -2161,7 +2133,7 @@ auto compiler::variable_access(expr_identifier const& exp) -> u8
|
||||
}
|
||||
}
|
||||
|
||||
throw comp_error(exp.loc(), std::format("local variable '{}' not found", exp.value));
|
||||
throw comp_error(exp.loc(), fmt::format("local variable '{}' not found", exp.value));
|
||||
}
|
||||
|
||||
auto compiler::is_constant_condition(expr const& exp) -> bool
|
||||
@ -2232,7 +2204,7 @@ auto compiler::insert_label() -> std::string
|
||||
else
|
||||
{
|
||||
label_idx_++;
|
||||
auto name = std::format("loc_{}", label_idx_);
|
||||
auto name = fmt::format("loc_{}", label_idx_);
|
||||
function_->labels.insert({ index_, name });
|
||||
return name;
|
||||
}
|
||||
@ -2241,7 +2213,7 @@ auto compiler::insert_label() -> std::string
|
||||
auto compiler::create_label() -> std::string
|
||||
{
|
||||
label_idx_++;
|
||||
return std::format("loc_{}", label_idx_);
|
||||
return fmt::format("loc_{}", label_idx_);
|
||||
}
|
||||
|
||||
} // namespace xsk::arc
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -206,7 +206,7 @@ auto context::opcode_size(opcode op) const -> u32
|
||||
case opcode::OP_GetVector:
|
||||
return (props_ & props::size64) ? 14 : 13;
|
||||
default:
|
||||
throw error(std::format("couldn't resolve instruction size for '{}'", opcode_name(op)));
|
||||
throw error(fmt::format("couldn't resolve instruction size for '{}'", opcode_name(op)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ auto context::opcode_id(opcode op) const -> u16
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
throw error(std::format("couldn't resolve opcode id for '{}'", opcode_name(op)));
|
||||
throw error(fmt::format("couldn't resolve opcode id for '{}'", opcode_name(op)));
|
||||
}
|
||||
|
||||
auto context::opcode_name(opcode op) const -> std::string
|
||||
@ -231,7 +231,7 @@ auto context::opcode_name(opcode op) const -> std::string
|
||||
return std::string{ itr->second };
|
||||
}
|
||||
|
||||
throw std::runtime_error(std::format("couldn't resolve opcode string for enum '{}'", static_cast<std::underlying_type_t<opcode>>(op)));
|
||||
throw std::runtime_error(fmt::format("couldn't resolve opcode string for enum '{}'", static_cast<std::underlying_type_t<opcode>>(op)));
|
||||
}
|
||||
|
||||
auto context::opcode_enum(std::string const& name) const -> opcode
|
||||
@ -243,7 +243,7 @@ auto context::opcode_enum(std::string const& name) const -> opcode
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
throw std::runtime_error(std::format("couldn't resolve opcode enum for name '{}'", name));
|
||||
throw std::runtime_error(fmt::format("couldn't resolve opcode enum for name '{}'", name));
|
||||
}
|
||||
|
||||
auto context::opcode_enum(u16 id) const -> opcode
|
||||
@ -302,7 +302,7 @@ auto context::hash_name(u32 id) const -> std::string
|
||||
return std::string(itr->second);
|
||||
}
|
||||
|
||||
return std::format("_id_{:08X}", id);
|
||||
return fmt::format("_id_{:08X}", id);
|
||||
}
|
||||
|
||||
auto context::make_token(std::string_view str) const -> std::string
|
||||
@ -344,7 +344,7 @@ auto context::load_header(std::string const& name) -> std::tuple<std::string con
|
||||
}
|
||||
}
|
||||
|
||||
throw error(std::format("couldn't open gsh file '{}'", name));
|
||||
throw error(fmt::format("couldn't open gsh file '{}'", name));
|
||||
}
|
||||
|
||||
extern std::array<std::pair<opcode, std::string_view>, opcode_count> const opcode_list
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -86,7 +86,7 @@ auto decompiler::decompile_function(function const& func) -> void
|
||||
}
|
||||
|
||||
auto& list = func_->body->block->list;
|
||||
locs_.end = std::format("loc_{:X}", list.back()->loc().begin.line + 1);
|
||||
locs_.end = fmt::format("loc_{:X}", list.back()->loc().begin.line + 1);
|
||||
|
||||
decompile_statements(*func_->body->block);
|
||||
|
||||
@ -1137,7 +1137,7 @@ auto decompiler::decompile_instruction(instruction const& inst, bool last) -> vo
|
||||
case opcode::OP_EvalLocalVariableCachedDebug:
|
||||
case opcode::OP_EvalLocalVariableRefCachedDebug:
|
||||
default:
|
||||
throw decomp_error(std::format("unhandled opcode {}", ctx_->opcode_name(inst.opcode)));
|
||||
throw decomp_error(fmt::format("unhandled opcode {}", ctx_->opcode_name(inst.opcode)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1933,7 +1933,7 @@ auto decompiler::find_location_index(stmt_list const& stm, std::string const& lo
|
||||
index++;
|
||||
}
|
||||
|
||||
throw decomp_error(std::format("location '{}' not found", loc));
|
||||
throw decomp_error(fmt::format("location '{}' not found", loc));
|
||||
}
|
||||
|
||||
auto decompiler::last_location_index(stmt_list const& stm, usize index) -> bool
|
||||
@ -1992,7 +1992,7 @@ auto decompiler::resolve_label(std::string const& name) -> u32
|
||||
}
|
||||
}
|
||||
|
||||
throw decomp_error(std::format("couldn't resolve label address of '{}'", name));
|
||||
throw decomp_error(fmt::format("couldn't resolve label address of '{}'", name));
|
||||
}
|
||||
|
||||
auto decompiler::process_function(decl_function& func) -> void
|
||||
@ -2037,15 +2037,15 @@ auto decompiler::process_stmt(stmt& stm) -> void
|
||||
case node::stmt_wait:
|
||||
process_stmt_wait(stm.as<stmt_wait>());
|
||||
break;
|
||||
case node::stmt_waitrealtime:
|
||||
process_stmt_waitrealtime(stm.as<stmt_waitrealtime>());
|
||||
break;
|
||||
case node::stmt_waittill:
|
||||
process_stmt_waittill(stm.as<stmt_waittill>());
|
||||
break;
|
||||
case node::stmt_waittillmatch:
|
||||
process_stmt_waittillmatch(stm.as<stmt_waittillmatch>());
|
||||
break;
|
||||
case node::stmt_waitrealtime:
|
||||
process_stmt_waitrealtime(stm.as<stmt_waitrealtime>());
|
||||
break;
|
||||
case node::stmt_if:
|
||||
process_stmt_if(stm.as<stmt_if>());
|
||||
break;
|
||||
@ -2135,11 +2135,6 @@ auto decompiler::process_stmt_wait(stmt_wait& stm) -> void
|
||||
process_expr(stm.time);
|
||||
}
|
||||
|
||||
auto decompiler::process_stmt_waitrealtime(stmt_waitrealtime& stm) -> void
|
||||
{
|
||||
process_expr(stm.time);
|
||||
}
|
||||
|
||||
auto decompiler::process_stmt_waittill(stmt_waittill& stm) -> void
|
||||
{
|
||||
process_expr(stm.event);
|
||||
@ -2158,6 +2153,11 @@ auto decompiler::process_stmt_waittillmatch(stmt_waittillmatch& stm) -> void
|
||||
process_expr(stm.obj);
|
||||
}
|
||||
|
||||
auto decompiler::process_stmt_waitrealtime(stmt_waitrealtime& stm) -> void
|
||||
{
|
||||
process_expr(stm.time);
|
||||
}
|
||||
|
||||
auto decompiler::process_stmt_if(stmt_if& stm) -> void
|
||||
{
|
||||
process_expr(stm.test);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
// Copyright 2023 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
@ -476,17 +476,17 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
|
||||
break;
|
||||
case opcode::OP_GetByte:
|
||||
case opcode::OP_GetNegByte:
|
||||
inst.data.push_back(std::format("{}", script_.read<u8>()));
|
||||
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
|
||||
break;
|
||||
case opcode::OP_GetUnsignedShort:
|
||||
case opcode::OP_GetNegUnsignedShort:
|
||||
inst.size += script_.align(2);
|
||||
inst.data.push_back(std::format("{}", script_.read<u16>()));
|
||||
inst.data.push_back(fmt::format("{}", script_.read<u16>()));
|
||||
break;
|
||||
case opcode::OP_GetInteger:
|
||||
inst.size += script_.align(4);
|
||||
disassemble_animtree(inst);
|
||||
inst.data.push_back(std::format("{}", script_.read<i32>()));
|
||||
inst.data.push_back(fmt::format("{}", script_.read<i32>()));
|
||||
break;
|
||||
case opcode::OP_GetFloat:
|
||||
inst.size += script_.align(4);
|
||||
@ -496,7 +496,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
|
||||
//case opcode::OP_ProfileStart:
|
||||
case opcode::OP_GetAPIFunction:
|
||||
inst.size += script_.align(8);
|
||||
inst.data.push_back(std::format("0x{:016X}", script_.read<u64>()));
|
||||
inst.data.push_back(fmt::format("0x{:016X}", script_.read<u64>()));
|
||||
break;
|
||||
case opcode::OP_GetVector:
|
||||
inst.size += script_.align(4);
|
||||
@ -512,10 +512,10 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
|
||||
disassemble_animation(inst);
|
||||
break;
|
||||
case opcode::OP_WaitTillMatch:
|
||||
inst.data.push_back(std::format("{}", script_.read<u8>()));
|
||||
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
|
||||
break;
|
||||
case opcode::OP_VectorConstant:
|
||||
inst.data.push_back(std::format("{}", script_.read<u8>()));
|
||||
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
|
||||
break;
|
||||
case opcode::OP_GetHash:
|
||||
inst.size += script_.align(4);
|
||||
@ -535,7 +535,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
|
||||
case opcode::OP_EvalLocalArrayRefCached:
|
||||
case opcode::OP_SafeSetWaittillVariableFieldCached:
|
||||
case opcode::OP_EvalLocalVariableRefCached:
|
||||
inst.data.push_back(std::format("{}", script_.read<u8>()));
|
||||
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
|
||||
break;
|
||||
case opcode::OP_EvalFieldVariable:
|
||||
case opcode::OP_EvalFieldVariableRef:
|
||||
@ -553,7 +553,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
|
||||
case opcode::OP_ScriptMethodCallPointer:
|
||||
case opcode::OP_ScriptThreadCallPointer:
|
||||
case opcode::OP_ScriptMethodThreadCallPointer:
|
||||
inst.data.push_back(std::format("{}", script_.read<u8>()));
|
||||
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
|
||||
break;
|
||||
case opcode::OP_GetFunction:
|
||||
disassemble_import(inst);
|
||||
@ -583,7 +583,7 @@ auto disassembler::disassemble_instruction(instruction& inst) -> void
|
||||
disassemble_end_switch(inst);
|
||||
break;
|
||||
default:
|
||||
throw disasm_error(std::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
|
||||
throw disasm_error(fmt::format("unhandled opcode {} at index {:04X}", ctx_->opcode_name(inst.opcode), inst.index));
|
||||
}
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ auto disassembler::disassemble_name(instruction& inst) -> void
|
||||
return;
|
||||
}
|
||||
|
||||
throw disasm_error(std::format("string reference not found at index {:04X}", inst.index));
|
||||
throw disasm_error(fmt::format("string reference not found at index {:04X}", inst.index));
|
||||
}
|
||||
}
|
||||
|
||||
@ -620,7 +620,7 @@ auto disassembler::disassemble_params(instruction& inst) -> void
|
||||
{
|
||||
inst.size += script_.align(4) + 5;
|
||||
inst.data.push_back(ctx_->hash_name(script_.read<u32>()));
|
||||
inst.data.push_back(std::format("{}", script_.read<u8>()));
|
||||
inst.data.push_back(fmt::format("{}", script_.read<u8>()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -644,7 +644,7 @@ auto disassembler::disassemble_import(instruction& inst) -> void
|
||||
return;
|
||||
}
|
||||
|
||||
throw disasm_error(std::format("import reference not found at index {:04X}", inst.index));
|
||||
throw disasm_error(fmt::format("import reference not found at index {:04X}", inst.index));
|
||||
}
|
||||
|
||||
auto disassembler::disassemble_string(instruction& inst) -> void
|
||||
@ -660,7 +660,7 @@ auto disassembler::disassemble_string(instruction& inst) -> void
|
||||
return;
|
||||
}
|
||||
|
||||
throw disasm_error(std::format("string reference not found at index {:04X}", inst.index));
|
||||
throw disasm_error(fmt::format("string reference not found at index {:04X}", inst.index));
|
||||
}
|
||||
|
||||
auto disassembler::disassemble_animtree(instruction& inst) -> void
|
||||
@ -695,7 +695,7 @@ auto disassembler::disassemble_animation(instruction& inst) -> void
|
||||
}
|
||||
}
|
||||
|
||||
throw disasm_error(std::format("animation reference not found at index {:04X}", inst.index));
|
||||
throw disasm_error(fmt::format("animation reference not found at index {:04X}", inst.index));
|
||||
}
|
||||
|
||||
auto disassembler::disassemble_jump(instruction& inst) -> void
|
||||
@ -709,7 +709,7 @@ auto disassembler::disassemble_jump(instruction& inst) -> void
|
||||
else
|
||||
addr = script_.read<i16>() + script_.pos();
|
||||
|
||||
auto const label = std::format("loc_{:X}", addr);
|
||||
auto const label = fmt::format("loc_{:X}", addr);
|
||||
|
||||
inst.data.push_back(label);
|
||||
func_->labels.insert({ addr, label });
|
||||
@ -720,7 +720,7 @@ auto disassembler::disassemble_switch(instruction& inst) -> void
|
||||
inst.size += script_.align(4);
|
||||
|
||||
auto const addr = script_.read<i32>() + script_.pos();
|
||||
auto const label = std::format("loc_{:X}", addr);
|
||||
auto const label = fmt::format("loc_{:X}", addr);
|
||||
|
||||
inst.data.push_back(label);
|
||||
func_->labels.insert({ addr, label });
|
||||
@ -738,7 +738,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
|
||||
{
|
||||
if (entry->opcode == opcode::OP_Switch && entry->data[0] == itr->second)
|
||||
{
|
||||
auto const label = std::format("loc_{:X}", inst.index);
|
||||
auto const label = fmt::format("loc_{:X}", inst.index);
|
||||
entry->data[0] = label;
|
||||
func_->labels.erase(script_.pos());
|
||||
|
||||
@ -754,7 +754,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
|
||||
|
||||
auto type = switch_type::none;
|
||||
auto const count = script_.read<u32>();
|
||||
inst.data.push_back(std::format("{}", count));
|
||||
inst.data.push_back(fmt::format("{}", count));
|
||||
|
||||
for (auto i = 0u; i < count; i++)
|
||||
{
|
||||
@ -777,7 +777,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
|
||||
{
|
||||
type = switch_type::integer;
|
||||
inst.data.push_back("case");
|
||||
inst.data.push_back(std::format("{}", value));
|
||||
inst.data.push_back(fmt::format("{}", value));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -798,12 +798,12 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
|
||||
{
|
||||
type = switch_type::integer;
|
||||
inst.data.push_back("case");
|
||||
inst.data.push_back(std::format("{}", (value - 0x800000) & 0xFFFFFF));
|
||||
inst.data.push_back(fmt::format("{}", (value - 0x800000) & 0xFFFFFF));
|
||||
}
|
||||
}
|
||||
|
||||
auto const addr = script_.read<i32>() + script_.pos();
|
||||
auto const label = std::format("loc_{:X}", addr);
|
||||
auto const label = fmt::format("loc_{:X}", addr);
|
||||
|
||||
inst.data.push_back(label);
|
||||
func_->labels.insert({ addr, label });
|
||||
@ -811,7 +811,7 @@ auto disassembler::disassemble_end_switch(instruction& inst) -> void
|
||||
inst.size += 8;
|
||||
}
|
||||
|
||||
inst.data.push_back(std::format("{}", static_cast<std::underlying_type_t<switch_type>>(type)));
|
||||
inst.data.push_back(fmt::format("{}", static_cast<std::underlying_type_t<switch_type>>(type)));
|
||||
}
|
||||
|
||||
} // namespace xsk::arc
|
||||
|
@ -1,32 +0,0 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
#include "xsk/arc/engine/jup.hpp"
|
||||
|
||||
namespace xsk::arc::jup
|
||||
{
|
||||
|
||||
extern std::array<std::pair<u16, opcode>, code_count> const code_list;
|
||||
// extern std::array<std::pair<u32, char const*>, hash_count> const hash_list;
|
||||
|
||||
context::context() : arc::context(props::v3, engine::jup, endian::little, system::pc, header_magic)
|
||||
{
|
||||
code_map_.reserve(code_list.size());
|
||||
code_map_rev_.reserve(code_list.size());
|
||||
// hash_map_.reserve(hash_list.size());
|
||||
|
||||
for (auto const& entry : code_list)
|
||||
{
|
||||
code_map_.insert({ entry.first, entry.second });
|
||||
code_map_rev_.insert({ entry.second, entry.first });
|
||||
}
|
||||
|
||||
// for (auto const& entry : hash_list)
|
||||
// {
|
||||
// hash_map_.insert({ entry.first, entry.second });
|
||||
// }
|
||||
}
|
||||
|
||||
} // namespace xsk::arc::jup
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2024 xensik. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a GNU GPLv3 license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
#include "xsk/arc/engine/jup.hpp"
|
||||
|
||||
namespace xsk::arc::jup
|
||||
{
|
||||
|
||||
extern std::array<std::pair<u16, opcode>, code_count> const code_list
|
||||
{{
|
||||
}};
|
||||
|
||||
} // namespace xsk::arc::jup
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user