summaryrefslogtreecommitdiffstats
path: root/llparse/src/implementation/c/code/external.ts
diff options
context:
space:
mode:
Diffstat (limited to 'llparse/src/implementation/c/code/external.ts')
-rw-r--r--llparse/src/implementation/c/code/external.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/llparse/src/implementation/c/code/external.ts b/llparse/src/implementation/c/code/external.ts
new file mode 100644
index 0000000..494fc5a
--- /dev/null
+++ b/llparse/src/implementation/c/code/external.ts
@@ -0,0 +1,19 @@
+import * as frontend from 'llparse-frontend';
+
+import { Compilation } from '../compilation';
+import { Code } from './base';
+
+export abstract class External<T extends frontend.code.External>
+ extends Code<T> {
+
+ public build(ctx: Compilation, out: string[]): void {
+ out.push(`int ${this.ref.name}(`);
+ out.push(` ${ctx.prefix}_t* s, const unsigned char* p,`);
+ if (this.ref.signature === 'value') {
+ out.push(' const unsigned char* endp,');
+ out.push(' int value);');
+ } else {
+ out.push(' const unsigned char* endp);');
+ }
+ }
+}