*** empty log message ***

svn path=/trunk/boinc/; revision=5924
This commit is contained in:
Charlie Fenton 2005-04-23 15:14:52 +00:00
parent 4520ff8b65
commit 36c243b736
8 changed files with 1053 additions and 71 deletions

View File

@ -27590,3 +27590,22 @@ Rom 22 April 2005
clientgui/
MainFrame.cpp
Charlie 23 April 2005
Mac: Rename "BOINC.app" to "BoincManager.app", rename "boinc_client"
to "boinc".
Create screen saver, add it to BOINC XCode project.
clientgui/
BOINCGUIApp.cpp
mac/
mac_saver_module.cpp (new)
mac_saver_module.tiff (new)
Mac_Saver_ModuleView.h (new)
Mac_Saver_ModuleView.m (new)
BOINCSaver.nib (new)
mac_build/
Info.plist
ScreenSaver-Info.plist (new)
boinc.pbproj/
project.pbxproj

View File

@ -365,7 +365,7 @@ void CBOINCGUIApp::StartupBOINCCore() {
if (err == noErr) {
strExecute = wxT("\"");
strExecute += wxT(buf);
strExecute += wxT("/Contents/Resources/boinc_client\" -redirectio");
strExecute += wxT("/Contents/Resources/boinc\" -redirectio");
} else {
buf[0] = '\0';
}

View File

@ -0,0 +1,52 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2005 University of California
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation;
// either version 2.1 of the License, or (at your option) any later version.
//
// This software 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 Lesser General Public License for more details.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Mac_Saver_ModuleView.h
// BOINC_Saver_Module
//
#import <ScreenSaver/ScreenSaver.h>
@interface BOINC_Saver_ModuleView : ScreenSaverView
{
NSQuickDrawView * mainQDView;
NSQuickDrawView * previewQDView;
NSString *mBundleID; // our bundle ID
IBOutlet id mConfigureSheet; // our configuration sheet
IBOutlet NSButton *mGoToBlankCheckbox;
IBOutlet NSTextField *mBlankingTimeTextField;
int mVersion; // the version of our prefs
NSString *mBlankingTimeString;
}
- (IBAction)closeSheetSave:(id) sender;
- (IBAction)closeSheetCancel:(id) sender;
@end
void setFrame(Rect *frame);
int initBOINCSaver(Boolean ispreview);
int drawGraphics(GrafPtr aPort);
void drawPreview(GrafPtr aPort);
void closeBOINCSaver(void);
void displayText(const unsigned char *s, GrafPtr aPort);
extern void print_to_log_file(const char *format, ...);

View File

@ -0,0 +1,213 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2005 University of California
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation;
// either version 2.1 of the License, or (at your option) any later version.
//
// This software 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 Lesser General Public License for more details.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Mac_Saver_ModuleView.m
// BOINC_Saver_Module
//
#import "Mac_Saver_ModuleView.h"
int gGoToBlank; // True if we are to blank the screen
int gBlankingTime; // Delay in minutes before blanking the screen
@implementation BOINC_Saver_ModuleView
- (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview {
NSQuickDrawView * myQDView;
self = [ super initWithFrame:frame isPreview:isPreview ];
if (self) {
// grab the screensaver defaults
mBundleID = [[ NSBundle bundleForClass:[self class]] bundleIdentifier ];
ScreenSaverDefaults *defaults = [ ScreenSaverDefaults defaultsForModuleWithName:mBundleID ];
// try to load the version key, used to see if we have any saved settings
mVersion = [defaults floatForKey:@"version"];
if (!mVersion) {
// no previous settings so define our defaults
mVersion = 1;
gGoToBlank = NO;
gBlankingTime = 1;
// write out the defaults
[ defaults setInteger:mVersion forKey:@"version" ];
[ defaults setInteger:gGoToBlank forKey:@"GoToBlank" ];
[ defaults setInteger:gBlankingTime forKey:@"BlankingTime" ];
// synchronize
[defaults synchronize];
}
// set defaults...
gGoToBlank = [ defaults integerForKey:@"GoToBlank" ];
gBlankingTime = [ defaults integerForKey:@"BlankingTime" ];
myQDView = [[ NSQuickDrawView alloc ] initWithFrame:frame ];
if (!myQDView) {
[ self autorelease ];
return nil;
}
[ self setAutoresizesSubviews:YES ]; // make sure the subview resizes.
[ self addSubview:myQDView ];
[ myQDView release ];
if (isPreview)
previewQDView = myQDView;
else
mainQDView = myQDView;
[ self setAnimationTimeInterval:1/8.0 ];
}
return self;
}
- (void)startAnimation {
int newFrequency;
[ super startAnimation ];
if ( [ self isPreview ] )
return;
newFrequency = initBOINCSaver([ self isPreview ]);
if (newFrequency)
[ self setAnimationTimeInterval:1.0/newFrequency ];
}
- (void)stopAnimation {
[ super stopAnimation ];
if ( [ self isPreview ] )
return;
closeBOINCSaver();
}
- (void)drawRect:(NSRect)rect {
NSView* myView = nil;
NSWindow* myWindow = nil;
[ super drawRect:rect ];
// Set our blanking window slightly below screen saver window level
// so that our application's graphics can draw over it.
if (! [ self isPreview ] ) {
myView = [ NSView focusView ];
if (myView)
myWindow = [ myView window ];
if (myWindow)
[ myWindow setLevel:kCGStatusWindowLevel ];
}
// optionally draw here
}
- (void)animateOneFrame {
int newFrequency;
NSRect theFrame = [ self frame ];
Point p = { 0, 0 };
if ([ self isPreview ]) {
#if 1 // Currently drawRect just draws our logo in the preview window
NSString *fileName = [[ NSBundle bundleForClass:[ self class ]] pathForImageResource:@"boinc" ];
if (fileName) {
NSImage *myImage = [[ NSImage alloc ] initWithContentsOfFile:fileName ];
[ myImage setScalesWhenResized:YES ];
[ myImage setSize:theFrame.size ];
[ myImage compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver ];
[ myImage release ];
}
[ self setAnimationTimeInterval:1/1.0 ];
#else // Code for possible future use if we want to draw more in preview
[ previewQDView lockFocus ];
drawPreview([ previewQDView qdPort ]);
[ previewQDView unlockFocus ];
QDFlushPortBuffer([ previewQDView qdPort ], nil);
[ self setAnimationTimeInterval:1/30.0 ];
#endif
return;
}
[ mainQDView lockFocus ];
LocalToGlobal(&p);
if ((p.h != 0) || (p.v != 0)) {
[ mainQDView unlockFocus ];
// Hide window on second display to aid in debugging
// [[[ NSView focusView] window ] setLevel:kCGMinimumWindowLevel ];
return; // We draw only to main screen
}
newFrequency = drawGraphics([ mainQDView qdPort ]);
[ mainQDView unlockFocus ];
QDFlushPortBuffer([ mainQDView qdPort ], nil);
if (newFrequency)
[ self setAnimationTimeInterval:(1.0/newFrequency) ];
}
- (BOOL)hasConfigureSheet {
return YES;
}
// Display the configuration sheet for the user to choose their settings
- (NSWindow*)configureSheet
{
// if we haven't loaded our configure sheet, load the nib named MyScreenSaver.nib
if (!mConfigureSheet)
[ NSBundle loadNibNamed:@"BOINCSaver" owner:self ];
// set the UI state
[ mGoToBlankCheckbox setState:gGoToBlank ];
mBlankingTimeString = [[ NSString alloc ] initWithFormat:@"%d", gBlankingTime ];
[ mBlankingTimeTextField setStringValue:mBlankingTimeString ];
return mConfigureSheet;
}
// Called when the user clicked the SAVE button
- (IBAction) closeSheetSave:(id) sender
{
// get the defaults
ScreenSaverDefaults *defaults = [ ScreenSaverDefaults defaultsForModuleWithName:mBundleID ];
// save the UI state
gGoToBlank = [ mGoToBlankCheckbox state ];
mBlankingTimeString = [ mBlankingTimeTextField stringValue ];
gBlankingTime = [ mBlankingTimeString intValue ];
// write the defaults
[ defaults setInteger:gGoToBlank forKey:@"GoToBlank" ];
[ defaults setInteger:gBlankingTime forKey:@"BlankingTime" ];
// synchronize
[ defaults synchronize ];
// end the sheet
[ NSApp endSheet:mConfigureSheet ];
}
// Called when the user clicked the CANCEL button
- (IBAction) closeSheetCancel:(id) sender
{
// nothing to configure
[ NSApp endSheet:mConfigureSheet ];
}
@end

View File

@ -0,0 +1,573 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2005 University of California
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation;
// either version 2.1 of the License, or (at your option) any later version.
//
// This software 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 Lesser General Public License for more details.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// mac_saver_module.cpp
// BOINC_Saver_Module
//
#include <Carbon/Carbon.h>
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
#include <limits.h>
#include <sys/stat.h>
#include "gui_rpc_client.h"
//#include <drivers/event_status_driver.h>
#ifdef __cplusplus
extern "C" {
#endif
void setFrame(Rect *frame);
int initBOINCSaver(Boolean ispreview);
OSStatus initBOINCApp(void);
int drawGraphics(GrafPtr aPort);
void drawPreview(GrafPtr aPort);
void closeBOINCSaver(void);
void setBannerText(ConstStringPtr msg, GrafPtr aPort);
void drawBanner(GrafPtr aPort);
void FlashIcon(void);
OSErr FindBOINCApplication(FSSpecPtr applicationFSSpecPtr);
pid_t FindProcessPID(char* name, pid_t thePID);
OSErr GetpathToBOINCManagerApp(char* path, int maxLen);
OSStatus RPCThread(void* param);
#ifdef __cplusplus
} // extern "C"
#endif
#define CREATE_LOG 1
#ifdef __cplusplus
extern "C" {
#endif
void print_to_log_file(const char *format, ...);
#ifdef __cplusplus
}
void strip_cr(char *buf);
#endif
#define BANNER_GAP 30 /* Space between repeats of banner text */
enum SaverState {
SaverState_Idle,
SaverState_LaunchingCoreClient,
SaverState_CoreClientRunning,
SaverState_CoreClientSetToSaverMode,
SaverState_CantLaunchCoreClient,
SaverState_UnrecoverableError
};
extern int gGoToBlank; // True if we are to blank the screen
extern int gBlankingTime; // Delay in minutes before blanking the screen
static Boolean wasAlreadyRunning;
static pid_t CoreClientPID = nil;
static Str255 bannerText;
static int bannerWidth;
static SaverState saverState = SaverState_Idle;
static StringPtr CurrentBannerMessage = 0;
static DISPLAY_INFO di; // Contains all NULLs for the Macintosh
static RPC_CLIENT *rpc;
MPQueueID gTerminationQueue; // This queue will report the completion of our threads
MPTaskID gRPC_thread_id; // IDs of the thread we create
int gClientSaverStatus = 0; // status returned by get_screensaver_mode RPC
Boolean gQuitRPCThread = false; // Flag to tell RPC thread to exit gracefully
const ConstStringPtr CantLaunchCCMsg = "\pUnable to launch BOINC application.";
const ConstStringPtr LaunchingCCMsg = "\pLaunching BOINC application.";
const ConstStringPtr BOINCSuspendedMsg = "\pBOINC is currently suspended.";
const ConstStringPtr BOINCNoAppsExecutingMsg = "\pBOINC is currently idle.";
const ConstStringPtr BOINCNoProjectsDetectedMsg = "\pBOINC is not attached to any projects. Please attach to projects using the BOINC Manager.";
const ConstStringPtr BOINCNoGraphicAppsExecutingMsg = "\pBOINC is currently not executing any applications with graphics";
const ConstStringPtr BOINCUnrecoverableErrorMsg = "\pSorry, an unrecoverable error occurred";
// Returns desired Animation Frequency (per second) or 0 for no change
int initBOINCSaver(Boolean ispreview) {
int newFrequency = 15;
OSStatus err;
if (ispreview)
return 8;
setBannerText(0, NULL);
if (ispreview)
return 0;
// If there are multiple displays, initBOINCSaver may get called
// multiple times (once for each display), so we need to guard
// against launching multiple instances of the core client
if (saverState == SaverState_Idle) {
err = initBOINCApp();
if (saverState == SaverState_LaunchingCoreClient)
{
gClientSaverStatus = 0;
gQuitRPCThread = false;
if (rpc == NULL)
rpc = new RPC_CLIENT;
newFrequency = 4;
}
}
return newFrequency;
}
OSStatus initBOINCApp() {
char boincPath[2048], buf[256];
pid_t myPid;
int status;
OSStatus err;
saverState = SaverState_CantLaunchCoreClient;
CoreClientPID = FindProcessPID("boinc", 0);
if (CoreClientPID) {
wasAlreadyRunning = true;
saverState = SaverState_LaunchingCoreClient;
return noErr;
}
err = GetpathToBOINCManagerApp(boincPath, sizeof(boincPath));
if (err) // If we couldn't find BOINCManager.app, try default path
strcpy(boincPath, "/Applications/BOINCManager.app"); //
strcat(boincPath, "/Contents/Resources/boinc");
if ( (myPid = fork()) < 0)
return -1;
else if (myPid == 0) // child
{
strcpy(buf, getenv("HOME"));
strcat(buf, "/Library/Application Support/BOINC Data");
status = chdir(buf);
if (status) {
perror("chdir");
_exit(status);
}
status = execl(boincPath, " -redirectio", (char *) 0);
_exit(127); // execl error (execl should never return)
} else {
CoreClientPID = myPid; // make this available globally
saverState = SaverState_LaunchingCoreClient;
}
return noErr;
}
// Returns new desired Animation Frequency (per second) or 0 for no change
int drawGraphics(GrafPtr aPort) {
CGrafPtr savePort;
GDHandle saveGDH;
int newFrequency = 15;
pid_t myPid;
OSStatus err;
ObscureCursor();
switch (saverState) {
case SaverState_LaunchingCoreClient:
setBannerText(LaunchingCCMsg, aPort);
myPid = FindProcessPID(NULL, CoreClientPID);
if (myPid) {
saverState = SaverState_CoreClientRunning;
rpc->init(NULL); // Initialize communications with Core Client
// Set up a separate thread for communicating with Core Client
if (!MPLibraryIsLoaded()) {
saverState = SaverState_UnrecoverableError;
break;
}
if (gTerminationQueue == NULL) {
err = MPCreateQueue(&gTerminationQueue); /* Create the queue which will report the completion of the task. */
if (err) {
saverState = SaverState_UnrecoverableError;
break;
}
}
err = MPCreateTask(RPCThread, /* This is the task function. */
0, /* This is the parameter to the task function. */
(50*1024), /* Stack size for thread. */
gTerminationQueue, /* We'll use this to sense task completion. */
0, /* We won't use the first part of the termination message. */
0, /* We won't use the second part of the termination message. */
0, /* Use the normal task options. (Currently this *must* be zero!) */
&gRPC_thread_id); /* Here's where the ID of the new task will go. */
if (err) {
MPDeleteQueue(gTerminationQueue);
saverState = SaverState_UnrecoverableError;
break;
}
}
// ToDo: Add a timeout after which we display error message
break;
case SaverState_CoreClientRunning:
// set_screensaver_mode RPC called in RPCThread()
break;
case SaverState_CoreClientSetToSaverMode:
switch (gClientSaverStatus) {
case 0:
break; // No status response yet from get_screensaver_mode RPC
case SS_STATUS_ENABLED:
default:
setBannerText(0, aPort); // No text message
// Let the science app draw over our window
break;
case SS_STATUS_BLANKED:
setBannerText(0, aPort); // No text message
break;
case SS_STATUS_BOINCSUSPENDED:
setBannerText(BOINCSuspendedMsg, aPort);
break;
case SS_STATUS_NOAPPSEXECUTING:
setBannerText(BOINCNoAppsExecutingMsg, aPort);
break;
case SS_STATUS_NOPROJECTSDETECTED:
setBannerText(BOINCNoProjectsDetectedMsg, aPort);
break;
case SS_STATUS_NOGRAPHICSAPPSEXECUTING:
setBannerText(BOINCNoGraphicAppsExecutingMsg, aPort);
break;
case SS_STATUS_QUIT:
// Handled in RPCThread()
break;
} // end switch (gClientSaverStatus)
break;
case SaverState_UnrecoverableError:
setBannerText(BOINCUnrecoverableErrorMsg, aPort);
break;
case SaverState_CantLaunchCoreClient:
setBannerText(CantLaunchCCMsg, aPort);
break;
case SaverState_Idle:
break; // Should never get here; fixes compiler warning
} // end switch (saverState)
if (bannerText[0]) {
GetGWorld(&savePort, &saveGDH);
SetPort(aPort);
drawBanner(aPort);
SetGWorld(savePort, saveGDH);
newFrequency = 45;
} else
newFrequency = 4;
return newFrequency;
}
void drawPreview(GrafPtr aPort) {
SetPort(aPort);
setBannerText("\p BOINC", aPort);
drawBanner(aPort);
}
// If there are multiple displays, closeBOINCSaver may get called
// multiple times (once for each display), so we need to guard
// against any problems that may cause.
void closeBOINCSaver() {
gQuitRPCThread = true; // Tell RPC Thread to exit
if (gTerminationQueue) { // Wait up to 10 seconds for RPC thread to exit
MPWaitOnQueue(gTerminationQueue, NULL, NULL, NULL, kDurationMillisecond*10000);
MPDeleteQueue(gTerminationQueue);
gTerminationQueue = NULL;
}
if (rpc)
{
rpc->set_screensaver_mode(false, 0, di);
delete rpc;
}
rpc = NULL;
setBannerText(0, NULL);
// Kill core client if we launched it
if (!wasAlreadyRunning)
if (CoreClientPID)
{
kill(CoreClientPID, SIGTERM);
}
CoreClientPID = NULL;
wasAlreadyRunning = false;
gQuitRPCThread = false;
saverState = SaverState_Idle;
}
OSStatus RPCThread(void* param) {
int val = 0;
// CC_STATE state;
AbsoluteTime timeToUnblock;
long time_to_blank;
while (true) {
if (gQuitRPCThread) // If main thread has requested we exit
MPExit(noErr); // Exit the thread
timeToUnblock = AddDurationToAbsolute(durationSecond/4, UpTime());
MPDelayUntil(&timeToUnblock);
// Calculate the estimated blank time by adding the current time
// and and the user specified time which is in minutes
if (gGoToBlank)
time_to_blank = time(0) + (gBlankingTime * 60);
else
time_to_blank = 0;
val = rpc->set_screensaver_mode(true, time_to_blank, di);
if (val == noErr)
break;
// Attempt to reinitialize the RPC client and state
rpc->close();
rpc->init(NULL);
// Error message after timeout?
}
saverState = SaverState_CoreClientSetToSaverMode;
while (true) {
if (gQuitRPCThread) // If main thread has requested we exit
{
MPExit(noErr); // Exit the thread
}
timeToUnblock = AddDurationToAbsolute(durationSecond/4, UpTime());
MPDelayUntil(&timeToUnblock);
#if 0
val = rpc->get_state(state);
if (val) {
}
#endif
val = rpc->get_screensaver_mode(gClientSaverStatus);
if (val) {
// Attempt to reinitialize the RPC client and state
rpc->close();
rpc->init(NULL);
// Error message after timeout?
}
if (gClientSaverStatus == SS_STATUS_QUIT) {
rpc->set_screensaver_mode(false, 0, di);
MPExit(noErr); // Exit the thread
}
}
}
void setBannerText(ConstStringPtr msg, GrafPtr aPort) {
CGrafPtr savePort;
RGBColor saveBackColor;
Rect wRect;
if ((ConstStringPtr)CurrentBannerMessage == msg)
return;
CurrentBannerMessage = (StringPtr)msg;
if (msg == 0) {
bannerText[0] = 0;
if (aPort != NULL)
drawBanner(aPort);
return;
}
GetPort(&savePort);
SetPort(aPort);
GetPortBounds(aPort, &wRect);
GetBackColor(&saveBackColor);
BackColor ( blackColor );
EraseRect(&wRect);
RGBBackColor(&saveBackColor);
BlockMove(msg, bannerText, msg[0]+1);
TextSize(24);
TextFace(bold);
bannerWidth = StringWidth(bannerText) + BANNER_GAP;
SetPort(savePort);
}
void drawBanner(GrafPtr aPort) {
CGrafPtr savePort;
GDHandle saveGDH;
RGBColor saveForeColor, saveBackColor;
short x, y;
Rect wRect;
FontInfo fInfo;
static short bannerPos;
GetGWorld(&savePort, &saveGDH);
SetPort(aPort);
GetForeColor(&saveForeColor);
GetBackColor(&saveBackColor);
ForeColor(whiteColor);
BackColor(blackColor);
GetPortBounds(aPort, &wRect);
if ( (bannerPos + bannerWidth) < wRect.left)
bannerPos = wRect.left;
else
bannerPos -= 1;
x = bannerPos;
y = (wRect.bottom - wRect.top) / 3 + wRect.top;
GetFontInfo(&fInfo);
wRect.top = y - fInfo.ascent;
wRect.bottom = y + fInfo.descent;
EraseRect(&wRect);
do {
MoveTo(x, y);
DrawString(bannerText);
x+= bannerWidth;
} while (x < wRect.right);
RGBForeColor(&saveForeColor);
RGBBackColor(&saveBackColor);
SetGWorld(savePort, saveGDH);
}
pid_t FindProcessPID(char* name, pid_t thePID)
{
FILE *f;
char buf[1024];
size_t n;
pid_t aPID;
if (name != NULL) // Search ny name
n = strlen(name);
f = popen("ps -a -x -c -o command,pid", "r");
if (f == NULL)
return 0;
while (fgets(buf, sizeof(buf), f))
{
if (name != NULL) { // Search ny name
if (strncmp(buf, name, n) == 0)
{
aPID = atol(buf+16);
pclose(f);
return aPID;
}
} else { // Search by PID
aPID = atol(buf+16);
if (aPID == thePID) {
pclose(f);
return aPID;
}
}
}
pclose(f);
return 0;
}
OSErr GetpathToBOINCManagerApp(char* path, int maxLen)
{
CFStringRef bundleID = CFSTR("edu.berkeley.boinc");
OSType creator = 'BNC!';
FSRef theFSRef;
OSStatus status = noErr;
status = LSFindApplicationForInfo(creator, bundleID, NULL, &theFSRef, NULL);
if (status == noErr)
status = FSRefMakePath(&theFSRef, (unsigned char *)path, maxLen);
return status;
}
void print_to_log_file(const char *format, ...) {
#if CREATE_LOG
FILE *f;
va_list args;
char buf[256];
time_t t;
strcpy(buf, getenv("HOME"));
strcat(buf, "/Documents/test_log.txt");
f = fopen(buf, "a");
if (!f) return;
// freopen(buf, "a", stdout);
// freopen(buf, "a", stderr);
time(&t);
strcpy(buf, asctime(localtime(&t)));
strip_cr(buf);
fputs(buf, f);
fputs(" ", f);
va_start(args, format);
vfprintf(f, format, args);
va_end(args);
fputs("\n", f);
fclose(f);
#endif
}
#if CREATE_LOG
void strip_cr(char *buf)
{
char *theCR;
theCR = strrchr(buf, '\n');
if (theCR)
*theCR = '\0';
theCR = strrchr(buf, '\r');
if (theCR)
*theCR = '\0';
}
#endif // CREATE_LOG

View File

@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>BOINC</string>
<string>BOINCManager</string>
<key>CFBundleIconFile</key>
<string>BOINCMgr.icns</string>
<key>CFBundleIdentifier</key>
@ -17,6 +17,6 @@
<key>CFBundleSignature</key>
<string>BNC!</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>3.40</string>
</dict>
</plist>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>BOINCSaver</string>
<key>CFBundleIdentifier</key>
<string>edu.berkeley.boincsaver</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>BOINCSaver</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string>BOINC_Saver_ModuleView</string>
</dict>
</plist>

View File

@ -131,6 +131,8 @@
};
20286C2CFDCF999611CA2CEA = {
children = (
DD0C5A8A0816711400CEC5D7,
DD48091E081A66F100A174AA,
DD64E7D507D89DB800B176C8,
DDF3028907CCCE2C00701169,
F51BDF4903086C46012012A7,
@ -295,7 +297,6 @@
DD095EF407D87B1600362260,
DD095F5A07D883E500362260,
DD095F5B07D883E600362260,
DD64E7D607D89DB800B176C8,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@ -387,7 +388,7 @@
OTHER_CPLUSPLUSFLAGS = "-DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DWX_PRECOMP -DNO_GCC_PRAGMA -DNOCLIPBOARD -DwxHAS_TASK_BAR_ICON -D_THREAD_SAFE -D__WXMAC__ -include../config.h";
OTHER_LDFLAGS = "-D_THREAD_SAFE -lz -lpthread -liconv -ldl -lz -lm";
OTHER_REZFLAGS = "";
PRODUCT_NAME = BOINC;
PRODUCT_NAME = BOINCManager;
SECTORDER_FLAGS = "";
SKIP_INSTALL = NO;
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
@ -428,7 +429,7 @@
explicitFileType = wrapper.application;
includeInIndex = 0;
isa = PBXFileReference;
path = BOINC.app;
path = BOINCManager.app;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
@ -702,6 +703,59 @@
settings = {
};
};
DD0C59580816573E00CEC5D7 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.cpp.cpp;
name = mac_saver_module.cpp;
path = ../clientgui/mac/mac_saver_module.cpp;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD0C59590816573E00CEC5D7 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
name = Mac_Saver_ModuleView.h;
path = ../clientgui/mac/Mac_Saver_ModuleView.h;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD0C595A0816573E00CEC5D7 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.objc;
name = Mac_Saver_ModuleView.m;
path = ../clientgui/mac/Mac_Saver_ModuleView.m;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD0C595B0816573E00CEC5D7 = {
fileRef = DD0C59580816573E00CEC5D7;
isa = PBXBuildFile;
settings = {
};
};
DD0C595D0816573E00CEC5D7 = {
fileRef = DD0C595A0816573E00CEC5D7;
isa = PBXBuildFile;
settings = {
};
};
DD0C5A8A0816711400CEC5D7 = {
isa = PBXFileReference;
lastKnownFileType = image.tiff;
name = boinc.tiff;
path = ../clientgui/mac/boinc.tiff;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD0C5A8B0816711400CEC5D7 = {
fileRef = DD0C5A8A0816711400CEC5D7;
isa = PBXBuildFile;
settings = {
};
};
DD2D25CB07FAB41700151141 = {
fileEncoding = 30;
isa = PBXFileReference;
@ -2048,6 +2102,20 @@
target = DD40CDF807F0386A0096C645;
targetProxy = DD40D36007F03B600096C645;
};
DD48091E081A66F100A174AA = {
isa = PBXFileReference;
lastKnownFileType = wrapper.nib;
name = BOINCSaver.nib;
path = /Volumes/Moon/BOINC_Mac/boinc/clientgui/mac/BOINCSaver.nib;
refType = 0;
sourceTree = "<absolute>";
};
DD48091F081A66F100A174AA = {
fileRef = DD48091E081A66F100A174AA;
isa = PBXBuildFile;
settings = {
};
};
DD4DD0A207EAA648008A6468 = {
fileRef = DD81C40307C5D1020098A04D;
isa = PBXBuildFile;
@ -2078,6 +2146,12 @@
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD616A3008150050006981C1 = {
fileRef = F51BDF4903086C46012012A7;
isa = PBXBuildFile;
settings = {
};
};
DD64E7D507D89DB800B176C8 = {
fileEncoding = 30;
isa = PBXFileReference;
@ -2086,12 +2160,6 @@
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD64E7D607D89DB800B176C8 = {
fileRef = DD64E7D507D89DB800B176C8;
isa = PBXBuildFile;
settings = {
};
};
DD6D07B307E99881007F882B = {
fileEncoding = 30;
isa = PBXFileReference;
@ -2178,6 +2246,18 @@
settings = {
};
};
DD791FF00819063C00BE2906 = {
containerPortal = 20286C28FDCF999611CA2CEA;
isa = PBXContainerItemProxy;
proxyType = 1;
remoteGlobalIDString = DD96AFF80811075000A06F22;
remoteInfo = ScreenSaver;
};
DD791FF10819063C00BE2906 = {
isa = PBXTargetDependency;
target = DD96AFF80811075000A06F22;
targetProxy = DD791FF00819063C00BE2906;
};
DD7C5D1F08110A60002FCE1E = {
fileRef = DD40CE0807F039350096C645;
isa = PBXBuildFile;
@ -2232,56 +2312,6 @@
settings = {
};
};
DD7C5E9508110D0B002FCE1E = {
children = (
DD7C5EA008110D69002FCE1E,
DD7C5EA108110D69002FCE1E,
DD7C5EAD08110DD1002FCE1E,
);
isa = PBXGroup;
name = mac;
refType = 4;
sourceTree = "<group>";
};
DD7C5EA008110D69002FCE1E = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
name = Mac_Saver_ModuleView.h;
path = ../client/mac/Mac_Saver_ModuleView.h;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD7C5EA108110D69002FCE1E = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.objc;
name = Mac_Saver_ModuleView.m;
path = ../client/mac/Mac_Saver_ModuleView.m;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD7C5EA308110D69002FCE1E = {
fileRef = DD7C5EA108110D69002FCE1E;
isa = PBXBuildFile;
settings = {
};
};
DD7C5EAD08110DD1002FCE1E = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.cpp.cpp;
name = mac_saver_module.cpp;
path = ../client/mac/mac_saver_module.cpp;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DD7C5EAE08110DD1002FCE1E = {
fileRef = DD7C5EAD08110DD1002FCE1E;
isa = PBXBuildFile;
settings = {
};
};
DD7E49CD080F9B09002716F9 = {
fileRef = DD6D0A8507E9A61B007F882B;
isa = PBXBuildFile;
@ -2361,7 +2391,7 @@
);
isa = PBXGroup;
name = clientgui;
path = ../../boinc_public_021005/lib;
path = ../clientgui;
refType = 2;
sourceTree = SOURCE_ROOT;
};
@ -2782,6 +2812,9 @@
DD96AFF50811075000A06F22 = {
buildActionMask = 2147483647;
files = (
DD616A3008150050006981C1,
DD0C5A8B0816711400CEC5D7,
DD48091F081A66F100A174AA,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@ -2789,8 +2822,17 @@
DD96AFF60811075000A06F22 = {
buildActionMask = 2147483647;
files = (
DD7C5EA308110D69002FCE1E,
DD7C5EAE08110DD1002FCE1E,
DD0C595B0816573E00CEC5D7,
DD0C595D0816573E00CEC5D7,
DDFD5F0F0818F2EE002B23D4,
DDFD5F270818F329002B23D4,
DDFD5F280818F33C002B23D4,
DDFD5F290818F346002B23D4,
DDFD5F2A0818F34F002B23D4,
DDFD5F2B0818F359002B23D4,
DDFD5F2C0818F368002B23D4,
DDFD5F2D0818F372002B23D4,
DDFD5F2E0818F3A1002B23D4,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@ -2820,12 +2862,14 @@
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = "ScreenSaver-Info.plist";
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
OTHER_CFLAGS = "";
OTHER_CFLAGS = " -include ../config.h";
OTHER_CPLUSPLUSFLAGS = " -include ../config.h";
OTHER_LDFLAGS = "-framework Foundation -framework AppKit";
OTHER_REZFLAGS = "";
PRODUCT_NAME = BOINC.saver;
PRODUCT_NAME = BOINCSaver;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
WRAPPER_EXTENSION = saver;
};
dependencies = (
);
@ -2860,7 +2904,7 @@
explicitFileType = wrapper.cfbundle;
includeInIndex = 0;
isa = PBXFileReference;
path = BOINC.saver.bundle;
path = BOINCSaver.saver;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
@ -2990,6 +3034,7 @@
DDBD681107FA830E0082C20D,
DDBD681307FA830E0082C20D,
DDBD681507FA830E0082C20D,
DD791FF10819063C00BE2906,
DDBD681707FA830E0082C20D,
);
isa = PBXAggregateTarget;
@ -3177,7 +3222,7 @@
OTHER_CFLAGS = "-D_THREAD_SAFE -D__WXMAC -include ../config.h";
OTHER_LDFLAGS = "-framework Carbon";
OTHER_REZFLAGS = "";
PRODUCT_NAME = boinc_client;
PRODUCT_NAME = boinc;
SECTORDER_FLAGS = "";
SKIP_INSTALL = YES;
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
@ -3195,7 +3240,7 @@
explicitFileType = "compiled.mach-o.executable";
includeInIndex = 0;
isa = PBXFileReference;
path = boinc_client;
path = boinc;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
@ -3756,6 +3801,60 @@
refType = 2;
sourceTree = SOURCE_ROOT;
};
DDFD5F0F0818F2EE002B23D4 = {
fileRef = DD81C5CC07C5D7D90098A04D;
isa = PBXBuildFile;
settings = {
};
};
DDFD5F270818F329002B23D4 = {
fileRef = F5EAD475031AEFF8018E201A;
isa = PBXBuildFile;
settings = {
};
};
DDFD5F280818F33C002B23D4 = {
fileRef = F5159562029EB02001F5651B;
isa = PBXBuildFile;
settings = {
};
};
DDFD5F290818F346002B23D4 = {
fileRef = F5159564029EB02001F5651B;
isa = PBXBuildFile;
settings = {
};
};
DDFD5F2A0818F34F002B23D4 = {
fileRef = DD344BD207C5B1150043025C;
isa = PBXBuildFile;
settings = {
};
};
DDFD5F2B0818F359002B23D4 = {
fileRef = DD344BD507C5B1150043025C;
isa = PBXBuildFile;
settings = {
};
};
DDFD5F2C0818F368002B23D4 = {
fileRef = DD6D0A8507E9A61B007F882B;
isa = PBXBuildFile;
settings = {
};
};
DDFD5F2D0818F372002B23D4 = {
fileRef = F54B901602AC0A2201FB7237;
isa = PBXBuildFile;
settings = {
};
};
DDFD5F2E0818F3A1002B23D4 = {
fileRef = F5EAD479031AF001018E201A;
isa = PBXBuildFile;
settings = {
};
};
//DD0
//DD1
//DD2
@ -4258,7 +4357,6 @@
F54B8FD502AC0A0C01FB7237,
F54B8FD602AC0A0C01FB7237,
F54B8FD702AC0A0C01FB7237,
DD7C5E9508110D0B002FCE1E,
DD344BCE07C5B0B80043025C,
DD344BCF07C5B0B80043025C,
F54B8FDA02AC0A0C01FB7237,
@ -4584,6 +4682,9 @@
DD2F32F707F2A88B00645DDC,
DD2F32EF07F2A83E00645DDC,
DD40CDFE07F038990096C645,
DD0C59580816573E00CEC5D7,
DD0C59590816573E00CEC5D7,
DD0C595A0816573E00CEC5D7,
);
isa = PBXGroup;
name = mac;