本文整理汇总了C++中eraise函数的典型用法代码示例。如果您正苦于以下问题:C++ eraise函数的具体用法?C++ eraise怎么用?C++ eraise使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eraise函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: en_socket_datagram_connect
void en_socket_datagram_connect (EIF_INTEGER fd, EIF_INTEGER fd1, EIF_POINTER sockaddr) {
SOCKETADDRESS* him;
int family;
EIF_INTEGER fdc = -1;
int ipv6_supported;
int connect_res;
EIF_NET_INITIALIZE;
ipv6_supported = en_ipv6_available();
him = (SOCKETADDRESS*) sockaddr;
family = him->him.sa_family;
if (family == AF_INET6 && !ipv6_supported) {
eraise ("Protocol family not supported", EN_PROG);
return;
}
fdc = (family == AF_INET? fd: fd1);
connect_res = connect(fdc, (struct sockaddr *)him, SOCKETADDRESS_LEN(him));
if ( connect_res == -1) {
eraise("Unable to establish connection", EN_PROG);
}
}
开发者ID:jocelyn,项目名称:EiffelStudio_old,代码行数:26,代码来源:ipv6win.c
示例2: parsing_store_write
rt_private void parsing_store_write(size_t size)
{
RT_GET_CONTEXT
char* cmps_out_ptr = cmps_general_buffer;
lzo_uint cmps_out_size = (lzo_uint) cmp_buffer_size;
int signed_cmps_out_size;
REQUIRE("cmp_buffer_size not too big", cmp_buffer_size <= 0x7FFFFFFF);
REQUIRE("size not too big", size <= 0x7FFFFFFF);
lzo1x_1_compress (
(unsigned char *) general_buffer, /* Current buffer location */
(lzo_uint) size, /* Current buffer size */
(unsigned char *) cmps_out_ptr, /* Output buffer for compressed data */
&cmps_out_size, /* Size of output buffer and then size of compressed data */
wrkmem); /* Memory allocator */
signed_cmps_out_size = (int) cmps_out_size;
/* Write size of compressed data */
if (parsing_char_write ((char *) &signed_cmps_out_size, sizeof(int)) <= 0)
eraise ("Unable to write compressed data size", EN_IO);
/* Write compressed data */
if (parsing_char_write (cmps_out_ptr, signed_cmps_out_size) <= 0)
eraise ("Unable to write on specified device", EN_IO);
}
开发者ID:EiffelSoftware,项目名称:EiffelStudio,代码行数:27,代码来源:pstore.c
示例3: en_socket_datagram_rcv_from
EIF_INTEGER en_socket_datagram_rcv_from (EIF_INTEGER fd, EIF_INTEGER fd1, EIF_INTEGER *a_last_fd, EIF_POINTER buf, EIF_INTEGER len, EIF_INTEGER flags, EIF_INTEGER timeout, SOCKETADDRESS *him) {
int nsockets = 0;
int fduse = 0;
int result;
int lenn = sizeof(SOCKETADDRESS);
int ipv6_supported = en_ipv6_available();
if (fd > 0) {
nsockets++;
}
if (fd1 > 0) {
nsockets++;
}
if (nsockets == 2) { /* need to choose one of them */
int ret, t = (timeout == 0) ? -1: timeout;
ret = net_timeout2 (fd, fd1, t, &fduse);
if (ret == 2) {
fduse = check_last_fd (a_last_fd, fd, fd1);
} else if (ret == 0) {
if (ret == 0) {
eraise("Receive timed out", EN_PROG);
} else {
eraise("Receive error", EN_PROG);
}
return -1;
}
} else if (!ipv6_supported) {
fduse = fd;
} else if (fd >= 0) {
/* ipv6 supported: and this socket bound to an IPV6 only address */
fduse = fd1;
} else {
/* ipv6 supported: and this socket bound to an IPV4 only address */
fduse = fd;
}
if (timeout && nsockets == 1) {
int ret;
ret = net_timeout(fduse, timeout);
if (ret <= 0) {
if (ret == 0) {
eraise("Receive timed out", EN_PROG);
} else {
eraise("Receive error", EN_PROG);
}
return -1;
}
}
result = recvfrom ((SOCKET) fduse, (char *) buf, (int) len, (int) flags, (struct sockaddr *) him, &lenn);
eif_net_check (result);
return (EIF_INTEGER) result;
}
开发者ID:jocelyn,项目名称:EiffelStudio_old,代码行数:56,代码来源:ipv6win.c
示例4: eif_file_tell
/*
* Current position within file.
*/
EIF_INTEGER eif_file_tell(FILE *f) {
long res;
if (f == (FILE *) 0) {
eraise("invalid file pointer", EN_EXT);
}
res = ftell(f);
if (res == -1) {
eraise("error occurred", EN_EXT);
}
return (EIF_INTEGER) res;
}
开发者ID:jocelyn,项目名称:EiffelStudio,代码行数:16,代码来源:eif_file.c
示例5: eif_file_fd
/*
* Return the associated file descriptor.
*/
EIF_INTEGER eif_file_fd(FILE *f) {
int res;
if (!f) {
res = 0;
eraise("invalid file pointer", EN_EXT);
} else {
res = fileno(f);
if (res == -1) {
eraise("error occurred", EN_EXT);
}
}
return (EIF_INTEGER) res;
}
开发者ID:jocelyn,项目名称:EiffelStudio,代码行数:16,代码来源:eif_file.c
示例6: parsing_store_append
rt_private void parsing_store_append(struct rt_store_context *a_context, EIF_REFERENCE object, fnptr mid, fnptr nid)
{
RT_GET_CONTEXT
struct rt_traversal_context traversal_context;
int gc_stopped;
make_index = mid;
need_index = nid;
gc_stopped = !eif_gc_ison();
eif_gc_stop(); /* Procedure `make_index' may call the GC
* while creating objects. */
/* Need to hold mutex here since we are using traversal. */
EIF_EO_STORE_LOCK;
#ifdef DEBUG
(void) nomark(object);
#endif
/* Do the traversal: mark and count the objects to store */
memset(&traversal_context, 0, sizeof(struct rt_traversal_context));
traversal_context.is_for_persistence = 1;
traversal(&traversal_context, object);
current_position = 0;
end_of_buffer = 0;
/* Write in file `file_descriptor' the count of stored objects */
buffer_write((char *) (&traversal_context.obj_nb), sizeof(uint32));
#ifndef DEBUG
(void) pst_store(a_context, object,0L); /* Recursive store process */
#else
{
uint32 nb_stored = pst_store(a_context, object,0L);
if (traversal_context.obj_nb != nb_stored) {
printf("obj_nb = %d nb_stored = %d\n", traversal_context.obj_nb, nb_stored);
eraise ("Eiffel partial store", EN_IO);
}
}
if (traversal_context.obj_nb != nomark(object))
eraise ("Partial store inconsistency", EN_IO);
#endif
a_context->flush_buffer_function(); /* Flush the buffer */
EIF_EO_STORE_UNLOCK; /* Unlock our mutex. */
if (!gc_stopped)
eif_gc_run(); /* Restart GC */
}
开发者ID:EiffelSoftware,项目名称:EiffelStudio,代码行数:51,代码来源:pstore.c
示例7: store_append
rt_public long store_append(EIF_INTEGER f_desc, char *object, fnptr mid, fnptr nid, EIF_REFERENCE s)
{
/* Append `object' in file `f', and applies routine `mid'
* on server `s'. Return position in the file where the object is
* stored. */
/* Initialization */
server = s;
if ((file_position = lseek ((int) f_desc, 0, SEEK_END)) == -1)
eraise ("Unable to seek on internal data files", EN_SYS);
/* Initialize store context used to store objects for appending. */
rt_setup_store (&parsing_context, BASIC_STORE);
parsing_store_append(&parsing_context, object, mid, nid);
/* Write `parsing_buffer' onto `f_desc'. If we cannot write `parsing_position' bytes
* we have a failure. */
if (write (f_desc, parsing_buffer, parsing_position) != parsing_position) {
eio();
}
parsing_position = 0;
return file_position;
}
开发者ID:EiffelSoftware,项目名称:EiffelStudio,代码行数:27,代码来源:pstore.c
示例8: set_matrix
void set_matrix(SquareBinaryMatrix &m) {
if((uint_t)m.get_size() != key_len)
eraise(InvalidMatrix) << "Size of matrix '" << m.get_size()
<< "' not equal to key length '" << key_len << "'";
hash_matrix = m;
hash_inverse_matrix = m.inverse();
}
开发者ID:Biocacahuete,项目名称:trinityrnaseq,代码行数:7,代码来源:invertible_hash_array.hpp
示例9: bloom_filter
bloom_filter(size_t m, unsigned long k, const HashPair& fns = HashPair()) :
mem_block_t(super::nb_bytes__(m)),
super(m, k, (unsigned char*)mem_block_t::get_ptr(), fns)
{
if(!mem_block_t::get_ptr())
eraise(std::runtime_error) << "Failed to allocate " << super::nb_bytes__(m) << " bytes of memory for bloom_filter";
}
开发者ID:Bioinformaticsnl,项目名称:Jellyfish,代码行数:7,代码来源:bloom_filter.hpp
示例10: parsing_compiler_write
rt_private void parsing_compiler_write(size_t size)
{
RT_GET_CONTEXT
char* cmps_out_ptr = cmps_general_buffer;
lzo_uint cmps_out_size = (lzo_uint) cmp_buffer_size;
int signed_cmps_out_size;
int number_written;
REQUIRE("cmp_buffer_size not too big", cmp_buffer_size <= 0x7FFFFFFF);
REQUIRE("size not too big", size <= 0x7FFFFFFF);
lzo1x_1_compress (
(unsigned char *) general_buffer, /* Current buffer location */
(lzo_uint) size, /* Current buffer size */
(unsigned char *) cmps_out_ptr, /* Output buffer for compressed data */
&cmps_out_size, /* Size of output buffer and then size of compressed data */
wrkmem); /* Memory allocator */
signed_cmps_out_size = (int) cmps_out_size;
/* Write size of compressed data */
if (write (file_descriptor, (char *) &signed_cmps_out_size, sizeof(int)) <= 0)
eraise ("Unable to write compressed data size", EN_IO);
/* Write compressed data */
while (signed_cmps_out_size > 0) {
number_written = write (file_descriptor, cmps_out_ptr, signed_cmps_out_size);
if (number_written <= 0)
eio();
signed_cmps_out_size -= number_written;
cmps_out_ptr += number_written;
}
}
开发者ID:EiffelSoftware,项目名称:EiffelStudio,代码行数:33,代码来源:pstore.c
示例11: call_data_sync_pid
void
priv_queue::log_call(processor *client, call_data *call)
{
bool will_sync = call_data_sync_pid (call) != NULL_PROCESSOR_ID;
push (pq_message (pq_message::e_normal, client, call));
if (will_sync)
{
processor *client = registry[call_data_sync_pid (call)];
call_stack_msg = client->result_notify.wait();
for (;
call_stack_msg.type == notify_message::e_callback;
call_stack_msg = client->result_notify.wait())
{
(*client)(call_stack_msg.client, call_stack_msg.call);
call_stack_msg.call = NULL;
}
if (call_stack_msg.type == notify_message::e_dirty)
{
char *msg = "EVE/Qs dirty processor exception";
eraise (msg, 32);
}
}
synced = will_sync;
}
开发者ID:scottgw,项目名称:eveqs,代码行数:30,代码来源:private_queue.cpp
示例12: private_object_id
rt_private EIF_INTEGER private_object_id(EIF_REFERENCE object, struct stack *st, EIF_INTEGER *max_value_ptr)
{
register unsigned int stack_number = 0;
register struct stchunk *end;
register EIF_INTEGER Result;
char *address;
if (-1 == epush(st, object)) { /* Cannot record object */
eraise("object id", EN_MEM); /* No more memory */
return (EIF_INTEGER) 0; /* They ignored it */
}
address = (char *) (st->st_top - 1); /* Was allocated here */
eif_access(address) = object; /* Record object's physical address */
/* Get the stack number */
for(end = st->st_hd;
end != st->st_cur;
stack_number++)
end = end->sk_next;
Result = (EIF_INTEGER) (stack_number*STACK_SIZE+1-(st->st_cur->sk_arena-(char **)address));
if (Result>*max_value_ptr)
*max_value_ptr = Result;
#ifdef DEBUG
dprintf (2) ("eif_object_id %d %lx %lx\n", Result, address, object);
#endif
return Result;
}
开发者ID:tioui,项目名称:EiffelStudio,代码行数:30,代码来源:object_id.c
示例13: ht_force
/*
doc: <routine name="ht_force" export="shared">
doc: <summary>Put value `val' associated with key `key' in table `ht'. If `ht' is full, we will resize `ht' and try again. If `resizing' failed or if we cannot find a suitable position, an exception is thrown. In other words, it is the same as `ht_safe_force' modulo an exception instead of an error code.</summary>
doc: <param name="ht" type="struct htable *">Table to initialize.</param>
doc: <param name="key" type="rt_uint_ptr">Key to insert in `ht'.</param>
doc: <param name="val" type="void *">Value to insert in `ht'.</param>
doc: <thread_safety>Not Safe</thread_safety>
doc: <synchronization>None</synchronization>
doc: </routine>
*/
rt_shared void ht_force(struct htable *ht, rt_uint_ptr key, void * val)
{
int l_error;
REQUIRE("ht not null", ht);
REQUIRE("key not null", key);
l_error = ht_safe_force (ht, key, val);
if (l_error != 0) {
if (l_error == -1) {
eraise ("Hash table resizing failure", EN_FATAL);
} else {
CHECK("valid error code", l_error == -2);
eraise ("Hash table insertion failure", EN_FATAL);
}
}
}
开发者ID:EiffelSoftware,项目名称:EiffelStudio,代码行数:27,代码来源:hashin.c
示例14: map
void map(const char *filename) {
int fd = open(filename, O_RDONLY);
struct stat stat;
if(fd < 0)
eraise(ErrorMMap) << "Can't open file '" << filename << "'" << err::no;
if(fstat(fd, &stat) < 0)
eraise(ErrorMMap) << "Can't stat file '" << filename << "'" << err::no;
_length = stat.st_size;
_base = (char *)mmap(NULL, _length, PROT_READ, MAP_SHARED, fd, 0);
if(_base == MAP_FAILED)
eraise(ErrorMMap) << "Can't mmap file '" << filename << "'" << err::no;
close(fd);
_end = _base + _length;
}
开发者ID:bryopsis,项目名称:trinity,代码行数:17,代码来源:mapped_file.hpp
示例15: resize
void resize() {
_capacity *= 2;
void * ndata = realloc(_data, sizeof(T) * _capacity);
if(ndata == 0) {
free(ndata);
_data = 0;
_capacity = _capacity / 2;
eraise(SimpleGrowingArrayError) << "Out of memory" << err::no;
}
_data = (T*)ndata;
}
开发者ID:Biocacahuete,项目名称:trinityrnaseq,代码行数:11,代码来源:simple_growing_array.hpp
示例16: rq
double_fifo_input<T>::double_fifo_input(unsigned long _nb_buckets) :
rq(_nb_buckets), wq(_nb_buckets), nb_buckets(_nb_buckets), state(WORKING),
input_id(0)
{
buckets = new T[nb_buckets];
for(unsigned long i = 0; i < nb_buckets; ++i)
wq.enqueue(&buckets[i]);
if(pthread_create(&input_id, 0, static_input_routine, (void *)this) != 0)
eraise(Error) << "Failed creating input thread" << err::no;
}
开发者ID:Bioinformaticsnl,项目名称:Jellyfish,代码行数:12,代码来源:double_fifo_input.hpp
示例17: host_address_from_name
void host_address_from_name (EIF_POINTER addr, EIF_POINTER name)
/*x 32-bits netid/hostid set in addr from hostname name */
{
struct hostent *hp;
#ifdef VXWORKS
int h_errno = 0;
#endif
EIF_NET_INITIALIZE;
#ifdef VXWORKS
hp = NULL;
#else
hp = gethostbyname((char *) name);
#endif
if (hp == (struct hostent *) 0) {
#ifdef EIF_WINDOWS
eif_net_check(EIFNET_ERROR_HAPPENED);
#else
/* On Unix, `gethostbyname' does not set errno, but h_errno. This is why
* we cannot use `eif_net_check'. */
errno = h_errno;
if (h_errno == HOST_NOT_FOUND) {
eraise ("The specified host is unknown.", EN_ISE_IO);
} else if (h_errno == NO_ADDRESS || h_errno == NO_DATA) {
eraise ("The requested name is valid but does not have an IP address.", EN_ISE_IO);
} else if (h_errno == NO_RECOVERY) {
eraise ("A non-recoverable name server error occurred.", EN_ISE_IO);
} else if (h_errno == TRY_AGAIN) {
eraise ("A temporary error occurred on an authoritative name server. Try again later.", EN_ISE_IO);
} else {
eio();
}
#endif
}
((struct in_addr *) addr)->s_addr = ((struct in_addr *) (hp->h_addr))->s_addr;
}
开发者ID:tioui,项目名称:EiffelStudio,代码行数:39,代码来源:network.c
示例18: eif_extend_object_id_stack
rt_public void eif_extend_object_id_stack (EIF_INTEGER nb_chunks)
/* extends of `nb_chunks the size of `object_id_stack' */
{
#ifdef ISE_GC
RT_GET_CONTEXT
struct stack *st = &object_id_stack;
char **top;
struct stchunk * current;
char **end;
EIF_OBJECT_ID_LOCK;
if (st->st_top == (char **) 0) {
top = st_alloc(st, eif_stack_chunk); /* Create stack */
if (top == (char **) 0) {
EIF_OBJECT_ID_UNLOCK;
eraise ("Couldn't allocate object id stack", EN_MEM);
}
/* No memory */
st->st_top = top; /* Update new top */
}
current = st->st_cur; /* save previous current stchunk */
top = st->st_top; /* save previous top of stack */
end = st->st_end; /*save previous st_end of stack */
SIGBLOCK; /* Critical section */
while (--nb_chunks) {
if (-1 == st_extend(st, eif_stack_chunk)) {
EIF_OBJECT_ID_UNLOCK;
eraise ("Couldn't allocate object id stack", EN_MEM);
}
}
st->st_cur = current; /* keep previous Current */
st->st_top = top; /* keep previous top */
st->st_end = end;
SIGRESUME; /* End of critical section */
EIF_OBJECT_ID_UNLOCK;
#endif
}
开发者ID:tioui,项目名称:EiffelStudio,代码行数:39,代码来源:object_id.c
示例19: check_socket_bounds
static SOCKET check_socket_bounds (SOCKET l_socket) {
#ifdef EIF_64_BITS
/* On 64-bit system `SOCKET' is actually a pointer. For the moment, we check that
* it is not coded on the whole 64-bit. */
if (l_socket != INVALID_SOCKET) {
if ((l_socket & RTU64C(0x00000000FFFFFFFF)) != l_socket) {
/* We are in trouble. Raise an exception for the moment. */
eraise ("Descriptor too big to be represented as INTEGER_32", EN_PROG);
}
}
#endif
return l_socket;
}
开发者ID:jocelyn,项目名称:EiffelStudio_old,代码行数:13,代码来源:ipv6win.c
示例20: generator_manager
generator_manager(const char* cmds, int nb_pipes, const char* shell = 0) :
cmds_(cmds),
pipes_(nb_pipes),
manager_pid_(-1),
shell_(shell),
kill_signal_(0)
{
if(!cmds_.good())
eraise(std::runtime_error) << "Failed to open cmds file '" << cmds << "'";
if(!shell_)
shell_ = getenv("SHELL");
if(!shell_)
shell_ = "/bin/sh";
}
开发者ID:Bioinformaticsnl,项目名称:Jellyfish,代码行数:14,代码来源:generator_manager.hpp
注:本文中的eraise函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论