本文整理汇总了C++中MATCH函数的典型用法代码示例。如果您正苦于以下问题:C++ MATCH函数的具体用法?C++ MATCH怎么用?C++ MATCH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MATCH函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: if
long IRrecv::decodePanasonic(decode_results *results) {
unsigned long long data = 0;
int offset = 1; // Dont skip first space
if (!MATCH_MARK(results->rawbuf[offset], PANASONIC_HDR_MARK)) {
return ERR;
}
offset++;
if (!MATCH_MARK(results->rawbuf[offset], PANASONIC_HDR_SPACE)) {
return ERR;
}
offset++;
// decode address
for (int i = 0; i < PANASONIC_BITS; i++) {
if (!MATCH(results->rawbuf[offset++], PANASONIC_BIT_MARK)) {
return ERR;
}
if (MATCH(results->rawbuf[offset],PANASONIC_ONE_SPACE)) {
data = (data << 1) | 1;
} else if (MATCH(results->rawbuf[offset],PANASONIC_ZERO_SPACE)) {
data <<= 1;
} else {
return ERR;
}
offset++;
}
results->value = (unsigned long)data;
results->panasonicAddress = (unsigned int)(data >> 32);
results->decode_type = PANASONIC;
results->bits = PANASONIC_BITS;
return DECODED;
}
开发者ID:hishamk,项目名称:IRremoteESP8266,代码行数:31,代码来源:IRremoteESP8266.cpp
示例2: MATCH
/* does the event match the tag, followed by a null, space, or slash? */
#define MATCH(event, tag) \
(!strncmp(event, tag, sizeof(tag)-1) && \
(!event[sizeof(tag)-1] || strchr(" /", event[sizeof(tag)-1])))
static const char event_cookie[] = "event_cookie"; /* demo placeholder */
static void* handle_event(void* cookie, const char* event, void* arg) {
#define NS_DEMO "demo:"
if (cookie != event_cookie)
printf("*** bad event cookie %p != %p\n", cookie, event_cookie);
if (xml) {
/* We could almost do a printf(event, arg),
but for the sake of a better demo,
we dress the result up as valid XML.
*/
const char* fmt = strchr(event, ' ');
int evlen = (fmt ? fmt - event : strlen(event));
if (!fmt) {
if (event[0] != '/') {
printf("<"NS_DEMO"%.*s>", evlen, event);
} else {
printf("</"NS_DEMO"%.*s>", evlen-1, event+1);
}
} else {
if (event[0] != '/') {
printf("<"NS_DEMO"%.*s", evlen, event);
printf(fmt, arg);
printf(">");
} else {
printf("<"NS_DEMO"%.*s_done", evlen-1, event+1);
printf(fmt, arg);
printf("/></"NS_DEMO"%.*s>", evlen-1, event+1);
}
}
}
if (MATCH(event, "insn")) {
const char* name = lookup(arg);
if (name) printf("%s:\n", name);
/* basic action for <insn>: */
printf(" %p\t", arg);
} else if (MATCH(event, "/insn")) {
/* basic action for </insn>:
(none, plugin puts the newline for us
*/
} else if (MATCH(event, "mach")) {
printf("Decoding for CPU '%s'\n", (char*) arg);
} else if (MATCH(event, "addr")) {
/* basic action for <addr/>: */
const char* name = lookup(arg);
if (name) {
printf("&%s (%p)", name, arg);
/* return non-null to notify hsdis not to print the addr */
return arg;
}
}
/* null return is always safe; can mean "I ignored it" */
return NULL;
}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:66,代码来源:hsdis-demo.c
示例3: divinglog_fill_sample
static int divinglog_fill_sample(struct sample *sample, const char *name, int len, char *buf)
{
return MATCH(".p.time", sampletime, &sample->time) ||
MATCH(".p.depth", depth, &sample->depth) ||
MATCH(".p.temp", fahrenheit, &sample->temperature) ||
MATCH(".p.press1", psi, &sample->cylinderpressure) ||
0;
}
开发者ID:draco003,项目名称:subsurface,代码行数:8,代码来源:parse-xml.c
示例4: match_these
static FLAG match_these(char *word)
{
if (MATCH(";", word))
return (NONE);
if (MATCH("&", word))
return (JOBS);
return (0);
}
开发者ID:Colliotv,项目名称:42.sh,代码行数:8,代码来源:jobs.c
示例5: uddf_fill_sample
static int uddf_fill_sample(struct sample *sample, const char *name, int len, char *buf)
{
return MATCH(".divetime", sampletime, &sample->time) ||
MATCH(".depth", depth, &sample->depth) ||
MATCH(".temperature", temperature, &sample->temperature) ||
MATCH(".tankpressure", pressure, &sample->cylinderpressure) ||
0;
}
开发者ID:denghuancong,项目名称:subsurface,代码行数:8,代码来源:parse-xml.c
示例6: SCOMP
void
SCOMP(SCOMP_TYPE v1, /* "old" vector to compare */
int n1, /* ...corresponding length */
SCOMP_TYPE v2, /* "new" vector to compare */
int n2, /* ...corresponding length */
int size, /* size of vector-entry */
int (*match) (SCOMP_MATCH_ARGS(p1, p2)),
void (*report) (SCOMP_REPORT_ARGS(p1, p2)))
{
int x, y, z;
int j1, j2;
char *V1 = (char *) v1;
char *V2 = (char *) v2;
int diag, bottom, corner, ok;
j1 = j2 = 0;
while ((j1 < n1) && (j2 < n2)) {
if (MATCH(j1, j2)) {
j1++, j2++;
} else {
corner = (n1 - j1) + (n2 - j2);
ok = 0;
for (diag = 1; !ok && (diag < corner); diag++) {
bottom = j1 + diag;
if (bottom >= n1)
bottom = n1 - 1;
for (y = bottom; y >= j1; y--) {
x = (j1 + diag) - y + j2;
if (x >= n2)
break;
for (z = 0; z < SYNC; z++) {
if ((y + z >= n1)
|| (x + z >= n2)
|| MATCH(y + z, x + z))
ok++;
}
if (ok == SYNC) {
(*report) (v1, j1, y - 1, v2, j2, x - 1);
j1 = y;
j2 = x;
break;
} else
ok = 0;
}
}
if (!ok) /* remainder of file is diff */
break;
}
}
if (j1 < n1) /* deletions on end ? */
(*report) (v1, j1, n1 - 1, v2, n2, n2 - 1);
if (j2 < n2) /* insertions on end ? */
(*report) (v1, n1, n1 - 1, v2, j2, n2 - 1);
}
开发者ID:ThomasDickey,项目名称:td_lib-snapshots,代码行数:58,代码来源:scomp.c
示例7: uemis_fill_sample
static int uemis_fill_sample(struct sample *sample, const char *name, int len, char *buf)
{
return MATCH(".reading.dive_time", sampletime, &sample->time) ||
MATCH(".reading.water_pressure", water_pressure, &sample->depth) ||
MATCH(".reading.active_tank", get_index, &sample->cylinderindex) ||
MATCH(".reading.tank_pressure", centibar, &sample->cylinderpressure) ||
MATCH(".reading.dive_temperature", decicelsius, &sample->temperature) ||
0;
}
开发者ID:draco003,项目名称:subsurface,代码行数:9,代码来源:parse-xml.c
示例8: MATCH
const ImageIOParameter *
ImageSpec::find_attribute (string_view name, ImageIOParameter &tmpparam,
TypeDesc searchtype, bool casesensitive) const
{
ImageIOParameterList::const_iterator iter =
extra_attribs.find (name, searchtype, casesensitive);
if (iter != extra_attribs.end())
return &(*iter);
// Check named items in the ImageSpec structs, not in extra_attrubs
#define MATCH(n,t) (((!casesensitive && Strutil::iequals(name,n)) || \
( casesensitive && name == n)) && \
(searchtype == TypeDesc::UNKNOWN || searchtype == t))
#define GETINT(n) if (MATCH(#n,TypeDesc::TypeInt)) { \
tmpparam.init (#n, TypeDesc::TypeInt, 1, &this->n); \
return &tmpparam; \
}
GETINT(nchannels);
GETINT(width);
GETINT(height);
GETINT(depth);
GETINT(x);
GETINT(y);
GETINT(z);
GETINT(full_width);
GETINT(full_height);
GETINT(full_depth);
GETINT(full_x);
GETINT(full_y);
GETINT(full_z);
GETINT(tile_width);
GETINT(tile_height);
GETINT(tile_depth);
GETINT(alpha_channel);
GETINT(z_channel);
// some special cases
if (MATCH("geom", TypeDesc::TypeString)) {
ustring s = (depth <= 1 && full_depth <= 1)
? ustring::format ("%dx%d%+d%+d", width, height, x, y)
: ustring::format ("%dx%dx%d%+d%+d%+d", width, height, depth, x, y, z);
tmpparam.init ("geom", TypeDesc::TypeString, 1, &s);
return &tmpparam;
}
if (MATCH("full_geom", TypeDesc::TypeString)) {
ustring s = (depth <= 1 && full_depth <= 1)
? ustring::format ("%dx%d%+d%+d",
full_width, full_height, full_x, full_y)
: ustring::format ("%dx%dx%d%+d%+d%+d",
full_width, full_height, full_depth,
full_x, full_y, full_z);
tmpparam.init ("full_geom", TypeDesc::TypeString, 1, &s);
return &tmpparam;
}
#undef GETINT
#undef MATCH
return NULL;
}
开发者ID:jproccia,项目名称:oiio,代码行数:56,代码来源:formatspec.cpp
示例9: parse_notifications_section
static void parse_notifications_section(UTOX_SAVE *config, const char* key, const char* value) {
if (MATCH(NAMEOF(config->audible_notifications_enabled), key)) {
config->audible_notifications_enabled = STR_TO_BOOL(value);
} else if (MATCH(NAMEOF(config->status_notifications), key)) {
config->status_notifications = STR_TO_BOOL(value);
} else if (MATCH(NAMEOF(config->no_typing_notifications), key)) {
config->no_typing_notifications = STR_TO_BOOL(value);
} else if (MATCH(NAMEOF(config->group_notifications), key)) {
config->group_notifications = atoi(value);
}
}
开发者ID:baloo79,项目名称:uTox,代码行数:11,代码来源:settings.c
示例10: parse_general_section
static void parse_general_section(UTOX_SAVE *config, const char* key, const char* value) {
if (MATCH(NAMEOF(config->save_version), key)) {
config->save_version = atoi(value);
} else if (MATCH(NAMEOF(config->utox_last_version), key)) {
config->utox_last_version = atoi(value);
} else if (MATCH(NAMEOF(config->send_version), key)) {
config->send_version = STR_TO_BOOL(value);
} else if (MATCH(NAMEOF(config->update_to_develop), key)) {
config->update_to_develop = STR_TO_BOOL(value);
}
}
开发者ID:baloo79,项目名称:uTox,代码行数:11,代码来源:settings.c
示例11: START_TEST
END_TEST
START_TEST(test_capa_add)
{
char *ex1 = "IMAP4rev1 AUTH=LOGIN AUTH=CRAM-MD5 ACL RIGHTS=texk NAMESPACE CHILDREN SORT QUOTA THREAD=ORDEREDSUBJECT UNSELECT IDLE STARTTLS UIDPLUS WITHIN LOGINDISABLED CONDSTORE LITERAL+ ENABLE QRESYNC";
char *ex2 = "IMAP4rev1 AUTH=LOGIN AUTH=CRAM-MD5 ACL RIGHTS=texk NAMESPACE CHILDREN SORT QUOTA THREAD=ORDEREDSUBJECT UNSELECT IDLE STARTTLS UIDPLUS WITHIN LOGINDISABLED CONDSTORE LITERAL+ ENABLE QRESYNC ID";
Capa_remove(A, "ID");
fail_unless(! Capa_match(A, "ID"), "remove failed\n[%s] !=\n[%s]\n", ex1, Capa_as_string(A));
fail_unless(MATCH(Capa_as_string(A), ex1), "remove failed\n[%s] !=\n[%s]\n", ex1, Capa_as_string(A));
Capa_add(A, "ID");
fail_unless(Capa_match(A, "ID"), "add failed\n[%s] !=\n[%s]\n", ex2, Capa_as_string(A));
fail_unless(MATCH(Capa_as_string(A), ex2), "add failed\n[%s] !=\n[%s]\n", ex2, Capa_as_string(A));
}
开发者ID:Alexander-KI,项目名称:dbmail,代码行数:13,代码来源:check_dbmail_capa.c
示例12: parse_av_section
static void parse_av_section(UTOX_SAVE *config, const char* key, const char* value) {
if (MATCH(NAMEOF(config->push_to_talk), key)) {
config->push_to_talk = STR_TO_BOOL(value);
} else if (MATCH(NAMEOF(config->audio_filtering_enabled), key)) {
config->audio_filtering_enabled = STR_TO_BOOL(value);
} else if (MATCH(NAMEOF(config->audio_device_in), key)) {
config->audio_device_in = atoi(value);
} else if (MATCH(NAMEOF(config->audio_device_out), key)) {
config->audio_device_out = atoi(value);
} else if (MATCH(NAMEOF(config->video_fps), key)) {
config->video_fps = atoi(value);
}
}
开发者ID:baloo79,项目名称:uTox,代码行数:13,代码来源:settings.c
示例13: peek_token
token_type
peek_token (void)
{
token_type result;
int ch = peek_input ();
if (ch == CHAR_EOF)
{
result = TOKEN_EOF;
}
else if (ch == CHAR_MACRO)
{
result = TOKEN_MACDEF;
}
else if (MATCH (ch, bcomm.string, false))
{
result = TOKEN_STRING;
}
else if ((default_word_regexp && (isalpha (ch) || ch == '_'))
#ifdef ENABLE_CHANGEWORD
|| (! default_word_regexp && word_regexp.fastmap[ch])
#endif /* ENABLE_CHANGEWORD */
)
{
result = TOKEN_WORD;
}
else if (MATCH (ch, lquote.string, false))
{
result = TOKEN_STRING;
}
else
switch (ch)
{
case '(':
result = TOKEN_OPEN;
break;
case ',':
result = TOKEN_COMMA;
break;
case ')':
result = TOKEN_CLOSE;
break;
default:
result = TOKEN_SIMPLE;
}
#ifdef DEBUG_INPUT
xfprintf (stderr, "peek_token -> %s\n", token_type_string (result));
#endif /* DEBUG_INPUT */
return result;
}
开发者ID:huther,项目名称:personal_projects,代码行数:51,代码来源:input.c
示例14: MATCH
bool operator==(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y)
{
// the semantics for equality are:
// 1) Values must match exactly
// 2) wildcard's are ignored in the comparison
#define MATCH(name) ((x.name) == 0 || (y.name) == 0 || (x.name) == (y.name))
return
// check the sample rate
MATCH(mSampleRate)
// check the format ids
&& MATCH(mFormatID)
// check the format flags
&& (x.mFormatID == 0 || y.mFormatID == 0 || MATCH(mFormatFlags))
// check the bytes per packet
&& MATCH(mBytesPerPacket)
// check the frames per packet
&& MATCH(mFramesPerPacket)
// check the bytes per frame
&& MATCH(mBytesPerFrame)
// check the channels per frame
&& MATCH(mChannelsPerFrame)
// check the channels per frame
&& MATCH(mBitsPerChannel) ;
}
开发者ID:arnelh,项目名称:Examples,代码行数:33,代码来源:CAAudioStreamBasicDesc.cpp
示例15: divinglog_dive_match
static int divinglog_dive_match(struct dive *dive, const char *name, int len, char *buf)
{
return MATCH(".divedate", divedate, &dive->when) ||
MATCH(".entrytime", divetime, &dive->when) ||
MATCH(".depth", depth, &dive->maxdepth) ||
MATCH(".tanksize", cylindersize, &dive->cylinder[0].type.size) ||
MATCH(".presw", pressure, &dive->cylinder[0].type.workingpressure) ||
MATCH(".comments", utf8_string, &dive->notes) ||
MATCH(".buddy.names", utf8_string, &dive->buddy) ||
MATCH(".country.name", utf8_string, &country) ||
MATCH(".city.name", utf8_string, &city) ||
MATCH(".place.name", divinglog_place, &dive->location) ||
0;
}
开发者ID:draco003,项目名称:subsurface,代码行数:14,代码来源:parse-xml.c
示例16: suunto_dive_match
/*
* Crazy suunto xml. Look at how those o2/he things match up.
*/
static int suunto_dive_match(struct dive *dive, const char *name, int len, char *buf)
{
return MATCH(".o2pct", percent, &dive->cylinder[0].gasmix.o2) ||
MATCH(".hepct_0", percent, &dive->cylinder[0].gasmix.he) ||
MATCH(".o2pct_2", percent, &dive->cylinder[1].gasmix.o2) ||
MATCH(".hepct_1", percent, &dive->cylinder[1].gasmix.he) ||
MATCH(".o2pct_3", percent, &dive->cylinder[2].gasmix.o2) ||
MATCH(".hepct_2", percent, &dive->cylinder[2].gasmix.he) ||
MATCH(".o2pct_4", percent, &dive->cylinder[3].gasmix.o2) ||
MATCH(".hepct_3", percent, &dive->cylinder[3].gasmix.he) ||
MATCH(".cylindersize", cylindersize, &dive->cylinder[0].type.size) ||
MATCH(".cylinderworkpressure", pressure, &dive->cylinder[0].type.workingpressure) ||
0;
}
开发者ID:draco003,项目名称:subsurface,代码行数:17,代码来源:parse-xml.c
示例17: IRLIB_ATTEMPT_MESSAGE
bool IRdecodeNEC::decode(void) {
IRLIB_ATTEMPT_MESSAGE(F("NEC"));
// Check for repeat
if (rawlen == 4 && MATCH(rawbuf[2], NEC_RPT_SPACE) &&
MATCH(rawbuf[3],564)) {
bits = 0;
value = REPEAT;
decode_type = NEC;
return true;
}
if(!decodeGeneric(68, 564*16, 564*8, 0, 564, 564*3, 564)) return false;
decode_type = NEC;
return true;
}
开发者ID:KeyJay86,项目名称:woerdclock-software,代码行数:14,代码来源:IRLib.cpp
示例18: main
int main(void) {
extern int program_buffer;
memset(&program_buffer, 0x00, 0x001d00);
init();
puts("kzload (kozos boot loader) started.\n");
while(1){
static long program_size = -1;
#define CommandSize 16
static char command_buff[CommandSize];
memset(command_buff, 0x00, CommandSize);
puts("kzload> ");
gets(command_buff);
#define MATCH(command) (strcmp(command_buff,command) == 0)
if(MATCH("load")){ // XMODEMでファイルをダウンロード
memset(&program_buffer, 0x00, 0x001d00);
program_size = receive_program((unsigned char*)&program_buffer);
}
else if(MATCH("dump")){
puts("size: "); putxval(program_size, 12);
puts("\n");
dump_h((unsigned char*)&program_buffer, program_size);
}
else if(MATCH("run")) {
const char *ep = elf_load((unsigned char*)&program_buffer);
const void (*entry_point)(void) = (void(*)(void))ep;
if( entry_point == NULL ){
puts("no entry_point.\n");
} else {
puts("start at 0x"); putxval(entry_point, 6); puts("\n");
entry_point();
}
}
else {
puts("unknown command.\n");
}
} // end of while(1)
return 0;
}
开发者ID:tac0x2a,项目名称:MakeEmbeddedOS,代码行数:50,代码来源:main.c
示例19: get_section
static CONFIG_SECTION get_section(const char* section) {
if (MATCH(config_sections[GENERAL_SECTION], section)) {
return GENERAL_SECTION;
} else if (MATCH(config_sections[INTERFACE_SECTION], section)) {
return INTERFACE_SECTION;
} else if (MATCH(config_sections[AV_SECTION], section)) {
return AV_SECTION;
} else if (MATCH(config_sections[NOTIFICATIONS_SECTION], section)) {
return NOTIFICATIONS_SECTION;
} else if (MATCH(config_sections[ADVANCED_SECTION], section)) {
return ADVANCED_SECTION;
} else {
return UNKNOWN_SECTION;
}
}
开发者ID:baloo79,项目名称:uTox,代码行数:15,代码来源:settings.c
示例20: testInput1
void testInput1()
{
RegEx* TheRegEx = 0;
EXPRESSION( "the quick brown fox", 0 );
SHOULD_MATCH( 1, "the quick brown fox" );
MATCH( 0, "the quick brown fox" );
SHOULD_NOT_MATCH("The quick brown FOX");
SHOULD_MATCH( 1, "What do you know about the quick brown fox?" );
MATCH( 0, "the quick brown fox" );
SHOULD_NOT_MATCH("What do you know about THE QUICK BROWN FOX?");
delete TheRegEx;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:15,代码来源:UtlRegex.cpp
注:本文中的MATCH函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论