PDLPorters / PDLPorters/pdl

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

Open
#358 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
105
Forks
49
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading pdlcore.c, pdlcore.h, pdlperl.h, and pdl.h to map the existing Perl-dependent code and API declarations; pp_indterm and the related #349 broadcastloop-vtable ideas are also called out. Done means the unchecked architectural tasks are implemented, including a separated C API, a Perl implementation behind the vtable, and removal of the listed Perl-specific dependencies from the C API.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, perl
Domain
backend-api-design, data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.