当前位置: 首页>>代码示例>>C++>>正文


C++ postfl函数代码示例

本文整理汇总了C++中postfl函数的典型用法代码示例。如果您正苦于以下问题:C++ postfl函数的具体用法?C++ postfl怎么用?C++ postfl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了postfl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: postfl

void SC_TerminalClient::initInput()
{

#ifndef _WIN32
	if( pipe( mInputCtlPipe ) == -1 ) {
		postfl("Error creating pipe for input thread control:\n%s\n", strerror(errno));
		quit(1);
	}
#else
	mQuitInputEvent = CreateEvent( NULL, false, false, NULL );
	if( mQuitInputEvent == NULL ) {
		postfl("Error creating event for input thread control.\n");
		quit(1);
	}
#endif

#ifdef HAVE_READLINE
	if (strcmp(gIdeName, "none") == 0) {
		// Other clients (emacs, vim, ...) won't want to interact through rl
		mUseReadline = true;
		return;
	}
#endif

#ifndef _WIN32
	if( fcntl( STDIN_FD, F_SETFL, O_NONBLOCK ) == -1 ) {
		postfl("Error setting up non-blocking pipe reading:\n%s\n", strerror(errno));
		quit(1);
	}
#endif // !_WIN32
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:31,代码来源:SC_TerminalClient.cpp

示例2: lockInput

void SC_TerminalClient::endInput()
{
	// NOTE: On Windows, there is no way to safely interrupt
	// the pipe-reading thread. So just quit and let it die.

#ifdef _WIN32
	if (mUseReadline) {
#endif
	// wake up the input thread in case it is waiting
	// for input to be processed
	lockInput();
		mInputShouldBeRunning = false;
		pthread_cond_signal( &mInputCond );
	unlockInput();

#ifndef _WIN32
	char c = 'q';
	ssize_t bytes = write( mInputCtlPipe[1], &c, 1 );
	if( bytes < 1 )
		postfl("WARNING: could not send quit command to input thread.\n");
#else
	SetEvent( mQuitInputEvent );
#endif

	postfl("main: waiting for input thread to join...\n");
	pthread_join( mInputThread, NULL );

#ifdef _WIN32
	} // if (mUseReadline)
#endif
	postfl("main: quitting...\n");
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:32,代码来源:SC_TerminalClient.cpp

示例3: readlineInit

void *SC_TerminalClient::readlineFunc( void *arg )
{
	readlineInit();

	SC_TerminalClient *client = static_cast<SC_TerminalClient*>(arg);

	fd_set fds;
	FD_ZERO(&fds);

	while(true) {
		FD_SET(STDIN_FD, &fds);
		FD_SET(client->mInputCtlPipe[0], &fds);

		if( select(FD_SETSIZE, &fds, NULL, NULL, NULL) < 0 ) {
			if( errno == EINTR ) continue;
			postfl("readline: select() error:\n%s\n", strerror(errno));
			client->onQuit(1);
			break;
		}

		if( FD_ISSET(client->mInputCtlPipe[0], &fds) ) {
			postfl("readline: quit requested\n");
			break;
		}

		if( FD_ISSET(STDIN_FD, &fds) ) {
			rl_callback_read_char();
		}
	}

	postfl("readline: stopped.\n");

	return NULL;
}
开发者ID:dpalkowski,项目名称:iSuperColliderKit,代码行数:34,代码来源:SC_TerminalClient.cpp

示例4: runLibrary

SC_DLLEXPORT_C void runLibrary(PyrSymbol* selector)
{
        VMGlobals *g = gMainVMGlobals;
        g->canCallOS = true;
	try {
		if (compiledOK) {
                        ++g->sp; SetObject(g->sp, g->process);
			runInterpreter(g, selector, 1);
		} else {
			postfl("Library has not been compiled successfully.\n");
		}
	} catch (std::exception &ex) {
		PyrMethod *meth = g->method;
		if (meth) {
			int ip = slotRawInt8Array(&meth->code) ? g->ip - slotRawInt8Array(&meth->code)->b : -1;
			post("caught exception in runLibrary %s:%s %3d\n",
				slotRawSymbol(&slotRawClass(&meth->ownerclass)->name)->name, slotRawSymbol(&meth->name)->name, ip
			);
			dumpByteCodes(meth);
		} else {
			post("caught exception in runLibrary\n");
		}
		error(ex.what());
	} catch (...) {
		postfl("DANGER: OUT of MEMORY. Operation failed.\n");
	}
        g->canCallOS = false;
}
开发者ID:Sybn,项目名称:supercollider,代码行数:28,代码来源:PyrLexer.cpp

示例5: prConnectSharedMem

int prConnectSharedMem(VMGlobals *g, int numArgsPushed)
{
#if !defined(SC_IPHONE)
	PyrSlot *a = g->sp - 1;
	PyrSlot *b = g->sp;

	assert(IsObj(a));

	PyrObject * self = slotRawObject(a);
	int portNumber = slotRawInt(b);

	int ptrIndex       = 0;
	int finalizerIndex = 1;

	try {
		server_shared_memory_client * client = new server_shared_memory_client(portNumber);
		SetPtr(self->slots + ptrIndex, client);

		InstallFinalizer(g, self, finalizerIndex, disconnectSharedMem);

		postfl("Shared memory server interface initialized\n");
	} catch (std::exception & e) {
		postfl("Cannot connect to shared memory: %s\n", e.what());
		return errFailed;
	}
#else
	postfl("Warning: Shared memory server interface disabled on iphone\n");
#endif
	return errNone;
}
开发者ID:robertol80,项目名称:supercollider,代码行数:30,代码来源:OSCData.cpp

示例6: postfl

void SC_TerminalClient::onInputRead(const boost::system::error_code &error, std::size_t bytes_transferred)
{
	if (error == boost::asio::error::operation_aborted) {
		postfl("SCLang Input: Quit requested\n");
		return;
	}

	if (error == boost::asio::error::eof) {
		postfl("SCLang Input: EOF. Will quit.\n");
		onQuit(0);
		return;
	}

	if (error) {
		postfl("SCLang Input: %s.\n", error.message().c_str());
		onQuit(1);
		return;
	}

	if (!error) {
#if HAVE_READLINE
		if (mUseReadline) {
			rl_callback_read_char();
			startInputRead();
			return;
		}
#endif
		pushCmdLine( inputBuffer.data(), bytes_transferred );
	}
}
开发者ID:Angeldude,项目名称:supercollider,代码行数:30,代码来源:SC_TerminalClient.cpp

示例7: init_OSC

void init_OSC(int port)
{
    postfl("init_OSC\n");
    try {
        gUDPport = new SC_UdpInPort(port);
    } catch (...) {
        postfl("No networking.");
    }
}
开发者ID:scztt,项目名称:sc-debug,代码行数:9,代码来源:OSCData.cpp

示例8: compileLibrary

SC_DLLEXPORT_C bool compileLibrary()
{
	//printf("->compileLibrary\n");
	shutdownLibrary();

	pthread_mutex_lock (&gLangMutex);
	gNumCompiledFiles = 0;
	compiledOK = false;

	// FIXME: the library config should have been initialized earlier!
	if (!gLibraryConfig)
		SC_LanguageConfig::readDefaultLibraryConfig();

	compileStartTime = elapsedTime();

	totalByteCodes = 0;

#ifdef NDEBUG
	postfl("compiling class library...\n");
#else
	postfl("compiling class library (debug build)...\n");
#endif

	bool res = passOne();
	if (res) {

		postfl("\tpass 1 done\n");

		if (!compileErrors) {
			buildDepTree();
			traverseFullDepTree();
			traverseFullDepTree2();
			flushPostBuf();

			if (!compileErrors && gShowWarnings) {
				SymbolTable* symbolTable = gMainVMGlobals->symbolTable;
				symbolTable->CheckSymbols();
			}
		}
		pyr_pool_compile->FreeAll();
		flushPostBuf();
		compileSucceeded();
	} else {
		compiledOK = false;
	}

	pthread_mutex_unlock (&gLangMutex);
	//printf("<-compileLibrary\n");
	return compiledOK;
}
开发者ID:davebritton,项目名称:supercollider,代码行数:50,代码来源:PyrLexer.cpp

示例9: compileLibrary

SC_DLLEXPORT_C bool compileLibrary(bool standalone)
{
	//printf("->compileLibrary\n");
	shutdownLibrary();

	gLangMutex.lock();
	gNumCompiledFiles = 0;
	compiledOK = false;

	SC_LanguageConfig::readLibraryConfig(standalone);

	compileStartTime = elapsedRealTime();

	totalByteCodes = 0;

#ifdef NDEBUG
	postfl("compiling class library...\n");
#else
	postfl("compiling class library (debug build)...\n");
#endif

	bool res = passOne();
	if (res) {

		postfl("\tpass 1 done\n");

		if (!compileErrors) {
			buildDepTree();
			traverseFullDepTree();
			traverseFullDepTree2();
			flushPostBuf();

			if (!compileErrors && gShowWarnings) {
				SymbolTable* symbolTable = gMainVMGlobals->symbolTable;
				symbolTable->CheckSymbols();
			}
		}
		pyr_pool_compile->FreeAll();
		flushPostBuf();
		compileSucceeded();
	} else {
		compiledOK = false;
	}

	gLangMutex.unlock();
	//printf("<-compileLibrary\n");
	return compiledOK;
}
开发者ID:ngwese,项目名称:supercollider,代码行数:48,代码来源:PyrLexer.cpp

示例10: lockLanguageOrQuit

void SC_HID_APIManager::handleElement( int joy_idx, struct hid_device_element * ele, std::atomic<bool> const & shouldBeRunning ){
	int status = lockLanguageOrQuit(shouldBeRunning);
	if (status == EINTR)
		return;
	if (status) {
		postfl("error when locking language (%d)\n", status);
		return;
	}

	if (compiledOK) {
		VMGlobals* g = gMainVMGlobals;
		g->canCallOS = false;
		++g->sp; SetObject(g->sp, s_hidapi->u.classobj ); // set the class HID_API
		++g->sp; SetInt(g->sp, joy_idx );
		++g->sp; SetInt(g->sp, ele->index );
		++g->sp; SetInt(g->sp, ele->usage_page );
		++g->sp; SetInt(g->sp, ele->usage );
		++g->sp; SetInt(g->sp, ele->value );
		++g->sp; SetFloat(g->sp, hid_element_map_logical( ele ) );
		++g->sp; SetFloat(g->sp, hid_element_map_physical( ele ) );
		++g->sp; SetInt(g->sp, ele->array_value );
		runInterpreter(g, s_hidElementData, 9 );
		g->canCallOS = false;
	}
	gLangMutex.unlock();
}
开发者ID:ASauer,项目名称:supercollider,代码行数:26,代码来源:SC_HID_api.cpp

示例11: ScIDE_Send

int ScIDE_Send(struct VMGlobals *g, int numArgsPushed)
{
    if (!gIpcClient) {
        error("ScIDE not connected\n");
        return errFailed;
    }

    if( !gMainVMGlobals->canCallOS ) {
        error("You can not use ScIDE:prSend functionality in the current thread.\nTry scheduling on AppClock instead.\n");
        return errFailed;
    }

    PyrSlot * idSlot = g->sp - 1;
    char id[255];
    if (slotStrVal( idSlot, id, 255 ))
        return errWrongType;

    PyrSlot * argSlot = g->sp;

    try {
        YAMLSerializer serializer(argSlot);
        sendSelectorAndData(gIpcClient->mSocket, QString(id), QString::fromUtf8(serializer.data()));
    } catch (std::exception const & e) {
        postfl("Exception during ScIDE_Send: %s\n", e.what());
        return errFailed;
    }

    return errNone;
}
开发者ID:8c6794b6,项目名称:supercollider,代码行数:29,代码来源:sc_ipc_client.cpp

示例12: ScIDE_Send

int ScIDE_Send(struct VMGlobals *g, int numArgsPushed)
{
    if (!gIpcClient) {
        error("ScIDE not connected\n");
        return errFailed;
    }

    PyrSlot * idSlot = g->sp - 1;
    char id[255];
    if (slotStrVal( idSlot, id, 255 ))
        return errWrongType;

    PyrSlot * argSlot = g->sp;

    try {
        YAMLSerializer serializer(argSlot);

        QDataStream stream(gIpcClient->mSocket);
        stream.setVersion(QDataStream::Qt_4_6);
        stream << QString(id);
        stream << QString::fromUtf8(serializer.data());
    } catch (std::exception const & e) {
        postfl("Exception during ScIDE_Send: %s\n", e.what());
        return errFailed;
    }

    return errNone;
}
开发者ID:brunoruviaro,项目名称:supercollider,代码行数:28,代码来源:sc_ipc_client.cpp

示例13: postfl

void SC_LanguageClient::initRuntime(const Options& opt)
{
	// start virtual machine
	if (!mHiddenClient->mRunning) {
#ifdef __linux__
		using DirName = SC_Filesystem::DirName;
		namespace bfs = boost::filesystem;
		bfs::path deprecatedSupportDirectory = SC_Filesystem::instance().getDirectory(DirName::UserHome);
		deprecatedSupportDirectory /= "share/SuperCollider";

		if (bfs::exists(deprecatedSupportDirectory)) {
			bfs::path supportDirectory = SC_Filesystem::instance().getDirectory(DirName::UserAppSupport);
			postfl("WARNING: Deprecated support directory detected: %s\n"
				"Extensions and other contents in this directory will not be available until you move them to the new support directory:\n"
				"%s\n"
				"Quarks will need to be reinstalled due to broken symbolic links.\n\n",
				deprecatedSupportDirectory.string().c_str(), // we can safely convert to c_str here because the POSIX filesystem uses UTF-8
				supportDirectory.string().c_str());
		}
#endif

		mHiddenClient->mRunning = true;
		if (opt.mRuntimeDir) {
			int err = chdir(opt.mRuntimeDir);
			if (err)
				error("Cannot change to runtime directory: %s", strerror(errno));
		}
		pyr_init_mem_pools(opt.mMemSpace, opt.mMemGrow);
		init_OSC(opt.mPort);
		schedInit();
		onInitRuntime();
	}
}
开发者ID:Sciss,项目名称:supercollider,代码行数:33,代码来源:SC_LanguageClient.cpp

示例14: newClassDependancy

ClassDependancy* newClassDependancy(PyrSymbol *className, PyrSymbol *superClassName,
	PyrSymbol *fileSym, int startPos, int endPos, int lineOffset)
{
	ClassDependancy* classdep;

	//post("classdep '%s' '%s' '%s' %d %d\n", className->name, superClassName->name,
	//	fileSym->name, className, superClassName);
	// pyrmalloc:
	// lifetime: kill after compile.
	numClassDeps++;
	if (className->classdep) {
		error("duplicate Class found: '%s' \n", className->name);
                post("%s\n",className->classdep->fileSym->name);
                postfl("%s\n\n",fileSym->name);
		return className->classdep;
	}
	classdep = (ClassDependancy*)pyr_pool_compile->Alloc(sizeof(ClassDependancy));
	MEMFAIL(text);
	classdep->className = className;
	classdep->superClassName = superClassName;
	classdep->fileSym = fileSym;
	classdep->superClassDep = NULL;
	classdep->next = NULL;
	classdep->subclasses = NULL;

	classdep->startPos = startPos;
	classdep->endPos = endPos;
	classdep->lineOffset = lineOffset;

	className->classdep = classdep;
	return classdep;
}
开发者ID:Sybn,项目名称:supercollider,代码行数:32,代码来源:PyrLexer.cpp

示例15: interpretCmdLine

void interpretCmdLine(const char *textbuf, int textlen, char *methodname)
{
	PyrString *string;

	if (compiledOK) {
		PyrSlot slot;

		string = newPyrStringN(gMainVMGlobals->gc, textlen, 0, false);
		memcpy(string->s, textbuf, textlen);
		SetObject(&slotRawInterpreter(&gMainVMGlobals->process->interpreter)->cmdLine, string);
		gMainVMGlobals->gc->GCWrite(slotRawObject(&gMainVMGlobals->process->interpreter), string);
		SetObject(&slot, gMainVMGlobals->process);
//#if __profile__
//		ProfilerInit(collectSummary, microsecondsTimeBase, 500, 100);
//#endif
		slotCopy((++gMainVMGlobals->sp), &slot);
		runInterpreter(gMainVMGlobals, getsym(methodname), 1);
//#if __profile__
//		ProfilerDump("\pErase2.prof");
//		ProfilerTerm();
//#endif
	} else {
		postfl("Library has not been compiled successfully.\n");
	}
}
开发者ID:Sybn,项目名称:supercollider,代码行数:25,代码来源:PyrLexer.cpp


注:本文中的postfl函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。