UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

85 lines (82 loc) 2.56 kB
type cp_query = { name: string; args: cp_term[]; }; type QueryResponse = { cont: string; arg: string; }; type cp_term = cp_atm | cp_num | cp_string | cp_struct; type cp_int = { tag: 'int'; value: number; }; type cp_flt = { tag: 'flt'; value: number; }; type cp_num = cp_int | cp_flt; type cp_struct = { tag: 'struct'; value: object; }; type cp_atm = { tag: 'atm'; value: string; }; type cp_string = { tag: 'string'; value: string; }; declare class CiaoPrologInterface { private c_config; private c_worker; constructor(curr_dir: string, bundles: string[], cust_modules?: string[], cust_modules_path?: string, boot_path?: string); ciao_init(dstdir: string): Promise<void>; ciao_mk_int(value: number): cp_int; ciao_mk_flt(value: number): cp_flt; ciao_mk_atm(value: string): cp_term; ciao_mk_string(value: string): cp_string; ciao_mk_struct(name: string, args: cp_term[]): cp_term; ciao_mk_list<T>(items: T[]): cp_term; ciao_mk_list_of_lists<T>(lists: T[][]): cp_term; ciao_mk_reg_type(type: cp_term['tag'], value: any): cp_term; private ciao_term; ciao_get_int(term: cp_int): number; ciao_get_flt(term: cp_flt): number; ciao_get_atm(term: cp_atm): string; ciao_get_string(term: cp_string): string; ciao_get_struct(term: cp_struct): object; ciao_get_list_from_string<T>(term: cp_string): T[]; ciao_get_list_of_lists_from_string<T>(term: cp_string): T[][]; ciao_get_reg_type(term: cp_term): any; ciao_is_int(term: cp_term): boolean; ciao_is_flt(term: cp_term): boolean; ciao_is_struct(term: cp_term): boolean; ciao_is_atm(term: cp_term): boolean; ciao_is_string(term: cp_term): boolean; ciao_is_type(term: cp_term, type: string): boolean; ciao_query_begin(query: cp_query): Promise<QueryResponse>; ciao_query_next(): Promise<QueryResponse>; ciao_query_end(): Promise<void>; } type BuilderConfig = { name: string; input: { name: string; type: 'number' | 'number[]' | 'string'; }[]; output: { type: string; }; }; declare class InterfaceBuilder { constructor(); buildInterface(conf: BuilderConfig): void; private createDirectory; private formatHeader; private formatInputs; private formatQuery; private formatOutput; } export { type BuilderConfig, CiaoPrologInterface, InterfaceBuilder, type QueryResponse, type cp_atm, type cp_flt, type cp_int, type cp_num, type cp_query, type cp_string, type cp_struct, type cp_term };