nsresult nsSMILNullType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const { NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types"); NS_PRECONDITION(aSrc.mType == this, "Unexpected source type"); aDest.mU = aSrc.mU; aDest.mType = Singleton(); return NS_OK; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { Singleton( ); ui->setupUi(this); pSettings = CCommonFunction::GetSettings( CommonDataType::CfgSystem ); pTextCodec = CCommonFunction::GetTextCodec( ); pLocalComm = CLocalSvrCommunication::GetInstance( pTextCodec ); connect( pLocalComm, SIGNAL( NotifyMsg( QString ) ), this, SLOT( DisplayMessage( QString ) ) ); pLocalComm->StartupServer( ); g_pLocalCltComm = new CLocalCltCommunication( pTextCodec, this ); g_pLocalCltComm->Connect2Server( ); CNetProcessData::GetCommonParams( ); netServer = CSvrThread::GetInstance( this ); connect( netServer, SIGNAL( Notify( QString ) ), this, SLOT(DisplayMessage( QString ) ) ); netServer->start( ); netServer->StartupUdpServer( true ); netServer->StartupTcpServer( true ); qRegisterMetaType< QAbstractSocket::SocketError >( "QAbstractSocket::SocketError" ); sysTrayIcon = NULL; NotifyIcon( ); Qt::WindowFlags flags = windowFlags( ); flags &= ( ~Qt::WindowMinimizeButtonHint ); setWindowFlags( flags ); //setWindowState( Qt::WindowMinimized ); //close( ); }
#include "Cello/Type.h" #include "Cello/Bool.h" #include "Cello/None.h" #include "Cello/Exception.h" #include "Cello/File.h" #include "Cello/String.h" #include "Cello/Number.h" #include "Cello/Char.h" #include "Cello/Reference.h" #include <stdio.h> #include <stdlib.h> #include <string.h> var Undefined = Singleton(Undefined); /* ** The type_of a Type object is just "Type" again. ** But because "Type" is extern it isn't a constant expression. ** This means it cannot be set at compile time. ** ** So by convention at compile time the type_of a Type object is set to NULL. ** So if we access a struct and it tells us NULL is the type, assume "Type". */ var type_of(var self) { /* Test against Builtins */ if (self is Undefined) return throw(ValueError, "Received 'Undefined' as value to 'type_of'"); if (self is True) return Bool;
#include "Cello/Exception.h" #include "Cello/Type.h" #include "Cello/None.h" #include "Cello/File.h" #include "Cello/String.h" #include "Cello/Number.h" #include "Cello/Thread.h" #include <signal.h> var TypeError = Singleton(TypeError); var ValueError = Singleton(ValueError); var ClassError = Singleton(ClassError); var IndexOutOfBoundsError = Singleton(IndexOutOfBoundsError); var KeyError = Singleton(KeyError); var OutOfMemoryError = Singleton(OutOfMemoryError); var IOError = Singleton(IOError); var FormatError = Singleton(FormatError); var BusyError = Singleton(BusyError); var ResourceError = Singleton(ResourceError); var ProgramAbortedError = Singleton(ProgramAbortedError); var DivisionByZeroError = Singleton(DivisionByZeroError); var IllegalInstructionError = Singleton(IllegalInstructionError); var ProgramInterruptedError = Singleton(ProgramInterruptedError); var SegmentationError = Singleton(SegmentationError); var ProgramTerminationError = Singleton(ProgramTerminationError); static void Exception_Signal(int sig) { switch(sig) {
#include "ptest.h" #include "Cello.h" local var DivideByZeroError = Singleton(DivideByZeroError); local var OtherError = Singleton(OtherError); local int exception_divide(int x, int y) { if (y == 0) { throw(DivideByZeroError, "%i / %i", $(Int, x), $(Int, y)); return 0; } else { return x / y; } } PT_SUITE(suite_exception) { PT_TEST(test_throw) { int r0 = exception_divide(2, 1); int r1 = exception_divide(4, 2); int r2 = exception_divide(9, 3); PT_ASSERT(r0 == 2); PT_ASSERT(r1 == 2); PT_ASSERT(r2 == 3); PT_ASSERT(__exc_depth is -1); }
float TimeGlobals::TimeScale() { return Singleton()->timeScale->data; }
UInt32 TimeGlobals::GameDaysPassed() { return Singleton()->gameDaysPassed->data; }
float TimeGlobals::GameHour() { return Singleton()->gameHour->data; }
UInt32 TimeGlobals::GameMonth() { return Singleton()->gameMonth->data; }
UInt32 TimeGlobals::GameYear() { return Singleton()->gameYear->data; }
UInt32 TimeGlobals::GameDay() { return Singleton()->gameDay->data; }