本文整理汇总了C++中NULLP函数的典型用法代码示例。如果您正苦于以下问题:C++ NULLP函数的具体用法?C++ NULLP怎么用?C++ NULLP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NULLP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fast_read_closure
static void fast_read_closure(lref_t reader, lref_t * retval)
{
lref_t env;
fast_read(reader, &env, false);
if (EOFP(env))
vmerror_fast_read("incomplete closure, missing environment", reader, NIL);
if (!(NULLP(env) || CONSP(env)))
vmerror_fast_read("malformed closure, bad environment", reader, env);
lref_t code;
fast_read(reader, &code, false);
if (EOFP(code))
vmerror_fast_read("Incomplete closure, missing code", reader, false);
if (!(NULLP(code) || CONSP(code)))
vmerror_fast_read("malformed closure, bad code", reader, code);
lref_t props;
fast_read(reader, &props, false);
if (EOFP(props))
vmerror_fast_read("incomplete closure, missing property list", reader, NIL);
if (!(NULLP(props) || CONSP(props)))
vmerror_fast_read("malformed closure, bad property list", reader, props);
*retval = lclosurecons(env, code, props);
}
示例2: dynlib_unbind_all_internal
static void *
dynlib_unbind_all_internal(uim_lisp plugin_alist_)
{
/* call dlclose(3) collectively at the end in order to avoid GC problem */
uim_lisp alist_ = plugin_alist_;
while (!NULLP(alist_)) {
uim_lisp plugin_, quit_proc_;
void (*dynlib_instance_quit)(void);
plugin_ = CAR(alist_);
quit_proc_ = CAR(CDR(CDR(CDR(plugin_))));
if (!FALSEP(quit_proc_)) {
dynlib_instance_quit = C_FPTR(quit_proc_);
(*dynlib_instance_quit)();
}
alist_ = CDR(alist_);
}
alist_ = plugin_alist_;
while (!NULLP(alist_)) {
uim_lisp plugin_, lib_;
void *library;
plugin_ = CAR(alist_);
lib_ = CAR(CDR(plugin_));
if (!FALSEP(lib_)) {
library = C_PTR(lib_);
dlclose(library);
}
alist_ = CDR(alist_);
}
return uim_scm_t();
}
示例3: lflush_whitespace
lref_t lflush_whitespace(lref_t port, lref_t slc)
{
int ch = EOF;
if (NULLP(port))
port = CURRENT_INPUT_PORT();
if (!TEXT_PORTP(port))
vmerror_wrong_type_n(1, port);
if (PORT_OUTPUTP(port))
vmerror_unsupported(_T("cannot flush-whitespace output ports"));
bool skip_lisp_comments = true;
if (!NULLP(slc))
skip_lisp_comments = TRUEP(slc);
ch = flush_whitespace(port, skip_lisp_comments);
if (ch == EOF)
return lmake_eof();
return charcons((_TCHAR) ch);
}
示例4: lregister_converter
static LISP lregister_converter(LISP fmt, LISP lext, LISP lcmd,
LISP sext, LISP scmd)
{
register_converter(get_c_string(fmt),
NULLP(lext)?NULL:get_c_string(lext),
NULLP(lcmd)?NULL:get_c_string(lcmd),
NULLP(sext)?NULL:get_c_string(sext),
NULLP(scmd)?NULL:get_c_string(scmd));
return NIL;
}
示例5: BGl_writezd2schemezd2commentz00zzwrite_schemez00
/* write-scheme-comment */
BGL_EXPORTED_DEF obj_t BGl_writezd2schemezd2commentz00zzwrite_schemez00(obj_t
BgL_portz00_3, obj_t BgL_sexpz00_4)
{
AN_OBJECT;
{ /* Write/scheme.scm 34 */
if (NULLP(BgL_sexpz00_4))
{ /* Write/scheme.scm 36 */
bgl_display_string(BGl_string1527z00zzwrite_schemez00, BgL_portz00_3);
return bgl_display_char(((unsigned char) '\n'), BgL_portz00_3);
}
else
{ /* Write/scheme.scm 36 */
if (NULLP(CDR(BgL_sexpz00_4)))
{ /* Write/scheme.scm 38 */
bgl_display_string(BGl_string1525z00zzwrite_schemez00,
BgL_portz00_3);
bgl_display_obj(CAR(BgL_sexpz00_4), BgL_portz00_3);
return bgl_display_char(((unsigned char) '\n'), BgL_portz00_3);
}
else
{ /* Write/scheme.scm 41 */
obj_t BgL_runner1522z00_104;
{ /* Write/scheme.scm 41 */
obj_t BgL_list1518z00_100;
{ /* Write/scheme.scm 41 */
obj_t BgL_arg1520z00_102;
BgL_arg1520z00_102 = MAKE_PAIR(BgL_sexpz00_4, BNIL);
BgL_list1518z00_100 =
MAKE_PAIR(BGl_string1525z00zzwrite_schemez00,
BgL_arg1520z00_102);
}
BgL_runner1522z00_104 =
BGl_consza2za2zz__r4_pairs_and_lists_6_3z00(BgL_portz00_3,
BgL_list1518z00_100);
}
{ /* Write/scheme.scm 41 */
obj_t BgL_aux1521z00_103;
BgL_aux1521z00_103 = CAR(BgL_runner1522z00_104);
BgL_runner1522z00_104 = CDR(BgL_runner1522z00_104);
return
BGl_fprintz00zz__r4_output_6_10_3z00(BgL_aux1521z00_103,
BgL_runner1522z00_104);
}
}
}
}
}
示例6: scm_p_map
SCM_EXPORT ScmObj
scm_p_map(ScmObj proc, ScmObj args)
{
DECLARE_FUNCTION("map", procedure_variadic_1);
if (NULLP(args))
ERR("wrong number of arguments");
/* fast path for single arg case */
if (NULLP(CDR(args)))
return scm_map_single_arg(proc, CAR(args));
/* multiple args case */
return scm_map_multiple_args(proc, args, scm_false);
}
示例7: scm_validate_formals
SCM_EXPORT scm_int_t
scm_validate_formals(ScmObj formals)
{
#if SCM_STRICT_ARGCHECK
scm_int_t len;
DECLARE_INTERNAL_FUNCTION("scm_validate_formals");
/*
* SigScheme does not perform the check for duplicate variable name in
* formals. It is an user's responsibility.
*
* R5RS: 4.1.4 Procedures
* It is an error for a <variable> to appear more than once in <formals>.
*/
/* This loop goes infinite if the formals is circular. SigSchme expects
* that user codes are sane here. */
for (len = 0; CONSP(formals); formals = CDR(formals), len++) {
if (!IDENTIFIERP(CAR(formals)))
return SCM_LISTLEN_ENCODE_ERROR(len);
}
if (NULLP(formals))
return len;
/* dotted list allowed */
if (IDENTIFIERP(formals))
return SCM_LISTLEN_ENCODE_DOTTED(len);
return SCM_LISTLEN_ENCODE_ERROR(len);
#else
/* Crashless loose validation:
* Regard any non-list object as symbol. Since the lookup operation search
* for a variable by EQ, this is safe although loosely allows
* R5RS-incompatible code. */
return scm_finite_length(formals);
#endif
}
示例8: x_get_cell
static LISP x_get_cell(LISP row, LISP col, LISP bname)
{
int r, c;
char *p;
buffer *buf;
int s;
r = get_c_long(row);
c = get_c_long(col);
if (r < 1 || r > BUFFER_ROWS || c < 1 || c > BUFFER_COLS)
return NIL;
if (NULLP(bname)) {
buf = siag_buffer;
s = siag_sht;
} else if (TYPEP(bname, tc_string)) {
buf = find_sheet_by_name(bname->storage_as.string.data,
siag_buffer, &s);
if (buf == NULL) return NIL;
}
else return NIL;
switch (ret_type(buf, s, r, c)) {
case STRING:
p = ret_string(buf, s, r, c);
return strcons(strlen(p), p);
case LABEL:
p = ret_text(buf, s, r, c);
return strcons(strlen(p), p);
case EMPTY:
case ERROR:
return NIL;
default:
return flocons(ret_val(buf, s, r, c).number);
}
}
示例9: continuation_stack_pop
static ScmObj
continuation_stack_pop(void)
{
DECLARE_INTERNAL_FUNCTION("continuation_stack_pop");
return NULLP(l_continuation_stack) ? SCM_FALSE : POP(l_continuation_stack);
}
示例10: accept_command_line_arguments
static void accept_command_line_arguments(int argc, _TCHAR * argv[])
{
lref_t arg_list = NIL;
lref_t arg_list_bud = NIL;
for (int ii = 0; ii < argc; ii++)
{
if (is_vm_argument(argv[ii]))
continue;
lref_t new_cell = lcons(strconsbuf(argv[ii]), NIL);
if (NULLP(arg_list_bud))
{
arg_list = arg_list_bud = new_cell;
}
else
{
SET_CDR(arg_list_bud, new_cell);
arg_list_bud = new_cell;
}
}
interp.startup_args = arg_list;
}
示例11: make_keyword_counted
CELL make_keyword_counted(char* s, size_t len)
{
CELL list = g_interned_keywords;
for( ; !NULLP(list); list = CDR(list)) {
CELL keyword = CAR(list);
KEYWORD* p = GET_KEYWORD(keyword);
if (p->len == len && (opt_case_sensitive ? strncmp : strncasecmp)(p->data, s, len) == 0) {
return keyword;
}
}
CELL keyword = make_raw_keyword_counted(len);
KEYWORD* p = GET_KEYWORD(keyword);
if (opt_case_sensitive) {
memcpy(p->data, s, len);
}
else {
int i;
for(i=0; i<len; ++i) {
GET_KEYWORD(keyword)->data[i] = tolower(s[i]);
}
}
gc_root_1("make_keyword_counted", keyword);
g_interned_keywords = make_cons(keyword, g_interned_keywords);
gc_unroot();
return keyword;
}
示例12: make_name_counted
CELL make_name_counted(char* s, size_t len)
{
CELL list = g_interned_names;
for( ; !NULLP(list); list = CDR(list)) {
CELL name = CAR(list);
NAME* p = GET_NAME(name);
if (p->len == len && (opt_case_sensitive ? strncmp : strncasecmp)(p->data, s, len) == 0) {
return name;
}
}
CELL name = make_raw_name_counted(len);
NAME* p = GET_NAME(name);
if (opt_case_sensitive) {
memcpy(p->data, s, len);
}
else {
int i;
for(i=0; i<len; ++i) {
p->data[i] = tolower(s[i]);
}
}
gc_root_1("make_name_counted", name);
g_interned_names = make_cons(name, g_interned_names);
gc_unroot();
return name;
}
示例13: func_append
CELL func_append(CELL frame)
{
if (FC == 0) {
return V_NULL;
}
CELL pre_tail = V_EMPTY;
CELL result = V_EMPTY;
CELL arg = V_EMPTY;
gc_root_4("func_append", frame, pre_tail, result, arg);
result = FV[FC-1];
int argi = 0;
while(argi < FC-1) {
arg = FV[argi++];
while(CONSP(arg)) {
const CELL next = make_cons(CAR(arg), FV[FC-1]);
if (EMPTYP(pre_tail)) {
pre_tail = result = next;
}
else {
pre_tail = CDR(pre_tail) = next;
}
arg = CDR(arg);
}
if (!NULLP(arg)) {
gc_unroot();
return make_exception("expects a <proper list> for all but last argument");
}
}
gc_unroot();
return result;
}
示例14: x_get_string
static LISP x_get_string(LISP row, LISP col, LISP bname)
{
int r, c;
int s;
char *p;
buffer *buf;
r = get_c_long(row);
c = get_c_long(col);
if (r < 1 || r > BUFFER_ROWS || c < 1 || c > BUFFER_COLS)
return NIL;
if (NULLP(bname)) {
buf = siag_buffer;
s = siag_sht;
} else if (TYPEP(bname, tc_string)) {
buf = find_sheet_by_name(bname->storage_as.string.data,
siag_buffer, &s);
if (buf == NULL) return NIL;
}
else return NIL;
if (ret_type(buf, s, r, c) == ERROR) p = "";
else p = ret_pvalue(NULL, buf, s, r, c, -1);
return strcons(strlen(p), p);
}
示例15: fasl_ensure_valid_table_index
static void fasl_ensure_valid_table_index(lref_t reader, size_t index)
{
if (NULLP(FASL_READER_STREAM(reader)->table))
{
FASL_READER_STREAM(reader)->table =
vectorcons((index >=
DEFAULT_FASL_TABLE_SIZE) ? index +
DEFAULT_FASL_TABLE_SIZE : DEFAULT_FASL_TABLE_SIZE, NIL);
}
else
{
lref_t fasl_table = FASL_READER_STREAM(reader)->table;
assert(VECTORP(fasl_table));
size_t old_len = fasl_table->as.vector.dim;
if (index >= old_len)
{
size_t new_len =
(index >= old_len * 2) ? index + DEFAULT_FASL_TABLE_SIZE : (old_len * 2);
FASL_READER_STREAM(reader)->table =
vector_resize(fasl_table, new_len > SIZE_MAX ? SIZE_MAX : (size_t) new_len, NIL);
}
}
assert(VECTORP(FASL_READER_STREAM(reader)->table));
assert(index < (FASL_READER_STREAM(reader)->table)->as.vector.dim);
}