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

C++ raise_error函数代码示例

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

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



在下文中一共展示了raise_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: create_miter_for_walk

static void create_miter_for_walk(folly::Optional<MArrayIter>& miter,
                                  Variant& var) {
  if (!var.is(KindOfObject)) {
    miter.emplace(var.asRef()->m_data.pref);
    return;
  }

  auto const odata = var.getObjectData();
  if (odata->isCollection()) {
    raise_error("Collection elements cannot be taken by reference");
  }
  bool isIterable;
  Object iterable = odata->iterableObject(isIterable);
  if (isIterable) {
    raise_fatal_error("An iterator cannot be used with "
                              "foreach by reference");
  }
  Array properties = iterable->o_toIterArray(null_string,
                                             ObjectData::CreateRefs);
  miter.emplace(properties.detach());
}
开发者ID:fredemmott,项目名称:hhvm,代码行数:21,代码来源:array-util.cpp


示例2: engine_write

VALUE engine_write(VALUE self, VALUE str) {
  ms_conn* conn;
  int bytes;

  Data_Get_Struct(self, ms_conn, conn);

  StringValue(str);

  ERR_clear_error();

  bytes = SSL_write(conn->ssl, (void*)RSTRING_PTR(str), (int)RSTRING_LEN(str));
  if(bytes > 0) {
    return INT2FIX(bytes);
  }

  if(SSL_want_write(conn->ssl)) return Qnil;

  raise_error(conn->ssl, bytes);

  return Qnil;
}
开发者ID:4rth4X,项目名称:puma,代码行数:21,代码来源:mini_ssl.c


示例3: _m_unserialize

/**
 * build mtree from serialized mtree data
 *
 * @params[in] pointer to serialized data
 * @returns handle to new mtree
 *
 */
H _m_unserialize(S *s) {
    M *m = malloc(sizeof(M));
    m->magic = s->magic;
    m->levels = s->levels;
    m->lP = malloc(sizeof(L)*m->levels);
    H h = {m,{0,0}};
    void *blob = s->blob_offset + (void *)s;

    uint32_t s_size = SERIALIZED_HEADER_SIZE(m->levels);
    for(h.a.l=0; h.a.l<m->levels; h.a.l++) {
        L *sl = (L *) (((void *)s) + s_size + ((S *)s)->level_offsets[h.a.l]);
        L *l = GET_LEVEL(h);
        l->nodes = sl->nodes;
        l->nP = malloc(sizeof(N)*l->nodes);
        N *sn = sizeof(Mindex)+(void *)sl;
        for(h.a.i=0;h.a.i < l->nodes;h.a.i++) {
            N *n = GET_NODE(h,l);
            *n = *sn;
            void *surface = blob+*(size_t *)&sn->surface;
            if (n->flags & TFLAG_SURFACE_IS_TREE && !(n->flags & TFLAG_SURFACE_IS_RECEPTOR)) {
                if (!(n->flags & TFLAG_ALLOCATED)) {
                    raise_error("whoa! orthogonal tree handles are supposed to be allocated!");
                }
                H sh = _m_unserialize((S *)surface);
                n->surface = malloc(sizeof(H));
                memcpy(n->surface,&sh,sn->size);
            }
            else if (n->flags & TFLAG_ALLOCATED) {
                n->surface = malloc(sn->size);
                memcpy(n->surface,surface,sn->size);
            }
            else {
                memcpy(&n->surface,&sn->surface,sn->size);
            }
            sn = (N *) (SERIALIZED_NODE_SIZE + ((void*)sn));
        }
    }
    h.a.i = h.a.l = 0;
    return h;
}
开发者ID:tropology,项目名称:ceptr,代码行数:47,代码来源:mtree.c


示例4: HHVM_FUNCTION

  XDEBUG_NOTIMPLEMENTED

