本文整理汇总了PHP中ncurses_end函数的典型用法代码示例。如果您正苦于以下问题:PHP ncurses_end函数的具体用法?PHP ncurses_end怎么用?PHP ncurses_end使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ncurses_end函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: onTerminate
public function onTerminate()
{
if ($this->nc) {
ncurses_end();
}
$this->nc = null;
}
开发者ID:noccy80,项目名称:cherryphp,代码行数:7,代码来源:context.php
示例2: __destruct
public function __destruct()
{
static::$init--;
if (static::$init == 0) {
ncurses_end();
}
}
开发者ID:EsterniTY,项目名称:dfl860e-logger,代码行数:7,代码来源:ncurse.php
示例3: __destruct
function __destruct()
{
if (function_exists('\\ncurses_end')) {
\ncurses_end();
}
fclose($this->fpin);
}
开发者ID:noccy80,项目名称:cherryphp,代码行数:7,代码来源:cwt.php
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
mb_internal_encoding('UTF-8');
try {
list($line, $colonne) = explode("x", $input->getOption("size"));
$symfonyStyle = new SymfonyStyle($input, $output);
$symfonyStyle->title("IA");
$mapRender = !$input->getOption("curse") ? new ConsoleMapRender($output, true) : new NCurseRender($line, $colonne);
if (!$input->getOption("load-dump")) {
$sizeMap = $mapRender->getSize();
$mapProvider = $input->getOption("map") ? new FileMapProvider($input->getOption("map")) : new RandomMapProvider($sizeMap["y"], $sizeMap["x"]);
$map = new MapBuilder($mapProvider->getMap());
$world = new World($map, array($this->addChat(5, 5), $this->addChat(10, 10)));
} else {
$file = $input->getOption("load-dump");
if (!file_exists($file)) {
if (extension_loaded("ncurses") && $mapRender instanceof NCurseRender) {
ncurses_end();
}
$symfonyStyle->error("le fichier {$file} n'existe pas");
return;
}
$world = unserialize(file_get_contents($file))->getFlashMemory()->all()[0]->getData();
}
while (1) {
$this->render($mapRender, $world);
}
} catch (\Exception $e) {
if (extension_loaded("ncurses") && $mapRender instanceof NCurseRender) {
ncurses_end();
}
$symfonyStyle->error($e->getMessage());
return;
}
}
开发者ID:jean-pasqualini,项目名称:ia,代码行数:35,代码来源:ApplicationCommand.php
示例5: HandleResize
public function HandleResize($iSignal)
{
//$this->Output(BUFFER_CURRENT, "FFS RESIZE");
ncurses_end();
ncurses_doupdate();
$this->InitialiseTerminal();
$this->CreateWindows();
$this->DrawBuffer($this->iCurrentBuffer);
$this->setuserinput();
}
开发者ID:rburchell,项目名称:ircc,代码行数:10,代码来源:ncurse.class.php
示例6: sig_handler
function sig_handler($signo)
{
switch ($signo) {
case SIGINT:
ncurses_end();
exit('exit');
case SIGTERM:
ncurses_end();
exit('exit');
default:
// other
}
}
开发者ID:jean-pasqualini,项目名称:ia,代码行数:13,代码来源:init.php
示例7: parse
private function parse($char = '')
{
switch ($char) {
case ESCAPE_KEY:
ncurses_end();
exit;
break;
case ENTER:
$buffer = $this->getBuffer();
ncurses_mvaddstr(0, 1, $buffer);
ncurses_wclear($this->small);
ncurses_wborder($this->small, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_mvwaddstr($this->small, 5, 5, $buffer);
ncurses_wrefresh($this->small);
break;
default:
$this->pushBuffer(chr($char));
ncurses_wclear($this->small);
ncurses_wborder($this->small, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_mvwaddstr($this->small, 5, 5, chr($char));
ncurses_wrefresh($this->small);
break;
}
}
开发者ID:swos-,项目名称:ncurses,代码行数:24,代码来源:Ncurses.php
示例8: define
<?php
/**
* nCurses Keys
*
* Show nCurses key code.
*
* @author Kenny Parnell <[email protected]>
* @date Tue 05 Aug 2008 09:08:07 PM EDT
*/
define('ESCAPE_KEY', 27);
ncurses_init();
$fullscreen = ncurses_newwin(0, 0, 0, 0);
ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
ncurses_getmaxyx($fullscreen, $y, $x);
$small = ncurses_newwin(5, 7, ($y - 5) / 2, ($x - 7) / 2);
ncurses_wborder($small, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_refresh();
ncurses_mvwaddstr($small, 5, 2, "12");
ncurses_wrefresh($small);
do {
$k = ncurses_wgetch($small);
if ($k == ESCAPE_KEY) {
ncurses_end();
exit;
} else {
echo $k;
}
} while (1);
/* vim:set ft=php ts=4 sw=4 et */
开发者ID:jean-pasqualini,项目名称:ia,代码行数:30,代码来源:keys.php
示例9: gui
function gui()
{
// we begin by initializing ncurses
$ncurse = ncurses_init();
// let ncurses know we wish to use the whole screen
$fullscreen = ncurses_newwin(0, 0, 0, 0);
// draw a border around the whole thing.
ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
ncurses_attron(NCURSES_A_REVERSE);
ncurses_mvaddstr(0, 1, "AEMB2 SIMULATOR OUTPUT TRANSLATOR");
ncurses_attroff(NCURSES_A_REVERSE);
// now lets create a small window
$small = ncurses_newwin(10, 30, 2, 2);
// border our small window.
ncurses_wborder($small, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_refresh();
// paint both windows
// move into the small window and write a string
ncurses_mvwaddstr($small, 5, 5, " Test String ");
// show our handiwork and refresh our small window
ncurses_wrefresh($small);
$pressed = ncurses_getch();
// wait for a user keypress
ncurses_end();
// clean up our screen
}
开发者ID:jiangxilong,项目名称:aemb,代码行数:26,代码来源:simulator.php
示例10: __destruct
public function __destruct()
{
if ($this->loaded) {
ncurses_end();
}
}
开发者ID:impelling,项目名称:VegaDNS,代码行数:6,代码来源:class.out_ncurses.php
示例11: closeCLI
public function closeCLI()
{
ncurses_end();
}
开发者ID:MaloufSleep,项目名称:obray,代码行数:4,代码来源:oCLI.php
示例12: __destruct
/**
* Application class destructor
*
* @return void
*/
public function __destruct()
{
// Reset terminal settings & end ncurses
if ($this->initialized) {
ncurses_resetty();
ncurses_end();
}
}
开发者ID:nicholasc,项目名称:blink,代码行数:13,代码来源:Application.php
示例13: importDataFromSource
//.........这里部分代码省略.........
ncurses_wattroff($r_errors, NCURSES_A_REVERSE);
$r_progress = ncurses_newwin(3, $vn_max_x - 4, $vn_max_y - 4, 2);
ncurses_wborder($r_progress, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_wattron($r_progress, NCURSES_A_REVERSE);
ncurses_mvwaddstr($r_progress, 0, 1, _t(" Progress "));
ncurses_wattroff($r_progress, NCURSES_A_REVERSE);
$r_status = ncurses_newwin(3, $vn_max_x - 4, 1, 2);
ncurses_wborder($r_status, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_wattron($r_status, NCURSES_A_REVERSE);
ncurses_mvwaddstr($r_status, 0, 1, _t(" Import status "));
ncurses_wattroff($r_status, NCURSES_A_REVERSE);
ncurses_refresh(0);
ncurses_wrefresh($r_progress);
ncurses_wrefresh($r_errors);
ncurses_wrefresh($r_status);
}
$o_log->logInfo(_t('Started import of %1 using mapping %2', $ps_source, $t_mapping->get("importer_code")));
$t = new Timer();
$vn_start_time = time();
$va_log_import_error_opts = array('startTime' => $vn_start_time, 'window' => $r_errors, 'log' => $o_log, 'request' => $po_request, 'progressCallback' => isset($pa_options['progressCallback']) && ($ps_callback = $pa_options['progressCallback']) ? $ps_callback : null, 'reportCallback' => isset($pa_options['reportCallback']) && ($ps_callback = $pa_options['reportCallback']) ? $ps_callback : null);
global $g_ui_locale_id;
// constant locale set by index.php for web requests
$vn_locale_id = isset($pa_options['locale_id']) && (int) $pa_options['locale_id'] ? (int) $pa_options['locale_id'] : $g_ui_locale_id;
$o_dm = $t_mapping->getAppDatamodel();
$o_progress->start(_t('Reading %1', $ps_source), array('window' => $r_progress));
if ($po_request && isset($pa_options['progressCallback']) && ($ps_callback = $pa_options['progressCallback'])) {
$ps_callback($po_request, $pn_file_number, $pn_number_of_files, $ps_source, 0, 100, _t('Reading %1', $ps_source), time() - $vn_start_time, memory_get_usage(true), 0, ca_data_importers::$s_num_import_errors);
}
// Open file
$ps_format = isset($pa_options['format']) && $pa_options['format'] ? $pa_options['format'] : null;
if (!($o_reader = $t_mapping->getDataReader($ps_source, $ps_format))) {
ca_data_importers::logImportError(_t("Could not open source %1 (format=%2)", $ps_source, $ps_format), $va_log_import_error_opts);
if ($vb_use_ncurses) {
ncurses_end();
}
if ($o_trans) {
$o_trans->rollback();
}
return false;
}
if (!$o_reader->read($ps_source, array('basePath' => $t_mapping->getSetting('basePath')))) {
ca_data_importers::logImportError(_t("Could not read source %1 (format=%2)", $ps_source, $ps_format), $va_log_import_error_opts);
if ($vb_use_ncurses) {
ncurses_end();
}
if ($o_trans) {
$o_trans->rollback();
}
return false;
}
$o_log->logDebug(_t('Finished reading input source at %1 seconds', $t->getTime(4)));
$vn_num_items = $o_reader->numRows();
$o_progress->setTotal($vn_num_items);
$o_progress->start(_t('Importing from %1', $ps_source), array('window' => $r_progress));
if ($po_request && isset($pa_options['progressCallback']) && ($ps_callback = $pa_options['progressCallback'])) {
$ps_callback($po_request, $pn_file_number, $pn_number_of_files, $ps_source, 0, $vn_num_items, _t('Importing from %1', $ps_source), time() - $vn_start_time, memory_get_usage(true), 0, ca_data_importers::$s_num_import_errors);
}
// What are we importing?
$vn_table_num = $t_mapping->get('table_num');
if (!($t_subject = $o_dm->getInstanceByTableNum($vn_table_num))) {
// invalid table
if ($vb_use_ncurses) {
ncurses_end();
}
if ($o_trans) {
$o_trans->rollback();
开发者ID:ffarago,项目名称:pawtucket2,代码行数:67,代码来源:ca_data_importers.php
示例14: curlInfoIPC
/**
* get IPC message and display
*
* @param callback $callback
* return true to end the loop, called on every loop
*/
function curlInfoIPC($callback = null)
{
$queue = $this->getMessageQueue(true)[0];
$nc = ncurses_init();
$window = ncurses_newwin(0, 0, 0, 0);
$caption = '';
$list = array();
$lastClear = time();
while (true) {
$time = time();
if ($time - $lastClear > 10) {
ncurses_clear();
$lastClear = $time;
}
$error = '';
if (msg_receive($queue, 0, $msgtype, 1024 * 1024, $msg, true, MSG_IPC_NOWAIT, $errorCode)) {
if (strlen($msg['caption']) > strlen($caption)) {
$caption = $msg['caption'];
}
$pid = $msg['pid'];
$isLast = $msg['isLast'];
unset($msg['pid'], $msg['isLast'], $msg['caption']);
$list[$pid] = $msg;
if (true === $isLast) {
unset($list[$pid]);
ncurses_clear();
if (empty($list)) {
break;
}
}
} else {
if ($errorCode != MSG_ENOMSG) {
$error = 'IPC receive error, errorCode=' . $errorCode;
}
}
$content = '';
$output = '';
foreach ($list as $k => $v) {
$content .= $v['content'] . "\n";
$output .= $v['output'] . "\n";
}
$str = trim($caption . "\n" . $content . "\n" . $output . "\n" . $error);
ncurses_move(0, 0);
ncurses_addstr($str);
ncurses_refresh();
if (isset($callback)) {
if (call_user_func($callback)) {
break;
}
}
usleep(100 * 1000);
}
ncurses_end();
msg_remove_queue($queue);
}
开发者ID:DJ-clamp,项目名称:php-curlmulti,代码行数:61,代码来源:Base.php
示例15: __destruct
public function __destruct()
{
ncurses_end();
ncurses_resetty();
}
开发者ID:nicholasc,项目名称:blink,代码行数:5,代码来源:TerminalTest.php
示例16: end
/**
* End the output, clean up ncurses.
*/
public function end()
{
ncurses_end();
}
开发者ID:ShaneMcC,项目名称:synacor-challenge,代码行数:7,代码来源:VMOutput_ncurses.php
示例17: render
/**
* Renders the dump
*/
public function render()
{
// initialize ncurses window
ncurses_init();
ncurses_curs_set(0);
ncurses_noecho();
ncurses_cbreak();
ncurses_start_color();
ncurses_use_default_colors();
ncurses_init_pair(self::COLOR_RED, NCURSES_COLOR_RED, -1);
ncurses_init_pair(self::COLOR_GREEN, NCURSES_COLOR_GREEN, -1);
ncurses_init_pair(self::COLOR_YELLOW, NCURSES_COLOR_YELLOW, -1);
ncurses_init_pair(self::COLOR_BLUE, NCURSES_COLOR_BLUE, -1);
ncurses_init_pair(self::COLOR_MAGENTA, NCURSES_COLOR_MAGENTA, -1);
ncurses_init_pair(self::COLOR_CYAN, NCURSES_COLOR_CYAN, -1);
ncurses_init_pair(self::COLOR_WHITE, NCURSES_COLOR_WHITE, -1);
ncurses_init_pair(self::COLOR_HIGHLIGHTED_DEFAULT, 0, NCURSES_COLOR_WHITE);
ncurses_init_pair(self::COLOR_HIGHLIGHTED_RED, NCURSES_COLOR_RED, NCURSES_COLOR_WHITE);
ncurses_init_pair(self::COLOR_HIGHLIGHTED_GREEN, NCURSES_COLOR_GREEN, NCURSES_COLOR_WHITE);
ncurses_init_pair(self::COLOR_HIGHLIGHTED_YELLOW, NCURSES_COLOR_YELLOW, NCURSES_COLOR_WHITE);
ncurses_init_pair(self::COLOR_HIGHLIGHTED_BLUE, NCURSES_COLOR_BLUE, NCURSES_COLOR_WHITE);
ncurses_init_pair(self::COLOR_HIGHLIGHTED_MAGENTA, NCURSES_COLOR_MAGENTA, NCURSES_COLOR_WHITE);
ncurses_init_pair(self::COLOR_HIGHLIGHTED_CYAN, NCURSES_COLOR_CYAN, NCURSES_COLOR_WHITE);
ncurses_init_pair(self::COLOR_HIGHLIGHTED_WHITE, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLACK);
// create a dummy pad which will receive user inputs
$this->windowDummy = ncurses_newpad(1, 1);
ncurses_keypad($this->windowDummy, true);
// run interface
$continue = true;
$this->currentRenderer = $this->rendererVarDump;
$this->createTitleWindow();
$this->createFooterWindow();
$this->refreshTitle();
$this->refreshFooter();
while ($continue) {
$this->currentRenderer->refresh();
$key = ncurses_wgetch($this->windowDummy);
$continue = $this->onKeypress($key);
}
ncurses_end();
}
开发者ID:samleybrize,项目名称:bugzorcist,代码行数:44,代码来源:VarDumpNcurses.php
示例18: getScreenWidthFromNcurses
protected function getScreenWidthFromNcurses()
{
// @codeCoverageIgnoreStart
if (!function_exists('ncurses_getmaxyx')) {
return false;
}
// @codeCoverageIgnoreEnd
$screenWidth = 0;
$screenHeight = 0;
if (!$this->isReallyATty()) {
return false;
}
// @codeCoverageIgnoreStart
ncurses_init();
$fullscreen = ncurses_newwin(0, 0, 0, 0);
ncurses_wrefresh($fullscreen);
ncurses_getmaxyx($fullscreen, $screenHeight, $screenWidth);
ncurses_end();
return $screenWidth;
// @codeCoverageIgnoreEnd
}
开发者ID:Gradwell,项目名称:ConsoleDisplayLib,代码行数:21,代码来源:StreamOutput.php
示例19: closeClean
protected function closeClean()
{
ncurses_end();
// выходим из режима ncurses, чистим экран
}
开发者ID:svgorbunov,项目名称:AcePHProxy,代码行数:5,代码来源:class.ncurses_ui.php
示例20: showError
private static function showError($ca, $type, $message, $file, $line, $log, $bt)
{
if (function_exists('ncurses_end')) {
@ncurses_end();
}
$header = "[41;1m[K\n" . " [1mFatal Exception[22m[K\n" . " {$message}[K\n" . "[K[0m\n\n";
$ca->error($header);
//$ca->error("\033[1m%s:\033[22m\n %s\n",$type,$message);
$ca->error("[31;1mSource:[0m\n %s (line %d)\n", $file, $line);
$ca->error("%s\n\n", join("\n", self::indent(\Cherry\Debug::getCodePreview($file, $line), 4)));
$ca->error("[31;1mBacktrace:\n[0m%s\n\n", join("\n", self::indent($bt, 4)));
$ca->error("[31;1mDebug log:[0m\n%s\n\n", join("\n", self::indent($log, 4)));
//$ca->error("(Hint: Change the LOG_LENGTH envvar to set the size of the debug log buffer)\n");
$ca->error("[33;1mCherryPHP[22m/%s (PHP/%s) %s %s\n", CHERRY_VERSION, PHP_VERSION, strtoupper(php_sapi_name()), PHP_OS);
}
开发者ID:noccy80,项目名称:cherryphp,代码行数:15,代码来源:consoleapplication.php
注:本文中的ncurses_end函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论