本文整理汇总了C++中CONTROL函数的典型用法代码示例。如果您正苦于以下问题:C++ CONTROL函数的具体用法?C++ CONTROL怎么用?C++ CONTROL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CONTROL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_telnet
void
init_telnet(void)
{
env_init();
SB_CLEAR();
ClearArray(options);
connected = ISend = localflow = donebinarytoggle = 0;
#ifdef AUTHENTICATION
#ifdef ENCRYPTION
auth_encrypt_connect(connected);
#endif
#endif
restartany = -1;
SYNCHing = 0;
/* Don't change NetTrace */
escape = CONTROL(']');
rlogin = _POSIX_VDISABLE;
#ifdef KLUDGELINEMODE
echoc = CONTROL('E');
#endif
flushline = 1;
telrcv_state = TS_DATA;
}
示例2: GetInputFromString
CARCONTROLMAP_LOCAL::CONTROL CARCONTROLMAP_LOCAL::GetControl(const std::string & inputname, size_t controlid)
{
size_t input = GetInputFromString(inputname);
if (input == CARINPUT::INVALID)
return CONTROL();
std::vector<CONTROL> & input_controls = controls[input];
if (controlid < input_controls.size())
return input_controls[controlid];
else
return CONTROL();
}
示例3: sml_control_suspend
SML_PRIMITIVE void
sml_control_suspend()
{
struct sml_control *control = CONTROL();
control->frame_stack_top = CALLER_FRAME_END_ADDRESS();
control_suspend(control);
}
示例4: do_console_raw_local_read
static gboolean do_console_raw_local_read(GObject *stream,
gpointer opaque)
{
GUnixInputStream *localStdin = G_UNIX_INPUT_STREAM(stream);
GVirSandboxConsoleRaw *console = GVIR_SANDBOX_CONSOLE_RAW(opaque);
GVirSandboxConsoleRawPrivate *priv = console->priv;
GError *err = NULL;
gssize ret = g_pollable_input_stream_read_nonblocking
(G_POLLABLE_INPUT_STREAM(localStdin),
priv->localToConsole + priv->localToConsoleOffset,
priv->localToConsoleLength - priv->localToConsoleOffset,
NULL, &err);
if (ret < 0) {
g_debug("Error from local read %s", err ? err->message : "");
do_console_raw_close(console, err);
g_error_free(err);
goto cleanup;
}
if (ret == 0)
priv->localEOF = TRUE;
else if (priv->localToConsole[priv->localToConsoleOffset] ==
CONTROL(gvir_sandbox_console_get_escape(GVIR_SANDBOX_CONSOLE(console)))) {
do_console_raw_close(console, err);
goto cleanup;
}
priv->localToConsoleOffset += ret;
priv->localStdinSource = NULL;
do_console_raw_update_events(console);
cleanup:
return FALSE;
}
示例5: control_enum_ptr
static void
control_enum_ptr(struct sml_control *control, void (*trace)(void **),
enum sml_gc_mode mode)
{
printf("enum 1 %p %p\n", control, CONTROL());
stack_enum_ptr(control, trace);
printf("enum 2 %p\n", CONTROL());
sml_exn_enum_ptr(control->exn, trace);
if (control->tmp_root[0]) {
printf("enum 2 tmp_root 0 %p\n", &control->tmp_root[0]);
trace(&control->tmp_root[0]);
}
if (control->tmp_root[1])
trace(&control->tmp_root[1]);
}
示例6: combuf_create
combuf_t combuf_create(const uint8_t control, const combuf_size_t payload_size)
{
const cb_store_t cb_size =
COMBUF_HEAD_SIZE + payload_size + COMBUF_END_SIZE;
cb_store_t _busy = cb_size;
result_t res = ENOERR;
cb_offset_t _front;
/* критическая секция нужна, потому что combuf_create может быть
* вызвана как из прерывания, так и из задачи. */
__critical_enter();
_busy += busy;
if (_busy <= COMBUF_STORE_SIZE) {
_front = front;
front = SUM(front, cb_size);
busy = _busy;
} else
res = ENOMEM;
__critical_exit();
if (ENOERR != res)
return res;
/* Можно не вносить в критическую секцию, поскольку доступ к этим
* полям осуществляется пользователем по описателю буфера, который
* ему ещё не возвращён. */
BEGIN(_front) = BEGIN_MARKER;
SIZE(_front) = cb_size;
CONTROL(_front) = control | CREATE_MASK;
return (combuf_t) _front;
}
示例7: combuf_search
/* функция поиска буфера по полю контроля буфера.
* Функция вызывается только из задач данного модуля. */
static combuf_t combuf_search(const uint8_t mask, const uint8_t value)
{
cb_store_t cb_size;
cb_offset_t _front;
uint8_t cb_ctrl;
combuf_t cb_iter = back;
while (cb_iter != front) {
/* не защищаем CONTROL( cb_iter ), так как предполагаем,
* что вычитывание атомарно */
if (value == (CONTROL(cb_iter) & mask))
return cb_iter;
/* поле SIZE( cb_iter ) можно не вычитывать в крит. секции, так как
* это поле не изменяется никем. Изменяется только в combuf_create, но
* это не страшно:
* 1. если combuf_create выз. из задачи, то всё хорошо.
* front и поле size будут согласованы.
* 2. если из прерывания, то тоже согласованы. */
cb_iter = SUM(cb_iter, SIZE(cb_iter));
}
return ENOTFOUND;
}
示例8: sml_mutex_lock
void
sml_mutex_lock(pthread_mutex_t *m)
{
struct sml_control *control = CONTROL();
control_suspend(control);
MUTEX_LOCK(m);
control_resume(control);
}
示例9: virshGetEscapeChar
static char
virshGetEscapeChar(const char *s)
{
if (*s == '^')
return CONTROL(c_toupper(s[1]));
return *s;
}
示例10: mca_search_char
/*
* Handle a char of a search command.
*/
static int
mca_search_char(int c)
{
int flag = 0;
/*
* Certain characters as the first char of
* the pattern have special meaning:
* ! Toggle the NO_MATCH flag
* * Toggle the PAST_EOF flag
* @ Toggle the FIRST_FILE flag
*/
if (len_cmdbuf() > 0)
return (NO_MCA);
switch (c) {
case CONTROL('E'): /* ignore END of file */
case '*':
if (mca != A_FILTER)
flag = SRCH_PAST_EOF;
break;
case CONTROL('F'): /* FIRST file */
case '@':
if (mca != A_FILTER)
flag = SRCH_FIRST_FILE;
break;
case CONTROL('K'): /* KEEP position */
if (mca != A_FILTER)
flag = SRCH_NO_MOVE;
break;
case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
flag = SRCH_NO_REGEX;
break;
case CONTROL('N'): /* NOT match */
case '!':
flag = SRCH_NO_MATCH;
break;
}
if (flag != 0) {
search_type ^= flag;
mca_search();
return (MCA_MORE);
}
return (NO_MCA);
}
示例11: parport_SPP_supported
/*
* Checks for port existence, all ports support SPP MODE
*/
static int __devinit parport_SPP_supported(struct parport *pb)
{
unsigned char r, w;
/*
* first clear an eventually pending EPP timeout
* I ([email protected]) have an SMSC chipset
* that does not even respond to SPP cycles if an EPP
* timeout is pending
*/
clear_epp_timeout(pb);
/* Do a simple read-write test to make sure the port exists. */
w = 0xc;
parport_writeb (w, CONTROL (pb));
/* Is there a control register that we can read from? Some
* ports don't allow reads, so read_control just returns a
* software copy. Some ports _do_ allow reads, so bypass the
* software copy here. In addition, some bits aren't
* writable. */
r = parport_readb (CONTROL (pb));
if ((r & 0xf) == w) {
w = 0xe;
parport_writeb (w, CONTROL (pb));
r = parport_readb (CONTROL (pb));
parport_writeb (0xc, CONTROL (pb));
if ((r & 0xf) == w)
return PARPORT_MODE_PCSPP;
}
/* Try the data register. The data lines aren't tri-stated at
* this stage, so we expect back what we wrote. */
w = 0xaa;
parport_gsc_write_data (pb, w);
r = parport_gsc_read_data (pb);
if (r == w) {
w = 0x55;
parport_gsc_write_data (pb, w);
r = parport_gsc_read_data (pb);
if (r == w)
return PARPORT_MODE_PCSPP;
}
return 0;
}
示例12: sml_push_fp
SML_PRIMITIVE void
sml_push_fp()
{
struct sml_control *control = CONTROL();
if (control->frame_stack_top_override != NULL)
FATAL((0, "sml_push_fp overfull"));
control->frame_stack_top_override = CALLER_FRAME_END_ADDRESS();
}
示例13: TerminalDefaultChars
void
TerminalDefaultChars (void)
{
memmove (new_tc.c_cc, old_tc.c_cc, sizeof (old_tc.c_cc));
# ifndef VDISCARD
termFlushChar = CONTROL ('O');
# endif
# ifndef VWERASE
termWerasChar = CONTROL ('W');
# endif
# ifndef VREPRINT
termRprntChar = CONTROL ('R');
# endif
# ifndef VLNEXT
termLiteralNextChar = CONTROL ('V');
# endif
# ifndef VSTART
termStartChar = CONTROL ('Q');
# endif
# ifndef VSTOP
termStopChar = CONTROL ('S');
# endif
# ifndef VSTATUS
termAytChar = CONTROL ('T');
# endif
}
示例14: TerminalSaveState
void
TerminalSaveState (void)
{
tcgetattr (0, &old_tc);
new_tc = old_tc;
#ifndef VDISCARD
termFlushChar = CONTROL ('O');
#endif
#ifndef VWERASE
termWerasChar = CONTROL ('W');
#endif
#ifndef VREPRINT
termRprntChar = CONTROL ('R');
#endif
#ifndef VLNEXT
termLiteralNextChar = CONTROL ('V');
#endif
#ifndef VSTART
termStartChar = CONTROL ('Q');
#endif
#ifndef VSTOP
termStopChar = CONTROL ('S');
#endif
#ifndef VSTATUS
termAytChar = CONTROL ('T');
#endif
}
示例15: TerminalDefaultChars
void TerminalDefaultChars(void) {
#ifndef USE_TERMIO
ntc = otc;
nltc = oltc;
nttyb.sg_kill = ottyb.sg_kill;
nttyb.sg_erase = ottyb.sg_erase;
#else /* USE_TERMIO */
memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
#ifndef VDISCARD
termFlushChar = CONTROL('O');
#endif
#ifndef VWERASE
termWerasChar = CONTROL('W');
#endif
#ifndef VREPRINT
termRprntChar = CONTROL('R');
#endif
#ifndef VLNEXT
termLiteralNextChar = CONTROL('V');
#endif
#ifndef VSTART
termStartChar = CONTROL('Q');
#endif
#ifndef VSTOP
termStopChar = CONTROL('S');
#endif
#ifndef VSTATUS
termAytChar = CONTROL('T');
#endif
#endif /* USE_TERMIO */
}