CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Tue, 02 Sep 2025 00:09:47 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20180611004412
location: https://web.archive.org/web/20180611004412/https://github.com/gitpan/xsubpp
server-timing: captures_list;dur=0.731111, exclusion.robots;dur=0.033576, exclusion.robots.policy;dur=0.013739, esindex;dur=0.017196, cdx.remote;dur=29.320654, LoadShardBlock;dur=3187.167399, PetaboxLoader3.datanode;dur=128.069580, PetaboxLoader3.resolve;dur=140.327659
x-app-server: wwwb-app220
x-ts: 302
x-tr: 3244
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app220; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Tue, 02 Sep 2025 00:09:48 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: GitHub.com
x-archive-orig-date: Mon, 11 Jun 2018 00:44:13 GMT
x-archive-orig-transfer-encoding: chunked
x-archive-orig-status: 200 OK
x-archive-orig-cache-control: no-cache
x-archive-orig-vary: X-PJAX
x-archive-orig-set-cookie: logged_in=no; domain=.github.com; path=/; expires=Fri, 11 Jun 2038 00:44:12 -0000; secure; HttpOnly
x-archive-orig-set-cookie: _gh_sess=M01YeXN1SHhpeU1FUkZuNU1FcndEYmVHY0Z6K3lKS3h1ZUdHV0E5Q2hvSHVwcURaMllxcVhlbGE2MUZzU094NUpTM2FVaGdoTjhya2MxT2NWM1BvMzExbVhyMnRPQkF2Nmw4Y0F5ZjEwbEdaaTcxaGxMTzFIQzduanloOE51MWNnZUs2S1M5YzJNQ1doMHJSKy9ZRFZIcnBmUFdyaXc1VWlaQzI5UXZJNWc1WUNQTnhYemlXa1c3QkFxOVp6bGFoeUZXUFpLSUo3VnhCT0hmTjI4ejBHVHRXWm43eGNLcXJRalJTd1cwcjlGN054MUN1MHBNTFNHVmg2TEllNFMreDN3MlRMTWlsTnU1Y24vMGxvVUIxanhXVUU0Q1FBT3BhcEx0bWJ5RmhNSi8wV29tRGhNdHNQandGTlQ0Z0Qyc05PcnRpL3hrdEZzQktzckFXM09GVURweTMzRHlOVUY4RWdBbjludHFnMzNKV0RETUEvakNNZHhqTkVVNDJGWlVCZEZrQ2xQZloxK2prT0IrVGQxQlR3YnovSUJibjJjb0x1MVlUWDc5OEcxVT0tLVhmZjJML05vNEZNR3FlSHBEd2ltR3c9PQ%3D%3D--2a4c8d7dedea1ce9cdc9a5dad6651722c336eaa1; path=/; secure; HttpOnly
x-archive-orig-x-request-id: 300f9365-e36f-44db-a422-94638bd1baca
x-archive-orig-x-runtime: 0.259402
x-archive-orig-strict-transport-security: max-age=31536000; includeSubdomains; preload
x-archive-orig-x-frame-options: deny
x-archive-orig-x-content-type-options: nosniff
x-archive-orig-x-xss-protection: 1; mode=block
x-archive-orig-expect-ct: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
x-archive-orig-content-security-policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com status.github.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com wss://live.github.com; font-src assets-cdn.github.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src assets-cdn.github.com; style-src 'unsafe-inline' assets-cdn.github.com
x-archive-orig-x-runtime-rack: 0.266660
x-archive-orig-x-github-request-id: 956A:1024:61E421F:B0E4EF8:5B1DC5DC
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Mon, 11 Jun 2018 00:44:12 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Mon, 11 Jun 2018 00:44:12 GMT", ; rel="memento"; datetime="Mon, 11 Jun 2018 00:44:12 GMT", ; rel="next memento"; datetime="Tue, 10 Nov 2020 08:16:33 GMT", ; rel="last memento"; datetime="Tue, 10 Nov 2020 08:16:33 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: archiveteam_github_20180703020419/archiveteam_github_20180703020419.megawarc.warc.gz
server-timing: captures_list;dur=0.657052, exclusion.robots;dur=0.026319, exclusion.robots.policy;dur=0.011891, esindex;dur=0.016101, cdx.remote;dur=22.466384, LoadShardBlock;dur=98.389506, PetaboxLoader3.datanode;dur=100.668710, PetaboxLoader3.resolve;dur=137.268446, load_resource;dur=184.748556
x-app-server: wwwb-app220
x-ts: 200
x-tr: 411
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
GitHub - gitpan/xsubpp: Read-only release history for xsubpp
Fetching latest commit…
Permalink
Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Read-only release history for xsubpp
https://metacpan.org/release/xsubpp
Perl
Switch branches/tags
Nothing to show
Clone or download
Launching GitHub Desktop...
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop...
If nothing happens, download GitHub Desktop and try again.
Launching Xcode...
If nothing happens, download Xcode and try again.
Launching Visual Studio...
If nothing happens, download the GitHub extension for Visual Studio and try again.

