Convert-Binary-C

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

tests/include/pdclib/functions/_tzcode/_PDCLIB_gmtcheck.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_gmtsub.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_increment_overflow.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_init_ttinfo.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_localsub.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_localtime_tzset.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_mktime_tzname.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_timesub.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_tzload.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_tzparse.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_tzset_unlocked.c
tests/include/pdclib/functions/_tzcode/_PDCLIB_update_tzname_etc.c
tests/include/pdclib/functions/_tzcode/Readme.txt
tests/include/pdclib/functions/ctype/isalnum.c
tests/include/pdclib/functions/ctype/isalpha.c
tests/include/pdclib/functions/ctype/isblank.c
tests/include/pdclib/functions/ctype/iscntrl.c
tests/include/pdclib/functions/ctype/isdigit.c
tests/include/pdclib/functions/ctype/isgraph.c
tests/include/pdclib/functions/ctype/islower.c
tests/include/pdclib/functions/ctype/isprint.c

ppport.h  view on Meta::CPAN

get_and_check_backslash_N_name_wrapper|5.029009||Viu
get_ANYOF_cp_list_for_ssc|5.019005||Viu
get_ANYOFM_contents|5.027009||Viu
GETATARGET|5.003007||Viu
get_aux_mg|5.011000||Viu
get_av|5.006000|5.003007|p
getc|5.003007||Viu
get_c_backtrace|5.021001||Vi
get_c_backtrace_dump|5.021001||V
get_context|5.006000|5.006000|nu
getc_unlocked|5.003007||Viu
get_cv|5.006000|5.003007|p
get_cvn_flags|5.009005|5.003007|p
get_cvs|5.011000|5.003007|p
getcwd_sv|5.007002|5.007002|
get_db_sub|||iu
get_debug_opts|5.008001||Viu
get_deprecated_property_msg|5.031011||cVniu
getegid|5.005000||Viu
getenv|5.005000||Viu
getenv_len|5.006000||Viu

ppport.h  view on Meta::CPAN

PERL_MAGIC_vec|5.007002|5.003007|p
PERL_MAGIC_vstring|5.008001|5.003007|p
PERL_MAGIC_VTABLE_MASK|5.015000||Viu
PERL_MALLOC_CTL_H|5.027001||Viu
Perl_malloc_good_size|5.010001||Viu
PERL_MALLOC_WRAP|5.009002|5.009002|Vn
PerlMem_calloc|5.006000||Viu
PerlMem_free|5.005000||Viu
PerlMem_free_lock|5.006000||Viu
PerlMem_get_lock|5.006000||Viu
PerlMem_is_locked|5.006000||Viu
PerlMem_malloc|5.005000||Viu
PERL_MEMORY_DEBUG_HEADER_SIZE|5.019009||Viu
PerlMemParse_calloc|5.006000||Viu
PerlMemParse_free|5.006000||Viu
PerlMemParse_free_lock|5.006000||Viu
PerlMemParse_get_lock|5.006000||Viu
PerlMemParse_is_locked|5.006000||Viu
PerlMemParse_malloc|5.006000||Viu
PerlMemParse_realloc|5.006000||Viu
PerlMem_realloc|5.005000||Viu
PerlMemShared_calloc|5.006000||Viu
PerlMemShared_free|5.006000||Viu
PerlMemShared_free_lock|5.006000||Viu
PerlMemShared_get_lock|5.006000||Viu
PerlMemShared_is_locked|5.006000||Viu
PerlMemShared_malloc|5.006000||Viu
PerlMemShared_realloc|5.006000||Viu
PERL_MG_UFUNC|5.007001||Viu
Perl_modf|5.006000|5.006000|n
PERL_MULTICONCAT_HEADER_SIZE|5.027006||Viu
PERL_MULTICONCAT_IX_LENGTHS|5.027006||Viu
PERL_MULTICONCAT_IX_NARGS|5.027006||Viu
PERL_MULTICONCAT_IX_PLAIN_LEN|5.027006||Viu
PERL_MULTICONCAT_IX_PLAIN_PV|5.027006||Viu
PERL_MULTICONCAT_IX_UTF8_LEN|5.027006||Viu

