]> rtime.felk.cvut.cz Git - orte.git/blobdiff - orte/libjorte/JORTEDomainInitEvents.c
New ORTE version 0.3.0 committed
[orte.git] / orte / libjorte / JORTEDomainInitEvents.c
diff --git a/orte/libjorte/JORTEDomainInitEvents.c b/orte/libjorte/JORTEDomainInitEvents.c
new file mode 100644 (file)
index 0000000..029f290
--- /dev/null
@@ -0,0 +1,61 @@
+/* JORTEDomainInitEvents.c */
+
+
+/**
+  * This code provides conversion between JAVA a C environments.
+  * The C functions are calling here and results are send to JAVA
+  * native functions. It uses the header pregenerated by JAVA
+  * (by command 'javah -jni class_with_native_function')
+  *
+  * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
+  * @author CTU FEE Prague - Department of Control Engineering (dce.felk.cvut.cz
+)
+  * @author Project ORTE - OCERA Real Time Ethernet (www.ocera.org)
+  * @author dedication to Kj
+  * @version 0.1
+  *
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+  * the Free Software Foundation; either version 2 of the License, or
+  * (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  * GNU General Public License for more details.
+  *
+  */
+
+
+#include <stdlib.h>
+// origin orte headers
+#include "orte.h"
+// pregenerated header
+#include "jorte/org_ocera_orte_DomainEvents.h"
+
+
+
+JNIEXPORT jint JNICALL
+Java_org_ocera_orte_DomainEvents_jORTEDomainInitEvents
+(JNIEnv *env, jclass cls)
+{
+  ORTEDomainAppEvents *evs;
+
+  /* allocation space for the pointer to struc ORTEDomainProp  */
+  evs = (ORTEDomainAppEvents *) malloc(sizeof(ORTEDomainAppEvents));
+  if (evs == NULL) {
+     printf(":!c: not enough of memory to alocation ORTEDomainAppEvents..");
+     return 0;
+  }
+
+  /* call the liborte function */
+  if (!ORTEDomainInitEvents(evs)) {
+    printf(":!c: ORTEDomainInitEvents() failed.. \n");
+    free(evs);
+    return 0;
+  }
+  printf(":c: ORTEDomainInitEvents() succesful.. %p \n",evs);
+  return ((jint) evs);
+
+}