Commit Graph

209 Commits (master)

Author SHA1 Message Date
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 4da0cb54a8 use format contants in default ivar/fvar/svar handlers 2021-04-06 21:23:17 +02:00
Daniel Kolesa f93042d7b9 add more utility methods for string_ref 2021-04-06 01:10:49 +02:00
Daniel Kolesa e531ab3434 clean up any_value APIs for consistency 2021-04-06 00:54:46 +02:00
Daniel Kolesa 3d06157dbc guarantee valid result from new_command 2021-04-05 20:05:41 +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 1a68dd1c25 move callable into internal namespace 2021-04-05 19:22:40 +02:00
Daniel Kolesa 194d5f960b drop ret-by-reference run APIs 2021-04-05 18:32:45 +02:00
Daniel Kolesa f64df83dd8 add getter/setter api on alias, drop old broken api 2021-04-05 18:20:07 +02:00
Daniel Kolesa a8cfa08bd8 split up cubescript.hh into individual files 2021-04-05 04:40:52 +02:00
Daniel Kolesa 06b1661afd hide thread_state, remove state::thread_pointer() 2021-04-05 04:10:39 +02:00
Daniel Kolesa c2de63be25 re-expose new_ident in a restricted way 2021-04-04 19:53:59 +02:00
Daniel Kolesa 1624938c0b remove public is_in_loop api 2021-04-04 19:43:28 +02:00
Daniel Kolesa 04441f206d remove the 255 run-depth limitation
also add optional per-thread API that sets the maximum run depth
(0 means no limit, default) if you want it; since we no longer
store stuff on the stack it should not be necessary though
2021-04-04 19:31:29 +02:00
Daniel Kolesa 529e34d268 add a variable value change trigger callback 2021-04-04 04:30:36 +02:00
Daniel Kolesa bab8633a05 add proper var value setting helpers 2021-04-04 02:58:04 +02:00
Daniel Kolesa e9fc023daa implement override value saving 2021-04-04 02:44:35 +02:00
Daniel Kolesa 3d91cf2ee7 rea-add proper handling of variable overrides 2021-04-04 02:33:28 +02:00
Daniel Kolesa 6777eb73d5 re-add some support for persistent/overridable flags + fix unknown 2021-04-04 01:08:30 +02:00
Daniel Kolesa f0bb6b1410 make more api private 2021-04-03 06:16:43 +02:00
Daniel Kolesa ddb0799213 minor cleanups 2021-04-03 05:46:05 +02:00
Daniel Kolesa 238e5a6ac5 unexpose get_flags from ident, replace with specific methods 2021-04-03 05:39:19 +02:00
Daniel Kolesa b2b83a8e5b clean up some leftover cruft 2021-04-03 03:40:19 +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 881ba4bce9 prepare codebase for per-thread alias stack 2021-04-02 05:47:49 +02:00
Daniel Kolesa e8856f8f9d rename alias_stack to alias_local 2021-04-02 04:43:57 +02:00
Daniel Kolesa b2caade276 remove all raw bcode passing in public api 2021-04-01 05:06:26 +02:00
Daniel Kolesa e2b65000d5 hide value getter from public alias interface
since this will become thread-specific, this API makes no sense
2021-04-01 04:19:00 +02:00
Daniel Kolesa e4c4c51055 remove more problematic public members 2021-03-31 01:48:56 +02:00
Daniel Kolesa 2312961cdc remove string_view from exported members of struct error
msvc doesn't like it
2021-03-31 01:43:29 +02:00
Daniel Kolesa 13d46881e8 windows fixes and other correctness/portability stuff 2021-03-31 01:13:35 +02:00
Daniel Kolesa 19f0ff379a move callable into its own header 2021-03-30 23:37:55 +02:00
Daniel Kolesa 89e5f5f004 move everything to alias_stack and remove stacked_value 2021-03-30 20:55:50 +02:00
Daniel Kolesa 1def48cf76 redo alias_stack for robustness (guarantee order of push/pop) 2021-03-30 20:37:50 +02:00
Daniel Kolesa d1243c5cc3 add better api to deal with alias stack 2021-03-30 03:57:43 +02:00
Daniel Kolesa c2bb8e4a3d move ident_stack out of public interface 2021-03-30 00:31:11 +02:00
Daniel Kolesa 4154944726 remove fixed-size argument stacks and reliance on argument ids 2021-03-30 00:28:06 +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 b27d4fa7e6 make p_tstate actually private 2021-03-26 03:05:14 +01:00
Daniel Kolesa bd9a6cbf7c eliminate more future private accesses 2021-03-26 02:59:42 +01:00
Daniel Kolesa 865bac73f3 remove pointless friends 2021-03-25 01:57:47 +01:00
Daniel Kolesa c854e9d189 move the owner tag inside 2021-03-25 01:55:47 +01:00
Daniel Kolesa d80af7b159 hide internal_state from public state struct 2021-03-25 01:37:42 +01:00
Daniel Kolesa 3d37ea22c3 put force_ident and force_code in any_value 2021-03-24 21:01:01 +01:00
Daniel Kolesa 00b8312ad5 move most thread state into an internal structure 2021-03-24 20:33:20 +01:00
Daniel Kolesa 4ded59ce70 launder aligned_storage pointers 2021-03-24 02:42:33 +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 4b766a380f drop the util namespace 2021-03-23 02:02:43 +01:00
Daniel Kolesa f52aeead32 eliminate the strref friend kludge 2021-03-23 01:35:04 +01:00
Daniel Kolesa 6821260c37 separate header/impl for strman 2021-03-23 01:25:47 +01:00
Daniel Kolesa 63251f0eac add cs_callable to replace std::function
now function data can be allocated with our own allocator as
well, plus we get guarantees on small storage; this type is
move-only, and it's also more memory efficient than std::function,
at least the libstdc++ implementation
2021-03-22 01:01:51 +01:00
Daniel Kolesa f8eb07ee2b hide implementation details of idents 2021-03-21 02:47:02 +01:00
Daniel Kolesa be71d3a4b9 rework allocator errors and error message storage buffer 2021-03-20 21:06:26 +01:00
Daniel Kolesa d7c93fa8b9 make format errors internal errors 2021-03-20 19:54:46 +01:00
Daniel Kolesa 2f3d5ea938 further clean up list parser api 2021-03-20 19:34:51 +01:00
Daniel Kolesa 82d366366e drop libostd requirement entirely 2021-03-20 08:23:51 +01:00
Daniel Kolesa cb926a5750 get rid of ostd requirements inside library entirely 2021-03-20 07:24:25 +01:00
Daniel Kolesa 10b2a81cec redo (un)escape_string around output iterators 2021-03-20 06:18:31 +01:00
Daniel Kolesa 320fdbaefd use c++20 std::span 2021-03-20 05:41:25 +01:00
Daniel Kolesa 4068c96ec2 remove the auxiliary run_<type> APIs, they are fairly useless now 2021-03-20 05:14:14 +01:00
Daniel Kolesa d626fba537 remove file exec api
this is something each thing will want to do on its own...