static void HHVM_FUNCTION(xdebug_start_code_coverage,
                          int64_t options /* = 0 */) {
  // XDEBUG_CC_UNUSED and XDEBUG_CC_DEAD_CODE not supported right now primarily
  // because the internal CodeCoverage class does support either unexecuted line
  // tracking or dead code analysis
  if (options != 0) {
    raise_error("XDEBUG_CC_UNUSED and XDEBUG_CC_DEAD_CODE constants are not "
                "currently supported.");
    return;
  }

  // If we get here, turn on coverage
  auto ti = ThreadInfo::s_threadInfo.getNoCheck();
  ti->m_reqInjectionData.setCoverage(true);
  if (g_context->isNested()) {
    raise_notice("Calling xdebug_start_code_coverage from a nested VM instance "
                 "may cause unpredicable results");
  }
  throw VMSwitchModeBuiltin();
}
开发者ID:DerPapst,项目名称:hhvm,代码行数:22,代码来源:ext_xdebug.cpp


示例5: switch

void FiberReferenceMap::unmarshal(Array &dest, CArrRef src, char strategy) {
  switch (strategy) {
    case FiberAsyncFunc::GlobalStateIgnore:
      // do nothing
      break;
    case FiberAsyncFunc::GlobalStateOverwrite:
      dest = src.fiberUnmarshal(*this);
      break;
    case FiberAsyncFunc::GlobalStateSkip:
      for (ArrayIter iter(src); iter; ++iter) {
        Variant key = iter.first();
        if (!dest.exists(key)) {
          dest.set(key.fiberUnmarshal(*this),
                   ref(iter.secondRef().fiberUnmarshal(*this)));
        }
      }
      break;
    default:
      raise_error("unknown strategy: %d", (int)strategy);
      break;
  }
}
开发者ID:Jostein,项目名称:hiphop-php,代码行数:22,代码来源:fiber_reference_map.cpp


示例6: assert

String StringUtil::HtmlEncode(CStrRef input, QuoteStyle quoteStyle,
                              const char *charset, bool nbsp) {
  if (input.empty()) return input;

  assert(charset);
  bool utf8 = true;
  if (strcasecmp(charset, "ISO-8859-1") == 0) {
    utf8 = false;
  } else if (strcasecmp(charset, "UTF-8")) {
    throw NotImplementedException(charset);
  }

  int len = input.size();
  char *ret = string_html_encode(input.data(), len,
                                 quoteStyle != QuoteStyle::No,
                                 quoteStyle == QuoteStyle::Both,
                                 utf8, nbsp);
  if (!ret) {
    raise_error("HtmlEncode called on too large input (%d)", len);
  }
  return String(ret, len, AttachString);
}
开发者ID:Tlamelo,项目名称:hiphop-php,代码行数:22,代码来源:string-util.cpp


示例7: init_vsim

/*****************************************************************************
 * Function: init_vsim                            
 * Description: Initializes a Modelsim .mem data structure
 *****************************************************************************/
void init_vsim(config_type *config, vsim_file_info *vsim) {


  // You might have to change this output manually

  // Allocate memory for the vsim_file_info variable
  vsim->comment = (char *)calloc(1024, 1);
  vsim->instance = (char *)calloc(1024, 1);
  vsim->flags = (char *)calloc(1024, 1);


  if ((!vsim->comment) || (!vsim->instance) || (!vsim->flags)) {
    raise_error(config, ERR_NOMEM);
  }

  strcpy(vsim->comment, "// memory data file (do not edit the following line - required for mem load use)\n");
  strcpy(vsim->instance, "// instance=/fb_dualport/ram\n");
  strcpy(vsim->flags, "// format=hex addressradix=h dataradix=h version=1.0 wordsperline=1 noaddress\n");


  return;
}
开发者ID:mjsenter,项目名称:cpre480x,代码行数:26,代码来源:vsim_utils.c


示例8: read_text

