本文整理汇总了C++中NILP函数的典型用法代码示例。如果您正苦于以下问题:C++ NILP函数的具体用法?C++ NILP怎么用?C++ NILP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NILP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: reread_doc_file
static bool
reread_doc_file (Lisp_Object file)
{
if (NILP (file))
Fsnarf_documentation (Vdoc_file_name);
else
Fload (file, Qt, Qt, Qt, Qnil);
return 1;
}
开发者ID:BartElliott,项目名称:cs188-case-study,代码行数:10,代码来源:doc.c
示例2: get_local_selection
/* Given a selection-name and desired type, this looks up our local copy of
the selection value and converts it to the type. */
static Lisp_Object
get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type)
{
Lisp_Object local_value = assq_no_quit (selection_symbol, Vselection_alist);
if (!NILP (local_value))
{
Lisp_Object value_list = XCAR (XCDR (local_value));
Lisp_Object value;
/* First try to find an entry of the appropriate type */
value = assq_no_quit (target_type, value_list);
if (!NILP (value))
return XCDR (value);
}
return Qnil;
}
开发者ID:kenny-thomas,项目名称:xemacs,代码行数:21,代码来源:select.c
示例3: record_backtrace
static void
record_backtrace (log_t *log, EMACS_INT count)
{
Lisp_Object backtrace;
ptrdiff_t index;
if (!INTEGERP (log->next_free))
/* FIXME: transfer the evicted counts to a special entry rather
than dropping them on the floor. */
evict_lower_half (log);
index = XINT (log->next_free);
/* Get a "working memory" vector. */
backtrace = HASH_KEY (log, index);
get_backtrace (backtrace);
{ /* We basically do a `gethash+puthash' here, except that we have to be
careful to avoid memory allocation since we're in a signal
handler, and we optimize the code to try and avoid computing the
hash+lookup twice. See fns.c:Fputhash for reference. */
EMACS_UINT hash;
ptrdiff_t j = hash_lookup (log, backtrace, &hash);
if (j >= 0)
{
EMACS_INT old_val = XINT (HASH_VALUE (log, j));
EMACS_INT new_val = saturated_add (old_val, count);
set_hash_value_slot (log, j, make_number (new_val));
}
else
{ /* BEWARE! hash_put in general can allocate memory.
But currently it only does that if log->next_free is nil. */
int j;
eassert (!NILP (log->next_free));
j = hash_put (log, backtrace, make_number (count), hash);
/* Let's make sure we've put `backtrace' right where it
already was to start with. */
eassert (index == j);
/* FIXME: If the hash-table is almost full, we should set
some global flag so that some Elisp code can offload its
data elsewhere, so as to avoid the eviction code.
There are 2 ways to do that, AFAICT:
- Set a flag checked in QUIT, such that QUIT can then call
Fprofiler_cpu_log and stash the full log for later use.
- Set a flag check in post-gc-hook, so that Elisp code can call
profiler-cpu-log. That gives us more flexibility since that
Elisp code can then do all kinds of fun stuff like write
the log to disk. Or turn it right away into a call tree.
Of course, using Elisp is generally preferable, but it may
take longer until we get a chance to run the Elisp code, so
there's more risk that the table will get full before we
get there. */
}
}
}
开发者ID:aspiers,项目名称:emacs-git,代码行数:55,代码来源:profiler.c
示例4: inotify_callback
/* This callback is called when the FD is available for read. The inotify
events are read from FD and converted into input_events. */
static void
inotify_callback (int fd, void *_)
{
int to_read;
if (ioctl (fd, FIONREAD, &to_read) < 0)
report_file_notify_error ("Error while retrieving file system events",
Qnil);
USE_SAFE_ALLOCA;
char *buffer = SAFE_ALLOCA (to_read);
ssize_t n = read (fd, buffer, to_read);
if (n < 0)
report_file_notify_error ("Error while reading file system events", Qnil);
struct input_event event;
EVENT_INIT (event);
event.kind = FILE_NOTIFY_EVENT;
for (ssize_t i = 0; i < n; )
{
struct inotify_event *ev = (struct inotify_event *) &buffer[i];
Lisp_Object descriptor = INTEGER_TO_CONS (ev->wd);
Lisp_Object prevtail = find_descriptor (descriptor);
if (! NILP (prevtail))
{
Lisp_Object tail = CONSP (prevtail) ? XCDR (prevtail) : watch_list;
for (Lisp_Object watches = XCDR (XCAR (tail)); ! NILP (watches);
watches = XCDR (watches))
{
event.arg = inotifyevent_to_event (XCAR (watches), ev);
if (!NILP (event.arg))
kbd_buffer_store_event (&event);
}
/* If event was removed automatically: Drop it from watch list. */
if (ev->mask & IN_IGNORED)
remove_descriptor (prevtail, true);
}
i += sizeof (*ev) + ev->len;
}
SAFE_FREE ();
}
开发者ID:davidswelt,项目名称:aquamacs-emacs,代码行数:44,代码来源:inotify.c
示例5: gtk_get_button_size
static int
gtk_get_button_size (struct frame *f, Lisp_Object window,
struct toolbar_button *tb, int vert, int pos)
{
int shadow_thickness = 2;
int size;
if (tb->blank)
{
if (!NILP (tb->down_glyph))
size = XINT (tb->down_glyph);
else
size = DEFAULT_TOOLBAR_BLANK_SIZE;
}
else
{
struct window *w = XWINDOW (window);
Lisp_Object glyph = get_toolbar_button_glyph (w, tb);
/* Unless, of course, the user has done something stupid like
change the glyph out from under us. Use a blank placeholder
in that case. */
if (NILP (glyph))
return XINT (f->toolbar_size[pos]);
if (vert)
size = glyph_height (glyph, window);
else
size = glyph_width (glyph, window);
}
if (!size)
{
/* If the glyph doesn't have a size we'll insert a blank
placeholder instead. */
return XINT (f->toolbar_size[pos]);
}
size += shadow_thickness * 2;
return (size);
}
开发者ID:boukeversteegh,项目名称:chise,代码行数:42,代码来源:toolbar-gtk.c
示例6: ensure_not_printing
static void
ensure_not_printing (struct device *d)
{
if (!NILP (DEVICE_FRAME_LIST (d)))
{
Lisp_Object device = wrap_device (d);
invalid_operation ("Cannot change settings while print job is active",
device);
}
}
开发者ID:kenny-thomas,项目名称:xemacs,代码行数:11,代码来源:device-msw.c
示例7: abbrev_match_mapper
/* For use by abbrev_match(): Match SYMBOL's name against buffer text
before point, case-insensitively. When found, return non-zero, so
that map_obarray terminates mapping. */
static int abbrev_match_mapper(Lisp_Object symbol, void *arg)
{
struct abbrev_match_mapper_closure *closure =
(struct abbrev_match_mapper_closure *)arg;
Charcount abbrev_length;
Lisp_Symbol *sym = XSYMBOL(symbol);
Lisp_String *abbrev;
/* symbol_value should be OK here, because abbrevs are not expected
to contain any SYMBOL_MAGIC stuff. */
if (UNBOUNDP(symbol_value(sym)) || NILP(symbol_value(sym))) {
/* The symbol value of nil means that abbrev got undefined. */
return 0;
}
abbrev = symbol_name(sym);
abbrev_length = string_char_length(abbrev);
if (abbrev_length > closure->maxlen) {
/* This abbrev is too large -- it wouldn't fit. */
return 0;
}
/* If `bar' is an abbrev, and a user presses `fubar<SPC>', we don't
normally want to expand it. OTOH, if the abbrev begins with
non-word syntax (e.g. `#if'), it is OK to abbreviate it anywhere. */
if (abbrev_length < closure->maxlen && abbrev_length > 0
&& (WORD_SYNTAX_P(closure->chartab, string_char(abbrev, 0)))
&& (WORD_SYNTAX_P(closure->chartab,
BUF_FETCH_CHAR(closure->buf,
closure->point - (abbrev_length +
1))))) {
return 0;
}
/* Match abbreviation string against buffer text. */
{
Bufbyte *ptr = string_data(abbrev);
Charcount idx;
for (idx = 0; idx < abbrev_length; idx++) {
if (DOWNCASE(closure->buf,
BUF_FETCH_CHAR(closure->buf,
closure->point -
abbrev_length + idx))
!= DOWNCASE(closure->buf, charptr_emchar(ptr))) {
break;
}
INC_CHARPTR(ptr);
}
if (idx == abbrev_length) {
/* This is the one. */
closure->found = sym;
return 1;
}
}
return 0;
}
开发者ID:hroptatyr,项目名称:sxemacs,代码行数:57,代码来源:abbrev.c
示例8: save_menu_items
void
save_menu_items (void)
{
Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil,
make_number (menu_items_used),
make_number (menu_items_n_panes),
make_number (menu_items_submenu_depth));
record_unwind_protect (restore_menu_items, saved);
menu_items_inuse = Qnil;
menu_items = Qnil;
}
开发者ID:ueno,项目名称:emacs,代码行数:11,代码来源:menu.c
示例9: decode_console
struct console *
decode_console (Lisp_Object console)
{
if (NILP (console))
console = Fselected_console ();
/* quietly accept devices and frames for the console arg */
if (DEVICEP (console) || FRAMEP (console))
console = DEVICE_CONSOLE (decode_device (console));
CHECK_LIVE_CONSOLE (console);
return XCONSOLE (console);
}
开发者ID:kenny-thomas,项目名称:xemacs,代码行数:11,代码来源:console.c
示例10: discard_menu_items
void
discard_menu_items (void)
{
/* Free the structure if it is especially large.
Otherwise, hold on to it, to save time. */
if (menu_items_allocated > 200)
{
menu_items = Qnil;
menu_items_allocated = 0;
}
eassert (NILP (menu_items_inuse));
}
开发者ID:ueno,项目名称:emacs,代码行数:12,代码来源:menu.c
示例11: gtk_device_to_console_connection
static Lisp_Object
gtk_device_to_console_connection (Lisp_Object connection, Error_behavior errb)
{
/* Strip the trailing .# off of the connection, if it's there. */
if (NILP (connection))
return Qnil;
else
{
connection = build_string ("gtk");
}
return connection;
}
开发者ID:boukeversteegh,项目名称:chise,代码行数:13,代码来源:console-gtk.c
示例12: find_env
int find_env(int exp_id) {
int level = call_depth;
int found = L_NIL;
while (level >= 0) {
found = env[(level << 8) + expression[exp_id]];
if (!NILP(found)){
return found;
}
level -= 1;
}
return L_NIL;
}
开发者ID:tomykaira,项目名称:mips,代码行数:13,代码来源:rukako.c
示例13: lookup
T lookup(T name, Environment env) {
assert(name->type == T_SYM);
for (; !NILP(env); env=CDR(env)) {
T binding;
binding = CAR(env);
if (CAR(binding) == name) {
return CDR(binding);
}
}
return NIL;
}
开发者ID:cantpitch,项目名称:CanaryOS,代码行数:13,代码来源:Eval.c
示例14: get_logical_cursor_bitmap
static int
get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
{
Lisp_Object cmap, bm = Qnil;
if ((cmap = BVAR (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap))
{
bm = Fassq (cursor, cmap);
if (CONSP (bm))
{
if ((bm = XCDR (bm)), NILP (bm))
return NO_FRINGE_BITMAP;
return lookup_fringe_bitmap (bm);
}
}
if (EQ (cmap, BVAR (&buffer_defaults, fringe_cursor_alist)))
return NO_FRINGE_BITMAP;
bm = Fassq (cursor, BVAR (&buffer_defaults, fringe_cursor_alist));
if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm)))
return NO_FRINGE_BITMAP;
return lookup_fringe_bitmap (bm);
}
开发者ID:infiniteone,项目名称:emacs,代码行数:22,代码来源:fringe.c
示例15: restore_menu_items
static void
restore_menu_items (Lisp_Object saved)
{
menu_items = XCAR (saved);
menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil);
menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0);
saved = XCDR (saved);
menu_items_used = XINT (XCAR (saved));
saved = XCDR (saved);
menu_items_n_panes = XINT (XCAR (saved));
saved = XCDR (saved);
menu_items_submenu_depth = XINT (XCAR (saved));
}
开发者ID:ueno,项目名称:emacs,代码行数:13,代码来源:menu.c
示例16: record_point
static void
record_point (ptrdiff_t pt)
{
bool at_boundary;
/* Don't record position of pt when undo_inhibit_record_point holds. */
if (undo_inhibit_record_point)
return;
/* Allocate a cons cell to be the undo boundary after this command. */
if (NILP (pending_boundary))
pending_boundary = Fcons (Qnil, Qnil);
if ((current_buffer != last_undo_buffer)
/* Don't call Fundo_boundary for the first change. Otherwise we
risk overwriting last_boundary_position in Fundo_boundary with
PT of the current buffer and as a consequence not insert an
undo boundary because last_boundary_position will equal pt in
the test at the end of the present function (Bug#731). */
&& (MODIFF > SAVE_MODIFF))
Fundo_boundary ();
last_undo_buffer = current_buffer;
at_boundary = ! CONSP (BVAR (current_buffer, undo_list))
|| NILP (XCAR (BVAR (current_buffer, undo_list)));
if (MODIFF <= SAVE_MODIFF)
record_first_change ();
/* If we are just after an undo boundary, and
point wasn't at start of deleted range, record where it was. */
if (at_boundary
&& current_buffer == last_boundary_buffer
&& last_boundary_position != pt)
bset_undo_list (current_buffer,
Fcons (make_number (last_boundary_position),
BVAR (current_buffer, undo_list)));
}
开发者ID:aixoss,项目名称:emacs,代码行数:38,代码来源:undo.c
示例17: reread_doc_file
static int
reread_doc_file (Lisp_Object file)
{
#if 0
Lisp_Object reply, prompt[3];
struct gcpro gcpro1;
GCPRO1 (file);
prompt[0] = build_string ("File ");
prompt[1] = NILP (file) ? Vdoc_file_name : file;
prompt[2] = build_string (" is out of sync. Reload? ");
reply = Fy_or_n_p (Fconcat (3, prompt));
UNGCPRO;
if (NILP (reply))
return 0;
#endif
if (NILP (file))
Fsnarf_documentation (Vdoc_file_name);
else
Fload (file, Qt, Qt, Qt, Qnil);
return 1;
}
开发者ID:T-force,项目名称:emacs,代码行数:23,代码来源:doc.c
示例18: gcpro_popup_callbacks
void gcpro_popup_callbacks(LWLIB_ID id)
{
struct popup_data *pdata;
Lisp_Object lid = make_int(id);
Lisp_Object lpdata;
assert(NILP(assq_no_quit(lid, Vpopup_callbacks)));
pdata = alloc_lcrecord_type(struct popup_data, &lrecord_popup_data);
pdata->id = id;
pdata->last_menubar_buffer = Qnil;
pdata->menubar_contents_up_to_date = 0;
XSETPOPUP_DATA(lpdata, pdata);
Vpopup_callbacks = Fcons(Fcons(lid, lpdata), Vpopup_callbacks);
}
开发者ID:hroptatyr,项目名称:sxemacs,代码行数:14,代码来源:gui-x.c
示例19: sound_oss_create
static ad_device_data *
sound_oss_create(Lisp_Object oss_options)
{
/* result */
sound_oss_data_t *sod = NULL;
int keep_open = 0;
/* option keywords */
Lisp_Object opt_device;
Lisp_Object opt_keepopen;
/* parse options */
opt_device = Fplist_get(oss_options, Q_device, Qnil);
if (!NILP(opt_device) && !STRINGP(opt_device)) {
wrong_type_argument(Qstringp, opt_device);
return NULL;
}
opt_keepopen = Fplist_get(oss_options, Q_keep_open, Qnil);
if (!NILP(opt_keepopen))
keep_open = 1;
/* initialise and fill */
sod = xnew_and_zero(sound_oss_data_t);
sod->device = opt_device;
sod->keep_open = keep_open;
sod->device_fd = -1;
SXE_MUTEX_INIT(&sod->mtx);
/* Open the device */
if (!keep_open) {
sod->device_fd = -1;
}
return (ad_device_data*)sod;
}
开发者ID:hroptatyr,项目名称:sxemacs,代码行数:37,代码来源:sound-oss.c
示例20: menu_parse_submenu_keywords
Lisp_Object
menu_parse_submenu_keywords (Lisp_Object desc, Lisp_Object gui_item)
{
Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item);
/* Menu descriptor should be a list */
CHECK_CONS (desc);
/* First element may be menu name, although can be omitted.
Let's think that if stuff begins with anything than a keyword
or a list (submenu), this is a menu name, expected to be a string */
if (!KEYWORDP (XCAR (desc)) && !CONSP (XCAR (desc)))
{
CHECK_STRING (XCAR (desc));
pgui_item->name = XCAR (desc);
desc = XCDR (desc);
if (!NILP (desc))
CHECK_CONS (desc);
}
/* Walk along all key-value pairs */
while (!NILP(desc) && KEYWORDP (XCAR (desc)))
{
Lisp_Object key, val;
key = XCAR (desc);
desc = XCDR (desc);
CHECK_CONS (desc);
val = XCAR (desc);
desc = XCDR (desc);
if (!NILP (desc))
CHECK_CONS (desc);
gui_item_add_keyval_pair (gui_item, key, val, ERROR_ME);
}
/* Return the rest - supposed to be a list of items */
return desc;
}
开发者ID:boukeversteegh,项目名称:chise,代码行数:37,代码来源:menubar.c
注:本文中的NILP函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论