本文整理汇总了C++中oops函数的典型用法代码示例。如果您正苦于以下问题:C++ oops函数的具体用法?C++ oops怎么用?C++ oops使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oops函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleFatalSignal
void handleFatalSignal(int signum, siginfo_t *si, void *ctx)
{
ucontext_t *uc = (ucontext_t*)ctx;
eDebug("KILLED BY signal %d", signum);
#ifndef NO_OOPS_SUPPORT
oops(uc->uc_mcontext, signum == SIGSEGV || signum == SIGABRT);
#endif
eDebug("-------");
bsodFatal("enigma2, signal");
}
示例2: lock_operation
void lock_operation(int fd,int op)
{
struct flock lock;
lock.l_whence=SEEK_SET;//start of the file
lock.l_start=lock.l_len=0;
lock.l_pid=getpid();
lock.l_type=op;
if(fcntl(fd,F_SETLK,&lock)==-1) oops("lock operation",1);
return;
}
示例3: get_compress_version
static int get_compress_version(struct compress *compress)
{
int version = 0;
if (ioctl(compress->fd, SNDRV_COMPRESS_IOCTL_VERSION, &version)) {
oops(compress, errno, "cant read version");
return -1;
}
return version;
}
示例4: while
void CheckedFile::open( int access, int permission )
//--------------------------------------------------
{
CheckedFile * closeIt; // file to be closed when out of handles
if( !_isOpen ) {
_openAccess = access;
_openPermission = permission;
while( _openFiles->size() >= MaxOpenReadFiles ) {
closeIt = _openFiles->back();
closeIt->privClose();
removeOpenFile( closeIt );
}
_handle = ::open( _fileName, _openAccess, _openPermission );
while( _handle == -1 && errno == EMFILE ) {
if( _openFiles->size() == 0 ) {
FileExcept oops( FileExcept::Open, errno, _fileName );
throw( oops );
}
closeIt = _openFiles->back();
closeIt->privClose();
removeOpenFile( closeIt );
_handle = ::open( _fileName, _openAccess, _openPermission );
}
if( _handle == -1 ) { // error other than out of handles
FileExcept oops( FileExcept::Open, errno, _fileName );
throw( oops );
}
_isOpen = TRUE;
_logOpen = TRUE;
_currOffset = 0;
if( !( _openAccess & O_WRONLY ) ) {
addOpenFile( this );
}
}
}
示例5: Substitute
void Expr::Substitute(hParam oldh, hParam newh) {
if(op == PARAM_PTR) oops();
if(op == PARAM && parh.v == oldh.v) {
parh = newh;
}
int c = Children();
if(c >= 1) a->Substitute(oldh, newh);
if(c >= 2) b->Substitute(oldh, newh);
}
示例6: switch
int Expr::Precedence(Expr *e) {
if(e->op == ALL_RESOLVED) return -1; // never want to reduce this marker
if(e->op != BINARY_OP && e->op != UNARY_OP) oops();
switch(e->c) {
case 'q':
case 's':
case 'c':
case 'n': return 30;
case '*':
case '/': return 20;
case '+':
case '-': return 10;
default: oops();
}
}
示例7: handleFatalSignal
void handleFatalSignal(int signum, siginfo_t *si, void *ctx)
{
#ifndef NO_OOPS_SUPPORT
ucontext_t *uc = (ucontext_t*)ctx;
oops(uc->uc_mcontext);
#endif
print_backtrace();
eDebug("-------FATAL SIGNAL (%d)", signum);
bsodFatal("enigma2, signal");
}
示例8: fetch_Single
static inline void
fetch_Single (Single_Item *item)
{
int i;
FT_UShort val;
item->coverage = mycalloc (1, sizeof(Coverage_Item));
GSUB_ptr = item->ptr;
need(6);
item->format = get_UShort();
item->coverage->ptr = item->ptr + get_UShort();
switch (item->format)
{
case 1:
val = get_Short();
item->data.delta = mycalloc (1, sizeof(FT_UShort));
*item->data.delta = val;
#ifdef DEBUG
warning("Single Substitution Format=1 with Delta=%d at 0x%04x.", val, item->ptr);
#endif
fetch_Coverage (item->coverage);
break;
case 2:
val = get_UShort();
need(2 * val);
item->data.array = mycalloc (1, sizeof(Glyph_Array));
item->data.array->count = val;
item->data.array->glyphs = mycalloc (val, sizeof(FT_UShort));
for (i = 0; i < val; i++)
item->data.array->glyphs[i] = get_UShort();
#ifdef DEBUG
warning("Single Substitution Format=2 with %d Glyphs at 0x%04x.", val, item->ptr);
#endif
val = fetch_Coverage (item->coverage);
if (val != item->data.array->count)
oops("Coverage at 0x%04x: covers %d glyphs (should be %d).", item->ptr, val, item->data.array->count);
break;
default:
oops("Single Substitution at 0x%04x: bad Format=%d.", item->ptr, item->format);
}
add_Single (item);
}
示例9: MakeColorTable
void TextWindow::MakeColorTable(const Color *in, float *out) {
int i;
for(i = 0; in[i].c != 0; i++) {
int c = in[i].c;
if(c < 0 || c > 255) oops();
out[c*3 + 0] = REDf(in[i].color);
out[c*3 + 1] = GREENf(in[i].color);
out[c*3 + 2] = BLUEf(in[i].color);
}
}
示例10: setup_socket
static int setup_socket()
{
int socket_fd = socket(PF_INET, SOCK_STREAM, 0);
if(socket_fd == -1) oops("socket initiating error...");
struct sockaddr_in address;
bzero((void *)&address, sizeof(address));
address.sin_family = AF_INET;
address.sin_addr.s_addr = inet_addr(SERVER_IP);
address.sin_port = htons(PORT);
int bind_return = bind(socket_fd, (struct sockaddr *)&address, sizeof(address));
if(bind_return == -1) oops("bind error...");
int listen_return = listen(socket_fd, 1);
if(listen_return == -1) oops("listen error...");
return socket_fd;
}
示例11: release_lock
release_lock(int semset_id) {
struct sembuf actions[1];
actions[0].sem_num = 1;
actions[0].sem_flg = SEM_UNDO;
actions[0].sem_op = -1;
if (semop(semset_id, actions, 1) == -1)
oops("semop: unlocking", 10);
}
示例12: Error
void GraphicsWindow::MenuClipboard(int id) {
if(id != MNU_DELETE && !SS.GW.LockedInWorkplane()) {
Error("Cut, paste, and copy work only in a workplane.\n\n"
"Select one with Sketch -> In Workplane.");
return;
}
switch(id) {
case MNU_PASTE: {
SS.UndoRemember();
Vector trans = SS.GW.projRight.ScaledBy(80/SS.GW.scale).Plus(
SS.GW.projUp .ScaledBy(40/SS.GW.scale));
SS.GW.ClearSelection();
SS.GW.PasteClipboard(trans, 0, 1);
break;
}
case MNU_PASTE_TRANSFORM: {
if(SS.clipboard.r.n == 0) {
Error("Clipboard is empty; nothing to paste.");
break;
}
Entity *wrkpl = SK.GetEntity(SS.GW.ActiveWorkplane());
Vector p = SK.GetEntity(wrkpl->point[0])->PointGetNum();
SS.TW.shown.paste.times = 1;
SS.TW.shown.paste.trans = Vector::From(0, 0, 0);
SS.TW.shown.paste.theta = 0;
SS.TW.shown.paste.origin = p;
SS.TW.shown.paste.scale = 1;
SS.TW.GoToScreen(TextWindow::SCREEN_PASTE_TRANSFORMED);
SS.GW.ForceTextWindowShown();
SS.later.showTW = true;
break;
}
case MNU_COPY:
SS.GW.CopySelection();
SS.GW.ClearSelection();
break;
case MNU_CUT:
SS.UndoRemember();
SS.GW.CopySelection();
SS.GW.DeleteSelection();
break;
case MNU_DELETE:
SS.UndoRemember();
SS.GW.DeleteSelection();
break;
default: oops();
}
}
示例13: _is_codec_supported
static bool _is_codec_supported(struct compress *compress, struct compr_config *config,
const struct snd_compr_caps *caps)
{
bool codec = false;
unsigned int i;
for (i = 0; i < caps->num_codecs; i++) {
if (caps->codecs[i] == config->codec->id) {
/* found the codec */
codec = true;
break;
}
}
if (codec == false) {
oops(compress, ENXIO, "this codec is not supported");
return false;
}
if (config->fragment_size < caps->min_fragment_size) {
oops(compress, EINVAL, "requested fragment size %d is below min supported %d",
config->fragment_size, caps->min_fragment_size);
return false;
}
if (config->fragment_size > caps->max_fragment_size) {
oops(compress, EINVAL, "requested fragment size %d is above max supported %d",
config->fragment_size, caps->max_fragment_size);
return false;
}
if (config->fragments < caps->min_fragments) {
oops(compress, EINVAL, "requested fragments %d are below min supported %d",
config->fragments, caps->min_fragments);
return false;
}
if (config->fragments > caps->max_fragments) {
oops(compress, EINVAL, "requested fragments %d are above max supported %d",
config->fragments, caps->max_fragments);
return false;
}
/* TODO: match the codec properties */
return true;
}
示例14: main
int main(int argc,char **argv)
{
uint16 u16;
if (!*argv) usage();
if (!*++argv) usage();
if (!parsetype(*argv,type)) usage();
if (!*++argv) usage();
if (!dns_domain_fromdot(&q,*argv,str_len(*argv))) oops();
if (*++argv) {
if (!ip4_scan(*argv,ip)) usage();
}
if (!stralloc_copys(&out,"")) oops();
/* uint16_unpack_big(type,&u16);
if (!stralloc_catulong0(&out,u16,0)) oops();
if (!stralloc_cats(&out," ")) oops();
if (!dns_domain_todot_cat(&out,q)) oops();
if (!stralloc_cats(&out,":\n")) oops(); */
if (!response_query(q,type,DNS_C_IN)) oops();
response[3] &= ~128;
response[2] &= ~1;
response[2] |= 4;
case_lowerb(q,dns_domain_length(q));
if (byte_equal(type,2,DNS_T_AXFR)) {
response[3] &= ~15;
response[3] |= 4;
}
else
if (!respond(q,type,ip)) goto DONE;
if (!printpacket_cat(&out,response,response_len)) oops();
DONE:
buffer_putflush(buffer_1,out.s,out.len);
_exit(0);
}
示例15: WeightControlPoints
void SSurface::SplitInHalf(bool byU, SSurface *sa, SSurface *sb) {
sa->degm = sb->degm = degm;
sa->degn = sb->degn = degn;
// by de Casteljau's algorithm in a projective space; so we must work
// on points (w*x, w*y, w*z, w)
WeightControlPoints();
switch(byU ? degm : degn) {
case 1:
sa->CopyRowOrCol (byU, 0, this, 0);
sb->CopyRowOrCol (byU, 1, this, 1);
sa->BlendRowOrCol(byU, 1, this, 0, this, 1);
sb->BlendRowOrCol(byU, 0, this, 0, this, 1);
break;
case 2:
sa->CopyRowOrCol (byU, 0, this, 0);
sb->CopyRowOrCol (byU, 2, this, 2);
sa->BlendRowOrCol(byU, 1, this, 0, this, 1);
sb->BlendRowOrCol(byU, 1, this, 1, this, 2);
sa->BlendRowOrCol(byU, 2, sa, 1, sb, 1);
sb->BlendRowOrCol(byU, 0, sa, 1, sb, 1);
break;
case 3: {
SSurface st;
st.degm = degm; st.degn = degn;
sa->CopyRowOrCol (byU, 0, this, 0);
sb->CopyRowOrCol (byU, 3, this, 3);
sa->BlendRowOrCol(byU, 1, this, 0, this, 1);
sb->BlendRowOrCol(byU, 2, this, 2, this, 3);
st. BlendRowOrCol(byU, 0, this, 1, this, 2); // scratch var
sa->BlendRowOrCol(byU, 2, sa, 1, &st, 0);
sb->BlendRowOrCol(byU, 1, sb, 2, &st, 0);
sa->BlendRowOrCol(byU, 3, sa, 2, sb, 1);
sb->BlendRowOrCol(byU, 0, sa, 2, sb, 1);
break;
}
default: oops();
}
sa->UnWeightControlPoints();
sb->UnWeightControlPoints();
UnWeightControlPoints();
}