本文整理汇总了C++中LOOKUP函数的典型用法代码示例。如果您正苦于以下问题:C++ LOOKUP函数的具体用法?C++ LOOKUP怎么用?C++ LOOKUP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOOKUP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: csAxisDrill
int csAxisDrill( char *operation, char *axis, char *surface )
{
static LWCommandCode ccode;
ModData *md = getModData();
DynaValue argv[ 3 ];
assert( md->edit == NULL );
argv[ 0 ].type = DY_STRING;
argv[ 0 ].str.buf = operation;
argv[ 0 ].str.bufLen = 0;
argv[ 1 ].type = DY_STRING;
argv[ 1 ].str.buf = axis;
argv[ 1 ].str.bufLen = 0;
if ( surface ) {
argv[ 2 ].type = DY_STRING;
argv[ 2 ].str.buf = surface;
argv[ 2 ].str.bufLen = 0;
}
else argv[ 2 ].type = DY_NULL;
LOOKUP( "AXISDRILL" );
EXECUTE( 3, argv );
return OK;
}
示例2: zlog_debug
static void
rip_auth_write_leading_rte
(
struct stream *s,
struct rip_interface *ri,
const u_int8_t key_id,
char *auth_str,
u_int16_t main_body_len
)
{
u_int8_t dlen;
if (IS_RIP_DEBUG_AUTH)
zlog_debug ("writing authentication header for %uB of main body", main_body_len);
stream_putw (s, RIP_FAMILY_AUTH);
switch (ri->auth_type)
{
case RIP_AUTH_SIMPLE_PASSWORD:
{
u_int8_t padded_simple_password[RIP_AUTH_SIMPLE_SIZE] = { 0 };
memcpy (padded_simple_password, auth_str, MIN (RIP_AUTH_SIMPLE_SIZE, strlen (auth_str)));
stream_putw (s, RIP_AUTH_SIMPLE_PASSWORD);
stream_put (s, padded_simple_password, RIP_AUTH_SIMPLE_SIZE);
break;
}
case RIP_AUTH_HASH:
if (IS_RIP_DEBUG_AUTH)
zlog_debug ("hash algorithm is '%s'", LOOKUP (hash_algo_str, ri->hash_algo));
stream_putw (s, RIP_AUTH_HASH);
stream_putw (s, main_body_len);
stream_putc (s, key_id);
switch (ri->hash_algo)
{
case HASH_KEYED_MD5:
/* Auth Data Len. Set 16 for MD5 authentication data. Older ripds
* however expect RIP_HEADER_SIZE + HASH_SIZE_MD5 so we allow for this
* to be configurable. */
dlen = ri->md5_auth_len;
break;
case HASH_HMAC_SHA1:
case HASH_HMAC_SHA256:
case HASH_HMAC_SHA384:
case HASH_HMAC_SHA512:
dlen = hash_digest_length[ri->hash_algo];
break;
default:
assert (0);
}
if (IS_RIP_DEBUG_AUTH)
zlog_debug ("declared auth data length is %uB", dlen);
stream_putc (s, dlen);
stream_putl (s, time (NULL)); /* Sequence Number (non-decreasing). */
stream_putl (s, 0); /* reserved, MBZ */
stream_putl (s, 0); /* reserved, MBZ */
break;
default:
assert (0);
}
}
示例3: bgp_fsm_event_error
/* FSM error, unexpected event. This is error of BGP connection. So cut the
peer and change to Idle status. */
static int
bgp_fsm_event_error (struct peer *peer)
{
plog_err (peer->log, "%s [FSM] unexpected packet received in state %s",
peer->host, LOOKUP (bgp_status_msg, peer->status));
return bgp_stop_with_notify (peer, BGP_NOTIFY_FSM_ERR, 0);
}
示例4: ism_change_callback
static void
ism_change_callback (struct in_addr ifaddr, struct in_addr area_id,
u_char state)
{
printf ("ism_change: ifaddr: %s ", inet_ntoa (ifaddr));
printf ("area_id: %s\n", inet_ntoa (area_id));
printf ("state: %d [%s]\n", state, LOOKUP (ospf_ism_state_msg, state));
}
示例5: real_slot_lookup
static inline struct objc_slot * real_slot_lookup(struct objc_object ** obj, uint32_t sel, id sender)
{
id object = *obj;
struct objc_slot * ret = NULL;
do
{
if(LOOKUP(object))
{
return (*LOOKUP(object))(obj, object, sel, sender);
}
if(SLOTS(object))
{
ret = SparseArrayLookup(SLOTS(object), sel);
}
object = object->isa;
} while(object != NULL && ret == NULL);
return ret;
}
示例6: nsm_change_callback
static void
nsm_change_callback (struct in_addr ifaddr, struct in_addr nbraddr,
struct in_addr router_id, u_char state)
{
printf ("nsm_change: ifaddr: %s ", inet_ntoa (ifaddr));
printf ("nbraddr: %s\n", inet_ntoa (nbraddr));
printf ("router_id: %s\n", inet_ntoa (router_id));
printf ("state: %d [%s]\n", state, LOOKUP (ospf_nsm_state_msg, state));
}
示例7: rbtree_get
/* =============================================================================
* rbtree_get
* =============================================================================
*/
void*
rbtree_get (rbtree_t* r, void* key) {
node_t* n = LOOKUP(r, key);
if (n != NULL) {
void* val = LDF(n, v);
return val;
}
return NULL;
}
示例8: bgp_event
/* Execute event process. */
int
bgp_event (struct thread *thread)
{
int ret = 0;
int event;
int next;
struct peer *peer;
peer = THREAD_ARG (thread);
event = THREAD_VAL (thread);
/* Logging this event. */
next = FSM [peer->status -1][event - 1].next_state;
if (BGP_DEBUG (fsm, FSM) && peer->status != next)
plog_debug (peer->log, "%s [FSM] %s (%s->%s)", peer->host,
bgp_event_str[event],
LOOKUP (bgp_status_msg, peer->status),
LOOKUP (bgp_status_msg, next));
/* Call function. */
if (FSM [peer->status -1][event - 1].func)
ret = (*(FSM [peer->status - 1][event - 1].func))(peer);
/* When function do not want proceed next job return -1. */
if (ret >= 0)
{
/* If status is changed. */
if (next != peer->status)
{
/* Transition into Clearing must /always/ clear all routes.. */
if (next == Clearing)
bgp_clear_route_all (peer);
bgp_fsm_change_status (peer, next);
}
/* Make sure timer is set. */
bgp_timer_set (peer);
}
return ret;
}
示例9: csSelInvert
int csSelInvert( void )
{
static LWCommandCode ccode;
ModData *md = getModData();
assert( md->edit == NULL );
LOOKUP( "SEL_INVERT" );
EXECUTE( 0, NULL );
return OK;
}
示例10: csSelUnhide
int csSelUnhide( void )
{
static LWCommandCode ccode;
ModData *md = getModData();
assert( md->edit == NULL );
LOOKUP( "SEL_UNHIDE" );
EXECUTE( 0, NULL );
return OK;
}
示例11: csMakeText
int csMakeText( char *text, int index, char *cornertype, double spacing,
double scale, char *axis, double *pos )
{
static LWCommandCode ccode;
ModData *md = getModData();
DynaValue argv[ 7 ];
assert( md->edit == NULL );
argv[ 0 ].type = DY_STRING;
argv[ 0 ].str.buf = text;
argv[ 0 ].str.bufLen = 0;
argv[ 1 ].type = DY_INTEGER;
argv[ 1 ].intv.value = index;
if ( cornertype ) {
argv[ 2 ].type = DY_STRING;
argv[ 2 ].str.buf = cornertype;
argv[ 2 ].str.bufLen = 0;
}
else argv[ 2 ].type = DY_NULL;
if ( spacing != 0.0 ) {
argv[ 3 ].type = DY_FLOAT;
argv[ 3 ].flt.value = spacing;
}
else argv[ 3 ].type = DY_NULL;
if ( scale != 0.0 ) {
argv[ 4 ].type = DY_FLOAT;
argv[ 4 ].flt.value = scale;
}
else argv[ 4 ].type = DY_NULL;
if ( axis ) {
argv[ 5 ].type = DY_STRING;
argv[ 5 ].str.buf = axis;
argv[ 5 ].str.bufLen = 0;
}
else argv[ 5 ].type = DY_NULL;
if ( pos ) {
argv[ 6 ].type = DY_VFLOAT;
argv[ 6 ].fvec.val[ 0 ] = pos[ 0 ];
argv[ 6 ].fvec.val[ 1 ] = pos[ 1 ];
argv[ 6 ].fvec.val[ 2 ] = pos[ 2 ];
}
else argv[ 6 ].type = DY_NULL;
LOOKUP( "MAKETEXT" );
EXECUTE( 7, argv );
return OK;
}
示例12: MCGetMsg
static MCMsgT *
MCGetMsg(MCSetT *set, int msgId)
{
MCMsgT *msg;
int32_t lo, hi, cur, dir;
if (set == NULL || set->invalid || msgId <= 0)
return (NULL);
LOOKUP(set, msg, msgId, ntohl(set->numMsgs), u.msgs);
return (msg);
}
示例13: DEFINE_PROPERTYKEY
/*****************************************************************************
* mmdevice.c : Windows Multimedia Device API audio output plugin for VLC
*****************************************************************************
* Copyright (C) 2012-2014 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#define INITGUID
#define COBJMACROS
#define CONST_VTABLE
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <audiopolicy.h>
#include <mmdeviceapi.h>
#include <endpointvolume.h>
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd,
0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_charset.h>
#include <vlc_modules.h>
#include "audio_output/mmdevice.h"
#if (_WIN32_WINNT < 0x600)
static VOID WINAPI (*InitializeConditionVariable)(PCONDITION_VARIABLE);
static BOOL WINAPI (*SleepConditionVariableCS)(PCONDITION_VARIABLE,
PCRITICAL_SECTION, DWORD);
static VOID WINAPI (*WakeConditionVariable)(PCONDITION_VARIABLE);
#define LOOKUP(s) \
if (((s) = (void *)GetProcAddress(h, #s)) == NULL) return FALSE
BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID); /* avoid warning */
BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved)
{
(void) dll;
(void) reserved;
switch (reason)
{
case DLL_PROCESS_ATTACH:
{
HANDLE h = GetModuleHandle(TEXT("kernel32.dll"));
if (unlikely(h == NULL))
return FALSE;
LOOKUP(InitializeConditionVariable);
LOOKUP(SleepConditionVariableCS);
LOOKUP(WakeConditionVariable);
break;
}
}
return TRUE;
}
示例14: csInvertHide
int csInvertHide( void )
{
static LWCommandCode ccode;
ModData *md = getModData();
assert( md->edit == NULL );
LOOKUP( "INVERT_HIDE" );
EXECUTE( 0, NULL );
return OK;
}
示例15: findApiSymbols
static int findApiSymbols(void)
{
HMODULE dll = NULL;
#define LOOKUP_NOFALLBACK(x, reallyLook) \
symLookup(dll, (PHYSFS_FARPROC *) &p##x, #x, reallyLook, NULL)
#define LOOKUP(x, reallyLook) \
symLookup(dll, (PHYSFS_FARPROC *) &p##x, #x, \
reallyLook, (PHYSFS_FARPROC) fallback##x)
/* Apparently Win9x HAS the Unicode entry points, they just don't WORK. */
/* ...so don't look them up unless we're on NT+. (see osHasUnicode.) */
dll = libUserEnv = LoadLibraryA("userenv.dll");
if (dll != NULL)
LOOKUP_NOFALLBACK(GetUserProfileDirectoryW, osHasUnicode);
/* !!! FIXME: what do they call advapi32.dll on Win64? */
dll = libAdvApi32 = LoadLibraryA("advapi32.dll");
if (dll != NULL)
LOOKUP(GetUserNameW, osHasUnicode);
/* !!! FIXME: what do they call kernel32.dll on Win64? */
dll = libKernel32 = LoadLibraryA("kernel32.dll");
if (dll != NULL)
{
LOOKUP_NOFALLBACK(GetFileAttributesExA, 1);
LOOKUP_NOFALLBACK(GetFileAttributesExW, osHasUnicode);
LOOKUP_NOFALLBACK(FindFirstFileW, osHasUnicode);
LOOKUP_NOFALLBACK(FindNextFileW, osHasUnicode);
LOOKUP(GetModuleFileNameW, osHasUnicode);
LOOKUP(FormatMessageW, osHasUnicode);
LOOKUP(GetFileAttributesW, osHasUnicode);
LOOKUP(GetCurrentDirectoryW, osHasUnicode);
LOOKUP(CreateDirectoryW, osHasUnicode);
LOOKUP(RemoveDirectoryW, osHasUnicode);
LOOKUP(CreateFileW, osHasUnicode);
LOOKUP(DeleteFileW, osHasUnicode);
} /* if */
#undef LOOKUP_NOFALLBACK
#undef LOOKUP
return(1);
} /* findApiSymbols */