zpmod  b19981f
High-performance Zsh module for script optimization and filesystem helpers
zpmod_imports.h
Go to the documentation of this file.
1 #pragma once
2 /* SPDX-License-Identifier: MIT */
3 /* Centralized imports for zsh-generated .epro prototypes and externs.
4  * Maintenance:
5  * - Only add a new .epro include here if you introduce usage of a symbol
6  * (function/variable/type) that causes a missing prototype/export at build.
7  * - Prefer relying on zsh's zsh.mdh when available; this header is the
8  * out-of-tree fallback aggregator for required .epro declarations.
9  */
10 #ifndef ZPMOD_ZSH_IMPORTS_H
11 #define ZPMOD_ZSH_IMPORTS_H
12 
13 #if defined(__has_include)
14 #if __has_include("builtin.epro")
15 #include "builtin.epro"
16 #endif
17 #if __has_include("module.epro")
18 #include "module.epro"
19 #endif
20 #if __has_include("params.epro")
21 #include "params.epro"
22 #endif
23 #if __has_include("mem.epro")
24 #include "mem.epro"
25 #endif
26 #if __has_include("string.epro")
27 #include "string.epro"
28 #endif
29 #if __has_include("hashtable.epro")
30 #include "hashtable.epro"
31 #endif
32 #if __has_include("options.epro")
33 #include "options.epro"
34 #endif
35 #if __has_include("parse.epro")
36 #include "parse.epro"
37 #endif
38 #if __has_include("input.epro")
39 #include "input.epro"
40 #endif
41 #if __has_include("jobs.epro")
42 #include "jobs.epro"
43 #endif
44 #if __has_include("prompt.epro")
45 #include "prompt.epro"
46 #endif
47 #if __has_include("loop.epro")
48 #include "loop.epro"
49 #endif
50 #if __has_include("init.epro")
51 #include "init.epro"
52 #endif
53 #if __has_include("utils.epro")
54 #include "utils.epro"
55 #endif
56 #if __has_include("signals.epro")
57 #include "signals.epro"
58 #endif
59 #if __has_include("signames.epro")
60 #include "signames.epro"
61 #endif
62 #endif /* __has_include */
63 
64 /* Fallback declarations for out-of-tree builds when zsh-generated .epro
65  * headers are not available in the include path. These are minimal
66  * prototypes sufficient for compilation; symbols are resolved at runtime
67  * by the hosting zsh.
68  */
69 #include <stddef.h>
70 
71 #if !defined(__has_include) || !__has_include("mem.epro")
72 void *zalloc(size_t size);
73 void zfree(void *ptr, size_t size);
74 void zsfree(char *ptr);
75 void *zrealloc(void *ptr, size_t size);
76 #endif
77 
78 #if !defined(__has_include) || !__has_include("string.epro")
79 char *ztrdup(const char *s);
80 char *dupstring(const char *s);
81 #endif
82 
83 #if !defined(__has_include) || !__has_include("utils.epro")
84 char *metafy(char *s, int len, int how);
85 char *unmetafy(char *s, int *len);
86 #endif
87 
88 #if !defined(__has_include) || !__has_include("params.epro")
89 char *getsparam(const char *name);
90 char **getaparam(const char *name);
91 void setsparam(const char *name, char *value);
92 void setaparam(const char *name, char **value);
93 void unsetparam(const char *name);
94 extern HashTable paramtab;
95 #endif
96 
97 #if !defined(__has_include) || !__has_include("hashtable.epro")
98 HashNode gethashnode2(HashTable ht, const char *name);
99 #endif
100 
101 #if !defined(__has_include) || !__has_include("options.epro")
102 int optlookup(const char *name);
103 #endif
104 
105 #if !defined(__has_include) || !__has_include("builtin.epro")
106 void zwarnnam(const char *cmd, const char *fmt, ...);
107 #endif
108 
109 #if !defined(__has_include) || !__has_include("module.epro")
110 /* Note: "Features" is a pointer typedef (struct features *). The real
111  * prototypes take a Features (pointer), not a pointer-to-pointer. */
112 char **featuresarray(Module m, Features features);
113 int handlefeatures(Module m, Features features, int **enables);
114 int setfeatureenables(Module m, Features features, int **enables);
115 #endif
116 
117 #endif /* ZPMOD_ZSH_IMPORTS_H */
void * Module
int setfeatureenables(Module m, Features features, int **enables)
char * unmetafy(char *s, int *len)
void * zalloc(size_t size)
void zsfree(char *ptr)
int handlefeatures(Module m, Features features, int **enables)
HashNode gethashnode2(HashTable ht, const char *name)
void unsetparam(const char *name)
char * dupstring(const char *s)
char * metafy(char *s, int len, int how)
void setaparam(const char *name, char **value)
void zfree(void *ptr, size_t size)
char ** getaparam(const char *name)
void setsparam(const char *name, char *value)
char * ztrdup(const char *s)
void * zrealloc(void *ptr, size_t size)
char ** featuresarray(Module m, Features features)
HashTable paramtab
int optlookup(const char *name)
void zwarnnam(const char *cmd, const char *fmt,...)
char * getsparam(const char *name)
struct hashtable * HashTable
struct features * Features
struct hashnode * HashNode