ppport.h  view on Meta::CPAN

PUSHSTACKi|5.005000||Viu
PUSHSTACK_INIT_HWM|5.027002||Viu
PUSHTARG|5.003007||Viu
PUSHu|5.004000|5.003007|p
PUTBACK|5.003007|5.003007|
putc|5.003007||Viu
put_charclass_bitmap_innards|5.021004||Viu
put_charclass_bitmap_innards_common|5.023008||Viu
put_charclass_bitmap_innards_invlist|5.023008||Viu
put_code_point|5.021004||Viu
putc_unlocked|5.003007||Viu
putenv|5.005000||Viu
put_range|5.019009||Viu
putw|5.003007||Viu
pv_display|5.006000|5.003007|p
pv_escape|5.009004|5.003007|p
pv_pretty|5.009004|5.003007|p
pv_uni_display|5.007003|5.007003|
pWARN_ALL|5.006000||Viu
pWARN_NONE|5.006000||Viu
pWARN_STD|5.006000||Viu

tests/include/pdclib/CMakeLists.txt  view on Meta::CPAN

     functions/_tzcode/_PDCLIB_gmtcheck.c
     functions/_tzcode/_PDCLIB_gmtsub.c
     functions/_tzcode/_PDCLIB_increment_overflow.c
     functions/_tzcode/_PDCLIB_init_ttinfo.c
     functions/_tzcode/_PDCLIB_localsub.c
     functions/_tzcode/_PDCLIB_localtime_tzset.c
     functions/_tzcode/_PDCLIB_mktime_tzname.c
     functions/_tzcode/_PDCLIB_timesub.c
     functions/_tzcode/_PDCLIB_tzload.c
     functions/_tzcode/_PDCLIB_tzparse.c
     functions/_tzcode/_PDCLIB_tzset_unlocked.c
     functions/_tzcode/_PDCLIB_update_tzname_etc.c

     functions/_PDCLIB/assert.c
     functions/_PDCLIB/errno.c
     functions/_PDCLIB/_PDCLIB_atomax.c
     functions/_PDCLIB/_PDCLIB_bigint.c
     functions/_PDCLIB/_PDCLIB_bigint2.c
     functions/_PDCLIB/_PDCLIB_bigint10.c
     functions/_PDCLIB/_PDCLIB_bigint32.c
     functions/_PDCLIB/_PDCLIB_bigint64.c

