summaryrefslogtreecommitdiffstats
path: root/llparse/src/implementation/c/code/external.ts
blob: 494fc5ade99a339b6eacd5526de85cd9792a36ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);');
    }
  }
}