Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
svn path=/trunk/boinc/; revision=3863
  • Loading branch information
Karl Chen committed Jul 13, 2004
1 parent e9fe74d commit afd778d
Show file tree
Hide file tree
Showing 114 changed files with 845 additions and 1,355 deletions.
16 changes: 8 additions & 8 deletions api/api_app.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//

// test program for MFILE class

#include <stdlib.h>
#include <cstdlib>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
Expand Down
21 changes: 10 additions & 11 deletions api/api_test.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,29 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//

#include <stdio.h>

#include <stdlib.h>
#include <cstdio>
#include <cstdlib>

#include "boinc_api.h"

int get_run_info(double& time, unsigned long int& counter);
void run_api_test(char* args);
int print_results(double time1, double time2,
int print_results(double time1, double time2,
unsigned long int counter1, unsigned long int counter2
);
int initialize_api();
Expand Down
4 changes: 1 addition & 3 deletions api/boinc_api.C
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <csignal>
#include "config.h"
using namespace std;
#endif
Expand Down
3 changes: 0 additions & 3 deletions api/boinc_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#ifndef _BOINC_API_
#define _BOINC_API_

// NOTE: this is required on windows as well as unix, do not add "#ifndef
// _WIN32" -- if something is not working on a particular version of MSVC
// let's find a working solution
#include <string>

#include "app_ipc.h"
Expand Down
38 changes: 19 additions & 19 deletions api/graphics_api.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//

Expand All @@ -28,13 +28,13 @@ extern DWORD WINAPI win_graphics_event_loop( LPVOID duff );
HANDLE graphics_threadh=NULL;
#endif

#ifndef _WIN32
#ifdef __APPLE_CC__
#include "mac_app_opengl.h"
#endif
#ndif

#include <string.h>
#include <stdarg.h>
#ifndef _WIN32
#include <cstring>
#include <cstdarg>

#ifdef HAVE_PTHREAD
#include <pthread.h>
Expand Down Expand Up @@ -119,20 +119,20 @@ int boinc_init_graphics() {
OSErr theErr = noErr;
ThreadID graphicsThreadID = 0;
ThreadEntryUPP entry_proc;

entry_proc = NewThreadEntryUPP( mac_graphics_event_loop );

// Create the thread in a suspended state
theErr = NewThread ( kCooperativeThread, entry_proc,
(void *)(&gi), 0, kNewSuspend | kCreateIfNeeded, NULL, &graphicsThreadID
);
if (theErr != noErr) return ERR_THREAD;

// In theory we could do customized scheduling or install thread disposal routines here

// Put the graphics event loop into the ready state
SetThreadState(graphicsThreadID, kReadyThreadState, kNoThreadID);

YieldToAnyThread();
#endif

Expand All @@ -145,7 +145,7 @@ int boinc_init_graphics() {
if (retval) return ERR_THREAD;
pthread_attr_destroy( &graphics_thread_attr );
#endif

graphics_inited = true;

return 0;
Expand All @@ -160,7 +160,7 @@ int boinc_finish_graphics() {
}
}
#endif

return 0;
}

Expand Down Expand Up @@ -215,4 +215,4 @@ bool throttled_app_render(int x, int y, double t) {
return true;
}
return false;
}
}
42 changes: 7 additions & 35 deletions api/gutil.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,19 @@
#include "jpeglib.h"
#include "bmplib.h"
#include "tgalib.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <glut.h>
#endif

#ifndef _WIN32
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <setjmp.h>

#ifdef HAVE_GL_H
#include "gl.h"
#elif defined(HAVE_GL_GL_H)
#include <GL/gl.h>
#elif defined(HAVE_OPENGL_GL_H)
#include <OpenGL/gl.h>
#else
#endif

#ifdef HAVE_GLU_H
#include "glu.h"
#elif defined(HAVE_GL_GLU_H)
#include <GL/glu.h>
#elif defined(HAVE_OPENGL_GLU_H)
#include <OpenGL/glu.h>
#endif