Cannot retrieve the latest commit at this time.
Failed to load latest commit information. | |||
![]() |
Alias | ||
![]() |
Harness | ||
![]() |
Proto | ||
![]() |
t | ||
![]() |
MANIFEST | ||
![]() |
Makefile.PL | ||
![]() |
README | ||
![]() |
typemap | ||
![]() |
xsubpp |
README
xsubpp 2.000 alpha 1 ==================== WARNING: This documentation is *very* incomplete. Objective. ========== My goal was to allow easy access to real C data structures for Perl External extensions. This included both the ability to access global variables exported by C libraries and the ability to to make use of more complex C data types in xsub parameters and as variables. All of these goals have been achieved (partially at least). As someone recently said on this list (Tim, I think), make it easy to do the simple things, and make it possible to do the complex things. I'll let you be the judge of that. With that in mind I have attempted to make the default interface to this new stuff look as much like the original C as possible. Interfacing to simple data types ================================ Firstly there are the cases where you just want to interface to a simple (int, char*, ...) global variable in some external C library, an integer version number say. The typemap file already contains all the information necessary to read and write most non-complex data structures. So for this type of interface I wanted to be able to write something like int Year in the .xs file and let xsubpp create a read/write interface to the C variable which can be accessed from Perl like this $Year = 1995 ; ... if ($Year > 2000) ... This has been achieved using the suggestion made by Larry (last year I think) of associating an index with each C variable and tie'ing the Perl scalar to a package which can work out the correspondence between the index and the real C variable. Interface to Complex Data structures ==================================== The second case (and my main reason for extending xsubpp) is interfacing to complex C data structures (i.e. structures, unions, arrays). As there is no real support for these in xsubpp it was necessary to design some. As with the simple data types I wanted to keep the default definition of the data structures simple and as close to C as possible. .xs interface ============= An XS file is currently split into a number of sections. Everything up to the first MODULE line is written the the C file verbatim. Thereafter the file contains a sequence of MODULE sections, each of which contain a number of XSUB definitions. In order to keep with the spirit of this structure and remain backward compatible with existing code I have defined a number of new sub-sections for the MODULE section. The list below shows the new sub-sections. XSUB TYPE HASH TYPE ARRAY TYPE SCALAR VAR If no sub-section is specified XSUB will be assumed. This will allow existing .xs files to be parsed with the new xsubpp. XSUB ----- Used to define xsubs. No change from the original xsubpp. TYPE HASH --------- Creates a type definition for a C structure/union. The struct/union definition is 'similar' to the equivalent C definition. Consider the example below. MODULE = Data PACKAGE = Data TYPE HASH struct fred int alpha short beta The first line of the data type definition *must* correspond to the C definition for the data type. So in this case struct fred is the C data type we are creating an interface to. To make it a bit easier to use existing C structure definitions xsubpp will remove any trailing semicolons, and also get rid of any '{' or '}' it finds. So struct fred can be written like this: struct fred { int alpha ; short beta ; } ; As with XSUB's it is possible to tailor the default behavior of the interface. TYPE HASH struct fred int alpha short beta FETCH: alpha ... code STORE: beta ... code ACCESS: ro alpha ACCESS: wo alpha NOTE: The structure/union must be defined *completely* before any of the tailoring code is introduced. So FETCH: allows you to modify the default read interface for an individual element of the structure/union. STORE: does the same for the write interface. ACCESS: allows you to make individual elements of the structure/union read-only or write-only. In addition to FETCH, STORE and ACCESS, you have SIZEOF:, ADDRESSOF:, LENGTHOF:, CLONE:, NEW: and DESTROY:. These methods apply to the complete data type and not individual elements. Note that not all of these last methods have been fully implemented yet. TYPE ARRAY ---------- Creates a type definition for an array. MODULE = Data PACKAGE = Data TYPE ARRAY int myarray [100] ; Works the same way as the TYPE HASH except the definition of the array takes only 1 line. TYPE SCALAR ------------ Creates a type definition for a scalar. I'm not sure if this section will be kept. VAR --- This sub-section creates an interface to *existing* C variables. Note that the C variable is assumed to exist already. This sub-section only creates the Perl interface to the variable. There are currently two variations with this sub-section. The first (which might or might not get dropped) is interfacing to simple data types like int and long. In these cases a definition like this VAR int fred ; will create a Perl interface which will allow 'fred' to be accessed directly, thus: $fred = 1 ; $b = $fred ; The second variation is interfacing to a type defined in one of the TYPE * sub-sections. In this case a definition like this: VAR struct fred MyFred ; will create a Perl interface which is accessed via a reference, thus: $MyFred->{alpha} = 2 ; $x = $MyFred->{beta} + 1 ; TYPEMAP Interface ================= It was necessary to extend the TYPEMAP file a bit. As with the .xs file, I have tried to keep the file backward compatible with the existing file. Both the INPUT and OUTPUT sections remain unchanged. The TYPEMAP section has been extended to take an optional parameter thus. TYPEMAP TYPEMAP XSUB TYPEMAP HASH TYPEMAP ARRAY TYPEMAP SCALAR The first two, TYPEMAP and TYPEMAP XSUB are equivalent. TYPEMAP HASH is used for the elements of structures/unions. When xsubpp is resolving a type for a structure element it will first check TYPEMAP HASH. If there is an entry it will be used. If not the TYPEMAP XSUB will be checked. This has been done because the existing typemap entries for quite a few types are fine for accessing the structure elements. The type resolution is the same with TYPEMAP ARRAY and TYPEMAP SCALAR. Perl Interface =============== The Perl interface to any data type defined in a TYPE * section in the .xs file is through a reference. A type (e.g. the struct fred shown above) can be instantiated thus $a = new Data::fred ; and read from /write to thus $a->{alpha} = 33 ; $y = $a->{beta} ; Similarly for an array $b = new Data::myarray ; $b->[3] = 5 ; $x = $b->[0] ; Other Methods ------------- Each of the complex data structure types has a number of methods defined for it. sizeof lengthof addressof clone The meaning of each of these is what you would expect in C (except clone, which is intended to create a duplicate of the complete data structure). So $b->lengthof is 100. What still needs to be done. ============================ * references, destroy, tailoring of new/addressof - references mostly work - destroy has been ignored for now * move util functions into core Perl? * tidy up the 'new' function. * naming - should it be MODULE::type ? * test harness for both the new stuff *and* existing xsubpp functionality -- started Paul Marquess <pmarquess@bfsec.bt.co.uk>
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.