• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RAISE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RAISE函数的典型用法代码示例。如果您正苦于以下问题:C++ RAISE函数的具体用法?C++ RAISE怎么用?C++ RAISE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RAISE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:didier-wenzek,项目名称:ocaml-kyotocabinet,代码行数:13,代码来源:kyoto_ocaml_wrapper.c


示例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;
}
开发者ID:wonghoifung,项目名称:reviewing-c,代码行数:22,代码来源:mp.c


示例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);
}
开发者ID:didier-wenzek,项目名称:ocaml-kyotocabinet,代码行数:13,代码来源:kyoto_ocaml_wrapper.c


示例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();
}
开发者ID:luzpaz,项目名称:scribus,代码行数:22,代码来源:api_imageitem.cpp


示例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;
}
开发者ID:cconklin,项目名称:iridium,代码行数:14,代码来源:ir_file.c


示例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);
}
开发者ID:vaughan0,项目名称:vlib,代码行数:22,代码来源:rich_json.c


示例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);
  }
}
开发者ID:zoulincheng,项目名称:stm32chip_project,代码行数:44,代码来源:utils_old.c


示例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);
}
开发者ID:CMPUT274-Project,项目名称:Assignment_4,代码行数:13,代码来源:movie.c


示例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;
}
开发者ID:fionser,项目名称:C_Interfaces,代码行数:22,代码来源:mem.c


示例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;
}
开发者ID:norbour,项目名称:AlgorithmStudy,代码行数:13,代码来源:mem.c


示例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);
}
开发者ID:IuryAlves,项目名称:pygame,代码行数:22,代码来源:cdrom.c


示例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);
}
开发者ID:IuryAlves,项目名称:pygame,代码行数:22,代码来源:cdrom.c


示例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);
}
开发者ID:JLuc,项目名称:scribus,代码行数:13,代码来源:api_document.cpp


示例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);
}
开发者ID:QuLogic,项目名称:scribus-plugin-scripter,代码行数:14,代码来源:utils.cpp


示例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));
}
开发者ID:Anugrahaa,项目名称:anagrammatic,代码行数:13,代码来源:joystick.c


示例16: mediacontrol_start

/*
 * Known issues: since moving in the playlist using playlist_Next
 * or playlist_Prev implies starting to play items, the a_position
 * argument will be only honored for the 1st item in the list.
 *
 * XXX:FIXME split moving in the playlist and playing items two
 * different actions or make playlist_<Next|Prev> accept a time
 * value to start to play from.
 */
void
mediacontrol_start( mediacontrol_Instance *self,
                    const mediacontrol_Position * a_position,
                    mediacontrol_Exception *exception )
{
    libvlc_media_t * p_media;
    char * psz_name;
    libvlc_exception_t ex;

    mediacontrol_exception_init( exception );
    libvlc_exception_init( &ex );

    p_media = libvlc_media_player_get_media( self->p_media_player, &ex );
    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

    if ( ! p_media )
    {
        /* No media was defined. */
        RAISE( mediacontrol_PlaylistException, "No defined media." );
    }
    else
    {
        /* A media was defined. Get its mrl to reuse it, but reset the options
           (because start-time may have been set on the previous invocation */
        psz_name = libvlc_media_get_mrl( p_media, &ex );
        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

        /* Create a new media */
        p_media = libvlc_media_new( self->p_instance, psz_name, &ex );
        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

        if( a_position->value )
        {
            char * psz_from;
            libvlc_time_t i_from;

            /* A start position was specified. Add it to media options */
            psz_from = ( char * )malloc( 20 * sizeof( char ) );
            i_from = private_mediacontrol_position2microsecond( self->p_media_player, a_position ) / 1000000;
            snprintf( psz_from, 20, "start-time=%"PRId64, i_from );
            libvlc_media_add_option( p_media, psz_from, &ex );
            HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
        }

        libvlc_media_player_set_media( self->p_media_player, p_media, &ex );
        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );

        libvlc_media_player_play( self->p_media_player, &ex );
        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
    }
}
开发者ID:mahaserver,项目名称:MHSVLC,代码行数:60,代码来源:mediacontrol_core.c


示例17: PUSH_ROOT

