Commit 9c047aec authored by Christian Persch's avatar Christian Persch

all: Add nonnull attributes

parent cbc73b6d
......@@ -11,6 +11,7 @@ header_HEADERS = \
vte.h \
vteenums.h \
vteglobals.h \
vtemacros.h \
vtepty.h \
vteterminal.h \
$(NULL)
......@@ -75,6 +76,7 @@ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES = \
vteenums.h \
vteglobals.h \
vteint.h \
vtemacros.h \
vtepty.h \
vtepty-private.h \
vteresources.c \
......@@ -185,6 +187,7 @@ Vte_@VTE_API_VERSION_U@_gir_FILES = \
vte.h \
vteenums.h \
vteglobals.h \
vtemacros.h \
vtepty.h \
vteterminal.h \
vtetypebuiltins.c \
......
/*
* Copyright © 2014 Christian Persch
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __VTE_VTE_MACROS_H__
#define __VTE_VTE_MACROS_H__
#if !defined (__VTE_VTE_H_INSIDE__) && !defined (VTE_COMPILATION)
#error "Only <vte/vte.h> can be included directly."
#endif
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
#define VTE_GNUC_PACKED __attribute__((__packed__))
#else
#define VTE_GNUC_PACKED
#endif /* !__GNUC__ */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
#define VTE_GNUC_NONNULL(position) __attribute__((__nonnull__(position)))
#else
#define VTE_GNUC_NONNULL(position)
#endif
#endif /* __VTE_VTE_MACROS_H__ */
......@@ -26,6 +26,7 @@
#include <gio/gio.h>
#include "vteenums.h"
#include "vtemacros.h"
G_BEGIN_DECLS
......@@ -65,28 +66,28 @@ VtePty *vte_pty_new_foreign_sync (int fd,
GCancellable *cancellable,
GError **error);
int vte_pty_get_fd (VtePty *pty);
int vte_pty_get_fd (VtePty *pty) VTE_GNUC_NONNULL(1);
void vte_pty_close (VtePty *pty);
void vte_pty_close (VtePty *pty) VTE_GNUC_NONNULL(1);
void vte_pty_child_setup (VtePty *pty);
void vte_pty_child_setup (VtePty *pty) VTE_GNUC_NONNULL(1);
gboolean vte_pty_get_size (VtePty *pty,
int *rows,
int *columns,
GError **error);
GError **error) VTE_GNUC_NONNULL(1);
gboolean vte_pty_set_size (VtePty *pty,
int rows,
int columns,
GError **error);
GError **error) VTE_GNUC_NONNULL(1);
gboolean vte_pty_set_utf8 (VtePty *pty,
gboolean utf8,
GError **error);
GError **error) VTE_GNUC_NONNULL(1);
void vte_pty_set_term (VtePty *pty,
const char *emulation);
const char *emulation) VTE_GNUC_NONNULL(1);
G_END_DECLS
......
......@@ -22,6 +22,7 @@
#define vterowdata_h_included
#include "vteunistr.h"
#include "vtemacros.h"
G_BEGIN_DECLS
......@@ -35,15 +36,6 @@ G_BEGIN_DECLS
#define VTE_CURSOR_BG 262
#define VTE_PALETTE_SIZE 263
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
#define VTE_GNUC_PACKED \
__attribute__((__packed__))
#else
#define VTE_GNUC_PACKED
#endif /* !__GNUC__ */
/*
* VteCellAttr: A single cell style attributes
*
......
......@@ -29,6 +29,7 @@
#include <gtk/gtk.h>
#include "vteenums.h"
#include "vtemacros.h"
#include "vtepty.h"
G_BEGIN_DECLS
......@@ -123,7 +124,7 @@ struct _VteCharAttributes {
typedef gboolean (*VteSelectionFunc)(VteTerminal *terminal,
glong column,
glong row,
gpointer data);
gpointer data) VTE_GNUC_NONNULL(1);
/* The widget's type. */
GType vte_terminal_get_type(void);
......@@ -133,10 +134,10 @@ GtkWidget *vte_terminal_new(void);
VtePty *vte_terminal_pty_new_sync (VteTerminal *terminal,
VtePtyFlags flags,
GCancellable *cancellable,
GError **error);
GError **error) VTE_GNUC_NONNULL(1);
void vte_terminal_watch_child (VteTerminal *terminal,
GPid child_pid);
GPid child_pid) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_spawn_sync(VteTerminal *terminal,
VtePtyFlags pty_flags,
......@@ -148,103 +149,116 @@ gboolean vte_terminal_spawn_sync(VteTerminal *terminal,
gpointer child_setup_data,
GPid *child_pid /* out */,
GCancellable *cancellable,
GError **error);
GError **error) VTE_GNUC_NONNULL(1) VTE_GNUC_NONNULL(4);
/* Send data to the terminal to display, or to the terminal's forked command
* to handle in some way. If it's 'cat', they should be the same. */
void vte_terminal_feed(VteTerminal *terminal, const char *data, gssize length);
void vte_terminal_feed_child(VteTerminal *terminal, const char *text, gssize length);
void vte_terminal_feed_child_binary(VteTerminal *terminal, const guint8 *data, gsize length);
void vte_terminal_feed(VteTerminal *terminal,
const char *data,
gssize length) VTE_GNUC_NONNULL(1);
void vte_terminal_feed_child(VteTerminal *terminal,
const char *text,
gssize length) VTE_GNUC_NONNULL(1);
void vte_terminal_feed_child_binary(VteTerminal *terminal,
const guint8 *data,
gsize length) VTE_GNUC_NONNULL(1);
/* Copy currently-selected text to the clipboard, or from the clipboard to
* the terminal. */
void vte_terminal_copy_clipboard(VteTerminal *terminal);
void vte_terminal_paste_clipboard(VteTerminal *terminal);
void vte_terminal_copy_primary(VteTerminal *terminal);
void vte_terminal_paste_primary(VteTerminal *terminal);
void vte_terminal_copy_clipboard(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
void vte_terminal_paste_clipboard(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
void vte_terminal_copy_primary(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
void vte_terminal_paste_primary(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
void vte_terminal_select_all(VteTerminal *terminal);
void vte_terminal_unselect_all(VteTerminal *terminal);
void vte_terminal_select_all(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
void vte_terminal_unselect_all(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set the terminal's size. */
void vte_terminal_set_size(VteTerminal *terminal,
glong columns, glong rows);
glong columns, glong rows) VTE_GNUC_NONNULL(1);
void vte_terminal_set_font_scale(VteTerminal *terminal,
gdouble scale);
gdouble vte_terminal_get_font_scale(VteTerminal *terminal);
gdouble scale) VTE_GNUC_NONNULL(1);
gdouble vte_terminal_get_font_scale(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set various on-off settings. */
void vte_terminal_set_audible_bell(VteTerminal *terminal, gboolean is_audible);
void vte_terminal_set_audible_bell(VteTerminal *terminal,
gboolean is_audible) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_get_audible_bell(VteTerminal *terminal);
void vte_terminal_set_visible_bell(VteTerminal *terminal, gboolean is_visible);
void vte_terminal_set_visible_bell(VteTerminal *terminal,
gboolean is_visible) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_get_visible_bell(VteTerminal *terminal);
void vte_terminal_set_scroll_on_output(VteTerminal *terminal, gboolean scroll);
void vte_terminal_set_scroll_on_output(VteTerminal *terminal,
gboolean scroll) VTE_GNUC_NONNULL(1);
void vte_terminal_set_scroll_on_keystroke(VteTerminal *terminal,
gboolean scroll);
void vte_terminal_set_rewrap_on_resize(VteTerminal *terminal, gboolean rewrap);
gboolean vte_terminal_get_rewrap_on_resize(VteTerminal *terminal);
void vte_terminal_set_rewrap_on_resize(VteTerminal *terminal,
gboolean rewrap) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_get_rewrap_on_resize(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set the color scheme. */
void vte_terminal_set_color_bold(VteTerminal *terminal,
const GdkRGBA *bold);
const GdkRGBA *bold) VTE_GNUC_NONNULL(1);
void vte_terminal_set_color_dim(VteTerminal *terminal,
const GdkRGBA *dim);
const GdkRGBA *dim) VTE_GNUC_NONNULL(1);
void vte_terminal_set_color_foreground(VteTerminal *terminal,
const GdkRGBA *foreground);
const GdkRGBA *foreground) VTE_GNUC_NONNULL(1) VTE_GNUC_NONNULL(2);
void vte_terminal_set_color_background(VteTerminal *terminal,
const GdkRGBA *background);
const GdkRGBA *background) VTE_GNUC_NONNULL(1) VTE_GNUC_NONNULL(2);
void vte_terminal_set_color_cursor(VteTerminal *terminal,
const GdkRGBA *cursor_background);
const GdkRGBA *cursor_background) VTE_GNUC_NONNULL(1);
void vte_terminal_set_color_highlight(VteTerminal *terminal,
const GdkRGBA *highlight_background);
const GdkRGBA *highlight_background) VTE_GNUC_NONNULL(1);
void vte_terminal_set_color_highlight_foreground(VteTerminal *terminal,
const GdkRGBA *highlight_foreground);
const GdkRGBA *highlight_foreground) VTE_GNUC_NONNULL(1);
void vte_terminal_set_colors(VteTerminal *terminal,
const GdkRGBA *foreground,
const GdkRGBA *background,
const GdkRGBA *palette,
gsize palette_size);
gsize palette_size) VTE_GNUC_NONNULL(1);
void vte_terminal_set_default_colors(VteTerminal *terminal);
void vte_terminal_set_default_colors(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set whether or not the cursor blinks. */
void vte_terminal_set_cursor_blink_mode(VteTerminal *terminal,
VteCursorBlinkMode mode);
VteCursorBlinkMode vte_terminal_get_cursor_blink_mode(VteTerminal *terminal);
VteCursorBlinkMode mode) VTE_GNUC_NONNULL(1);
VteCursorBlinkMode vte_terminal_get_cursor_blink_mode(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set cursor shape */
void vte_terminal_set_cursor_shape(VteTerminal *terminal,
VteCursorShape shape);
VteCursorShape vte_terminal_get_cursor_shape(VteTerminal *terminal);
VteCursorShape shape) VTE_GNUC_NONNULL(1);
VteCursorShape vte_terminal_get_cursor_shape(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set the number of scrollback lines, above or at an internal minimum. */
void vte_terminal_set_scrollback_lines(VteTerminal *terminal, glong lines);
void vte_terminal_set_scrollback_lines(VteTerminal *terminal,
glong lines) VTE_GNUC_NONNULL(1);
/* Set or retrieve the current font. */
void vte_terminal_set_font(VteTerminal *terminal,
const PangoFontDescription *font_desc);
const PangoFontDescription *vte_terminal_get_font(VteTerminal *terminal);
void vte_terminal_set_allow_bold(VteTerminal *terminal, gboolean allow_bold);
gboolean vte_terminal_get_allow_bold(VteTerminal *terminal);
const PangoFontDescription *font_desc) VTE_GNUC_NONNULL(1);
const PangoFontDescription *vte_terminal_get_font(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
void vte_terminal_set_allow_bold(VteTerminal *terminal,
gboolean allow_bold) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_get_allow_bold(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Check if the terminal is the current selection owner. */
gboolean vte_terminal_get_has_selection(VteTerminal *terminal);
gboolean vte_terminal_get_has_selection(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set what happens when the user strikes backspace or delete. */
void vte_terminal_set_backspace_binding(VteTerminal *terminal,
VteEraseBinding binding);
VteEraseBinding binding) VTE_GNUC_NONNULL(1);
void vte_terminal_set_delete_binding(VteTerminal *terminal,
VteEraseBinding binding);
VteEraseBinding binding) VTE_GNUC_NONNULL(1);
/* Manipulate the autohide setting. */
void vte_terminal_set_mouse_autohide(VteTerminal *terminal, gboolean setting);
gboolean vte_terminal_get_mouse_autohide(VteTerminal *terminal);
void vte_terminal_set_mouse_autohide(VteTerminal *terminal,
gboolean setting) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_get_mouse_autohide(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Reset the terminal, optionally clearing the tab stops and line history. */
void vte_terminal_reset(VteTerminal *terminal,
gboolean clear_tabstops,
gboolean clear_history);
gboolean clear_history) VTE_GNUC_NONNULL(1);
/* Read the contents of the terminal, using a callback function to determine
* if a particular location on the screen (0-based) is interesting enough to
......@@ -255,101 +269,112 @@ void vte_terminal_reset(VteTerminal *terminal,
char *vte_terminal_get_text(VteTerminal *terminal,
VteSelectionFunc is_selected,
gpointer user_data,
GArray *attributes);
GArray *attributes) VTE_GNUC_NONNULL(1);
char *vte_terminal_get_text_include_trailing_spaces(VteTerminal *terminal,
VteSelectionFunc is_selected,
gpointer user_data,
GArray *attributes);
GArray *attributes) VTE_GNUC_NONNULL(1);
char *vte_terminal_get_text_range(VteTerminal *terminal,
glong start_row, glong start_col,
glong end_row, glong end_col,
VteSelectionFunc is_selected,
gpointer user_data,
GArray *attributes);
GArray *attributes) VTE_GNUC_NONNULL(1);
void vte_terminal_get_cursor_position(VteTerminal *terminal,
glong *column, glong *row);
glong *column,
glong *row) VTE_GNUC_NONNULL(1);
/* Add a matching expression, returning the tag the widget assigns to that
* expression. */
int vte_terminal_match_add_gregex(VteTerminal *terminal, GRegex *regex, GRegexMatchFlags flags);
int vte_terminal_match_add_gregex(VteTerminal *terminal,
GRegex *regex,
GRegexMatchFlags flags) VTE_GNUC_NONNULL(1);
/* Set the cursor to be used when the pointer is over a given match. */
void vte_terminal_match_set_cursor(VteTerminal *terminal, int tag,
GdkCursor *cursor);
void vte_terminal_match_set_cursor(VteTerminal *terminal,
int tag,
GdkCursor *cursor) VTE_GNUC_NONNULL(1);
void vte_terminal_match_set_cursor_type(VteTerminal *terminal,
int tag, GdkCursorType cursor_type);
int tag,
GdkCursorType cursor_type) VTE_GNUC_NONNULL(1);
void vte_terminal_match_set_cursor_name(VteTerminal *terminal,
int tag, const char *cursor_name);
void vte_terminal_match_remove(VteTerminal *terminal, int tag);
void vte_terminal_match_remove_all(VteTerminal *terminal);
int tag,
const char *cursor_name) VTE_GNUC_NONNULL(1) VTE_GNUC_NONNULL(3);
void vte_terminal_match_remove(VteTerminal *terminal,
int tag) VTE_GNUC_NONNULL(1);
void vte_terminal_match_remove_all(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Check if a given cell on the screen contains part of a matched string. If
* it does, return the string, and store the match tag in the optional tag
* argument. */
char *vte_terminal_match_check(VteTerminal *terminal,
glong column, glong row,
int *tag);
int *tag) VTE_GNUC_NONNULL(1);
char *vte_terminal_match_check_event(VteTerminal *terminal,
GdkEvent *event,
int *tag);
int *tag) VTE_GNUC_NONNULL(1) VTE_GNUC_NONNULL(2);
void vte_terminal_search_set_gregex (VteTerminal *terminal,
GRegex *regex,
GRegexMatchFlags flags);
GRegex *vte_terminal_search_get_gregex (VteTerminal *terminal);
GRegexMatchFlags flags) VTE_GNUC_NONNULL(1);
GRegex *vte_terminal_search_get_gregex (VteTerminal *terminal) VTE_GNUC_NONNULL(1);
void vte_terminal_search_set_wrap_around (VteTerminal *terminal,
gboolean wrap_around);
gboolean vte_terminal_search_get_wrap_around (VteTerminal *terminal);
gboolean vte_terminal_search_find_previous (VteTerminal *terminal);
gboolean vte_terminal_search_find_next (VteTerminal *terminal);
gboolean wrap_around) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_search_get_wrap_around (VteTerminal *terminal) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_search_find_previous (VteTerminal *terminal) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_search_find_next (VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set the emulation type. Most of the time you won't need this. */
void vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation);
const char *vte_terminal_get_emulation(VteTerminal *terminal);
void vte_terminal_set_emulation(VteTerminal *terminal,
const char *emulation) VTE_GNUC_NONNULL(1);
const char *vte_terminal_get_emulation(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Set the character encoding. Most of the time you won't need this. */
void vte_terminal_set_encoding(VteTerminal *terminal, const char *codeset);
const char *vte_terminal_get_encoding(VteTerminal *terminal);
void vte_terminal_set_encoding(VteTerminal *terminal,
const char *codeset) VTE_GNUC_NONNULL(1);
const char *vte_terminal_get_encoding(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* CJK compatibility setting */
void vte_terminal_set_cjk_ambiguous_width(VteTerminal *terminal, int width);
int vte_terminal_get_cjk_ambiguous_width(VteTerminal *terminal);
void vte_terminal_set_cjk_ambiguous_width(VteTerminal *terminal,
int width) VTE_GNUC_NONNULL(1);
int vte_terminal_get_cjk_ambiguous_width(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Get the contents of the status line. */
const char *vte_terminal_get_status_line(VteTerminal *terminal);
const char *vte_terminal_get_status_line(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
void vte_terminal_set_pty(VteTerminal *terminal, VtePty *pty);
VtePty *vte_terminal_get_pty(VteTerminal *terminal);
void vte_terminal_set_pty(VteTerminal *terminal,
VtePty *pty) VTE_GNUC_NONNULL(1);
VtePty *vte_terminal_get_pty(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Accessors for bindings. */
glong vte_terminal_get_char_width(VteTerminal *terminal);
glong vte_terminal_get_char_height(VteTerminal *terminal);
glong vte_terminal_get_row_count(VteTerminal *terminal);
glong vte_terminal_get_column_count(VteTerminal *terminal);
const char *vte_terminal_get_window_title(VteTerminal *terminal);
const char *vte_terminal_get_icon_title(VteTerminal *terminal);
const char *vte_terminal_get_current_directory_uri(VteTerminal *terminal);
const char *vte_terminal_get_current_file_uri(VteTerminal *terminal);
glong vte_terminal_get_char_width(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
glong vte_terminal_get_char_height(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
glong vte_terminal_get_row_count(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
glong vte_terminal_get_column_count(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
const char *vte_terminal_get_window_title(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
const char *vte_terminal_get_icon_title(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
const char *vte_terminal_get_current_directory_uri(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
const char *vte_terminal_get_current_file_uri(VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* misc */
void vte_terminal_set_input_enabled (VteTerminal *terminal,
gboolean enabled);
gboolean vte_terminal_get_input_enabled (VteTerminal *terminal);
gboolean enabled) VTE_GNUC_NONNULL(1);
gboolean vte_terminal_get_input_enabled (VteTerminal *terminal) VTE_GNUC_NONNULL(1);
/* Window geometry helpers */
void vte_terminal_get_geometry_hints(VteTerminal *terminal,
GdkGeometry *hints,
int min_rows,
int min_columns);
int min_columns) VTE_GNUC_NONNULL(1) VTE_GNUC_NONNULL(2);
void vte_terminal_set_geometry_hints_for_window(VteTerminal *terminal,
GtkWindow *window);
GtkWindow *window) VTE_GNUC_NONNULL(1) VTE_GNUC_NONNULL(2);
/* Writing contents out */
gboolean vte_terminal_write_contents (VteTerminal *terminal,
GOutputStream *stream,
VteWriteFlags flags,
GCancellable *cancellable,
GError **error);
GError **error) VTE_GNUC_NONNULL(1) VTE_GNUC_NONNULL(2);
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment