diff options
author | Martin Baulig <martin@home-of-linux.org> | 1999-11-28 16:20:16 +0000 |
---|---|---|
committer | Martin Baulig <martin@src.gnome.org> | 1999-11-28 16:20:16 +0000 |
commit | b60b7fd20199cf72ce23e638d50d9d6f90662023 (patch) | |
tree | bf4e999ae8de5c82d08d6a834dea207184da9644 | |
parent | f918792bb6852ed1263398dd1ec5fa64a79e9cdc (diff) | |
download | libgtop-b60b7fd20199cf72ce23e638d50d9d6f90662023.tar.gz |
New file. This is included in `$(top_srcdir)/lib/lib.pl'.
1999-11-28 Martin Baulig <martin@home-of-linux.org>
* c_types.pl: New file.
This is included in `$(top_srcdir)/lib/lib.pl'.
-rw-r--r-- | scripts/.cvsignore | 2 | ||||
-rw-r--r-- | scripts/ChangeLog | 5 | ||||
-rw-r--r-- | scripts/Makefile.am | 1 | ||||
-rw-r--r-- | scripts/c_types.pl | 49 |
4 files changed, 57 insertions, 0 deletions
diff --git a/scripts/.cvsignore b/scripts/.cvsignore new file mode 100644 index 00000000..3dda7298 --- /dev/null +++ b/scripts/.cvsignore @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff --git a/scripts/ChangeLog b/scripts/ChangeLog new file mode 100644 index 00000000..b3f9673d --- /dev/null +++ b/scripts/ChangeLog @@ -0,0 +1,5 @@ +1999-11-28 Martin Baulig <martin@home-of-linux.org> + + * c_types.pl: New file. + This is included in `$(top_srcdir)/lib/lib.pl'. + diff --git a/scripts/Makefile.am b/scripts/Makefile.am new file mode 100644 index 00000000..a991cb2b --- /dev/null +++ b/scripts/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = c_types.pl diff --git a/scripts/c_types.pl b/scripts/c_types.pl new file mode 100644 index 00000000..49a1923a --- /dev/null +++ b/scripts/c_types.pl @@ -0,0 +1,49 @@ +# Internal functions + +my $c_strlen_func = sub { + local ($_) = @_; + + return "strlen ($_) + sizeof (unsigned) + 1"; +}; + +my $c_marshal_func = sub { + my ($type, $param, $indent) = @_; + + my $code = ''; + $code .= sprintf ("%s_LIBGTOP_SEND_temp_len = strlen (%s)+1;\n", + $indent, $param); + $code .= sprintf ("%smemcpy (_LIBGTOP_SEND_ptr, %s, %s);\n", + $indent, "&_LIBGTOP_SEND_temp_len", "sizeof (unsigned)"); + $code .= sprintf ("%s_LIBGTOP_SEND_ptr += sizeof (unsigned);\n", $indent); + $code .= sprintf ("%smemcpy (_LIBGTOP_SEND_ptr, %s, %s);\n", + $indent, $param, "strlen ($param)+1"); + + $need_temp_len = 1; + + return $code; +}; + + +# Typeinfo array fields: +# --------------------- +# * C type name +# * Flag specifying whether we need to copy the parameter into temp storage +# + +$typeinfo = {'long' => ['int64_t', 0], + 'ulong' => ['u_int64_t', 0], + 'pid_t' => ['pid_t', 0], + 'int' => ['int', 0], + 'retval' => ['int', 0], + 'ushort' => ['unsigned short', 0], + 'unsigned' => ['unsigned', 0], + 'string' => ['const char *', 1], + }; + +$sizeof_funcs = {'string' => $c_strlen_func, + }; + +$marshal_funcs = {'string' => $c_marshal_func, + }; + +1; |