static void
read_text(PInfo pi) {
    char	buf[MAX_TEXT_LEN];
    char	*b = buf;
    char	*alloc_buf = 0;
    char	*end = b + sizeof(buf) - 2;
    char	c;
    int		done = 0;

    while (!done) {
	c = *pi->s++;
	switch(c) {
	case '<':
	    done = 1;
	    pi->s--;
	    break;
	case '\0':
	    raise_error("invalid format, document not terminated", pi->str, pi->s);
	default:
	    if ('&' == c) {
		c = read_coded_char(pi);
	    }
	    if (end <= b) {
		unsigned long	size;
		
		if (0 == alloc_buf) {
		    size = sizeof(buf) * 2;
		    alloc_buf = ALLOC_N(char, size);
		    memcpy(alloc_buf, buf, b - buf);
		    b = alloc_buf + (b - buf);
		} else {
		    unsigned long	pos = b - alloc_buf;

		    size = (end - alloc_buf) * 2;
		    REALLOC_N(alloc_buf, char, size);
		    b = alloc_buf + pos;
		}
		end = alloc_buf + size - 2;
	    }
开发者ID:MSNexploder,项目名称:ox,代码行数:39,代码来源:parse.c


示例9: glGenFramebuffers

void light_t::add(vec4 amb, vec4 diff, vec4 spec, int window[2], int shad_size)
{
	cnt++;
	ambient.push_back(amb);
	diffuse.push_back(diff);
	specular.push_back(spec);
	depth_tex.push_back(texture_create_depth(window[0] * shad_size, window[1] * shad_size));
	depthFBO.push_back(-1);

	GLenum fboStatus;

	glGenFramebuffers(1, &depthFBO[cnt - 1]);
	glBindFramebuffer(GL_FRAMEBUFFER, depthFBO[cnt - 1]);
	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_tex[cnt - 1], 0);

	glDrawBuffer(GL_NONE);
	glReadBuffer(GL_NONE);

	if ((fboStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER)) != GL_FRAMEBUFFER_COMPLETE)
		raise_error("Framebuffer error ", false, true);
	glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
开发者ID:Cryostasis,项目名称:CG_ALL,代码行数:22,代码来源:light.cpp


示例10: HHVM_FUNCTION

void HHVM_FUNCTION(pcntl_exec,
                   const String& path,
                   const Array& args /* = null_array */,
                   const Array& envs /* = null_array */) {
  if (RuntimeOption::WhitelistExec && !check_cmd(path.data())) {
    return;
  }
  if (Repo::prefork()) {
    raise_error("execing is disallowed in multi-threaded mode");
    return;
  }

  // build argumnent list
  std::vector<String> sargs; // holding those char *
  int size = args.size();
  char **argv = (char **)malloc((size + 2) * sizeof(char *));
  *argv = (char *)path.data();
  int i = 1;
  if (size) {
    sargs.reserve(size);
    for (ArrayIter iter(args); iter; ++iter, ++i) {
      String arg = iter.second().toString();
      sargs.push_back(arg);
      *(argv + i) = (char *)arg.data();
    }
  }
  *(argv + i) = NULL;

  // build environment pair list
  std::vector<String> senvs; // holding those char *
  char **envp = build_envp(envs, senvs);
  if (execve(path.c_str(), argv, envp) == -1) {
    raise_warning("Error has occurred: (errno %d) %s",
                    errno, folly::errnoStr(errno).c_str());
  }

  free(envp);
  free(argv);
}
开发者ID:milesj,项目名称:hhvm,代码行数:39,代码来源:ext_process.cpp


示例11: main

int main()
{
    //Declare buffers for user input
    char line[LINE_LEN];

    //Initialize socket file descriptor
    int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
    if (sockfd < 0)
        raise_error("Error opening socket");

    //Prompt user to enter the port number
    int port_num;
    printf("Enter the port number: ");
    if ( fgets(line, sizeof(line), stdin) )
        sscanf(line, "%d", &port_num);

    //Prompt user to enter the server's IP address
    char server_ip[IP_LEN];
    printf("Enter the IP address of server: ");
    if ( fgets(line, sizeof(line), stdin) )
        sscanf(line, "%[^\n]s", server_ip);

    //Set up remote server address
    struct sockaddr_in server;
    server.sin_family = AF_INET;
    server.sin_port = htons(port_num);
    server.sin_addr.s_addr = inet_addr(server_ip);

    //Prompt user to enter the message to server
    printf("Enter the message: \n");
    char msg[BUFF_SIZE];
    if ( fgets(line, sizeof(line), stdin) )
        sscanf(line, "%[^\n]s", msg);
    sendto(sockfd, msg, strlen(msg), 0, (struct sockaddr *) &server, sizeof(server));

    //Terminate the transfer
    close(sockfd);

}
开发者ID:goan15910,项目名称:socket_program,代码行数:39,代码来源:client1-UDP.c


示例12: stub_pcap_stats

CAMLprim value
stub_pcap_stats (value p_p)
{
	CAMLparam1 (p_p);
	CAMLlocal1 (ret);
	pcap_t *p;
	struct pcap_stat ps;

	p = (pcap_t *) p_p;

	if (pcap_stats(p, &ps)) {
		raise_error (pcap_geterr (p));
	}

	ret = caml_alloc (3, 0);

	Store_field (ret, 0, copy_int64 (ps.ps_recv));
	Store_field (ret, 1, copy_int64 (ps.ps_drop));
	Store_field (ret, 2, copy_int64 (ps.ps_ifdrop));

	CAMLreturn (ret);
}
开发者ID:johnlepikhin,项目名称:mpcap,代码行数:22,代码来源:mpcap_stubs.c


示例13: checkHHConfig

void checkHHConfig(const Unit* unit) {

  if (RuntimeOption::RepoAuthoritative ||
      !RuntimeOption::LookForTypechecker ||
      s_foundHHConfig ||
      !unit->isHHFile() ||
      isDebuggerAttached()) {
    return;
  }

  const std::string &s = unit->filepath()->toCppString();
  boost::filesystem::path p(s);

  while (p != "/" && p != "") {
    p.remove_filename();
    p /= ".hhconfig";

    if (boost::filesystem::exists(p)) {
      break;
    }

    p.remove_filename();
  }

  if (p == "/" || p == "") {
    raise_error(
      "%s appears to be a Hack file, but you do not appear to be running "
      "the Hack typechecker. See the documentation at %s for information on "
      "getting it running. You can also set "
      "`-d hhvm.hack.lang.look_for_typechecker=0` "
      "to disable this check (not recommended).",
      s.c_str(),
      "http://docs.hhvm.com/hack/typechecker/setup"
    );
  } else {
    s_foundHHConfig = true;
  }
}
开发者ID:DerPapst,项目名称:hhvm,代码行数:38,代码来源:hh-utils.cpp


示例14: exec_code

/** A more generic function than exec_call, this one actually lets you
 * execute any piece of code (more than just a simple function call).
 * It automatically wraps the snippet in a function.
 *
 * \param code The code to execute.
 */
string exec_code(string code) {
   string buf, err;
   mixed ret;
   string fname;

   if( !this_player() )
      raise_error("exec_code must have a valid this_player() using it");

   fname = this_player()->make_path_absolute( EXEC_OBJ );

   if( ret = find_object(fname) ) destruct(ret);
   if( file_exists(fname + ".c") &&  !rm( fname + ".c" ) )
      return "Unable to remove file "+fname+" to execute call.";
   buf = HEADER +
         EXEC_MACROS +"\ndo_exec() {\n";

   buf += code + "\n}\n";


   write_file( fname + ".c", buf );
   err = catch(ret = load_object( fname ));
   if( err ) {
      msg("==> [Exec Error] "+err);
      return "<Invalid>";
   }

   seteuid( getuid(this_player()) );
   export_uid( ret );
   seteuid( getuid(this_object()) );
   ret = 0;
   err = catch(ret = fname->do_exec());
   if( err ) {
      msg("==> [Call Runtime Error] "+err);
      return "<Invalid>";
   }

   return as_lpc(ret);
}
开发者ID:shentino,项目名称:simud,代码行数:44,代码来源:wizard.c


示例15: convert_for_pow

static MaybeDataType convert_for_pow(const Variant& val,
                                     int64_t& ival, double& dval) {
  switch (val.getType()) {
    case KindOfUninit:
    case KindOfNull:
    case KindOfBoolean:
    case KindOfInt64:
    case KindOfResource:
    case KindOfObject:
      ival = val.toInt64();
      return KindOfInt64;

    case KindOfDouble:
      dval = val.toDouble();
      return KindOfDouble;

    case KindOfPersistentString:
    case KindOfString: {
      auto dt = val.toNumeric(ival, dval, true);
      if ((dt != KindOfInt64) && (dt != KindOfDouble)) {
        ival = 0;
        return KindOfInt64;
      }
      return dt;
    }

    case KindOfPersistentArray:
    case KindOfArray:
      // Not reachable since HHVM_FN(pow) deals with these base cases first.
    case KindOfRef:
    case KindOfClass:
      break;
  }

  // Unknown data type.
  raise_error("Unsupported operand types");
  not_reached();
}
开发者ID:292388900,项目名称:hhvm,代码行数:38,代码来源:ext_std_math.cpp


示例16: proj_forward

/**Transforms a point in WGS84 LonLat in radians to projected coordinates.
   This version of the method changes the point in-place.

   call-seq: forward!(point) -> point

 */
static VALUE proj_forward(VALUE self,VALUE point){
  _wrap_pj* wpj;
  int pj_errno_ref;
  projLP pj_point;
  projXY pj_result;
  Data_Get_Struct(self,_wrap_pj,wpj);

  pj_point.u = NUM2DBL( rb_funcall(point, idGetX, 0) );
  pj_point.v = NUM2DBL( rb_funcall(point, idGetY, 0) );
  pj_result = pj_fwd(pj_point, wpj->pj);

  pj_errno_ref = *pj_get_errno_ref();
  if (pj_errno_ref == 0) {
    rb_funcall(point, idSetX, 1, rb_float_new(pj_result.u) );
    rb_funcall(point, idSetY, 1, rb_float_new(pj_result.v) );
    return point;
  } else if (pj_errno_ref > 0) {
    rb_raise(rb_eSystemCallError, "Unknown system call error");
  } else {
    raise_error(pj_errno_ref);
  }
  return self; /* Makes gcc happy */
}
开发者ID:LouisStAmour,项目名称:proj4rb19,代码行数:29,代码来源:projrb.c


示例17: close_channel

static PyObject *
close_channel( PyObject *self, PyObject *args ) {
    (void)self;

    PyObject *py_chan;
    if( !PyArg_ParseTuple(args, "O", &py_chan) ) {
        return NULL;
    }

    ach_channel_t *c = parse_channel_pointer(py_chan);
    if( NULL == c ) {
        return NULL;
    }

    ach_status_t r = ach_close(c);
    if( ACH_OK != r ) {
        return raise_error(r);
    }

    free(c);

    Py_RETURN_NONE;
}
开发者ID:LofaroLabs,项目名称:ach,代码行数:23,代码来源:ach_py.c


示例18: engine_read

VALUE engine_read(VALUE self) {
  ms_conn* conn;
  char buf[512];
  int bytes, n;

  Data_Get_Struct(self, ms_conn, conn);

  bytes = SSL_read(conn->ssl, (void*)buf, sizeof(buf));

  if(bytes > 0) {
    return rb_str_new(buf, bytes);
  }

  if(SSL_want_read(conn->ssl)) return Qnil;

  if(SSL_get_error(conn->ssl, bytes) == SSL_ERROR_ZERO_RETURN) {
    rb_eof_error();
  }

  raise_error(conn->ssl, bytes);

  return Qnil;
}
开发者ID:Gu1,项目名称:puma,代码行数:23,代码来源:mini_ssl.c


示例19: proj_transform

/**Transforms a point from one projection to another. The second parameter is
   either a Proj4::Point object or you can use any object which
   responds to the x, y, z read and write accessor methods. (In fact you
   don't even need the z accessor methods, 0 is assumed if they don't exist).
   This is the destructive variant of the method, i.e. it will overwrite your
   existing point coordinates but otherwise leave the point object alone.

   call-seq: transform!(destinationProjection, point) -> point

 */
static VALUE proj_transform(VALUE self, VALUE dst, VALUE point){
  _wrap_pj* wpjsrc;
  _wrap_pj* wpjdst;
  double array_x[1];
  double array_y[1];
  double array_z[1];
  int result;

  Data_Get_Struct(self,_wrap_pj,wpjsrc);
  Data_Get_Struct(dst,_wrap_pj,wpjdst);

  array_x[0] = NUM2DBL( rb_funcall(point, idGetX, 0) );
  array_y[0] = NUM2DBL( rb_funcall(point, idGetY, 0) );

  /* if point objects has a method 'z' we get the z coordinate, otherwise we just assume 0 */
  if ( rb_respond_to(point, idGetZ) ) {
    array_z[0] = NUM2DBL( rb_funcall(point, idGetZ, 0) );
  } else {
    array_z[0] = 0.0;
  }

  result = pj_transform(wpjsrc->pj, wpjdst->pj, 1, 1, array_x, array_y, array_z);
  if (! result) {
    rb_funcall(point, idSetX, 1, rb_float_new(array_x[0]) );
    rb_funcall(point, idSetY, 1, rb_float_new(array_y[0]) );
    /* if point objects has a method 'z=' we set the z coordinate, otherwise we ignore it  */
    if ( rb_respond_to(point, idSetZ) ) {
        rb_funcall(point, idSetZ, 1, rb_float_new(array_z[0]) );
    }
    return point;
  } else if (result > 0) {
    rb_raise(rb_eSystemCallError, "Unknown system call error");
  } else {
    raise_error(result);
  }
  return self; /* Makes gcc happy */
}
开发者ID:LouisStAmour,项目名称:proj4rb19,代码行数:47,代码来源:projrb.c


示例20: raise_message

void raise_message(ErrorConstants::ErrorModes mode, const std::string &msg) {
  switch (mode) {
    case ErrorConstants::ErrorModes::ERROR:
      raise_error(msg);
      break;
    case ErrorConstants::ErrorModes::WARNING:
      raise_warning(msg);
      break;
    case ErrorConstants::ErrorModes::NOTICE:
    case ErrorConstants::ErrorModes::PHP_DEPRECATED: {
        // This is here rather than in the individual functions to reduce the
        // copy+paste
        if (RuntimeOption::NoticeFrequency <= 0 ||
            (g_notice_counter++) % RuntimeOption::NoticeFrequency != 0) {
          break;
        }
        int errnum = static_cast<int>(mode);
        if (!g_context->errorNeedsHandling(errnum, true,
                                      ExecutionContext::ErrorThrowMode::Never)) {
          return;
        }
        if (mode == ErrorConstants::ErrorModes::NOTICE) {
          g_context->handleError(msg, errnum, true,
                                 ExecutionContext::ErrorThrowMode::Never,
                                 "\nNotice: ");
        } else {
          g_context->handleError(msg, errnum, true,
                                 ExecutionContext::ErrorThrowMode::Never,
                                 "\nDeprecated: ");
        }
      }
      break;
    default:
      always_assert(!"Unhandled type of error");
  }
}
开发者ID:6api,项目名称:hhvm,代码行数:36,代码来源:runtime-error.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ raise_exception函数代码示例发布时间:2022-05-30
下一篇:
C++ raiseOverflow函数代码示例发布时间: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