First Checked In.
This commit is contained in:
Родитель
11eedec678
Коммит
0fbd501a4b
|
@ -0,0 +1,170 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Mac implementation of the timer interface */
|
||||
#include "nsITimer.h"
|
||||
#include "nsITimerCallback.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prlog.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Implementation of timers using Xt timer facility
|
||||
*/
|
||||
class TimerImpl : public nsITimer {
|
||||
public:
|
||||
|
||||
public:
|
||||
TimerImpl();
|
||||
virtual ~TimerImpl();
|
||||
|
||||
virtual nsresult Init(nsTimerCallbackFunc aFunc,
|
||||
void *aClosure,
|
||||
// PRBool aRepeat,
|
||||
PRUint32 aDelay);
|
||||
|
||||
virtual nsresult Init(nsITimerCallback *aCallback,
|
||||
// PRBool aRepeat,
|
||||
PRUint32 aDelay);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual void Cancel();
|
||||
virtual PRUint32 GetDelay() { return mDelay; }
|
||||
virtual void SetDelay(PRUint32 aDelay) { mDelay=aDelay; };
|
||||
|
||||
void FireTimeout();
|
||||
|
||||
private:
|
||||
nsresult Init(PRUint32 aDelay);
|
||||
|
||||
PRUint32 mDelay;
|
||||
nsTimerCallbackFunc mFunc;
|
||||
void *mClosure;
|
||||
nsITimerCallback *mCallback;
|
||||
// PRBool mRepeat;
|
||||
TimerImpl *mNext;
|
||||
XtIntervalId mTimerId;
|
||||
};
|
||||
|
||||
void TimerImpl::FireTimeout()
|
||||
{
|
||||
if (mFunc != NULL) {
|
||||
(*mFunc)(this, mClosure);
|
||||
}
|
||||
else if (mCallback != NULL) {
|
||||
mCallback->Notify(this); // Fire the timer
|
||||
}
|
||||
|
||||
// Always repeating here
|
||||
|
||||
// if (mRepeat)
|
||||
// mTimerId = XtAppAddTimeOut(gAppContext, GetDelay(),(XtTimerCallbackProc)nsTimerExpired, this);
|
||||
}
|
||||
|
||||
|
||||
TimerImpl::TimerImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mFunc = NULL;
|
||||
mCallback = NULL;
|
||||
mNext = NULL;
|
||||
mTimerId = 0;
|
||||
mDelay = 0;
|
||||
}
|
||||
|
||||
TimerImpl::~TimerImpl()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
TimerImpl::Init(nsTimerCallbackFunc aFunc,
|
||||
void *aClosure,
|
||||
// PRBool aRepeat,
|
||||
PRUint32 aDelay)
|
||||
{
|
||||
mFunc = aFunc;
|
||||
mClosure = aClosure;
|
||||
// mRepeat = aRepeat;
|
||||
|
||||
mTimerId = XtAppAddTimeOut(gAppContext, aDelay,(XtTimerCallbackProc)nsTimerExpired, this);
|
||||
|
||||
return Init(aDelay);
|
||||
}
|
||||
|
||||
nsresult
|
||||
TimerImpl::Init(nsITimerCallback *aCallback,
|
||||
// PRBool aRepeat,
|
||||
PRUint32 aDelay)
|
||||
{
|
||||
mCallback = aCallback;
|
||||
// mRepeat = aRepeat;
|
||||
|
||||
mTimerId = XtAppAddTimeOut(gAppContext, aDelay, (XtTimerCallbackProc)nsTimerExpired, this);
|
||||
|
||||
return Init(aDelay);
|
||||
}
|
||||
|
||||
nsresult
|
||||
TimerImpl::Init(PRUint32 aDelay)
|
||||
{
|
||||
mDelay = aDelay;
|
||||
NS_ADDREF(this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(TimerImpl, kITimerIID)
|
||||
|
||||
|
||||
void
|
||||
TimerImpl::Cancel()
|
||||
{
|
||||
XtRemoveTimeOut(mTimerId);
|
||||
}
|
||||
|
||||
NS_BASE nsresult NS_NewTimer(nsITimer** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
TimerImpl *timer = new TimerImpl();
|
||||
if (nsnull == timer) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return timer->QueryInterface(kITimerIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
void nsTimerExpired(XtPointer aCallData)
|
||||
{
|
||||
TimerImpl* timer = (TimerImpl *)aCallData;
|
||||
timer->FireTimeout();
|
||||
}
|
||||
#else
|
||||
NS_BASE nsresult NS_NewTimer(nsITimer** aInstancePtrResult)
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,57 @@
|
|||
#include "fe_proto.h"
|
||||
#include "xp_file.h"
|
||||
#include "prlog.h"
|
||||
|
||||
/* Netlib utility routine, should be ripped out */
|
||||
void FE_FileType(char * path, Bool * useDefault, char ** fileType, char ** encoding)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// XP_File routines, stubbed for now
|
||||
|
||||
char * WH_FileName (const char *name, XP_FileType type)
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
void XP_CloseDir( XP_Dir dir )
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
XP_File XP_FileOpen( const char* name, XP_FileType type,
|
||||
const XP_FilePerm permissions )
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
char * XP_FileReadLine(char * dest, int32 bufferSize, XP_File file)
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
int XP_FileRemove( const char* name, XP_FileType type )
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
XP_Dir XP_OpenDir( const char* name, XP_FileType type )
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
XP_DirEntryStruct * XP_ReadDir(XP_Dir dir)
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
int XP_Stat( const char* name, XP_StatStruct * outStat, XP_FileType type )
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
#include "mcom_db.h"
|
||||
DB * dbopen(const char *fname, int flags,int mode, DBTYPE type, const void *openinfo)
|
||||
{
|
||||
PR_ASSERT(FALSE);
|
||||
}
|
Загрузка…
Ссылка в новой задаче