本文整理汇总了C++中Internal函数的典型用法代码示例。如果您正苦于以下问题:C++ Internal函数的具体用法?C++ Internal怎么用?C++ Internal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Internal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mgl_wcslen
//-----------------------------------------------------------------------------
float mglFont::Width(const wchar_t *str,int font) const
{
if(GetNumGlyph()==0 || !str || *str==0) return 0;
float ww=0,w=0;
size_t size = mgl_wcslen(str)+1;
if(parse)
{
unsigned *wcs = new unsigned[size], *buf=wcs;
memcpy(wcs,str,size*sizeof(wchar_t));
Convert(str, wcs);
for(size_t i=0;wcs[i];i++) if(wcs[i]=='\n') // parse '\n' symbol
{
wcs[i]=0; w = Puts(buf,0,0,1.,0x10|font,'k','k'); // find width
buf=wcs+i+1; if(w>ww) ww=w;
}
w = Puts(buf,0,0,1.,0x10|font,'k','k');
if(w<ww) w=ww;
delete []wcs;
}
else
{
int s = (font/MGL_FONT_BOLD)&3;
for(size_t i=0;i<size;i++)
{
long j = str[i]!=' ' ? Internal(str[i]) : Internal('!');
if(j==-1) continue;
w+= GetWidth(s,j)/fact[s];
}
}
return w;
}
示例2: CE_SetNumArg
void CE_SetNumArg (CodeEntry* E, long Num)
/* Set a new numeric argument for the given code entry that must already
** have a numeric argument.
*/
{
char Buf[16];
/* Check that the entry has a numerical argument */
CHECK (E->Flags & CEF_NUMARG);
/* Make the new argument string */
if (E->Size == 2) {
Num &= 0xFF;
xsprintf (Buf, sizeof (Buf), "$%02X", (unsigned) Num);
} else if (E->Size == 3) {
Num &= 0xFFFF;
xsprintf (Buf, sizeof (Buf), "$%04X", (unsigned) Num);
} else {
Internal ("Invalid instruction size in CE_SetNumArg");
}
/* Replace the argument by the new one */
CE_SetArg (E, Buf);
/* Use the new numerical value */
E->Num = Num;
}
示例3: FORMAT
void Logger::Error(const char *in, ...)
{
string str;
FORMAT(str);
Internal(str, "ERROR", FG_RED);
}
示例4: File
Logger::Logger(std::string path)
{
string dir = path.substr(0, path.find_last_of("/"));
m_File = new File(dir);
m_File->mkdir();
// Logger is borked if this happens
if (!m_File->open(path, FileAccessMode_Write))
{
printf("%s\n", m_File->get_last_error().c_str());
assert(0);
return;
}
UseColors(true);
ShowTraces(true);
#if DEBUG
ShowDebug(true);
#else
ShowDebug(false);
#endif
// time_t raw = time(NULL);
// char sTime[25];
// strftime(sTime, 25, "%m/%d/%Y @ %H:%M:%S", localtime(&raw));
Internal(string("# ") + Nepgear::FullName + " log started", "", FG_INVALID, false, false);
}
示例5: Start
void Start()
{
Internal("Http::Start","()");
if (enabled && !ctx)
{
// Try listening on the configured port number (8080 by default)
// and advance foward until one is available
for (int i = 0; i<100; ++i)
{
string j = print_string(port+i);
const char *options[3] = { "listening_ports", j.c_str(), NULL};
ctx = mg_start(&callback, NULL, options);
if (ctx)
break;
}
const char *option = NULL;
if (ctx)
option = mg_get_option(ctx,"listening_ports");
if (option)
{
Info("Listening for HTTP connections on port ",option);
}
else
{
Info("Not listening for HTTP connections.");
}
}
}
示例6: Cleanup
void Cleanup()
{
Internal("Logging::Cleanup","()");
initialized = false;
if (logOutput)
fileClose(&logOutput);
#if !REGAL_NO_JSON
if (jsonOutput)
{
fprintf(jsonOutput,"%s","{} ] }\n");
fileClose(&jsonOutput);
}
#endif
#if REGAL_LOG_ONCE
delete uniqueMutex;
uniqueMutex = NULL;
#endif
delete buffer;
delete bufferMutex;
buffer = NULL;
bufferMutex = NULL;
}
示例7: MacExpandStart
void MacExpandStart (Macro* M)
/* Start expanding a macro */
{
MacExp* E;
/* Check the argument */
PRECONDITION (M && (M->Style != MAC_STYLE_DEFINE || DisableDefines == 0));
/* We cannot expand an incomplete macro */
if (M->Incomplete) {
Error ("Cannot expand an incomplete macro");
return;
}
/* Don't allow too many nested macro expansions - otherwise it is possible
* to force an endless loop and assembler crash.
*/
if (MacExpansions >= MAX_MACEXPANSIONS) {
Error ("Too many nested macro expansions");
return;
}
/* Create a structure holding expansion data */
E = NewMacExp (M);
/* Call the apropriate subroutine */
switch (M->Style) {
case MAC_STYLE_CLASSIC: StartExpClassic (E); break;
case MAC_STYLE_DEFINE: StartExpDefine (E); break;
default: Internal ("Invalid macro style: %d", M->Style);
}
}
示例8: GetBranchCond
bc_t GetBranchCond (opc_t OPC)
/* Get the condition for the conditional branch in OPC */
{
switch (OPC) {
case OP65_BCC: return BC_CC;
case OP65_BCS: return BC_CS;
case OP65_BEQ: return BC_EQ;
case OP65_BMI: return BC_MI;
case OP65_BNE: return BC_NE;
case OP65_BPL: return BC_PL;
case OP65_BVC: return BC_VC;
case OP65_BVS: return BC_VS;
case OP65_JCC: return BC_CC;
case OP65_JCS: return BC_CS;
case OP65_JEQ: return BC_EQ;
case OP65_JMI: return BC_MI;
case OP65_JNE: return BC_NE;
case OP65_JPL: return BC_PL;
case OP65_JVC: return BC_VC;
case OP65_JVS: return BC_VS;
default:
Internal ("GetBranchCond: Invalid opcode: %d", OPC);
return 0;
}
}
示例9: Internal
IndexReader::IndexReader(){
//Constructor.
//Func - Creates an instance of IndexReader
//Pre - true
//Post - An instance has been created with writeLock = NULL
_internal = _CLNEW Internal(NULL, this);
}
示例10: MakeLongBranch
opc_t MakeLongBranch (opc_t OPC)
/* Return the long version of the given branch. If the branch is already
** a long branch, return the opcode unchanged.
*/
{
switch (OPC) {
case OP65_BCC:
case OP65_JCC: return OP65_JCC;
case OP65_BCS:
case OP65_JCS: return OP65_JCS;
case OP65_BEQ:
case OP65_JEQ: return OP65_JEQ;
case OP65_BMI:
case OP65_JMI: return OP65_JMI;
case OP65_BNE:
case OP65_JNE: return OP65_JNE;
case OP65_BPL:
case OP65_JPL: return OP65_JPL;
case OP65_BVC:
case OP65_JVC: return OP65_JVC;
case OP65_BVS:
case OP65_JVS: return OP65_JVS;
case OP65_BRA:
case OP65_JMP: return OP65_JMP;
default:
Internal ("MakeLongBranch: Invalid opcode: %d", OPC);
return 0;
}
}
示例11: MakeShortBranch
opc_t MakeShortBranch (opc_t OPC)
/* Return the short version of the given branch. If the branch is already
** a short branch, return the opcode unchanged.
*/
{
switch (OPC) {
case OP65_BCC:
case OP65_JCC: return OP65_BCC;
case OP65_BCS:
case OP65_JCS: return OP65_BCS;
case OP65_BEQ:
case OP65_JEQ: return OP65_BEQ;
case OP65_BMI:
case OP65_JMI: return OP65_BMI;
case OP65_BNE:
case OP65_JNE: return OP65_BNE;
case OP65_BPL:
case OP65_JPL: return OP65_BPL;
case OP65_BVC:
case OP65_JVC: return OP65_BVC;
case OP65_BVS:
case OP65_JVS: return OP65_BVS;
case OP65_BRA:
case OP65_JMP: return (CPUIsets[CPU] & CPU_ISET_65SC02)? OP65_BRA : OP65_JMP;
default:
Internal ("MakeShortBranch: Invalid opcode: %d", OPC);
return 0;
}
}
示例12: GetInverseBranch
opc_t GetInverseBranch (opc_t OPC)
/* Return a branch that reverse the condition of the branch given in OPC */
{
switch (OPC) {
case OP65_BCC: return OP65_BCS;
case OP65_BCS: return OP65_BCC;
case OP65_BEQ: return OP65_BNE;
case OP65_BMI: return OP65_BPL;
case OP65_BNE: return OP65_BEQ;
case OP65_BPL: return OP65_BMI;
case OP65_BVC: return OP65_BVS;
case OP65_BVS: return OP65_BVC;
case OP65_JCC: return OP65_JCS;
case OP65_JCS: return OP65_JCC;
case OP65_JEQ: return OP65_JNE;
case OP65_JMI: return OP65_JPL;
case OP65_JNE: return OP65_JEQ;
case OP65_JPL: return OP65_JMI;
case OP65_JVC: return OP65_JVS;
case OP65_JVS: return OP65_JVC;
default:
Internal ("GetInverseBranch: Invalid opcode: %d", OPC);
return 0;
}
}
示例13: GetInsnSize
unsigned GetInsnSize (opc_t OPC, am_t AM)
/* Return the size of the given instruction */
{
/* Get the opcode desc and check the size given there */
const OPCDesc* D = &OPCTable[OPC];
if (D->Size != 0) {
return D->Size;
}
/* Check the addressing mode. */
switch (AM) {
case AM65_IMP: return 1;
case AM65_ACC: return 1;
case AM65_IMM: return 2;
case AM65_ZP: return 2;
case AM65_ZPX: return 2;
case AM65_ABS: return 3;
case AM65_ABSX: return 3;
case AM65_ABSY: return 3;
case AM65_ZPX_IND: return 2;
case AM65_ZP_INDY: return 2;
case AM65_ZP_IND: return 2;
default:
Internal ("Invalid addressing mode");
return 0;
}
}
示例14: SizeOf
unsigned SizeOf (const Type* T)
/* Compute size of object represented by type array. */
{
switch (UnqualifiedType (T->C)) {
case T_VOID:
return 0; /* Assume voids have size zero */
case T_SCHAR:
case T_UCHAR:
return SIZEOF_CHAR;
case T_SHORT:
case T_USHORT:
return SIZEOF_SHORT;
case T_INT:
case T_UINT:
return SIZEOF_INT;
case T_PTR:
case T_FUNC: /* Maybe pointer to function */
return SIZEOF_PTR;
case T_LONG:
case T_ULONG:
return SIZEOF_LONG;
case T_LONGLONG:
case T_ULONGLONG:
return SIZEOF_LONGLONG;
case T_ENUM:
return SIZEOF_INT;
case T_FLOAT:
return SIZEOF_FLOAT;
case T_DOUBLE:
return SIZEOF_DOUBLE;
case T_STRUCT:
case T_UNION:
return ((SymEntry*) T->A.P)->V.S.Size;
case T_ARRAY:
if (T->A.L == UNSPECIFIED) {
/* Array with unspecified size */
return 0;
} else {
return T->A.L * SizeOf (T + 1);
}
default:
Internal ("Unknown type in SizeOf: %04lX", T->C);
return 0;
}
}
示例15: GetModelName
const char* GetModelName (O65Model M)
/* Map the model to its name. */
{
if (M < 0 || M >= O65_MODEL_COUNT) {
Internal ("O65 Model %d not found", M);
}
return NameTable[M];
}