1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-10 18:00:30 -08:00
emacs/src/emacs-module.h
John Wiegley 63efcc2686 Merge from origin/emacs-25
facb5e2 Update Emacs manual section related to character folding
4efea8e ; * etc/DEBUG: Fix a typo.  (Bug#22984)
f8df21b Update admin/notes/unicode
950be68 Add symref-filepattern entries for c?perl-mode
8b8a6ad Don't use XRANDR 1.3 extensions if the server doesn't support them.
985dacf ; NEWS update for the last change in etags
741a6f8 Sync with gnulib
7352c6c Rework C source files to avoid ^(
a589e9a By default, etags produces unqualified Perl tag names
72c7438 Indent methods with keyword names correctly
28532a9 Propertize character literals and special global variables
        differently
a7d6f39 ; Fix last change in NEWS
83b2a20 Change how /etc/NEWS presents character folding
b417c5a Revert "Revert "Backport: * lisp/isearch.el: Turn char-folding
        off by default""
711ca36 Properly handle lambda as read function (bug 22961)
1b9d616 Propertize operator symbol names with symbol syntax class
9b16bc2 Stop recognizing :#{} as symbol in ruby-mode
366ec77 Allow using the left shift operator without spaces on both sides
02bf7cc Properly handle unquoting in wdired (bug 22938)
16cf469 ; Spelling fix and tighten up comment
f50bc04 Allow splat operator before percent literal
991c801 Don't apply the return value of goto-char as syntax class
6e63b3e Guard against nested percent literals
066f3bc Recognize iuwu-mod after an escaped newline
6f7a57c Fix symbolic mode string conversion for s and t
50b9826 Update 'ucs-names' database
993b2fb Improve doc string of 'shell-command'
b71c717 Make the code in movemail_strftime more general
cc057e4 Speed up redisplay of binary files with long series of nulls
e51b27e Remove the highlighting support for quoting 'like this' inside
        Lisp docstrings
b1abce1 Restore leading space in movemail pop output
98b8d44 Fix bidi-paragraph-direction in Rmail view buffer
dc9d837 Don't misindent computed property generator methods
7923112 Fix mbox files produced by movemail on MS-Windows
c45a1ca doc string file descriptor exhaustion fix
265141b Fix Bug#22814
2016-03-11 13:33:32 -08:00

197 lines
5.5 KiB
C++

/* emacs-module.h - GNU Emacs module API.
Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef EMACS_MODULE_H
#define EMACS_MODULE_H
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if defined __cplusplus && __cplusplus >= 201103L
# define EMACS_NOEXCEPT noexcept
#else
# define EMACS_NOEXCEPT
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Current environment. */
typedef struct emacs_env_25 emacs_env;
/* Opaque pointer representing an Emacs Lisp value.
BEWARE: Do not assume NULL is a valid value! */
typedef struct emacs_value_tag *emacs_value;
enum { emacs_variadic_function = -2 };
/* Struct passed to a module init function (emacs_module_init). */
struct emacs_runtime
{
/* Structure size (for version checking). */
ptrdiff_t size;
/* Private data; users should not touch this. */
struct emacs_runtime_private *private_members;
/* Return an environment pointer. */
emacs_env *(*get_environment) (struct emacs_runtime *ert);
};
/* Possible Emacs function call outcomes. */
enum emacs_funcall_exit
{
/* Function has returned normally. */
emacs_funcall_exit_return = 0,
/* Function has signaled an error using `signal'. */
emacs_funcall_exit_signal = 1,
/* Function has exit using `throw'. */
emacs_funcall_exit_throw = 2,
};
struct emacs_env_25
{
/* Structure size (for version checking). */
ptrdiff_t size;
/* Private data; users should not touch this. */
struct emacs_env_private *private_members;
/* Memory management. */
emacs_value (*make_global_ref) (emacs_env *env,
emacs_value any_reference);
void (*free_global_ref) (emacs_env *env,
emacs_value global_reference);
/* Non-local exit handling. */
enum emacs_funcall_exit (*non_local_exit_check) (emacs_env *env);
void (*non_local_exit_clear) (emacs_env *env);
enum emacs_funcall_exit (*non_local_exit_get)
(emacs_env *env,
emacs_value *non_local_exit_symbol_out,
emacs_value *non_local_exit_data_out);
void (*non_local_exit_signal) (emacs_env *env,
emacs_value non_local_exit_symbol,
emacs_value non_local_exit_data);
void (*non_local_exit_throw) (emacs_env *env,
emacs_value tag,
emacs_value value);
/* Function registration. */
emacs_value (*make_function) (emacs_env *env,
ptrdiff_t min_arity,
ptrdiff_t max_arity,
emacs_value (*function) (emacs_env *env,
ptrdiff_t nargs,
emacs_value args[],
void *)
EMACS_NOEXCEPT,
const char *documentation,
void *data);
emacs_value (*funcall) (emacs_env *env,
emacs_value function,
ptrdiff_t nargs,
emacs_value args[]);
emacs_value (*intern) (emacs_env *env,
const char *symbol_name);
/* Type conversion. */
emacs_value (*type_of) (emacs_env *env,
emacs_value value);
bool (*is_not_nil) (emacs_env *env, emacs_value value);
bool (*eq) (emacs_env *env, emacs_value a, emacs_value b);
intmax_t (*extract_integer) (emacs_env *env, emacs_value value);
emacs_value (*make_integer) (emacs_env *env, intmax_t value);
double (*extract_float) (emacs_env *env, emacs_value value);
emacs_value (*make_float) (emacs_env *env, double value);
/* Copy the content of the Lisp string VALUE to BUFFER as an utf8
null-terminated string.
SIZE must point to the total size of the buffer. If BUFFER is
NULL or if SIZE is not big enough, write the required buffer size
to SIZE and return false.
Note that SIZE must include the last null byte (e.g. "abc" needs
a buffer of size 4).
Return true if the string was successfully copied. */
bool (*copy_string_contents) (emacs_env *env,
emacs_value value,
char *buffer,
ptrdiff_t *size_inout);
/* Create a Lisp string from a utf8 encoded string. */
emacs_value (*make_string) (emacs_env *env,
const char *contents, ptrdiff_t length);
/* Embedded pointer type. */
emacs_value (*make_user_ptr) (emacs_env *env,
void (*fin) (void *) EMACS_NOEXCEPT,
void *ptr);
void *(*get_user_ptr) (emacs_env *env, emacs_value uptr);
void (*set_user_ptr) (emacs_env *env, emacs_value uptr, void *ptr);
void (*(*get_user_finalizer) (emacs_env *env, emacs_value uptr))
(void *) EMACS_NOEXCEPT;
void (*set_user_finalizer) (emacs_env *env,
emacs_value uptr,
void (*fin) (void *) EMACS_NOEXCEPT);
/* Vector functions. */
emacs_value (*vec_get) (emacs_env *env, emacs_value vec, ptrdiff_t i);
void (*vec_set) (emacs_env *env, emacs_value vec, ptrdiff_t i,
emacs_value val);
ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vec);
};
/* Every module should define a function as follows. */
extern int emacs_module_init (struct emacs_runtime *ert);
#ifdef __cplusplus
}
#endif
#endif /* EMACS_MODULE_H */