• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bin/H23-Nov-2020-4,1293,122

cbc/H23-Nov-2020-12,3466,754

ctlib/H23-Nov-2020-18,93712,241

examples/H23-Nov-2020-75

lib/Convert/Binary/H23-Nov-2020-5,907307

support/H23-Nov-2020-7,2242,822

tests/H23-Nov-2020-264,626182,497

token/H23-Nov-2020-3,9693,191

ucpp/H23-Nov-2020-14,09610,157

util/H23-Nov-2020-5,2302,908

xsubs/H23-Nov-2020-2,0411,567

C.xsH A D19-Nov-202012.5 KiB487315

ChangesH A D23-Nov-202025.1 KiB1,002644

MANIFESTH A D23-Nov-202020.7 KiB596595

META.jsonH A D23-Nov-20201.3 KiB5453

META.ymlH A D23-Nov-2020778 2928

Makefile.PLH A D19-Nov-202018.5 KiB764630

README.mdH A D19-Nov-20205.5 KiB184121

TODOH A D22-Jul-201510.8 KiB389253

ppport.hH A D22-Jul-2015168.8 KiB6,9853,032

test.plH A D19-Nov-20201.5 KiB6140

typemapH A D19-May-2020993 3228

README.md

1# Convert-Binary-C
2
3Binary Data Conversion using C Types
4
5
6## Description
7
8Convert::Binary::C is a preprocessor and parser for C type definitions.
9It is highly configurable and should support arbitrarily complex data
10structures. Its object-oriented interface has pack and unpack methods
11that act as replacements for Perl's pack and unpack and allow to use the
12C types instead of a string representation of the data structure for
13conversion of binary data from and to Perl's complex data structures.
14
15Actually, what Convert::Binary::C does is not very different from what
16a C compiler does, just that it doesn't compile the source code into
17an object file or executable, but only parses the code and allows Perl
18to use the enumerations, structs, unions and typedefs that have been
19defined within your C source for binary data conversion, similar to
20Perl's pack and unpack.
21
22Beyond that, the module offers a lot of convenience methods to retrieve
23information about the C types that have been parsed.
24
25
26## Installation
27
28Installation of the Convert::Binary::C module follows the standard
29Perl Way and should not be harder than:
30
31    perl Makefile.PL
32    make
33    make test
34    make install
35
36Note that you may need to become superuser to `make install`.
37
38If you're building the module under Windows, you may need to use a
39different make program, such as `nmake`, instead of `make`.
40
41When running 'make test' on on slower systems please be patient,
42since some of the tests are quite time consuming. The time required
43for running the whole test suite depends on your Perl version, the
44features you're building the module with, and of course your machine.
45
46
47## Upgrading
48
49If you are upgrading from a previous release of Convert::Binary::C,
50please check the Changes file. In its current state, the module is
51still subject to changes that may affect compatibility with older
52releases.
53
54
55## Documentation
56
57To see the documentation, use the perldoc command:
58
59    perldoc Convert::Binary::C
60    perldoc Convert::Binary::C::Cached
61
62You can also visit CPAN Search and see the documentation online as
63pretty nice HTML. This is also where you will find the most recent
64version of this module:
65
66    https://metacpan.org/release/Convert-Binary-C
67
68Even though the documentation contains a large amount of tested
69example code, you might want some working example scripts. You can
70find them in the
71
72    examples
73
74subdirectory after you've built the module. These scripts normally
75require Convert::Binary::C to be installed on your system. If you
76want to test the examples prior to installing Convert::Binary::C,
77you can start the examples like this after building the module:
78
79    perl -Mblib examples/script.pl
80
81Otherwise just run the example scripts like any other Perl script.
82
83
84## Configuration
85
86Configuring a Convert::Binary::C object correctly can be quite
87painful if you don't know every little detail about your compiler.
88
89However, if you're lucky, you can use the 'ccconfig' tool that
90comes with this package. It was written to automatically retrieve
91the complete compiler configuration. This may not work always,
92or retrieve the complete configuration, but it should at least
93give you some point to start from.
94
95Just run
96
97    ccconfig -c compiler
98
99with `compiler` being the name of your compiler executable.
100
101You can see the documentation for 'ccconfig' using the perldoc
102command:
103
104    perldoc ccconfig
105
106As the tool is very experimental, any feedback on 'ccconfig'
107is really appreciated!
108
109
110## Compatibility
111
112The module should build on most of the platforms that Perl runs on.
113I have tested it on:
114
115* Various Linux systems
116* Various BSD systems
117* HP-UX
118* Compaq/HP Tru64 Unix
119* Mac-OS X
120* Cygwin
121* Windows 98/NT/2000/XP
122
123Also, most architectures should be supported. Tests were done on:
124
125* Various Intel Pentium and Itanium systems
126* Various Alpha systems
127* HP PA-RISC
128* Power-PC
129* StrongARM (the module worked fine on an IPAQ system)
130
131The module should build with any perl from 5.005 up to the latest
132development version. It will also build with perl 5.004, but then
133the test suite cannot be run completely.
134
135Multithreaded perl binaries are explicitly supported, as the module
136is intended to be thread-safe.
137
138
139## Features
140
141You can enable or disable certain features at compile time by adding
142options to the `Makefile.PL` call. However, you can safely leave them
143at their default.
144
145Available features are `debug` to build the module with debugging
146support and `ieeefp` to explicitly enable or disable IEEE floating
147point support.
148
149The `debug` feature depend on how your perl binary was built. If it
150was built with the `DEBUGGING` flag, the `debug` feature is enabled,
151otherwise it is disabled by default.
152
153The `ieeefp` feature depends on how your machine stores floating point
154values. If they are stored in IEEE format, this feature will be enabled
155automatically. You should really only change the default if you know
156what you're doing.
157
158You can enable or disable features explicitly by adding the arguments
159
160    enable-feature
161    disable-feature
162
163to the Makefile.PL call. To explicitly build the module with debugging
164enabled, you would say:
165
166    perl Makefile.PL enable-debug
167
168This will still allow you to pass other standard arguments to
169`Makefile.PL`, like
170
171    perl Makefile.PL enable-debug OPTIMIZE=-O3
172
173
174## Copyright
175
176Copyright (c) Marcus Holland-Moritz. All rights reserved.
177This program is free software; you can redistribute it and/or modify
178it under the same terms as Perl itself.
179
180The ucpp library is (c) 1998-2002 Thomas Pornin. For license
181and redistribution details refer to 'ctlib/ucpp/README'.
182
183Portions copyright (c) 1989, 1990 James A. Roskind.
184