diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-03-29 12:54:31 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-03-29 12:54:31 -0400 |
| commit | 04d9adc8138566eec5d6bf7b233a6c617306bcce (patch) | |
| tree | 8414c07e92cdd17613190cd6a8e179b2eed2f00c /builtins/array.h | |
| parent | d94053ca7768037016cbcacc4cadf843dad1bea6 (diff) | |
Switch naming convention to use '$' in symbols more
Diffstat (limited to 'builtins/array.h')
| -rw-r--r-- | builtins/array.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/builtins/array.h b/builtins/array.h index dad72b7e..98638222 100644 --- a/builtins/array.h +++ b/builtins/array.h @@ -15,15 +15,15 @@ const array_t $arr = arr_expr; int64_t $index = (int64_t)(index_expr); \ int64_t $off = $index + ($index < 0) * ($arr.length + 1) - 1; \ if (__builtin_expect($off < 0 || $off >= $arr.length, 0)) \ - fail_source(filename, start, end, "Invalid array index: %r (array has length %ld)\n", Int__as_text(&$index, USE_COLOR, NULL), $arr.length); \ + fail_source(filename, start, end, "Invalid array index: %r (array has length %ld)\n", Int$as_text(&$index, USE_COLOR, NULL), $arr.length); \ (item_type*)($arr.data + $arr.stride * $off);}) #define $Array_lvalue(item_type, arr_expr, index_expr, typeinfo, filename, start, end) { \ array_t *$arr = arr_expr; int64_t $index = (int64_t)(index_expr); \ int64_t $off = $index + ($index < 0) * ($arr->length + 1) - 1; \ if (__builtin_expect($off < 0 || $off >= $arr->length, 0)) \ - fail_source(filename, start, end, "Invalid array index: %r (array has length %ld)\n", Int__as_text(&$index, USE_COLOR, NULL), $arr->length); \ + fail_source(filename, start, end, "Invalid array index: %r (array has length %ld)\n", Int$as_text(&$index, USE_COLOR, NULL), $arr->length); \ if ($arr->data_refcount > 0) \ - Array__compact($arr, typeinfo); \ + Array$compact($arr, typeinfo); \ *(item_type*)($arr->data + $arr->stride * $off); } #define $Array_set(item_type, arr, index, value, typeinfo, filename, start, end) \ $Array_lvalue(item_type, arr_expr, index, typeinfo, filename, start, end) = value @@ -52,22 +52,22 @@ #define $ARRAY_INCREF(arr) (arr).data_refcount |= ((arr).data_refcount << 1) | 1 #define $ARRAY_DECREF(arr) (arr).data_refcount &= 2 -#define Array__insert_value(arr, item_expr, index, type) ({ __typeof(item_expr) $item = item_expr; Array__insert(arr, &$item, index, type); }) -void Array__insert(array_t *arr, const void *item, int64_t index, const TypeInfo *type); -void Array__insert_all(array_t *arr, array_t to_insert, int64_t index, const TypeInfo *type); -void Array__remove(array_t *arr, int64_t index, int64_t count, const TypeInfo *type); -void Array__sort(array_t *arr, const TypeInfo *type); -void Array__shuffle(array_t *arr, const TypeInfo *type); -void *Array__random(array_t arr); -void Array__clear(array_t *array); -void Array__compact(array_t *arr, const TypeInfo *type); -bool Array__contains(array_t array, void *item, const TypeInfo *type); -array_t Array__slice(array_t *array, int64_t first, int64_t length, int64_t stride, const TypeInfo *type); -array_t Array__reversed(array_t array); -array_t Array__concat(array_t x, array_t y, const TypeInfo *type); -uint32_t Array__hash(const array_t *arr, const TypeInfo *type); -int32_t Array__compare(const array_t *x, const array_t *y, const TypeInfo *type); -bool Array__equal(const array_t *x, const array_t *y, const TypeInfo *type); -CORD Array__as_text(const array_t *arr, bool colorize, const TypeInfo *type); +#define Array$insert_value(arr, item_expr, index, type) ({ __typeof(item_expr) $item = item_expr; Array$insert(arr, &$item, index, type); }) +void Array$insert(array_t *arr, const void *item, int64_t index, const TypeInfo *type); +void Array$insert_all(array_t *arr, array_t to_insert, int64_t index, const TypeInfo *type); +void Array$remove(array_t *arr, int64_t index, int64_t count, const TypeInfo *type); +void Array$sort(array_t *arr, const TypeInfo *type); +void Array$shuffle(array_t *arr, const TypeInfo *type); +void *Array$random(array_t arr); +void Array$clear(array_t *array); +void Array$compact(array_t *arr, const TypeInfo *type); +bool Array$contains(array_t array, void *item, const TypeInfo *type); +array_t Array$slice(array_t *array, int64_t first, int64_t length, int64_t stride, const TypeInfo *type); +array_t Array$reversed(array_t array); +array_t Array$concat(array_t x, array_t y, const TypeInfo *type); +uint32_t Array$hash(const array_t *arr, const TypeInfo *type); +int32_t Array$compare(const array_t *x, const array_t *y, const TypeInfo *type); +bool Array$equal(const array_t *x, const array_t *y, const TypeInfo *type); +CORD Array$as_text(const array_t *arr, bool colorize, const TypeInfo *type); // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 |
