本文整理汇总了C++中check_config函数的典型用法代码示例。如果您正苦于以下问题:C++ check_config函数的具体用法?C++ check_config怎么用?C++ check_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: INV
std::string
impl::check_requirements(const atf::tests::vars_map& metadata,
const atf::tests::vars_map& config)
{
std::string failure_reason = "";
for (atf::tests::vars_map::const_iterator iter = metadata.begin();
failure_reason.empty() && iter != metadata.end(); iter++) {
const std::string& name = (*iter).first;
const std::string& value = (*iter).second;
INV(!value.empty()); // Enforced by application/X-atf-tp parser.
if (name == "require.arch")
failure_reason = check_arch(value);
else if (name == "require.config")
failure_reason = check_config(value, config);
else if (name == "require.machine")
failure_reason = check_machine(value);
else if (name == "require.progs")
failure_reason = check_progs(value);
else if (name == "require.user")
failure_reason = check_user(value, config);
else {
// Unknown require.* properties are forbidden by the
// application/X-atf-tp parser.
INV(failure_reason.find("require.") != 0);
}
}
return failure_reason;
}
开发者ID:w796933,项目名称:bind99damp,代码行数:31,代码来源:requirements.cpp
示例2: check_config
/*****************************************************************************
全サーボ設定
*****************************************************************************/
bool CGainer::SetServoAll(const std::vector<WORD> &data)
{
check_config();
int limit = 8;
if ( m_config != 8 ) { return false; }
std::string c("P");
char buf[32];
size_t n = data.size();
if ( n > limit ) {
n = limit;
}
for ( size_t i = 0 ; i < n ; ++i ) {
sprintf(buf,"%02X",data[i]);
c += buf;
}
int diff = limit - n;
while ( diff > 0 ) {
c += "00";
--diff;
}
c += "*";
return command_send(c).size() != 0;
}
开发者ID:82488059,项目名称:csaori,代码行数:32,代码来源:gainercxx.cpp
示例3: main123
/*
* main:
* -----
*/
int main123(int argc, char **argv)
{
time_t end_time;
int raw = 0;
int mono_from_stereo = 0;
printf("Shine v1.08 19/06/03\n");
time(&config.start_time);
set_defaults();
if (!parse_command(argc, argv, &raw, &mono_from_stereo))
print_usage();
wave_open(raw, mono_from_stereo); /* prints wave (input) configuration */
check_config(); /* prints mpeg (output) configuration */
printf("Encoding \"%s\" to \"%s\"\n", config.infile, config.outfile);
L3_compress();
wave_close();
time(&end_time);
end_time -= config.start_time;
printf(" Finished in %2ld:%2ld:%2ld\n",
end_time/3600,(end_time/60)%60,end_time%60);
return 0;
}
开发者ID:Mjiulee,项目名称:jobMeetY,代码行数:35,代码来源:mp3encoder.c
示例4: init
static AS3_Val init(void * self, AS3_Val args)
{
void * ref;
void * src;
void * dest;
AS3_ArrayValue(args, "AS3ValType, AS3ValType, AS3ValType", &ref, &src, &dest);
flashErrorsRef = (AS3_Val)ref;
config.wave.file = funopen((void *)src, readByteArray, writeByteArray, seekByteArray, closeByteArray);
config.wave.output = funopen((void *)dest, readByteArray, writeByteArray, seekByteArray, closeByteArray);
if (config.wave.file == NULL || config.wave.output == NULL) {
ERROR("Unable to set bytes arrays");
}
wave_open();
set_defaults();
check_config();
start_compress();
return AS3_Int(1);
}
开发者ID:Glideh,项目名称:jfrec,代码行数:26,代码来源:main.c
示例5: load_config
int load_config(const char *filename, config *conf)
{
FILE* fp;
char line[1024];
memset(conf, 0, sizeof(config));
/* Open config file */
fp = fopen(filename, "r+");
if (fp == NULL)
{
perror("Config file open failed!");
return EXIT_FAILURE;
}
/* Read config file */
while (fgets(line, 1024, fp))
{
if ( (parse_line(line, conf)) != EXIT_SUCCESS)
{
fprintf(stderr, "Config file structure is not appropriate");
return EXIT_FAILURE;
}
} /* end while */
fclose(fp);
return check_config(*conf);
}
开发者ID:kocsob,项目名称:linux-webserver,代码行数:29,代码来源:config.c
示例6: log10
CRefresher::CRefresher(const char * rconfig_file)
{
//by cm
config_error = false;
if( !rconfig.init(rconfig_file) )
{
#ifdef _TEST
cout << "config error" << endl
<< "please check your config file" << endl;
#endif
config_error = true;
}
else
{
//compute file suffix:
float tmp = log10((float(rconfig.max_timeout))/(float(rconfig.min_timeout))) / log10(float(rconfig.step));
float suffix = tmp -(int)tmp;
int file_num;
if(suffix >= 0.5) //sometimes tmp == 4.9999....so have to do this
file_num = 2 + (int)tmp;
else
file_num = 1 + (int)tmp;
filesuffix = new FileSuffix( file_num );
/*
changelog = fopen("log.change","a");
deletelog = fopen("log.delete","a");
newlog = fopen("log.new","a");
*/
config_changed = false;
if(check_config())
config_changed = true;
init();
}
}
开发者ID:Patrickxzm,项目名称:P_Arthur,代码行数:35,代码来源:refresher.cpp
示例7: fs_store
ret_code_t fs_store(fs_config_t const * p_config,
uint32_t const * p_addr,
uint32_t const * const p_data,
fs_length_t length_words)
{
if ((m_flags & FS_FLAG_INIT) == 0)
{
return NRF_ERROR_INVALID_STATE;
}
if (!check_config(p_config))
{
return NRF_ERROR_FORBIDDEN;
}
if (!is_word_aligned(p_addr))
{
return NRF_ERROR_INVALID_ADDR;
}
// Check that the erase operation is on pages owned by this user (configuration).
if ((p_addr < p_config->p_start_addr) || ((p_addr + length_words) > p_config->p_end_addr))
{
return NRF_ERROR_INVALID_ADDR;
}
return cmd_enqueue(p_config, FS_OP_STORE, p_addr, p_data, length_words);
}
开发者ID:CarrieTung,项目名称:mbed,代码行数:28,代码来源:fstorage.c
示例8: load_config
void load_config(char * path)
{
int i;
char *p;
//__android_log_print(ANDROID_LOG_DEBUG, "org.rin", "path in load_config: %s",path);
jfile fd = jfopen(env_game_thread, path, JF_MODE_READ, NULL, 0);
if(!fd)
{
init_config();
return;
}
memset(&setting, 0, sizeof(setting));
jfread(env_game_thread, fd, &setting, sizeof(setting));
jfclose(env_game_thread, fd);
tmpsetting = setting;
memcpy(m_pal16[PAL_CUSTOM_LOCAL],setting.custom_palette, sizeof(short)*4*3);
check_config();
set_gb_type();
set_speed(setting.speed);
}
开发者ID:BelmonduS,项目名称:rin,代码行数:26,代码来源:saveload.c
示例9: fs_erase
ret_code_t fs_erase(fs_config_t const * p_config,
uint32_t * const p_addr,
fs_length_t const length_words)
{
if ((m_flags & FS_FLAG_INIT) == 0)
{
return NRF_ERROR_INVALID_STATE;
}
if (!check_config(p_config))
{
return NRF_ERROR_FORBIDDEN;
}
/** Check that the address is aligned on a page boundary and the length to erase
* is a multiple of the page size. */
if (((uint32_t)p_addr & (FS_PAGE_SIZE - 1)) ||
(length_words & (FS_PAGE_SIZE_WORDS - 1)))
{
return NRF_ERROR_INVALID_ADDR;
}
// Check that the erase operation is on pages owned by this user (configuration).
if ((p_addr < p_config->p_start_addr) || ((p_addr + length_words) > p_config->p_end_addr))
{
return NRF_ERROR_INVALID_ADDR;
}
return cmd_enqueue(p_config, FS_OP_ERASE, p_addr, NULL, length_words);
}
开发者ID:BLEHexapod,项目名称:nrf_sdk,代码行数:30,代码来源:fstorage.c
示例10: inotify_handler
static void inotify_handler(int fd, short args, void *cbdata)
{
struct {
struct inotify_event ev;
char filename_buffer[4096];
} data;
int sz;
struct timespec tp={0, 100000};
sz= read(fd, &data, sizeof(data));
if (sz >= sizeof(data.ev)) {
OPAL_OUTPUT_VERBOSE((2, orcm_cfgi_base.output,
"%s Inotify Event: name %s type %d",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
data.ev.name, data.ev.mask));
/* if the event involves a typical editor swap
* file, ignore it
*/
if (NULL != strstr(data.ev.name, ".swp") ||
NULL != strchr(data.ev.name, '~')) {
/* vi swap */
OPAL_OUTPUT_VERBOSE((2, orcm_cfgi_base.output,
"%s Inotify Event: Ignoring .swp file",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
return;
}
if ('.' == data.ev.name[0]) {
/* special file */
OPAL_OUTPUT_VERBOSE((2, orcm_cfgi_base.output,
"%s Inotify Event: Ignoring dot-file",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
return;
}
if ('#' == data.ev.name[0]) {
/* emacs auto-save */
OPAL_OUTPUT_VERBOSE((2, orcm_cfgi_base.output,
"%s Ignoring emacs auto-save file",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
return;
}
/* ensure that editors have a chance to cleanly
* exit before reading the config so we don't
* destabilize the parser
*/
nanosleep(&tp, NULL);
check_config(0, 0, NULL);
} else if (sz < 0) {
OPAL_OUTPUT_VERBOSE((2, orcm_cfgi_base.output,
"%s Inotify Event: READ ERROR",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); /* EINVAL: short of space */
return;
} else {
OPAL_OUTPUT_VERBOSE((2, orcm_cfgi_base.output,
"%s Inotify Event: Short read: %d",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), sz));
}
}
开发者ID:bringhurst,项目名称:orcm,代码行数:59,代码来源:cfgi_file.c
示例11: main
int main(int argc, char *argv[])
{
char ch;
int ret = EXIT_FAILURE;
struct sc_config config;
config.in_place = 0;
config.file[FILE_DIC] = DEFAULT_DICTIONARY;
while ((ch = getopt(argc, argv, "d:hi:o:pv")) != -1) {
switch (ch) {
case 'd':
config.file[FILE_DIC] = optarg;
break;
case 'h':
print_content(SC_FILE_HELP);
return EXIT_SUCCESS;
case 'i':
config.file[FILE_DOC] = optarg;
break;
case 'o':
if (config.in_place) {
log_fatal("output file cannot be specified "
"if in-place edit is asked for");
return EXIT_FAILURE;
}
config.file[FILE_OUT] = optarg;
break;
case 'p':
if (config.file[FILE_OUT]) {
log_fatal("document cannot be edited in place "
"if output file is specified");
return EXIT_FAILURE;
}
config.in_place = 1;
break;
case 'v':
print_content(SC_FILE_VERSION);
return EXIT_SUCCESS;
default:
print_content(SC_FILE_HELP);
return EXIT_FAILURE;
}
}
if (check_config(&config, argc, argv)) {
print_content(SC_FILE_HELP);
goto ERROR;
}
if (spell_check(&config))
goto ERROR;
print_content(SC_FILE_BANNER);
ret = EXIT_SUCCESS;
ERROR:
if (config.file[FILE_OUT])
free(config.file[FILE_OUT]);
return ret;
}
开发者ID:ghorbanzade,项目名称:spell-checker,代码行数:59,代码来源:spell-check.c
示例12: GNUNET_RESOLVER_connect
/**
* Create the connection to the resolver service.
*
* @param cfg configuration to use
*/
void
GNUNET_RESOLVER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_assert (NULL != cfg);
backoff = GNUNET_TIME_UNIT_MILLISECONDS;
resolver_cfg = cfg;
check_config ();
}
开发者ID:amatus,项目名称:gnunet-debian,代码行数:13,代码来源:resolver_api.c
示例13: fs_store
fs_ret_t fs_store(fs_config_t const * const p_config,
uint32_t const * const p_dest,
uint32_t const * const p_src,
uint16_t const length_words)
{
fs_op_t * p_op;
if (!(m_flags & FS_FLAG_INITIALIZED))
{
return FS_ERR_NOT_INITIALIZED;
}
if (!check_config(p_config))
{
return FS_ERR_INVALID_CFG;
}
if ((p_src == NULL) || (p_dest == NULL))
{
return FS_ERR_NULL_ARG;
}
// Check that both pointers are word aligned.
if (((uint32_t)p_src & 0x03) ||
((uint32_t)p_dest & 0x03))
{
return FS_ERR_UNALIGNED_ADDR;
}
// Check that the operation doesn't go outside the client's memory boundaries.
if ((p_config->p_start_addr > p_dest) ||
(p_config->p_end_addr < (p_dest + length_words)))
{
return FS_ERR_INVALID_ADDR;
}
if (length_words == 0)
{
return FS_ERR_INVALID_ARG;
}
if (!queue_get_next_free(&p_op))
{
return FS_ERR_QUEUE_FULL;
}
// Initialize the operation.
p_op->p_config = p_config;
p_op->op_code = FS_OP_STORE;
p_op->store.p_src = p_src;
p_op->store.p_dest = p_dest;
p_op->store.length_words = length_words;
queue_start();
return FS_SUCCESS;
}
开发者ID:JakeChenCCB,项目名称:Smart-Bike,代码行数:57,代码来源:fstorage.c
示例14: GNUNET_RESOLVER_hostname_get
/**
* Get an IP address as a string.
*
* @param sa host address
* @param salen length of host address in @a sa
* @param do_resolve use #GNUNET_NO to return numeric hostname
* @param timeout how long to try resolving
* @param callback function to call with hostnames
* last callback is NULL when finished
* @param cls closure for @a callback
* @return handle that can be used to cancel the request
*/
struct GNUNET_RESOLVER_RequestHandle *
GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
socklen_t salen,
int do_resolve,
struct GNUNET_TIME_Relative timeout,
GNUNET_RESOLVER_HostnameCallback callback,
void *cls)
{
struct GNUNET_RESOLVER_RequestHandle *rh;
size_t ip_len;
const void *ip;
check_config ();
switch (sa->sa_family)
{
case AF_INET:
GNUNET_assert (salen == sizeof (struct sockaddr_in));
ip_len = sizeof (struct in_addr);
ip = &((const struct sockaddr_in*)sa)->sin_addr;
break;
case AF_INET6:
GNUNET_assert (salen == sizeof (struct sockaddr_in6));
ip_len = sizeof (struct in6_addr);
ip = &((const struct sockaddr_in6*)sa)->sin6_addr;
break;
default:
GNUNET_break (0);
return NULL;
}
rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + salen);
rh->name_callback = callback;
rh->cls = cls;
rh->af = sa->sa_family;
rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
memcpy (&rh[1], ip, ip_len);
rh->data_len = ip_len;
rh->direction = GNUNET_YES;
rh->received_response = GNUNET_NO;
if (GNUNET_NO == do_resolve)
{
rh->task = GNUNET_SCHEDULER_add_now (&numeric_reverse, rh);
return rh;
}
GNUNET_CONTAINER_DLL_insert_tail (req_head,
req_tail,
rh);
rh->was_queued = GNUNET_YES;
if (NULL != s_task)
{
GNUNET_SCHEDULER_cancel (s_task);
s_task = NULL;
}
process_requests ();
return rh;
}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:67,代码来源:resolver_api.c
示例15: setup
/*
* setup() - performs all ONE TIME setup for this test
*/
void setup(void)
{
tst_sig(NOFORK, DEF_HANDLER, cleanup);
check_config(TEST_NODES);
/* Pause if that option was specified
* TEST_PAUSE contains the code to fork the test with the -c option.
*/
TEST_PAUSE;
}
开发者ID:GOEUM,项目名称:ltp,代码行数:14,代码来源:move_pages01.c
示例16: fs_erase
fs_ret_t fs_erase(fs_config_t const * const p_config,
uint32_t const * const p_page_addr,
uint16_t const num_pages)
{
fs_op_t * p_op;
if (!(m_flags & FS_FLAG_INITIALIZED))
{
return FS_ERR_NOT_INITIALIZED;
}
if (!check_config(p_config))
{
return FS_ERR_INVALID_CFG;
}
if (p_page_addr == NULL)
{
return FS_ERR_NULL_ARG;
}
// Check that the page is aligned to a page boundary.
if (((uint32_t)p_page_addr % FS_PAGE_SIZE) != 0)
{
return FS_ERR_UNALIGNED_ADDR;
}
// Check that the operation doesn't go outside the client's memory boundaries.
if ((p_page_addr < p_config->p_start_addr) ||
(p_page_addr + (FS_PAGE_SIZE_WORDS * num_pages) > p_config->p_end_addr))
{
return FS_ERR_INVALID_ADDR;
}
if (num_pages == 0)
{
return FS_ERR_INVALID_ARG;
}
if (!queue_get_next_free(&p_op))
{
return FS_ERR_QUEUE_FULL;
}
// Initialize the operation.
p_op->p_config = p_config;
p_op->op_code = FS_OP_ERASE;
p_op->erase.page = ((uint32_t)p_page_addr / FS_PAGE_SIZE);
p_op->erase.pages_to_erase = num_pages;
queue_start();
return FS_SUCCESS;
}
开发者ID:JakeChenCCB,项目名称:Smart-Bike,代码行数:54,代码来源:fstorage.c
示例17: LED
/*****************************************************************************
LED(h/l)
*****************************************************************************/
bool CGainer::SetLED(bool isOn)
{
check_config();
if ( isOn ) {
return command_send("h*").size() != 0;
}
else {
return command_send("l*").size() != 0;
}
}
开发者ID:82488059,项目名称:csaori,代码行数:14,代码来源:gainercxx.cpp
示例18: config_init
static int config_init(const char *file)
{
GKeyFile *config;
config = load_config(file);
check_config(config);
parse_config(config);
if (config != NULL)
g_key_file_free(config);
return 0;
}
开发者ID:plundstr,项目名称:connman,代码行数:12,代码来源:main.c
示例19: sep_setconf_ind
static gboolean sep_setconf_ind(struct avdtp *session,
struct avdtp_local_sep *sep,
struct avdtp_stream *stream,
GSList *caps,
avdtp_set_configuration_cb cb,
void *user_data)
{
struct a2dp_endpoint *endpoint = user_data;
struct a2dp_device *dev;
struct a2dp_preset *preset = NULL;
DBG("");
dev = find_device_by_session(session);
if (!dev) {
error("Unable to find device for session %p", session);
return FALSE;
}
for (; caps != NULL; caps = g_slist_next(caps)) {
struct avdtp_service_capability *cap = caps->data;
struct avdtp_media_codec_capability *codec;
if (cap->category == AVDTP_DELAY_REPORTING)
return FALSE;
if (cap->category != AVDTP_MEDIA_CODEC)
continue;
codec = (struct avdtp_media_codec_capability *) cap->data;
if (codec->media_codec_type != endpoint->codec)
return FALSE;
preset = g_new0(struct a2dp_preset, 1);
preset->len = cap->length - sizeof(*codec);
preset->data = g_memdup(codec->data, preset->len);
if (check_config(endpoint, preset) < 0) {
preset_free(preset);
return FALSE;
}
}
if (!preset)
return FALSE;
setup_add(dev, endpoint, preset, stream);
cb(session, stream, NULL);
return TRUE;
}
开发者ID:BirdAndEarth,项目名称:RPi,代码行数:53,代码来源:a2dp.c
示例20: setup_config
static int setup_config(int type)
{
int rv;
rv = read_config(cl.configfile, type);
if (rv < 0)
goto out;
if (is_auth_req()) {
rv = read_authkey();
if (rv < 0)
goto out;
#if HAVE_LIBGCRYPT
if (!gcry_check_version(NULL)) {
log_error("gcry_check_version");
rv = -ENOENT;
goto out;
}
gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif
}
/* Set "local" pointer, ignoring errors. */
if (cl.type == DAEMON && cl.site[0]) {
if (!find_site_by_name(cl.site, &local, 1)) {
log_error("Cannot find \"%s\" in the configuration.",
cl.site);
return -EINVAL;
}
local->local = 1;
} else
find_myself(NULL, type == CLIENT || type == GEOSTORE);
rv = check_config(type);
if (rv < 0)
goto out;
/* Per default the PID file name is derived from the
* configuration name. */
if (!cl.lockfile[0]) {
snprintf(cl.lockfile, sizeof(cl.lockfile)-1,
"%s/%s.pid", BOOTH_RUN_DIR, booth_conf->name);
}
out:
return rv;
}
开发者ID:inouekazu,项目名称:booth,代码行数:50,代码来源:main.c
注:本文中的check_config函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论