but add a new set of calls that take code source for debug info
2021-03-20 05:10:19 +01:00
Daniel Kolesa 55d5397f4f implement move behavior for cs_value
this prevents things from going horribly wrong when people
do move the values (since the implicit implementations don't
take care of handling the refcounts)
2021-03-20 04:49:47 +01:00
Daniel Kolesa 5648c1a757 use string_view everywhere that returns or takes a string 2021-03-20 04:10:27 +01:00
Daniel Kolesa 126d6ab2b6 use a stolen buffer for strupper/lower 2021-03-19 01:31:34 +01:00
Daniel Kolesa af1a85fb91 get rid of public format_int/float (use cs_value) 2021-03-19 00:34:12 +01:00
Daniel Kolesa 26bcc43578 get rid of tvals_concat in favor of simpler api 2021-03-19 00:31:18 +01:00
Daniel Kolesa d3ec4a47dd ditch cs_string from public headers + style fix 2021-03-18 23:56:25 +01:00
Daniel Kolesa 9d0494a9da replace list_parser with a simpler api 2021-03-18 23:53:16 +01:00
Daniel Kolesa 704f9217f7 unify enum style 2021-03-18 20:55:14 +01:00
Daniel Kolesa 7023e09049 don't use memcpy for non-trivial structures 2021-03-18 01:37:38 +01:00
Daniel Kolesa 6ed9ae1235 get rid of standard i/o inside vm 2021-03-18 00:03:30 +01:00
Daniel Kolesa fb8668a508 use more stringrefs 2021-03-17 23:32:38 +01:00
Daniel Kolesa 7eaf3679a4 get rid of cs_value::get_strr 2021-03-17 21:59:37 +01:00
Daniel Kolesa 2f5bb697eb use string refs more instead of allocated strings 2021-03-17 21:46:37 +01:00
Daniel Kolesa 8b7f36319d eliminate length field in cs_value 2021-03-17 21:16:25 +01:00
Daniel Kolesa e3cff816c7 reduce copying strings around (ensure refs are not erased) 2021-03-17 21:00:19 +01:00
Daniel Kolesa 64130a12bf remove handling of constants from codegen, bytecode and cs_value
also drop move semantics on cs_value
2021-03-17 20:41:08 +01:00
Daniel Kolesa c004db42c6 refactor cs_value and related structures to contain state
this will allow us to intern strings inside cs_value
2021-03-17 01:26:30 +01:00
Daniel Kolesa 8c77724f88 return alias value by value 2021-03-17 00:32:25 +01:00
Daniel Kolesa dcae5b30b2 initial implementation of unique/interned string manager 2021-03-16 00:45:09 +01:00
Daniel Kolesa 8805594bc2 style fixes 2018-04-27 23:53:55 +02:00
Daniel Kolesa fb78b4acdd initial support for "threads" 2018-04-26 19:23:11 +02:00
Daniel Kolesa bd008ffb46 introduce list_range 2018-04-26 00:20:23 +02:00
Daniel Kolesa 07666c7564 naming consistency 2018-04-25 01:49:58 +02:00
Daniel Kolesa 8d62c09f88 fix build 2017-04-23 15:34:45 +02:00
Daniel Kolesa f0f6dc437f fix build 2017-04-17 17:13:14 +02:00
Daniel Kolesa d744c6b1c6 remove dependency on types.hh 2017-04-04 00:28:56 +02:00
Daniel Kolesa 7294580ccf use range_put_all 2017-02-19 18:13:51 +01:00
Daniel Kolesa 5c2c441925 fix build 2017-02-19 16:44:16 +01:00
Daniel Kolesa e87b1b566c use appender_range directly 2017-02-18 17:28:43 +01:00
Daniel Kolesa 14436d6aa0 fix build 2017-02-16 20:51:03 +01:00
Daniel Kolesa c2a86f1625 build fix 2017-02-16 20:03:08 +01:00
Daniel Kolesa 8343979e03 fix build after style update 2017-02-16 19:07:22 +01:00
Daniel Kolesa 9b4ea3e765 replace removed PointerRange 2017-02-14 17:41:15 +01:00
Daniel Kolesa efe4ee523a fix build 2017-02-13 23:32:15 +01:00
Daniel Kolesa 41eb8b211f begin naming scheme rework 2017-02-13 18:11:19 +01:00
Daniel Kolesa 140ccf08c6 add cs_internal_error exception and use it for unrecoverable unlikely errors 2017-02-12 22:52:43 +01:00
Daniel Kolesa fda734a868 ostd fixes 2017-02-09 21:27:57 +01:00
Daniel Kolesa 2536179500 use standard type traits 2017-02-09 20:59:14 +01:00