forked from GitHub/gf-core
Fixed c-bindings gfctest
This commit is contained in:
@@ -15,7 +15,9 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
# 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/>.
|
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
gf=../../dist/build/gf/gf
|
||||||
gf --make ../../examples/tutorial/embedded/QueryEng.gf &&
|
src=../../src
|
||||||
ghc --make -fglasgow-exts -O2 -no-hs-main $* -c PGFFFI.hs &&
|
import=-i$src/runtime/haskell:$src/compiler
|
||||||
ghc --make -fglasgow-exts -O2 -no-hs-main $* gfctest.c gf_lexing.c PGFFFI.hs -o gfctest
|
$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
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "pgf.h"
|
#include "pgf.h"
|
||||||
#include "gf_lexing.h"
|
// #include "gf_lexing.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -27,9 +27,10 @@ int main(int argc, char *argv[])
|
|||||||
GF_PGF pgf = gf_readPGF("Query.pgf");
|
GF_PGF pgf = gf_readPGF("Query.pgf");
|
||||||
GF_Language lang = gf_readLanguage("QueryEng");
|
GF_Language lang = gf_readLanguage("QueryEng");
|
||||||
GF_Type cat = gf_startCat(pgf);
|
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);
|
GF_Tree *result = gf_parse(pgf, lang, cat, lexed);
|
||||||
free(lexed);
|
//free(lexed);
|
||||||
GF_Tree *p = result;
|
GF_Tree *p = result;
|
||||||
if (*p) {
|
if (*p) {
|
||||||
do {
|
do {
|
||||||
|
|||||||
Reference in New Issue
Block a user