eĿlipsis
a language independent preprocessor
 
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Loading...
Searching...
No Matches
ellipsis‿sarray Struct Reference

A structure with a flexible array member of base type ellipsis‿sarray‿base. More...

#include <ellipsis-sarray.h>

Public Types

typedef size_t ellipsis‿sarray‿base
 

Public Member Functions

ellipsis‿sarrayellipsis‿sarray‿alloc‿_Ctra (size_t len)
 Allocate a ellipsis‿sarray with elements as given by the parameter.
 
ellipsis‿sarrayellipsis‿sarray‿alloc‿_Insta (size_t len)
 Allocate a ellipsis‿sarray with elements as given by the parameter.
 
ellipsis‿sarrayellipsis‿sarray‿alloc (size_t len)
 Allocate a ellipsis‿sarray with elements as given by the parameter.
 
ellipsis‿sarrayellipsis‿sarray‿append‿_Ctra (ellipsis‿sarray *restrict s, ellipsis‿sarray‿base c)
 Append a new element to a ellipsis‿sarray and return a new object.
 
ellipsis‿sarrayellipsis‿sarray‿append‿_Insta (ellipsis‿sarray *restrict s, ellipsis‿sarray‿base c)
 Append a new element to a ellipsis‿sarray and return a new object.
 
ellipsis‿sarrayellipsis‿sarray‿append (ellipsis‿sarray *restrict s, ellipsis‿sarray‿base c)
 Append a new element to a ellipsis‿sarray and return a new object.
 
int ellipsis‿sarray‿base‿compare (ellipsis‿sarray‿base const _a[static 1], ellipsis‿sarray‿base const _b[static 1])
 Compare two elements of type ellipsis‿sarray‿base.
 
void ellipsis‿sarray‿base‿destroy (size_t _n, ellipsis‿sarray‿base _ar[static _n])
 Destroy an element of type ellipsis‿sarray‿base.
 
void ellipsis‿sarray‿cmove (ellipsis‿sarray const *__LOC_ID_0_3[restrict static 1], ellipsis‿sarray const **restrict __LOC_ID_0_4)
 Move a ellipsis‿sarray const pointed to by the second parameter to the one pointed to by the first.
 
int ellipsis‿sarray‿compare (ellipsis‿sarray const *s, ellipsis‿sarray const *t)
 Compare two arrays lexicographically.
 
int ellipsis‿sarray‿compareInternal (void const *A, void const *B)
 
ellipsis‿sarrayellipsis‿sarray‿concat‿_Ctra (ellipsis‿sarray const *s, ellipsis‿sarray const *t)
 Concatenate two ellipsis‿sarray into a new one.
 
ellipsis‿sarrayellipsis‿sarray‿concat‿_Insta (ellipsis‿sarray const *s, ellipsis‿sarray const *t)
 Concatenate two ellipsis‿sarray into a new one.
 
ellipsis‿sarrayellipsis‿sarray‿concat (ellipsis‿sarray const *s, ellipsis‿sarray const *t)
 Concatenate two ellipsis‿sarray into a new one.
 
ellipsis‿sarrayellipsis‿sarray‿concat_inplace‿_Ctra (ellipsis‿sarray const *s, ellipsis‿sarray const *t)
 Concatenate two ellipsis‿sarray into a new one and delete s.
 
ellipsis‿sarrayellipsis‿sarray‿concat_inplace‿_Insta (ellipsis‿sarray const *s, ellipsis‿sarray const *t)
 Concatenate two ellipsis‿sarray into a new one and delete s.
 
ellipsis‿sarrayellipsis‿sarray‿concat_inplace (ellipsis‿sarray const *s, ellipsis‿sarray const *t)
 Concatenate two ellipsis‿sarray into a new one and delete s.
 
ellipsis‿sarrayellipsis‿sarray‿cpy (ellipsis‿sarray const *restrict __LOC_ID_0_5)
 Allocate a ellipsis‿sarray and copy the data to which the parameter points into it.
 
ellipsis‿sarray const * ellipsis‿sarray‿cpy_const‿_Ctra (ellipsis‿sarray const *restrict s)
 Copy or link to a const-qualified ellipsis‿sarray.
 