tests/include/pdclib/functions/_dlmalloc/malloc.c  view on Meta::CPAN

  using already-existing space will be serviced via mmap.  (If enough
  normal freed space already exists it is used instead.)  Using mmap
  segregates relatively large chunks of memory so that they can be
  individually obtained and released from the host system. A request
  serviced through mmap is never reused by any other request (at least
  not directly; the system may just so happen to remap successive
  requests to the same locations).  Segregating space in this way has
  the benefits that: Mmapped space can always be individually released
  back to the system, which helps keep the system level memory demands
  of a long-lived program low.  Also, mapped memory doesn't become
  `locked' between other chunks, as can happen with normally allocated
  chunks, which means that even trimming via malloc_trim would not
  release them.  However, it has the disadvantage that the space
  cannot be reclaimed, consolidated, and then used to service later
  requests, as happens with normal chunks.  The advantages of mmap
  nearly always outweigh disadvantages for "large" chunks, but the
  value of "large" may vary across systems.  The default is an
  empirically derived value that works well in most systems. You can
  disable mmap by setting to MAX_SIZE_T.

MAX_RELEASE_CHECK_RATE   default: 4095 unless not HAVE_MMAP

tests/include/pdclib/functions/_dlmalloc/malloc.c  view on Meta::CPAN


/*
  malloc_trim(size_t pad);

  If possible, gives memory back to the system (via negative arguments
  to sbrk) if there is unused memory at the `high' end of the malloc
  pool or in unused MMAP segments. You can call this after freeing
  large blocks of memory to potentially reduce the system-level memory
  requirements of a program. However, it cannot guarantee to reduce
  memory. Under some allocation patterns, some large free blocks of
  memory will be locked between two used chunks, so they cannot be
  given back to the system.

  The `pad' argument to malloc_trim represents the amount of free
  trailing space to leave untrimmed. If this argument is zero, only
  the minimum amount of memory to maintain internal data structures
  will be left. Non-zero arguments can be supplied to maintain enough
  trailing space to service future expected allocations without having
  to re-obtain memory from the system.

  Malloc_trim returns 1 if it actually released any memory, else 0.

tests/include/pdclib/functions/_dlmalloc/malloc.c  view on Meta::CPAN

/*
  mspace is an opaque type representing an independent
  region of space that supports mspace_malloc, etc.
*/
typedef void* mspace;

/*
  create_mspace creates and returns a new independent space with the
  given initial capacity, or, if 0, the default granularity size.  It
  returns null if there is no system memory available to create the
  space.  If argument locked is non-zero, the space uses a separate
  lock to control access. The capacity of the space will grow
  dynamically as needed to service mspace_malloc requests.  You can
  control the sizes of incremental increases of this space by
  compiling with a different DEFAULT_GRANULARITY or dynamically
  setting with mallopt(M_GRANULARITY, value).
*/
DLMALLOC_EXPORT mspace create_mspace(size_t capacity, int locked);

/*
  destroy_mspace destroys the given space, and attempts to return all
  of its memory back to the system, returning the total number of
  bytes freed. After destruction, the results of access to all memory
  used by the space become undefined.
*/
DLMALLOC_EXPORT size_t destroy_mspace(mspace msp);

/*
  create_mspace_with_base uses the memory supplied as the initial base
  of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
  space is used for bookkeeping, so the capacity must be at least this
  large. (Otherwise 0 is returned.) When this initial space is
  exhausted, additional memory will be obtained from the system.
  Destroying this space will deallocate all additionally allocated
  space (if possible) but not the initial base.
*/
DLMALLOC_EXPORT mspace create_mspace_with_base(void* base, size_t capacity, int locked);

/*
  mspace_track_large_chunks controls whether requests for large chunks
  are allocated in their own untracked mmapped regions, separate from
  others in this mspace. By default large chunks are not tracked,
  which reduces fragmentation. However, such chunks are not
  necessarily released to the system upon destroy_mspace.  Enabling
  tracking by setting to true may increase fragmentation, but avoids
  leakage when relying on destroy_mspace to release all memory
  allocated using this space.  The function returns the previous

tests/include/pdclib/functions/_dlmalloc/malloc.c  view on Meta::CPAN

#endif /* solaris or LACKS_SCHED_H */
#if (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0) || !USE_SPIN_LOCKS
#include <pthread.h>
#endif /* USE_RECURSIVE_LOCKS ... */
#elif defined(_MSC_VER)
#ifndef _M_AMD64
/* These are already defined on AMD64 builds */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
LONG __cdecl _InterlockedCompareExchange(LONG volatile *Dest, LONG Exchange, LONG Comp);
LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _M_AMD64 */
#pragma intrinsic (_InterlockedCompareExchange)
#pragma intrinsic (_InterlockedExchange)
#define interlockedcompareexchange _InterlockedCompareExchange
#define interlockedexchange _InterlockedExchange
#elif defined(WIN32) && defined(__GNUC__)
#define interlockedcompareexchange(a, b, c) __sync_val_compare_and_swap(a, c, b)
#define interlockedexchange __sync_lock_test_and_set
#endif /* Win32 */
#else /* USE_LOCKS */
#endif /* USE_LOCKS */

#ifndef LOCK_AT_FORK
#define LOCK_AT_FORK 0
#endif

/* Declarations for bit scanning on win32 */
#if defined(_MSC_VER) && _MSC_VER>=1300

tests/include/pdclib/functions/_dlmalloc/malloc.c  view on Meta::CPAN

  __asm__ __volatile__ ("lock; xchgl %0, %1"
                        : "=r" (ret)
                        : "m" (*(sl)), "0"(prev)
                        : "memory");
}

#define CAS_LOCK(sl)     x86_cas_lock(sl)
#define CLEAR_LOCK(sl)   x86_clear_lock(sl)

#else /* Win32 MSC */
#define CAS_LOCK(sl)     interlockedexchange(sl, (LONG)1)
#define CLEAR_LOCK(sl)   interlockedexchange (sl, (LONG)0)

#endif /* ... gcc spins locks ... */

/* How to yield for a spin lock */
#define SPINS_PER_YIELD       63
#if defined(_MSC_VER)
#define SLEEP_EX_DURATION     50 /* delay for yield/sleep */
#define SPIN_LOCK_YIELD  SleepEx(SLEEP_EX_DURATION, FALSE)
#elif defined (__SVR4) && defined (__sun) /* solaris */
#define SPIN_LOCK_YIELD   thr_yield();

tests/include/pdclib/functions/_dlmalloc/malloc.c  view on Meta::CPAN

static volatile LONG malloc_global_mutex_status;

/* Use spin loop to initialize global lock */
static void init_malloc_global_mutex() {
  for (;;) {
    long stat = malloc_global_mutex_status;
    if (stat > 0)
      return;
    /* transition to < 0 while initializing, then to > 0) */
    if (stat == 0 &&
        interlockedcompareexchange(&malloc_global_mutex_status, (LONG)-1, (LONG)0) == 0) {
      InitializeCriticalSection(&malloc_global_mutex);
      interlockedexchange(&malloc_global_mutex_status, (LONG)1);
      return;
    }
    SleepEx(0, FALSE);
  }
}

#else /* pthreads-based locks */
#define MLOCK_T               pthread_mutex_t
#define ACQUIRE_LOCK(lk)      pthread_mutex_lock(lk)
#define RELEASE_LOCK(lk)      pthread_mutex_unlock(lk)

tests/include/pdclib/functions/_dlmalloc/malloc.c  view on Meta::CPAN

  m->extp = 0;
  m->exts = 0;
  disable_contiguous(m);
  init_bins(m);
  mn = next_chunk(mem2chunk(m));
  init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE);
  check_top_chunk(m, m->top);
  return m;
}

mspace create_mspace(size_t capacity, int locked) {
  mstate m = 0;
  size_t msize;
  ensure_initialization();
  msize = pad_request(sizeof(struct malloc_state));
  if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
    size_t rs = ((capacity == 0)? mparams.granularity :
                 (capacity + TOP_FOOT_SIZE + msize));
    size_t tsize = granularity_align(rs);
    char* tbase = (char*)(CALL_MMAP(tsize));
    if (tbase != CMFAIL) {
      m = init_user_mstate(tbase, tsize);
      m->seg.sflags = USE_MMAP_BIT;
      set_lock(m, locked);
    }
  }
  return (mspace)m;
}

mspace create_mspace_with_base(void* base, size_t capacity, int locked) {
  mstate m = 0;
  size_t msize;
  ensure_initialization();
  msize = pad_request(sizeof(struct malloc_state));
  if (capacity > msize + TOP_FOOT_SIZE &&
      capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) {
    m = init_user_mstate((char*)base, capacity);
    m->seg.sflags = EXTERN_BIT;
    set_lock(m, locked);
  }
  return (mspace)m;
}

int mspace_track_large_chunks(mspace msp, int enable) {
  int ret = 0;
  mstate ms = (mstate)msp;
  if (!PREACTION(ms)) {
    if (!use_mmap(ms)) {
      ret = 1;

tests/include/pdclib/functions/_dlmalloc/malloc.c  view on Meta::CPAN

      regions in those cases where they do happen to be contiguous.
  * MORECORE need not handle negative arguments -- it may instead
      just return MFAIL when given negative arguments.
      Negative arguments are always multiples of pagesize. MORECORE
      must not misinterpret negative args as large positive unsigned
      args. You can suppress all such calls from even occurring by defining
      MORECORE_CANNOT_TRIM,

  As an example alternative MORECORE, here is a custom allocator
  kindly contributed for pre-OSX macOS.  It uses virtually but not
  necessarily physically contiguous non-paged memory (locked in,
  present and won't get swapped out).  You can use it by uncommenting
  this section, adding some #includes, and setting up the appropriate
  defines above:

      #define MORECORE osMoreCore

  There is also a shutdown routine that should somehow be called for
  cleanup upon program exit.

  #define MAX_POOL_ENTRIES 100

tests/include/pdclib/functions/_tzcode/_PDCLIB_localtime_tzset.c  view on Meta::CPAN

#endif

#include <string.h>

struct tm * _PDCLIB_localtime_tzset( time_t const * timep, struct tm * tmp, bool setname )
{
    _PDCLIB_LOCK( _PDCLIB_time_mtx );

    if ( setname || ! lcl_is_set )
    {
        _PDCLIB_tzset_unlocked();
    }

    tmp = _PDCLIB_localsub( &_PDCLIB_lclmem, timep, setname, tmp );
    _PDCLIB_UNLOCK( _PDCLIB_time_mtx );
    return tmp;
}

#endif

#ifdef TEST

tests/include/pdclib/functions/_tzcode/_PDCLIB_tzset_unlocked.c  view on Meta::CPAN

/* _PDCLIB_tzset_unlocked( void )

   This file is part of the Public Domain C Library (PDCLib).
   Permission is granted to use, modify, and / or redistribute at will.
*/

#ifndef REGTEST

#include "pdclib/_PDCLIB_tzcode.h"

#include <stdlib.h>

tests/include/pdclib/functions/_tzcode/_PDCLIB_tzset_unlocked.c  view on Meta::CPAN

        if ( 0 < lcl )
        {
            strcpy( lcl_TZname, name );
        }
    }

    settzname();
    lcl_is_set = lcl;
}

void _PDCLIB_tzset_unlocked( void )
{
    tzsetlcl( getenv( "TZ" ) );
}

#endif

#ifdef TEST

#include "_PDCLIB_test.h"

tests/include/pdclib/functions/stdio/freopen.c  view on Meta::CPAN

#ifndef __STDC_NO_THREADS__
        if ( mtx_init( &stream->mtx, mtx_plain | mtx_recursive ) != thrd_success )
        {
            /* Could not initialize stream mutex */
            _PDCLIB_UNLOCK( _PDCLIB_filelist_mtx );
            return NULL;
        }

#endif

        /* Locking the mutex, so we come out of the if-else with a locked
           mutex either way.
        */
        _PDCLIB_LOCK( stream->mtx );
    }

    /* Stream is closed, or never was open (even though its mutex exists
       and is locked) at this point.
       Now we check if we have the whereabouts to open it.
    */

    if ( filemode == 0 )
    {
        /* Mode invalid */
        _PDCLIB_UNLOCK( stream->mtx );
#ifndef __STDC_NO_THREADS__
        mtx_destroy( &stream->mtx );
#endif

tests/include/pdclib/functions/time/mktime.c  view on Meta::CPAN


#ifndef __STDC_NO_THREADS__
#include <threads.h>
extern mtx_t _PDCLIB_time_mtx;
#endif

time_t mktime( struct tm * timeptr )
{
    time_t t;
    _PDCLIB_LOCK( _PDCLIB_time_mtx );
    _PDCLIB_tzset_unlocked();
    t = _PDCLIB_mktime_tzname( &_PDCLIB_lclmem, timeptr, true );
    _PDCLIB_UNLOCK( _PDCLIB_time_mtx );
    return t;
}

#endif

#ifdef TEST

#include "_PDCLIB_test.h"

tests/include/pdclib/include/pdclib/_PDCLIB_tzcode.h  view on Meta::CPAN

void        _PDCLIB_gmtcheck(void);
struct tm * _PDCLIB_gmtsub( struct state const * sp, time_t const * timep, int_fast32_t offset, struct tm * tmp );
bool        _PDCLIB_increment_overflow( int * ip, int j );
void        _PDCLIB_init_ttinfo( struct ttinfo * s, int_fast32_t utoff, bool isdst, int desigidx );
struct tm * _PDCLIB_localsub( struct state const * sp, time_t const * timep, int_fast32_t setname, struct tm * const tmp );
struct tm * _PDCLIB_localtime_tzset( time_t const * timep, struct tm * tmp, bool setname );
time_t      _PDCLIB_mktime_tzname( struct state * sp, struct tm * tmp, bool setname );
struct tm * _PDCLIB_timesub( const time_t * timep, int_fast32_t offset, const struct state * sp, struct tm * tmp );
int         _PDCLIB_tzload( char const * name, struct state * sp, bool doextend );
bool        _PDCLIB_tzparse(char const *, struct state *, bool);
void        _PDCLIB_tzset_unlocked( void );
void        _PDCLIB_update_tzname_etc( struct state const * sp, struct ttinfo const * ttisp );

#ifdef __cplusplus
}
#endif

#endif

tests/include/pdclib/platform/example/include/signal.h  view on Meta::CPAN

   arrangements, it is not possible to turn them into a useful tool.

   This example implementation chose to "not generate any of these signals,
   except as a result of explicit calls to the raise function", which is
   allowed by the standard but of course does nothing for the usefulness of
   <signal.h>.

   A useful signal handling would:
   1) make signal() a system call that registers the signal handler with the OS
   2) make raise() a system call triggering an OS signal to the running process
   3) make provisions that further signals of the same type are blocked until
      the signal handler returns (optional for SIGILL)
*/

/* These are the values used by Linux. */

/* Abnormal termination / abort() */
#define SIGABRT 6
/* Arithmetic exception / division by zero / overflow */
#define SIGFPE  8
/* Illegal instruction */

tests/include/pdclib/platform/example/include/threads.h  view on Meta::CPAN

   mtx_plain                 -- non-recursive mutex
   mtx_timed                 -- non-recursive mutex supporting timeout
   mtx_plain | mtx_recursive -- recursive mutex
   mtx_timed | mtx_recursive -- recursive mutex supporting timeout
*/
_PDCLIB_PUBLIC int mtx_init( mtx_t * mtx, int type );

/* Try to lock the given mutex (blocking).
   Returns thrd_success if successful, thrd_error if the request could not
   be honored.
   If the given mutex is non-recursive, it must not be already locked by
   the calling thread.
*/
_PDCLIB_PUBLIC int mtx_lock( mtx_t * mtx );

/* TODO: Documentation.
   Returns thrd_success if successful, thrd_timedout if the specified time
   is reached without acquiring the resource, or thrd_error if the request
   could not be honored.
*/
_PDCLIB_PUBLIC int mtx_timedlock( mtx_t * _PDCLIB_restrict mtx, const struct timespec * _PDCLIB_restrict ts );

/* Try to lock the given mutex (non-blocking).
   Returns thrd_success if successful, thrd_busy if the resource is already
   locked, or thrd_error if the request could not be honored.
*/
_PDCLIB_PUBLIC int mtx_trylock( mtx_t * mtx );

/* Unlock the given mutex.
   Returns thrd_success if successful, thrd_error if the request could not
   be honored.
   The given mutex must be locked by the calling thread.
*/
_PDCLIB_PUBLIC int mtx_unlock( mtx_t * mtx );

/* Thread functions */

/* Create a new thread.
   Returns thrd_success if successful, thrd_nomem if out of memory, and
   thrd_error if the request could not be honored.
   Create a new thread executing func( arg ), and sets thr to identify
   the created thread. (Identifiers may be reused afer a thread exited



( run in 0.384 second using v1.01-cache-2.11-cpan-26ccb49234f )