Commit 416574e1 authored by Jerome Benoit's avatar Jerome Benoit

Imported Upstream version 0.99~b6

parent 30bb006c
$Id: Changes,v 1.134 2011/02/18 04:52:59 johns Exp $
$Id: Changes,v 1.148 2013/04/21 19:16:38 johns Exp $
Changelog for Tachyon(tm) Ray Tracer
------------------------------------
04/21/2013 o Added the Doxygen build files to the source tree
o Massive update to the list of different target platforms.
I have removed all of the old build targets that aren't
particularly relevant to an average person from the main list,
but they are still in the makefiles for those that want to
dig into Make-arch and see what is there.
o Implemented a new barrier synchronization mechanism for
synchronizing the pool of worker threads on each node
prior to sending/receiving the image buffer via MPI.
This increases the performance of hybrid MPI/threads
builds quite substantially on average. Rather than using
the higher-cost threadpool barriers on each row/scanline,
this implementation uses either lock-free atomic integer
operations or a minimalistic mutex-based approach.
Tests on the NCSA Blue Waters Cray XE6/XK7 give a
performance gain of roughly 3.6x when using the
mutex- or fetch-and-add/add-and-fetch atomic counter
barriers rather than the condition variable sleeping barriers.
o Added support for atomic integer ops for improved performance
when mixing threads and distributed memory message passing.
o Fixed a couple of bugs in the volume loader code.
Added check for successful read, and added a missing
call to fclose().
o Added bluewaters-mpi-thr target enabling both MPI and threads.
o Replaced hard-coded threading defines in the makefile with
inclusion of flags from Make-config similar to what is
already done for MPI and other features. This makes it
much easier to enable/disable various implementation
options, tunings, and machine-dependent, compiler-specific,
platform-specific optimizations, and experimental code.
04/20/2013 o Eliminated a small bit of unnecessarily inlined/duplicated
code for caching the AO RNG handle in the two main
image generation loops.
o Added commentary about the costs of the barrier synchronization
in the context of mixed threads+MPI builds, and the opportunity
to replace it with simpler mechanisms such as a scheme based on
fetch-add atomic ops.
04/19/2013 o Integrated bug fixes for the old OpenMP code path
and added build targets linux-icc-64-openmp and linux-64-openmp.
o Fixed a bug with OpenGL+MPI where all of the non-zero nodes
were setting their image output buffers to rgb96f, but
node 0 was setting rgb24f. All nodes now set their output
buffers to rgb24f if OpenGL is enabled. Added a simple
linux-mpi-ogl build target for easy testing.
04/17/2013 o Misc cleanup of the Makefiles, added more comments
regarding the need for -DUSE_MPI_IN_PLACE when compiling
with MPI 2.x libraries.
04/09/2013 o Changed the double-precision epsilon values to prevent
occurence of the "digital zits" problem when rendering
VMD scenes of extremely large structures such as the HIV capsid.
Reducing the epsilon value by 50 cures this problem for
extremely large VMD scenes. In the longer term, Tachyon
should be changed to use epsilon differently to avoid
this sort of sensitivity.
12/09/2012 o Use the pthread affinity APIs when compiling for Intel MIC
12/07/2012 o Added support native Tachyon builds on
Intel Xeon Phi (MIC) compute accelerators
12/06/2012 o Updated CARMA Tegra3 targets to use forced override of
the number of CPU cores to prevent offlined CPUs from
causing Tachyon to spawn too few host threads.
11/15/2012 o Added new linux-carma-thr and linux-carma-softfp-thr
build targets supporting the NVIDIA / SECO Tegra3
development boards.
09/29/2012 o Added workaround to address the problem of varying CPU counts
reported by sysconf() on the Android platform. Android varies
the number of active CPU cores according to system activity,
thermal load, and battery state. Several existing Android
versions incorrectly report the number of active processors
rather than the number of physical processors when queried
with _SC_NPROCESSORS_CONF, so until this is fixed, we work
around that problem by reading and interpreting the contents
of the file /sys/devices/system/cpu/present.
09/28/2012 o Added special Java JNI wrapper functions and supporting
infrastructure that is required in order to call Tachyon
from Java, wrapped in an Android application.
o Don't call exit() on the Android platform, return instead.
o Added new Makefile macros to control the naming of the Tachyon
Java JNI wrapper function, and the app/class that it
gets embedded into.
o Significantly streamlined Android JNI builds by adding new macros to control NDK binary/include/lib/sysroot paths.
09/24/2012 o Updated the Tachyon threads code for MacOS X to avoid using
the old Carbon Multiprocessing APIs, which are now deprecated
on versions of MacOS X 10.7 and later.
08/27/2012 o Fixed a potential thread handle leak on Windows platforms.
03/14/2012 o Added check for USE_MPI_IN_PLACE macro when compiling
Tachyon for platforms based on MPI 2.x, such as the
NCSA/Cray Blue Waters system.
04/11/2012 o Fix behavior of non-blocking glwin_handle_events() calls
on windows.
Updated OpenGL window handling code to process various
mouse events and to prevent dropping any events.
02/17/2011 o Revised Tachyon APIs to greatly improve const correctness.
02/15/2011 o Changed the behavior of OpenGL fog such that fog color
......
/*
* Copyright (c) 1994-2011 John E. Stone
* Copyright (c) 1994-2013 John E. Stone
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: Copyright,v 1.10 2011/02/05 18:56:09 johns Exp $
* $Id: Copyright,v 1.11 2013/04/21 19:16:57 johns Exp $
*
*/
$Id: README,v 1.27 2011/02/05 19:00:07 johns Exp $
$Id: README,v 1.28 2013/04/21 19:32:42 johns Exp $
README for Tachyon(tm) Parallel/Multiprocessor Ray Tracing Software
-------------------------------------------------------------------
......@@ -10,40 +10,63 @@ Author: John E. Stone - john.stone@gmail.com (preferred email address)
What is Tachyon?
----------------
Tachyon is a result of my curiosities in computer graphics. Some of
it was written as part of my M.S. degree in Computer Science, other
parts of it were done purely for their entertainment value.
In this collection of software, you will find:
Tachyon was originally written as part of my M.S. degree in Computer Science,
but I have made an ongoing effort to maintain and improve at as a
hobby, and for the benefit of the molecular visualization community where
Tachyon gets significant use as the built-in photorealistic renderer in
the molecular visualization program VMD.
- A portable, high performance parallel ray tracing system supporting
In the Tachyon distribution you will find:
- Tachyon ray tracing library:
A portable, high performance parallel ray tracing system supporting
MPI and multithreaded implementations. Tachyon is built as a
C callable library, which can be used with the included demo
C/C++ callable library, which can be used with the included demo
programs or within your own application. The distribution
also includes a simple scene file parser front-end which reads
a few different formats.
a few other input file formats such as MGF, NFF, and an old
version of AC3D.
- Tachyon implements all of the basic geometric primitives such as
triangles, planes, spheres, cylinders, etc. Some of the goals in
developing Tachyon were to make it fast and for it to parallelize
well. These are what set it apart from more full-featured programs
like POV-Ray, Rayshade, and others. Tachyon supports enough features
to be an excellent alternative to slower programs for demanding animation
and scientific visualization tasks. As time goes on, Tachyon will
indeed incorporate more features, but with a continued emphasis on
rendering performance.
- Tachyon standalone ray tracer:
Tachyon implements all of the basic geometric primitives such as
triangles, planes, spheres, cylinders, etc. Recent versions of
Tachyon support ambient occlusion lighting, material properties
for shading with angle-modulated transparency, and many other
features of particular use in molecular visualization.
The original goal in developing Tachyon was to make it fast
and to parallelize well both for shared memory, distributed
memory parallel, and hybrid shared/distributed memory parallel
computers. These areas of emphasis are what set Tachyon apart
from more full-featured programs like POV-Ray, Rayshade, and
many others. Tachyon is an excellent alternative to slower
programs for computationally demanding animation and
scientific visualization tasks. As time goes on, Tachyon will
incorporate more features, but will continue its emphasis on
minimalism, rendering performance, and simplicity.
- Example scenes for use with the ray tracer and previewer.
Note: some scenes require texture maps and/or volume data sets
which are distributed seperately due to their large size.
- Example scenese:
Tachyon comes with example scenes for use with the
standalone ray tracer executable. Note that some of
the example scenes require texture maps and/or volume data sets
which are distributed seperately due to their large size.
How do I compile and run Tachyon?
---------------------------------
The build process is quite simple. On Unix, just cd into the
unix directory and type "make", you'll see a long list of configurations
that can be built. This will work fine for almost all Unix systems.
If you wish to customize your build to enable optional features,
you'll need to edit Make-config. These are discussed in more
detail in the README file included in the unix directory.
The build process is quite simple. On Unix, just "cd" into the
unix directory and type "make". You wil see a list of common
configurations that can be built. This will work fine for almost
all common Unix systems. The Make-arch file contains a large
number of other build configurations that are not listed
in the main list, if you don't see what you're looking for.
To customize the Tachyon build to enable optional features,
to force the use of single-precision arithmetic, or other
site-specific customizations, the Make-config file should be
edited as-needed.
To compile Tachyon for unusual hardware or software environments,
the Make-arch file may also need to be edited to add a new
set of make rules for the new target platform.
These steps are discussed in more detail in the README file
included in the unix directory.
On Windows, the process is as simple as loading up the project files
in the msvc subdirectory and building them.
......@@ -62,12 +85,12 @@ How can I contribute to further development?
--------------------------------------------
I continue to work on this software in my free time. I depend
on other individuals or institutions to provide me access to
the various kinds of parallel computers Tachyon supports in
order to continue maintaining it on those platforms. If you
would like to see the software ported to a new parallel platform,
send me a note, and I'll work with you on it.
the various parallel computers and compilers that Tachyon supports
in order to continue maintaining it on those platforms. If you
would like to see Tachyon ported to a new parallel platform,
send me a note and I'll be happy to take a look at it.
I would be happy to collaborate with others on extending
Tachyon for a wide variety of uses.
Tachyon for a wider variety of uses.
Copyrights etc.
---------------
......@@ -75,7 +98,7 @@ Copyrights etc.
except where noted within specific source files. You may use this code
for any purpose you wish, as long as credit is given to its source(s).
Last updated February 5, 2011
Last updated April 21, 2013
John E. Stone
john.stone@gmail.com
......
This diff is collapsed.
This diff is collapsed.
/animspheres2.c/1.11/Wed Jul 3 21:20:08 2002//
/hypertex.c/1.13/Wed Jul 3 21:20:09 2002//
/trackball.c/1.1/Sun Aug 19 05:57:17 2001//
/trackball.h/1.1/Sun Aug 19 05:57:17 2001//
/animskull.c/1.12/Mon Jan 31 15:25:01 2011//
/fire.c/1.24/Mon Jan 31 15:25:01 2011//
/mainanim.c/1.15/Mon Jan 31 15:25:02 2011//
/animspheres.c/1.16/Mon Jan 31 15:26:14 2011//
/ac3dparse.c/1.19/Fri Feb 4 15:29:45 2011//
/ac3dparse.h/1.8/Fri Feb 4 15:29:45 2011//
/mgfparse.c/1.14/Fri Feb 4 15:29:45 2011//
/mgfparse.h/1.3/Fri Feb 4 15:29:45 2011//
/nffparse.c/1.13/Fri Feb 4 15:29:45 2011//
/nffparse.h/1.4/Fri Feb 4 15:29:45 2011//
/spaceball.h/1.4/Fri Feb 4 15:29:45 2011//
/tgatoyuv.c/1.4/Fri Feb 4 15:29:46 2011//
/getargs.h/1.25/Fri Feb 4 16:06:03 2011//
/getargs.c/1.57/Fri Feb 4 16:11:46 2011//
/spaceball.c/1.6/Mon Feb 7 05:50:55 2011//
/parse.c/1.87/Tue Feb 15 23:51:58 2011//
/parse.h/1.32/Tue Feb 15 23:51:58 2011//
/glwin.c/1.73/Wed Mar 7 06:53:21 2012//
/glwin.h/1.20/Wed Mar 7 06:53:21 2012//
/main.c/1.110/Sun Apr 21 19:09:28 2013//
D
johns@www.photonlimited.org:/home/johns/cvsroot
......@@ -10,7 +10,7 @@
* This file is part of the Tachyon ray tracer.
* John E. Stone - john.stone@gmail.com
*
* $Id: glwin.c,v 1.71 2011/02/07 05:23:22 johns Exp $
* $Id: glwin.c,v 1.73 2011/04/11 07:08:07 johns Exp $
*/
#include <stdio.h>
......@@ -23,7 +23,11 @@
/*
* Win32
*/
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400 /* hack for definition of wheel event codes */
#endif
#include <windows.h>
#include <winuser.h> /* mouse wheel event codes */
#include <GL/gl.h>
/* 3DxWare driver */
#if defined(VMDSPACEWARE) && defined(WIN32)
......@@ -92,6 +96,7 @@ typedef struct {
HGLRC hRC;
long scrwidth;
long scrheight;
long MouseFlags;
#else
int scrnum;
Display *dpy;
......@@ -107,6 +112,8 @@ typedef struct {
int height; /* height of window */
int xpos; /* x position of window */
int ypos; /* y position of window */
int mousex; /* x position of mouse */
int mousey; /* y position of mouse */
int evdev; /* event device class */
int evval; /* value of the event */
char evkey; /* keypress ASCII character */
......@@ -339,7 +346,7 @@ void * glwin_create(const char * wintitle, int width, int height) {
XSelectInput(handle->dpy, handle->win,
KeyPressMask | ButtonPressMask | ButtonReleaseMask |
StructureNotifyMask | ExposureMask |
PointerMotionMask | StructureNotifyMask | ExposureMask |
EnterWindowMask | LeaveWindowMask | FocusChangeMask);
/* set window manager size and position hints */
......@@ -425,11 +432,13 @@ int glwin_handle_events(void * voidhandle, int evblockmode) {
if (handle == NULL)
return 0;
/* clear previous spaceball event state, except for button state which */
/* must be left alone. */
/* clear previous spaceball event state, except for button state which */
/* must be left alone. */
spaceball_clear_event(&handle->sballevent);
while (evblockmode || XPending(handle->dpy)) {
/* only process a single recognized event and then return to the caller */
/* otherwise it is too easy to drop mouse button press/release events */
while (!rc && (evblockmode || XPending(handle->dpy))) {
int k;
unsigned int button;
XEvent event;
......@@ -456,6 +465,8 @@ int glwin_handle_events(void * voidhandle, int evblockmode) {
break;
case KeyPress:
handle->mousex = event.xbutton.x;
handle->mousey = event.xbutton.y;
k = XLookupString(&(event.xkey), keybuf, keybuflen, &keysym, &comp);
if (k > 0 && keybuf[0] != '\0') {
handle->evdev = GLWIN_EV_KBD;
......@@ -496,10 +507,19 @@ int glwin_handle_events(void * voidhandle, int evblockmode) {
}
break;
case MotionNotify:
handle->evdev = GLWIN_EV_MOUSE_MOVE;
handle->mousex = event.xmotion.x;
handle->mousey = event.xmotion.y;
rc=1; /* we got one event */
break;
case ButtonPress:
case ButtonRelease:
button = event.xbutton.button;
handle->evval = (event.type == ButtonPress);
handle->mousex = event.xbutton.x;
handle->mousey = event.xbutton.y;
switch (button) {
case Button1:
handle->evdev = GLWIN_EV_MOUSE_LEFT;
......@@ -881,6 +901,18 @@ static int myCreateWindow(oglhandle * handle, const char * wintitle,
}
static void win32decodemouse(oglhandle *handle, LPARAM lParam) {
int x, y;
x = LOWORD(lParam);
y = HIWORD(lParam);
/* handle mouse capture in negative range */
if (x & 1 << 15) x -= (1 << 16);
if (y & 1 << 15) y -= (1 << 16);
handle->mousex = x;
handle->mousey = y;
}
LONG WINAPI myWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
PAINTSTRUCT ps; /* Paint structure. */
oglhandle *handle;
......@@ -909,11 +941,7 @@ LONG WINAPI myWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
if (handle == NULL)
return DefWindowProc(hwnd, msg, wParam, lParam);
handle->evdev = GLWIN_EV_NONE;
handle->evval = 0;
handle->evkey = '\0';
switch(msg) {
switch (msg) {
case WM_CREATE:
handle->hWnd = hwnd; /* must be set before we do anything else */
handle->hRC = SetupOpenGL(handle);
......@@ -976,6 +1004,76 @@ LONG WINAPI myWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
}
return 0;
case WM_MOUSEMOVE:
win32decodemouse(handle, lParam);
handle->evdev = GLWIN_EV_MOUSE_MOVE;
handle->MouseFlags = (long) wParam;
if (!(handle->MouseFlags & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)))
ReleaseCapture();
return 0;
case WM_MOUSEWHEEL:
{
int wheeldelta = ((short) HIWORD(wParam));
if (wheeldelta > (WHEEL_DELTA / 2)) {
handle->evdev = GLWIN_EV_MOUSE_WHEELUP;
} else if (wheeldelta < -(WHEEL_DELTA / 2)) {
handle->evdev = GLWIN_EV_MOUSE_WHEELDOWN;
}
}
return 0;
case WM_LBUTTONDOWN:
SetCapture(hwnd);
win32decodemouse(handle, lParam);
handle->MouseFlags = (long) wParam;
handle->evdev = GLWIN_EV_MOUSE_LEFT;
handle->evval = 1;
return 0;
case WM_LBUTTONUP:
win32decodemouse(handle, lParam);
handle->MouseFlags = (long) wParam;
handle->evdev = GLWIN_EV_MOUSE_LEFT;
handle->evval = 0;
if (!(handle->MouseFlags & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)))
ReleaseCapture();
return 0;
case WM_MBUTTONDOWN:
SetCapture(hwnd);
win32decodemouse(handle, lParam);
handle->MouseFlags = (long) wParam;
handle->evdev = GLWIN_EV_MOUSE_MIDDLE;
handle->evval = 1;
return 0;
case WM_MBUTTONUP:
win32decodemouse(handle, lParam);
handle->MouseFlags = (long) wParam;
handle->evdev = GLWIN_EV_MOUSE_MIDDLE;
handle->evval = 0;
if (!(handle->MouseFlags & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)))
ReleaseCapture();
return 0;
case WM_RBUTTONDOWN:
SetCapture(hwnd);
win32decodemouse(handle, lParam);
handle->MouseFlags = (long) wParam;
handle->evdev = GLWIN_EV_MOUSE_RIGHT;
handle->evval = 1;
return 0;
case WM_RBUTTONUP:
win32decodemouse(handle, lParam);
handle->MouseFlags = (long) wParam;
handle->evdev = GLWIN_EV_MOUSE_RIGHT;
handle->evval = 0;
if (!(handle->MouseFlags & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)))
ReleaseCapture();
return 0;
case WM_CLOSE:
PostQuitMessage(0);
return 0;
......@@ -1078,24 +1176,37 @@ void glwin_swap_buffers(void * voidhandle) {
int glwin_handle_events(void * voidhandle, int evblockmode) {
oglhandle * handle = (oglhandle *) voidhandle;
MSG msg;
/* This pumps the Windows message queue, forcing WEvents to be updated */
/* by the time we return from DispatchMessage. */
if (evblockmode == GLWIN_EV_POLL_BLOCK) {
if (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
return 1;
}
} else {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
int rc=0;
int pending=0;
handle->evdev = GLWIN_EV_NONE;
handle->evval = 0;
handle->evkey = '\0';
/* This pumps the Windows message queue, forcing events to be updated */
/* by the time we return from DispatchMessage. */
pending=PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
while (!rc && (evblockmode || pending)) {
if (pending) {
TranslateMessage(&msg); /* translate the message */
DispatchMessage(&msg); /* fire it off to the window proc */
return 1;
pending=0;
} else if (evblockmode == GLWIN_EV_POLL_BLOCK) {
if (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} else {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg); /* translate the message */
DispatchMessage(&msg); /* fire it off to the window proc */
}
}
if (handle->evdev != GLWIN_EV_NONE)
rc=1;
}
return 0;
return rc;
}
......@@ -1217,6 +1328,21 @@ int glwin_get_winpos(void * voidhandle, int *xpos, int *ypos) {
}
int glwin_get_mousepointer(void *voidhandle, int *x, int *y) {
oglhandle * handle = (oglhandle *) voidhandle;
if (handle == NULL)
return -1;
if (x != NULL)
*x = handle->mousex;
if (y != NULL)
*y = handle->mousey;
return 0;
}
int glwin_get_lastevent(void * voidhandle, int *evdev, int *evval, char *evkey) {
oglhandle * handle = (oglhandle *) voidhandle;
if (handle == NULL)
......@@ -1289,6 +1415,10 @@ int glwin_get_winpos(void * voidhandle, int *xpos, int *ypos) {
return -1;
}
int glwin_get_mousepointer(void *voidhandle, int *x, int *y) {
return -1;
}
int glwin_get_lastevent(void * voidhandle, int *evdev, int *evval, char *evkey) {
return -1;
}
......
......@@ -10,7 +10,7 @@
* This file is part of the Tachyon ray tracer.
* John E. Stone - john.stone@gmail.com
*
* $Id: glwin.h,v 1.19 2011/01/28 05:46:16 johns Exp $
* $Id: glwin.h,v 1.20 2011/04/11 06:46:34 johns Exp $
*/
#define GLWIN_EV_POLL_NONBLOCK 0
......@@ -46,6 +46,8 @@
#define GLWIN_EV_KBD_ESC 24
#define GLWIN_EV_MOUSE_MOVE 31
#define GLWIN_EV_MOUSE_LEFT 32
#define GLWIN_EV_MOUSE_MIDDLE 34
#define GLWIN_EV_MOUSE_RIGHT 35
......@@ -59,6 +61,7 @@ int glwin_handle_events(void * voidhandle, int evblockmode);
int glwin_get_wininfo(void * voidhandle, int *instereo, int *havestencil);
int glwin_get_winsize(void * voidhandle, int *xsize, int *ysize);
int glwin_get_winpos(void * voidhandle, int *xpos, int *ypos);
int glwin_get_mousepointer(void *voidhandle, int *x, int *y);
int glwin_get_lastevent(void * voidhandle, int *evdev, int *evval, char *evkey);
int glwin_get_spaceball(void *voidhandle, int *rx, int *ry, int *rz, int *tx, int *ty, int *tz, int *buttons);
int glwin_resize(void *voidhandle, int width, int height);
......
/*
* main.c - This file contains the Tachyon main program.
*
* $Id: main.c,v 1.99 2011/01/31 15:26:14 johns Exp $
* $Id: main.c,v 1.110 2013/04/21 17:38:47 johns Exp $
*/
#include <stdio.h>
......@@ -46,6 +46,107 @@ typedef struct {
} dispHandle;
#if defined(ANDROID)
int ray(int argc, char **argv); /* provide a prototype... */
/*
* Tachyon is wrapped in a JNI shared object and called by Java...
*/
#include <jni.h>
#if !defined(TACHYON_JNI_CLASSNAME)
#define TACHYON_JNI_CLASSNAME "com/photonlimited/Tachyon/Tachyon"
#endif
#if !defined(TACHYON_JNI_WRAPFUNC)
#define TACHYON_JNI_WRAPFUNC Java_com_photonlimited_Tachyon_Tachyon_nativeMain
#endif
void logtojava(JNIEnv *env, jobject thiz, const char *logstring) {
#if 1
// c version JNI interface:
jclass clazz = (*env)->FindClass(env, TACHYON_JNI_CLASSNAME);
jmethodID logOutput = (*env)->GetMethodID(env, clazz, "logOutput",
"(Ljava/lang/String;)V");
/* this actually logs a char*, logstring */
(*env)->CallVoidMethod(env, thiz, logOutput, (*env)->NewStringUTF(env, logstring));
#else
// c++ version JNI interface:
jclass clazz = (env)->FindClass(TACHYON_JNI_CLASSNAME);
jmethodID logOutput = (env)->GetMethodID(clazz, "logOutput",
"(Ljava/lang/String;)V");
/* this actually logs a char*, logstring */
(env)->CallVoidMethod(thiz, logOutput, (env)->NewStringUTF(logstring));
#endif
}
/* XXX gross disgusting hack!!!! */
JNIEnv *global_jnienv; /* XXX hack! */
jobject global_thiz; /* XXX hack! */
/*
* This is the main JNI wrapper function.
* Contains startup code, neverending loop, shutdown code, etc...
*/
void TACHYON_JNI_WRAPFUNC(JNIEnv* env, jobject thiz ) {
char* rargv[10];
global_jnienv = env; /* XXX this is a hack! */
global_thiz = thiz; /* XXX this is a hack! */
fprintf(stderr, "--stderr fprintf---------------------------------\n");
printf("---regular printf----------------------------\n");
fflush(stdout);
logtojava(global_jnienv, global_thiz, "--Log event ---------------------\n");
#if 0
printf("Android platform info:\n");
printf(" sizeof(char): %d\n", sizeof(char));
printf(" sizeof(int): %d\n", sizeof(int));
printf(" sizeof(long): %d\n", sizeof(long));
printf(" sizeof(void*): %d\n", sizeof(void*));
fflush(stdout);