]> rtime.felk.cvut.cz Git - orte.git/blob - orte/libjorte/JORTEDomainInitEvents.c
Reformat the sources with orte/uncrustify script
[orte.git] / orte / libjorte / JORTEDomainInitEvents.c
1 /* JORTEDomainInitEvents.c */
2
3
4 /**
5   * This code provides conversion between JAVA a C environments.
6   * The C functions are calling here and results are send to JAVA
7   * native functions. It uses the header pregenerated by JAVA
8   * (by command 'javah -jni class_with_native_function')
9   *
10   * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
11   * @author CTU FEE Prague - Department of Control Engineering (dce.felk.cvut.cz
12 )
13   * @author Project ORTE - OCERA Real Time Ethernet (www.ocera.org)
14   * @author dedication to Kj
15   * @version 0.1
16   *
17   *
18   * This program is free software; you can redistribute it and/or modify
19   * it under the terms of the GNU General Public License as published by
20   * the Free Software Foundation; either version 2 of the License, or
21   * (at your option) any later version.
22   *
23   * This program is distributed in the hope that it will be useful,
24   * but WITHOUT ANY WARRANTY; without even the implied warranty of
25   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26   * GNU General Public License for more details.
27   *
28   */
29
30 #include <stdlib.h>
31 // origin orte headers
32 #include "orte.h"
33 // pregenerated header
34 #include "jorte/org_ocera_orte_types_DomainEvents.h"
35 #include "jorte/4all.h"
36
37 JNIEXPORT jlong JNICALL
38 Java_org_ocera_orte_types_DomainEvents_jORTEDomainInitEvents
39   (JNIEnv *env, jobject obj)
40 {
41   ORTEDomainAppEvents *evs;
42
43   // memory allocation
44   evs = (ORTEDomainAppEvents *)malloc(sizeof(ORTEDomainAppEvents));
45   if (evs == 0) {
46     printf(":!c: evs = NULL [not enough memory] \n");
47     return 0;
48   }
49   // call the liborte function
50   if (!ORTEDomainInitEvents(evs)) {
51     printf(":!c: events not initialized! \n");
52     free(evs);
53     return 0;
54   }
55   #ifdef TEST_STAGE
56   printf(":c: events initialized.. \n");
57   #endif
58
59   return ((jlong)evs);
60
61 }