本文整理汇总了C++中CODE函数的典型用法代码示例。如果您正苦于以下问题:C++ CODE函数的具体用法?C++ CODE怎么用?C++ CODE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CODE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: i80286_check_permission
static void i80286_check_permission(i8086_state *cpustate, UINT8 check_seg, UINT32 offset, UINT16 size, i80286_operation operation)
{
int trap = 0;
UINT8 rights;
if (PM) {
rights = cpustate->rights[check_seg];
trap = i80286_verify(cpustate, cpustate->sregs[check_seg], operation, rights, cpustate->valid[check_seg]);
if ((CODE(rights) || !EXPDOWN(rights)) && ((offset+size-1) > cpustate->limit[check_seg])) trap = GENERAL_PROTECTION_FAULT;
if (!CODE(rights) && EXPDOWN(rights) && ((offset <= cpustate->limit[check_seg]) || ((offset+size-1) > 0xffff))) trap = GENERAL_PROTECTION_FAULT;
if ((trap == GENERAL_PROTECTION_FAULT) && (check_seg == SS)) trap = STACK_FAULT;
if (trap) throw TRAP(trap, 0);
}
}
开发者ID:NastyNoah,项目名称:groovyarcade.groovymame,代码行数:14,代码来源:instr286.c
示例2: sockClientStop
// =-=-=-=-=-=-=-
//
irods::error sockClientStop(
irods::network_object_ptr _ptr,
rodsEnv* _env ) {
// =-=-=-=-=-=-=-
// resolve a network interface plugin from the
// network object
irods::plugin_ptr p_ptr;
irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
if ( !ret_err.ok() ) {
return PASSMSG( "failed to resolve network interface", ret_err );
}
// =-=-=-=-=-=-=-
// make the call to the "read" interface
irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
ret_err = net->call< rodsEnv* >( irods::NETWORK_OP_CLIENT_STOP, _ptr, _env );
// =-=-=-=-=-=-=-
// pass along an error from the interface or return SUCCESS
if ( !ret_err.ok() ) {
return PASSMSG( "failed to call 'client stop'", ret_err );
}
else {
return CODE( ret_err.code() );
}
} // sockClientStop
开发者ID:hurngchunlee,项目名称:irods,代码行数:32,代码来源:sockComm.cpp
示例3: fileRead
// =-=-=-=-=-=-=-
// Top Level Interface for Resource Plugin POSIX read
irods::error fileRead(
rsComm_t* _comm,
irods::first_class_object_ptr _object,
void* _buf,
const int _len ) {
// =-=-=-=-=-=-=-
// retrieve the resource name given the object
irods::plugin_ptr ptr;
irods::resource_ptr resc;
irods::error ret_err = _object->resolve( irods::RESOURCE_INTERFACE, ptr );
if ( !ret_err.ok() ) {
return PASSMSG( "failed to resolve resource", ret_err );
}
// =-=-=-=-=-=-=-
// make the call to the "read" interface
resc = boost::dynamic_pointer_cast< irods::resource >( ptr );
ret_err = resc->call< void*, const int >( _comm, irods::RESOURCE_OP_READ, _object, _buf, _len );
// =-=-=-=-=-=-=-
// pass along an error from the interface or return SUCCESS
if ( !ret_err.ok() ) {
return PASSMSG( "failed to call 'read'", ret_err );
}
else {
return CODE( ret_err.code() );
}
} // fileRead
开发者ID:QuarkDoe,项目名称:irods,代码行数:31,代码来源:fileDriver.cpp
示例4: fileTruncate
// =-=-=-=-=-=-=-
// Top Level Interface for Resource Plugin truncate
irods::error fileTruncate(
rsComm_t* _comm,
irods::first_class_object_ptr _object ) {
// =-=-=-=-=-=-=-
// retrieve the resource name given the path
irods::plugin_ptr ptr;
irods::resource_ptr resc;
irods::error ret_err = _object->resolve( irods::RESOURCE_INTERFACE, ptr );
if ( !ret_err.ok() ) {
return PASSMSG( "failed to resolve resource", ret_err );
}
// =-=-=-=-=-=-=-
// make the call to the "truncate" interface
resc = boost::dynamic_pointer_cast< irods::resource >( ptr );
ret_err = resc->call( _comm, irods::RESOURCE_OP_TRUNCATE, _object );
// =-=-=-=-=-=-=-
// pass along an error from the interface or return SUCCESS
if ( !ret_err.ok() ) {
return PASSMSG( "failed to call 'truncate'", ret_err );
}
else {
return CODE( ret_err.code() );
}
} // fileTruncate
开发者ID:QuarkDoe,项目名称:irods,代码行数:29,代码来源:fileDriver.cpp
示例5: fileRename
// =-=-=-=-=-=-=-
// Top Level Interface for Resource Plugin POSIX rename
irods::error fileRename(
rsComm_t* _comm,
irods::first_class_object_ptr _object,
const std::string& _new_file_name ) {
// =-=-=-=-=-=-=-
// retrieve the resource name given the path
irods::plugin_ptr ptr;
irods::resource_ptr resc;
irods::error ret_err = _object->resolve( irods::RESOURCE_INTERFACE, ptr );
if ( !ret_err.ok() ) {
return PASSMSG( "failed to resolve resource", ret_err );
}
// =-=-=-=-=-=-=-
// make the call to the "rename" interface
resc = boost::dynamic_pointer_cast< irods::resource >( ptr );
ret_err = resc->call< const char* >( _comm, irods::RESOURCE_OP_RENAME, _object, _new_file_name.c_str() );
// =-=-=-=-=-=-=-
// pass along an error from the interface or return SUCCESS
if ( !ret_err.ok() ) {
return PASSMSG( "failed to call 'rename'", ret_err );
}
else {
return CODE( ret_err.code() );
}
} // fileRename
开发者ID:QuarkDoe,项目名称:irods,代码行数:30,代码来源:fileDriver.cpp
示例6: fileReaddir
// =-=-=-=-=-=-=-
// Top Level Interface for Resource Plugin POSIX readdir
irods::error fileReaddir(
rsComm_t* _comm,
irods::first_class_object_ptr _object,
struct rodsDirent** _dirent_ptr ) {
// =-=-=-=-=-=-=-
// retrieve the resource name given the path
irods::plugin_ptr ptr;
irods::resource_ptr resc;
irods::error ret_err = _object->resolve( irods::RESOURCE_INTERFACE, ptr );
if ( !ret_err.ok() ) {
return PASSMSG( "failed to resolve resource", ret_err );
}
// =-=-=-=-=-=-=-
// make the call to the "readdir" interface
resc = boost::dynamic_pointer_cast< irods::resource >( ptr );
ret_err = resc->call< struct rodsDirent** >( _comm, irods::RESOURCE_OP_READDIR, _object, _dirent_ptr );
// =-=-=-=-=-=-=-
// pass along an error from the interface or return SUCCESS
if ( !ret_err.ok() ) {
return PASSMSG( "failed to call 'readdir'", ret_err );
}
else {
return CODE( ret_err.code() );
}
} // fileReaddir
开发者ID:QuarkDoe,项目名称:irods,代码行数:30,代码来源:fileDriver.cpp
示例7: fileLseek
// =-=-=-=-=-=-=-
// Top Level Interface for Resource Plugin POSIX lseek
irods::error fileLseek(
rsComm_t* _comm,
irods::first_class_object_ptr _object,
const long long _offset,
const int _whence ) {
// =-=-=-=-=-=-=-
// retrieve the resource name given the path
irods::plugin_ptr ptr;
irods::resource_ptr resc;
irods::error ret_err = _object->resolve( irods::RESOURCE_INTERFACE, ptr );
if ( !ret_err.ok() ) {
return PASSMSG( "failed to resolve resource", ret_err );
}
// =-=-=-=-=-=-=-
// make the call to the "lseek" interface
resc = boost::dynamic_pointer_cast< irods::resource >( ptr );
ret_err = resc->call< const long long, const int >( _comm, irods::RESOURCE_OP_LSEEK, _object, _offset, _whence );
// =-=-=-=-=-=-=-
// pass along an error from the interface or return SUCCESS
if ( !ret_err.ok() ) {
return PASSMSG( "failed to call 'lseek'", ret_err );
}
else {
return CODE( ret_err.code() );
}
} // fileLseek
开发者ID:QuarkDoe,项目名称:irods,代码行数:31,代码来源:fileDriver.cpp
示例8: get_host_status_by_host_info
// =-=-=-=-=-=-=-
// helper function - get the status property of a resource given a
// match to the incoming pointer
error get_host_status_by_host_info( rodsServerHost_t* _info ) {
// =-=-=-=-=-=-=-
// idiot check pointer
if ( !_info ) {
return ERROR( SYS_INVALID_INPUT_PARAM, "null pointer" );
}
// =-=-=-=-=-=-=-
// find a matching resource
resource_ptr resc;
error err = resc_mgr.resolve_from_property< rodsServerHost_t* >( RESOURCE_HOST, _info, resc );
if ( !err.ok() ) {
return PASSMSG( "failed to resolve resource", err );
}
// =-=-=-=-=-=-=-
// get the status property of the resource
int status = -1;
err = resc->get_property< int >( RESOURCE_STATUS, status );
if ( !err.ok() ) {
return PASSMSG( "failed to get resource property", err );
}
return CODE( status );
} // get_host_status_by_host_info
开发者ID:QuarkDoe,项目名称:irods,代码行数:29,代码来源:irods_resource_backport.cpp
示例9: clip_line
//bool
//clip_line(int *pX1, int *pY1, int *pX2, int *pY2, int l, int b, int r, int t)
int
clip_line(int *pX1, int *pY1, int *pX2, int *pY2, int l, int b, int r, int t)
{
int x1 = *pX1;
int y1 = *pY1;
int x2 = *pX2;
int y2 = *pY2;
int x = 0, y = 0;
int c, c1, c2;
CODE(x1, y1, c1);
CODE(x2, y2, c2);
while (c1 || c2) {
if (c1 & c2)
return (TRUE); /* Line is invisible. */
if ((c = c1) == 0)
c = c2;
if (c & CODEMINX) {
y = y1+(y2-y1)*(l-x1)/(x2-x1);
x = l;
} else if (c & CODEMAXX) {
y = y1+(y2-y1)*(r-x1)/(x2-x1);
x = r;
} else if (c & CODEMINY) {
x = x1+(x2-x1)*(b-y1)/(y2-y1);
y = b;
} else if (c & CODEMAXY) {
x = x1+(x2-x1)*(t-y1)/(y2-y1);
y = t;
}
if (c == c1) {
x1 = x;
y1 = y;
CODE(x, y, c1);
} else {
x2 = x;
y2 = y;
CODE(x, y, c2);
}
}
*pX1 = x1;
*pY1 = y1;
*pX2 = x2;
*pY2 = y2;
return (FALSE); /* Line is at least partially visible.*/
}
开发者ID:fengmm521,项目名称:myspice,代码行数:49,代码来源:clip.c
示例10: univ_mss_file_stage_to_cache
/// =-=-=-=-=-=-=-
/// @brief This routine is for testing the TEST_STAGE_FILE_TYPE.
/// Just copy the file from filename to cacheFilename. optionalInfo info
/// is not used.
irods::error univ_mss_file_stage_to_cache(
irods::resource_plugin_context& _ctx,
const char* _cache_file_name ) {
// =-=-=-=-=-=-=-
// check context
irods::error err = univ_mss_check_param< irods::file_object >( _ctx );
if ( !err.ok() ) {
std::stringstream msg;
msg << __FUNCTION__;
msg << " - invalid context";
return PASSMSG( msg.str(), err );
}
// =-=-=-=-=-=-=-
// snag a ref to the fco
irods::file_object_ptr fco = boost::dynamic_pointer_cast< irods::file_object >( _ctx.fco() );
std::string filename = fco->physical_path();
// =-=-=-=-=-=-=-
// get the script property
std::string script;
err = _ctx.prop_map().get< std::string >( SCRIPT_PROP, script );
if ( !err.ok() ) {
return PASSMSG( __FUNCTION__, err );
}
int status = 0;
execCmd_t execCmdInp;
char cmdArgv[HUGE_NAME_LEN] = "";
execCmdOut_t *execCmdOut = NULL;
bzero( &execCmdInp, sizeof( execCmdInp ) );
rstrcpy( execCmdInp.cmd, script.c_str(), LONG_NAME_LEN );
strcat( cmdArgv, "stageToCache" );
strcat( cmdArgv, " '" );
strcat( cmdArgv, filename.c_str() );
strcat( cmdArgv, "' '" );
strcat( cmdArgv, _cache_file_name );
strcat( cmdArgv, "'" );
rstrcpy( execCmdInp.cmdArgv, cmdArgv, HUGE_NAME_LEN );
rstrcpy( execCmdInp.execAddr, "localhost", LONG_NAME_LEN );
status = _rsExecCmd( _ctx.comm(), &execCmdInp, &execCmdOut );
if ( status < 0 ) {
status = UNIV_MSS_STAGETOCACHE_ERR - errno;
std::stringstream msg;
msg << "univ_mss_file_stage_to_cache: staging from [";
msg << _cache_file_name;
msg << "] to [";
msg << filename;
msg << "] failed.";
return ERROR( status, msg.str() );
}
return CODE( status );
} // univ_mss_file_stage_to_cache
开发者ID:PlantandFoodResearch,项目名称:irods,代码行数:62,代码来源:libunivmss.cpp
示例11: ScreenWithMenuElements
ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClassName)
{
LOG->Trace( "ScreenSelect::ScreenSelect()" );
m_sName = sClassName;
//
// Load choices
//
{
// Instead of using NUM_CHOICES, use a comma-separated list of choices. Each
// element in the list is a choice name. This level of indirection
// makes it easier to add or remove items without having to change a bunch
// of indices.
CStringArray asChoiceNames;
split( CHOICE_NAMES, ",", asChoiceNames, true );
for( unsigned c=0; c<asChoiceNames.size(); c++ )
{
CString sChoiceName = asChoiceNames[c];
CString sChoice = CHOICE(sChoiceName);
ModeChoice mc;
mc.m_sName = sChoiceName;
mc.Load( c, sChoice );
m_aModeChoices.push_back( mc );
CString sBGAnimationDir = THEME->GetPath(BGAnimations, m_sName, mc.m_sName, true); // true="optional"
if( sBGAnimationDir == "" )
sBGAnimationDir = THEME->GetPathToB(m_sName+" background");
BGAnimation *pBGA = new BGAnimation;
m_vpBGAnimations.push_back( pBGA );
}
}
//
// Load codes
//
for( int c=0; c<NUM_CODES; c++ )
{
CodeItem code;
if( !code.Load( CODE(c) ) )
continue;
m_aCodes.push_back( code );
m_aCodeActions.push_back( CODE_ACTION(c) );
ModeChoice mc;
mc.Load( c, CODE_ACTION(c) );
m_aCodeChoices.push_back( mc );
}
if( !m_aModeChoices.size() )
RageException::Throw( "Screen \"%s\" does not set any choices", m_sName.c_str() );
// derived classes can override if they want
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
}
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:57,代码来源:ScreenSelect.cpp
示例12: i80286_verify
static int i80286_verify(i80286_state *cpustate, UINT16 selector, i80286_operation operation, UINT8 rights, bool valid)
{
if (!IDXTBL(selector) && !valid) return GENERAL_PROTECTION_FAULT;
if (!SEGDESC(rights)) return GENERAL_PROTECTION_FAULT;
switch(operation) {
case I80286_READ:
if (CODE(rights) && !READ(rights)) return GENERAL_PROTECTION_FAULT;
break;
case I80286_WRITE:
if (CODE(rights) || !RW(rights)) return GENERAL_PROTECTION_FAULT;
break;
case I80286_EXECUTE:
if (!CODE(rights)) return GENERAL_PROTECTION_FAULT;
break;
}
return 0;
}
开发者ID:NastyNoah,项目名称:groovyarcade.groovymame,代码行数:18,代码来源:instr286.c
示例13: univ_mss_file_chmod
/// =-=-=-=-=-=-=-
/// @brief interface for POSIX chmod
irods::error univ_mss_file_chmod(
irods::resource_plugin_context& _ctx ) {
// =-=-=-=-=-=-=-
// check context
irods::error err = univ_mss_check_param< irods::data_object >( _ctx );
if ( !err.ok() ) {
std::stringstream msg;
msg << __FUNCTION__;
msg << " - invalid context";
return PASSMSG( msg.str(), err );
}
// =-=-=-=-=-=-=-
// get the script property
std::string script;
err = _ctx.prop_map().get< std::string >( SCRIPT_PROP, script );
if ( !err.ok() ) {
return PASSMSG( __FUNCTION__, err );
}
// =-=-=-=-=-=-=-
// snag a ref to the fco
irods::data_object_ptr fco = boost::dynamic_pointer_cast< irods::data_object >( _ctx.fco() );
std::string filename = fco->physical_path();
int mode = fco->mode();
int status = 0;
execCmd_t execCmdInp;
if ( mode != getDefDirMode() ) {
mode = getDefFileMode();
}
bzero( &execCmdInp, sizeof( execCmdInp ) );
snprintf( execCmdInp.cmd, sizeof( execCmdInp.cmd ), "%s", script.c_str() );
snprintf( execCmdInp.cmdArgv, sizeof( execCmdInp.cmdArgv ), "chmod '%s' %o", filename.c_str(), mode );
snprintf( execCmdInp.execAddr, sizeof( execCmdInp.execAddr ), "%s", "localhost" );
execCmdOut_t *execCmdOut = NULL;
status = _rsExecCmd( &execCmdInp, &execCmdOut );
freeCmdExecOut( execCmdOut );
if ( status < 0 ) {
status = UNIV_MSS_CHMOD_ERR - errno;
std::stringstream msg;
msg << "univ_mss_file_chmod - failed for [";
msg << filename;
msg << "]";
return ERROR( status, msg.str() );
}
return CODE( status );
} // univ_mss_file_chmod
开发者ID:0x414A,项目名称:irods,代码行数:57,代码来源:libunivmss.cpp
示例14: add_line
static void add_line(ushort line, uint64_t time)
{
int n;
char buf[32], num[16];
char *p;
n = line - _last_line;
p = buf;
if (n >= -9 && n <= 9)
*p++ = CODE(0 + n + 9);
else if (n >= -99 && n <= 99)
{
*p++ = n > 0 ? CODE(19) : CODE(20);
*p++ = CODE(0) + abs(n) - 10;
}
else
{
*p++ = n > 0 ? CODE(21) : CODE(22);
n = sprintf(num, "%d", abs(n));
*p++ = CODE(n);
strcpy(p, num);
p += n;
}
if (time <= 9)
*p++ = CODE(time);
else
{
n = sprintf(num, "%" PRIu64, time);
*p++ = CODE(10 + n - 2);
strcpy(p, num);
p += n;
}
*p = 0;
fputs(buf, _file);
_last_line = line;
_new_line = FALSE;
_count++;
if ((_count & 0xFFFFF) == 0)
check_size();
}
开发者ID:ramonelalto,项目名称:gambas,代码行数:45,代码来源:profile.c
示例15: medsa_print_full
static void
medsa_print_full(netdissect_options *ndo,
const struct medsa_pkthdr *medsa,
u_int caplen)
{
u_char tag = TAG(medsa);
ND_PRINT((ndo, "%s",
tok2str(tag_values, "Unknown (%u)", tag)));
switch (tag) {
case TAG_TO_CPU:
ND_PRINT((ndo, ", %stagged", SRC_TAG(medsa) ? "" : "un"));
ND_PRINT((ndo, ", dev.port:vlan %d.%d:%d",
SRC_DEV(medsa), SRC_PORT(medsa), VID(medsa)));
ND_PRINT((ndo, ", %s",
tok2str(code_values, "Unknown (%u)", CODE(medsa))));
if (CFI(medsa))
ND_PRINT((ndo, ", CFI"));
ND_PRINT((ndo, ", pri %d: ", PRI(medsa)));
break;
case TAG_FROM_CPU:
ND_PRINT((ndo, ", %stagged", SRC_TAG(medsa) ? "" : "un"));
ND_PRINT((ndo, ", dev.port:vlan %d.%d:%d",
SRC_DEV(medsa), SRC_PORT(medsa), VID(medsa)));
if (CFI(medsa))
ND_PRINT((ndo, ", CFI"));
ND_PRINT((ndo, ", pri %d: ", PRI(medsa)));
break;
case TAG_FORWARD:
ND_PRINT((ndo, ", %stagged", SRC_TAG(medsa) ? "" : "un"));
if (TRUNK(medsa))
ND_PRINT((ndo, ", dev.trunk:vlan %d.%d:%d",
SRC_DEV(medsa), SRC_PORT(medsa), VID(medsa)));
else
ND_PRINT((ndo, ", dev.port:vlan %d.%d:%d",
SRC_DEV(medsa), SRC_PORT(medsa), VID(medsa)));
if (CFI(medsa))
ND_PRINT((ndo, ", CFI"));
ND_PRINT((ndo, ", pri %d: ", PRI(medsa)));
break;
default:
ND_DEFAULTPRINT((const u_char *)medsa, caplen);
return;
}
}
开发者ID:Distrotech,项目名称:tcpdump,代码行数:52,代码来源:print-medsa.c
示例16: readMsgBody
// =-=-=-=-=-=-=-
//
irods::error readMsgBody(
irods::network_object_ptr _ptr,
msgHeader_t* _header,
bytesBuf_t* _input_struct_buf,
bytesBuf_t* _bs_buf,
bytesBuf_t* _error_buf,
irodsProt_t _protocol,
struct timeval* _time_val ) {
// =-=-=-=-=-=-=-
// resolve a network interface plugin from the
// network object
irods::plugin_ptr p_ptr;
irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
if ( !ret_err.ok() ) {
return PASSMSG( "failed to resolve network interface", ret_err );
}
// =-=-=-=-=-=-=-
// make the call to the "read" interface
irods::first_class_object_ptr ptr = boost::dynamic_pointer_cast< irods::first_class_object >( _ptr );
irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
ret_err = net->call < msgHeader_t*,
bytesBuf_t*,
bytesBuf_t*,
bytesBuf_t*,
irodsProt_t,
struct timeval* > (
irods::NETWORK_OP_READ_BODY,
ptr,
_header,
_input_struct_buf,
_bs_buf,
_error_buf,
_protocol,
_time_val );
// =-=-=-=-=-=-=-
// pass along an error from the interface or return SUCCESS
if ( !ret_err.ok() ) {
return PASSMSG( "failed to call 'read message body'", ret_err );
}
else {
return CODE( ret_err.code() );
}
} // readMsgBody
开发者ID:hurngchunlee,项目名称:irods,代码行数:50,代码来源:sockComm.cpp
示例17: i80286_data_descriptor_full
static void i80286_data_descriptor_full(i80286_state *cpustate, int reg, UINT16 selector, int cpl, UINT32 trap, UINT16 offset, int size)
{
if (PM) {
UINT16 desc[3];
UINT8 r;
UINT32 addr;
/* selector format
15..3 number/address in descriptor table
2: 0 global, 1 local descriptor table
1,0: requested privileg level
must be higher or same as current privileg level in code selector */
if ((reg != SS) && !IDXTBL(selector)) {
cpustate->sregs[reg]=0;
cpustate->limit[reg]=0;
cpustate->base[reg]=0;
cpustate->rights[reg]=0;
cpustate->valid[reg]=0;
return;
}
if ((addr = i80286_selector_address(cpustate,selector)) == -1) throw trap;
desc[0] = ReadWord(addr);
desc[1] = ReadWord(addr+2);
desc[2] = ReadWord(addr+4);
r = RIGHTS(desc);
if (!SEGDESC(r)) throw trap;
if (reg == SS) {
if (!IDXTBL(selector)) throw trap;
if (DPL(r)!=cpl) throw trap;
if (RPL(selector)!=cpl) throw trap;
if (!RW(r) || CODE(r)) throw trap;
if (!PRES(r)) throw TRAP(STACK_FAULT,(IDXTBL(selector)+(trap&1)));
} else {
if ((DPL(r) < PMAX(cpl,RPL(selector))) && (!CODE(r) || (CODE(r) && !CONF(r)))) throw trap;
if (CODE(r) && !READ(r)) throw trap;
if (!PRES(r)) throw TRAP(SEG_NOT_PRESENT,(IDXTBL(selector)+(trap&1)));
}
if (offset+size) {
if ((CODE(r) || !EXPDOWN(r)) && ((offset+size-1) > LIMIT(desc))) throw (reg==SS)?TRAP(STACK_FAULT,(trap&1)):trap;
if (!CODE(r) && EXPDOWN(r) && ((offset <= LIMIT(desc)) || ((offset+size-1) > 0xffff))) throw (reg==SS)?TRAP(STACK_FAULT,(trap&1)):trap;
}
SET_ACC(desc);
WriteWord(addr+4, desc[2]);
cpustate->sregs[reg]=selector;
cpustate->limit[reg]=LIMIT(desc);
cpustate->base[reg]=BASE(desc);
cpustate->rights[reg]=RIGHTS(desc);
} else {
cpustate->sregs[reg]=selector;
cpustate->base[reg]=selector<<4;
}
cpustate->valid[reg]=1;
}
开发者ID:NastyNoah,项目名称:groovyarcade.groovymame,代码行数:55,代码来源:instr286.c
示例18: sendRodsMsg
irods::error sendRodsMsg(
irods::network_object_ptr _ptr,
char* _msg_type,
bytesBuf_t* _msg_buf,
bytesBuf_t* _bs_buf,
bytesBuf_t* _error_buf,
int _int_info,
irodsProt_t _protocol ) {
// =-=-=-=-=-=-=-
// resolve a network interface plugin from the
// network object
irods::plugin_ptr p_ptr;
irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
if ( !ret_err.ok() ) {
return PASSMSG( "failed to resolve network interface", ret_err );
}
// =-=-=-=-=-=-=-
// make the call to the "write body" interface
irods::first_class_object_ptr ptr = boost::dynamic_pointer_cast< irods::first_class_object >( _ptr );
irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
ret_err = net->call< char*, bytesBuf_t*, bytesBuf_t*, bytesBuf_t*, int, irodsProt_t >(
irods::NETWORK_OP_WRITE_BODY,
ptr,
_msg_type,
_msg_buf,
_bs_buf,
_error_buf,
_int_info,
_protocol );
// =-=-=-=-=-=-=-
// pass along an error from the interface or return SUCCESS
if ( !ret_err.ok() ) {
return PASSMSG( "failed to call 'write body'", ret_err );
}
else {
return CODE( ret_err.code() );
}
return SUCCESS();
} // sendRodsMsg
开发者ID:hurngchunlee,项目名称:irods,代码行数:46,代码来源:sockComm.cpp
示例19: sendReconnMsg
// =-=-=-=-=-=-=-
// interface for requesting a reconnection
irods::error sendReconnMsg(
irods::network_object_ptr _ptr,
reconnMsg_t* _msg ) {
// =-=-=-=-=-=-=-
// trap invalid param
if ( _msg == NULL ) {
return ERROR( USER__NULL_INPUT_ERR, "null msg buf" );
}
// =-=-=-=-=-=-=-
// pack outgoing message - alway use XML for version
bytesBuf_t* recon_buf = NULL;
int status = packStruct(
static_cast<void*>( _msg ),
&recon_buf,
"ReconnMsg_PI",
RodsPackTable,
0, XML_PROT );
if ( status < 0 ) {
return ERROR( status, "failed to pack struct" );
}
// =-=-=-=-=-=-=-
// pack outgoing message - alway use XML for version
irods::error ret = sendRodsMsg(
_ptr,
RODS_RECONNECT_T,
recon_buf,
NULL,
NULL,
0,
XML_PROT );
freeBBuf( recon_buf );
if ( !ret.ok() ) {
rodsLogError( LOG_ERROR, status,
"sendReconnMsg: sendRodsMsg of reconnect msg failed, status = %d",
status );
}
return CODE( status );
} // sendReconnMsg
开发者ID:hurngchunlee,项目名称:irods,代码行数:44,代码来源:sockComm.cpp
示例20: main
//主函数==============================================================================================
int main()
{
p_in=∈
p_out=&out;
system("mode con cols=80 lines=22");
CODE();//输入密码
if(!shut)
{
Menu(4);//打印界面
Menu(1);//打印选项
Arrow();//打印光标
gotoxy(0,0);
}
while(!shut)
{
while(!shut)
{
shut=0;
MOVE();
if(chos_in==1&&chos_out==1)
{
//转换进制并输出
turn(p_in);
turn(p_out);
Trans(in,out);
getch();
//重置开关及界面等待下一次操作
chos_in=chos_out=0;
SPRD(3,13,50,15,19);
Menu(1);
break;
}
}
}
gotoxy(50,20);
return 0;
}
开发者ID:JiHyoGary,项目名称:lesson1,代码行数:38,代码来源:Transform.cpp
注:本文中的CODE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论