9 years agoUpdate main POD with TODOs
Ryan Jendoubi [Mon, 1 Oct 2012 10:46:05 +0000 (12:46 +0200)]
Update main POD with TODOs

9 years agoSome headway to testing float types in Simple.t
Ryan Jendoubi [Tue, 17 Jul 2012 20:07:55 +0000 (21:07 +0100)]
Some headway to testing float types in Simple.t

However, still a long way to go; don't want to get
bogged down in this aspect any longer.

modified:   Makefile.PL
modified:   t/Simple.t

9 years agoRemove is_integer/is_float confusion in Simple.t
Ryan Jendoubi [Tue, 10 Jul 2012 21:26:06 +0000 (22:26 +0100)]
Remove is_integer/is_float confusion in Simple.t

10 years agoFixed range warnings for floating point Simple types
Ryan Jendoubi [Tue, 3 Jul 2012 15:24:59 +0000 (16:24 +0100)]
Fixed range warnings for floating point Simple types

Used to get warnings like:

  c_double: numeric values must be
  2.2250738585072e-308 <= x <= 1.79769313486232e+308 (got 0)

Minima for floating point types were based on the standard C
constants FLT_MIN, DBL_MIN and LDBL_MIN.

While the _MAX counterparts of these constants actually DWIM,
the _MIN values are not the minimum possible magnitudes but
the smallest value capable of being represented being
distinguishable from 0 (why this differs from the _EPSILON
constants I don't know).

To get the actual minimum possible values (magnitudes) for
these types I adopted code from the Makefile.PL of C::Dynalib
which writes, compiles and runs a small C program, in this case
outputting the actual minima, which are then written into a new
.h file under the names CTYPES_FLT_MIN, CTYPES_DBL_MIN and
CTYPES_LDBL_MIN, which file is in turn made available by being
included in Ctypes.xs.

Calculating the minimum magnitudes:
I read somewhere that on any system with IEEE 754-1985
compliant floating point handling the minimum magnitude
will in fact be simply the negative of the maximum magnitude,
"since a sign bit stored separately (no two's complement)".

In order to cater for non-compliant architectures though,
we take a low value and subtract the relevant _EPSILON value
from it until the resultant value either doesn't change or
overflows. I took -FOO_MAX + 1 as a starting point. If
there's a more efficient way of doing this please let me

  * Haven't instituted tests for these types yet in Simple.t
  * CTYPES_LDBL_MIN (and indeed LDBL_MAX) exceeds the range
    of normal Perl scalars, the NV field of which are only
    doubles, not long doubles. This *will* lead to problems;
    not sure what to do about it yet.

modified:   Ctypes.xs
modified:   Makefile.PL
modified:   lib/Ctypes/Type/

10 years agoQuiet down make test output
Ryan Jendoubi [Fri, 22 Jun 2012 18:58:58 +0000 (19:58 +0100)]
Quiet down make test output

10 years agoFinished fixing Union.t (via _hook_store for numerics)
Ryan Jendoubi [Fri, 22 Jun 2012 14:36:20 +0000 (15:36 +0100)]
Finished fixing Union.t (via _hook_store for numerics)

modified:   lib/Ctypes/Type/

10 years agoFixed issues in Union.t
Ryan Jendoubi [Fri, 22 Jun 2012 14:09:34 +0000 (15:09 +0100)]
Fixed issues in Union.t

Still not passing due to more general problems with
non-integer numeric types. Comparisons (<, > etc) seem
to be a bit squiffy with very large numbers (needed
for validation). Research needed.

modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Union.t

10 years agoFinished Struct.t, Simple.t fixes + cleanup
Ryan Jendoubi [Fri, 22 Jun 2012 01:51:18 +0000 (02:51 +0100)]
Finished Struct.t, Simple.t fixes + cleanup

The use of the new Ctypes.xs functions _save and
_load_input_flags now seems fairly robust.

Next job is investigating test failures in Union.t.
Can't honestly remember if they ever passed.

modified:   Ctypes.xs
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Struct.t

10 years agoFixed Struct.t, broke Simple.t
Ryan Jendoubi [Fri, 22 Jun 2012 00:03:09 +0000 (01:03 +0100)]
Fixed Struct.t, broke Simple.t

10 years agoHalf-way to fixing problems in Struct.t
Ryan Jendoubi [Thu, 21 Jun 2012 15:40:27 +0000 (16:40 +0100)]
Half-way to fixing problems in Struct.t

Central problem revolves around flags on Perl scalars
retrieved from Ctypes.

For example, Scalar::Util's "looks_like_number" is inadequate
for dealing with situations where someone's stored the
/character string/ "9", and expects it out in the same form.

Also, where e.g. the value of a c_int has been set to '0' by
assigning Perl's "undef", unpacking that data results in a
scalar with an IV of 0, but no IOK flag set, so Perl sees it
as "undef".

Instead of merely saving the input argument in $obj->{_input},
which may easily have its SV flags changed, {_input} will be
a hash, storing both the input argument as soon as possible,
and a key indicating the scalar flag it came in with.

In _hook_out, this can either be restored or changed (e.g.
c_char's output should always be POK, c_int's IOK).

modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/types.t

10 years agoUtil: auto append newline if not present
Ryan Jendoubi [Thu, 21 Jun 2012 01:56:04 +0000 (02:56 +0100)]
Util: auto append newline if not present

modified:   lib/Ctypes/

10 years agoStruct::new: bless self before passing to Fields
Ryan Jendoubi [Thu, 21 Jun 2012 01:27:44 +0000 (02:27 +0100)]
Struct::new: bless self before passing to Fields

Also imported _debug() to Field, fixing infinite

modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/

10 years agoAdd commandline debug options
Ryan Jendoubi [Wed, 20 Jun 2012 00:34:45 +0000 (01:34 +0100)]
Add commandline debug options

A debug level can now be passed to Ctypes using "--debug <num>"
on the command line.

The _debug() routine, which replaces all instances of "print $foo
if $Debug", is in Ctypes::Util, which has consequently been split
out into its own .pm file. I think this might help some ugly
cyclical dependencies which were present (although some may

The first argument to _debug is a number, the debug level of the
message. Messages <= the debug level passed at the command line
are displayed; e.g. "--debug 3" would output all debug messages
numbered 1, 2 or 3.

Most messages have been preliminarily set to debug level 5.
Messages notifying sub entry or exit are at 4.

I envision some time in the future adding the option of
displaying only debug messages from certain packages. API
suggestions welcome.

modified:   MANIFEST
modified:   lib/
modified:   lib/Ctypes/
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
new file:   lib/Ctypes/
modified:   t/Simple.t
modified:   t/Struct.t

10 years agoCorrected manifest
Ryan Jendoubi [Sun, 17 Jun 2012 23:43:09 +0000 (00:43 +0100)]
Corrected manifest

10 years agoMerge branch 'master' of
Ryan Jendoubi [Wed, 13 Jun 2012 23:47:43 +0000 (00:47 +0100)]
Merge branch 'master' of

10 years agoFixed Array pod coverage, added size()
Ryan Jendoubi [Tue, 12 Jun 2012 22:27:15 +0000 (23:27 +0100)]
Fixed Array pod coverage, added size()

Also silence pack warnings in pack_overflow.t

modified:   lib/Ctypes/Type/
modified:   t/pack_overflow.t

10 years agoQuieten down limits_test.t with Test::Warn
Ryan Jendoubi [Tue, 12 Jun 2012 22:17:12 +0000 (23:17 +0100)]
Quieten down limits_test.t with Test::Warn

modified:   t/limits_test.t

10 years agoDrastically cut test noise
Ryan Jendoubi [Tue, 12 Jun 2012 22:05:53 +0000 (23:05 +0100)]
Drastically cut test noise

Introduced Test::Warn and used no warnings 'pack' for Simple's
STORE (there are plenty of other, more useful checks and warnings).

modified:   lib/Ctypes/Type/
modified:   t/Simple.t

10 years agoIntegrated old separate tests into Simple.t
Ryan Jendoubi [Tue, 12 Jun 2012 20:25:53 +0000 (21:25 +0100)]
Integrated old separate tests into Simple.t

modified:   lib/Ctypes/Type/
modified:   t/Simple.t
deleted:    t/Simple_byte.t
deleted:    t/Simple_char.t
deleted:    t/Simple_int.t
deleted:    t/Simple_long.t
deleted:    t/Simple_short.t
deleted:    t/Simple_ubyte.t
deleted:    t/Simple_uchar.t
deleted:    t/Simple_uint.t
deleted:    t/Simple_ulong.t
deleted:    t/Simple_ushort.t

10 years agoMake individual tests in Simple.t easier to run
Ryan Jendoubi [Tue, 12 Jun 2012 18:07:16 +0000 (19:07 +0100)]
Make individual tests in Simple.t easier to run

modified:   t/Simple.t

10 years agoSimilar fix for c_ubyte
Ryan Jendoubi [Tue, 12 Jun 2012 17:53:34 +0000 (18:53 +0100)]
Similar fix for c_ubyte

modified:   lib/Ctypes/Type/

10 years agoFixes for c_byte type and Simple.t
Ryan Jendoubi [Tue, 12 Jun 2012 14:49:23 +0000 (15:49 +0100)]
Fixes for c_byte type and Simple.t

modified:   lib/Ctypes/Type/
modified:   t/Simple.t

10 years agoFixed Simple_char.t
Ryan Jendoubi [Mon, 11 Jun 2012 20:06:27 +0000 (21:06 +0100)]
Fixed Simple_char.t

_minmax for this type was set to ( -127, 128 ). According to
CHAR_MIN, CHAR_MAX C constants,   should be ( -128, 127 ).

modified:   Makefile.PL
modified:   lib/Ctypes/Type/
modified:   t/Simple_char.t

10 years agoMerge branch 'master' of
Reini Urban [Tue, 10 Apr 2012 20:51:06 +0000 (15:51 -0500)]
Merge branch 'master' of

10 years agoinvalid not defined @array
Reini Urban [Tue, 10 Apr 2012 20:45:57 +0000 (15:45 -0500)]
invalid not defined @array

10 years agoFinished fixing C::T::Pointer test failures
Ryan Jendoubi [Mon, 2 Apr 2012 04:21:15 +0000 (05:21 +0100)]
Finished fixing C::T::Pointer test failures

modified:   lib/Ctypes/Type/
modified:   t/Pointer.t

10 years agoFix regression from commit 93e0c908
Ryan Jendoubi [Mon, 2 Apr 2012 03:38:33 +0000 (04:38 +0100)]
Fix regression from commit 93e0c908

Ctypes::call is not a drop-in replacement for Function::_call.

This should probably not be the case, but I plan to get the
important parts of the test suite (the bits testing complex
functionality which were fairly stable) passing again first
before undertaking any more root and branch restructuring.

modified:   lib/Ctypes/

10 years agoBetter error msg / obj name() for Pointer
Ryan Jendoubi [Sun, 1 Apr 2012 15:15:01 +0000 (16:15 +0100)]
Better error msg / obj name() for Pointer

Also fixed incorrect test in Pointer.t
(Specify Pointer type with Pointer( <typecode> <obj> ))

modified:   lib/Ctypes/Type/
modified:   t/Pointer.t

10 years agoMake sure T::Simple initialising args get STOREd
Ryan Jendoubi [Sun, 1 Apr 2012 15:11:21 +0000 (16:11 +0100)]
Make sure T::Simple initialising args get STOREd

10 years agoFixed Pointer regression from commit 3edca28e35d6a
Ryan Jendoubi [Sun, 1 Apr 2012 15:08:12 +0000 (16:08 +0100)]
Fixed Pointer regression from commit 3edca28e35d6a

See comment near change.

Note there is still a Heisenbug in later Pointer test on this
commit (test 23).

modified:   lib/Ctypes/Type/

10 years agoUpdating Pointer pod
Ryan Jendoubi [Sat, 31 Mar 2012 00:50:58 +0000 (01:50 +0100)]
Updating Pointer pod

10 years agoFixed 'blank warning' in Array.t
Ryan Jendoubi [Wed, 22 Feb 2012 17:45:40 +0000 (17:45 +0000)]
Fixed 'blank warning' in Array.t

Array types could not sizecode(), so were failing

Also added Array::packcode().

modified:   lib/Ctypes/Type/

10 years agoFixed C:T:Simple constructor arg coersion; Function.t passing
Ryan Jendoubi [Wed, 22 Feb 2012 14:53:23 +0000 (14:53 +0000)]
Fixed C:T:Simple constructor arg coersion; Function.t passing

modified:   lib/
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   t/002-Function.t

10 years agoCleaned up POD errors for pod.t
Ryan Jendoubi [Mon, 20 Feb 2012 20:18:24 +0000 (20:18 +0000)]
Cleaned up POD errors for pod.t

10 years agoSimple.t passing many more tests than before
Ryan Jendoubi [Mon, 20 Feb 2012 19:53:30 +0000 (19:53 +0000)]
Simple.t passing many more tests than before

Fixed bug introduced in chages to in commit 07bf5c708
(First version of class refactor). Misleading names for internally
used properties were probably responsible for the confusion.

Changes to _hook_fetch due to the fix have been documented in POD.

Key is in keeping the value as a property of $object->{_rawvalue}
and not in $object->{_value} directly. $object->{_value} can't be
trusted since $$x = <anything> will squash it in the course of
scalar overload. $object->{_rawvalue}->{VALUE} or ->[1]
is the only location which is checked on input and output.
In effect, $object->{_value} is just a placeholder which is
accessed to allow tie() to do its magic; it shouldn't be used

Of course, the way everything /should/ be done is to not
cache /anything/ Perl-side, and keep all values as native C
variables / data structures only. This would remove so much
messing about keeping track of values in multiple locations,
cascading changes around objects etc.

Python Ctypes keeps all values as native C. The only reason
I didn't do it that way to begin with is because I was less
comfortable in C and thought it would be too hard. In
retrospect, it would have saved a ton of work.

modified:   lib/Ctypes/Type/
modified:   t/Simple.t

10 years agoMaking's FETCH more robust
Ryan Jendoubi [Mon, 20 Feb 2012 17:43:05 +0000 (17:43 +0000)]
Making's FETCH more robust

10 years agoInconsequential changes in Simple.t
Ryan Jendoubi [Mon, 20 Feb 2012 16:56:32 +0000 (16:56 +0000)]
Inconsequential changes in Simple.t

10 years agoArray.t actually passing
Ryan Jendoubi [Mon, 20 Feb 2012 00:50:57 +0000 (00:50 +0000)]
Array.t actually passing

Dereferencing the FETCH'd value from C:T:Array's interal store.

modified:   lib/Ctypes/Type/

10 years ago.gitignore MYMETA.json
Ryan Jendoubi [Mon, 20 Feb 2012 00:47:02 +0000 (00:47 +0000)]
.gitignore MYMETA.json

10 years agoArray.t passing
Ryan Jendoubi [Mon, 20 Feb 2012 00:38:11 +0000 (00:38 +0000)]
Array.t passing

modified:   lib/Ctypes/Type/
modified:   t/Array.t

10 years agorevert chmod -x win32/libffi-5.dll
Reini Urban [Tue, 10 Jan 2012 01:58:24 +0000 (19:58 -0600)]
revert chmod -x win32/libffi-5.dll

10 years agoRemove executable bits. 1
Shlomi Fish [Mon, 7 Nov 2011 17:25:32 +0000 (19:25 +0200)]
Remove executable bits.

Made some files that should not be executable not executable.

10 years agofix pod. add gcov make target
Reini Urban [Wed, 10 Aug 2011 15:02:36 +0000 (17:02 +0200)]
fix pod. add gcov make target

10 years agofix pod coverage. fix byte max limit from 256 to 255
Reini Urban [Mon, 8 Aug 2011 18:22:05 +0000 (20:22 +0200)]
fix pod coverage. fix byte max limit from 256 to 255

10 years agorefactor Function + Pointer: size method. sizecode = packcode (libffi interface)
Reini Urban [Mon, 8 Aug 2011 15:00:42 +0000 (17:00 +0200)]
refactor Function + Pointer: size method. sizecode = packcode (libffi interface)

10 years agouse Ctypes::USE_PERLTYPES, use sizecode for ffi sizes
Reini Urban [Mon, 8 Aug 2011 14:58:25 +0000 (16:58 +0200)]
use Ctypes::USE_PERLTYPES, use sizecode for ffi sizes

10 years agoadd LONGLONG, indent #ifdef
Reini Urban [Mon, 8 Aug 2011 14:56:38 +0000 (16:56 +0200)]
add LONGLONG, indent #ifdef

10 years agoadd simple TODO per Audreys req
Reini Urban [Mon, 8 Aug 2011 14:49:39 +0000 (16:49 +0200)]
add simple TODO per Audreys req

11 years agodisallow STDCALL on non-windows systems classify
Reini Urban [Mon, 25 Apr 2011 13:43:23 +0000 (15:43 +0200)]
disallow STDCALL on non-windows systems

11 years added c_int alias classes
Reini Urban [Sat, 12 Mar 2011 00:02:23 +0000 (01:02 +0100)] added c_int alias classes
types.t: TODO strict_input tests, all others pass

11 years agoimprove cygwin libffi build and accept spaces in cwd
Reini Urban [Fri, 11 Mar 2011 23:17:37 +0000 (00:17 +0100)]
improve cygwin libffi build and accept spaces in cwd

11 years agofix _hook_fetch for chars
Reini Urban [Fri, 11 Mar 2011 23:16:46 +0000 (00:16 +0100)]
fix _hook_fetch for chars

11 years agofixed _minmax and two types checks
Reini Urban [Fri, 11 Mar 2011 18:38:41 +0000 (19:38 +0100)]
fixed _minmax and two types checks

11 years agoindent comments
Reini Urban [Fri, 11 Mar 2011 17:50:14 +0000 (18:50 +0100)]
indent comments

11 years agoMerge branch 'classify' of into classify
Reini Urban [Fri, 11 Mar 2011 17:48:29 +0000 (18:48 +0100)]
Merge branch 'classify' of into classify

11 years agoMakefile.PL: fix LIBDIR INCDIR args
Reini Urban [Fri, 11 Mar 2011 15:53:49 +0000 (16:53 +0100)]
Makefile.PL: fix LIBDIR INCDIR args
  fix libffi building

11 years agoType/ rename _hook_in to _hook_store, _hook_out to _hook_fetch
Reini Urban [Fri, 11 Mar 2011 08:54:26 +0000 (09:54 +0100)]
Type/ rename _hook_in to _hook_store, _hook_out to _hook_fetch
.gitignore: add .provedb

11 years agoclassify part 2: fixed _minmax with constant, char hook_out int2chr wrong
Reini Urban [Thu, 10 Mar 2011 14:52:20 +0000 (15:52 +0100)]
classify part 2: fixed _minmax with constant, char hook_out int2chr wrong

11 years agoFinish writing down the Simple numeric classes with accessors and both hooks
Reini Urban [Sat, 26 Feb 2011 10:59:42 +0000 (11:59 +0100)]
Finish writing down the Simple numeric classes with accessors and both hooks
_hook_in valid => invalid
use new hook methods in Simple

11 years agoignore test results, .test-* files
Reini Urban [Thu, 24 Feb 2011 20:48:39 +0000 (21:48 +0100)]
ignore test results, .test-* files

11 years agoFirst version of class refactor, 20% finished, but most tests pass as before.
Reini Urban [Thu, 24 Feb 2011 20:38:55 +0000 (21:38 +0100)]
First version of class refactor, 20% finished, but most tests pass as before.
No need for the global _pytypes hash, with its unmanageble and duplicate subs,
  use classes instead.
Create global c_int,... packages to be able to say
  use Ctypes; my c_int $i = 1;
Remove duplicate value slots, the RAWVALUE tie reads/writes to the one
  and only _value slot
Do not store the Simple ref $object as hash, use a faster and
  shorter arrayref instead $self->[0]
Add more private stuff to .gitignore ( I use now )

11 years agolibffi 3.0.10rc3
Reini Urban [Tue, 15 Feb 2011 23:28:33 +0000 (00:28 +0100)]
libffi 3.0.10rc3
msys fixes
pod formatting
fix Type init
  force _update_ and validate data
  set VALUE slot
  call hook_in

11 years agoomit more default sizecodes
Reini Urban [Mon, 17 Jan 2011 18:51:24 +0000 (19:51 +0100)]
omit more default sizecodes

11 years agoCtypes::Type::_new simplification: allow init hashref for default values
Reini Urban [Mon, 17 Jan 2011 18:46:23 +0000 (19:46 +0100)]
Ctypes::Type::_new simplification: allow init hashref for default values
derived types: use it
Simple: use sizecode, packcode and validate defaults (sparse $_types)

11 years agoCtypes.xs simplification: sizeof already gets the perl-style sizecode type
Reini Urban [Mon, 17 Jan 2011 18:45:53 +0000 (19:45 +0100)]
Ctypes.xs simplification: sizeof already gets the perl-style sizecode type

11 years agobetter util.c error messages: cry less and more context
Reini Urban [Mon, 17 Jan 2011 17:30:38 +0000 (18:30 +0100)]
better util.c error messages: cry less and more context

11 years agoadd helper .c files to xs deps
Reini Urban [Mon, 17 Jan 2011 17:28:49 +0000 (18:28 +0100)]
add helper .c files to xs deps

11 years agoMore docs
Reini Urban [Thu, 13 Jan 2011 17:38:15 +0000 (18:38 +0100)]
More docs
more $Debug style fixes

11 years agofixed Struct.t accessor
Reini Urban [Thu, 13 Jan 2011 11:38:46 +0000 (12:38 +0100)]
fixed Struct.t accessor

11 years agorurban libffi and Debug cleanup:
Reini Urban [Thu, 13 Jan 2011 08:57:32 +0000 (09:57 +0100)]
rurban libffi and Debug cleanup:
- layout changes: *.c, *.h to root
- check Debug print in Type modules
- if no libffi lib exists, unpack our prepackaged and install it locally
- rm conflicting ffi headers. use either installed or new.
- add libffi.tar.gz, version 3.0.10rc0 from git
- add precompiled win32 libffi (mingw32 gcc-4.5), no win64 yet

lots of multi-char warnings in the Type tests
Files=28, Tests=356, 47 wallclock secs ( 0.19 usr  0.17 sys + 38.24 cusr  4.19 csys = 42.78 CPU)
Result: FAIL
Failed 19/28 test programs. 29/356 subtests failed.

11 years agoMerge branch 'master' of v0.002
Reini Urban [Tue, 11 Jan 2011 17:39:43 +0000 (18:39 +0100)]
Merge branch 'master' of

11 years agoConsolidating Simple type tests into t/Simple.t
Ryan Jendoubi [Wed, 29 Dec 2010 05:41:54 +0000 (05:41 +0000)]
Consolidating Simple type tests into t/Simple.t

Will have cmd line options: --all, --c_short, --c_int etc.
rurban tells me pack() is knowingly deviates from C overflow
behaviour. One less thing to worry about getting 100% right now.

modified:   lib/Ctypes/
new file:   t/Simple.t
deleted:    t/limits_test.t
deleted:    t/pack_overflow.t

11 years agoPlodding on with tests
Ryan Jendoubi [Tue, 28 Dec 2010 02:25:50 +0000 (02:25 +0000)]
Plodding on with tests

Unsigned integer wrap-around by pack() appears irregular. Looking
into it.

Also, since hook_out performs chr() on a c_char's value, ++ might
need overloaded... but I'm not sure how to make it a special
overload just for that type.

modified:   Makefile.PL
modified:   lib/
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   t/Simple_int.t
new file:   t/Simple_long.t
modified:   t/Simple_short.t
new file:   t/Simple_uint.t
new file:   t/Simple_ulong.t
modified:   t/Simple_ushort.t
new file:   t/limits_test.t
new file:   t/pack_overflow.t

11 years agoNew tests, new testing function perl_data_validation
Ryan Jendoubi [Mon, 15 Nov 2010 13:17:43 +0000 (13:17 +0000)]
New tests, new testing function

Complete tests for [u]byte, [u]char, [u]short.

Large range of [u]int required writing Ctypes::Util::create_range
to easily make ranges of testing values.

Will also require CTYPES_TEST_FULL env arg for tests to really
test full value range of variables, or whatever standard release
testing flag is.

11 years agoTests for c_uchar
Ryan Jendoubi [Sun, 31 Oct 2010 02:39:19 +0000 (02:39 +0000)]
Tests for c_uchar

modified:   lib/Ctypes/
modified:   t/Simple_char.t
new file:   t/Simple_uchar.t

11 years agoMore new tests (c_byte, c_ubyte)
Ryan Jendoubi [Sun, 17 Oct 2010 08:51:32 +0000 (09:51 +0100)]
More new tests (c_byte, c_ubyte)

New XS function (Ctypes::Test::is_a_number) which simply checks
the SvIOK($arg) || SvNOK($arg). Will probably encounter the
same problem later about the values returned by Ctypes objects
not having the public flags set, but that's a problem with the
output so should be fixed at that point.

modified:   Ctypes.xs
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   t/Simple_byte.t
new file:   t/Simple_char.t
new file:   t/Simple_ubyte.t

11 years agohook_* proof-of-concept working for type c_byte
Ryan Jendoubi [Tue, 12 Oct 2010 23:21:27 +0000 (00:21 +0100)]
hook_* proof-of-concept working for type c_byte

. All $_types now have sizecodes and packcodes, since these can
  be different from their typecodes. Since our range of Types
  don't reflect only those in C or Python's Ctypes, typecodes
  are really only for use within Ctypes identify them.

. All $_types need an anonymous sub under the hash key 'hook_in'.
  This takes one argument, the value passed to be STOREd, and
  performs whatever validations necessary. It returns a list of
  two scalars: an indicator of invalidity (must be undef if arg
  was valid) and a 'sanitized' form of the arg - basically, do
  whatever can be done to make the input valid for the type.
  This will be STOREd instead of the original input. The original
  input is stored in $object->{_input} though, for use later by
  hook_out if needs be.

. $_types /can/ have a hook_out, but it's not compulsory. This
  can take two arguments: the STOREd $val, and the $object itself.
  The latter can be used to ascertain information which might
  affect whether anything special needs to be done to the value
  before output (e.g., whether the {_input} was numeric or string).

. Type::Simple objects now have size(), sizecode(), packcode() and
  validate() methods (can you believe they didn't implement size()
  before?? @_@). The validate() is the same as used by STORE. It
  can be used if you happen to need to know if certain input is
  invalid for a given type without squashing its current contents.

Now all the rest of the types need their hooks and test written.

modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   t/Simple_byte.t

11 years agoMoving development to new branch
Ryan Jendoubi [Mon, 11 Oct 2010 15:24:23 +0000 (16:24 +0100)]
Moving development to new branch

11 years agoUse of qw(...) as parentheses is deprecated at inc/Devel/ line 164
Reini Urban [Fri, 8 Oct 2010 07:50:56 +0000 (09:50 +0200)]
Use of qw(...) as parentheses is deprecated at inc/Devel/ line 164

11 years agoMerge branch 'master' of
Reini Urban [Fri, 8 Oct 2010 06:55:40 +0000 (08:55 +0200)]
Merge branch 'master' of

11 years agoFinish Unions
Ryan Jendoubi [Thu, 16 Sep 2010 09:54:56 +0000 (10:54 +0100)]
Finish Unions

Also changed Union.t & Struct.t to show real number of tests (not
mostly in subtests anymore).

modified:   lib/Ctypes/Type/
modified:   t/Struct.t
modified:   t/Union.t

11 years agoMerge branch 'unions'
Ryan Jendoubi [Mon, 6 Sep 2010 20:11:10 +0000 (21:11 +0100)]
Merge branch 'unions'

11 years agoUnions work, improvements in Simple, Struct, Field
Ryan Jendoubi [Mon, 6 Sep 2010 20:09:46 +0000 (21:09 +0100)]
Unions work, improvements in Simple, Struct, Field

modified:   Ctypes.xs
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Struct.t
modified:   t/Union.t
modified:   t/types.t
modified:   t/win-proto.t

11 years agoMerge changes to Array, Pointer from branch unions
Ryan Jendoubi [Sun, 5 Sep 2010 16:57:08 +0000 (17:57 +0100)]
Merge changes to Array, Pointer from branch unions

modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/

11 years agoFix ->copy method for Arrays, Pointers need tests
Ryan Jendoubi [Sun, 5 Sep 2010 16:50:49 +0000 (17:50 +0100)]
Fix ->copy method for Arrays, Pointers need tests

modified:   lib/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Array.t
modified:   t/Union.t

11 years agoRe-add t/Union.t
Ryan Jendoubi [Sun, 5 Sep 2010 14:28:10 +0000 (15:28 +0100)]
Re-add t/Union.t

new file:   t/Union.t

11 years agoMerge branch 'master' into unions
Ryan Jendoubi [Sun, 5 Sep 2010 14:19:23 +0000 (15:19 +0100)]
Merge branch 'master' into unions


modified:   Ctypes.xs
modified:   lib/
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Array.t
modified:   t/Pointer.t
modified:   t/Struct.t
deleted:    t/Struct.t_pyguides
deleted:    t/Union.t
modified:   t/pod-coverage.t
modified:   t/
modified:   t/types.t

11 years agoFinished basic Struct implementation, tests, docs
Ryan Jendoubi [Sun, 5 Sep 2010 12:41:49 +0000 (13:41 +0100)]
Finished basic Struct implementation, tests, docs

  add/remove/splice fields methods
  alignment of parts of structs

11 years agoLots more work on structs, think it's good now struct_api_change
Ryan Jendoubi [Wed, 1 Sep 2010 12:49:13 +0000 (13:49 +0100)]
Lots more work on structs, think it's good now

General setup now allows assignment and returning of values as
well as returning information about fields.

Next issue is error in alignment I think.

11 years agoWork on Structs
Ryan Jendoubi [Tue, 31 Aug 2010 10:18:59 +0000 (11:18 +0100)]
Work on Structs

Implemented copy() method for all Types (as Structs need their
own copy() of the contents of subclasses' $_fields_).

No good way of using method-style access for Struct members (always
some Perl method names which could hypothetically limit field names
so must use hash-style access ($$struct->{field}).

Now looking at how to return info about fields, so that fields
can know their own name within the struct. Removed tied Field
objects, may reintroduce them in a different way.

11 years agoTests for new Struct API
Ryan Jendoubi [Mon, 23 Aug 2010 23:28:44 +0000 (00:28 +0100)]
Tests for new Struct API

modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   t/Struct.t
new file:   t/Struct.t_old
modified:   t/

11 years agoMore pod for
Ryan Jendoubi [Sat, 21 Aug 2010 10:58:30 +0000 (11:58 +0100)]
More pod for

modified:   lib/Ctypes/Type/
modified:   t/Pointer.t
modified:   t/pod-coverage.t
modified:   t/types.t

11 years agoMore docs, plus fixed rounding error for integers
Ryan Jendoubi [Mon, 16 Aug 2010 18:39:08 +0000 (19:39 +0100)]
More docs, plus fixed rounding error for integers

modified:   Ctypes.xs
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Array.t
modified:   t/Pointer.t
modified:   t/Struct.t
modified:   t/pod-coverage.t
modified:   t/types.t

11 years agoRemoved unfinished unions from master
Ryan Jendoubi [Mon, 16 Aug 2010 16:44:07 +0000 (17:44 +0100)]
Removed unfinished unions from master

modified:   lib/
modified:   lib/Ctypes/
deleted:    lib/Ctypes/Type/
deleted:    t/Union.t

11 years agoInitial commit for branch unions unions
Ryan Jendoubi [Mon, 16 Aug 2010 16:40:59 +0000 (17:40 +0100)]
Initial commit for branch unions

modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/

11 years agoMany changes
Ryan Jendoubi [Mon, 16 Aug 2010 16:32:30 +0000 (17:32 +0100)]
Many changes

Moved Type::Simple to new file, work on Unions (unfinished)

modified:   Ctypes.xs
modified:   lib/
modified:   lib/Ctypes/
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
new file:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
new file:   lib/Ctypes/Type/
modified:   t/Array.t
modified:   t/Pointer.t
modified:   t/Struct.t
new file:   t/Union.t
modified:   t/pod-coverage.t
modified:   t/types.t

11 years agoMerge
Reini Urban [Mon, 16 Aug 2010 10:16:33 +0000 (12:16 +0200)]

11 years agoStruct indirection working
Ryan Jendoubi [Sun, 15 Aug 2010 11:50:57 +0000 (12:50 +0100)]
Struct indirection working

modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Struct.t

11 years agoMore tightening and tests for Structs
Ryan Jendoubi [Sun, 15 Aug 2010 05:58:16 +0000 (06:58 +0100)]
More tightening and tests for Structs

modified:   lib/
modified:   lib/Ctypes/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Struct.t

11 years agoMore interface trials
Ryan Jendoubi [Sat, 14 Aug 2010 23:17:22 +0000 (00:17 +0100)]
More interface trials

modified:   lib/Ctypes/Type/
modified:   lib/Ctypes/Type/
modified:   t/Struct.t