-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathScriptHelp.rtf
More file actions
61 lines (56 loc) · 6.04 KB
/
Copy pathScriptHelp.rtf
File metadata and controls
61 lines (56 loc) · 6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{\rtf1\ansi\ansicpg1251\deff0\nouicompat\deflang1049\deflangfe1049{\fonttbl{\f0\fswiss\fprq2\fcharset204 Calibri;}{\f1\fmodern\fprq1\fcharset204 Consolas;}{\f2\fmodern\fprq1\fcharset0 Consolas;}{\f3\fswiss\fprq2\fcharset0 Calibri;}{\f4\fnil\fcharset2 Symbol;}}
{\colortbl ;\red0\green0\blue255;\red5\green99\blue193;}
{\*\generator Riched20 10.0.22621}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1
\pard\nowidctlpar\sa200\sl276\slmult1\f0\fs40 Chet Post Processing Script\fs22\par
You can use scripts in the post processing phase to "clean up" the translated header so that the final output will be compilable in Delphi.\par
The clean up process will usally consist of adding, removing or changing lines. The following script commands will assist in doing this.\par
Each script must:\par
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent0{\pntxtb\'B7}}\nowidctlpar\fi-360\li720\sa200 Be on a single line\par
{\pntext\f4\'B7\tab}Start with a valid command\par
{\pntext\f4\'B7\tab}Followed by it's each parameter separated by a comma enclosed in a pair of parentheses.\par
\pard\nowidctlpar\sa200 Example script:\par
\b\f1\fs16 RemoveLines(1, "PHYSFS_file = PHYSFS_File;", 0, 1)\line ReplaceLine(1, "Bytef = Byte_;", " Bytef = Byte;", 0)\line InsertLine(1, "z_stream = z_stream_s;", 1, " Pz_stream = ^z_stream;")\line InsertTextFile(1, "unit Header;", 0, "UnitHeader.inc")\line RemoveAllLines("///", 1)\line RemoveLineRangeAll("(**", "*)")\line RegEx("NK_COMMAND_\\w*", "_", "Append")\line\f2\lang1033 RegEx("(\\w+) = Pointer;", "%1:s_rec = record end; %1:s = ^%1:s_rec;", "Format")\f1\lang1049\line SaveToFile("Header.pas")\line LoadFromFile("Header.pas")\line CreateDynamicImport()\par
\pard\nowidctlpar\sa200\sl276\slmult1\f0\fs36 ReplaceLine\par
\fs22 Syntax\b0\tab\i\f1 ReplaceLine(Occurence, OldLine, NewLine, Offset)\par
\b\i0\f0 Parameters\line\b0 Occurence\tab The number lines of OldLine to start at\line OldLIne\tab\tab The existing line to replace\line NewLine\tab The next line that will replace existing line\par
\b Description\b0\line Replace an existing line with a new line\par
\b\fs36 RemoveLines\b0\fs22\par
\b Syntax\b0\tab\i\f1 RemoveLines(Occurence, ReferenceLine, Offset, Count)\par
\b\i0\f0 Parameters\line\b0 Occurence\tab The number lines of ReferenceLine to start at\line ReferenceLine\tab The line to start removing lines from\line Offset\tab\tab The number of lines from ReferenceLine to start removing from\line Count\tab\tab The number of lines to remove\par
\b Description\b0\line Remove a specified number of lines. \par
\b\fs36 RemoveAllLines\par
\fs22 Syntax\b0\tab\i\f1 RemoveLines(StartText, Count)\par
\b\i0\f0\fs36 InsertLine\b0\fs22\par
\b Syntax\b0\tab\i\f1 InsertLine(Occurence, ReferenceLine, Offset, NewLine)\i0\par
\b\f0 Parameters\line\b0 Occurence\tab The number lines of ReferenceLine to start at\line ReferenceLine\tab The line to start inserting lines from\line Offset\tab\tab The number of lines from ReferenceLine to start inserting from\line NewLine\tab The line to insert\par
\b Description\b0\line Insert a new line\par
\b\fs36 InsertTextFile\b0\fs22\par
\b Syntax\b0\tab\i\f1 InsertTextFile(Occurence, ReferenceLine, Offset, TextFilename)\i0\par
\b\f0 Parameters\line\b0 Occurence\tab The number lines of ReferenceLine to start at\line ReferenceLine\tab The line to start inserting lines from\line Offset\tab\tab The number of lines from ReferenceLine to start inserting from\line TextFilename\tab Text file to insert\par
\b Description\b0\line Insert a text file\par
\b\fs36 RemoveAllLines\b0\fs22\par
\b Syntax\b0\tab\i\f1 InsertAllLines(StartText, Count)\i0\par
\b\f0 Parameters\line\b0 StartText\tab The starting text of line\line Count\tab\tab The number of lines from line that starts with StartText to also remove\line\line\b Description\b0\line Remove all lines that starts with specified tet\par
\b\fs36 RemoveLineRangeAll\b0\fs22\par
\b Syntax\b0\tab\i\f1 InsertLine(StartLine, EndLine)\i0\par
\b\f0 Parameters\line\b0 StartLine\tab The starting line text\line EndLine\tab The ending line text\line\line\b Description\b0\line Remove all lines ranges with StartLine and EndLine\par
\b\fs36 RegEx\b0\fs22\par
\b Syntax\b0\tab RegEx\i\f1 (Pattern, Value, Operation)\i0\par
\b\f0 Parameters\line\b0 Pattern\tab\tab A valid RegEx pattern\line Value\tab\tab A string value that replace, prepend or append to regex pattern match\line Operation\tab Possible values: "Replace", "Prepend", "Append", \f3\lang1033 "Format" \f0\lang1049 Value to the pattern match \line\line\b Description\b0\line Do replace, prepend\f3\lang1033 ,\f0\lang1049 append\f3\lang1033 , or format\f0\lang1049 operation to a regex pattern match for each line\par
\f3\lang1033 For the "Format" operation, the Value is passed through a Format() call, and the arguments are the match groups from the regex result. The first argument is the value matching the entire pattern, and the subsequent arguments are the values of the individual match groups.\f0\lang1049\par
\b\fs36 SaveToFile\b0\fs22\par
\b Syntax\b0\tab SaveToFile\i\f1 (Filename)\i0\par
\b\f0 Parameters\line\b0 Filename\tab A filename to save to filesystem\line\line\b Description\b0\line Save text to Filename to the OS filesystem\par
\b\fs36 LoadFromFile\b0\fs22\par
\b Syntax\b0\tab LoadFromFile\i\f1 (Filename)\i0\par
\b\f0 Parameters\line\b0 Filename\tab A filename to load on the filesystem\line\line\b Description\b0\line Load text from Filename on the OS filesystem\par
\b\fs36 CreateDynamicImport\b0\fs22\par
\b Syntax\b0\tab CreateDynamicImport\i\f1 (ImportType)\i0\par
\b\f0 Parameters\line\b0\i\f1 ImportType\i0\f0\tab A import type possible values is\par
\pard\nowidctlpar\li720\sa200\sl276\slmult1 0 \endash use LoadLibrary/GetProcAddress methods.\line 1 \endash use {{\field{\*\fldinst{HYPERLINK "https://github.com/Fr0sT-Brutal/Delphi_MemoryModule" }}{\fldrslt{\ul\cf1\cf2\ul MemoryModule}}}}\f0\fs22 API.\b\par
\pard\nowidctlpar\sa200\sl276\slmult1 Description\b0\line Find all procedures/function in text and convert them so they can be dynamically loaded from a DLL.\par
\par
\par
\par
}