ellipsis‿sarray const * ellipsis‿sarray‿cpy_const‿_Insta (ellipsis‿sarray const *restrict s)
 Copy or link to a const-qualified ellipsis‿sarray.
 
ellipsis‿sarray const * ellipsis‿sarray‿cpy_const (ellipsis‿sarray const *restrict s)
 Copy or link to a const-qualified ellipsis‿sarray.
 
void ellipsis‿sarray‿delete (ellipsis‿sarray const *)
 Delete a ellipsis‿sarray pointed to by the parameter.
 
ellipsis‿sarrayellipsis‿sarray‿grow‿_Ctra (ellipsis‿sarray *restrict s, size_t length)
 Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete the old one, if any.
 
ellipsis‿sarrayellipsis‿sarray‿grow‿_Insta (ellipsis‿sarray *restrict s, size_t length)
 Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete the old one, if any.
 
ellipsis‿sarrayellipsis‿sarray‿grow (ellipsis‿sarray *restrict s, size_t length)
 Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete the old one, if any.
 
void ellipsis‿sarray‿move (ellipsis‿sarray *__LOC_ID_0_1[restrict static 1], ellipsis‿sarray **restrict __LOC_ID_0_2)
 Move a ellipsis‿sarray pointed to by the second parameter to the one pointed to by the first.
 
ellipsis‿sarrayellipsis‿sarray‿remove (ellipsis‿sarray s[restrict static 1], size_t)
 Remove (at most) the indicated amount of elements from the ellipsis‿sarray return a new one and delete s.
 
ellipsis‿sarray‿base const * ellipsis‿sarray‿search (ellipsis‿sarray‿base const el[static 1], ellipsis‿sarray const *p, size_t offs, size_t len)
 search for an element in a ellipsis‿sarray
 
ellipsis‿sarrayellipsis‿sarray‿shrink‿_Ctra (ellipsis‿sarray s[restrict static 1], size_t length)
 Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete the old one, if any.
 
ellipsis‿sarrayellipsis‿sarray‿shrink‿_Insta (ellipsis‿sarray s[restrict static 1], size_t length)
 Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete the old one, if any.
 
ellipsis‿sarrayellipsis‿sarray‿shrink (ellipsis‿sarray s[restrict static 1], size_t length)
 Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete the old one, if any.
 
void ellipsis‿sarray‿sort (ellipsis‿sarray *p, size_t offs, size_t len)
 sort a ellipsis‿sarray in place.
 
ellipsis‿sarrayellipsis‿sarray‿sub‿_Ctra (ellipsis‿sarray const *restrict s, size_t pos, size_t len)
 Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.
 
ellipsis‿sarrayellipsis‿sarray‿sub‿_Insta (ellipsis‿sarray const *restrict s, size_t pos, size_t len)
 Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.
 
ellipsis‿sarrayellipsis‿sarray‿sub (ellipsis‿sarray const *restrict s, size_t pos, size_t len)
 Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.
 

Data Fields

ellipsis‿sarray‿base array []
 The current data array.
 
size_t const length
 Current length of this instance.
 

Private Attributes

size_t const capacity
 Maximal length of this instance.
 
size_t length_mod
 Modifiable length of this instance.
 

Related Symbols

(Note that these are not member symbols.)

#define ELLIPSIS_SARRAY_LITERAL_LOCAL(N, ...)
 Create a literal of type ellipsis‿sarray, where the array component is initialized with the arguments.
 

Detailed Description

A structure with a flexible array member of base type ellipsis‿sarray‿base.

The ellipsis‿sarray type by itself only works if allocated, you should never declare a variable of it; but see below for creating literals of this type. Functions and macros are provided to allocate, delete, copy etc.

ellipsis‿sarray keeps track of two different lengths

  • length, an actual length that holds the number of elements that are currently stored
  • capacity, a maximal length to which the current fa structure may be expanded without reallocation. The special value 0 indicates that this instance is a literal and may not be reallocated at all.

The purpose is to handle additions and removal of elements relatively efficient, without having to reallocated and copy the whole structure each time.

Use the member length to query the current length and array to access the members. Do not touch the other members.

See also
ELLIPSIS_SARRAY_LITERAL for the creation of a literal of this type.

Source definitions for this type

