本文整理汇总了C++中process_commands函数的典型用法代码示例。如果您正苦于以下问题:C++ process_commands函数的具体用法?C++ process_commands怎么用?C++ process_commands使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process_commands函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char **argv)
{
struct gengetopt_args_info opts;
struct vfi_source *s;
struct vfi_dev *dev;
vfi_open(&dev,NULL,opts.timeout_arg);
cmdline_parser_init(&opts);
cmdline_parser(argc,argv,&opts);
if (opts.file_given) {
vfi_setup_file(dev,&s,fopen(opts.file_arg,"r"));
process_commands(dev,s,&opts);
}
if (opts.inputs_num) {
setup_inputs(dev,&s,&opts);
process_commands(dev,s,&opts);
}
if (opts.interactive_given) {
vfi_setup_file(dev,&s,stdin);
process_commands(dev,s,&opts);
}
vfi_close(dev);
return 0;
}
示例2: srvmgr_module_run
int srvmgr_module_run(char *base_path, char *data, int authorized)
{
char config_file[BUFSIZE];
tTokenizer t;
int ret;
if (strncmp(data, MODULE_KEYWORD, strlen(MODULE_KEYWORD)) != 0)
return -ENOTSUP;
DPRINTF("[%s] Input data: '%s' ( user %s authorized )\n", MODULE_IDENTIFICATION,
data, authorized ? "is" : "NOT");
t = tokenize(data);
if (t.numTokens == 0)
return -EINVAL;
snprintf(config_file, sizeof(config_file), "%s/manager.conf", base_path);
if (access(config_file, R_OK) != 0) {
DPRINTF("%s: Cannot read configuration file '%s'\n", __FUNCTION__,
config_file);
free_tokens(t);
return -EINVAL;
}
ret = process_commands(config_file, authorized, t);
free_tokens(t);
return ret;
}
示例3: process_commands
void zmq::socket_base_t::in_event ()
{
// Process any commands from other threads/sockets that may be available
// at the moment. Ultimately, socket will be destroyed.
process_commands (false, false);
check_destroy ();
}
示例4: get_command
void get_command() {
if ( pc.readable() ) {
serial_char = pc.getc();
if (serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) ) {
if (!serial_count) {
return; //empty line
}
cmdbuffer[serial_count] = 0; //terminate string
process_commands();
comment_mode = false; //for new command
serial_count = 0; //clear buffer
//Serial.println("ok");
} else {
if (serial_char == ';') {
comment_mode = true;
}
if (!comment_mode) {
cmdbuffer[serial_count++] = serial_char;
}
}
}
}
示例5: rn42_task
/******************************************************************************
rn42_task
*//**
@brief Handles receiving data from the RN42 bluetooth module.
******************************************************************************/
void
rn42_task(void)
{
static bool connected = false;
bool current_status = rn42_connected();
if (connected != current_status)
{
connected = current_status;
if (connected)
{
LED_On(LED1);
}
else
{
LED_Off(LED1);
}
}
if (connected)
{
process_commands();
}
}
示例6: DriverPriorityQueue
DriverPriorityQueue() : q(regular_gt){
std::string allowable[] = {"r","R",""};
bool (*gt)(const std::string& a, const std::string& b);
gt = (ics::prompt_string("Enter comparison for Priority Queue: r[egular] or R[everse]\n regular means smaller values have higher priority","r",allowable) =="r" ? regular_gt : reverse_gt);
q = PriorityQueueType(gt);
process_commands("");
};
示例7: process_commands
int zmq::socket_base_t::term_endpoint (const char *addr_)
{
// Check whether the library haven't been shut down yet.
if (unlikely (ctx_terminated)) {
errno = ETERM;
return -1;
}
// Check whether endpoint address passed to the function is valid.
if (unlikely (!addr_)) {
errno = EINVAL;
return -1;
}
// Process pending commands, if any, since there could be pending unprocessed process_own()'s
// (from launch_child() for example) we're asked to terminate now.
int rc = process_commands (0, false);
if (unlikely (rc != 0))
return -1;
// Parse addr_ string.
std::string protocol;
std::string address;
if (parse_uri (addr_, protocol, address) || check_protocol (protocol))
return -1;
// Disconnect an inproc socket
if (protocol == "inproc") {
if (unregister_endpoint (std::string (addr_), this) == 0)
return 0;
std::pair <inprocs_t::iterator, inprocs_t::iterator> range = inprocs.equal_range (std::string (addr_));
if (range.first == range.second) {
errno = ENOENT;
return -1;
}
for (inprocs_t::iterator it = range.first; it != range.second; ++it)
it->second->terminate (true);
inprocs.erase (range.first, range.second);
return 0;
}
// Find the endpoints range (if any) corresponding to the addr_ string.
std::pair <endpoints_t::iterator, endpoints_t::iterator> range = endpoints.equal_range (std::string (addr_));
if (range.first == range.second) {
errno = ENOENT;
return -1;
}
for (endpoints_t::iterator it = range.first; it != range.second; ++it) {
// If we have an associated pipe, terminate it.
if (it->second.second != NULL)
it->second.second->terminate (false);
term_child (it->second.first);
}
endpoints.erase (range.first, range.second);
return 0;
}
示例8: process_commands
int zmq::socket_base_t::getsockopt (int option_, void *optval_,
size_t *optvallen_)
{
if (unlikely (ctx_terminated)) {
errno = ETERM;
return -1;
}
if (option_ == ZMQ_RCVMORE) {
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
}
*((int*) optval_) = rcvmore ? 1 : 0;
*optvallen_ = sizeof (int);
return 0;
}
if (option_ == ZMQ_FD) {
if (*optvallen_ < sizeof (fd_t)) {
errno = EINVAL;
return -1;
}
*((fd_t*) optval_) = mailbox.get_fd ();
*optvallen_ = sizeof (fd_t);
return 0;
}
if (option_ == ZMQ_EVENTS) {
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
}
int rc = process_commands (0, false);
if (rc != 0 && (errno == EINTR || errno == ETERM))
return -1;
errno_assert (rc == 0);
*((int*) optval_) = 0;
if (has_out ())
*((int*) optval_) |= ZMQ_POLLOUT;
if (has_in ())
*((int*) optval_) |= ZMQ_POLLIN;
*optvallen_ = sizeof (int);
return 0;
}
if (option_ == ZMQ_LAST_ENDPOINT) {
if (*optvallen_ < last_endpoint.size () + 1) {
errno = EINVAL;
return -1;
}
strcpy (static_cast <char *> (optval_), last_endpoint.c_str ());
*optvallen_ = last_endpoint.size () + 1;
return 0;
}
return options.getsockopt (option_, optval_, optvallen_);
}
示例9: process_commands
int zmq::socket_base_t::getsockopt (int option_, void *optval_,
size_t *optvallen_)
{
if (unlikely (ctx_terminated)) {
errno = ETERM;
return -1;
}
if (option_ == ZMQ_RCVLABEL) {
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
}
*((int*) optval_) = rcvlabel ? 1 : 0;
*optvallen_ = sizeof (int);
return 0;
}
if (option_ == ZMQ_RCVMORE) {
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
}
*((int*) optval_) = rcvmore ? 1 : 0;
*optvallen_ = sizeof (int);
return 0;
}
if (option_ == ZMQ_FD) {
if (*optvallen_ < sizeof (fd_t)) {
errno = EINVAL;
return -1;
}
*((fd_t*) optval_) = mailbox.get_fd ();
*optvallen_ = sizeof (fd_t);
return 0;
}
if (option_ == ZMQ_EVENTS) {
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
}
int rc = process_commands (0, false);
if (rc != 0 && (errno == EINTR || errno == ETERM))
return -1;
errno_assert (rc == 0);
*((int*) optval_) = 0;
if (has_out ())
*((int*) optval_) |= ZMQ_POLLOUT;
if (has_in ())
*((int*) optval_) |= ZMQ_POLLIN;
*optvallen_ = sizeof (int);
return 0;
}
return options.getsockopt (option_, optval_, optvallen_);
}
示例10: process_commands
int zmq::socket_base_t::send (::zmq_msg_t *msg_, int flags_)
{
// Check whether the library haven't been shut down yet.
if (unlikely (ctx_terminated)) {
errno = ETERM;
return -1;
}
// Check whether message passed to the function is valid.
if (unlikely ((msg_->flags | ZMQ_MSG_MASK) != 0xff)) {
errno = EFAULT;
return -1;
}
// Process pending commands, if any.
int rc = process_commands (false, true);
if (unlikely (rc != 0))
return -1;
// At this point we impose the MORE flag on the message.
if (flags_ & ZMQ_SNDMORE)
msg_->flags |= ZMQ_MSG_MORE;
// Try to send the message.
rc = xsend (msg_, flags_);
if (rc == 0)
return 0;
// In case of non-blocking send we'll simply propagate
// the error - including EAGAIN - upwards.
if (flags_ & ZMQ_NOBLOCK)
return -1;
// Oops, we couldn't send the message. Wait for the next
// command, process it and try to send the message again.
while (rc != 0) {
if (errno != EAGAIN)
return -1;
if (unlikely (process_commands (true, false) != 0))
return -1;
rc = xsend (msg_, flags_);
}
return 0;
}
示例11: gcode_loop
void gcode_loop(void) {
if (buflen < (BUFSIZE - 1))
get_command();
if (buflen) {
process_commands();
buflen = (buflen - 1);
bufindr = (bufindr + 1) % BUFSIZE;
}
}
示例12: main
int main(int argc,char ** argv)
{
daemon_init();
for (;;)
{
process_commands();
sleep(10);
}
return 0;
}
示例13: main
/*************************M*A*I*N*************************/
int main(void) {
turtle_t boo;
pen_t pen;
srand(time(NULL));
set_ps_header(HEIGHT, WIDTH);
process_commands(&boo, &pen);
set_ps_display();
return 0;
}
示例14: main
int main(int argc, char *argv[])
{
init();
if(init_setting() != 0){
print_errmsg("ERROR: SETTING init fail. \n");
return 1;
}
if(gc_init() != 0){
print_errmsg("ERROR: G_CODE init fail. \n");
return 1;
}
if (cm_init() == false)
{
print_errmsg("ERROR: USB-DEV init fail. \n");
return 1;
}
if (cmd_init() == false)
{
print_errmsg("ERROR: G code init fail.\n");
cm_close();
return 1;
}
if (tp_init() == false)
{
print_errmsg("ERROR: Temperature library init fail. \n");
cmd_close();
cm_close();
return 1;
}
plan_init();
Config_ResetDefault();
st_init();
while(1) {
LCD(10UL);
getCommand(10UL);
process_commands(50UL);
stepper(1000L);
manageHeater(10UL);
}
st_close();
plan_close();
tp_close();
cmd_close();
cm_close();
//debug
//sfp_close();
return 0;
}
示例15: process_commands
int zmq::socket_base_t::send (::zmq_msg_t *msg_, int flags_)
{
//LOGD() << "zmq::socket_base_t::send" << LOG_ENDL();
if (unlikely (ctx_terminated)) {
errno = ETERM;
return -1;
}
// Process pending commands, if any.
int rc = process_commands (false, true);
if (unlikely (rc != 0))
return -1;
// At this point we impose the MORE flag on the message.
if (flags_ & ZMQ_SNDMORE)
msg_->flags |= ZMQ_MSG_MORE;
// Try to send the message.
rc = xsend (msg_, flags_);
if (rc == 0)
return 0;
// In case of non-blocking send we'll simply propagate
// the error - including EAGAIN - upwards.
if (flags_ & ZMQ_NOBLOCK)
return -1;
// Oops, we couldn't send the message. Wait for the next
// command, process it and try to send the message again.
while (rc != 0) {
if (errno != EAGAIN)
return -1;
if (unlikely (process_commands (true, false) != 0))
return -1;
rc = xsend (msg_, flags_);
}
return 0;
}