本文整理汇总了C++中pic_get_args函数的典型用法代码示例。如果您正苦于以下问题:C++ pic_get_args函数的具体用法?C++ pic_get_args怎么用?C++ pic_get_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pic_get_args函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pic_blob_bytevector_copy_i
static pic_value
pic_blob_bytevector_copy_i(pic_state *pic)
{
pic_blob *to, *from;
int n;
size_t at, start, end;
n = pic_get_args(pic, "bkb|kk", &to, &at, &from, &start, &end);
switch (n) {
case 3:
start = 0;
case 4:
end = from->len;
}
if (to == from && (start <= at && at < end)) {
/* copy in reversed order */
at += end - start;
while (start < end) {
to->data[--at] = from->data[--end];
}
return pic_none_value();
}
while (start < end) {
to->data[at++] = from->data[start++];
}
return pic_none_value();
}
开发者ID:KeenS,项目名称:benz,代码行数:31,代码来源:blob.c
示例2: pic_blob_bytevector_copy
static pic_value
pic_blob_bytevector_copy(pic_state *pic)
{
pic_blob *from, *to;
int n;
size_t start, end, i = 0;
n = pic_get_args(pic, "b|kk", &from, &start, &end);
switch (n) {
case 1:
start = 0;
case 2:
end = from->len;
}
if (end < start) {
pic_errorf(pic, "make-bytevector: end index must not be less than start index");
}
to = pic_make_blob(pic, end - start);
while (start < end) {
to->data[i++] = from->data[start++];
}
return pic_obj_value(to);
}
开发者ID:KeenS,项目名称:benz,代码行数:27,代码来源:blob.c
示例3: pic_state_features
static pic_value
pic_state_features(pic_state *pic)
{
pic_get_args(pic, "");
return pic->features;
}
开发者ID:picrin-scheme,项目名称:benz,代码行数:7,代码来源:state.c
示例4: pic_state_global_objects
static pic_value
pic_state_global_objects(pic_state *pic)
{
pic_get_args(pic, "");
return pic->globals;
}
开发者ID:picrin-scheme,项目名称:benz,代码行数:7,代码来源:state.c
示例5: weak_call
static pic_value
weak_call(pic_state *pic)
{
pic_value key, val, weak;
int n;
n = pic_get_args(pic, "o|o", &key, &val);
if (! pic_obj_p(pic, key)) {
pic_error(pic, "attempted to set a non-object key", 1, key);
}
weak = pic_closure_ref(pic, 0);
if (n == 1) {
if (! pic_weak_has(pic, weak, key)) {
return pic_false_value(pic);
}
return pic_cons(pic, key, pic_weak_ref(pic, weak, key));
} else {
if (pic_undef_p(pic, val)) {
if (pic_weak_has(pic, weak, key)) {
pic_weak_del(pic, weak, key);
}
} else {
pic_weak_set(pic, weak, key, val);
}
return pic_undef_value(pic);
}
}
开发者ID:dmalves,项目名称:benz,代码行数:30,代码来源:weak.c
示例6: pic_weak_make_ephemeron
static pic_value
pic_weak_make_ephemeron(pic_state *pic)
{
pic_get_args(pic, "");
return pic_lambda(pic, weak_call, 1, pic_make_weak(pic));
}
开发者ID:dmalves,项目名称:benz,代码行数:7,代码来源:weak.c
示例7: pic_system_getenvs
static pic_value
pic_system_getenvs(pic_state *pic)
{
char **envp;
pic_value data = pic_nil_value();
size_t ai = pic_gc_arena_preserve(pic);
pic_get_args(pic, "");
if (! pic->envp) {
return pic_nil_value();
}
for (envp = pic->envp; *envp; ++envp) {
pic_str *key, *val;
int i;
for (i = 0; (*envp)[i] != '='; ++i)
;
key = pic_make_str(pic, *envp, i);
val = pic_make_str_cstr(pic, getenv(pic_str_cstr(pic, key)));
/* push */
data = pic_acons(pic, pic_obj_value(key), pic_obj_value(val), data);
pic_gc_arena_restore(pic, ai);
pic_gc_protect(pic, data);
}
return data;
}
开发者ID:ktakashi,项目名称:picrin,代码行数:32,代码来源:system.c
示例8: pic_str_list_to_string
static pic_value
pic_str_list_to_string(pic_state *pic)
{
pic_str *str;
pic_value list, e, it;
size_t i = 0;
char *buf;
pic_get_args(pic, "o", &list);
if (pic_length(pic, list) == 0) {
return pic_obj_value(pic_make_str(pic, NULL, 0));
}
buf = pic_malloc(pic, pic_length(pic, list));
pic_try {
pic_for_each (e, list, it) {
pic_assert_type(pic, e, char);
buf[i++] = pic_char(e);
}
str = pic_make_str(pic, buf, i);
}
开发者ID:leavesbnw,项目名称:picrin,代码行数:25,代码来源:string.c
示例9: pic_str_string_for_each
static pic_value
pic_str_string_for_each(pic_state *pic)
{
struct pic_proc *proc;
size_t argc, len, i, j;
pic_value *argv, vals;
pic_get_args(pic, "l*", &proc, &argc, &argv);
if (argc == 0) {
pic_errorf(pic, "string-map: one or more strings expected, but got zero");
} else {
pic_assert_type(pic, argv[0], str);
len = pic_str_len(pic_str_ptr(argv[0]));
}
for (i = 1; i < argc; ++i) {
pic_assert_type(pic, argv[i], str);
len = len < pic_str_len(pic_str_ptr(argv[i]))
? len
: pic_str_len(pic_str_ptr(argv[i]));
}
for (i = 0; i < len; ++i) {
vals = pic_nil_value();
for (j = 0; j < argc; ++j) {
pic_push(pic, pic_char_value(pic_str_ref(pic, pic_str_ptr(argv[j]), i)), vals);
}
pic_apply(pic, proc, vals);
}
return pic_undef_value();
}
开发者ID:leavesbnw,项目名称:picrin,代码行数:33,代码来源:string.c
示例10: cont_call
static pic_value
cont_call(pic_state *pic)
{
struct pic_proc *self = pic_get_proc(pic);
int argc;
pic_value *argv;
int id;
struct pic_cont *cc, *cont;
pic_get_args(pic, "*", &argc, &argv);
id = pic_int(pic_proc_env_ref(pic, self, "id"));
/* check if continuation is alive */
for (cc = pic->cc; cc != NULL; cc = cc->prev) {
if (cc->id == id) {
break;
}
}
if (cc == NULL) {
pic_errorf(pic, "calling dead escape continuation");
}
cont = pic_data_ptr(pic_proc_env_ref(pic, self, "escape"))->data;
cont->results = pic_list_by_array(pic, argc, argv);
pic_load_point(pic, cont);
PIC_LONGJMP(pic, cont->jmp, 1);
PIC_UNREACHABLE();
}
开发者ID:ktakashi,项目名称:picrin,代码行数:32,代码来源:cont.c
示例11: pic_repl_tty_p
static pic_value
pic_repl_tty_p(pic_state *pic)
{
pic_get_args(pic, "");
return pic_bool_value(pic, (isatty(STDIN_FILENO)));
}
开发者ID:koba-e964,项目名称:picrin,代码行数:7,代码来源:repl.c
示例12: pic_number_exp
static pic_value
pic_number_exp(pic_state *pic)
{
double f;
pic_get_args(pic, "f", &f);
return pic_float_value(pic, exp(f));
}
开发者ID:koba-e964,项目名称:picrin,代码行数:8,代码来源:math.c
示例13: pic_port_port_open_p
static pic_value
pic_port_port_open_p(pic_state *pic)
{
struct pic_port *port;
pic_get_args(pic, "p", &port);
return pic_bool_value(port->status == PIC_PORT_OPEN);
}
开发者ID:KeenS,项目名称:benz,代码行数:9,代码来源:port.c
示例14: pic_error_error_object_irritants
static pic_value
pic_error_error_object_irritants(pic_state *pic)
{
struct pic_error *e;
pic_get_args(pic, "e", &e);
return e->irrs;
}
开发者ID:ktakashi,项目名称:picrin,代码行数:9,代码来源:error.c
示例15: pic_error_error_object_type
static pic_value
pic_error_error_object_type(pic_state *pic)
{
struct pic_error *e;
pic_get_args(pic, "e", &e);
return pic_obj_value(e->type);
}
开发者ID:ktakashi,项目名称:picrin,代码行数:9,代码来源:error.c
示例16: pic_error_raise_continuable
static pic_value
pic_error_raise_continuable(pic_state *pic)
{
pic_value v;
pic_get_args(pic, "o", &v);
return pic_raise_continuable(pic, v);
}
开发者ID:ktakashi,项目名称:picrin,代码行数:9,代码来源:error.c
示例17: pic_error_error_object_p
static pic_value
pic_error_error_object_p(pic_state *pic)
{
pic_value v;
pic_get_args(pic, "o", &v);
return pic_bool_value(pic_error_p(v));
}
开发者ID:ktakashi,项目名称:picrin,代码行数:9,代码来源:error.c
示例18: pic_macro_variable_p
static pic_value
pic_macro_variable_p(pic_state *pic)
{
pic_value obj;
pic_get_args(pic, "o", &obj);
return pic_bool_value(pic_var_p(obj));
}
开发者ID:leavesbnw,项目名称:picrin,代码行数:9,代码来源:macro.c
示例19: pic_error_raise
static pic_value
pic_error_raise(pic_state *pic)
{
pic_value v;
pic_get_args(pic, "o", &v);
pic_raise(pic, v);
}
开发者ID:ktakashi,项目名称:picrin,代码行数:9,代码来源:error.c
示例20: pic_number_number_p
static pic_value
pic_number_number_p(pic_state *pic)
{
pic_value v;
pic_get_args(pic, "o", &v);
return pic_bool_value(pic, pic_float_p(pic, v) || pic_int_p(pic, v));
}
开发者ID:koba-e964,项目名称:picrin,代码行数:9,代码来源:number.c
注:本文中的pic_get_args函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论