本文整理汇总了C++中VALID函数的典型用法代码示例。如果您正苦于以下问题:C++ VALID函数的具体用法?C++ VALID怎么用?C++ VALID使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VALID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void initialize()
{
static int a_buf[7*FIELDS], *a = a_buf;
static int ac_buf[7*FIELDS], *ac = ac_buf;
static const int dr[8] = { -1, 0, 0, +1, -1, -1, +1, +1 };
static const int dc[8] = { 0, -1, +1, 0, -1, +1, -1, +1 };
int r1, c1, r2, c2, d;
for (r1 = 0; r1 < 7; ++r1)
{
for (c1 = 0; c1 < 7; ++c1)
{
sprintf(field_str[POS(r1,c1)], "%c%c", 'a' + c1, '1' + r1);
adjacent[POS(r1,c1)] = a;
adjacent_capture[POS(r1,c1)] = ac;
for (d = 0; d < ((POS(r1,c1)&1) ? 4 : 8); ++d)
{
r2 = r1 + dr[d];
c2 = c1 + dc[d];
if (VALID(r2, c2))
{
*a++ = POS(r2,c2);
if (VALID(r2 + dr[d], c2 + dc[d]))
*ac++ = POS(r2,c2);
}
}
*a++ = -1;
*ac++ = -1;
}
}
}
示例2: StrMatchCase
/*************************************************************************
* StrMatchCase
*/
int StrMatchCase(char *string, char *pattern)
{
assert(VALID(string));
assert(VALID(pattern));
for (; ('*' != *pattern); ++pattern, ++string)
{
if (NIL == *string)
{
return (NIL == *pattern);
}
if ((*string != *pattern)
&& ('?' != *pattern))
{
return FALSE;
}
}
/* two-line patch to prevent *too* much recursiveness: */
while ('*' == pattern[1])
pattern++;
do
{
if ( StrMatchCase(string, &pattern[1]) )
{
return TRUE;
}
}
while (*string++);
return FALSE;
}
示例3: StrEqualMax
/*************************************************************************
* StrEqualMax
*/
int StrEqualMax(const char *first, size_t max, const char *second)
{
assert(VALID(first));
assert(VALID(second));
if (VALID(first) && VALID(second))
{
#if defined(USE_STRNCASECMP)
return (0 == strncasecmp(first, second, max));
#else
/* Not adequately tested yet */
size_t cnt = 0;
while ((*first != NIL) && (*second != NIL) && (cnt <= max))
{
if (toupper(*first) != toupper(*second))
{
break;
}
first++;
second++;
cnt++;
}
return ((cnt == max) || ((*first == NIL) && (*second == NIL)));
#endif
}
return FALSE;
}
示例4: main
int main()
{
printf("%d, %d, %d\n",DAYS(2010,2),DAYS(2010,8),DAYS(2010,11));
printf("%d,%d\n", VALID(2010,2,29),VALID(2020,2,29));
return 0;
}
示例5: assert
/*************************************************************************
* StrAppendMax
*/
char *StrAppendMax(char *target, size_t max, const char *source)
{
assert(VALID(target));
assert(VALID(source));
assert(max > 0);
max -= StrLength(target) + 1;
return (max > 0) ? strncat(target, source, max) : target;
}
示例6: jx_pointer_clone
void jx_pointer_clone(const jx_pointer *self, jx_pointer *out_clone) {
VALID(self);
/* point to the same data */
out_clone->data = self->data;
/* increment the reference counter */
out_clone->data->refs++;
VALID(out_clone);
}
示例7: strings
int
strings(char *fn) {
FILE *f;
int state=1;
int c;
char *seq = 0;
f = stdin;
if (fn && (f = fopen(fn, "r")) == NULL)
return -1;
if (!fn)
fn = "standard input";
while ((c = getc(f)) != EOF) {
redo:
switch (state) {
case 0: /* searching for ascii */
if (VALID(c)) {
state=1;
seq = seq_hold;
goto redo;
}
break;
case 1: /* holding sequence */
if (VALID(c)) {
*seq++ = c;
if (seq-seq_hold >= opts.minlen) {
*seq++ = 0;
if (opts.pr_fn)
printf("%s: ", fn);
printf("%s", seq_hold);
state = 2;
}
} else
state = 0;
break;
case 2: /* write sequences */
if (VALID(c)) {
putchar(c);
} else {
putchar('\n');
state = 0;
}
break;
}
}
if (state == 2)
putchar('\n');
if (f != stdin)
fclose(f);
return 0;
}
示例8: StrEqualLocale
/*************************************************************************
* StrEqualLocale
*/
int StrEqualLocale(const char *first, const char *second)
{
assert(VALID(first));
assert(VALID(second));
#if defined(LC_COLLATE)
return (strcoll(first, second) == 0);
#else
return StrEqual(first, second);
#endif
}
示例9: StrEqualCaseMax
/*************************************************************************
* StrEqualCaseMax
*/
int StrEqualCaseMax(const char *first, size_t max, const char *second)
{
assert(VALID(first));
assert(VALID(second));
if (VALID(first) && VALID(second))
{
return (0 == strncmp(first, second, max));
}
return FALSE;
}
示例10: StrEqualCase
/*************************************************************************
* StrEqualCase
*/
int StrEqualCase(const char *first, const char *second)
{
assert(VALID(first));
assert(VALID(second));
if (VALID(first) && VALID(second))
{
return (0 == strcmp(first, second));
}
return FALSE;
}
示例11: StrFormatDateMax
/*************************************************************************
* StrFormatDate
*/
size_t StrFormatDateMax(char *target,
size_t max,
const char *format,
const struct tm *datetime)
{
assert(VALID(target));
assert(VALID(format));
assert(VALID(datetime));
assert(max > 0);
return strftime(target, max, format, datetime);
}
示例12: channel_info
static void
channel_info (void *elem, void *data)
{
CHANNEL *chan = (CHANNEL *) elem;
ASSERT (VALID (elem));
ASSERT (VALID (data));
if ((chan->flags & ON_CHANNEL_PRIVATE) == 0)
send_cmd ((CONNECTION *) data, MSG_SERVER_CHANNEL_LIST /* 618 */ ,
"%s %d %s", chan->name,
effective_channel_count (chan->users,
((CONNECTION *) data)->user->
level >= LEVEL_MODERATOR),
chan->topic);
}
示例13: skiplist_itor_valid
bool
skiplist_itor_valid(const skiplist_itor* itor)
{
ASSERT(itor != NULL);
return VALID(itor);
}
示例14: VALID
bool DomainShader::Create(Blob & shaderbuffer)
{
HRESULT hr = DX11API::D3D11Device()->CreateDomainShader(shaderbuffer.m_pBlob->GetBufferPointer(),
shaderbuffer.m_pBlob->GetBufferSize(), nullptr, &m_pShader);
VALID(hr);
}
示例15: StrSpanFunction
/*************************************************************************
* StrSpanFunction
*
* Untested
*/
size_t StrSpanFunction(char *source, int (*Function)(int))
{
size_t count = 0;
assert(VALID(source));
assert(VALID(Function));
while (*source != NIL)
{
if (Function(*source))
break; /* while */
source++;
count++;
}
return count;
}