The contents of this file here is automatically expanded from the meta-source file "generate/xfiles/ellipsis-fa-xcode.eLh". That source has to be included by eĿlipsis with a unit name (here ellipsis‿sarray) set to the name that the new array structure should have. Before that, the type ¤::base (here ellipsis‿sarray‿base) has to be defined to the base type of the array. The include should then be done by using include_source; when doing so the macro ELLIPSIS_FA_NAME (here ellipsis_sarray) has to be set to a non-composed name that will be used as a prefix for the macros that are defined.

# include_source "generate/xfiles/ellipsis-fa-xcode.eLh"__prefix__(bind ELLIPSIS_FA_NAME ellipsis_sarray)

There are two other features that can be used to fine-tune the type. They depend on the macros ELLIPSIS_HAS_DESTROY and ELLIPSIS_HAS_COMPARE that can be added with similar __prefix__(bind ...) arguments as above. If these are defined, ellipsis‿sarray‿base‿destroy and ellipsis‿sarray‿base‿compare are supposed to pre-exist, respectively; if they are not defined, the corresponding function is synthesized to a default.

See also
ellipsis‿sarray‿base‿destroy for the policy when elements are removed
ellipsis‿sarray‿base‿compare for the policy when two elements are compared

A similar mechanism is in place for the .c file.

Warning
This is a file generated by eĿlipsis version 20250309, do not modify

Member Typedef Documentation

◆ ellipsis‿sarray‿base

typedef size_t ellipsis‿sarray‿base

Member Function Documentation

◆ ellipsis‿sarray‿alloc‿_Ctra()

ellipsis‿sarray * ellipsis‿sarray‿alloc‿_Ctra ( size_t  len)
inline

