void GetUnicodeFileLines(wifstream &File, Vector<UnicodeString> &Output) { SignalError("wifstream seems to die on ASCII EOF character"); Output.FreeMemory(); wstring CurLine; while(!File.eof()) { getline<UnicodeCharacter>(File, CurLine); if(!File.eof()) { Output.PushEnd(UnicodeString(CurLine.c_str())); } } }
void ProcessList::Update() { FreeMemory(); HANDLE processSnapshot; PROCESSENTRY32 processEntry; // Take a snapshot of all processes in the system. processSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if(processSnapshot == INVALID_HANDLE_VALUE) { SignalError("CreateToolhelp32Snapshot"); } // Set the size of the structure before using it. processEntry.dwSize = sizeof(PROCESSENTRY32); if(!Process32First(processSnapshot, &processEntry)) { SignalError("Process32First"); } // Now walk the snapshot of processes, and // display information about each process in turn do { WindowsProcess *curProcess = new WindowsProcess(processEntry); _list.PushEnd(curProcess); } while(Process32Next(processSnapshot, &processEntry)); CloseHandle(processSnapshot); }
/* * Enable/disable tracing of method calls. */ void java_lang_VMRuntime_traceMethodCalls(jboolean on) { if (on == true) { SignalError("java.lang.RuntimeException", "Cannot trace method calls"); } }
/* * Enable/disable tracing of instructions. */ void java_lang_VMRuntime_traceInstructions(jboolean on) { if (on == true) { SignalError("java.lang.RuntimeException", "Cannot trace instructions"); } }
/*------------------------------------ deferred_Rate ---*/ static Pvoid deferred_Rate(QtPtr xx, PSymbol ss, short argc, PAtom argv) { #pragma unused(argc, ss) EnterCallback(); if (xx->fCurrentMovie) { short numerator = short(argv->a_w.w_long); short denominator = short((argv + 1)->a_w.w_long); if (! denominator) denominator = 1; xx->fCurrentRate = FixRatio(numerator, denominator); SetMovieRate(xx->fCurrentMovie, xx->fCurrentRate); xx->fStopSignalled = false; qtAdjustController(xx); } else { LOG_ERROR_1(OUTPUT_PREFIX "no movies loaded") SignalError(xx); } ExitMaxMessageHandler() } /* deferred_Rate */
void StateManager::LoadVertexTexCoord0(Vec2f &TexCoord, UINT Index) { for(UINT i = 0; i < VertexDeclaration.Length(); i++) { const D3D9Base::D3DVERTEXELEMENT9 &Decl = VertexDeclaration[i]; if(Decl.Usage == D3DDECLUSAGE_TEXCOORD && Decl.UsageIndex == 0) { StreamInfo &Stream = VBufferStreams[Decl.Stream]; Assert(Stream.StreamData != NULL, "Reference to unbound stream"); BYTE *ByteStream = (BYTE *)(Stream.StreamData->Buffer.CArray() + Stream.OffsetInBytes + Index * Stream.Stride + Decl.Offset); float *FloatStream = (float *)ByteStream; Vec4f Result = Vec4f(0.0f, 0.0f, 0.0f, 0.0f); switch(Decl.Type) { case D3DDECLTYPE_FLOAT1: Result = Vec4f(FloatStream[0], 0.0f, 0.0f, 1.0f); break; case D3DDECLTYPE_FLOAT2: Result = Vec4f(FloatStream[0], FloatStream[1], 0.0f, 1.0f); break; case D3DDECLTYPE_FLOAT3: Result = Vec4f(FloatStream[0], FloatStream[1], FloatStream[2], 1.0f); break; case D3DDECLTYPE_FLOAT4: Result = Vec4f(FloatStream[0], FloatStream[1], FloatStream[2], FloatStream[3]); break; default: SignalError(String("Unsupported type: ") + String(UINT(Decl.Type))); } Assert(Decl.UsageIndex < MaxTexCoords, "Texture coordinate index out of range"); TexCoord = Vec2f(Result.x, Result.y); return; } } }
Matrix4 IndicatorShape::TransformMatrix() const { switch(Type) { case IndicatorShapeSphere: { Matrix4 Scale = Matrix4::Scaling(Radius); Matrix4 Translate = Matrix4::Translation(Pos[0]); return Scale * Translate; } case IndicatorShapeCylinder: { Vec3f Diff = Pos[1] - Pos[0]; float Height = Diff.Length(); Matrix4 Scale = Matrix4::Scaling(Vec3f(Radius, Radius, Height)); Matrix4 Face = Matrix4::Face(Vec3f::eZ, Diff); Matrix4 Translate = Matrix4::Translation(Pos[0]); return Scale * Face * Translate; } default: SignalError("Invalid shape type"); return Matrix4::Identity(); } }
jint Java_java_awt_Toolkit_fntBytesWidth(JNIEnv *envP, jclass k, jobject _jfont, jbyteArray _jbytes, jint off, jint len) { GR_FONT_ID fontid; GR_FONT_INFO fontinfo; jboolean isCopy; int w; int n,i; jbyte *jb; if ( _jfont == NULL) { SignalError("java.lang.NullPointerException", "no font object"); return 0; } if ( _jbytes == NULL) { SignalError("java.lang.NullPointerException", "no byte array "); return 0; } fontid = (GR_FONT_ID)_jfont; GrGetFontInfo(fontid,&fontinfo); n = (*envP)->GetArrayLength(envP, _jbytes); if ( n < ( off + len )) { return 0; } if ( fontinfo.fixed ) { return len * fontinfo.maxwidth; } else { jb = (*envP)->GetByteArrayElements(envP, _jbytes, &isCopy); if ( jb == NULL ) { SignalError("java.lang.OutOfMemoryError","can't alocate byte array"); return 0; } w = 0; for( i = off; i < off + len; i++ ) { if ( fontinfo.lastchar < jb[i] ) { return 0; } w += fontinfo.widths[(unsigned int)jb[i]]; } (*envP)->ReleaseByteArrayElements(envP, _jbytes, jb, 0); } return w; }
void WindowsProcess::Suspend() { SignalError("Not implemented"); if(_handle == NULL) { //_handle = OpenThread(THREAD_ALL_ACCESS, FALSE, } }
jint Java_java_awt_Toolkit_fntCharsWidth ( JNIEnv* envP, jclass clazz, jobject _jfont, jcharArray _jchars, jint off, jint len ) { GR_FONT_ID fontid; GR_FONT_INFO fontinfo; jboolean isCopy; jchar *jc; int n, w, i; if ( _jfont == NULL) { SignalError("java.lang.NullPointerException", "no font object"); return 0; } if ( _jchars == NULL ) { SignalError("java.lang.NullPointerException", "no char array object"); return 0; } fontid = (GR_FONT_ID)_jfont; GrGetFontInfo(fontid,&fontinfo); n = (*envP)->GetArrayLength( envP, _jchars); if ( n < ( off + len )) { return 0; } if ( fontinfo.fixed ) { return len * fontinfo.maxwidth; } else { jc = (*envP)->GetCharArrayElements(envP, _jchars, &isCopy); if ( jc == NULL ) { SignalError("java.lang.OutOfMemoryError", "can't alocate char array"); return 0; } w = 0; for( i = off; i < off + len; i++ ) { if ( fontinfo.lastchar < jc[i] ) { return 0; } w += fontinfo.widths[(unsigned int)jc[i]]; } (*envP)->ReleaseCharArrayElements( envP, _jchars, jc, JNI_ABORT); } return w; }
jint Java_java_awt_Toolkit_fntGetMaxAdvance(JNIEnv *env, jclass k, jobject _jfont) { if ( _jfont == NULL) { SignalError("java.lang.NullPointerException", "no font object"); return 0; } return 0; }
ostream& operator << (ostream &os, const UnicodeString &S) { /*if(S.Length() > 0) { os.write(S.CString(), S.Length()); }*/ SignalError(_T("Not implemented")); return os; }
void ExternalConnectThread::ThreadFunc() { m_udpSocket = m_address.m_socketFactory->CreateSocket(); UDPSocket* socket = dynamic_cast<UDPSocket*>(m_udpSocket); if(!socket || !socket->Bind(m_address.m_localIP, m_address.m_localPort)) { SignalError(); return; } socket->SetSendAddr(m_address.m_ip, m_address.m_port); std::string data = m_address.m_moduleName; int size = m_address.m_moduleName.size(); while(!IsStop()) { if(m_changeAddr.Wait(1000) == Semaphore::TIMEOUT) { if (!socket->Send((char*)&size, sizeof(size)) || !socket->Send((char*)data.c_str(), data.size() * sizeof(char))) { SignalError(); return; } } else { break; } } UDTSecureSocketFactory* udtSocketFactory = dynamic_cast<UDTSecureSocketFactory*>(m_address.m_socketFactory); if(!udtSocketFactory) { SignalError(); return; } udtSocketFactory->SetUdpSocket(socket->GetSocket()); m_csSocket.Enter(); m_udpSocket = 0; m_csSocket.Leave(); ConnectThread::ThreadFunc(); }
void Java_java_awt_Toolkit_fntFreeFont ( JNIEnv* env, jclass clazz, jobject _jfont ) { if ( _jfont == NULL) { SignalError("java.lang.NullPointerException", "no font object"); return; } GrDestroyFont((GR_FONT_ID)_jfont); }
jobject Java_java_awt_Toolkit_fntGetWidths(JNIEnv* envP, jclass clazz, jobject _jfont ) { GR_FONT_ID fontid; GR_FONT_INFO fontinfo; jintArray widths; jint *jw; jboolean isCopy; int i; if ( _jfont == NULL) { SignalError("java.lang.NullPointerException", "no font object"); return 0; } fontid = (GR_FONT_ID)_jfont; GrGetFontInfo(fontid,&fontinfo); widths = (*envP)->NewIntArray(envP, fontinfo.lastchar + 1); if ( widths == NULL ) { SignalError("java.lang.OutOfMemoryError", "can't alocate int array"); return 0; } jw = (*envP)->GetIntArrayElements(envP, widths, &isCopy); if ( jw == NULL ) { SignalError("java.lang.OutOfMemoryError","can't alocate int array"); return 0; } if ( fontinfo.fixed ) { for ( i = fontinfo.firstchar ; i <= fontinfo.lastchar ; i++ ) { jw[i] = fontinfo.maxwidth; } } else { for ( i = fontinfo.firstchar ; i <= fontinfo.lastchar ; i++ ) { jw[i] = fontinfo.widths[i]; } } (*envP)->ReleaseIntArrayElements(envP, widths, jw, 0); return widths; }
void String::ResizeToCStringLength() { for(UINT i = 0; i < _Capacity; i++) { if(_Data[i] == '\0') { _Length = i; ReSize(_Length + 1); return; } } SignalError("No null terminator found in String::ResizeToCStringLength"); }
void FileCollection::AddFileFromDisk(const String &FileCollectionName, const String &ExistingFilename) { _FileListMutex.Acquire(); Vector<BYTE> Data; RemoveFile(FileCollectionName); if(!Utility::FileExists(ExistingFilename)) { SignalError(String("Required file not found: ") + FileCollectionName); } Utility::GetFileData(ExistingFilename, Data); AddFileFromMemory(FileCollectionName, Data); _FileListMutex.Release(); }
bool String::ConvertToBoolean() const { if(*this == "true") { return true; } if(*this == "false") { return false; } SignalError("Invalid string to boolean conversion"); return false; }
void UnicodeString::ResizeToCStringLength() { for(UINT i = 0; i < _Capacity; i++) { if(_Data[i] == UnicodeNullTerminator) { _Length = i; ReSize(_Length + 1); return; } } SignalError(_T("No null terminator found in UnicodeString::ResizeToCStringLength")); }
Vertex& FullEdge::GetSharedVertex(const FullEdge &FullE) { if(FullE.ContainsVertex(GetVertex(0))) { return GetVertex(0); } if(FullE.ContainsVertex(GetVertex(1))) { return GetVertex(1); } SignalError("FullEdge::GetSharedVertex failed"); return Vertex::Invalid; }
Vertex& FullEdge::GetOtherVertex(const Vertex &VCompare) { if(GetVertex(0) == VCompare) { return GetVertex(1); } if(GetVertex(1) == VCompare) { return GetVertex(0); } SignalError("FullEdge::GetOtherVertex failed"); return Vertex::Invalid; }
const Triangle& FullEdge::GetOtherTriangle(const Triangle &TCompare) const { if(GetTriangle(0) == TCompare) { return GetTriangle(1); } if(GetTriangle(1) == TCompare) { return GetTriangle(0); } SignalError("FullEdge::GetOtherTriangle failed"); return Triangle::Invalid; }
jint Java_java_awt_Toolkit_fntStringWidth( JNIEnv* env, jclass clazz, jobject _jfont, jstring _jstr ) { jboolean isCopy; const jchar *jc; int len; int i,w; GR_FONT_INFO fontinfo; GR_FONT_ID fontid; if (( _jfont == NULL) || (_jstr == NULL)) { SignalError("java.lang.NullPointerException", "no object"); return 0; } jc = (*env)->GetStringChars( env, _jstr, &isCopy); if ( jc == NULL ) { SignalError("java.lang.OutOfMemoryError", "can't alocate chars"); return 0; } len = (*env)->GetStringLength( env, _jstr); fontid = (GR_FONT_ID)_jfont; GrGetFontInfo(fontid,&fontinfo); w = 0; for( i = 0 ; i < len ; i++ ) { unsigned int index; index = (unsigned int)jc[i]; if (( index < fontinfo.firstchar ) ||( index > fontinfo.lastchar )) { SignalError("java.lang.InternalError", "font id error"); } w += fontinfo.widths[index]; } (*env)->ReleaseStringChars( env, _jstr, jc); return w; }
jint Java_java_awt_Toolkit_fntGetHeight( JNIEnv* env, jclass clazz, jobject _jfont ) { GR_FONT_ID fontid; GR_FONT_INFO fontinfo; if ( _jfont == NULL) { SignalError("java.lang.NullPointerException", "no font object"); return 0; } fontid = (GR_FONT_ID)_jfont; GrGetFontInfo(fontid,&fontinfo); return fontinfo.height; }
void WindowsWindow::MoveMouse(const Vec2i &coords) { SignalError("Not implemented"); Console::WriteLine("Moving mouse to " + coords.CommaSeparatedString()); POINT currentMousePos; GetCursorPos(¤tMousePos); POINT screenPoint; screenPoint.x = coords.x; screenPoint.y = coords.y; ClientToScreen(_windowHandle, &screenPoint); mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, screenPoint.x, screenPoint.y, 0, NULL); }
jboolean Java_java_awt_Toolkit_fntIsWideFont( JNIEnv* env, jclass clazz, jobject _jfont ) { GR_FONT_ID fontid; GR_FONT_INFO fontinfo; if ( _jfont == NULL) { SignalError("java.lang.NullPointerException", "no font object"); return 0; } fontid = (GR_FONT_ID)_jfont; GrGetFontInfo(fontid,&fontinfo); return (fontinfo.lastchar < 256 )?JNI_FALSE:JNI_TRUE; }
/*------------------------------------ deferred_End ---*/ static Pvoid deferred_End(QtPtr xx) { EnterCallback(); if (xx->fCurrentMovie) { GoToEndOfMovie(xx->fCurrentMovie); SetMovieActive(xx->fCurrentMovie, TRUE); xx->fStopSignalled = true; /* pretend that we reached the end normally */ qtAdjustController(xx); } else { LOG_ERROR_1(OUTPUT_PREFIX "no movies loaded") SignalError(xx); } ExitMaxMessageHandler() } /* deferred_End */
int DexApparatus::CheckOverrun( const char *msg ) { if ( tracker->CheckAcquisitionOverrun() ) { monitor->SendEvent( "Acquisition overrun." ); int response = SignalError( MB_ABORTRETRYIGNORE, msg, "alert.bmp" ); if ( response == IDABORT ) return( ABORT_EXIT ); if ( response == IDRETRY ) return( RETRY_EXIT ); if ( response == IDIGNORE ) return( IGNORE_EXIT ); } // Log the successful overrun check. monitor->SendEvent( "Overrun check OK." ); return( NORMAL_EXIT ); }
bool ComplexMesh::ShootRay(const D3D9Mesh &M, const Vec3f &Pos, const Vec3f &Dir, UINT &TriangleIndex, UINT &VertexIndex, UINT &EdgeIndex, Vec3f &WorldPos) const { #ifdef USE_D3D9 Vector<float> Hits; Vec3f NormalizedDir = Vec3f::Normalize(Dir); float u, v; DWORD FaceIndex; M.QueryHits(Pos, NormalizedDir, Hits, FaceIndex, u, v); if(Hits.Length() > 0) { TriangleIndex = FaceIndex; WorldPos = Pos + NormalizedDir * Hits[0]; float ClosestVertexDistance = 1e10f, ClosestEdgeDistance = 1e10f; const Triangle &CurTriangle = _Triangles[TriangleIndex]; for(UINT LocalIndex = 0; LocalIndex < 3; LocalIndex++) { float CurVertexDistance = Vec3f::Dist(CurTriangle.GetVertex(LocalIndex).Pos(), WorldPos); if(CurVertexDistance < ClosestVertexDistance) { ClosestVertexDistance = CurVertexDistance; VertexIndex = CurTriangle.GetVertex(LocalIndex).Index(); } float CurEdgeDistance = Vec3f::Dist(CurTriangle.GetFullEdge(LocalIndex).Center(), WorldPos); if(CurEdgeDistance < ClosestEdgeDistance) { ClosestEdgeDistance = CurEdgeDistance; EdgeIndex = CurTriangle.GetFullEdge(LocalIndex).Index(); } } return true; } else { VertexIndex = _Vertices.Length(); EdgeIndex = _FullEdges.Length(); TriangleIndex = _Triangles.Length(); return false; } #else SignalError("DirectX 9 required for ComplexMesh::ShootRay"); return false; #endif }
jint Java_java_awt_Toolkit_fntCharWidth( JNIEnv* envP, jclass clazz, jobject _jfont, jchar jChar ) { GR_FONT_ID fontid; GR_FONT_INFO fontinfo; if ( _jfont == NULL) { SignalError("java.lang.NullPointerException", "no font object"); return 0; } fontid = (GR_FONT_ID)_jfont; GrGetFontInfo(fontid,&fontinfo); if ( fontinfo.lastchar < jChar ) { return 0; } else if ( fontinfo.fixed ) { return fontinfo.maxwidth; } else { return fontinfo.widths[(unsigned int)jChar]; } }