bugfix for print names in the C runtime and expose the functionality from Java

This commit is contained in:
krasimir
2017-05-11 09:11:30 +00:00
parent 2cf98147e6
commit a839bdc687
5 changed files with 26 additions and 7 deletions

View File

@@ -1146,6 +1146,19 @@ Java_org_grammaticalframework_pgf_Concr_hasLinearization(JNIEnv* env, jobject se
return res;
}
JNIEXPORT jstring JNICALL
Java_org_grammaticalframework_pgf_Concr_getPrintName(JNIEnv* env, jobject self, jstring jid)
{
PgfConcr* concr = get_ref(env, self);
GuPool* tmp_pool = gu_local_pool();
PgfCId id = j2gu_string(env, jid, tmp_pool);
GuString name = pgf_print_name(concr, id);
jstring jname = (name == NULL) ? NULL : gu2j_string(env, name);
gu_pool_free(tmp_pool);
return jname;
}
JNIEXPORT jlong JNICALL
Java_org_grammaticalframework_pgf_Pool_alloc(JNIEnv* env, jclass clazz)
{

View File

@@ -79,6 +79,10 @@ public class Concr {
*/
public native boolean hasLinearization(String fun);
/** returns the print name for that function or category.
*/
public native String getPrintName(String id);
/** If the concrete syntaxes in the grammar are stored in external
* files then this method can be used to load the current syntax
* in memory.