rename dt to x
[liba.git] / java / src / trajbell.c
blobad0cb0e3823252ae01a8f5a514913a25aaece926
1 #include "a.h"
2 #include "a/trajbell.h"
3 #include "liba_trajbell.h"
5 #undef L
6 #define L Java_liba_trajbell
7 static struct
9 jmethodID _new;
10 jfieldID ctx;
11 } L = {NULL, NULL};
13 JNIEXPORT void JNICALL Java_liba_trajbell_clinit(JNIEnv *_env, jclass _cls)
15 jclass _nbb = (*_env)->FindClass(_env, "Ljava/nio/ByteBuffer;");
16 L._new = (*_env)->GetStaticMethodID(_env, _nbb, "allocateDirect", "(I)Ljava/nio/ByteBuffer;");
17 L.ctx = (*_env)->GetFieldID(_env, _cls, "ctx", "Ljava/nio/ByteBuffer;");
20 JNIEXPORT void JNICALL Java_liba_trajbell_init(JNIEnv *_env, jobject _obj)
22 jobject _ctx = (*_env)->CallObjectMethod(_env, _obj, L._new, (jint)sizeof(a_trajbell));
23 (*_env)->SetObjectField(_env, _obj, L.ctx, _ctx);
26 JNIEXPORT jdouble JNICALL Java_liba_trajbell_gen(JNIEnv *_env, jobject _obj, jdouble jm, jdouble am, jdouble vm, jdouble p0, jdouble p1, jdouble vs, jdouble ve)
28 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
29 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
30 return a_trajbell_gen(ctx, jm, am, vm, p0, p1, vs, ve);
33 JNIEXPORT jdouble JNICALL Java_liba_trajbell_t(JNIEnv *_env, jobject _obj)
35 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
36 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
37 return ctx->t;
40 JNIEXPORT jdouble JNICALL Java_liba_trajbell_tv(JNIEnv *_env, jobject _obj)
42 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
43 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
44 return ctx->tv;
47 JNIEXPORT jdouble JNICALL Java_liba_trajbell_ta(JNIEnv *_env, jobject _obj)
49 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
50 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
51 return ctx->ta;
54 JNIEXPORT jdouble JNICALL Java_liba_trajbell_td(JNIEnv *_env, jobject _obj)
56 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
57 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
58 return ctx->td;
61 JNIEXPORT jdouble JNICALL Java_liba_trajbell_taj(JNIEnv *_env, jobject _obj)
63 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
64 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
65 return ctx->taj;
68 JNIEXPORT jdouble JNICALL Java_liba_trajbell_tdj(JNIEnv *_env, jobject _obj)
70 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
71 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
72 return ctx->tdj;
75 JNIEXPORT jdouble JNICALL Java_liba_trajbell_p0(JNIEnv *_env, jobject _obj)
77 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
78 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
79 return ctx->p0;
82 JNIEXPORT jdouble JNICALL Java_liba_trajbell_p1(JNIEnv *_env, jobject _obj)
84 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
85 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
86 return ctx->p1;
89 JNIEXPORT jdouble JNICALL Java_liba_trajbell_v0(JNIEnv *_env, jobject _obj)
91 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
92 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
93 return ctx->v0;
96 JNIEXPORT jdouble JNICALL Java_liba_trajbell_v1(JNIEnv *_env, jobject _obj)
98 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
99 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
100 return ctx->v1;
103 JNIEXPORT jdouble JNICALL Java_liba_trajbell_vm(JNIEnv *_env, jobject _obj)
105 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
106 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
107 return ctx->vm;
110 JNIEXPORT jdouble JNICALL Java_liba_trajbell_jm(JNIEnv *_env, jobject _obj)
112 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
113 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
114 return ctx->jm;
117 JNIEXPORT jdouble JNICALL Java_liba_trajbell_am(JNIEnv *_env, jobject _obj)
119 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
120 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
121 return ctx->am;
124 JNIEXPORT jdouble JNICALL Java_liba_trajbell_dm(JNIEnv *_env, jobject _obj)
126 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
127 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
128 return ctx->dm;
131 JNIEXPORT jdouble JNICALL Java_liba_trajbell_pos(JNIEnv *_env, jobject _obj, jdouble x)
133 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
134 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
135 return a_trajbell_pos(ctx, x);
138 JNIEXPORT jdouble JNICALL Java_liba_trajbell_vel(JNIEnv *_env, jobject _obj, jdouble x)
140 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
141 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
142 return a_trajbell_vel(ctx, x);
145 JNIEXPORT jdouble JNICALL Java_liba_trajbell_acc(JNIEnv *_env, jobject _obj, jdouble x)
147 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
148 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
149 return a_trajbell_acc(ctx, x);
152 JNIEXPORT jdouble JNICALL Java_liba_trajbell_jer(JNIEnv *_env, jobject _obj, jdouble x)
154 jobject _ctx = (*_env)->GetObjectField(_env, _obj, L.ctx);
155 a_trajbell *ctx = (a_trajbell *)(*_env)->GetDirectBufferAddress(_env, _ctx);
156 return a_trajbell_jer(ctx, x);