obj_t *apply_procedure(obj_t *proc, obj_t *args)
{
    PUSH_ROOT(proc);
    PUSH_ROOT(args);
    AUTO_ROOT(body, procedure_body(proc));
    if (procedure_is_C(proc)) {
	obj_t *env = F_ENV;
	if (!procedure_is_special_form(proc))
	    env = procedure_env(proc);
	GOTO_FRAME(make_short_frame, (C_procedure_t *)body, args, env);
    }
    AUTO_ROOT(new_env, make_env(procedure_env(proc)));
    AUTO_ROOT(formals, procedure_args(proc));
    AUTO_ROOT(actuals, args);
    while (!is_null(formals) || !is_null(actuals)) {
	if (is_null(formals)) {
	    printf_unchecked("calling %O\n", proc);
	    RAISE("too many args");
	}
	obj_t *formal, *actual;
	if (is_pair(formals)) {
	    if (is_null(actuals)) {
		printf_unchecked("proc=%O\n", proc);
		RAISE("not enough args");
	    }
	    formal  = pair_car(formals);
	    formals = pair_cdr(formals);
	    actual  = pair_car(actuals);
	    actuals = pair_cdr(actuals);
	} else {
	    formal  = formals;
	    actual  = actuals;
	    formals = actuals = NIL;
	}
	env_bind(new_env, formal, BT_LEXICAL, M_MUTABLE, actual);
    }
    GOTO(b_eval_sequence, body, new_env);
}
开发者ID:kbob,项目名称:kbscheme,代码行数:38,代码来源:eval.c


示例18: cpu_set_gpreg

PyObject *
cpu_set_gpreg(JitCpu *self, PyObject *args) {
    PyObject *dict;
    PyObject *d_key, *d_value = NULL;
    Py_ssize_t pos = 0;
    uint64_t val;
    unsigned int i;

    if (!PyArg_ParseTuple(args, "O", &dict))
	return NULL;
    if(!PyDict_Check(dict))
	RAISE(PyExc_TypeError, "arg must be dict");

    while(PyDict_Next(dict, &pos, &d_key, &d_value)) {
	int found = 0;

	if(!PyString_Check(d_key))
	    RAISE(PyExc_TypeError, "key must be str");

	PyGetInt(d_value, val);

	for (i=0; i < sizeof(gpreg_dict)/sizeof(reg_dict); i++){
	    if (strcmp(PyString_AsString(d_key), gpreg_dict[i].name))
		continue;
	    *((uint32_t*)(((char*)(self->cpu)) + gpreg_dict[i].offset)) = val;
	    found = 1;
	    break;
	}

	if (found)
	    continue;
	fprintf(stderr, "unknown key: %s\n", PyString_AsString(d_key));
	RAISE(PyExc_ValueError, "unknown reg");
    }

    Py_INCREF(Py_None);
    return Py_None;
}
开发者ID:commial,项目名称:miasm,代码行数:38,代码来源:JitCore_ppc32.c


示例19: qDebug

void PrinterAPI::setPages(QList<QVariant> list)
{
	this->pages.clear();
	for(int i=0; i<list.count(); ++i)
	{
		if(list[i].toInt() > ScCore->primaryMainWindow()->doc->Pages->count())
		{
			qDebug()<<"trying to raise an exception";
			RAISE("pages value out of range.");
		}
		else
			this->pages.append(list[i].toInt());
	}
}
开发者ID:Fahad-Alsaidi,项目名称:scribus,代码行数:14,代码来源:api_printer.cpp


示例20: assert

void *Mem_copy( void* destination, void* source, long nbytes, const char *file, int line ) {
	assert(nbytes > 0);

    void *ptr;
	ptr = memcpy( destination, source, nbytes );
	if (ptr == NULL) {
        if (file == NULL)
            RAISE(Mem_Failed);
        else
	        Except_raise(&Mem_Failed, file, line);
    }
    
    return ptr; 
}
开发者ID:wuyefeng1975,项目名称:DataStructures,代码行数:14,代码来源:mem.c



注:本文中的RAISE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RAISE_ERROR函数代码示例发布时间:2022-05-30
下一篇:
C++ RAID_MODE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap