本文整理汇总了C++中RAISE函数的典型用法代码示例。如果您正苦于以下问题:C++ RAISE函数的具体用法?C++ RAISE怎么用?C++ RAISE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RAISE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kc_abort_tran
extern CAMLprim
value kc_abort_tran(value caml_db)
{
CAMLparam1(caml_db);
KCDB* db = get_db(caml_db);
if (! kcdbendtran(db, 0)) {
const char *error = kcdbemsg(db);
RAISE(error);
}
CAMLreturn(Val_unit);
}
示例2: MP_muli
T MP_muli(T z, T x, long y) {
assert(x); assert(z);
if (-BASE < y && y < BASE) {
int sx = sign(x), sy = y < 0;
if (sx) {
XP_neg(nbytes, tmp[0], x, 1);
x = tmp[0];
x[nbytes-1] &= msb;
}
XP_product(nbytes, z, x, sy ? -y : y);
if (sx != sy)
XP_neg(nbytes, z, x, 1);
z[nbytes-1] &= msb;
if (sx == sy && sign(z))
RAISE(MP_Overflow);
if (nbits < 8
&& (y < -(1<<(nbits-1)) || y >= (1<<(nbits-1))))
RAISE(MP_Overflow);
} else if (apply(MP_mul, z, x, y))
RAISE(MP_Overflow);
return z;
}
示例3: kc_begin_tran_sync
extern CAMLprim
value kc_begin_tran_sync(value caml_db)
{
CAMLparam1(caml_db);
KCDB* db = get_db(caml_db);
if (! kcdbbegintran(db, 1)) {
const char *error = kcdbemsg(db);
RAISE(error);
}
CAMLreturn(Val_unit);
}
示例4: RAISE
void ImageAPI::setBrightness(double n)
{
if (!checkHaveDocument())
RAISE("No document open");
if (item == nullptr)
return ;
if (! item->asImageFrame())
{
RAISE("Specified item not an image frame.");
return;
}
ImageEffect ef;
ef.effectCode = ScImage::EF_BRIGHTNESS;
ScTextStream fp(&ef.effectParameters, QIODevice::WriteOnly);
fp << n;
item->effectsInUse.append(ef);
item->pixm.applyEffect(item->effectsInUse, ScCore->primaryMainWindow()->doc->PageColors, false);
ScCore->primaryMainWindow()->doc->updatePic();
}
示例5: iridium_method
// Instantiate a File with a filename
iridium_method(File, initialize) {
object self = local(self);
object filename = local(filename);
object mode = local(mode);
FILE * f = fopen(C_STRING(context, filename), C_STRING(context, mode));
send(self, "__set__", L_ATOM(filename), filename);
send(self, "__set__", L_ATOM(mode), mode);
if (NULL == f) {
RAISE(send(CLASS(FileNotFoundError), "new", filename));
}
internal_set_attribute(self, L_ATOM(FILE), f);
return NIL;
}
示例6: read_map
static void read_map(JSONSource* self, rich_Sink* to) {
Input* in = self->in;
call(to, sink, RICH_MAP, NULL);
bool first = true;
for (;;) {
int ch = skip_whitespace(in);
if (ch == '}') break;
if (first) {
first = false;
} else {
if (ch != ',') RAISE(MALFORMED);
ch = skip_whitespace(in);
}
if (ch != '"') RAISE(MALFORMED);
read_string(self);
call(to, sink, RICH_KEY, &self->sval);
ch = skip_whitespace(in);
if (ch != ':') RAISE(MALFORMED);
read_value(self, to);
}
call(to, sink, RICH_ENDMAP, NULL);
}
示例7: resetAndHaltTarget
/**********************************************************
* Resets the target CPU by using the AIRCR register.
* The target will be halted immediately when coming
* out of reset. Does not reset the debug interface.
**********************************************************/
void resetAndHaltTarget(void)
{
uint32_t dhcsr;
int timeout = DEBUG_EVENT_TIMEOUT;
/* Halt target first. This is necessary before setting
* the VECTRESET bit */
haltTarget();
/* Set halt-on-reset bit */
writeMem((uint32_t)&(CoreDebug->DEMCR), CoreDebug_DEMCR_VC_CORERESET_Msk);
/* Clear exception state and reset target */
writeAP(AP_TAR, (uint32_t)&(SCB->AIRCR));
writeAP(AP_DRW, (0x05FA << SCB_AIRCR_VECTKEY_Pos) |
SCB_AIRCR_VECTCLRACTIVE_Msk |
SCB_AIRCR_VECTRESET_Msk);
/* Wait for target to reset */
do {
delayUs(10);
timeout--;
dhcsr = readMem((uint32_t)&(CoreDebug->DHCSR));
} while ( dhcsr & CoreDebug_DHCSR_S_RESET_ST_Msk );
/* Check if we timed out */
dhcsr = readMem((uint32_t)&(CoreDebug->DHCSR));
if ( dhcsr & CoreDebug_DHCSR_S_RESET_ST_Msk )
{
RAISE(SWD_ERROR_TIMEOUT_WAITING_RESET);
}
/* Verify that target is halted */
if ( !(dhcsr & CoreDebug_DHCSR_S_HALT_Msk) )
{
RAISE(SWD_ERROR_TARGET_NOT_HALTED);
}
}
示例8: movie_get_busy
static PyObject*
movie_get_busy (PyObject* self)
{
SMPEG* movie;
if (!SDL_WasInit (SDL_INIT_VIDEO))
return RAISE (PyExc_SDLError,
"cannot convert without pygame.display initialized");
movie = PyMovie_AsSMPEG (self);
return PyInt_FromLong (SMPEG_status (movie) == SMPEG_PLAYING);
}
示例9: RAISE
void *Mem_alloc(long nbytes, const char *file, int line)
{
void *ptr;
if (nbytes <= 0) {
if (file == NULL)
RAISE(Mem_Failed);
else
Except_raise(&Mem_Failed, file, line);
}
ptr = malloc(nbytes);
if (ptr == NULL) {
if (file == NULL) {
RAISE(Mem_Failed);
}
else {
Except_raise(&Mem_Failed, file, line);
}
}
alt++;
return ptr;
}
示例10: assert
void *Mem_alloc(long nbytes, const char *file, int line) {
void *ptr;
assert(nbytes > 0);
ptr = malloc(nbytes);
if (ptr == NULL)
{
if (file == NULL)
RAISE(Mem_Failed);
else
Except_raise(&Mem_Failed, file, line);
}
return ptr;
}
示例11: cd_get_track_audio
static PyObject*
cd_get_track_audio (PyObject* self, PyObject* args)
{
int cd_id = PyCD_AsID (self);
SDL_CD* cdrom = cdrom_drivedata[cd_id];
int track;
if (!PyArg_ParseTuple (args, "i", &track)) {
return NULL;
}
CDROM_INIT_CHECK ();
if (!cdrom) {
return RAISE (PyExc_SDLError, "CD drive not initialized");
}
SDL_CDStatus (cdrom);
if (track < 0 || track >= cdrom->numtracks) {
return RAISE (PyExc_IndexError, "Invalid track number");
}
return PyInt_FromLong (cdrom->track[track].type == SDL_AUDIO_TRACK);
}
示例12: cd_get_track_start
static PyObject*
cd_get_track_start (PyObject* self, PyObject* args)
{
int cd_id = PyCD_AsID (self);
SDL_CD* cdrom = cdrom_drivedata[cd_id];
int track;
if (!PyArg_ParseTuple (args, "i", &track)) {
return NULL;
}
CDROM_INIT_CHECK ();
if (!cdrom) {
return RAISE (PyExc_SDLError, "CD drive not initialized");
}
SDL_CDStatus (cdrom);
if (track < 0 || track >= cdrom->numtracks) {
return RAISE (PyExc_IndexError, "Invalid track number");
}
return PyFloat_FromDouble (cdrom->track[track].offset / (double) CD_FPS);
}
示例13: masterNames
void DocumentAPI::editMasterPage(QString name)
{
if (!check())
return;
const QMap<QString,int>& masterNames(ScCore->primaryMainWindow()->doc->MasterNames);
const QMap<QString,int>::const_iterator it(masterNames.find(name));
if (it == masterNames.constEnd())
{
RAISE("Master page not found");
return;
}
ScCore->primaryMainWindow()->view->showMasterPage(*it);
}
示例14: GetUniqueItem
/* 04/07/10 returns selection if is not name specified pv */
PageItem* GetUniqueItem(QString name)
{
if (name.length()==0)
if (ScCore->primaryMainWindow()->doc->m_Selection->count() != 0)
return ScCore->primaryMainWindow()->doc->m_Selection->itemAt(0);
else
{
RAISE("Cannot use empty string for object name when there is no selection");
return NULL;
}
else
return getPageItemByName(name);
}
示例15: joy_get_numballs
static PyObject*
joy_get_numballs (PyObject* self)
{
int joy_id = PyJoystick_AsID (self);
SDL_Joystick* joy = joystick_stickdata[joy_id];
JOYSTICK_INIT_CHECK ();
if (!joy) {
return RAISE (PyExc_SDLError, "Joystick not initialized");
}
return PyInt_FromLong (SDL_JoystickNumBalls (joy));
}