Commit 9a58fd67 authored by Thierry Martinez's avatar Thierry Martinez

Top level

parents
all: biocham
clean:
rm -f biocham
biocham: biocham.pl
swipl -o biocham -g main -c biocham.pl
main :-
about,
init,
toplevel,
halt.
about :-
print('BIOCHAM 4.0'),
nl,
print('Copyright (C) 2003-2015 Inria, EPI Lifeware, Paris-Rocquencourt, France,'),
nl,
print('license GNU GPL 2, http://lifeware.inria.fr/biocham/'),
nl.
init :-
set_prolog_flag(allow_variable_name_as_functor, true),
op(200, xfx, '=>').
toplevel :-
read_command(Term),
catch(
execute(Term),
E,
print_message(error, E)),
toplevel.
read_command(Term) :-
read_command_with_variables(Term, VariableNames),
suppress_variables_from_term(Term, VariableNames).
read_command_with_variables(Term, VariableNames) :-
read_history('', '', [], 'biocham:', Term, VariableNames).
suppress_variables_from_term(Term, VariableNames) :-
bind_variables(VariableNames),
term_variables(Term, AnonymousVariables),
bind_anonymous_variables(AnonymousVariables).
bind_variables([]).
bind_variables([Name = Variable | Tail]) :-
Name = Variable,
bind_variables(Tail).
bind_anonymous_variables([]).
bind_anonymous_variables([Variable | Tail]) :-
Variable = '_',
bind_anonymous_variables(Tail).
execute(Term) :-
(
(
Term = 'quit'
;
Term = 'end_of_file'
)
->
halt
;
(
Term = 'add_rule'(Rule)
;
Term = 'add_rules'(Rule)
)
->
add_rule(Rule)
;
Term = 'list_rules'
->
list_rules
;
Term = numerical_simulation
->
numerical_simulation(20)
;
Term = numerical_simulation(Time)
->
numerical_simulation(Time)
;
throw(unknown_command(Term))
).
CFLAGS=`pkg-config --cflags libsbml`
LDLIBSx=`pkg-config --libs libsbml`
all: sbml2biocham
clean:
rm -rf sbml2biocham sbml2biocham.o
sbml2biocham: sbml2biocham.o
#include <stdio.h>
#include <sbml/SBMLTypes.h>
int
main (int argc, char *argv[])
{
const char *filename;
SBMLDocument_t *document;
Model_t *model;
if (argc != 2) {
fprintf(stderr, "Usage: sbml2biocham filename\n");
return 2;
}
filename = argv[1];
document = readSBML(filename);
if (SBMLDocument_getNumErrors(document) != 0) {
SBMLDocument_printErrors(document, stderr);
return 1;
}
model = SBMLDocument_getModel(document);
SBMLDocument_free(document);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment