Fixed c-bindings gfctest

This commit is contained in:
jordi.saludes
2010-06-05 11:01:09 +00:00
parent 87a8d91d3b
commit a1b6234bd4
2 changed files with 10 additions and 7 deletions

View File

@@ -15,7 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
gf --make ../../examples/tutorial/embedded/QueryEng.gf &&
ghc --make -fglasgow-exts -O2 -no-hs-main $* -c PGFFFI.hs &&
ghc --make -fglasgow-exts -O2 -no-hs-main $* gfctest.c gf_lexing.c PGFFFI.hs -o gfctest
gf=../../dist/build/gf/gf
src=../../src
import=-i$src/runtime/haskell:$src/compiler
$gf --make ../../examples/tutorial/embedded/QueryEng.gf &&
ghc $import --make -fglasgow-exts -O2 -no-hs-main $* -c PGFFFI.hs &&
ghc $import --make -fglasgow-exts -O2 -no-hs-main $* gfctest.c PGFFFI.hs -o gfctest # gf_lexing.c

View File

@@ -18,7 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "pgf.h"
#include "gf_lexing.h"
// #include "gf_lexing.h"
int main(int argc, char *argv[])
{
@@ -27,9 +27,10 @@ int main(int argc, char *argv[])
GF_PGF pgf = gf_readPGF("Query.pgf");
GF_Language lang = gf_readLanguage("QueryEng");
GF_Type cat = gf_startCat(pgf);
char *lexed = gf_stringOp("lextext")("Is 2 prime");
// char *lexed = gf_stringOp("lextext", "Is 2 prime");
char *lexed = "is 23 odd";
GF_Tree *result = gf_parse(pgf, lang, cat, lexed);
free(lexed);
//free(lexed);
GF_Tree *p = result;
if (*p) {
do {