Skip to content

Make PDL be a C library with a Perl interface so it can be used from other C (or dynamic language) code #358

Description

@mohawk2

Tasks:

  • segregate the Perl-using C code (mostly pdlcore.c) completely away from the "PDL API" code, separating PDL_CORE_LIST into PDL_PERL_LIST and PDL_API_LIST - for compatibility reasons this will need to remain called "pdlcore.h" so may as well still call the .c the same, and probably merge pdlperl.h back in; the C API stuff would need to move to pdl.h
  • make macros that handle either allocating or using the default arrays such as def_dims
  • separate out a PDL_Value union type for the PDL_Anyval.value
  • use that to add a pdl.value entry to be used for ndarrays whose data segment is less than that number of bytes (which for small types could be several elements) obviously including scalar/single-value, using the alloc/default macro
  • switch PDL to just using realloc rather than pdl_grow/pdl_makescratchhash
  • have a pdl_impl_vtable * pdl.impl pointer, and void * pdl.impl_data that would replace the current datasv, sv, hdrsv (probably with a struct for the Perl implementation to use), implementing a Perl version
  • segregate remaining croak (etc)-using code into that vtable (especially pp_indterm)
  • that vtable might also want memory-management entries (malloc, realloc, free) unless the "switch to realloc" item renders it moot
  • eliminate the whole pdl.hdrsv from the C code, make the Perl object routinely be a hashref with a PDL and a hdr element so any copying could be done at Perl level
  • detection of POSIX threads could be de-Perl-ised

This is somewhat connected to the #349 ideas on making a broadcastloop vtable, but only somewhat.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions