agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
vm_function_index.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 ykat UG (haftungsbeschraenkt) - All Rights Reserved
3  *
4  * Permission for non-commercial use is hereby granted,
5  * free of charge, without warranty of any kind.
6  */
7 #ifndef ZRTOS_VM_FUNCTION_INDEX_H
8 #define ZRTOS_VM_FUNCTION_INDEX_H
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 
14 #include <zrtos/types.h>
15 #include <zrtos/cast.h>
16 #include <zrtos/mem.h>
17 #include <zrtos/vm_function.h>
18 
19 //#define ZRTOS_VM_FUNCTION_INDEX__CFG_ENABLE_PROGMEM
20 #define ZRTOS_VM_FUNCTION_INDEX(name,...) \
21 zrtos_vm_function_t name[] = { \
22  __VA_ARGS__ \
23  ,{} \
24 };
25 
28  size_t length;
30 
34  ,size_t length
35 ){
36  thiz->arr = arr;
37  thiz->length = length;
38  return true;
39 }
40 
44 ){
45  zrtos_vm_function_t key = {
46  .id = id
47  };
48  return ZRTOS_CAST(
51  &key
52  ,thiz->arr
53  ,thiz->length
54  ,sizeof(zrtos_vm_function_t)
56  )
57  );
58 }
59 
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 #endif
struct _zrtos_vm_function_index_t zrtos_vm_function_index_t
#define ZRTOS_CAST(type, value)
Definition: cast.h:18
int zrtos_vm_function__cmp(const void *aa, const void *bb)
Definition: vm_function.h:38
size_t zrtos_vm_function_id_t
Definition: vm_function.h:17
void * zrtos_mem__search(const void *key, const void *base, size_t high, size_t size, int(*compar)(const void *, const void *))
Definition: mem.h:148
bool zrtos_vm_function_index__init(zrtos_vm_function_index_t *thiz, zrtos_vm_function_t *arr, size_t length)
zrtos_vm_function_t * arr
zrtos_vm_function_t * zrtos_vm_function_index__get_function(zrtos_vm_function_index_t *thiz, zrtos_vm_function_id_t id)
zrtos_vm_function_id_t id
Definition: vm_function.h:26