65 lines
2.5 KiB
Plaintext
65 lines
2.5 KiB
Plaintext
|
|
:- use_module(library(lineutils),
|
|
[file_filter_with_init/5,
|
|
split/3]).
|
|
|
|
:- use_module(library(lists),
|
|
[append/2]).
|
|
|
|
:- initialization(main).
|
|
|
|
:- yap_flag(write_strings,on).
|
|
|
|
main :-
|
|
warning(Warning),
|
|
file_filter_with_init('misc/ATOMS','H/tatoms.h',gen_fields, Warning, ['tatoms.h']),
|
|
file_filter_with_init('misc/ATOMS','H/iatoms.h',gen_decl, Warning, ['iatoms.h']),
|
|
file_filter_with_init('misc/ATOMS','H/ratoms.h',gen_rcov, Warning, ['ratoms.h']).
|
|
|
|
warning('~n /* This file, ~a, was generated automatically by \"yap -L misc/buildatoms\"~n please do not update, update misc/ATOMS instead */~n~n').
|
|
|
|
gen_fields(Inp,Out) :-
|
|
split(Inp," ",["A",Atom,_,_]), !,
|
|
append([" Atom Atom",Atom,"_;\n#define Atom",Atom," Yap_heap_regs->Atom",Atom,"_"],Out).
|
|
%gen_fields(Inp,Out) :-
|
|
% split(Inp," ",["A",Atom,_]), !,
|
|
% append([" Atom Atom_",Atom,"_;\n#define Atom_",Atom," Yap_heap_regs->Atom_",Atom,"_"],Out).
|
|
gen_fields(Inp,Out) :-
|
|
split(Inp," ",["F",Name,_,_]), !,
|
|
append([" Functor Functor",Name,"_;\n#define Functor",Name," Yap_heap_regs->Functor",Name,"_"],Out).
|
|
%gen_fields(Inp,Out) :-
|
|
% split(Inp," ",["F",Name,Arity]), !,
|
|
% append([" Functor Functor_",Name,Arity,"_;\n#define Functor_",Name,Arity," Yap_heap_regs->Functor_",Name,Arity,"_"],Out).
|
|
|
|
gen_rcov(Inp,Out) :-
|
|
split(Inp," ",["A",Atom,_,_]), !,
|
|
append([" Atom",Atom," = AtomAdjust(Atom",Atom,");"],Out).
|
|
%gen_rcov(Inp,Out) :-
|
|
% split(Inp," ",["A",Atom,_]), !,
|
|
% append([" Atom_",Atom," = AtomAdjust(Atom_",Atom,");"],Out).
|
|
gen_rcov(Inp,Out) :-
|
|
split(Inp," ",["F",Functor,_,_]), !,
|
|
append([" Functor",Functor," = FuncAdjust(Functor",Functor,");"],Out).
|
|
%gen_rcov(Inp,Out) :-
|
|
% split(Inp," ",["F",Functor,Arity]), !,
|
|
% append([" Functor_",Functor,Arity," = FuncAdjust(Functor_",Functor,Arity,");"],Out).
|
|
|
|
gen_decl(Inp,Out) :-
|
|
split(Inp," ",["A",Atom,"N",String]), !,
|
|
append([" Atom",Atom," = Yap_LookupAtom(",String,");"],Out).
|
|
gen_decl(Inp,Out) :-
|
|
split(Inp," ",["A",Atom,"F",String]), !,
|
|
append([" Atom",Atom," = Yap_FullLookupAtom(",String,");"],Out).
|
|
%gen_decl(Inp,Out) :-
|
|
% split(Inp," ",["A",Atom,String]), String = [0'",0'$|_], !,
|
|
% append([" Atom_",Atom," = Yap_FullLookupAtom(",String,");"],Out).
|
|
%gen_decl(Inp,Out) :-
|
|
% split(Inp," ",["A",Atom,String]), !,
|
|
% append([" Atom_",Atom," = Yap_LookupAtom(",String,");"],Out).
|
|
gen_decl(Inp,Out) :-
|
|
split(Inp," ",["F",Name,Atom,Arity]), !,
|
|
append([" Functor",Name," = Yap_MkFunctor(Atom",Atom,",",Arity,");"],Out).
|
|
%gen_decl(Inp,Out) :-
|
|
% split(Inp," ",["F",Name,Arity]), !,
|
|
% append([" Functor_",Name,Arity," = Yap_MkFunctor(Atom_",Name,",",Arity,");"],Out).
|