mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-11 05:49:31 -06:00
better dictionary visualization in the Android App
This commit is contained in:
@@ -212,6 +212,25 @@ Java_org_grammaticalframework_pgf_PGF_getStartCat(JNIEnv* env, jobject self)
|
||||
return gu2j_string(env, pgf_start_cat(get_ref(env, self)));
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_grammaticalframework_pgf_PGF_getFunctionType(JNIEnv* env, jobject self, jstring jid)
|
||||
{
|
||||
PgfPGF* pgf = get_ref(env, self);
|
||||
GuPool* tmp_pool = gu_new_pool();
|
||||
PgfCId id = j2gu_string(env, jid, tmp_pool);
|
||||
PgfType* tp = pgf_function_type(pgf, id);
|
||||
gu_pool_free(tmp_pool);
|
||||
|
||||
if (tp == NULL)
|
||||
return NULL;
|
||||
|
||||
jclass type_class = (*env)->FindClass(env, "org/grammaticalframework/pgf/Type");
|
||||
jmethodID constrId = (*env)->GetMethodID(env, type_class, "<init>", "(Lorg/grammaticalframework/pgf/PGF;J)V");
|
||||
jobject jtype = (*env)->NewObject(env, type_class, constrId, self, p2l(tp));
|
||||
|
||||
return jtype;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GuMapItor fn;
|
||||
JNIEnv *env;
|
||||
@@ -535,6 +554,13 @@ Java_org_grammaticalframework_pgf_Expr_readExpr(JNIEnv* env, jclass clazz, jstri
|
||||
return (*env)->NewObject(env, clazz, constrId, jpool, NULL, p2l(gu_variant_to_ptr(e)));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_grammaticalframework_pgf_Type_getCategory(JNIEnv* env, jobject self)
|
||||
{
|
||||
PgfType* tp = get_ref(env, self);
|
||||
return gu2j_string(env, tp->cid);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_grammaticalframework_pgf_Generator_generateAll(JNIEnv* env, jclass clazz, jobject jpgf, jstring jstartCat)
|
||||
{
|
||||
|
||||
7
src/runtime/java/org/grammaticalframework/pgf/Hypo.java
Normal file
7
src/runtime/java/org/grammaticalframework/pgf/Hypo.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package org.grammaticalframework.pgf;
|
||||
|
||||
public class Hypo {
|
||||
public native boolean getBindType();
|
||||
public native String getVariable();
|
||||
public native Type getType();
|
||||
}
|
||||
@@ -1,4 +1,18 @@
|
||||
package org.grammaticalframework.pgf;
|
||||
|
||||
public class Type {
|
||||
public native String getCategory();
|
||||
public native Expr[] getExprs();
|
||||
public native Hypo[] getHypos();
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// private stuff
|
||||
|
||||
private PGF gr;
|
||||
private long ref;
|
||||
|
||||
private Type(PGF gr, long ref) {
|
||||
this.gr = gr;
|
||||
this.ref = ref;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user