Commit Graph

103 Commits (master)

Author SHA1 Message Date
Daniel Kolesa 263b12c1c4 stop using reinterpret_cast 2021-05-14 22:10:16 +02:00
Daniel Kolesa 139ead5d72 fold BC_INST_IVAR/FVAR/SVAR into one instruction 2021-05-06 03:42:58 +02:00
Daniel Kolesa bd1e7825d8 be consistent with usage of get_/set_ prefixes 2021-05-05 03:16:32 +02:00
Daniel Kolesa a5003678da fix build with libc++, and try using it in CI with clang 2021-04-12 19:53:24 +02:00
Daniel Kolesa 8114279816 fix warning with msvc 2021-04-12 00:17:07 +02:00
Daniel Kolesa 416c6ba8fb do not access parser state from error 2021-04-10 03:51:08 +02:00
Daniel Kolesa 83aa8bfd07 hide bcode pointers from public api 2021-04-10 03:37:59 +02:00
Daniel Kolesa 6d6a115d0c remove leftover junk 2021-04-10 03:01:41 +02:00
Daniel Kolesa d2b53b174e move all codegen stuff, make instruction vector private 2021-04-10 02:56:49 +02:00
Daniel Kolesa 05661662d2 more codegen conversions 2021-04-10 02:15:06 +02:00
Daniel Kolesa 63023f8c5e remove parser_state::gen_main 2021-04-10 00:54:28 +02:00
Daniel Kolesa 1bc94bf5af move some more codegen into proper place 2021-04-10 00:42:01 +02:00
Daniel Kolesa 295c905c32 more codegen utils 2021-04-09 03:34:48 +02:00
Daniel Kolesa 3790435c34 add more codegen utils 2021-04-09 03:22:34 +02:00
Daniel Kolesa 51da22be06 add ivar/fvar/svar lookup funcs in codegen 2021-04-09 03:14:34 +02:00
Daniel Kolesa bac186a0c7 move compileblockstr/compileunescapestr logic into gen 2021-04-09 02:54:36 +02:00
Daniel Kolesa c0fc1aa452 abstract away ugly bcode reference creation 2021-04-09 01:12:52 +02:00
Daniel Kolesa 283f23394d add more codegen utilities 2021-04-09 00:50:13 +02:00
Daniel Kolesa 5f67b205df initial bits for separation of codegen from parser 2021-04-09 00:41:55 +02:00
Daniel Kolesa ccb0c09d59 rename codegen_state to parser_state and move it
later commits will rewrite the parser and separate the codegen
bits into their own API
2021-04-08 23:35:30 +02:00
Daniel Kolesa 2de2c9b46c remove get_raw_type from public interface
users of the library never need to know this
2021-04-07 00:30:39 +02:00
Daniel Kolesa 8c8aa26c20 return refs for new_*var and new_ident (guarantee valid result) 2021-04-05 19:52:13 +02:00
Daniel Kolesa 06b1661afd hide thread_state, remove state::thread_pointer() 2021-04-05 04:10:39 +02:00
Daniel Kolesa e65e141741 sanitize var names, provide cached builtins for var handlers 2021-04-04 06:47:17 +02:00
Daniel Kolesa a789659387 minor cleanups 2021-04-04 05:36:19 +02:00
Daniel Kolesa f0bb6b1410 make more api private 2021-04-03 06:16:43 +02:00
Daniel Kolesa b00a08ea88 remove most variable code and leave it to user-defined handlers
the user can now define commands '//ivar', '//fvar' and '//svar'
which take identity (which is the variable) as the first argument
followed by any number of user defined arguments with types (one
can use the N argument type to check argument count, and when no
value arguments are provided, print the variable); this allows us
to implement different styles of variable setting without the
interpreter itself knowing about it, as well as ditch all the
stuff with overridden vars and hex vars and whatnot since this is
all specific to the engine and has no place in here

there is still leftover code remaining, which will get cleaned up
afterwards...
2021-04-03 03:16:57 +02:00
Daniel Kolesa b9c74d86b5 msvc warning fixes 2021-03-31 02:21:32 +02:00
Daniel Kolesa 13d46881e8 windows fixes and other correctness/portability stuff 2021-03-31 01:13:35 +02:00
Daniel Kolesa 3dc6ad866f make command argcount unlimited, remove maxargs checks from codegen
also adjust the bytecode appropriately, now you can call commands
with an unlimited number of args and aliases with max 32 args,
extra args will be ignored
2021-03-30 02:08:25 +02:00
Daniel Kolesa f7ba70b8b2 fix conc instruction 2021-03-28 22:49:46 +02:00
Daniel Kolesa 064a7ea99b document the instructions and drop more now useless vm code 2021-03-28 17:07:29 +02:00
Daniel Kolesa 3f513180f1 drop prevargs in codegen
since we now have a single, contiguous, unlimited VM stack, this
does not make any sense anymore (it was a limitation of the static
array)
2021-03-28 01:28:31 +01:00
Daniel Kolesa 71f45b2f07 fix up usage of IDENT_FLAG_UNKNOWN 2021-03-28 00:38:41 +01:00
Daniel Kolesa 99f227bfd9 unify arg and non-arg opcodes 2021-03-28 00:19:51 +01:00
Daniel Kolesa d1e131dbf6 don't rely on MAX_ARGUMENTS where not necessary 2021-03-27 23:43:55 +01:00
Daniel Kolesa a24f7c9385 remove leftover dead code 2021-03-27 00:32:27 +01:00
Daniel Kolesa bd9a6cbf7c eliminate more future private accesses 2021-03-26 02:59:42 +01:00
Daniel Kolesa 0b2c4c7038 pass thread_state in more places 2021-03-26 02:29:54 +01:00
Daniel Kolesa d80af7b159 hide internal_state from public state struct 2021-03-25 01:37:42 +01:00
Daniel Kolesa d774db675a separate cs_gen.hh, various refactors 2021-03-24 02:21:32 +01:00
Daniel Kolesa 21aec59ad3 rename namespace to cubescript 2021-03-23 23:32:25 +01:00
Daniel Kolesa b9b344cba6 remove cs_ namespace in all API 2021-03-23 23:29:32 +01:00
Daniel Kolesa b3b4624af1 drop cubescript.cc, move parsing stuff from cs_std to cs_parser 2021-03-23 22:17:25 +01:00
Daniel Kolesa 4b766a380f drop the util namespace 2021-03-23 02:02:43 +01:00
Daniel Kolesa 4b6c284ea1 separate cs_parser.cc, drop cs_util.cc 2021-03-23 02:00:23 +01:00
Daniel Kolesa 2cc1b0e271 add cs_std.cc, drop cs_util.hh 2021-03-23 01:46:56 +01:00
Daniel Kolesa 702dca0809 separate ident and error impls into their own files 2021-03-22 22:33:15 +01:00
Daniel Kolesa a591384afd use our allocator for more buffers 2021-03-21 06:13:45 +01:00
Daniel Kolesa f8eb07ee2b hide implementation details of idents 2021-03-21 02:47:02 +01:00