~ubuntu-branches/ubuntu/trusty/ocamlnet/trusty

« back to all changes in this revision

Viewing changes to src/netcgi2-apache/handler.c

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-09-02 14:12:33 UTC
  • mfrom: (18.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110902141233-zbj0ygxb92u6gy4z
Tags: 3.4-1
* New upstream release
  - add a new NetcgiRequire directive to ease dependency management
    (Closes: #637147)
  - remove patches that were applied upstream:
    + Added-missing-shebang-lines-in-example-shell-scripts
    + Try-also-ocamlc-for-POSIX-threads

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
 
63
63
static void init (void)
64
64
{
 
65
  /* The doc says that argv[0] and argv[1] are consulted to find the
 
66
   * file containing the bytecode. */
65
67
  static char *argv[] = {
66
68
    APACHE_LIBDIR "/mod_netcgi_apache.so",
67
69
    APACHE_LIBDIR "/mod_netcgi_apache.so",
268
270
 * Commands
269
271
 */
270
272
 
271
 
static const char *
272
 
cmd_load (cmd_parms *parms, void *dummy, const char *filename)
273
 
{
274
 
  static value *f = NULL;
275
 
  value arg = copy_string (filename);
276
 
  value exn;
277
 
  if (f == NULL) f = caml_named_value("netcgi2_apache_cmd_load");
278
 
  exn = callback_exn(*f, arg);
279
 
  if (Is_exception_result (exn))
280
 
    /* FIXME: ap_pstrdup into pool? */
281
 
    return caml_format_exception (Extract_exception (exn));
282
 
  return NULL;
 
273
#define MAKE_SIMPLE_CMD(name)                                          \
 
274
static const char *                                                    \
 
275
name (cmd_parms *parms, void *dummy, const char *strarg)               \
 
276
{                                                                      \
 
277
  static value *f = NULL;                                              \
 
278
  value arg = copy_string (strarg);                                    \
 
279
  value exn;                                                           \
 
280
  if (f == NULL) f = caml_named_value("netcgi2_apache_" #name);        \
 
281
  exn = callback_exn(*f, arg);                                         \
 
282
  if (Is_exception_result (exn))                                       \
 
283
    /* FIXME: ap_pstrdup into pool? */                                 \
 
284
    return caml_format_exception (Extract_exception (exn));            \
 
285
  return NULL;                                                         \
283
286
}
284
287
 
 
288
MAKE_SIMPLE_CMD(cmd_load)
 
289
MAKE_SIMPLE_CMD(cmd_require)
 
290
MAKE_SIMPLE_CMD(cmd_thread)
 
291
MAKE_SIMPLE_CMD(cmd_predicates)
 
292
 
285
293
 
286
294
static const char *
287
295
cmd_translate_handler (cmd_parms *parms, void *dummy, const char *name)
337
345
                 NULL,
338
346
                 RSRC_CONF,
339
347
                 "load OCaml module"),
 
348
  AP_INIT_TAKE1 ("NetcgiRequire", cmd_require,
 
349
                 NULL,
 
350
                 RSRC_CONF,
 
351
                 "load OCaml package (findlib)"),
 
352
  AP_INIT_TAKE1 ("NetcgiThread", cmd_thread,
 
353
                 NULL,
 
354
                 RSRC_CONF,
 
355
                 "load OCaml threading support"),
 
356
  AP_INIT_TAKE1 ("NetcgiPredicates", cmd_predicates,
 
357
                 NULL,
 
358
                 RSRC_CONF,
 
359
                 "set findlib predicates for NetcgiRequire"),
340
360
  AP_INIT_TAKE1 ("NetcgiTranslateHandler", cmd_translate_handler,
341
361
                 NULL,
342
362
                 RSRC_CONF,