3 .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 .if !
\a\\$4
\a\a .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
7 .ie
\a\\$3
\a\a .ft \\$1
11 .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
16 .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
19 .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
22 .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
24 .de EX \" start example
47 .ta 1.0i 2.0i 3.0i 4.0i 5.0i
50 astsa \- standalone libast support
61 is a standalone subset of
80 if supported by the local system.
82 The macros and functions provided by
85 The other headers are described in
92 .Ss "size_t elementsof(\fIx\fP)"
93 Evaluates to the number of elements in the array variable
95 .Ss "\fItype\fP* newof(void* old, \fItype\fP, size_t \fIelements\fP, size_t \fIextra\fP)"
96 Equivalent to (\fItype\fP*)realloc((char*)\fIold\fP,sizeof(\fItype\fP)*\fIelements\fP+\fIextra\fP)
98 (\fItype\fP*)calloc(1,sizeof(\fItype\fP)*\fIelements\fP+\fIextra\fP)
100 .Ss "\fItype\fP* oldof(void* old, \fItype\fP, size_t \fIelements\fP, size_t \fIextra\fP)"
101 Equivalent to (\fItype\fP*)realloc((char*)\fIold\fP,sizeof(\fItype\fP)*\fIelements\fP+\fIextra\fP)
103 (\fItype\fP*)malloc(1,sizeof(\fItype\fP)*\fIelements\fP+\fIextra\fP)
105 .Ss "size_t roundof(\fIx\fP,\fIy\fP)"
106 Evaluates to \fIx\fP rounded up to the next power of 2 boundary \fIy\fP.
107 .Ss "int ssizeof(\fIx\fP)"
108 Equivalent to (int)sizeof(\fIx\fP).
109 .Ss "int streq(\fIa\fP,\fIb\fP)"
110 Equivalent to (*(\fIa\fP)==*(\fIb\fP)&&strcmp(\fIa\fP,\fIb\fP)==0).
111 .Ss "int strneq(\fIa\fP,\fIb\fP,\fIn\fP)"
112 Equivalent to (*(\fIa\fP)==*(\fIb\fP)&&strncmp(\fIa\fP,\fIb\fP,\fIn\fP)==0).
114 .Ss "void astwinsize(int \fIfd\fP, int* \fIplines\fP, int* \fIpcolumns\fP)"
115 If \fIplines\fP!=0 then *\fIplines\fP is set to the number of lines on the
116 tty device corresponding to \fIfd\fP.
117 If \fIpcolumns\fP!=0 then *\fIpcolumns\fP is set to the number of columns
118 on the tty device corresponding to \fIfd\fP.
119 The default if \fIfd\fP is not a terminal device, or if \fIfd\fP queries fail,
120 is 24 lines and 80 columns.
121 .Ss "char* fmterror(int \fIerrno\fP)"
122 Returns the error message text corresponding to the
125 .Ss "char* strerror(int \fIerrno\fP)"
126 Equivalent to fmterror(\fIerrno\fP).
127 .Ss "int strgrpmatch(const char* \fIstring\fP, const char* \fIpattern\fP, int* \fIsub\fP, int \fInsub\fP, int \fIflags\fP)"
128 Matches the null terminated \fIstring\fP against the null terminated
130 augmented \fIpattern\fP.
131 If \fIsub\fP!=0 then \fIsub\fP[2*\fIi\fP] is set to the start offset and \fIsub\fP[2*\fIi\fP+1] is set
132 to the end offset of the \fIi\fP-th parenthesized subexpression.
133 \fInsub\fP is 1/2 the number of elements in \fIsub\fP.
134 \fIflags\fP controls the matching:
138 The default is minimal (first) match.
141 Implicit left anchor.
144 Implicit right anchor.
150 (|&) inside [@|*|+{n,m}](...) only.
151 .Ss "int strmatch(const char* \fIstring\fP, const char* \fIpattern\fP, int* \fIsub\fP, int \fInsub\fP, int \fIflags\fP)"
152 Equivalent to strgrpmatch(\fIstring\fP,\fIpattern\fP,0,0,STR_MAXIMAL|STR_LEFT|STR_RIGHT).