2 * Copyright (c) 2005, 2008 Sun Microsystems, Inc. All Rights Reserved.
3 * Use is subject to license terms.
5 * Copyright (c) 1984 AT&T
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0.
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
30 #include "apr_file_io.h"
32 #define SED_NLINES 256
34 #define SED_LABSIZE 50
35 #define SED_ABUFSIZE 20
37 typedef struct sed_reptr_s sed_reptr_t;
54 typedef struct sed_label_s sed_label_t;
62 typedef apr_status_t (sed_err_fn_t)(void *data, const char *error);
63 typedef apr_status_t (sed_write_fn_t)(void *ctx, char *buf, int sz);
65 typedef struct sed_commands_s sed_commands_t;
66 #define NWFILES 11 /* 10 plus one for standard output */
68 struct sed_commands_s {
86 apr_int64_t tlno[SED_NLINES];
93 sed_label_t ltab[SED_LABSIZE];
98 sed_reptr_t **cmpend[SED_DEPTH];
99 sed_reptr_t *ptrspace;
107 typedef struct sed_eval_s sed_eval_t;
111 sed_write_fn_t *writefn;
114 sed_commands_t *commands;
131 apr_file_t *fcode[NWFILES];
132 sed_reptr_t *abuf[SED_ABUFSIZE];
134 sed_reptr_t *pending;
151 apr_status_t sed_init_commands(sed_commands_t *commands, sed_err_fn_t *errfn, void *data,
153 apr_status_t sed_compile_string(sed_commands_t *commands, const char *s);
154 apr_status_t sed_compile_file(sed_commands_t *commands, apr_file_t *fin);
155 char* sed_get_finalize_error(const sed_commands_t *commands, apr_pool_t* pool);
156 int sed_canbe_finalized(const sed_commands_t *commands);
157 void sed_destroy_commands(sed_commands_t *commands);
159 apr_status_t sed_init_eval(sed_eval_t *eval, sed_commands_t *commands,
160 sed_err_fn_t *errfn, void *data,
161 sed_write_fn_t *writefn, apr_pool_t *p);
162 apr_status_t sed_reset_eval(sed_eval_t *eval, sed_commands_t *commands, sed_err_fn_t *errfn, void *data);
163 apr_status_t sed_eval_buffer(sed_eval_t *eval, const char *buf, int bufsz, void *fout);
164 apr_status_t sed_eval_file(sed_eval_t *eval, apr_file_t *fin, void *fout);
165 apr_status_t sed_finalize_eval(sed_eval_t *eval, void *f);
166 void sed_destroy_eval(sed_eval_t *eval);
172 #endif /* LIBSED_H */