Allocate a ellipsis‿sarray with elements as given by the parameter.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿alloc‿_Ctra(), ellipsis‿sarray‿alloc‿_Inner(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿alloc‿_Ctra().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿alloc‿_Insta()

ellipsis‿sarray * ellipsis‿sarray‿alloc‿_Insta ( size_t  len)
inline

Allocate a ellipsis‿sarray with elements as given by the parameter.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

Referenced by ellipsis‿sarray‿alloc().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿alloc()

ellipsis‿sarray * ellipsis‿sarray‿alloc ( size_t  len)
inline

Allocate a ellipsis‿sarray with elements as given by the parameter.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿alloc‿_Insta(), ellipsis‿sarray‿alloc(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿alloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿append‿_Ctra()

ellipsis‿sarray * ellipsis‿sarray‿append‿_Ctra ( ellipsis‿sarray *restrict  s,
ellipsis‿sarray‿base  c 
)
inline

Append a new element to a ellipsis‿sarray and return a new object.

If the array is statically allocated an allocated copy of it is made first.

A pointer to a new or the old array may be returned, and so you should update all pointer variables that previous held the pointer accordingly.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned and the old array is maintained.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿append‿_Ctra(), ellipsis‿sarray‿append‿_Inner(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿append‿_Ctra().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿append‿_Insta()

ellipsis‿sarray * ellipsis‿sarray‿append‿_Insta ( ellipsis‿sarray *restrict  s,
ellipsis‿sarray‿base  c 
)
inline

Append a new element to a ellipsis‿sarray and return a new object.

If the array is statically allocated an allocated copy of it is made first.

A pointer to a new or the old array may be returned, and so you should update all pointer variables that previous held the pointer accordingly.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned and the old array is maintained.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

Referenced by ellipsis‿sarray‿append().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿append()

ellipsis‿sarray * ellipsis‿sarray‿append ( ellipsis‿sarray *restrict  s,
ellipsis‿sarray‿base  c 
)
inline

Append a new element to a ellipsis‿sarray and return a new object.

If the array is statically allocated an allocated copy of it is made first.

A pointer to a new or the old array may be returned, and so you should update all pointer variables that previous held the pointer accordingly.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned and the old array is maintained.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿append‿_Insta(), ellipsis‿sarray‿append(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿append().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿base‿compare()

int ellipsis‿sarray‿base‿compare ( ellipsis‿sarray‿base const  _a[static 1],
ellipsis‿sarray‿base const  _b[static 1] 
)
inline

Compare two elements of type ellipsis‿sarray‿base.

This is a synthesized function that compares the byte representation of the pointed-to elements.

See also
ellipsis‿sarray‿compare

Referenced by ellipsis‿sarray‿compareInternal().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿base‿destroy()

void ellipsis‿sarray‿base‿destroy ( size_t  _n,
ellipsis‿sarray‿base  _ar[static _n] 
)
inline

Destroy an element of type ellipsis‿sarray‿base.

This is a synthesized function that sets all bytes of the array to 0.

See also
ellipsis‿sarray‿remove
ellipsis‿sarray‿delete

◆ ellipsis‿sarray‿cmove()

void ellipsis‿sarray‿cmove ( ellipsis‿sarray const *  __LOC_ID_0_3[restrict static 1],
ellipsis‿sarray const **restrict  __LOC_ID_0_4 
)
inline

Move a ellipsis‿sarray const pointed to by the second parameter to the one pointed to by the first.

If target is not null before, the old pointed-to object is deleted.

References ellipsis‿sarray‿delete().

Here is the call graph for this function:

◆ ellipsis‿sarray‿compare()

int ellipsis‿sarray‿compare ( ellipsis‿sarray const *  s,
ellipsis‿sarray const *  t 
)

Compare two arrays lexicographically.

This synthesizes and uses a function ellipsis‿sarray‿base‿compare that compares two pointed-to elements of type ellipsis‿sarray‿base, comparing the byte representation of the pointed-to elements.

References array, and length.

◆ ellipsis‿sarray‿compareInternal()

int ellipsis‿sarray‿compareInternal ( void const *  A,
void const *  B 
)
inline

References ellipsis‿sarray‿base‿compare().

Referenced by ellipsis‿sarray‿search(), and ellipsis‿sarray‿sort().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿concat‿_Ctra()

ellipsis‿sarray * ellipsis‿sarray‿concat‿_Ctra ( ellipsis‿sarray const *  s,
ellipsis‿sarray const *  t 
)
inline

Concatenate two ellipsis‿sarray into a new one.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿concat‿_Ctra(), ellipsis‿sarray‿concat‿_Inner(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿concat‿_Ctra().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿concat‿_Insta()

ellipsis‿sarray * ellipsis‿sarray‿concat‿_Insta ( ellipsis‿sarray const *  s,
ellipsis‿sarray const *  t 
)
inline

Concatenate two ellipsis‿sarray into a new one.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

Referenced by ellipsis‿sarray‿concat().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿concat()

ellipsis‿sarray * ellipsis‿sarray‿concat ( ellipsis‿sarray const *  s,
ellipsis‿sarray const *  t 
)
inline

Concatenate two ellipsis‿sarray into a new one.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿concat‿_Insta(), ellipsis‿sarray‿concat(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿concat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿concat_inplace‿_Ctra()

ellipsis‿sarray * ellipsis‿sarray‿concat_inplace‿_Ctra ( ellipsis‿sarray const *  s,
ellipsis‿sarray const *  t 
)
inline

Concatenate two ellipsis‿sarray into a new one and delete s.

If s is null on entry a new array is returned, if possible, otherwise a null pointer is returned.

The effect is mostly as if in the following

A structure with a flexible array member of base type ellipsis‿sarray‿base.
Definition ellipsis-sarray.h:140
void ellipsis‿sarray‿delete(ellipsis‿sarray const *)
Delete a ellipsis‿sarray pointed to by the parameter.
Definition ellipsis-sarray.c:615
ellipsis‿sarray * ellipsis‿sarray‿concat(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Concatenate two ellipsis‿sarray into a new one.
Definition ellipsis-sarray.h:410
ellipsis‿sarray * ellipsis‿sarray‿cpy(ellipsis‿sarray const *restrict __LOC_ID_0_5)
Allocate a ellipsis‿sarray and copy the data to which the parameter points into it.
Definition ellipsis-sarray.h:1245

only that the storage of s may be reused more efficiently.

If s is a literal, a copy of it is made and then it is concatenated.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

Note that in particular, as for ellipsis‿sarray‿delete(), *s may be deleted although it is const-qualified.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿concat_inplace‿_Ctra(), ellipsis‿sarray‿concat_inplace‿_Inner(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿concat_inplace‿_Ctra().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿concat_inplace‿_Insta()

ellipsis‿sarray * ellipsis‿sarray‿concat_inplace‿_Insta ( ellipsis‿sarray const *  s,
ellipsis‿sarray const *  t 
)
inline

Concatenate two ellipsis‿sarray into a new one and delete s.

If s is null on entry a new array is returned, if possible, otherwise a null pointer is returned.

The effect is mostly as if in the following

only that the storage of s may be reused more efficiently.

If s is a literal, a copy of it is made and then it is concatenated.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

Note that in particular, as for ellipsis‿sarray‿delete(), *s may be deleted although it is const-qualified.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

Referenced by ellipsis‿sarray‿concat_inplace().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿concat_inplace()

ellipsis‿sarray * ellipsis‿sarray‿concat_inplace ( ellipsis‿sarray const *  s,
ellipsis‿sarray const *  t 
)
inline

Concatenate two ellipsis‿sarray into a new one and delete s.

If s is null on entry a new array is returned, if possible, otherwise a null pointer is returned.

The effect is mostly as if in the following

only that the storage of s may be reused more efficiently.

If s is a literal, a copy of it is made and then it is concatenated.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

Note that in particular, as for ellipsis‿sarray‿delete(), *s may be deleted although it is const-qualified.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿concat_inplace‿_Insta(), ellipsis‿sarray‿concat_inplace(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿concat_inplace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿cpy()

ellipsis‿sarray * ellipsis‿sarray‿cpy ( ellipsis‿sarray const *restrict  __LOC_ID_0_5)
inline

Allocate a ellipsis‿sarray and copy the data to which the parameter points into it.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿sub(), and ELLIPSIS_CONTRACT.

Here is the call graph for this function:

◆ ellipsis‿sarray‿cpy_const‿_Ctra()

ellipsis‿sarray const * ellipsis‿sarray‿cpy_const‿_Ctra ( ellipsis‿sarray const *restrict  s)
inline

Copy or link to a const-qualified ellipsis‿sarray.

If the pointed to object has been allocated statically, only a pointer to that object is returned. If the object has been allocated dynamically, a copy as by ellipsis‿sarray‿cpy is produced.

See also
ELLIPSIS_SARRAY_LITERAL

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿cpy_const‿_Ctra(), ellipsis‿sarray‿cpy_const‿_Inner(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿cpy_const‿_Ctra().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿cpy_const‿_Insta()

ellipsis‿sarray const * ellipsis‿sarray‿cpy_const‿_Insta ( ellipsis‿sarray const *restrict  s)
inline

Copy or link to a const-qualified ellipsis‿sarray.

If the pointed to object has been allocated statically, only a pointer to that object is returned. If the object has been allocated dynamically, a copy as by ellipsis‿sarray‿cpy is produced.

See also
ELLIPSIS_SARRAY_LITERAL

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

Referenced by ellipsis‿sarray‿cpy_const().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿cpy_const()

ellipsis‿sarray const * ellipsis‿sarray‿cpy_const ( ellipsis‿sarray const *restrict  s)
inline

Copy or link to a const-qualified ellipsis‿sarray.

If the pointed to object has been allocated statically, only a pointer to that object is returned. If the object has been allocated dynamically, a copy as by ellipsis‿sarray‿cpy is produced.

See also
ELLIPSIS_SARRAY_LITERAL

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿cpy_const‿_Insta(), ellipsis‿sarray‿cpy_const(), and ELLIPSIS_CONTRACT.

Referenced by ellipsis‿sarray‿cpy_const().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿delete()

void ellipsis‿sarray‿delete ( ellipsis‿sarray const *  )

Delete a ellipsis‿sarray pointed to by the parameter.

Remarks
This function may be presented with a literal as produced by ELLIPSIS_SARRAY_LITERAL and will just do nothing, then.

This synthesizes and uses a function ellipsis‿sarray‿base‿destroy on the deleted elements, setting the byte representation of the pointed-to elements to 0.

References array, and length.

Referenced by ellipsis‿sarray‿cmove(), and ellipsis‿sarray‿move().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿grow‿_Ctra()

ellipsis‿sarray * ellipsis‿sarray‿grow‿_Ctra ( ellipsis‿sarray *restrict  s,
size_t  length 
)
inline

Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete the old one, if any.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

If s is null on entry a new array is returned, if possible, otherwise a null pointer is returned.

If s is non-null and cannot be grown, s is returned unchanged.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References capacity, ellipsis‿sarray‿grow‿_Ctra(), ellipsis‿sarray‿grow‿_Inner(), ELLIPSIS_CONTRACT, and length.

Referenced by ellipsis‿sarray‿grow‿_Ctra().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿grow‿_Insta()

ellipsis‿sarray * ellipsis‿sarray‿grow‿_Insta ( ellipsis‿sarray *restrict  s,
size_t  length 
)
inline

Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete the old one, if any.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

If s is null on entry a new array is returned, if possible, otherwise a null pointer is returned.

If s is non-null and cannot be grown, s is returned unchanged.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

Referenced by ellipsis‿sarray‿grow().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿grow()

ellipsis‿sarray * ellipsis‿sarray‿grow ( ellipsis‿sarray *restrict  s,
size_t  length 
)
inline

Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete the old one, if any.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

If s is null on entry a new array is returned, if possible, otherwise a null pointer is returned.

If s is non-null and cannot be grown, s is returned unchanged.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References capacity, ellipsis‿sarray‿grow‿_Insta(), ellipsis‿sarray‿grow(), ELLIPSIS_CONTRACT, and length.

Referenced by ellipsis‿sarray‿grow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿move()

void ellipsis‿sarray‿move ( ellipsis‿sarray __LOC_ID_0_1[restrict static 1],
ellipsis‿sarray **restrict  __LOC_ID_0_2 
)
inline

Move a ellipsis‿sarray pointed to by the second parameter to the one pointed to by the first.

If target is not null before, the old pointed-to object is deleted.

References ellipsis‿sarray‿delete().

Here is the call graph for this function:

◆ ellipsis‿sarray‿remove()

ellipsis‿sarray * ellipsis‿sarray‿remove ( ellipsis‿sarray  s[restrict static 1],
size_t   
)

Remove (at most) the indicated amount of elements from the ellipsis‿sarray return a new one and delete s.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

This synthesizes and uses a function ellipsis‿sarray‿base‿destroy on the removed elements, setting the byte representation of the pointed-to elements to 0.

References ELLIPSIS_CONTRACT.

◆ ellipsis‿sarray‿search()

ellipsis‿sarray‿base const * ellipsis‿sarray‿search ( ellipsis‿sarray‿base const  el[static 1],
ellipsis‿sarray const *  p,
size_t  offs,
size_t  len 
)
inline

search for an element in a ellipsis‿sarray

The same restrictions for offs and len hold as for ellipsis‿sarray‿sort.

The return is the same as for the bsearch C library feature.

References array, ellipsis‿sarray‿compareInternal(), and length.

Here is the call graph for this function:

◆ ellipsis‿sarray‿shrink‿_Ctra()

ellipsis‿sarray * ellipsis‿sarray‿shrink‿_Ctra ( ellipsis‿sarray  s[restrict static 1],
size_t  length 
)
inline

Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete the old one, if any.

If the requested length is larger than the current, s is unchanged and is returned.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

Use this function to reduce the memory footprint if you find that necessary once you know that the used length of your array will remain stable.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References capacity, ellipsis‿sarray‿shrink‿_Ctra(), ellipsis‿sarray‿shrink‿_Inner(), ELLIPSIS_CONTRACT, and length.

Referenced by ellipsis‿sarray‿shrink‿_Ctra().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿shrink‿_Insta()

ellipsis‿sarray * ellipsis‿sarray‿shrink‿_Insta ( ellipsis‿sarray  s[restrict static 1],
size_t  length 
)
inline

Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete the old one, if any.

If the requested length is larger than the current, s is unchanged and is returned.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

Use this function to reduce the memory footprint if you find that necessary once you know that the used length of your array will remain stable.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

Referenced by ellipsis‿sarray‿shrink().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿shrink()

ellipsis‿sarray * ellipsis‿sarray‿shrink ( ellipsis‿sarray  s[restrict static 1],
size_t  length 
)
inline

Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete the old one, if any.

If the requested length is larger than the current, s is unchanged and is returned.

*s may or not be replaced to an new object for internal maintenance reasons. Do not expect it to remain the same and update the pointers you are holding to it.

Use this function to reduce the memory footprint if you find that necessary once you know that the used length of your array will remain stable.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References capacity, ellipsis‿sarray‿shrink‿_Insta(), ellipsis‿sarray‿shrink(), ELLIPSIS_CONTRACT, and length.

Referenced by ellipsis‿sarray‿shrink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿sort()

void ellipsis‿sarray‿sort ( ellipsis‿sarray p,
size_t  offs,
size_t  len 
)
inline

sort a ellipsis‿sarray in place.

Sort array of length len starting from offs according to comparison function ellipsis‿sarray‿base‿compare.

  • If offs is outside the range, nothing is done.
  • len is adjusted to the minimum of len and ellipsis‿sarray‿length-pos.
  • If len is zero, nothing is done.

References array, ellipsis‿sarray‿compareInternal(), and length.

Here is the call graph for this function:

◆ ellipsis‿sarray‿sub‿_Ctra()

ellipsis‿sarray * ellipsis‿sarray‿sub‿_Ctra ( ellipsis‿sarray const *restrict  s,
size_t  pos,
size_t  len 
)
inline

Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿sub‿_Ctra(), ellipsis‿sarray‿sub‿_Inner(), ELLIPSIS_CONTRACT, and length.

Referenced by ellipsis‿sarray‿sub‿_Ctra().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ellipsis‿sarray‿sub‿_Insta()

ellipsis‿sarray * ellipsis‿sarray‿sub‿_Insta ( ellipsis‿sarray const *restrict  s,
size_t  pos,
size_t  len 
)
inline

Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

end inner defer anchor, level 1

Referenced by ellipsis‿sarray‿sub().

Here is the caller graph for this function:

◆ ellipsis‿sarray‿sub()

ellipsis‿sarray * ellipsis‿sarray‿sub ( ellipsis‿sarray const *restrict  s,
size_t  pos,
size_t  len 
)
inline

Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.

If such a ellipsis‿sarray cannot be allocated, a null pointer is returned.

start inner defer anchor at level 1

DEFER_TYPE needs a semicolon

defer needs braces and a semicolon

end inner defer anchor, level 1

References ellipsis‿sarray‿sub‿_Insta(), ellipsis‿sarray‿sub(), ELLIPSIS_CONTRACT, and length.

Referenced by ellipsis‿sarray‿cpy(), and ellipsis‿sarray‿sub().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ ELLIPSIS_SARRAY_LITERAL_LOCAL

#define ELLIPSIS_SARRAY_LITERAL_LOCAL (   N,
  ... 
)
related
Value:
((static const ELLIPSIS_SARRAY_OVERLAY( \
sizeof((ellipsis‿sarray‿base[]){__VA_ARGS__ }) \
{\
.length = (N), \
.array = {__VA_ARGS__ }, \
}.fa)
#define ELLIPSIS_SARRAY_OVERLAY(N)
Definition ellipsis-sarray.h:177
ellipsis‿sarray‿base array[]
The current data array.
Definition ellipsis-sarray.h:174
size_t ellipsis‿sarray‿base
Definition ellipsis-sarray.h:16

Create a literal of type ellipsis‿sarray, where the array component is initialized with the arguments.

This results in an lvalue of type ellipsis‿sarray for an object that has static storage duration and that is const-qualified.

Most functions that are provided for ellipsis‿sarray need to be able to reallocate the structure, so they will produce an error on a literal that is created with this macro. A notable exception of this is ellipsis‿sarray‿delete which will just do nothing on such an object.

Remarks
Because of current restrictions in C23 that constexpr compound literals may not be of union type, this is not yet provided as constexpr.

Field Documentation

◆ array

◆ capacity

size_t const capacity
private

Maximal length of this instance.

Also serves to encode the fact that a ellipsis‿sarray is statically allocated. Do not mess with it.

Referenced by ellipsis‿sarray‿concat_inplace‿_Inner(), ellipsis‿sarray‿grow‿_Ctra(), ellipsis‿sarray‿grow(), ellipsis‿sarray‿shrink‿_Ctra(), and ellipsis‿sarray‿shrink().

◆ length

◆ length_mod

size_t length_mod
private

The documentation for this struct was generated from the following files: