[patch] New $IncludeString directive
Original Reporter info from Mantis: SIV
-
Reporter name: Igor Sudarikov
Original Reporter info from Mantis: SIV
- Reporter name: Igor Sudarikov
Description:
It is often needed to include a piece of code written in other language (Lua, GLSL, OpenCL, etc.) as a string constant to feed it to some external interpreter at runtime. Instead of doing it in a rather dirty way (see Additional Information), as it is being done now, it would be sometimes better to store the code in an external file. This patch adds $IncludeString directive that includes file contents as a string.
Benefits: easier script editing (e.g. in external editor with syntax highlighting), easier maintenance, inclusions of the following type are allowed: {IncludeString %DATE} (Which is equivalent to {
Include %DATE}, but more "correct", as in fact it includes a string, not a file)
Additional information:
For example:
<<<<<<<<<<<<<<<<<<<<<<<<<
const
LuaCode = 'local sometable = {'#10+
' 1,2,3'#10+
'}';
is equivalent to
<<<<<<<<<<<<<<<<<<<<<<<<<
const
LuaCode = {$INCLUDESTRING Test.Lua};
where Test.Lua contains
<<<<<<<<<<<<<<<<<<<<<<<<<
local sometable = {
1,2,3
}
Also see OpenCL package example (basicsample.pas).
Mantis conversion info:
- Mantis ID: 15560
- Build: 14760
- Version: 2.5.1
- Monitored by: » Raid (Dennis Fehr), » Vincent (Vincent Snijders), » @michaliskambi (Michalis Kamburelis), » @PascalDragon (Sven Barth)