#ifdef HAVE_GLUT_H
#include "glut.h"
#elif defined(HAVE_GL_GLUT_H)
#include <GL/glut.h>
#elif defined(HAVE_OPENGL_GLUT_H)
#include <OpenGL/glut.h>
#elif defined(HAVE_GLUT_GLUT_H)
#include <GLUT/glut.h>
#endif
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <csetjmp>
#include <jpeglib.h>
#endif

#include "boinc_gl.h"

#include "gutil.h"
#include "filesys.h"
#include "util.h"
Expand Down
51 changes: 25 additions & 26 deletions api/mac_app_opengl.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,26 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//

#include "mac_app_opengl.h"
#include "mac_carbon_gl.h"

#ifdef __APPLE_CC__
#include <OpenGL/gl.h>
#else
#include <gl.h>

#include <Devices.h>
#include <Dialogs.h>
#include <DriverServices.h>
Expand All @@ -37,8 +34,10 @@
#include <Windows.h>
#endif

#include <stdio.h>
#include <string.h>
#include "boinc_gl.h"

#include <cstdio>
#include <cstring>

// project includes ---------------------------------------------------------

Expand Down Expand Up @@ -76,14 +75,14 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
TimerUPP boincYieldUPP;
EventLoopTimerRef boincYieldTimer;
short i,fNum;

InitCursor();

SetRect( &winRect, 100, 100, 100+xsize, 100+ysize );

err = CreateNewWindow ( kDocumentWindowClass, kWindowStandardDocumentAttributes, &winRect, &appGLWindow );
if (err != noErr) return -1;

// Application-level event handler installer
appCommandProcessor = NewEventHandlerUPP(MainAppEventHandler);
err = InstallApplicationEventHandler(appCommandProcessor, GetEventTypeCount(appEventList),
Expand All @@ -107,15 +106,15 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
err = InstallEventLoopTimer(GetMainEventLoop(), 0,
kEventDurationMillisecond*refresh_period*1000,
boincYieldUPP, NULL, &boincYieldTimer);

// TODO: add an event handler for the window
ChangeWindowAttributes( appGLWindow, kWindowStandardHandlerAttribute, 0 );
SetWTitle (appGLWindow, "\pWindow");
ShowWindow(appGLWindow);
SetPortWindowPort (appGLWindow);

glInfo.fmt = 0; // output pixel format

i = 0;
glInfo.aglAttributes [i++] = AGL_RGBA;
glInfo.aglAttributes [i++] = AGL_DOUBLEBUFFER;
Expand All @@ -124,13 +123,13 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
glInfo.aglAttributes [i++] = AGL_DEPTH_SIZE;
glInfo.aglAttributes [i++] = 16;
glInfo.aglAttributes [i++] = AGL_NONE;

BuildGLonWindow (appGLWindow, &boincAGLContext, &glInfo);
if (!boincAGLContext) {
DestroyGLFromWindow (&boincAGLContext, &glInfo);
} else {
Rect rectPort;

GetWindowPortBounds (appGLWindow, &rectPort);
aglSetCurrentContext (boincAGLContext);
aglReportError ();
Expand All @@ -141,24 +140,24 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
aglReportError ();
ReSizeGLScene( rectPort.right - rectPort.left, rectPort.bottom - rectPort.top );
glReportError ();

InitGL();
app_init_gl();

glClear (GL_COLOR_BUFFER_BIT);
glReportError ();
aglSwapBuffers (boincAGLContext);
aglReportError ();

GetFNum("\pTimes New Roman", &fNum); // build font
main_font = BuildFontGL (boincAGLContext, fNum, normal, 9);

aglUpdateContext (boincAGLContext);
aglReportError ();

using_opengl = true;
}

return 0;
}

Expand Down Expand Up @@ -252,10 +251,10 @@ pascal OSStatus MainAppEventHandler(EventHandlerCallRef appHandler, EventRef the

pascal void *mac_graphics_event_loop ( void *data ) {
GRAPHICS_INFO *gi = (GRAPHICS_INFO *)data;

InitGLWindow(gi->xsize, gi->ysize, 16, gi->refresh_period);
RunApplicationEventLoop();

return NULL;
}

Expand Down
Loading

0 comments on commit afd778d

Please sign in to comment.