vte3 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README ADDED
@@ -0,0 +1,34 @@
1
+ Ruby/VTE
2
+ ========
3
+
4
+ Ruby/VTE is a Ruby binding of VTE.
5
+
6
+ Requirements
7
+ ------------
8
+
9
+ Ruby: http://www.ruby-lang.org/
10
+ VTE [*]: http://www.gnome.org/
11
+ Ruby/GTK2: http://ruby-gnome2.sourceforge.net/
12
+
13
+ [*]: 0.12.1 or later is required.
14
+
15
+ Install
16
+ -------
17
+
18
+ 0. install ruby and VTE.
19
+ 1. ruby extconf.rb
20
+ 2. make
21
+ 3. su
22
+ 4. make install
23
+
24
+ Copying
25
+ -------
26
+ Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
27
+
28
+ This program is free software.
29
+ You can distribute/modify this program under the terms of
30
+ the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
31
+
32
+ Project Website
33
+ ---------------
34
+ http://ruby-gnome2.sourceforge.jp/
data/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ # -*- ruby -*-
2
+
3
+ $LOAD_PATH.unshift("./../glib2/lib")
4
+ require 'gnome2-raketask'
5
+
6
+ package = GNOME2Package.new do |_package|
7
+ _package.summary = "Ruby/VTE is a Ruby binding of VTE."
8
+ _package.description = "Ruby/VTE is a Ruby binding of VTE."
9
+ _package.dependency.gem.runtime = ["gtk3"]
10
+ _package.win32.packages = []
11
+ _package.win32.dependencies = []
12
+ _package.win32.build_dependencies = [
13
+ "glib2", "atk", "pango", "gdk_pixbuf2", "gdk3",
14
+ ]
15
+ _package.win32.build_packages = [
16
+ # {
17
+ # :name => "ncurses",
18
+ # :download_base_url => "http://ftp.gnu.org/pub/gnu/ncurses",
19
+ # :label => "ncurses",
20
+ # :version => "5.9",
21
+ # :configure_args => [
22
+ # "--enable-sp-funcs",
23
+ # "--enable-term-driver",
24
+ # "--with-shared",
25
+ # "--without-normal",
26
+ # "--without-progs",
27
+ # "--without-tests",
28
+ # ],
29
+ # :patches => [
30
+ # "ncurses-5.9-support-mingw32.diff",
31
+ # "ncurses-5.9-add-missing-exe.diff",
32
+ # ],
33
+ # },
34
+ # {
35
+ # :name => "vte",
36
+ # :download_site => :gnome,
37
+ # :label => "vte",
38
+ # :version => "0.34.2",
39
+ # :configure_args => [],
40
+ # :compression_method => "xz",
41
+ # }
42
+ ]
43
+ _package.required_ruby_version = ">= 1.9.2"
44
+ _package.post_install_message = "This library is experimental."
45
+ end
46
+ package.define_tasks
47
+
data/ext/vte3/depend ADDED
@@ -0,0 +1,6 @@
1
+ install: install-pc
2
+ install-pc:
3
+ if test -n "$(pkgconfigdir)"; then \
4
+ $(MAKEDIRS) $(pkgconfigdir); \
5
+ $(INSTALL_DATA) ruby-vte3.pc $(pkgconfigdir); \
6
+ fi
@@ -0,0 +1,67 @@
1
+ =begin
2
+ extconf.rb for Ruby/VTE extention library
3
+ =end
4
+
5
+ require 'pathname'
6
+
7
+ base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
8
+ top_dir = base_dir.parent
9
+ top_build_dir = Pathname(".").parent.parent.parent.expand_path
10
+
11
+ mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
12
+ version_suffix = ""
13
+ unless mkmf_gnome2_dir.exist?
14
+ if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
15
+ version_suffix = $1
16
+ mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
17
+ end
18
+ end
19
+
20
+ $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
21
+
22
+ module_name = "vte3"
23
+ package_id = "vte-2.90"
24
+
25
+ begin
26
+ require 'mkmf-gnome2'
27
+ rescue LoadError
28
+ require 'rubygems'
29
+ gem 'glib2'
30
+ require 'mkmf-gnome2'
31
+ end
32
+
33
+ setup_win32(module_name, base_dir)
34
+
35
+ unless required_pkg_config_package([package_id, 0, 26, 0],
36
+ :debian => "libvte-2.90-dev",
37
+ :redhat => "vte3-devel")
38
+ exit(false)
39
+ end
40
+
41
+ ["glib2", "gio2", "atk", "pango", "gdk3", "gtk3"].each do |package|
42
+ directory = "#{package}#{version_suffix}"
43
+ build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
44
+ add_depend_package(package, "#{directory}/ext/#{package}",
45
+ top_dir.to_s,
46
+ :top_build_dir => top_build_dir.to_s,
47
+ :target_build_dir => build_dir)
48
+ end
49
+
50
+ vte_headers = ["vte/vte.h"]
51
+ have_type("VteTerminalCursorBlinkMode", vte_headers)
52
+
53
+ unless have_macro("VTE_CHECK_VERSION", vte_headers)
54
+ make_version_header("VTE", package_id, ".")
55
+ end
56
+
57
+ create_pkg_config_file("Ruby/VTE3", package_id)
58
+ $defs << "-DRUBY_VTE3_COMPILATION"
59
+ create_makefile(module_name)
60
+ pkg_config_dir = with_config("pkg-config-dir")
61
+ if pkg_config_dir.is_a?(String)
62
+ File.open("Makefile", "ab") do |makefile|
63
+ makefile.puts
64
+ makefile.puts("pkgconfigdir=#{pkg_config_dir}")
65
+ end
66
+ end
67
+
data/ext/vte3/rbvte.c ADDED
@@ -0,0 +1,47 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2006-2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbvte3private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE mVte
24
+
25
+ void Init_vte3(void);
26
+
27
+ void
28
+ Init_vte3(void)
29
+ {
30
+ VALUE RG_TARGET_NAMESPACE;
31
+
32
+ RG_TARGET_NAMESPACE = rb_define_module("Vte");
33
+
34
+ rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION",
35
+ rb_ary_new3(3,
36
+ INT2FIX(VTE_MAJOR_VERSION),
37
+ INT2FIX(VTE_MINOR_VERSION),
38
+ INT2FIX(VTE_MICRO_VERSION)));
39
+
40
+ G_DEF_CLASS(VTE_TYPE_TERMINAL_ANTI_ALIAS, "TerminalAntiAlias", RG_TARGET_NAMESPACE);
41
+
42
+ Init_vte_access(RG_TARGET_NAMESPACE);
43
+ Init_vte_reaper(RG_TARGET_NAMESPACE);
44
+ Init_vte_terminal(RG_TARGET_NAMESPACE);
45
+ Init_vte_charattributes(RG_TARGET_NAMESPACE);
46
+ Init_vte_pty(RG_TARGET_NAMESPACE);
47
+ }
@@ -0,0 +1,39 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef __RBVTE3CONVERSIONS_H__
22
+ #define __RBVTE3CONVERSIONS_H__
23
+
24
+ #define RVAL2VTEPTY(o) (VTE_PTY(RVAL2GOBJ(o)))
25
+ #define RVAL2VTETERMINAL(o) (VTE_TERMINAL(RVAL2GOBJ(o)))
26
+
27
+ #define RVAL2VTETERMINALCURSORBLINKMODE(o) (RVAL2GENUM(o, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE))
28
+ #define VTETERMINALCURSORBLINKMODE2RVAL(o) (GENUM2RVAL(o, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE))
29
+ #define RVAL2VTETERMINALCURSORSHAPE(o) (RVAL2GENUM(o, VTE_TYPE_TERMINAL_CURSOR_SHAPE))
30
+ #define VTETERMINALCURSORSHAPE2RVAL(o) (GENUM2RVAL(o, VTE_TYPE_TERMINAL_CURSOR_SHAPE))
31
+ #define RVAL2VTETERMINALERASEBINDING(o) (RVAL2GENUM(o, VTE_TYPE_TERMINAL_ERASE_BINDING))
32
+ #define VTETERMINALERASEBINDING2RVAL(o) (GENUM2RVAL(o, VTE_TYPE_TERMINAL_ERASE_BINDING))
33
+ #define RVAL2VTETERMINALWRITEFLAGS(o) (RVAL2GENUM(o, VTE_TYPE_TERMINAL_WRITE_FLAGS))
34
+ #define VTETERMINALWRITEFLAGS2RVAL(o) (GENUM2RVAL(o, VTE_TYPE_TERMINAL_WRITE_FLAGS))
35
+
36
+ #define RVAL2VTEPTYFLAGS(o) (RVAL2GFLAGS(o, VTE_TYPE_PTY_FLAGS))
37
+ #define VTEPTYFLAGS2RVAL(o) (GFLAGS2RVAL(o, VTE_TYPE_PTY_FLAGS))
38
+
39
+ #endif /* __RBVTE3CONVERSIONS_H__ */
@@ -0,0 +1,24 @@
1
+ #ifndef __RBVTE3PRIVATE_H__
2
+ #define __RBVTE3PRIVATE_H__
3
+
4
+ #include <vte/vte.h>
5
+ #include <vte/vteaccess.h>
6
+ #include <vte/reaper.h>
7
+
8
+ #include <ruby.h>
9
+ #include <rbgio2.h>
10
+ #include <rbpango.h>
11
+ #include <rbgdk3.h>
12
+ #include <rbgtk3.h>
13
+ #include "rbvte3conversions.h"
14
+ #ifndef VTE_CHECK_VERSION
15
+ # include "rbvteversion.h"
16
+ #endif
17
+
18
+ G_GNUC_INTERNAL void Init_vte_access(VALUE mVte);
19
+ G_GNUC_INTERNAL void Init_vte_reaper(VALUE mVte);
20
+ G_GNUC_INTERNAL void Init_vte_terminal(VALUE mVte);
21
+ G_GNUC_INTERNAL void Init_vte_charattributes(VALUE mVte);
22
+ G_GNUC_INTERNAL void Init_vte_pty(VALUE mVte);
23
+
24
+ #endif
@@ -0,0 +1,76 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2006-2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbvte3private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cCharAttributes
24
+
25
+ static ID id_row, id_column, id_fore, id_back, id_underline, id_strikethrough;
26
+
27
+ static VALUE
28
+ rg_initialize(VALUE self, VALUE row, VALUE column, VALUE fore, VALUE back,
29
+ VALUE underline, VALUE strikethrough)
30
+ {
31
+ rb_ivar_set(self, id_row, row);
32
+ rb_ivar_set(self, id_column, column);
33
+ rb_ivar_set(self, id_fore, fore);
34
+ rb_ivar_set(self, id_back, back);
35
+ rb_ivar_set(self, id_underline, underline);
36
+ rb_ivar_set(self, id_strikethrough, strikethrough);
37
+ return Qnil;
38
+ }
39
+
40
+ static VALUE
41
+ rg_underline_p(VALUE self)
42
+ {
43
+ return rb_ivar_get(self, id_underline);
44
+ }
45
+
46
+ static VALUE
47
+ rg_strikethrough_p(VALUE self)
48
+ {
49
+ return rb_ivar_get(self, id_strikethrough);
50
+ }
51
+
52
+ void
53
+ Init_vte_charattributes(VALUE mVte)
54
+ {
55
+ VALUE RG_TARGET_NAMESPACE;
56
+
57
+ id_row = rb_intern("@row");
58
+ id_column = rb_intern("@column");
59
+ id_fore = rb_intern("@fore");
60
+ id_back = rb_intern("@back");
61
+ id_underline = rb_intern("@underline");
62
+ id_strikethrough = rb_intern("@strikethrough");
63
+
64
+ RG_TARGET_NAMESPACE = rb_define_class_under(mVte, "CharAttributes", rb_cObject);
65
+
66
+ RG_DEF_METHOD(initialize, 6);
67
+ RG_DEF_ATTR("row", TRUE, FALSE, TRUE);
68
+ RG_DEF_ATTR("column", TRUE, FALSE, TRUE);
69
+ RG_DEF_ATTR("fore", TRUE, FALSE, TRUE);
70
+ RG_DEF_ATTR("back", TRUE, FALSE, TRUE);
71
+ RG_DEF_ALIAS("foreground", "fore");
72
+ RG_DEF_ALIAS("background", "back");
73
+ RG_DEF_METHOD_P(underline, 0);
74
+ RG_DEF_METHOD_P(strikethrough, 0);
75
+ }
76
+
@@ -0,0 +1,114 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbvte3private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cPty
24
+ #define _SELF(s) (RVAL2VTEPTY(s))
25
+
26
+ static VALUE
27
+ rg_initialize(VALUE self, VALUE flags_or_fd)
28
+ {
29
+ VtePty *pty = NULL;
30
+ GError *error = NULL;
31
+
32
+ if (TYPE(flags_or_fd) == T_FIXNUM) {
33
+ pty = vte_pty_new_foreign(NUM2INT(flags_or_fd), &error);
34
+ } else {
35
+ pty = vte_pty_new(RVAL2VTEPTYFLAGS(flags_or_fd), &error);
36
+ }
37
+ if (error)
38
+ RAISE_GERROR(error);
39
+
40
+ G_INITIALIZE(self, pty);
41
+
42
+ return Qnil;
43
+ }
44
+
45
+ static VALUE
46
+ rg_child_setup(VALUE self)
47
+ {
48
+ vte_pty_child_setup(_SELF(self));
49
+
50
+ return self;
51
+ }
52
+
53
+ static VALUE
54
+ rg_close(VALUE self)
55
+ {
56
+ vte_pty_close(_SELF(self));
57
+
58
+ return self;
59
+ }
60
+
61
+ static VALUE
62
+ rg_size(VALUE self)
63
+ {
64
+ int rows, columns;
65
+ gboolean result;
66
+ GError *error = NULL;
67
+
68
+ result = vte_pty_get_size(_SELF(self), &rows, &columns, &error);
69
+ if (error)
70
+ RAISE_GERROR(error);
71
+
72
+ return rb_ary_new3(2, INT2NUM(rows), INT2NUM(columns));
73
+ }
74
+
75
+ static VALUE
76
+ rg_set_size(VALUE self, VALUE rows, VALUE columns)
77
+ {
78
+ gboolean result;
79
+ GError *error = NULL;
80
+
81
+ result = vte_pty_set_size(_SELF(self), NUM2INT(rows), NUM2INT(columns), &error);
82
+ if (error)
83
+ RAISE_GERROR(error);
84
+
85
+ return self;
86
+ }
87
+
88
+ static VALUE
89
+ rg_set_utf8(VALUE self, VALUE utf8)
90
+ {
91
+ gboolean result;
92
+ GError *error = NULL;
93
+
94
+ result = vte_pty_set_utf8(_SELF(self), RVAL2CBOOL(utf8), &error);
95
+ if (error)
96
+ RAISE_GERROR(error);
97
+
98
+ return self;
99
+ }
100
+
101
+ void
102
+ Init_vte_pty(VALUE mVte)
103
+ {
104
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_PTY, "Pty", mVte);
105
+ G_DEF_CLASS(VTE_TYPE_PTY_ERROR, "Error", RG_TARGET_NAMESPACE);
106
+ G_DEF_CLASS(VTE_TYPE_PTY_FLAGS, "Flags", RG_TARGET_NAMESPACE);
107
+
108
+ RG_DEF_METHOD(initialize, 1);
109
+ RG_DEF_METHOD(child_setup, 0);
110
+ RG_DEF_METHOD(close, 0);
111
+ RG_DEF_METHOD(size, 0);
112
+ RG_DEF_METHOD(set_size, 2);
113
+ RG_DEF_METHOD(set_utf8, 1);
114
+ }
@@ -0,0 +1,39 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2006-2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbvte3private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cReaper
24
+
25
+ static VALUE
26
+ rg_s_get(G_GNUC_UNUSED VALUE self)
27
+ {
28
+ return GOBJ2RVAL(vte_reaper_get());
29
+ }
30
+
31
+ void
32
+ Init_vte_reaper(VALUE mVte)
33
+ {
34
+ VALUE RG_TARGET_NAMESPACE;
35
+
36
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_REAPER, "Reaper", mVte);
37
+
38
+ RG_DEF_SMETHOD(get, 0);
39
+ }