From 22c48ce04f56787835149a98c3ed25e0655165c6 Mon Sep 17 00:00:00 2001 From: Vincent Balat Date: Fri, 27 Mar 2026 15:27:13 +0100 Subject: [PATCH 01/41] Rename user-facing source files: remove eliom_ prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pure file renames, no content changes. For example: eliom_service.server.ml → service.server.ml eliom_content.eliom → content.eliom Files NOT renamed (name conflicts with Stdlib/external libs): eliom_form (conflicts with Js_of_ocaml.Form) eliom_lazy (conflicts with Stdlib.Lazy) eliom_react (conflicts with react library) eliom_uri (conflicts with uri library) Internal modules also kept unchanged: eliom_common, eliom_types, eliom_runtime, *_base, *_core, etc. This commit does not compile: reference updates follow. --- src/lib/{eliom_bus.client.ml => bus.client.ml} | 0 src/lib/{eliom_bus.client.mli => bus.client.mli} | 0 src/lib/{eliom_bus.server.ml => bus.server.ml} | 0 src/lib/{eliom_bus.server.mli => bus.server.mli} | 0 src/lib/{eliom_client.client.ml => client.client.ml} | 0 src/lib/{eliom_client.client.mli => client.client.mli} | 0 src/lib/{eliom_client.server.ml => client.server.ml} | 0 src/lib/{eliom_client.server.mli => client.server.mli} | 0 src/lib/{eliom_comet.client.ml => comet.client.ml} | 0 src/lib/{eliom_comet.client.mli => comet.client.mli} | 0 src/lib/{eliom_comet.server.ml => comet.server.ml} | 0 src/lib/{eliom_comet.server.mli => comet.server.mli} | 0 src/lib/{eliom_config.client.ml => config.client.ml} | 0 src/lib/{eliom_config.client.mli => config.client.mli} | 0 src/lib/{eliom_config.server.ml => config.server.ml} | 0 src/lib/{eliom_config.server.mli => config.server.mli} | 0 src/lib/{eliom_content.client.mli => content.client.mli} | 0 src/lib/{eliom_content.eliom => content.eliom} | 0 src/lib/{eliom_content.server.mli => content.server.mli} | 0 .../{eliom_content_sigs.shared.mli => content_sigs.shared.mli} | 0 src/lib/{eliom_cscache.eliom => cscache.eliom} | 0 src/lib/{eliom_cscache.eliomi => cscache.eliomi} | 0 src/lib/{eliom_extension.server.ml => extension.server.ml} | 0 src/lib/{eliom_extension.server.mli => extension.server.mli} | 0 src/lib/{eliom_form_sigs.shared.mli => form_sigs.shared.mli} | 0 src/lib/{eliom_lib.client.ml => lib.client.ml} | 0 src/lib/{eliom_lib.client.mli => lib.client.mli} | 0 src/lib/{eliom_lib.server.ml => lib.server.ml} | 0 src/lib/{eliom_lib.server.mli => lib.server.mli} | 0 src/lib/{eliom_mkreg.server.ml => mkreg.server.ml} | 0 src/lib/{eliom_mkreg.server.mli => mkreg.server.mli} | 0 src/lib/{eliom_notif.server.ml => notif.server.ml} | 0 src/lib/{eliom_notif.server.mli => notif.server.mli} | 0 src/lib/{eliom_parameter.client.ml => parameter.client.ml} | 0 src/lib/{eliom_parameter.client.mli => parameter.client.mli} | 0 src/lib/{eliom_parameter.server.ml => parameter.server.ml} | 0 src/lib/{eliom_parameter.server.mli => parameter.server.mli} | 0 ...{eliom_parameter_sigs.shared.mli => parameter_sigs.shared.mli} | 0 src/lib/{eliom_reference.server.ml => reference.server.ml} | 0 src/lib/{eliom_reference.server.mli => reference.server.mli} | 0 src/lib/{eliom_registration.client.ml => registration.client.ml} | 0 .../{eliom_registration.client.mli => registration.client.mli} | 0 src/lib/{eliom_registration.server.ml => registration.server.ml} | 0 .../{eliom_registration.server.mli => registration.server.mli} | 0 ..._registration_sigs.shared.mli => registration_sigs.shared.mli} | 0 src/lib/{eliom_request.client.ml => request.client.ml} | 0 src/lib/{eliom_request.client.mli => request.client.mli} | 0 src/lib/{eliom_request_info.client.ml => request_info.client.ml} | 0 .../{eliom_request_info.client.mli => request_info.client.mli} | 0 src/lib/{eliom_request_info.server.ml => request_info.server.ml} | 0 .../{eliom_request_info.server.mli => request_info.server.mli} | 0 src/lib/{eliom_route.client.ml => route.client.ml} | 0 src/lib/{eliom_route.server.ml => route.server.ml} | 0 src/lib/{eliom_route.server.mli => route.server.mli} | 0 src/lib/{eliom_service.client.ml => service.client.ml} | 0 src/lib/{eliom_service.client.mli => service.client.mli} | 0 src/lib/{eliom_service.server.ml => service.server.ml} | 0 src/lib/{eliom_service.server.mli => service.server.mli} | 0 .../{eliom_service_sigs.shared.mli => service_sigs.shared.mli} | 0 src/lib/{eliom_shared.client.mli => shared.client.mli} | 0 src/lib/{eliom_shared.eliom => shared.eliom} | 0 src/lib/{eliom_shared.server.mli => shared.server.mli} | 0 src/lib/{eliom_shared_content.eliom => shared_content.eliom} | 0 src/lib/{eliom_shared_content.eliomi => shared_content.eliomi} | 0 src/lib/{eliom_shared_sigs.shared.mli => shared_sigs.shared.mli} | 0 src/lib/{eliom_state.server.ml => state.server.ml} | 0 src/lib/{eliom_state.server.mli => state.server.mli} | 0 src/lib/{eliom_tools.eliom => tools.eliom} | 0 src/lib/{eliom_tools.eliomi => tools.eliomi} | 0 src/lib/{eliom_unwrap.client.ml => unwrap.client.ml} | 0 src/lib/{eliom_unwrap.client.mli => unwrap.client.mli} | 0 src/lib/{eliom_wrap.client.mli => wrap.client.mli} | 0 src/lib/{eliom_wrap.server.ml => wrap.server.ml} | 0 src/lib/{eliom_wrap.server.mli => wrap.server.mli} | 0 74 files changed, 0 insertions(+), 0 deletions(-) rename src/lib/{eliom_bus.client.ml => bus.client.ml} (100%) rename src/lib/{eliom_bus.client.mli => bus.client.mli} (100%) rename src/lib/{eliom_bus.server.ml => bus.server.ml} (100%) rename src/lib/{eliom_bus.server.mli => bus.server.mli} (100%) rename src/lib/{eliom_client.client.ml => client.client.ml} (100%) rename src/lib/{eliom_client.client.mli => client.client.mli} (100%) rename src/lib/{eliom_client.server.ml => client.server.ml} (100%) rename src/lib/{eliom_client.server.mli => client.server.mli} (100%) rename src/lib/{eliom_comet.client.ml => comet.client.ml} (100%) rename src/lib/{eliom_comet.client.mli => comet.client.mli} (100%) rename src/lib/{eliom_comet.server.ml => comet.server.ml} (100%) rename src/lib/{eliom_comet.server.mli => comet.server.mli} (100%) rename src/lib/{eliom_config.client.ml => config.client.ml} (100%) rename src/lib/{eliom_config.client.mli => config.client.mli} (100%) rename src/lib/{eliom_config.server.ml => config.server.ml} (100%) rename src/lib/{eliom_config.server.mli => config.server.mli} (100%) rename src/lib/{eliom_content.client.mli => content.client.mli} (100%) rename src/lib/{eliom_content.eliom => content.eliom} (100%) rename src/lib/{eliom_content.server.mli => content.server.mli} (100%) rename src/lib/{eliom_content_sigs.shared.mli => content_sigs.shared.mli} (100%) rename src/lib/{eliom_cscache.eliom => cscache.eliom} (100%) rename src/lib/{eliom_cscache.eliomi => cscache.eliomi} (100%) rename src/lib/{eliom_extension.server.ml => extension.server.ml} (100%) rename src/lib/{eliom_extension.server.mli => extension.server.mli} (100%) rename src/lib/{eliom_form_sigs.shared.mli => form_sigs.shared.mli} (100%) rename src/lib/{eliom_lib.client.ml => lib.client.ml} (100%) rename src/lib/{eliom_lib.client.mli => lib.client.mli} (100%) rename src/lib/{eliom_lib.server.ml => lib.server.ml} (100%) rename src/lib/{eliom_lib.server.mli => lib.server.mli} (100%) rename src/lib/{eliom_mkreg.server.ml => mkreg.server.ml} (100%) rename src/lib/{eliom_mkreg.server.mli => mkreg.server.mli} (100%) rename src/lib/{eliom_notif.server.ml => notif.server.ml} (100%) rename src/lib/{eliom_notif.server.mli => notif.server.mli} (100%) rename src/lib/{eliom_parameter.client.ml => parameter.client.ml} (100%) rename src/lib/{eliom_parameter.client.mli => parameter.client.mli} (100%) rename src/lib/{eliom_parameter.server.ml => parameter.server.ml} (100%) rename src/lib/{eliom_parameter.server.mli => parameter.server.mli} (100%) rename src/lib/{eliom_parameter_sigs.shared.mli => parameter_sigs.shared.mli} (100%) rename src/lib/{eliom_reference.server.ml => reference.server.ml} (100%) rename src/lib/{eliom_reference.server.mli => reference.server.mli} (100%) rename src/lib/{eliom_registration.client.ml => registration.client.ml} (100%) rename src/lib/{eliom_registration.client.mli => registration.client.mli} (100%) rename src/lib/{eliom_registration.server.ml => registration.server.ml} (100%) rename src/lib/{eliom_registration.server.mli => registration.server.mli} (100%) rename src/lib/{eliom_registration_sigs.shared.mli => registration_sigs.shared.mli} (100%) rename src/lib/{eliom_request.client.ml => request.client.ml} (100%) rename src/lib/{eliom_request.client.mli => request.client.mli} (100%) rename src/lib/{eliom_request_info.client.ml => request_info.client.ml} (100%) rename src/lib/{eliom_request_info.client.mli => request_info.client.mli} (100%) rename src/lib/{eliom_request_info.server.ml => request_info.server.ml} (100%) rename src/lib/{eliom_request_info.server.mli => request_info.server.mli} (100%) rename src/lib/{eliom_route.client.ml => route.client.ml} (100%) rename src/lib/{eliom_route.server.ml => route.server.ml} (100%) rename src/lib/{eliom_route.server.mli => route.server.mli} (100%) rename src/lib/{eliom_service.client.ml => service.client.ml} (100%) rename src/lib/{eliom_service.client.mli => service.client.mli} (100%) rename src/lib/{eliom_service.server.ml => service.server.ml} (100%) rename src/lib/{eliom_service.server.mli => service.server.mli} (100%) rename src/lib/{eliom_service_sigs.shared.mli => service_sigs.shared.mli} (100%) rename src/lib/{eliom_shared.client.mli => shared.client.mli} (100%) rename src/lib/{eliom_shared.eliom => shared.eliom} (100%) rename src/lib/{eliom_shared.server.mli => shared.server.mli} (100%) rename src/lib/{eliom_shared_content.eliom => shared_content.eliom} (100%) rename src/lib/{eliom_shared_content.eliomi => shared_content.eliomi} (100%) rename src/lib/{eliom_shared_sigs.shared.mli => shared_sigs.shared.mli} (100%) rename src/lib/{eliom_state.server.ml => state.server.ml} (100%) rename src/lib/{eliom_state.server.mli => state.server.mli} (100%) rename src/lib/{eliom_tools.eliom => tools.eliom} (100%) rename src/lib/{eliom_tools.eliomi => tools.eliomi} (100%) rename src/lib/{eliom_unwrap.client.ml => unwrap.client.ml} (100%) rename src/lib/{eliom_unwrap.client.mli => unwrap.client.mli} (100%) rename src/lib/{eliom_wrap.client.mli => wrap.client.mli} (100%) rename src/lib/{eliom_wrap.server.ml => wrap.server.ml} (100%) rename src/lib/{eliom_wrap.server.mli => wrap.server.mli} (100%) diff --git a/src/lib/eliom_bus.client.ml b/src/lib/bus.client.ml similarity index 100% rename from src/lib/eliom_bus.client.ml rename to src/lib/bus.client.ml diff --git a/src/lib/eliom_bus.client.mli b/src/lib/bus.client.mli similarity index 100% rename from src/lib/eliom_bus.client.mli rename to src/lib/bus.client.mli diff --git a/src/lib/eliom_bus.server.ml b/src/lib/bus.server.ml similarity index 100% rename from src/lib/eliom_bus.server.ml rename to src/lib/bus.server.ml diff --git a/src/lib/eliom_bus.server.mli b/src/lib/bus.server.mli similarity index 100% rename from src/lib/eliom_bus.server.mli rename to src/lib/bus.server.mli diff --git a/src/lib/eliom_client.client.ml b/src/lib/client.client.ml similarity index 100% rename from src/lib/eliom_client.client.ml rename to src/lib/client.client.ml diff --git a/src/lib/eliom_client.client.mli b/src/lib/client.client.mli similarity index 100% rename from src/lib/eliom_client.client.mli rename to src/lib/client.client.mli diff --git a/src/lib/eliom_client.server.ml b/src/lib/client.server.ml similarity index 100% rename from src/lib/eliom_client.server.ml rename to src/lib/client.server.ml diff --git a/src/lib/eliom_client.server.mli b/src/lib/client.server.mli similarity index 100% rename from src/lib/eliom_client.server.mli rename to src/lib/client.server.mli diff --git a/src/lib/eliom_comet.client.ml b/src/lib/comet.client.ml similarity index 100% rename from src/lib/eliom_comet.client.ml rename to src/lib/comet.client.ml diff --git a/src/lib/eliom_comet.client.mli b/src/lib/comet.client.mli similarity index 100% rename from src/lib/eliom_comet.client.mli rename to src/lib/comet.client.mli diff --git a/src/lib/eliom_comet.server.ml b/src/lib/comet.server.ml similarity index 100% rename from src/lib/eliom_comet.server.ml rename to src/lib/comet.server.ml diff --git a/src/lib/eliom_comet.server.mli b/src/lib/comet.server.mli similarity index 100% rename from src/lib/eliom_comet.server.mli rename to src/lib/comet.server.mli diff --git a/src/lib/eliom_config.client.ml b/src/lib/config.client.ml similarity index 100% rename from src/lib/eliom_config.client.ml rename to src/lib/config.client.ml diff --git a/src/lib/eliom_config.client.mli b/src/lib/config.client.mli similarity index 100% rename from src/lib/eliom_config.client.mli rename to src/lib/config.client.mli diff --git a/src/lib/eliom_config.server.ml b/src/lib/config.server.ml similarity index 100% rename from src/lib/eliom_config.server.ml rename to src/lib/config.server.ml diff --git a/src/lib/eliom_config.server.mli b/src/lib/config.server.mli similarity index 100% rename from src/lib/eliom_config.server.mli rename to src/lib/config.server.mli diff --git a/src/lib/eliom_content.client.mli b/src/lib/content.client.mli similarity index 100% rename from src/lib/eliom_content.client.mli rename to src/lib/content.client.mli diff --git a/src/lib/eliom_content.eliom b/src/lib/content.eliom similarity index 100% rename from src/lib/eliom_content.eliom rename to src/lib/content.eliom diff --git a/src/lib/eliom_content.server.mli b/src/lib/content.server.mli similarity index 100% rename from src/lib/eliom_content.server.mli rename to src/lib/content.server.mli diff --git a/src/lib/eliom_content_sigs.shared.mli b/src/lib/content_sigs.shared.mli similarity index 100% rename from src/lib/eliom_content_sigs.shared.mli rename to src/lib/content_sigs.shared.mli diff --git a/src/lib/eliom_cscache.eliom b/src/lib/cscache.eliom similarity index 100% rename from src/lib/eliom_cscache.eliom rename to src/lib/cscache.eliom diff --git a/src/lib/eliom_cscache.eliomi b/src/lib/cscache.eliomi similarity index 100% rename from src/lib/eliom_cscache.eliomi rename to src/lib/cscache.eliomi diff --git a/src/lib/eliom_extension.server.ml b/src/lib/extension.server.ml similarity index 100% rename from src/lib/eliom_extension.server.ml rename to src/lib/extension.server.ml diff --git a/src/lib/eliom_extension.server.mli b/src/lib/extension.server.mli similarity index 100% rename from src/lib/eliom_extension.server.mli rename to src/lib/extension.server.mli diff --git a/src/lib/eliom_form_sigs.shared.mli b/src/lib/form_sigs.shared.mli similarity index 100% rename from src/lib/eliom_form_sigs.shared.mli rename to src/lib/form_sigs.shared.mli diff --git a/src/lib/eliom_lib.client.ml b/src/lib/lib.client.ml similarity index 100% rename from src/lib/eliom_lib.client.ml rename to src/lib/lib.client.ml diff --git a/src/lib/eliom_lib.client.mli b/src/lib/lib.client.mli similarity index 100% rename from src/lib/eliom_lib.client.mli rename to src/lib/lib.client.mli diff --git a/src/lib/eliom_lib.server.ml b/src/lib/lib.server.ml similarity index 100% rename from src/lib/eliom_lib.server.ml rename to src/lib/lib.server.ml diff --git a/src/lib/eliom_lib.server.mli b/src/lib/lib.server.mli similarity index 100% rename from src/lib/eliom_lib.server.mli rename to src/lib/lib.server.mli diff --git a/src/lib/eliom_mkreg.server.ml b/src/lib/mkreg.server.ml similarity index 100% rename from src/lib/eliom_mkreg.server.ml rename to src/lib/mkreg.server.ml diff --git a/src/lib/eliom_mkreg.server.mli b/src/lib/mkreg.server.mli similarity index 100% rename from src/lib/eliom_mkreg.server.mli rename to src/lib/mkreg.server.mli diff --git a/src/lib/eliom_notif.server.ml b/src/lib/notif.server.ml similarity index 100% rename from src/lib/eliom_notif.server.ml rename to src/lib/notif.server.ml diff --git a/src/lib/eliom_notif.server.mli b/src/lib/notif.server.mli similarity index 100% rename from src/lib/eliom_notif.server.mli rename to src/lib/notif.server.mli diff --git a/src/lib/eliom_parameter.client.ml b/src/lib/parameter.client.ml similarity index 100% rename from src/lib/eliom_parameter.client.ml rename to src/lib/parameter.client.ml diff --git a/src/lib/eliom_parameter.client.mli b/src/lib/parameter.client.mli similarity index 100% rename from src/lib/eliom_parameter.client.mli rename to src/lib/parameter.client.mli diff --git a/src/lib/eliom_parameter.server.ml b/src/lib/parameter.server.ml similarity index 100% rename from src/lib/eliom_parameter.server.ml rename to src/lib/parameter.server.ml diff --git a/src/lib/eliom_parameter.server.mli b/src/lib/parameter.server.mli similarity index 100% rename from src/lib/eliom_parameter.server.mli rename to src/lib/parameter.server.mli diff --git a/src/lib/eliom_parameter_sigs.shared.mli b/src/lib/parameter_sigs.shared.mli similarity index 100% rename from src/lib/eliom_parameter_sigs.shared.mli rename to src/lib/parameter_sigs.shared.mli diff --git a/src/lib/eliom_reference.server.ml b/src/lib/reference.server.ml similarity index 100% rename from src/lib/eliom_reference.server.ml rename to src/lib/reference.server.ml diff --git a/src/lib/eliom_reference.server.mli b/src/lib/reference.server.mli similarity index 100% rename from src/lib/eliom_reference.server.mli rename to src/lib/reference.server.mli diff --git a/src/lib/eliom_registration.client.ml b/src/lib/registration.client.ml similarity index 100% rename from src/lib/eliom_registration.client.ml rename to src/lib/registration.client.ml diff --git a/src/lib/eliom_registration.client.mli b/src/lib/registration.client.mli similarity index 100% rename from src/lib/eliom_registration.client.mli rename to src/lib/registration.client.mli diff --git a/src/lib/eliom_registration.server.ml b/src/lib/registration.server.ml similarity index 100% rename from src/lib/eliom_registration.server.ml rename to src/lib/registration.server.ml diff --git a/src/lib/eliom_registration.server.mli b/src/lib/registration.server.mli similarity index 100% rename from src/lib/eliom_registration.server.mli rename to src/lib/registration.server.mli diff --git a/src/lib/eliom_registration_sigs.shared.mli b/src/lib/registration_sigs.shared.mli similarity index 100% rename from src/lib/eliom_registration_sigs.shared.mli rename to src/lib/registration_sigs.shared.mli diff --git a/src/lib/eliom_request.client.ml b/src/lib/request.client.ml similarity index 100% rename from src/lib/eliom_request.client.ml rename to src/lib/request.client.ml diff --git a/src/lib/eliom_request.client.mli b/src/lib/request.client.mli similarity index 100% rename from src/lib/eliom_request.client.mli rename to src/lib/request.client.mli diff --git a/src/lib/eliom_request_info.client.ml b/src/lib/request_info.client.ml similarity index 100% rename from src/lib/eliom_request_info.client.ml rename to src/lib/request_info.client.ml diff --git a/src/lib/eliom_request_info.client.mli b/src/lib/request_info.client.mli similarity index 100% rename from src/lib/eliom_request_info.client.mli rename to src/lib/request_info.client.mli diff --git a/src/lib/eliom_request_info.server.ml b/src/lib/request_info.server.ml similarity index 100% rename from src/lib/eliom_request_info.server.ml rename to src/lib/request_info.server.ml diff --git a/src/lib/eliom_request_info.server.mli b/src/lib/request_info.server.mli similarity index 100% rename from src/lib/eliom_request_info.server.mli rename to src/lib/request_info.server.mli diff --git a/src/lib/eliom_route.client.ml b/src/lib/route.client.ml similarity index 100% rename from src/lib/eliom_route.client.ml rename to src/lib/route.client.ml diff --git a/src/lib/eliom_route.server.ml b/src/lib/route.server.ml similarity index 100% rename from src/lib/eliom_route.server.ml rename to src/lib/route.server.ml diff --git a/src/lib/eliom_route.server.mli b/src/lib/route.server.mli similarity index 100% rename from src/lib/eliom_route.server.mli rename to src/lib/route.server.mli diff --git a/src/lib/eliom_service.client.ml b/src/lib/service.client.ml similarity index 100% rename from src/lib/eliom_service.client.ml rename to src/lib/service.client.ml diff --git a/src/lib/eliom_service.client.mli b/src/lib/service.client.mli similarity index 100% rename from src/lib/eliom_service.client.mli rename to src/lib/service.client.mli diff --git a/src/lib/eliom_service.server.ml b/src/lib/service.server.ml similarity index 100% rename from src/lib/eliom_service.server.ml rename to src/lib/service.server.ml diff --git a/src/lib/eliom_service.server.mli b/src/lib/service.server.mli similarity index 100% rename from src/lib/eliom_service.server.mli rename to src/lib/service.server.mli diff --git a/src/lib/eliom_service_sigs.shared.mli b/src/lib/service_sigs.shared.mli similarity index 100% rename from src/lib/eliom_service_sigs.shared.mli rename to src/lib/service_sigs.shared.mli diff --git a/src/lib/eliom_shared.client.mli b/src/lib/shared.client.mli similarity index 100% rename from src/lib/eliom_shared.client.mli rename to src/lib/shared.client.mli diff --git a/src/lib/eliom_shared.eliom b/src/lib/shared.eliom similarity index 100% rename from src/lib/eliom_shared.eliom rename to src/lib/shared.eliom diff --git a/src/lib/eliom_shared.server.mli b/src/lib/shared.server.mli similarity index 100% rename from src/lib/eliom_shared.server.mli rename to src/lib/shared.server.mli diff --git a/src/lib/eliom_shared_content.eliom b/src/lib/shared_content.eliom similarity index 100% rename from src/lib/eliom_shared_content.eliom rename to src/lib/shared_content.eliom diff --git a/src/lib/eliom_shared_content.eliomi b/src/lib/shared_content.eliomi similarity index 100% rename from src/lib/eliom_shared_content.eliomi rename to src/lib/shared_content.eliomi diff --git a/src/lib/eliom_shared_sigs.shared.mli b/src/lib/shared_sigs.shared.mli similarity index 100% rename from src/lib/eliom_shared_sigs.shared.mli rename to src/lib/shared_sigs.shared.mli diff --git a/src/lib/eliom_state.server.ml b/src/lib/state.server.ml similarity index 100% rename from src/lib/eliom_state.server.ml rename to src/lib/state.server.ml diff --git a/src/lib/eliom_state.server.mli b/src/lib/state.server.mli similarity index 100% rename from src/lib/eliom_state.server.mli rename to src/lib/state.server.mli diff --git a/src/lib/eliom_tools.eliom b/src/lib/tools.eliom similarity index 100% rename from src/lib/eliom_tools.eliom rename to src/lib/tools.eliom diff --git a/src/lib/eliom_tools.eliomi b/src/lib/tools.eliomi similarity index 100% rename from src/lib/eliom_tools.eliomi rename to src/lib/tools.eliomi diff --git a/src/lib/eliom_unwrap.client.ml b/src/lib/unwrap.client.ml similarity index 100% rename from src/lib/eliom_unwrap.client.ml rename to src/lib/unwrap.client.ml diff --git a/src/lib/eliom_unwrap.client.mli b/src/lib/unwrap.client.mli similarity index 100% rename from src/lib/eliom_unwrap.client.mli rename to src/lib/unwrap.client.mli diff --git a/src/lib/eliom_wrap.client.mli b/src/lib/wrap.client.mli similarity index 100% rename from src/lib/eliom_wrap.client.mli rename to src/lib/wrap.client.mli diff --git a/src/lib/eliom_wrap.server.ml b/src/lib/wrap.server.ml similarity index 100% rename from src/lib/eliom_wrap.server.ml rename to src/lib/wrap.server.ml diff --git a/src/lib/eliom_wrap.server.mli b/src/lib/wrap.server.mli similarity index 100% rename from src/lib/eliom_wrap.server.mli rename to src/lib/wrap.server.mli From 798f5e7eea974d20469b195d8ab1cfee6a98b429 Mon Sep 17 00:00:00 2001 From: Vincent Balat Date: Fri, 27 Mar 2026 15:37:08 +0100 Subject: [PATCH 02/41] Update all references to use new module names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update all internal references from Eliom_xxx to the new short names. For example: Eliom_service.create → Service.create Eliom_parameter.int → Parameter.int References updated in: - Renamed source files (74 files) - Internal modules (eliom_common, eliommod_*, etc.) - PPX code (ppx_eliom_server.ml, ppx_eliom_utils.ml) References NOT changed (modules not renamed): Eliom_form, Eliom_lazy, Eliom_react, Eliom_uri Eliom_common, Eliom_runtime, Eliom_types, and all *_base/*_core modules --- src/lib/bus.client.ml | 25 +- src/lib/bus.server.ml | 51 +-- src/lib/bus.server.mli | 8 +- src/lib/client.client.ml | 287 +++++++-------- src/lib/client.client.mli | 82 ++--- src/lib/client.server.ml | 19 +- src/lib/client.server.mli | 14 +- src/lib/client/eliommod_cookies.ml | 2 +- src/lib/client/eliommod_dom.ml | 24 +- src/lib/client/eliommod_parameters.ml | 4 +- src/lib/comet.client.ml | 61 ++- src/lib/comet.server.ml | 62 ++-- src/lib/config.server.ml | 15 +- src/lib/config.server.mli | 14 +- src/lib/content.client.mli | 23 +- src/lib/content.eliom | 2 +- src/lib/content.server.mli | 68 ++-- src/lib/content_sigs.shared.mli | 4 +- src/lib/cscache.eliom | 16 +- src/lib/cscache.eliomi | 6 +- src/lib/eliom_client_base.shared.ml | 16 +- src/lib/eliom_client_core.client.ml | 27 +- src/lib/eliom_client_main.eliom | 30 +- src/lib/eliom_client_value.client.mli | 11 +- src/lib/eliom_client_value.server.ml | 8 +- src/lib/eliom_client_value.server.mli | 4 +- src/lib/eliom_comet_base.shared.ml | 49 ++- src/lib/eliom_comet_base.shared.mli | 51 ++- src/lib/eliom_common.client.ml | 15 +- src/lib/eliom_common.server.ml | 34 +- src/lib/eliom_common.server.mli | 12 +- src/lib/eliom_common_base.shared.ml | 4 +- src/lib/eliom_content_.client.ml | 8 +- src/lib/eliom_content_.server.ml | 6 +- src/lib/eliom_content_core.client.ml | 8 +- src/lib/eliom_content_core.client.mli | 21 +- src/lib/eliom_content_core.server.ml | 27 +- src/lib/eliom_content_core.server.mli | 8 +- src/lib/eliom_error_pages.server.ml | 2 +- src/lib/eliom_form.eliom | 62 ++-- src/lib/eliom_form.eliomi | 8 +- src/lib/eliom_lazy.server.ml | 4 +- src/lib/eliom_parameter_base.shared.ml | 8 +- src/lib/eliom_process.client.ml | 9 +- src/lib/eliom_react.client.ml | 12 +- src/lib/eliom_react.server.ml | 41 +-- src/lib/eliom_react.server.mli | 14 +- src/lib/eliom_route_base.shared.ml | 4 +- src/lib/eliom_runtime.shared.ml | 6 +- src/lib/eliom_runtime.shared.mli | 8 +- src/lib/eliom_service_base.eliom | 68 ++-- src/lib/eliom_syntax.server.ml | 33 +- src/lib/eliom_syntax.server.mli | 14 +- src/lib/eliom_types.server.ml | 6 +- src/lib/eliom_types_base.shared.ml | 2 +- src/lib/eliom_types_base.shared.mli | 2 +- src/lib/eliom_uri.shared.ml | 216 +++++------ src/lib/eliom_uri.shared.mli | 47 +-- src/lib/form_sigs.shared.mli | 102 +++-- src/lib/lib.client.ml | 4 +- src/lib/mkreg.server.ml | 109 +++--- src/lib/mkreg.server.mli | 13 +- src/lib/notif.server.ml | 44 +-- src/lib/notif.server.mli | 4 +- src/lib/parameter.client.ml | 4 +- src/lib/parameter.client.mli | 2 +- src/lib/parameter.server.ml | 4 +- src/lib/parameter.server.mli | 2 +- src/lib/parameter_sigs.shared.mli | 34 +- src/lib/reference.server.ml | 39 +- src/lib/reference.server.mli | 34 +- src/lib/registration.client.ml | 120 +++--- src/lib/registration.client.mli | 42 +-- src/lib/registration.server.ml | 369 +++++++++---------- src/lib/registration.server.mli | 115 +++--- src/lib/registration_sigs.shared.mli | 152 ++++---- src/lib/request.client.ml | 10 +- src/lib/request.client.mli | 4 +- src/lib/request_info.client.ml | 15 +- src/lib/request_info.client.mli | 2 +- src/lib/request_info.server.ml | 2 +- src/lib/request_info.server.mli | 37 +- src/lib/route.client.ml | 8 +- src/lib/route.server.ml | 2 +- src/lib/route.server.mli | 2 +- src/lib/server/eliommod.ml | 22 +- src/lib/server/eliommod.mli | 14 +- src/lib/server/eliommod_cli.ml | 2 +- src/lib/server/eliommod_cookies.ml | 2 +- src/lib/server/eliommod_datasess.ml | 8 +- src/lib/server/eliommod_gc.ml | 2 +- src/lib/server/eliommod_pagegen.ml | 6 +- src/lib/server/eliommod_pagegen.mli | 2 +- src/lib/server/eliommod_persess.ml | 6 +- src/lib/server/eliommod_sersess.ml | 12 +- src/lib/server/eliommod_sessexpl.ml | 12 +- src/lib/server/eliommod_sessiongroups.ml | 6 +- src/lib/server/eliommod_sessiongroups.mli | 2 +- src/lib/server/eliommod_timeouts.ml | 2 +- src/lib/server/monitor/eliom_monitor.ml | 20 +- src/lib/server/monitor/eliom_monitor.mli | 4 +- src/lib/server/monitor/eliom_monitor_main.ml | 4 +- src/lib/service.client.ml | 6 +- src/lib/service.client.mli | 6 +- src/lib/service.server.ml | 51 ++- src/lib/service.server.mli | 34 +- src/lib/service_sigs.shared.mli | 57 ++- src/lib/shared.client.mli | 8 +- src/lib/shared.eliom | 6 +- src/lib/shared.server.mli | 6 +- src/lib/shared_content.eliom | 90 ++--- src/lib/shared_content.eliomi | 12 +- src/lib/state.server.ml | 118 +++--- src/lib/state.server.mli | 10 +- src/lib/tools.eliom | 62 ++-- src/lib/tools.eliomi | 48 +-- src/lib/unwrap.client.ml | 8 +- src/lib/unwrap.client.mli | 4 +- src/lib/wrap.server.ml | 2 +- src/ppx/ppx_eliom_server.ml | 2 +- src/ppx/ppx_eliom_utils.ml | 4 +- 121 files changed, 1698 insertions(+), 1929 deletions(-) diff --git a/src/lib/bus.client.ml b/src/lib/bus.client.ml index bb2474995f..e22ee7f844 100644 --- a/src/lib/bus.client.ml +++ b/src/lib/bus.client.ml @@ -21,7 +21,7 @@ open Lwt.Syntax * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib let section = Logs.Src.create "eliom:bus" @@ -61,30 +61,29 @@ let clone_exn (t, u) s = type ('a, 'att, 'co, 'ext, 'reg) callable_bus_service = ( unit , 'a list - , Eliom_service.post + , Service.post , 'att , 'co , 'ext , 'reg , [`WithoutSuffix] , unit - , [`One of 'a list Eliom_parameter.ocaml] Eliom_parameter.param_name - , Eliom_registration.Action.return ) - Eliom_service.t + , [`One of 'a list Parameter.ocaml] Parameter.param_name + , Registration.Action.return ) + Service.t let create service channel waiter = let write x = Lwt.catch (fun () -> let* _ = - Eliom_client.call_service + Client.call_service ~service:(service :> ('a, _, _, _, _) callable_bus_service) () x in Lwt.return_unit) (function - | Eliom_request.Failed_request 204 -> Lwt.return_unit - | exc -> Lwt.reraise exc) + | Request.Failed_request 204 -> Lwt.return_unit | exc -> Lwt.reraise exc) in let error_h = let t, u = Lwt.wait () in @@ -97,7 +96,7 @@ let create service channel waiter = in let stream = lazy - (let stream = Eliom_comet.register channel in + (let stream = Comet.register channel in (* iterate on the stream to consume messages: avoid memory leak *) let _ = consume error_h stream in stream) @@ -117,7 +116,7 @@ let create service channel waiter = original channel (i.e. without message lost) is only available in the first loading phase. *) let _ = - let* () = Eliom_client.wait_load_end () in + let* () = Client.wait_load_end () in t.original_stream_available <- false; Lwt.return_unit in @@ -128,9 +127,7 @@ let internal_unwrap ((wrapped_bus : ('a, 'b) Ecb.wrapped_bus), _unwrapper) = let channel, Eliom_comet_base.Bus_send_service service = wrapped_bus in create service channel waiter -let () = - Eliom_unwrap.register_unwrapper Eliom_common.bus_unwrap_id internal_unwrap - +let () = Unwrap.register_unwrapper Eliom_common.bus_unwrap_id internal_unwrap let stream t = clone_exn t.error_h (Lazy.force t.stream) let original_stream t = @@ -155,7 +152,7 @@ let try_flush t = Lwt.return_unit let write t v = Queue.add v t.queue; try_flush t -let close {channel; _} = Eliom_comet.close channel +let close {channel; _} = Comet.close channel let set_queue_size b s = b.max_size <- s let set_time_before_flush b t = diff --git a/src/lib/bus.server.ml b/src/lib/bus.server.ml index c7814ceab2..7ec99ea991 100644 --- a/src/lib/bus.server.ml +++ b/src/lib/bus.server.ml @@ -24,19 +24,19 @@ module Ecb = Eliom_comet_base type ('a, 'b) t = { stream : 'b Lwt_stream.t - ; scope : Eliom_comet.Channel.comet_scope + ; scope : Comet.Channel.comet_scope ; name : string option - ; channel : 'b Eliom_comet.Channel.t option + ; channel : 'b Comet.Channel.t option ; write : 'a -> unit Lwt.t ; service : 'a Ecb.bus_send_service - ; service_registered : bool Eliom_state.volatile_table option + ; service_registered : bool State.volatile_table option ; size : int option ; bus_mark : ('a, 'b) t Eliom_common.wrapper (* must be the last field ! *) } [@@warning "-69"] let register_sender scope service write = - Eliom_registration.Action.register ~scope ~options:`NoReload ~service - (fun () x -> Lwt_list.iter_s write x) + Registration.Action.register ~scope ~options:`NoReload ~service (fun () x -> + Lwt_list.iter_s write x) let internal_wrap (bus : ('a, 'b) t) : ('a, 'b) Ecb.wrapped_bus * Eliom_common.unwrapper @@ -44,35 +44,23 @@ let internal_wrap (bus : ('a, 'b) t) : let channel = match bus.channel with | None -> - Eliom_comet.Channel.create ~scope:bus.scope ?name:bus.name - ?size:bus.size + Comet.Channel.create ~scope:bus.scope ?name:bus.name ?size:bus.size (Lwt_stream.clone bus.stream) | Some c -> c in (match bus.service_registered with | None -> () | Some table -> ( - match Eliom_state.get_volatile_data ~table () with - | Eliom_state.Data true -> () + match State.get_volatile_data ~table () with + | State.Data true -> () | _ -> let {service = Ecb.Bus_send_service srv; _} = bus in register_sender bus.scope (srv - :> ( _ - , _ list - , _ - , _ - , _ - , Eliom_service.non_ext - , _ - , _ - , _ - , _ - , _ ) - Eliom_service.t) + :> (_, _ list, _, _, _, Service.non_ext, _, _, _, _, _) Service.t) bus.write; - Eliom_state.set_volatile_data ~table true)); - ( (Eliom_comet.Channel.get_wrapped channel, bus.service) + State.set_volatile_data ~table true)); + ( (Comet.Channel.get_wrapped channel, bus.service) , Eliom_common.make_unwrapper Eliom_common.bus_unwrap_id ) let bus_mark () = Eliom_common.make_wrapper internal_wrap @@ -105,29 +93,26 @@ let create_filtered ?scope ?name ?size ~filter typ = let channel = match scope with | `Site -> - Some - (Eliom_comet.Channel.create ~scope ?name ?size - (Lwt_stream.clone stream)) + Some (Comet.Channel.create ~scope ?name ?size (Lwt_stream.clone stream)) | `Client_process _ -> None in let typ_list = deriving_to_list typ in (*The service*) let post_params = - (Eliom_parameter.ocaml "bus_write" typ_list - : ('a, 'aa, 'aaa) Eliom_parameter.params_type) + (Parameter.ocaml "bus_write" typ_list + : ('a, 'aa, 'aaa) Parameter.params_type) in let distant_write = - Eliom_service.create ?name - ~meth:(Eliom_service.Post (Eliom_parameter.unit, post_params)) - ~path:Eliom_service.No_path () + Service.create ?name + ~meth:(Service.Post (Parameter.unit, post_params)) + ~path:Service.No_path () in let service_registered = match scope with | `Site -> register_sender scope distant_write push; None - | `Client_process _ as scope -> - Some (Eliom_state.create_volatile_table ~scope ()) + | `Client_process _ as scope -> Some (State.create_volatile_table ~scope ()) in (*The bus*) let bus = diff --git a/src/lib/bus.server.mli b/src/lib/bus.server.mli index 5a29d0ca6b..3b92fd14f3 100644 --- a/src/lib/bus.server.mli +++ b/src/lib/bus.server.mli @@ -36,7 +36,7 @@ type ('a, 'b) t participants. *) val create : - ?scope:[< Eliom_comet.Channel.comet_scope] + ?scope:[< Comet.Channel.comet_scope] -> ?name:string -> ?size:int -> 'a Deriving_Json.t @@ -44,16 +44,16 @@ val create : (** [create ?scope ?name ?size ?filter t] creates a fresh bus. The [scope] parameter is used to chose the kind of channel on which the bus rely - (See [Eliom_comet.create] for more information). The [?name] argument + (See [Comet.create] for more information). The [?name] argument allow one to make bus's persistent over server restart. The [size] - argument behaves like the one on {!Eliom_comet.Channel.create}. + argument behaves like the one on {!Comet.Channel.create}. If [?filter] argument is present, data is filtered through this function before entering the bus. Use this for example if you want to add some information, like IP address, or user id. *) val create_filtered : - ?scope:[< Eliom_comet.Channel.comet_scope] + ?scope:[< Comet.Channel.comet_scope] -> ?name:string -> ?size:int -> filter:('a -> 'b Lwt.t) diff --git a/src/lib/client.client.ml b/src/lib/client.client.ml index 7b156aca74..64f950ee23 100644 --- a/src/lib/client.client.ml +++ b/src/lib/client.client.ml @@ -24,8 +24,8 @@ open Lwt.Syntax let section = Eliom_client_core.section open Js_of_ocaml -open Eliom_lib -module Opt = Eliom_lib.Option +open Lib +module Opt = Lib.Option module Xml = Eliom_content_core.Xml (* == Callbacks for onload, onbeforeunload, and onunload *) @@ -122,8 +122,7 @@ let check_global_data global_data = instance_id | Some pos -> Printf.sprintf "%s:%s/%d at %s" compilation_unit_id - closure_id instance_id - (Eliom_lib.pos_to_string pos)) + closure_id instance_id (Lib.pos_to_string pos)) l))); match !missing_injections with | [] -> () @@ -138,11 +137,9 @@ let check_global_data global_data = match d.Eliom_runtime.injection_dbg with | None -> Printf.sprintf "%d" id | Some (pos, Some i) -> - Printf.sprintf "%d (%s at %s)" id i - (Eliom_lib.pos_to_string pos) + Printf.sprintf "%d (%s at %s)" id i (Lib.pos_to_string pos) | Some (pos, None) -> - Printf.sprintf "%d (at %s)" id - (Eliom_lib.pos_to_string pos)) + Printf.sprintf "%d (at %s)" id (Lib.pos_to_string pos)) l)) let do_request_data request_data = @@ -255,12 +252,12 @@ let relink_request_node (node : Dom_html.element Js.t) = let relink_request_nodes root = Logs.debug ~src:section (fun fmt -> fmt "Relink request nodes"); - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(time (Js.string "relink_request_nodes")); Eliommod_dom.iter_nodeList (Eliommod_dom.select_request_nodes root) relink_request_node; - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "relink_request_nodes")) (* Relinks a-elements, form-elements, and process nodes. The list of @@ -368,7 +365,7 @@ let relink_attrib _root table (node : Dom_html.element Js.t) = try let value = Eliom_runtime.RawXML.ClosureMap.find cid table in let rattrib : Eliom_content_core.Xml.attrib = - Eliom_lib.from_poly (Eliom_lib.to_poly value) + Lib.from_poly (Lib.to_poly value) in Eliom_client_core.rebuild_rattrib node rattrib with Not_found -> @@ -385,7 +382,7 @@ let relink_attribs (root : Dom_html.element Js.t) attribs attrib_nodeList = (* == Extract the request data and the request tab-cookies from a page See the corresponding function on the server side: - Eliom_registration.Eliom_appl_reg_make_param.make_eliom_data_script. + Registration.Eliom_appl_reg_make_param.make_eliom_data_script. *) let load_data_script page = @@ -404,12 +401,12 @@ let load_data_script page = | _ -> raise_error ~section "Unable to find Eliom application data." in let script = data_script##.text in - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(time (Js.string "load_data_script")); ignore (Js.Unsafe.eval_string (Js.to_string script)); Eliom_process.reset_request_template (); Eliom_process.reset_request_cookies (); - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "load_data_script")) (* == Scroll the current page such that the top of element with the id @@ -536,14 +533,14 @@ let unwrap_global_data (global_data', _) = global_data' let _ = - Eliom_unwrap.register_unwrapper' - (Eliom_unwrap.id_of_int Eliom_common_base.client_value_unwrap_id_int) + Unwrap.register_unwrapper' + (Unwrap.id_of_int Eliom_common_base.client_value_unwrap_id_int) unwrap_client_value; - Eliom_unwrap.register_unwrapper - (Eliom_unwrap.id_of_int Eliom_runtime.tyxml_unwrap_id_int) + Unwrap.register_unwrapper + (Unwrap.id_of_int Eliom_runtime.tyxml_unwrap_id_int) unwrap_tyxml; - Eliom_unwrap.register_unwrapper - (Eliom_unwrap.id_of_int Eliom_common_base.global_data_unwrap_id_int) + Unwrap.register_unwrapper + (Unwrap.id_of_int Eliom_common_base.global_data_unwrap_id_int) unwrap_global_data; () @@ -634,8 +631,7 @@ type page = ; mutable previous_page : int option ; set_page_status : ?step:React.step -> Page_status_t.t -> unit ; mutable dom : Dom_html.bodyElement Js.t option - ; mutable reload_function : - (unit -> unit -> Eliom_service.result Lwt.t) option } + ; mutable reload_function : (unit -> unit -> Service.result Lwt.t) option } let string_of_page p = Printf.sprintf "%d/%d %s %s %d %b" p.page_unique_id p.page_id.state_index @@ -839,11 +835,11 @@ let set_state i (v : state) = let update_state () = set_state !active_page.page_id - { template = Eliom_request_info.get_request_template () + { template = Request_info.get_request_template () ; position = Eliommod_dom.getDocumentScroll () } -let lock_request_handling = Eliom_request.lock -let unlock_request_handling = Eliom_request.unlock +let lock_request_handling = Request.lock +let unlock_request_handling = Request.unlock type ('a, +'b) server_function = 'a -> 'b Lwt.t @@ -871,7 +867,7 @@ let get_global_data () = Js.Optdef.case Dom_html.window##.localStorage def @@ fun storage -> Js.Opt.case storage##(getItem id) def @@ fun v -> Logs.debug (fun fmt -> fmt "Unwrap __global_data"); - match Eliom_unwrap.unwrap (Url.decode (Js.to_string v)) 0 with + match Unwrap.unwrap (Url.decode (Js.to_string v)) 0 with | {Eliom_runtime.ecs_data = `Success v; _} -> Logs.debug (fun fmt -> fmt "Unwrap __global_data success"); Some v @@ -879,15 +875,15 @@ let get_global_data () = let normalize_app_path p = (* remove "" from beginning and end of path *) - let p = Eliom_lib.Url.split_path p in + let p = Lib.Url.split_path p in let p = match p with "" :: p -> p | _ -> p in match List.rev p with "" :: p -> List.rev p | _ -> p let init_client_app ~app_name ?(ssl = false) ~hostname ?(port = 80) ~site_dir () = - Logs.debug (fun fmt -> fmt "Eliom_client.init_client_app called."); + Logs.debug (fun fmt -> fmt "Client.init_client_app called."); Eliom_process.appl_name_r := Some app_name; - Eliom_request_info.client_app_initialised := true; + Request_info.client_app_initialised := true; (* For site_dir, we want no trailing slash. We tend to concatenate it with relative paths, or treat it as a prefix to be removed from other paths. The trailing slash would be burdensome. @@ -969,7 +965,7 @@ let init () = init_client_app ~app_name ~ssl:true ~hostname:hu_host ~port:hu_port ~site_dir () | _ -> ()); - let js_data = lazy (Eliom_request_info.get_request_data ()) in + let js_data = lazy (Request_info.get_request_data ()) in Js.Optdef.case Js.Unsafe.global##.___eliom_global_data_ (fun () -> @@ -979,7 +975,7 @@ let init () = (* Global data are in a separate file. We should not unmarshal [js_data] right away but only once the client program has been initialized. *) - ignore (Eliom_unwrap.unwrap_js global_data); + ignore (Unwrap.unwrap_js global_data); Js.Unsafe.delete Js.Unsafe.global "__eliom_global_data"); (* *) (* The first time we load the page, we record the initial URL in a client @@ -995,7 +991,7 @@ let init () = during initialisation phase. I move this here. -- Vincent *) Eliommod_cookies.update_cookie_table (Some (Eliom_process.get_info ()).cpi_hostname) - (Eliom_request_info.get_request_cookies ()); + (Request_info.get_request_cookies ()); let onload_handler = ref None in let onload _ev = let js_data = Lazy.force js_data in @@ -1007,19 +1003,16 @@ let init () = | None -> ()); Eliom_client_core.set_initial_load (); Lwt.async (fun () -> - if !Eliom_config.debug_timings - then Console.console##(time (Js.string "onload")); + if !Config.debug_timings then Console.console##(time (Js.string "onload")); let* () = - Eliom_request_info.set_session_info - ~uri: - (String.concat "/" - (Eliom_request_info.get_csp_original_full_path ())) + Request_info.set_session_info + ~uri:(String.concat "/" (Request_info.get_csp_original_full_path ())) js_data.Eliom_common.ejs_sess_info @@ fun () -> Lwt.return_unit in (* Give the browser the chance to actually display the page NOW *) let* () = Js_of_ocaml_lwt.Lwt_js.sleep 0.001 in - (* Ordering matters. See [Eliom_client.set_content] for explanations *) + (* Ordering matters. See [Client.set_content] for explanations *) relink_request_nodes Dom_html.document##.documentElement; let root = Dom_html.document##.documentElement in let closure_nodeList, attrib_nodeList = @@ -1046,7 +1039,7 @@ let init () = in Lwt_mutex.unlock Eliom_client_core.load_mutex; run_callbacks load_callbacks; - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "onload")); Lwt.return_unit); Js._false @@ -1077,7 +1070,7 @@ let create_request__ ?absolute_path ?https (type m) - ~(service : (_, _, m, _, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (_, _, m, _, _, _, _, _, _, _, _) Service.t) ?hostname ?port ?fragment @@ -1102,7 +1095,7 @@ let create_request_ ?absolute ?absolute_path ?https - ~(service : (_, _, m, _, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (_, _, m, _, _, _, _, _, _, _, _) Service.t) ?hostname ?port ?fragment @@ -1117,25 +1110,25 @@ let create_request_ and Eliom_uri.make_post_uri_components instead of Eliom_uri.make_string_uri_ and Eliom_uri.make_post_uri_components__ *) - match Eliom_service.which_meth service with - | Eliom_service.Get' -> + match Service.which_meth service with + | Service.Get' -> let ((_, get_params, _) as components) = Eliom_uri.make_uri_components ?absolute ?absolute_path ?https ~service ?hostname ?port ?fragment ?keep_nl_params ?nl_params get_params in let uri = Eliom_uri.make_string_uri_from_components components in `Get (uri, get_params) - | Eliom_service.Post' -> + | Service.Post' -> `Post (create_request__ ?absolute ?absolute_path ?https ~service ?hostname ?port ?fragment ?keep_nl_params ?nl_params ?keep_get_na_params get_params post_params) - | Eliom_service.Put' -> + | Service.Put' -> `Put (create_request__ ?absolute ?absolute_path ?https ~service ?hostname ?port ?fragment ?keep_nl_params ?nl_params ?keep_get_na_params get_params post_params) - | Eliom_service.Delete' -> + | Service.Delete' -> `Delete (create_request__ ?absolute ?absolute_path ?https ~service ?hostname ?port ?fragment ?keep_nl_params ?nl_params ?keep_get_na_params @@ -1164,7 +1157,7 @@ let raw_call_service in a browser, with Cordova's Web server. Also set with_credentials to true in CORS configuration. *) - let with_credentials = not (Eliom_service.is_external service) in + let with_credentials = not (Service.is_external service) in let* uri, content = match create_request_ ?absolute ?absolute_path ?https ~service ?hostname ?port @@ -1172,28 +1165,28 @@ let raw_call_service post_params with | `Get (uri, _) -> - Eliom_request.http_get ~with_credentials + Request.http_get ~with_credentials ?cookies_info:(Eliom_uri.make_cookies_info (https, service)) uri [] ?progress ?upload_progress ?override_mime_type - Eliom_request.string_result + Request.string_result | `Post (uri, _, post_params) -> - Eliom_request.http_post ~with_credentials + Request.http_post ~with_credentials ?cookies_info:(Eliom_uri.make_cookies_info (https, service)) ?progress ?upload_progress ?override_mime_type uri post_params - Eliom_request.string_result + Request.string_result | `Put (uri, _, post_params) -> - Eliom_request.http_put ~with_credentials + Request.http_put ~with_credentials ?cookies_info:(Eliom_uri.make_cookies_info (https, service)) ?progress ?upload_progress ?override_mime_type uri post_params - Eliom_request.string_result + Request.string_result | `Delete (uri, _, post_params) -> - Eliom_request.http_delete ~with_credentials + Request.http_delete ~with_credentials ?cookies_info:(Eliom_uri.make_cookies_info (https, service)) ?progress ?upload_progress ?override_mime_type uri post_params - Eliom_request.string_result + Request.string_result in match content with - | None -> Lwt.fail (Eliom_request.Failed_request 204) + | None -> Lwt.fail (Request.Failed_request 204) | Some content -> Lwt.return (uri, content) let call_service @@ -1243,14 +1236,13 @@ let exit_to ?fragment ?keep_nl_params ?nl_params ?keep_get_na_params get_params post_params with - | `Get (uri, _) -> - Eliom_request.redirect_get ?window_name ?window_features uri + | `Get (uri, _) -> Request.redirect_get ?window_name ?window_features uri | `Post (uri, _, post_params) -> - Eliom_request.redirect_post ?window_name uri post_params + Request.redirect_post ?window_name uri post_params | `Put (uri, _, post_params) -> - Eliom_request.redirect_put ?window_name uri post_params + Request.redirect_put ?window_name uri post_params | `Delete (uri, _, post_params) -> - Eliom_request.redirect_delete ?window_name uri post_params + Request.redirect_delete ?window_name uri post_params let window_open ~window_name @@ -1286,7 +1278,7 @@ let window_open let unwrap_caml_content content = let r : 'a Eliom_runtime.eliom_caml_service_data = - Eliom_unwrap.unwrap (Url.decode content) 0 + Unwrap.unwrap (Url.decode content) 0 in Lwt.return (r.Eliom_runtime.ecs_data, r.Eliom_runtime.ecs_request_data) @@ -1352,8 +1344,8 @@ let set_current_uri, get_current_uri = (get_this_page ()).url <- current_uri; let path, all_get_params = path_and_args_of_uri current_uri in Lwt.async @@ fun () -> - Eliom_request_info.update_session_info ~path ~all_get_params - ~all_post_params:None (fun () -> Lwt.return_unit) + Request_info.update_session_info ~path ~all_get_params ~all_post_params:None + (fun () -> Lwt.return_unit) in let get_current_uri () = (get_this_page ()).url in set_current_uri, get_current_uri @@ -1513,15 +1505,14 @@ let change_url = Logs.debug ~src:section_page (fun fmt -> fmt "Change url"); (reload_function := - match Eliom_service.xhr_with_cookies service with + match Service.xhr_with_cookies service with | None - when (https = Some true && not Eliom_request_info.ssl_) - || (https = Some false && Eliom_request_info.ssl_) -> - None - | Some (Some _ as t) when t = Eliom_request_info.get_request_template () -> + when (https = Some true && not Request_info.ssl_) + || (https = Some false && Request_info.ssl_) -> None + | Some (Some _ as t) when t = Request_info.get_request_template () -> None | _ -> ( - match Eliom_service.reload_fun service with + match Service.reload_fun service with | Some rf -> Some (fun () () -> rf params ()) | None -> None)); change_url_string ~replace @@ -1554,7 +1545,7 @@ let set_uri ~replace ?fragment uri = | Some fragment -> change_url_string ~replace (uri ^ "#" ^ fragment) let replace_page ~do_insert_base new_page = - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(time (Js.string "replace_page")); if !only_replace_body then @@ -1570,7 +1561,7 @@ let replace_page ~do_insert_base new_page = if do_insert_base then insert_base new_page; Dom.replaceChild Dom_html.document new_page Dom_html.document##.documentElement); - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "replace_page")) (* Function to be called for client side services: *) @@ -1579,7 +1570,7 @@ let set_content_local ?offset ?fragment new_page = let locked = ref true in let recover () = if !locked then Lwt_mutex.unlock Eliom_client_core.load_mutex; - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "set_content_local")) and really_set () = (* Inline CSS in the header to avoid the "flashing effect". @@ -1605,7 +1596,7 @@ let set_content_local ?offset ?fragment new_page = Page_status.onactive ~once:true (fun () -> run_callbacks load_callbacks); scroll_to_fragment ?offset fragment; advance_page (); - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "set_content_local")); Lwt.return_unit in @@ -1614,7 +1605,7 @@ let set_content_local ?offset ?fragment new_page = (fun () -> let* () = Lwt_mutex.lock Eliom_client_core.load_mutex in Eliom_client_core.set_loading_phase (); - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(time (Js.string "set_content_local")); run_onunload_wrapper really_set cancel) (fun exn -> @@ -1664,8 +1655,8 @@ let set_content ~replace ~uri ?offset ?fragment content = (* Put the loaded data script in action *) load_data_script fake_page; (* Unmarshall page data. *) - let cookies = Eliom_request_info.get_request_cookies () in - let js_data = Eliom_request_info.get_request_data () in + let cookies = Request_info.get_request_cookies () in + let js_data = Request_info.get_request_data () in (* Update tab-cookies: *) let host = match Url.url_of_string uri with @@ -1681,8 +1672,7 @@ let set_content ~replace ~uri ?offset ?fragment content = let closure_nodeList, attrib_nodeList = relink_page_but_client_values fake_page in - Eliom_request_info.set_session_info ~uri - js_data.Eliom_common.ejs_sess_info + Request_info.set_session_info ~uri js_data.Eliom_common.ejs_sess_info @@ fun () -> (* Really change page contents *) replace_page ~do_insert_base:false fake_page; @@ -1715,19 +1705,19 @@ let set_content ~replace ~uri ?offset ?fragment content = run_callbacks load_callbacks; scroll_to_fragment ?offset fragment; advance_page (); - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "set_content")); Lwt.return_unit and recover () = if !locked then Lwt_mutex.unlock Eliom_client_core.load_mutex; - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "set_content")) in Lwt.catch (fun () -> let* () = Lwt_mutex.lock Eliom_client_core.load_mutex in Eliom_client_core.set_loading_phase (); - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(time (Js.string "set_content")); let g () = recover (); Lwt.return_unit in run_onunload_wrapper really_set g) @@ -1757,7 +1747,7 @@ let make_uri subpath params = and params = List.map (fun (s, s') -> s, `String (Js.string s')) params in Eliom_uri.make_string_uri_from_components (base, params, None) -let route ({Eliom_route.i_subpath; i_get_params; i_post_params; _} as info) = +let route ({Route.i_subpath; i_get_params; i_post_params; _} as info) = Logs.debug ~src:section_page (fun fmt -> fmt "Route"); let info, i_subpath = match i_subpath with @@ -1765,13 +1755,13 @@ let route ({Eliom_route.i_subpath; i_get_params; i_post_params; _} as info) = | i_subpath -> info, i_subpath in let uri = make_uri i_subpath i_get_params in - Eliom_request_info.update_session_info ~path:i_subpath - ~all_get_params:i_get_params ~all_post_params:(Some i_post_params) + Request_info.update_session_info ~path:i_subpath ~all_get_params:i_get_params + ~all_post_params:(Some i_post_params) @@ fun () -> let* result = - Eliom_route.call_service + Route.call_service { info with - Eliom_route.i_get_params = + Route.i_get_params = Eliom_common.(remove_prefixed_param nl_param_prefix) i_get_params } in Lwt.return (uri, result) @@ -1782,7 +1772,7 @@ let switch_to_https () = let string_of_result result = match result with - | Eliom_service.No_contents -> "No_contents" + | Service.No_contents -> "No_contents" | Dom _ -> "Dom" | Redirect _ -> "Redirect" | Reload_action {hidden; https} -> @@ -1800,7 +1790,7 @@ let rec handle_result ~replace ~uri result = Logs.debug ~src:section_page (fun fmt -> fmt "%s" ("handle_result: result is " ^ string_of_result result)); match result with - | Eliom_service.No_contents -> Lwt.return_unit + | Service.No_contents -> Lwt.return_unit | Dom d -> change_url_string ~replace uri; set_content_local d @@ -1808,17 +1798,15 @@ let rec handle_result ~replace ~uri result = | Reload_action {hidden; https} -> ( match hidden, https with | false, false -> - reload_without_na_params ~replace ~uri - ~fallback:Eliom_service.reload_action + reload_without_na_params ~replace ~uri ~fallback:Service.reload_action | false, true -> switch_to_https (); reload_without_na_params ~replace ~uri - ~fallback:Eliom_service.reload_action_https - | true, false -> - reload ~replace ~uri ~fallback:Eliom_service.reload_action_hidden + ~fallback:Service.reload_action_https + | true, false -> reload ~replace ~uri ~fallback:Service.reload_action_hidden | true, true -> switch_to_https (); - reload ~replace ~uri ~fallback:Eliom_service.reload_action_https_hidden) + reload ~replace ~uri ~fallback:Service.reload_action_https_hidden) (* == Main (exported) function: change the content of the page without leaving the javascript application. See [change_page_uri] for the @@ -1844,13 +1832,13 @@ and change_page : , 'tipo , 'gn , 'pn - , Eliom_service.non_ocaml ) - Eliom_service.t + , Service.non_ocaml ) + Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `None | `Persistent] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?keep_get_na_params:bool -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) @@ -1867,12 +1855,12 @@ and change_page : ?absolute ?absolute_path ?https - ~(service : (_, _, m, _, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (_, _, m, _, _, _, _, _, _, _, _) Service.t) ?hostname ?port ?fragment ?keep_nl_params - ?(nl_params = Eliom_parameter.empty_nl_params_set) + ?(nl_params = Parameter.empty_nl_params_set) ?keep_get_na_params ?progress ?upload_progress @@ -1880,11 +1868,11 @@ and change_page : get_params post_params -> Logs.debug ~src:section_page (fun fmt -> fmt "Change page"); - let xhr = Eliom_service.xhr_with_cookies service in + let xhr = Service.xhr_with_cookies service in if xhr = None - || (https = Some true && not Eliom_request_info.ssl_) - || (https = Some false && Eliom_request_info.ssl_) + || (https = Some true && not Request_info.ssl_) + || (https = Some false && Request_info.ssl_) || (window_name <> None && window_name <> Some "_self") then let () = @@ -1897,13 +1885,11 @@ and change_page : else with_progress_cursor (match xhr with - | Some (Some tmpl as t) - when t = Eliom_request_info.get_request_template () -> + | Some (Some tmpl as t) when t = Request_info.get_request_template () -> Logs.debug ~src:section_page (fun fmt -> fmt "change page: xhr is Some of get request template"); let nl_params = - Eliom_parameter.add_nl_parameter nl_params Eliom_request.nl_template - tmpl + Parameter.add_nl_parameter nl_params Request.nl_template tmpl in let* uri, content = raw_call_service ?absolute ?absolute_path ?https ~service ?hostname @@ -1913,7 +1899,7 @@ and change_page : in set_template_content ~replace ~uri ?fragment (Some content) | _ -> ( - match Eliom_service.client_fun service with + match Service.client_fun service with | Some f when not ignore_client_fun -> Logs.debug ~src:section_page (fun fmt -> fmt @@ -1921,9 +1907,9 @@ and change_page : (* The service has a client side implementation. We do not make the request *) (* I record the function to be used for void coservices: *) - Eliom_lib.Option.iter + Lib.Option.iter (fun rf -> reload_function := Some (fun () -> rf get_params)) - (Eliom_service.reload_fun service); + (Service.reload_fun service); let uri, l, l' = match create_request_ ~absolute:true ?absolute_path ?https ~service @@ -1935,7 +1921,7 @@ and change_page : uri, l, Some (ocamlify_params l') in let l = ocamlify_params l in - Eliom_request_info.update_session_info + Request_info.update_session_info ~path:(Url.path_of_url_string uri) ~all_get_params:l ~all_post_params:l' @@ fun () -> @@ -1976,17 +1962,17 @@ and change_page : ?keep_get_na_params get_params post_params with | `Get (uri, _) -> - Eliom_request.http_get ~expecting_process_page:true - ?cookies_info uri [] Eliom_request.xml_result + Request.http_get ~expecting_process_page:true ?cookies_info + uri [] Request.xml_result | `Post (uri, _, p) -> - Eliom_request.http_post ~expecting_process_page:true - ?cookies_info uri p Eliom_request.xml_result + Request.http_post ~expecting_process_page:true ?cookies_info + uri p Request.xml_result | `Put (uri, _, p) -> - Eliom_request.http_put ~expecting_process_page:true - ?cookies_info uri p Eliom_request.xml_result + Request.http_put ~expecting_process_page:true ?cookies_info + uri p Request.xml_result | `Delete (uri, _, p) -> - Eliom_request.http_delete ~expecting_process_page:true - ?cookies_info uri p Eliom_request.xml_result + Request.http_delete ~expecting_process_page:true ?cookies_info + uri p Request.xml_result in let uri, fragment = Url.split_fragment uri in set_content ~replace ~uri ?fragment content)) @@ -2000,7 +1986,7 @@ and change_page_unknown i_post_params = Logs.debug ~src:section_page (fun fmt -> fmt "Change page unknown"); - let i_sess_info = Eliom_request_info.get_sess_info () + let i_sess_info = Request_info.get_sess_info () and i_meth = match meth, i_post_params with | Some meth, _ -> @@ -2010,8 +1996,7 @@ and change_page_unknown in with_new_page ~replace () @@ fun () -> let* uri, result = - route - {Eliom_route.i_sess_info; i_subpath; i_meth; i_get_params; i_post_params} + route {Route.i_sess_info; i_subpath; i_meth; i_get_params; i_post_params} in handle_result ~replace ~uri (Lwt.return result) @@ -2042,17 +2027,17 @@ let change_page_uri_a ?cookies_info ?tmpl ?(get_params = []) full_uri = if is_client_app () then failwith "Change_page_uri_a called on client app"; match tmpl with - | Some t when tmpl = Eliom_request_info.get_request_template () -> + | Some t when tmpl = Request_info.get_request_template () -> let* uri, content = - Eliom_request.http_get ?cookies_info uri - ((Eliom_request.nl_template_string, t) :: get_params) - Eliom_request.string_result + Request.http_get ?cookies_info uri + ((Request.nl_template_string, t) :: get_params) + Request.string_result in set_template_content ~replace:false ~uri ?fragment content | _ -> let* uri, content = - Eliom_request.http_get ~expecting_process_page:true ?cookies_info - uri get_params Eliom_request.xml_result + Request.http_get ~expecting_process_page:true ?cookies_info uri + get_params Request.xml_result in set_content ~replace:false ~uri ?fragment content) else ( @@ -2087,17 +2072,17 @@ let change_page_get_form ?cookies_info ?tmpl form full_uri = (let form = Js.Unsafe.coerce form in let uri, fragment = Url.split_fragment full_uri in match tmpl with - | Some t when tmpl = Eliom_request_info.get_request_template () -> + | Some t when tmpl = Request_info.get_request_template () -> let* uri, content = - Eliom_request.send_get_form - ~get_args:[Eliom_request.nl_template_string, t] - ?cookies_info form uri Eliom_request.string_result + Request.send_get_form + ~get_args:[Request.nl_template_string, t] + ?cookies_info form uri Request.string_result in set_template_content ~replace:false ~uri ?fragment content | _ -> let* uri, content = - Eliom_request.send_get_form ~expecting_process_page:true - ?cookies_info form uri Eliom_request.xml_result + Request.send_get_form ~expecting_process_page:true ?cookies_info form + uri Request.xml_result in set_content ~replace:false ~uri ?fragment content) @@ -2106,17 +2091,17 @@ let change_page_post_form ?cookies_info ?tmpl form full_uri = (let form = Js.Unsafe.coerce form in let uri, fragment = Url.split_fragment full_uri in match tmpl with - | Some t when tmpl = Eliom_request_info.get_request_template () -> + | Some t when tmpl = Request_info.get_request_template () -> let* uri, content = - Eliom_request.send_post_form - ~get_args:[Eliom_request.nl_template_string, t] - ?cookies_info form uri Eliom_request.string_result + Request.send_post_form + ~get_args:[Request.nl_template_string, t] + ?cookies_info form uri Request.string_result in set_template_content ~replace:false ~uri ?fragment content | _ -> let* uri, content = - Eliom_request.send_post_form ~expecting_process_page:true - ?cookies_info form uri Eliom_request.xml_result + Request.send_post_form ~expecting_process_page:true ?cookies_info + form uri Request.xml_result in set_content ~replace:false ~uri ?fragment content) @@ -2237,7 +2222,7 @@ let () = History.replace (get_this_page ()); let* () = Lwt.bind (f () ()) (function - | Eliom_service.Dom d -> set_content_local d + | Service.Dom d -> set_content_local d | r -> handle_result ~uri:(get_current_uri ()) ~replace:true (Lwt.return r)) @@ -2248,14 +2233,14 @@ let () = (* different session ID *) set_current_uri uri; match tmpl with - | Some t when tmpl = Eliom_request_info.get_request_template () -> + | Some t when tmpl = Request_info.get_request_template () -> Logs.debug ~src:section_page (fun fmt -> fmt "revisit: template is Some and equals to get_request_template"); let* uri, content = - Eliom_request.http_get uri - [Eliom_request.nl_template_string, t] - Eliom_request.string_result + Request.http_get uri + [Request.nl_template_string, t] + Request.string_result in let* () = set_template_content content ~replace:true ~uri in scroll_to_fragment ~offset:state.position fragment; @@ -2274,8 +2259,8 @@ let () = ~replace:false () @@ fun () -> let* uri, content = - Eliom_request.http_get ~expecting_process_page:true uri [] - Eliom_request.xml_result + Request.http_get ~expecting_process_page:true uri [] + Request.xml_result in let* () = set_content ~uri ~replace:true ~offset:state.position @@ -2354,8 +2339,8 @@ let () = Lwt.return_unit) let () = - Eliom_unwrap.register_unwrapper - (Eliom_unwrap.id_of_int Eliom_common_base.server_function_unwrap_id_int) + Unwrap.register_unwrapper + (Unwrap.id_of_int Eliom_common_base.server_function_unwrap_id_int) (fun (service, _) -> (* 2013-07-31 I make all RPC's absolute because otherwise it does not work with mobile apps. @@ -2369,4 +2354,4 @@ let middleClick = Eliom_client_core.middleClick type client_form_handler = Eliom_client_core.client_form_handler -module Additional_headers = Eliom_request.Additional_headers +module Additional_headers = Request.Additional_headers diff --git a/src/lib/client.client.mli b/src/lib/client.client.mli index 8947148983..0422d3b3b8 100644 --- a/src/lib/client.client.mli +++ b/src/lib/client.client.mli @@ -32,7 +32,7 @@ val init_client_app : -> ?ssl:bool -> hostname:string -> ?port:int - -> site_dir:Eliom_lib.Url.path + -> site_dir:Lib.Url.path -> unit -> unit (** Call this function if you want to be able to run your client side @@ -56,8 +56,8 @@ val is_client_app : unit -> bool Otherwise, it tests the presence of JS variables added automatically by Eliom when the page is sent by a server. Example: - {[ if not (Eliom_client.is_client_app ()) - then Eliom_client.init_client_app ... ]} + {[ if not (Client.is_client_app ()) + then Client.init_client_app ... ]} *) (** {2 Calling services} *) @@ -70,13 +70,12 @@ val change_page : -> ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ('a, 'b, _, _, _, _, _, _, _, _, Eliom_service.non_ocaml) Eliom_service.t + -> service:('a, 'b, _, _, _, _, _, _, _, _, Service.non_ocaml) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `None | `Persistent] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?keep_get_na_params:bool -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) @@ -99,24 +98,12 @@ val call_ocaml_service : ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ( 'a - , 'b - , _ - , _ - , _ - , _ - , _ - , _ - , _ - , _ - , 'return Eliom_service.ocaml ) - Eliom_service.t + -> service:('a, 'b, _, _, _, _, _, _, _, _, 'return Service.ocaml) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `None | `Persistent] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?keep_get_na_params:bool -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) @@ -139,13 +126,12 @@ val exit_to : -> ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ('a, 'b, _, _, _, _, _, _, _, _, Eliom_service.non_ocaml) Eliom_service.t + -> service:('a, 'b, _, _, _, _, _, _, _, _, Service.non_ocaml) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `None | `Persistent] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?keep_get_na_params:bool -> 'a -> 'b @@ -167,13 +153,12 @@ val window_open : -> ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ('a, unit, Eliom_service.get, _, _, _, _, _, _, unit, _) Eliom_service.t + -> service:('a, unit, Service.get, _, _, _, _, _, _, unit, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `None | `Persistent] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?keep_get_na_params:bool -> 'a -> Dom_html.window Js.t Js.opt @@ -185,24 +170,12 @@ val change_url : -> ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ( 'get - , unit - , Eliom_service.get - , _ - , _ - , _ - , _ - , _ - , _ - , unit - , _ ) - Eliom_service.t + -> service:('get, unit, Service.get, _, _, _, _, _, _, unit, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `None | `Persistent] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> 'get -> unit (** Changes the URL, without doing a request. @@ -215,12 +188,12 @@ val call_service : ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service:('a, 'b, _, _, _, _, _, _, _, _, _) Eliom_service.t + -> service:('a, 'b, _, _, _, _, _, _, _, _, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `None | `Persistent] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?keep_get_na_params:bool -> ?progress:(int -> int -> unit) -> ?upload_progress:(int -> int -> unit) @@ -249,13 +222,13 @@ val onload : (unit -> unit) -> unit avoid this problem rely on [Page_status.onactive] which is triggered for freshly generated pages as well as pages served from the DOM cache. - {[ - [%%shared open Eliom_lib] + {% < alert "Once only when the document is put in place.") ] [%%server @@ -381,7 +354,7 @@ val wait_load_end : unit -> unit Lwt.t val get_application_name : unit -> string (** Returns the name of currently running Eliom application, - defined while applying [Eliom_registration.App] functor. *) + defined while applying [Registration.App] functor. *) val persist_document_head : unit -> unit (** After this function is called, the document head is no @@ -393,13 +366,14 @@ val persist_document_head : unit -> unit type ('a, +'b) server_function = 'a -> 'b Lwt.t (** A [('a, 'b) server_function] provides transparently access to a - server side function which has been created by {!Eliom_client.server_function}. + server side function which has been created by {% <> %}. - See also {{!Eliom_client.server_function}the opaque server - side representation}. + See also {% <> %}. The handling of exception on the server corresponds to that of - {!Eliom_client.call_ocaml_service}. + <>. *) val change_page_uri : ?replace:bool -> string -> unit Lwt.t @@ -436,7 +410,7 @@ val change_page_unknown : (* Documentation rather in eliom_client.ml *) val init : unit -> unit -val set_reload_function : (unit -> unit -> Eliom_service.result Lwt.t) -> unit +val set_reload_function : (unit -> unit -> Service.result Lwt.t) -> unit module History : sig val past : unit -> string list @@ -463,7 +437,7 @@ val push_history_dom : unit -> unit {[ let%shared service_handler = fun () () -> - ignore [%client (Eliom_client.onload Eliom_client.push_history_dom : unit)]; + ignore [%client (Client.onload Client.push_history_dom : unit)]; Lwt.return [div [h1 [pcdata "Hello"]; p [pcdata "Blablablabla"] ] @@ -472,9 +446,9 @@ val push_history_dom : unit -> unit onload handler. *) let%client () = let rec register () = - Eliom_client.onload ( + Client.onload ( fun () -> - Eliom_client.push_history_dom (); + Client.push_history_dom (); register ()) in register () diff --git a/src/lib/client.server.ml b/src/lib/client.server.ml index 9404f4b77b..88482762aa 100644 --- a/src/lib/client.server.ml +++ b/src/lib/client.server.ml @@ -22,7 +22,7 @@ let is_client_app () = false type ('a, 'b) server_function = - ('a, 'b) Eliom_client_base.server_function_service * Eliom_wrap.unwrapper + ('a, 'b) Eliom_client_base.server_function_service * Wrap.unwrapper let mk_serv_fun a b : ('a, 'b) server_function = a, b @@ -46,14 +46,13 @@ let server_function f = mk_serv_fun - (Eliom_registration.Ocaml.create ?scope ?options ?charset ?code - ?content_type ?headers ?secure_session ?name ?csrf_safe ?csrf_scope - ?csrf_secure ?max_use ?timeout ?https ?error_handler + (Registration.Ocaml.create ?scope ?options ?charset ?code ?content_type + ?headers ?secure_session ?name ?csrf_safe ?csrf_scope ?csrf_secure + ?max_use ?timeout ?https ?error_handler ~meth: - (Eliom_service.Post - ( Eliom_parameter.unit - , Eliom_parameter.(ocaml "argument" argument_type) )) - ~path:Eliom_service.No_path + (Service.Post + (Parameter.unit, Parameter.(ocaml "argument" argument_type))) + ~path:Service.No_path (fun () argument -> f argument)) - (Eliom_wrap.create_unwrapper - (Eliom_wrap.id_of_int Eliom_common_base.server_function_unwrap_id_int)) + (Wrap.create_unwrapper + (Wrap.id_of_int Eliom_common_base.server_function_unwrap_id_int)) diff --git a/src/lib/client.server.mli b/src/lib/client.server.mli index f984f3baa8..efa94e3912 100644 --- a/src/lib/client.server.mli +++ b/src/lib/client.server.mli @@ -4,8 +4,8 @@ val is_client_app : unit -> bool Otherwise, it tests the presence of JS variables added automatically by Eliom when the page is sent by a server. Example: - {[ if not (Eliom_client.is_client_app ()) - then Eliom_client.init_client_app ... ]} + {[ if not (Client.is_client_app ()) + then Client.init_client_app ... ]} *) (** {2 RPC / Server functions} @@ -15,9 +15,10 @@ val is_client_app : unit -> bool type ('a, 'b) server_function (** A value of type [('a, 'b) server_function] is created on the server from a function ['a -> 'b Lwt.t] and provides a given function on the client side. - See also {{!Eliom_client.server_function}the concrete client side representation}. *) + See also {% <> %}. *) -(* BBB This is not in Eliom_service because it depends on Eliom_registration *) +(* BBB This is not in Service because it depends on Registration *) val server_function : ?scope:[< Eliom_common.scope] -> ?options:unit @@ -37,13 +38,14 @@ val server_function : -> 'a Deriving_Json.t -> ('a -> 'b Lwt.t) -> ('a, 'b) server_function -(** [server_function argument_type f] creates a value of type {!Eliom_client.server_function}. This allows +(** [server_function argument_type f] creates a value of type {% + <> %}. This allows to call [f] from the client. The first argument [argument_type] is an instance of [Deriving_Json] for the type of the argument. It is used to safely encode and decode the argument sent to the server. The optional parameters correspond directly to the optional - parameters of {!Eliom_registration.Ocaml.register_coservice'}. + parameters of {% <> %}. See also the {{!page-"clientserver-communication".rpc}manual}. *) diff --git a/src/lib/client/eliommod_cookies.ml b/src/lib/client/eliommod_cookies.ml index 33900a74ed..ff019a0e31 100644 --- a/src/lib/client/eliommod_cookies.ml +++ b/src/lib/client/eliommod_cookies.ml @@ -18,7 +18,7 @@ *) open Js_of_ocaml -open Eliom_lib +open Lib include Eliom_cookies_base (* CCC The tables are indexed by the hostname, not the port appear. diff --git a/src/lib/client/eliommod_dom.ml b/src/lib/client/eliommod_dom.ml index 6422f97134..96b59bc690 100644 --- a/src/lib/client/eliommod_dom.ml +++ b/src/lib/client/eliommod_dom.ml @@ -20,7 +20,7 @@ open Lwt.Syntax *) open Js_of_ocaml -open Eliom_lib +open Lib let section = Logs.Src.create "eliom:dom" @@ -103,7 +103,7 @@ let fast_select_request_nodes root = (Js.string ("." ^ Eliom_runtime.RawXML.request_node_class))) let fast_select_nodes root = - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(time (Js.string "fast_select_nodes")); let a_nodeList : Dom_html.element Dom.nodeList Js.t = root##(querySelectorAll @@ -132,7 +132,7 @@ let fast_select_nodes root = root##(querySelectorAll (Js.string ("." ^ Eliom_runtime.RawXML.ce_registered_attr_class))) in - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "fast_select_nodes")); ( a_nodeList , form_nodeList @@ -474,9 +474,7 @@ let fetch_linked_css e = then acc else let href = Js.to_string href in - let css = - Eliom_request.http_get href [] Eliom_request.string_result - in + let css = Request.http_get href [] Request.string_result in acc @ [e, (e##.media, href, css >|= snd)] | Dom.Element e -> let c = e##.childNodes in @@ -581,12 +579,12 @@ let rec rewrite_css ~max (media, href, css) = css >>= function | None -> Lwt.return_nil | Some css -> - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(time (Js.string ("rewrite_CSS: " ^ href))); let* imports, css = rewrite_css_import ~max ~prefix:(basedir href) ~media css 0 in - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string ("rewrite_CSS: " ^ href))); Lwt.return (imports @ [media, css])) (fun _ -> Lwt.return [media, Printf.sprintf "@import url(%s);" href]) @@ -620,9 +618,7 @@ and rewrite_css_import ?(charset = "") ~max ~prefix ~media css pos = let media = if media##.length > 0 then media else Js.string media' in - let css = - Eliom_request.http_get href [] Eliom_request.string_result - in + let css = Request.http_get href [] Request.string_result in rewrite_css ~max:(max - 1) (media, href, css >|= snd) and* imports, css = rewrite_css_import ~charset ~max ~prefix ~media css i @@ -665,7 +661,7 @@ let build_style (e, css) = (* Lwt.return (e, node )*) let preload_css (doc : Dom_html.element Js.t) = - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(time (Js.string "preload_css (fetch+rewrite)")); let* css = Lwt_list.map_p build_style (fetch_linked_css (get_head doc)) in let css = List.concat css in @@ -679,7 +675,7 @@ let preload_css (doc : Dom_html.element Js.t) = in a perfect settings we won't have parsed it... *) section (fun fmt -> fmt "Unique CSS skipped...")) css; - if !Eliom_config.debug_timings + if !Config.debug_timings then Console.console##(timeEnd (Js.string "preload_css (fetch+rewrite)")); Lwt.return_unit @@ -755,7 +751,7 @@ let touch_base () = This is implemented in: * this file -> here and called in load_eliom_data - * Eliom_request: in send_post_form + * Request: in send_post_form * in js_of_ocaml, module Form: the code to emulate FormData *) let onclick_on_body_handler event = diff --git a/src/lib/client/eliommod_parameters.ml b/src/lib/client/eliommod_parameters.ml index 71e292d3f5..43b9bf90c4 100644 --- a/src/lib/client/eliommod_parameters.ml +++ b/src/lib/client/eliommod_parameters.ml @@ -32,8 +32,8 @@ let to_string : field -> string = function let inject_param_list l = List.map (fun (n, v) -> n, insert_string v) l let get_param_list l = List.map (fun (n, v) -> n, to_string v) l -let inject_param_table t : (string * param) list Eliom_lib.String.Table.t = - Eliom_lib.String.Table.map (fun v -> inject_param_list v) t +let inject_param_table t : (string * param) list Lib.String.Table.t = + Lib.String.Table.map (fun v -> inject_param_list v) t let string_of_param = function | `String s -> Js.to_string s diff --git a/src/lib/comet.client.ml b/src/lib/comet.client.ml index 2c30a7113d..343fb26806 100644 --- a/src/lib/comet.client.ml +++ b/src/lib/comet.client.ml @@ -24,7 +24,7 @@ open Lwt.Syntax (* This file is for client-side comet-programming. *) open Js_of_ocaml -open Eliom_lib +open Lib module Ecb = Eliom_comet_base let section = Logs.Src.create "eliom:comet" @@ -182,7 +182,7 @@ let handle_exn, set_handle_exn_function = let r = ref (fun ?exn () -> let s = - "Unknown exception during comet. Customize this with Eliom_comet.set_handle_exn_function. " + "Unknown exception during comet. Customize this with Comet.set_handle_exn_function. " in match exn with | Some exn -> raise_error ~section ~exn "%s" s @@ -244,11 +244,11 @@ end = struct ; mutable active_wakener : unit Lwt.u ; mutable restart_waiter : Ecb.answer Lwt.t ; mutable restart_wakener : Ecb.answer Lwt.u - ; mutable active_channels : Eliom_lib.String.Set.t } + ; mutable active_channels : Lib.String.Set.t } type stateful_state = int ref (* id of the next request *) type stateless_state_ = {count : int; position : Ecb.position} - type stateless_state = stateless_state_ Eliom_lib.String.Table.t ref + type stateless_state = stateless_state_ Lib.String.Table.t ref (* index for each channel of the last message *) type channel_state = @@ -279,7 +279,7 @@ end = struct Dom_html.(add_listener document (Event.make "visibilitychange") f) let set_activity hd v = - if Eliom_lib.String.Set.is_empty hd.hd_activity.active_channels + if Lib.String.Set.is_empty hd.hd_activity.active_channels then hd.hd_activity.active <- `Inactive else if v <> hd.hd_activity.active then @@ -378,24 +378,24 @@ end = struct match p with | _, Ecb.Stateful (Ecb.Commands commands) -> queue := List.rev_append (Array.to_list commands) !queue; - let* () = Eliom_client.wait_load_end () in + let* () = Client.wait_load_end () in let q = !queue in if q <> [] then ( queue := []; - Eliom_client.call_service ~service () + Client.call_service ~service () (false, Ecb.Stateful (Ecb.Commands (Array.of_list (List.rev q))))) else Lwt.return "" | _ -> - let* () = Eliom_client.wait_load_end () in - Eliom_client.call_service ~service () p + let* () = Client.wait_load_end () in + Client.call_service ~service () p let make_request hd = match hd.hd_state with | Stateful_state count -> Ecb.Stateful (Ecb.Request_data !count) | Stateless_state map -> let l = - Eliom_lib.String.Table.fold + Lib.String.Table.fold (fun channel {position; _} l -> (channel, position) :: l) !map [] in @@ -403,8 +403,8 @@ end = struct let stop_waiting hd chan_id = hd.hd_activity.active_channels <- - Eliom_lib.String.Set.remove chan_id hd.hd_activity.active_channels; - if Eliom_lib.String.Set.is_empty hd.hd_activity.active_channels + Lib.String.Set.remove chan_id hd.hd_activity.active_channels; + if Lib.String.Set.is_empty hd.hd_activity.active_channels then set_activity hd `Inactive let update_stateful_state hd message = @@ -435,10 +435,8 @@ end = struct let close_all_channels hd = let s = hd.hd_activity.active_channels in - Eliom_lib.String.Set.iter (fun chan_id -> stop_waiting hd chan_id) s; - Eliom_lib.String.Set.fold - (fun chan_id l -> (chan_id, None, Ecb.Closed) :: l) - s [] + Lib.String.Set.iter (fun chan_id -> stop_waiting hd chan_id) s; + Lib.String.Set.fold (fun chan_id l -> (chan_id, None, Ecb.Closed) :: l) s [] let update_stateless_state hd (message : stateless_message) = match hd.hd_state with @@ -448,10 +446,10 @@ end = struct (fun table -> function | chan_id, Ecb.Data (_, index) -> ( try - let state = Eliom_lib.String.Table.find chan_id table in + let state = Lib.String.Table.find chan_id table in if position_value state.position < index + 1 then - Eliom_lib.String.Table.add chan_id + Lib.String.Table.add chan_id { state with position = set_position state.position (index + 1) } table @@ -459,7 +457,7 @@ end = struct with Not_found -> table) | chan_id, Ecb.Closed | chan_id, Ecb.Full -> stop_waiting hd chan_id; - Eliom_lib.String.Table.remove chan_id table) + Lib.String.Table.remove chan_id table) !r message in r := table @@ -530,7 +528,7 @@ end = struct Lwt.return (add_no_index l)) (fun e -> match e with - | Eliom_request.Failed_request (0 | 502 | 504) -> + | Request.Failed_request (0 | 502 | 504) -> if retries > max_retries then ( Logs.app ~src:section (fun fmt -> fmt "connection failure"); @@ -570,12 +568,12 @@ end = struct call_commands hd [|Ecb.Close chan_id|] | Stateless_state map -> ( try - let state = Eliom_lib.String.Table.find chan_id !map in + let state = Lib.String.Table.find chan_id !map in if state.count = 1 - then map := Eliom_lib.String.Table.remove chan_id !map + then map := Lib.String.Table.remove chan_id !map else map := - Eliom_lib.String.Table.add chan_id + Lib.String.Table.add chan_id {state with count = state.count - 1} !map with Not_found -> @@ -584,7 +582,7 @@ end = struct let add_channel_stateful hd chan_id = hd.hd_activity.active_channels <- - Eliom_lib.String.Set.add chan_id hd.hd_activity.active_channels; + Lib.String.Set.add chan_id hd.hd_activity.active_channels; call_commands hd [|Eliom_comet_base.Register chan_id|] let min_pos = function @@ -603,18 +601,18 @@ end = struct | Ecb.Last_kind i -> Ecb.Last i in hd.hd_activity.active_channels <- - Eliom_lib.String.Set.add chan_id hd.hd_activity.active_channels; + Lib.String.Set.add chan_id hd.hd_activity.active_channels; match hd.hd_state with | Stateful_state _ -> assert false | Stateless_state map -> (let state = try - let old_state = Eliom_lib.String.Table.find chan_id !map in + let old_state = Lib.String.Table.find chan_id !map in let pos = min_pos (old_state.position, pos) in {count = old_state.count + 1; position = pos} with Not_found -> {count = 1; position = pos} in - map := Eliom_lib.String.Table.add chan_id state !map); + map := Lib.String.Table.add chan_id state !map); restart hd let init_activity () = @@ -626,12 +624,12 @@ end = struct ; active_wakener ; restart_waiter ; restart_wakener - ; active_channels = Eliom_lib.String.Set.empty } + ; active_channels = Lib.String.Set.empty } let make hd_service hd_kind = let hd_state = match hd_kind with - | Stateless -> Stateless_state (ref Eliom_lib.String.Table.empty) + | Stateless -> Stateless_state (ref Lib.String.Table.empty) | Stateful -> Stateful_state (ref 0) in let hd = {hd_service; hd_state; hd_activity = init_activity ()} in @@ -704,7 +702,7 @@ let close = function let {hd_service_handler; _} = get_stateless_hd chan_service in Service_handler.close hd_service_handler (Ecb.string_of_chan_id chan_id) -let unmarshal s : 'a = Eliom_unwrap.unwrap (Eliom_lib.Url.decode s) 0 +let unmarshal s : 'a = Unwrap.unwrap (Lib.Url.decode s) 0 type position_relation = | Equal @@ -792,8 +790,7 @@ let register ?(wake = true) (wrapped_chan : 'a Ecb.wrapped_channel) = let internal_unwrap (wrapped_chan, _unwrapper) = register wrapped_chan let () = - Eliom_unwrap.register_unwrapper Eliom_common.comet_channel_unwrap_id - internal_unwrap + Unwrap.register_unwrapper Eliom_common.comet_channel_unwrap_id internal_unwrap let is_active () = (*VVV Check. Isn't it the contrary? (fold from `Inactive?) *) diff --git a/src/lib/comet.server.ml b/src/lib/comet.server.ml index 896d880c4e..e1e3991b64 100644 --- a/src/lib/comet.server.ml +++ b/src/lib/comet.server.ml @@ -43,9 +43,9 @@ let error_msg s = answer_to_string (Eliom_comet_base.Comet_error s) let json_content_type = "application/json" let marshal (v : 'a) = - let wrapped = Eliom_wrap.wrap v in + let wrapped = Wrap.wrap v in let value : 'a Eliom_runtime.eliom_comet_data_type = wrapped in - Eliom_lib.Url.encode ~plus:false (Marshal.to_string value []) + Lib.Url.encode ~plus:false (Marshal.to_string value []) exception New_connection @@ -55,27 +55,25 @@ module Comet_param = struct let translate content = Lwt.return (content, json_content_type) end -module Comet = - Eliom_registration.Customize (Eliom_registration.String) (Comet_param) +module Comet = Registration.Customize (Registration.String) (Comet_param) let comet_path = ["__eliom_comet__"] let comet_global_path = ["__eliom_comet_global__"] let fallback_service = Eliom_common.lazy_site_value_from_fun @@ fun () -> - Comet.create ~meth:(Eliom_service.Get Eliom_parameter.unit) - ~path:(Eliom_service.Path comet_path) (fun () () -> - Lwt.return state_closed_msg) + Comet.create ~meth:(Service.Get Parameter.unit) + ~path:(Service.Path comet_path) (fun () () -> Lwt.return state_closed_msg) let fallback_global_service = Eliom_common.lazy_site_value_from_fun @@ fun () -> - Comet.create ~meth:(Eliom_service.Get Eliom_parameter.unit) - ~path:(Eliom_service.Path comet_global_path) (fun () () -> + Comet.create ~meth:(Service.Get Parameter.unit) + ~path:(Service.Path comet_global_path) (fun () () -> Lwt.return (error_msg "request with no post parameters, or there isn't any registered site comet channel")) -let new_id = Eliom_lib.make_cryptographic_safe_string +let new_id = Lib.make_cryptographic_safe_string (* ocsigenserver needs to be modified for this to be configurable: the connection is closed after a fixed amount of time @@ -181,7 +179,7 @@ end = struct let get_channel (ch_id, position) = match find_channel ch_id with - | Some channel -> Eliom_lib.Left (channel, position) + | Some channel -> Lib.Left (channel, position) | None -> Right ch_id exception @@ -198,8 +196,8 @@ end = struct with Finished l -> l let get_available_data = function - | Eliom_lib.Right ch_id -> [ch_id, Eliom_comet_base.Closed] - | Eliom_lib.Left (channel, position) -> ( + | Lib.Right ch_id -> [ch_id, Eliom_comet_base.Closed] + | Lib.Left (channel, position) -> ( match position with (* the first request of the client should be with i = 1 *) (* when the client is requesting the newest data, only return @@ -225,9 +223,9 @@ end = struct queue_take channel i) let has_data = function - | Eliom_lib.Right _ -> + | Lib.Right _ -> true (* a channel was closed: need to tell it to the client *) - | Eliom_lib.Left (channel, position) -> ( + | Lib.Left (channel, position) -> ( match position with | Eliom_comet_base.Newest i when i > channel.ch_index -> false | Eliom_comet_base.Newest _ -> true @@ -239,9 +237,9 @@ end = struct let really_wait_data requests = let rec make_list = function | [] -> [] - | Eliom_lib.Left (channel, _) :: q -> + | Lib.Left (channel, _) :: q -> Lwt_condition.wait channel.ch_wakeup :: make_list q - | Eliom_lib.Right _ :: _ -> assert false + | Lib.Right _ :: _ -> assert false (* closed channels are considered to have data *) in Lwt.pick (make_list requests) @@ -274,7 +272,7 @@ end = struct (*VVV Why isn't this a POST non-attached coservice? --Vincent *) Comet.create_attached_post ~post_params: - Eliom_parameter.(bool "idle" ** Eliom_comet_base.comet_request_param) + Parameter.(bool "idle" ** Eliom_comet_base.comet_request_param) ~fallback:(Eliom_common.force_lazy_site_value fallback_global_service) handle_request @@ -513,9 +511,7 @@ end = struct List.filter (( <> ) chan_id) handler.hd_registered_chan_id let wait_closed_connection () = - let* () = - Ocsigen_request.connection_closed (Eliom_request_info.get_ri ()) - in + let* () = Ocsigen_request.connection_closed (Request_info.get_ri ()) in Lwt.fail Connection_closed (* register the service handler.hd_service *) @@ -586,7 +582,7 @@ end = struct (* as of now only `Client_process scope are handled: so we only stock scope_hierarchy *) type handler_ref_table = ( Eliom_common.scope_hierarchy - , handler option Eliom_reference.Volatile.eref ) + , handler option Reference.Volatile.eref ) Hashtbl.t let handler_ref_table : handler_ref_table = Hashtbl.create 1 @@ -598,24 +594,22 @@ end = struct try Hashtbl.find handler_ref_table scope_hierarchy with Not_found -> let eref = - Eliom_reference.Volatile.eref ~scope:(`Client_process scope_hierarchy) - None + Reference.Volatile.eref ~scope:(`Client_process scope_hierarchy) None in Hashtbl.add handler_ref_table scope_hierarchy eref; eref let get_handler scope = let eref = get_handler_eref scope in - match Eliom_reference.Volatile.get eref with + match Reference.Volatile.get eref with | Some t -> t | None -> let hd_service = Eliom_comet_base.Internal_comet_service (* CCC ajouter possibilité d'https *) - ( Eliom_service.create_attached_post - (*VVV Why is it attached? --Vincent *) + ( Service.create_attached_post (*VVV Why is it attached? --Vincent *) ~post_params: - Eliom_parameter.( + Parameter.( bool "idle" ** Eliom_comet_base.comet_request_param) ~fallback:(Eliom_common.force_lazy_site_value fallback_service) (*~name:"comet" (* CCC faut il mettre un nom ? *)*) @@ -632,7 +626,7 @@ end = struct ; hd_last = "", -1 ; hd_activity = Inactive (Unix.gettimeofday ()) } in - Eliom_reference.Volatile.set eref (Some handler); + Reference.Volatile.set eref (Some handler); run_handler handler; handler @@ -856,12 +850,12 @@ end = struct let external_channel ?(history = 1) ?(newest = false) ~prefix ~name () = let service = - Eliom_service.extern ~prefix ~path:comet_global_path + Service.extern ~prefix ~path:comet_global_path ~meth: - (Eliom_service.Post - ( Eliom_parameter.unit - , Eliom_parameter.( - bool "idle" ** Eliom_comet_base.comet_request_param) )) + (Service.Post + ( Parameter.unit + , Parameter.(bool "idle" ** Eliom_comet_base.comet_request_param) + )) () in let last = if newest then None else Some history in diff --git a/src/lib/config.server.ml b/src/lib/config.server.ml index a9ef09e749..dd8e05c7ae 100644 --- a/src/lib/config.server.ml +++ b/src/lib/config.server.ml @@ -92,28 +92,28 @@ let add_ignored_post_params regexp = let set_omitpersistentstorage v = Eliommod.default_omitpersistentstorage := v let get_default_hostname () = - let sitedata = Eliom_request_info.find_sitedata "get_default_hostname" in + let sitedata = Request_info.find_sitedata "get_default_hostname" in (Eliom_common.get_config_info sitedata).Ocsigen_extensions.default_hostname let get_default_port () = - let sitedata = Eliom_request_info.find_sitedata "get_default_port" in + let sitedata = Request_info.find_sitedata "get_default_port" in (Eliom_common.get_config_info sitedata).Ocsigen_extensions.default_httpport let get_default_sslport () = - let sitedata = Eliom_request_info.find_sitedata "get_default_sslport" in + let sitedata = Request_info.find_sitedata "get_default_sslport" in (Eliom_common.get_config_info sitedata).Ocsigen_extensions.default_httpsport let default_protocol_is_https () = - let sitedata = Eliom_request_info.find_sitedata "default_protocol_is_https" in + let sitedata = Request_info.find_sitedata "default_protocol_is_https" in (Eliom_common.get_config_info sitedata) .Ocsigen_extensions.default_protocol_is_https let get_default_links_xhr () = - let sitedata = Eliom_request_info.find_sitedata "get_default_links_xhr" in + let sitedata = Request_info.find_sitedata "get_default_links_xhr" in sitedata.Eliom_common.default_links_xhr#get let set_default_links_xhr ?override_configfile:_ v = - let sitedata = Eliom_request_info.find_sitedata "set_default_links_xhr" in + let sitedata = Request_info.find_sitedata "set_default_links_xhr" in sitedata.Eliom_common.default_links_xhr#set v let get_config_default_charset_sp sp = @@ -140,8 +140,7 @@ let get_config () = | None -> failwith "No config file. Is it a statically linked executable?") | None -> raise - (Eliom_common.Eliom_site_information_not_available - "Eliom_config.get_config") + (Eliom_common.Eliom_site_information_not_available "Config.get_config") let parse_config ?pcdata ?other_elements elements = Ocsigen_extensions.Configuration.process_elements diff --git a/src/lib/config.server.mli b/src/lib/config.server.mli index 067396e9b2..bfc9bd2840 100644 --- a/src/lib/config.server.mli +++ b/src/lib/config.server.mli @@ -22,7 +22,7 @@ file. It make also possible to add configuration options in configuration file for your Eliom modules. - Use {!Eliom_config.parse_config} for that. + Use {!Config.parse_config} for that. Example: @@ -103,7 +103,7 @@ val set_enable_wasm : bool -> unit val get_enable_wasm : unit -> bool (** Get the current global setting for WebAssembly support. *) -val set_cache_global_data : (Eliom_lib.Url.path * int) option -> unit +val set_cache_global_data : (Lib.Url.path * int) option -> unit val set_html_content_type : string -> unit val add_ignored_get_params : string * Re.re -> unit val add_ignored_post_params : string * Re.re -> unit @@ -145,8 +145,8 @@ val get_config_default_charset : unit -> string val set_default_links_xhr : ?override_configfile:bool -> bool -> unit (** The provided value serves as a default value for the optional parameter - [~xhr] in the functions [Eliom_registration.*.{a, get_form, post_form, - lwt_get_form, lwt_post_form}] (cf. {!Eliom_registration.Html.a} et al.). + [~xhr] in the functions [Registration.*.{a, get_form, post_form, + lwt_get_form, lwt_post_form}] (cf. {!Registration.Html.a} et al.). This value can also be set in the {{!page-config}config file}. *) @@ -167,7 +167,7 @@ val get_config : unit -> Xml.xml list {!Eliom_common.Eliom_site_information_not_available}. If you want to build a statically linkable module, you must call this function inside the initialisation function given to - {!Eliom_service.register_eliom_module}.} + {!Service.register_eliom_module}.} *) val parse_config : @@ -177,8 +177,8 @@ val parse_config : -> unit (** Process the configuration (same as the one returned by - {!Eliom_config.get_config}) - by a given specification (cf. {!Ocsigen_extensions.Configuration.element}) *) + {% <> %}) + by a given specification (cf. {% <> %}) *) val get_config_info : unit -> Ocsigen_extensions.config_info (** The function [get_config_info ()] returns the information diff --git a/src/lib/content.client.mli b/src/lib/content.client.mli index 2c3c6ec518..63761f8f59 100644 --- a/src/lib/content.client.mli +++ b/src/lib/content.client.mli @@ -26,7 +26,7 @@ open Js_of_ocaml {{!page-"clientserver-html"}Eliom's manual} for more information on HTML generation. } You can also have a look at the server API of - {!Eliom_content} + {% <> %} for an explication of the modules [F] and [D]. *) @@ -284,7 +284,8 @@ module Svg : sig val of_pcdata : [> `Pcdata] elt -> Dom.text Js.t end - (** Conversion functions from DOM nodes ({!Js_of_ocaml.Dom_html.element} {!Js_of_ocaml.Js.t}) to Eliom nodes ({!Eliom_content.Html.elt}). *) + (** Conversion functions from DOM nodes ({% <> %} {% <> %}) to Eliom nodes ({% <> %}). *) module Of_dom : sig val of_element : Dom_html.element Js.t -> 'a elt end @@ -331,7 +332,7 @@ module Html : sig include module type of Raw' include - Eliom_content_sigs.LINKS_AND_FORMS + Content_sigs.LINKS_AND_FORMS with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri @@ -363,7 +364,7 @@ module Html : sig include module type of Raw' include - Eliom_content_sigs.LINKS_AND_FORMS + Content_sigs.LINKS_AND_FORMS with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri @@ -379,7 +380,7 @@ module Html : sig (** {2 Content creation} See {!Html_sigs.T}, If you want to create an untyped form, - you will have to use {!Eliom_content.Html.D.Raw} + you will have to use {% <> %} otherwise, use the form module. For more information, see {{!page-"server-links".forms}the manual}. *) @@ -458,7 +459,8 @@ module Html : sig -> unit -> 'a t (** Create a custom data field by providing string conversion functions. - If the [default] is provided, calls to {!Eliom_content.Html.Custom_data.get_dom} return that instead of throwing an + If the [default] is provided, calls to {% <> %} return that instead of throwing an exception [Not_found]. *) val create_json : name:string -> ?default:'a -> 'a Deriving_Json.t -> 'a t @@ -467,7 +469,7 @@ module Html : sig val attrib : 'a t -> 'a -> [> `User_data] attrib (** [attrib my_data value ] creates a HTML5 attribute for the custom-data type [my_data] with value [value] for injecting it into an a HTML5 tree - ({!Eliom_content.Html.elt}). *) + ({% <> %}). *) val get_dom : Dom_html.element Js.t -> 'a t -> 'a val set_dom : Dom_html.element Js.t -> 'a t -> 'a -> unit @@ -906,7 +908,8 @@ module Html : sig end module Of_dom : Js_of_ocaml_tyxml.Tyxml_cast_sigs.OF with type 'a elt = 'a elt - (** Conversion functions from DOM nodes ({!Js_of_ocaml.Dom_html.element} {!Js_of_ocaml.Js.t}) to Eliom nodes ({!Eliom_content.Html.elt}). *) + (** Conversion functions from DOM nodes ({% <> %} {% <> %}) to Eliom nodes ({% <> %}). *) end val force_link : unit @@ -915,8 +918,8 @@ val force_link : unit val set_client_fun : ?app:string - -> service:('a, 'b, _, _, _, _, _, _, _, _, _) Eliom_service.t - -> ('a -> 'b -> Eliom_service.result Lwt.t) + -> service:('a, 'b, _, _, _, _, _, _, _, _, _) Service.t + -> ('a -> 'b -> Service.result Lwt.t) -> unit val set_form_error_handler : (unit -> bool Lwt.t) -> unit diff --git a/src/lib/content.eliom b/src/lib/content.eliom index bdec85aee4..224209b841 100644 --- a/src/lib/content.eliom +++ b/src/lib/content.eliom @@ -89,5 +89,5 @@ module Html = struct end end] -let%client set_client_fun = Eliom_service.set_client_fun +let%client set_client_fun = Service.set_client_fun let%client set_form_error_handler = Eliom_form.set_error_handler diff --git a/src/lib/content.server.mli b/src/lib/content.server.mli index 6256b4fe29..c7f4bae8e4 100644 --- a/src/lib/content.server.mli +++ b/src/lib/content.server.mli @@ -22,18 +22,18 @@ (** XML tree manipulation within Eliom is based on the TyXML library but Eliom is using a custom representation for XML values (see - {!Xml}). Then, [Eliom_content] redefines the two high level + {!Xml}). Then, [Content] redefines the two high level interfaces ({!Svg}, {!Html}) that are provided by TyXML for valid XML tree creation and printing. - - If you want to generate typed HTML, use {!Eliom_content.Html}, - - If you want to write untyped html, use {!Eliom_content.Html_text}, - - If you want to generate typed svg, use {!Eliom_content.Svg}. + - If you want to generate typed HTML, use {!Content.Html}, + - If you want to write untyped html, use {!Content.Html_text}, + - If you want to generate typed svg, use {!Content.Svg}. - Modules {!Eliom_content.Html}, {!Eliom_content.Svg} contain two - sub-modules: {!Eliom_content.Html.F}, {!Eliom_content.Html.D} + Modules {!Content.Html}, {!Content.Svg} contain two + sub-modules: {!Content.Html.F}, {!Content.Html.D} corresponding to tow different semantics. - They also contain a module {!Eliom_content.Html.C} that allows to + They also contain a module {!Content.Html.C} that allows to inject client-side content into server-side content. {5 Functional semantics} @@ -63,8 +63,8 @@ Secondly, those values have an identifier, which means they can be referred to on client side (by [%variable]) or used with the functions in - {!Eliom_content.Html.To_dom} and - {!Eliom_content.Html.Manip}. + {% <> %} and + {% <> %}. In case of doubt, always use [D]-nodes when you are writing a client-server Eliom app. You can also mix F-nodes and D-nodes. @@ -112,8 +112,9 @@ module Xml : sig type caml_event_handler (** Values of type [caml_event_handler] represents event handler build with the [{{ ... }}] syntax (see the Eliom manual for more - information on {{!page-"clientserver-html".syntax}syntax extension}). Such values are - expected by functions like {!Eliom_content.Html.a_onclick}. *) + information on {% <>%}). Such values are + expected by functions like {!Content.Html.a_onclick}. *) (**/**) @@ -138,7 +139,7 @@ module Xml : sig | RACamlEventHandler of caml_event_handler | RALazyStr of string Eliom_lazy.request | RALazyStrL of separator * string Eliom_lazy.request list - | RAClient of string * attrib option * Eliom_lib.poly + | RAClient of string * attrib option * Lib.poly (* attrib client_value *) val racontent : attrib -> racontent @@ -146,8 +147,8 @@ module Xml : sig (**/**) - val wrap : elt -> 'a -> 'a Eliom_wrap.wrapped_value - (** [Eliom_content.Xml.wrap page v] is like [Eliom_wrap.wrap v] but + val wrap : elt -> 'a -> 'a Wrap.wrapped_value + (** [Content.Xml.wrap page v] is like [Wrap.wrap v] but it makes sure that all [elt]s in [v] which are included in [page] are sent with empty content. This is safe because such elements will be taken from the DOM on the client either @@ -156,8 +157,8 @@ end module Xml_shared : Xml_sigs.T - with type 'a W.t = 'a Eliom_shared.React.S.t - and type 'a W.tlist = 'a Eliom_shared.ReactiveData.RList.t + with type 'a W.t = 'a Shared.React.S.t + and type 'a W.tlist = 'a Shared.ReactiveData.RList.t and type event_handler = (Dom_html.event Js.t -> unit) Eliom_client_value.t and type mouse_event_handler = (Dom_html.mouseEvent Js.t -> unit) Eliom_client_value.t @@ -230,7 +231,7 @@ module Svg : sig end (** Creation of SVG content from shared reactive signals and data - ({!Eliom_shared}). + ({% <> %}). For the operations provided, see {!Svg_sigs.T}. *) module R : sig @@ -244,7 +245,7 @@ module Svg : sig val pcdata : string Xml.W.t -> [> `Unimplemented] (** [pcdata] is not implemented reactively for SVG. *) - val node : 'a elt Eliom_shared.React.S.t -> 'a elt + val node : 'a elt Shared.React.S.t -> 'a elt (** [node s] produces an ['a elt] out of the shared reactive signal [s]. *) end @@ -318,12 +319,13 @@ module Html : sig (**/**) (** Creation of {b F}unctional HTML5 content (copy-able but not - referable, see also {!Eliom_content}). *) + referable, see also {% <> %}). *) module F : sig (** {2 Content creation} - See {!Html_sigs.T}. - If you want to create an untyped form, you will have to use {!Eliom_content.Html.F.Raw} otherwise, use + See {% <> %}. + If you want to create an untyped form, you will have to use {% + <> %} otherwise, use Eliom form widgets. For more information, see {{!page-"server-links".forms}the manual}. *) @@ -347,7 +349,7 @@ module Html : sig include module type of Raw' include - Eliom_content_sigs.LINKS_AND_FORMS + Content_sigs.LINKS_AND_FORMS with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri @@ -356,12 +358,13 @@ module Html : sig end (** Creation of HTML content with {b D}OM semantics (referable, see - also {!Eliom_content}). *) + also {% <> %}). *) module D : sig (** {2 Content creation} - See {!Html_sigs.T}. - If you want to create an untyped form, you will have to use {!Eliom_content.Html.F.Raw} otherwise, use + See {% <> %}. + If you want to create an untyped form, you will have to use {% + <> %} otherwise, use Eliom form widgets. For more information, see {{!page-"server-links".forms}the manual}. *) @@ -384,7 +387,7 @@ module Html : sig include module type of Raw' include - Eliom_content_sigs.LINKS_AND_FORMS + Content_sigs.LINKS_AND_FORMS with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri @@ -446,7 +449,7 @@ module Html : sig end (** Creation of HTML content from shared reactive signals and data - ({!Eliom_shared}). + ({% <> %}). For the operations provided, see {!Html_sigs.T}. *) module R : sig @@ -455,16 +458,16 @@ module Html : sig with type 'a elt = 'a elt and type 'a attrib = 'a attrib - val pcdata : string Eliom_shared.React.S.t -> [> Html_types.span] elt + val pcdata : string Shared.React.S.t -> [> Html_types.span] elt (** [pcdata s] produces a node of type [\[> Html_types.span\] elt] out of the string signal [s]. *) - val node : 'a elt Eliom_shared.React.S.t -> 'a elt + val node : 'a elt Shared.React.S.t -> 'a elt (** [node s] produces an ['a elt] out of the shared reactive signal [s]. *) - val filter_attrib : 'a attrib -> bool Eliom_shared.React.S.t -> 'a attrib + val filter_attrib : 'a attrib -> bool Shared.React.S.t -> 'a attrib (** [filter_attrib a b] amounts to the attribute [a] while [b] is [true], and to no attribute while [b] is [false]. *) end @@ -483,7 +486,8 @@ module Html : sig -> unit -> 'a t (** Create a custom data field by providing string conversion functions. - If the [default] is provided, calls to {!Eliom_content.Html.Custom_data.get_dom} return that instead of throwing an + If the [default] is provided, calls to {% <> %} return that instead of throwing an exception [Not_found]. *) val create_json : name:string -> ?default:'a -> 'a Deriving_Json.t -> 'a t @@ -492,7 +496,7 @@ module Html : sig val attrib : 'a t -> 'a -> [> `User_data] attrib (** [attrib my_data value ] creates a HTML attribute for the custom-data type [my_data] with value [value] for injecting it into an a HTML tree - ({!Eliom_content.Html.elt}). *) + ({% <> %}). *) end (** {{:http://dev.w3.org/html5/html-xhtml-author-guide/}"Polyglot"} diff --git a/src/lib/content_sigs.shared.mli b/src/lib/content_sigs.shared.mli index 5b5e8c4336..d88e2785d0 100644 --- a/src/lib/content_sigs.shared.mli +++ b/src/lib/content_sigs.shared.mli @@ -34,13 +34,13 @@ module type LINKS_AND_FORMS = sig lazy_star include - Eliom_form_sigs.LINKS + Form_sigs.LINKS with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri module Form : - Eliom_form_sigs.S + Form_sigs.S with type +'a elt := 'a elt and type +'a attrib := 'a attrib and type uri := uri diff --git a/src/lib/cscache.eliom b/src/lib/cscache.eliom index 1262fb0899..c9c0d25450 100644 --- a/src/lib/cscache.eliom +++ b/src/lib/cscache.eliom @@ -4,7 +4,7 @@ open Lwt.Syntax [%%shared.start] -type ('a, 'b) t = (unit -> ('a, 'b Lwt.t) Hashtbl.t) Eliom_shared.Value.t +type ('a, 'b) t = (unit -> ('a, 'b Lwt.t) Hashtbl.t) Shared.Value.t let%client create_ () = let c = Hashtbl.create 100 in @@ -12,16 +12,16 @@ let%client create_ () = let%server create_ () = let c = - Eliom_reference.Volatile.eref_from_fun ~scope:Eliom_common.request_scope + Reference.Volatile.eref_from_fun ~scope:Eliom_common.request_scope (fun () -> Hashtbl.create 10) in - fun () -> Eliom_reference.Volatile.get c + fun () -> Reference.Volatile.get c let%server create () = - Eliom_shared.Value.create (create_ ()) [%client.unsafe create_ ()] + Shared.Value.create (create_ ()) [%client.unsafe create_ ()] let do_cache_raw cache id data = - let c = Eliom_shared.Value.local cache () in + let c = Shared.Value.local cache () in Hashtbl.replace c id data; (* Do not cache exceptions *) ignore (Lwt.catch (fun _ -> data) (fun e -> Hashtbl.remove c id; Lwt.fail e)) @@ -33,7 +33,7 @@ let%server do_cache cache id v = ignore [%client.unsafe (do_cache ~%cache ~%id ~%v : unit)] let%server find cache get_data id = - try Hashtbl.find ((Eliom_shared.Value.local cache) ()) id + try Hashtbl.find ((Shared.Value.local cache) ()) id with Not_found -> let th = let* v = get_data id in @@ -53,12 +53,12 @@ let%client load cache get_data id = do_cache_raw cache id th; th let%client find cache get_data id = - try Hashtbl.find ((Eliom_shared.Value.local cache) ()) id + try Hashtbl.find ((Shared.Value.local cache) ()) id with Not_found -> load cache get_data id exception Not_ready -let local_find cache id = Hashtbl.find ((Eliom_shared.Value.local cache) ()) id +let local_find cache id = Hashtbl.find ((Shared.Value.local cache) ()) id let find_if_ready cache id = let v = local_find cache id in diff --git a/src/lib/cscache.eliomi b/src/lib/cscache.eliomi index edfafed6ee..1a75af450d 100644 --- a/src/lib/cscache.eliomi +++ b/src/lib/cscache.eliomi @@ -4,11 +4,11 @@ keeping data on client side or keeping values in memory during a request. - When you get a piece of data through Eliom_cscache from client-side, + When you get a piece of data through Cscache from client-side, the request to the server is done only if the data is not already in the client-side cache. - On server side, Eliom_cscache is using a temporary cache + On server side, Cscache is using a temporary cache (with "request" scope) to avoid fetching the data several time from the database during the same request. This server-side cache is automatically sent to the client to fill the client-side @@ -20,7 +20,7 @@ client-server (possibly reactive) applications, like, for example, handling delays correctly both on client and server sides. - In the near future, Eliom_cscache will make it possible to save persistent + In the near future, Cscache will make it possible to save persistent data, which is useful for implementing off-line applications. *) diff --git a/src/lib/eliom_client_base.shared.ml b/src/lib/eliom_client_base.shared.ml index 97f32300e2..09520e154c 100644 --- a/src/lib/eliom_client_base.shared.ml +++ b/src/lib/eliom_client_base.shared.ml @@ -1,13 +1,13 @@ type ('a, 'b) server_function_service = ( unit , 'a - , Eliom_service.post - , Eliom_service.non_att - , Eliom_service.co - , Eliom_service.non_ext - , Eliom_service.reg + , Service.post + , Service.non_att + , Service.co + , Service.non_ext + , Service.reg , [`WithoutSuffix] , unit - , [`One of 'a Eliom_parameter.ocaml] Eliom_parameter.param_name - , 'b Eliom_service.ocaml ) - Eliom_service.t + , [`One of 'a Parameter.ocaml] Parameter.param_name + , 'b Service.ocaml ) + Service.t diff --git a/src/lib/eliom_client_core.client.ml b/src/lib/eliom_client_core.client.ml index 726adcc4e5..dda98cb25f 100644 --- a/src/lib/eliom_client_core.client.ml +++ b/src/lib/eliom_client_core.client.ml @@ -22,7 +22,7 @@ open Lwt.Syntax *) open Js_of_ocaml -open Eliom_lib +open Lib module Xml = Eliom_content_core.Xml (* Logs *) @@ -85,14 +85,14 @@ end = struct let pos = match Eliom_runtime.Client_value_server_repr.loc server_value with | None -> "" - | Some p -> Printf.sprintf "(%s)" (Eliom_lib.pos_to_string p) + | Some p -> Printf.sprintf "(%s)" (Lib.pos_to_string p) in raise_error ~section "Client closure %s not found %s (is the module linked on the client?)" closure_id pos in let value = closure args in - Eliom_unwrap.late_unwrap_value server_value value; + Unwrap.late_unwrap_value server_value value; (* Only register global client values *) let instance_id = Eliom_runtime.Client_value_server_repr.instance_id server_value @@ -130,11 +130,10 @@ end = struct match ident, pos with | None, None -> Printf.sprintf "%s" name | None, Some pos -> - Printf.sprintf "%s at %s" name (Eliom_lib.pos_to_string pos) + Printf.sprintf "%s at %s" name (Lib.pos_to_string pos) | Some i, None -> Printf.sprintf "%s (%s)" name i | Some i, Some pos -> - Printf.sprintf "%s (%s at %s)" name i - (Eliom_lib.pos_to_string pos) + Printf.sprintf "%s (%s at %s)" name i (Lib.pos_to_string pos) in raise_error "Did not find injection %s" name)) @@ -313,8 +312,8 @@ let raw_a_handler node cookies_info tmpl ev = (* Returns true when the default link behaviour is to be kept: *) middleClick ev || (not !Eliom_common.is_client_app) - && ((https = Some true && not Eliom_request_info.ssl_) - || (https = Some false && Eliom_request_info.ssl_)) + && ((https = Some true && not Request_info.ssl_) + || (https = Some false && Request_info.ssl_)) || ((* If a link is clicked, we do not want to continue propagation (for example if the link is in a wider clickable area) *) @@ -337,15 +336,14 @@ let raw_form_handler form kind cookies_info tmpl ev client_form_handler = Lwt.return_unit in (not !Eliom_common.is_client_app) - && ((https = Some true && not Eliom_request_info.ssl_) - || (https = Some false && Eliom_request_info.ssl_)) + && ((https = Some true && not Request_info.ssl_) + || (https = Some false && Request_info.ssl_)) || (f (); false) let raw_event_handler value = let handler = (*XXX???*) - (Eliom_lib.from_poly (Eliom_lib.to_poly value) - : #Dom_html.event Js.t -> unit) + (Lib.from_poly (Lib.to_poly value) : #Dom_html.event Js.t -> unit) in fun ev -> try handler ev; true with Eliom_client_value.False -> false @@ -375,7 +373,7 @@ let reify_caml_event name node ce = raise_error ~section "not a form element") in raw_form_handler form kind cookies_info tmpl ev - (Eliom_lib.from_poly client_hdlr : client_form_handler)) ) + (Lib.from_poly client_hdlr : client_form_handler)) ) | Xml.CE_client_closure f -> ( name , `Other @@ -553,8 +551,7 @@ let rec rebuild_rattrib node ra = (Js.string (Xml.aname ra)) (Js.string (String.concat "," l))) | Xml.RAClient (_, _, value) -> - rebuild_rattrib node - (Eliom_lib.from_poly (Eliom_lib.to_poly value) : Xml.attrib) + rebuild_rattrib node (Lib.from_poly (Lib.to_poly value) : Xml.attrib) (* TODO: Registering a global "onunload" event handler breaks the 'bfcache' mechanism of Firefox and Safari. We may try to use diff --git a/src/lib/eliom_client_main.eliom b/src/lib/eliom_client_main.eliom index 3328cebfc9..04ab3f9ace 100644 --- a/src/lib/eliom_client_main.eliom +++ b/src/lib/eliom_client_main.eliom @@ -18,11 +18,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -let%client _ = Eliom_client.init () +let%client _ = Client.init () let _ = Eliommod.register_site_init (fun () -> - let sitedata = Eliom_request_info.get_sitedata () in + let sitedata = Request_info.get_sitedata () in let ignored_get_params = List.map fst sitedata.Eliom_common.ignored_get_params in @@ -41,29 +41,29 @@ let _ = [%%client.start] -(* The following lines are for Eliom_bus, Eliom_comet and Eliom_react +(* The following lines are for Bus, Comet and Eliom_react to be linked. *) let _force_link = - Eliom_react.force_link, Eliom_comet.force_link, Eliom_bus.force_link + Eliom_react.force_link, Comet.force_link, Bus.force_link (* Client side implementation of reload actions *) let%shared _ = - Eliom_service.internal_set_client_fun ~service:Eliom_service.reload_action + Service.internal_set_client_fun ~service:Service.reload_action [%client fun () () -> - Lwt.return (Eliom_service.Reload_action {hidden = false; https = false})]; - Eliom_service.internal_set_client_fun - ~service:Eliom_service.reload_action_https + Lwt.return (Service.Reload_action {hidden = false; https = false})]; + Service.internal_set_client_fun + ~service:Service.reload_action_https [%client fun () () -> - Lwt.return (Eliom_service.Reload_action {hidden = false; https = true})]; - Eliom_service.internal_set_client_fun - ~service:Eliom_service.reload_action_hidden + Lwt.return (Service.Reload_action {hidden = false; https = true})]; + Service.internal_set_client_fun + ~service:Service.reload_action_hidden [%client fun () () -> - Lwt.return (Eliom_service.Reload_action {hidden = true; https = false})]; - Eliom_service.internal_set_client_fun - ~service:Eliom_service.reload_action_https_hidden + Lwt.return (Service.Reload_action {hidden = true; https = false})]; + Service.internal_set_client_fun + ~service:Service.reload_action_https_hidden [%client fun () () -> - Lwt.return (Eliom_service.Reload_action {hidden = true; https = true})] + Lwt.return (Service.Reload_action {hidden = true; https = true})] diff --git a/src/lib/eliom_client_value.client.mli b/src/lib/eliom_client_value.client.mli index 30e2258d00..6a65ccb103 100644 --- a/src/lib/eliom_client_value.client.mli +++ b/src/lib/eliom_client_value.client.mli @@ -27,18 +27,21 @@ type 'a t = 'a exception Exception_on_server of string (** This exception is raised (in Lwt) on the client if a call to a - server function {!Eliom_client.server_function} fails (in Lwt) on the server + server function {% <> %} fails (in Lwt) on the server side. The argument describes the original exception by {!Printexc.to_string}. *) -(** Event handlers like {!Eliom_content.Html.F.a_onclick} may raise [False] to cancel the event (as if the JavaScript +(** Event handlers like {% <> %} may raise [False] to cancel the event (as if the JavaScript function returned [false]). *) -(* Cannot re-export exception Eliom_lib.False, +(* Cannot re-export exception Lib.False, cf. http://caml.inria.fr/mantis/view.php?id=5778 *) -(* (\** See {!Eliom_lib.False}. *\) *) +(* (\** See {% <> + %}. *\) *) exception False (**/**) diff --git a/src/lib/eliom_client_value.server.ml b/src/lib/eliom_client_value.server.ml index 54374f560e..b1b15292ca 100644 --- a/src/lib/eliom_client_value.server.ml +++ b/src/lib/eliom_client_value.server.ml @@ -20,8 +20,8 @@ type +'a t = 'a Eliom_runtime.Client_value_server_repr.t let client_value_unwrapper = - Eliom_wrap.create_unwrapper - (Eliom_wrap.id_of_int Eliom_runtime.client_value_unwrap_id_int) + Wrap.create_unwrapper + (Wrap.id_of_int Eliom_runtime.client_value_unwrap_id_int) let create_client_value ~loc ~instance_id = Eliom_runtime.Client_value_server_repr.create ~loc ~instance_id @@ -36,7 +36,5 @@ let client_value_datum ~closure_id ~args ~value = exception Client_value_creation_invalid_context of string -let escaped_value value : - Eliom_runtime.escaped_value (* * Eliom_wrap.unwrapper *) - = +let escaped_value value : Eliom_runtime.escaped_value (* * Wrap.unwrapper *) = Ocsigen_lib.to_poly value diff --git a/src/lib/eliom_client_value.server.mli b/src/lib/eliom_client_value.server.mli index 537be69f06..348e06fd70 100644 --- a/src/lib/eliom_client_value.server.mli +++ b/src/lib/eliom_client_value.server.mli @@ -37,7 +37,7 @@ exception Client_value_creation_invalid_context of string (**/**) val create_client_value : - loc:Eliom_lib.pos option + loc:Lib.pos option -> instance_id:int -> _ Eliom_runtime.Client_value_server_repr.t @@ -52,4 +52,4 @@ val client_value_datum : -> Eliom_runtime.client_value_datum val escaped_value : 'a -> Eliom_runtime.escaped_value -(* * Eliom_wrap.unwrapper *) +(* * Wrap.unwrapper *) diff --git a/src/lib/eliom_comet_base.shared.ml b/src/lib/eliom_comet_base.shared.ml index bb0f21a0f9..6bcef60c4b 100644 --- a/src/lib/eliom_comet_base.shared.ml +++ b/src/lib/eliom_comet_base.shared.ml @@ -55,25 +55,23 @@ type answer = [@@@warning "+39"] -let comet_request_param = - Eliom_parameter.ocaml "comet_request" [%json: comet_request] +let comet_request_param = Parameter.ocaml "comet_request" [%json: comet_request] type comet_service = | Comet_service : ( unit , bool * comet_request - , Eliom_service.post - , Eliom_service.att + , Service.post + , Service.att , _ , _ , _ , [`WithoutSuffix] , unit - , [`One of bool] Eliom_parameter.param_name - * [`One of comet_request Eliom_parameter.ocaml] - Eliom_parameter.param_name - , Eliom_service.non_ocaml ) - Eliom_service.t + , [`One of bool] Parameter.param_name + * [`One of comet_request Parameter.ocaml] Parameter.param_name + , Service.non_ocaml ) + Service.t * command list ref -> comet_service @@ -81,18 +79,17 @@ type internal_comet_service = | Internal_comet_service : ( unit , bool * comet_request - , Eliom_service.post - , Eliom_service.att + , Service.post + , Service.att , _ - , Eliom_service.non_ext - , Eliom_service.reg + , Service.non_ext + , Service.reg , [`WithoutSuffix] , unit - , [`One of bool] Eliom_parameter.param_name - * [`One of comet_request Eliom_parameter.ocaml] - Eliom_parameter.param_name - , Eliom_service.non_ocaml ) - Eliom_service.t + , [`One of bool] Parameter.param_name + * [`One of comet_request Parameter.ocaml] Parameter.param_name + , Service.non_ocaml ) + Service.t * command list ref -> internal_comet_service @@ -109,16 +106,16 @@ type 'a bus_send_service = | Bus_send_service : ( unit , 'a list - , Eliom_service.post - , Eliom_service.non_att - , Eliom_service.co - , Eliom_service.non_ext - , Eliom_service.reg + , Service.post + , Service.non_att + , Service.co + , Service.non_ext + , Service.reg , [`WithoutSuffix] , unit - , [`One of 'a list Eliom_parameter.ocaml] Eliom_parameter.param_name - , Eliom_service.non_ocaml ) - Eliom_service.t + , [`One of 'a list Parameter.ocaml] Parameter.param_name + , Service.non_ocaml ) + Service.t -> 'a bus_send_service type ('a, 'b) wrapped_bus = 'b wrapped_channel * 'a bus_send_service diff --git a/src/lib/eliom_comet_base.shared.mli b/src/lib/eliom_comet_base.shared.mli index 05627dcd1d..405a906071 100644 --- a/src/lib/eliom_comet_base.shared.mli +++ b/src/lib/eliom_comet_base.shared.mli @@ -44,9 +44,8 @@ type comet_request = val comet_request_param : ( comet_request , [`WithoutSuffix] - , [`One of comet_request Eliom_parameter.ocaml] Eliom_parameter.param_name - ) - Eliom_parameter.params_type + , [`One of comet_request Parameter.ocaml] Parameter.param_name ) + Parameter.params_type type 'a channel_data = Data of 'a | Full | Closed [@@deriving json] @@ -62,18 +61,17 @@ type comet_service = | Comet_service : ( unit , bool * comet_request - , Eliom_service.post - , Eliom_service.att + , Service.post + , Service.att , _ , _ , _ , [`WithoutSuffix] , unit - , [`One of bool] Eliom_parameter.param_name - * [`One of comet_request Eliom_parameter.ocaml] - Eliom_parameter.param_name - , Eliom_service.non_ocaml ) - Eliom_service.t + , [`One of bool] Parameter.param_name + * [`One of comet_request Parameter.ocaml] Parameter.param_name + , Service.non_ocaml ) + Service.t * command list ref -> comet_service @@ -81,18 +79,17 @@ type internal_comet_service = | Internal_comet_service : ( unit , bool * comet_request - , Eliom_service.post - , Eliom_service.att + , Service.post + , Service.att , _ - , Eliom_service.non_ext - , Eliom_service.reg + , Service.non_ext + , Service.reg , [`WithoutSuffix] , unit - , [`One of bool] Eliom_parameter.param_name - * [`One of comet_request Eliom_parameter.ocaml] - Eliom_parameter.param_name - , Eliom_service.non_ocaml ) - Eliom_service.t + , [`One of bool] Parameter.param_name + * [`One of comet_request Parameter.ocaml] Parameter.param_name + , Service.non_ocaml ) + Service.t * command list ref -> internal_comet_service @@ -109,16 +106,16 @@ type 'a bus_send_service = | Bus_send_service : ( unit , 'a list - , Eliom_service.post - , Eliom_service.non_att - , Eliom_service.co - , Eliom_service.non_ext - , Eliom_service.reg + , Service.post + , Service.non_att + , Service.co + , Service.non_ext + , Service.reg , [`WithoutSuffix] , unit - , [`One of 'a list Eliom_parameter.ocaml] Eliom_parameter.param_name - , Eliom_service.non_ocaml ) - Eliom_service.t + , [`One of 'a list Parameter.ocaml] Parameter.param_name + , Service.non_ocaml ) + Service.t -> 'a bus_send_service type ('a, 'b) wrapped_bus = 'b wrapped_channel * 'a bus_send_service diff --git a/src/lib/eliom_common.client.ml b/src/lib/eliom_common.client.ml index 4f606702c4..379c37733b 100644 --- a/src/lib/eliom_common.client.ml +++ b/src/lib/eliom_common.client.ml @@ -29,21 +29,18 @@ type 'a wrapper = unit let make_wrapper _ : 'a wrapper = () let empty_wrapper () : 'a wrapper = () -type unwrap_id = Eliom_unwrap.unwrap_id +type unwrap_id = Unwrap.unwrap_id -let react_up_unwrap_id : unwrap_id = - Eliom_unwrap.id_of_int react_up_unwrap_id_int - -let react_down_unwrap_id : unwrap_id = - Eliom_unwrap.id_of_int react_down_unwrap_id_int +let react_up_unwrap_id : unwrap_id = Unwrap.id_of_int react_up_unwrap_id_int +let react_down_unwrap_id : unwrap_id = Unwrap.id_of_int react_down_unwrap_id_int let signal_down_unwrap_id : unwrap_id = - Eliom_unwrap.id_of_int signal_down_unwrap_id_int + Unwrap.id_of_int signal_down_unwrap_id_int let comet_channel_unwrap_id : unwrap_id = - Eliom_unwrap.id_of_int comet_channel_unwrap_id_int + Unwrap.id_of_int comet_channel_unwrap_id_int -let bus_unwrap_id : unwrap_id = Eliom_unwrap.id_of_int bus_unwrap_id_int +let bus_unwrap_id : unwrap_id = Unwrap.id_of_int bus_unwrap_id_int (* On client side, we have sitedata. Thus, we can define new services. diff --git a/src/lib/eliom_common.server.ml b/src/lib/eliom_common.server.ml index c221dcd5cd..d6d36378f1 100644 --- a/src/lib/eliom_common.server.ml +++ b/src/lib/eliom_common.server.ml @@ -19,7 +19,7 @@ open Lwt.Syntax * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib include Eliom_common_base exception Eliom_Session_expired @@ -1404,28 +1404,24 @@ end (**** Wrapper type shared by client/server side ***) -type 'a wrapper = 'a Eliom_wrap.wrapper +type 'a wrapper = 'a Wrap.wrapper -let make_wrapper f = Eliom_wrap.create_wrapper f -let empty_wrapper () = Eliom_wrap.empty_wrapper +let make_wrapper f = Wrap.create_wrapper f +let empty_wrapper () = Wrap.empty_wrapper -type unwrap_id = Eliom_wrap.unwrap_id -type unwrapper = Eliom_wrap.unwrapper +type unwrap_id = Wrap.unwrap_id +type unwrapper = Wrap.unwrapper -let make_unwrapper = Eliom_wrap.create_unwrapper -let empty_unwrapper = Eliom_wrap.empty_unwrapper -let react_up_unwrap_id : unwrap_id = Eliom_wrap.id_of_int react_up_unwrap_id_int - -let react_down_unwrap_id : unwrap_id = - Eliom_wrap.id_of_int react_down_unwrap_id_int - -let signal_down_unwrap_id : unwrap_id = - Eliom_wrap.id_of_int signal_down_unwrap_id_int +let make_unwrapper = Wrap.create_unwrapper +let empty_unwrapper = Wrap.empty_unwrapper +let react_up_unwrap_id : unwrap_id = Wrap.id_of_int react_up_unwrap_id_int +let react_down_unwrap_id : unwrap_id = Wrap.id_of_int react_down_unwrap_id_int +let signal_down_unwrap_id : unwrap_id = Wrap.id_of_int signal_down_unwrap_id_int let comet_channel_unwrap_id : unwrap_id = - Eliom_wrap.id_of_int comet_channel_unwrap_id_int + Wrap.id_of_int comet_channel_unwrap_id_int -let bus_unwrap_id : unwrap_id = Eliom_wrap.id_of_int bus_unwrap_id_int +let bus_unwrap_id : unwrap_id = Wrap.id_of_int bus_unwrap_id_int (* HACK: Remove the 'nl_get_appl_parameter' used to avoid confusion between XHR and classical request in App. *) @@ -1457,12 +1453,12 @@ module To_and_of_shared = struct [@@warning "-69"] let wrapper : wrapper = - Obj.magic @@ Eliom_wrap.create_wrapper + Obj.magic @@ Wrap.create_wrapper @@ function | {client = Some tao; _} -> tao | {client = None; _} -> failwith - "Cannot wrap user type parameter.\nUse the ?client_to_and_of parameter of Eliom_parameter.user_type\nor (Eliom_parameter.all_suffix_user)" + "Cannot wrap user type parameter.\nUse the ?client_to_and_of parameter of Parameter.user_type\nor (Parameter.all_suffix_user)" let to_string {server = {to_string; _}; _} = to_string let of_string {server = {of_string; _}; _} = of_string diff --git a/src/lib/eliom_common.server.mli b/src/lib/eliom_common.server.mli index 04de1afa2d..0cdedbe417 100644 --- a/src/lib/eliom_common.server.mli +++ b/src/lib/eliom_common.server.mli @@ -20,7 +20,7 @@ (** Low level functions for Eliom, exceptions and types. *) -open Eliom_lib +open Lib module Ocsipersist : module type of Ocsipersist (* those types are not available to the user, a scope must be created using @@ -108,7 +108,7 @@ exception Eliom_site_information_not_available of string In particular, you cannot use the function before the configuration file is read for example when you are using {e static linking}. In that case you must - delay the function call using {!Eliom_service.register_eliom_module}. + delay the function call using {!Service.register_eliom_module}. *) exception Cannot_call_this_function_before_app_is_linked_to_a_site @@ -705,13 +705,13 @@ val found_stop_key : unit Polytables.key (**** Wrapper type shared by client/server side ***) -type 'a wrapper = 'a Eliom_wrap.wrapper +type 'a wrapper = 'a Wrap.wrapper val make_wrapper : ('a -> 'b) -> 'a wrapper val empty_wrapper : unit -> 'a wrapper -type unwrapper = Eliom_wrap.unwrapper -type unwrap_id = Eliom_wrap.unwrap_id +type unwrapper = Wrap.unwrapper +type unwrap_id = Wrap.unwrap_id val make_unwrapper : unwrap_id -> unwrapper val empty_unwrapper : unwrapper @@ -727,7 +727,7 @@ val patch_request_info : -> Ocsigen_extensions.request type eliom_js_page_data = - { ejs_global_data : (Eliom_runtime.global_data * Eliom_wrap.unwrapper) option + { ejs_global_data : (Eliom_runtime.global_data * Wrap.unwrapper) option ; ejs_request_data : Eliom_runtime.request_data ; (* Event handlers *) ejs_event_handler_table : Eliom_runtime.RawXML.event_handler_table diff --git a/src/lib/eliom_common_base.shared.ml b/src/lib/eliom_common_base.shared.ml index 51c1e01b26..09de337c35 100644 --- a/src/lib/eliom_common_base.shared.ml +++ b/src/lib/eliom_common_base.shared.ml @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib exception Eliom_site_information_not_available of string @@ -234,7 +234,7 @@ type sess_info = (*204FORMS* si_internal_form: bool; *) } type eliom_js_page_data = - { ejs_global_data : (Eliom_runtime.global_data * Eliom_wrap.unwrapper) option + { ejs_global_data : (Eliom_runtime.global_data * Wrap.unwrapper) option ; ejs_request_data : Eliom_runtime.request_data ; (* Event handlers *) ejs_event_handler_table : Eliom_runtime.RawXML.event_handler_table diff --git a/src/lib/eliom_content_.client.ml b/src/lib/eliom_content_.client.ml index 5b21d796b1..8d0c6c4a0d 100644 --- a/src/lib/eliom_content_.client.ml +++ b/src/lib/eliom_content_.client.ml @@ -18,7 +18,7 @@ *) open Js_of_ocaml -open Eliom_lib +open Lib open Eliom_content_core module Xml = Xml @@ -205,19 +205,19 @@ struct Js.Opt.to_option res let insertBefore ~before elt = - Eliom_lib.Option.iter + Lib.Option.iter (fun parent -> appendChild ~before parent elt) (parentNode before) let insertAfter ~after elt = - Eliom_lib.Option.iter + Lib.Option.iter (fun parent -> let before = nextSibling after in appendChild ?before parent elt) (parentNode after) let replaceSelf elt1 elt2 = - Eliom_lib.Option.iter + Lib.Option.iter (fun parent -> replaceChild parent elt2 elt1) (parentNode elt1) diff --git a/src/lib/eliom_content_.server.ml b/src/lib/eliom_content_.server.ml index 9aa8f24df1..15c9dd681a 100644 --- a/src/lib/eliom_content_.server.ml +++ b/src/lib/eliom_content_.server.ml @@ -19,7 +19,7 @@ open Eliom_content_core module Xml = Eliom_content_core.Xml -module Xml_shared = Eliom_shared_content.Xml +module Xml_shared = Shared_content.Xml module Svg = struct module Ev' = Svg.Ev' @@ -27,7 +27,7 @@ module Svg = struct module D = Svg.D module R = struct - module Raw = Eliom_shared_content.Svg.R + module Raw = Shared_content.Svg.R include Raw let pcdata _ = `Unimplemented @@ -91,7 +91,7 @@ module Html = struct module Form = Eliom_form.Make (Arg) end - module R = Eliom_shared_content.Html.R + module R = Shared_content.Html.R module Custom_data = Eliom_content_core.Html.Custom_data module Id = Html.Id module Printer = Html.Printer diff --git a/src/lib/eliom_content_core.client.ml b/src/lib/eliom_content_core.client.ml index 5a2bc216ec..8f8bc2d444 100644 --- a/src/lib/eliom_content_core.client.ml +++ b/src/lib/eliom_content_core.client.ml @@ -17,13 +17,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(* This the core of [Eliom_content] without its dependencies to [Eliom_service], - [Eliom_client] et al. +(* This the core of [Content] without its dependencies to [Service], + [Client] et al. Its name is not [Eliom_content_base] because this would suggest the sharing between server and client. *) open Js_of_ocaml -open Eliom_lib +open Lib module Xml = struct include Eliom_runtime.RawXML @@ -48,7 +48,7 @@ module Xml = struct | ReactChildren of econtent * elt ReactiveData.RList.t and elt = - { (* See Eliom_content.Html.To_dom for the 'unwrap' function that convert + { (* See Content.Html.To_dom for the 'unwrap' function that convert the server's tree representation into the client one. *) mutable elt : node lazy_t ; node_id : node_id } diff --git a/src/lib/eliom_content_core.client.mli b/src/lib/eliom_content_core.client.mli index 72eb67e52c..49c4881847 100644 --- a/src/lib/eliom_content_core.client.mli +++ b/src/lib/eliom_content_core.client.mli @@ -38,7 +38,7 @@ module Xml : sig type attrib type caml_event_handler = - | CE_registered_closure of string * Eliom_lib.poly + | CE_registered_closure of string * Lib.poly (* 'a Js.t -> unit) client_value_server *) | CE_client_closure of (Dom_html.event Js.t -> unit) (* Client side-only *) | CE_client_closure_mouse of (Dom_html.mouseEvent Js.t -> unit) @@ -81,7 +81,7 @@ module Xml : sig ([`A | `Form_get | `Form_post] * (bool * string list) option * string option - * Eliom_lib.poly) + * Lib.poly) option Eliom_lazy.request -> internal_event_handler @@ -102,7 +102,7 @@ module Xml : sig | RACamlEventHandler of caml_event_handler | RALazyStr of string Eliom_lazy.request | RALazyStrL of separator * string Eliom_lazy.request list - | RAClient of string * attrib option * Eliom_lib.poly + | RAClient of string * attrib option * Lib.poly (* attrib Eliom_client_value.t *) val racontent : attrib -> racontent @@ -300,16 +300,16 @@ module Svg : sig (** The type of global SVG element identifier. *) val new_elt_id : ?global:bool -> unit -> 'a id - (** See {!Eliom_content.Html.Id.new_elt_id} *) + (** See {!Content.Html.Id.new_elt_id} *) val create_named_elt : id:'a id -> 'a elt -> 'a elt - (** See {!Eliom_content.Html.Id.create_named_elt} *) + (** See {!Content.Html.Id.create_named_elt} *) val create_global_elt : 'a elt -> 'a elt - (** See {!Eliom_content.Html.Id.create_global_elt} *) + (** See {!Content.Html.Id.create_global_elt} *) val create_request_elt : ?reset:bool -> 'a elt -> 'a elt - (** See {!Eliom_content.Html.Id.create_request_elt} *) + (** See {!Content.Html.Id.create_request_elt} *) (**/**) @@ -525,7 +525,7 @@ module Html : sig [create_named_elt ~id:(new_elt_id ()) elt]. *) val create_request_elt : ?reset:bool -> 'a elt -> 'a elt - (** See {!Eliom_content.Svg.Id.create_request_elt} *) + (** See {!Content.Svg.Id.create_request_elt} *) (**/**) @@ -545,7 +545,8 @@ module Html : sig -> unit -> 'a t (** Create a custom data field by providing string conversion functions. - If the [default] is provided, calls to {!Eliom_content.Html.Custom_data.get_dom} return that instead of throwing an + If the [default] is provided, calls to {% <> %} return that instead of throwing an exception [Not_found]. *) val create_json : name:string -> ?default:'a -> 'a Deriving_Json.t -> 'a t @@ -554,7 +555,7 @@ module Html : sig val attrib : 'a t -> 'a -> [> `User_data] attrib (** [attrib my_data value ] creates a HTML5 attribute for the custom-data type [my_data] with value [value] for injecting it into an a HTML5 tree - ({!Eliom_content.Html.elt}). *) + ({% <> %}). *) val get_dom : Dom_html.element Js.t -> 'a t -> 'a (** [get_dom element custom_data] gets the [custom_data] from a JavaScript [element] diff --git a/src/lib/eliom_content_core.server.ml b/src/lib/eliom_content_core.server.ml index cc8253fbf9..ff5414cfc3 100644 --- a/src/lib/eliom_content_core.server.ml +++ b/src/lib/eliom_content_core.server.ml @@ -18,9 +18,9 @@ *) open Js_of_ocaml -open Eliom_lib +open Lib -(* This the core of [Eliom_content] without its dependencies to [Eliom_service] et al. +(* This the core of [Content] without its dependencies to [Service] et al. Its name is not [Eliom_content_base] because this would suggest the sharing between server and client. *) @@ -45,13 +45,10 @@ module Xml = struct and recontent = RELazy of econtent Eliom_lazy.request | RE of econtent and elt' = - { recontent : recontent - ; node_id : node_id - ; unwrapper_mark : Eliom_wrap.unwrapper } + {recontent : recontent; node_id : node_id; unwrapper_mark : Wrap.unwrapper} [@@warning "-69"] - and elt = {elt : elt'; wrapper_mark : elt Eliom_wrap.wrapper} - [@@warning "-69"] + and elt = {elt : elt'; wrapper_mark : elt Wrap.wrapper} [@@warning "-69"] (** Values of type [elt] are wrapped values of type [elt']. *) let content {elt; _} = @@ -66,7 +63,7 @@ module Xml = struct let node_ids_in_content = ref Node_id_set.empty let wrapper_mark = - Eliom_wrap.create_wrapper (fun {elt; _} -> + Wrap.create_wrapper (fun {elt; _} -> if Node_id_set.mem elt.node_id !node_ids_in_content then {elt with recontent = RE Empty} else elt) @@ -83,25 +80,25 @@ module Xml = struct collect_node_ids page; node_ids_in_content := List.fold_right Node_id_set.add !node_ids Node_id_set.empty; - let res = Eliom_wrap.wrap value in + let res = Wrap.wrap value in node_ids_in_content := Node_id_set.empty; res let get_node_id {elt; _} = elt.node_id - let tyxml_unwrap_id = Eliom_wrap.id_of_int Eliom_runtime.tyxml_unwrap_id_int + let tyxml_unwrap_id = Wrap.id_of_int Eliom_runtime.tyxml_unwrap_id_int let make elt = { elt = { recontent = RE elt ; node_id = NoId - ; unwrapper_mark = Eliom_wrap.create_unwrapper tyxml_unwrap_id } + ; unwrapper_mark = Wrap.create_unwrapper tyxml_unwrap_id } ; wrapper_mark } let make_lazy elt = { elt = { recontent = RELazy elt ; node_id = NoId - ; unwrapper_mark = Eliom_wrap.create_unwrapper tyxml_unwrap_id } + ; unwrapper_mark = Wrap.create_unwrapper tyxml_unwrap_id } ; wrapper_mark } let empty () = make Empty @@ -133,7 +130,7 @@ module Xml = struct let caml_event_handler cf = let crypto = make_cryptographic_safe_string () in - CE_registered_closure (crypto, Eliom_lib.to_poly cf) + CE_registered_closure (crypto, Lib.to_poly cf) let event_handler cf = Caml (caml_event_handler cf) @@ -155,7 +152,7 @@ module Xml = struct let client_attrib ?init (x : attrib Eliom_client_value.t) = let crypto = make_cryptographic_safe_string () in let empty_name = "" in - empty_name, RAClient (crypto, init, Eliom_lib.to_poly x) + empty_name, RAClient (crypto, init, Lib.to_poly x) let closing_cdata = Re.Pcre.(regexp (quote "]]>")) @@ -447,7 +444,7 @@ module Html = struct end module D = struct - (* This is [Eliom_content.Xml] adapted such that request nodes are produced *) + (* This is [Content.Xml] adapted such that request nodes are produced *) module Xml' = struct include Xml diff --git a/src/lib/eliom_content_core.server.mli b/src/lib/eliom_content_core.server.mli index 1bf352f418..5e5c9d9f83 100644 --- a/src/lib/eliom_content_core.server.mli +++ b/src/lib/eliom_content_core.server.mli @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** See {!Eliom_content} for complete module. *) +(** See {% <> %} for complete module. *) open Js_of_ocaml @@ -57,7 +57,7 @@ module Xml : sig ([`A | `Form_get | `Form_post] * (bool * string list) option * string option - * Eliom_lib.poly) + * Lib.poly) option Eliom_lazy.request -> internal_event_handler @@ -72,7 +72,7 @@ module Xml : sig | RACamlEventHandler of caml_event_handler | RALazyStr of string Eliom_lazy.request | RALazyStrL of separator * string Eliom_lazy.request list - | RAClient of string * attrib option * Eliom_lib.poly + | RAClient of string * attrib option * Lib.poly (* attrib client_value *) val racontent : attrib -> racontent @@ -80,7 +80,7 @@ module Xml : sig (**/**) - val wrap : elt -> 'a -> 'a Eliom_wrap.wrapped_value + val wrap : elt -> 'a -> 'a Wrap.wrapped_value val client_attrib : ?init:attrib -> attrib Eliom_client_value.t -> attrib end diff --git a/src/lib/eliom_error_pages.server.ml b/src/lib/eliom_error_pages.server.ml index 02d82860eb..89638c6c44 100644 --- a/src/lib/eliom_error_pages.server.ml +++ b/src/lib/eliom_error_pages.server.ml @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib open Eliom_content_core open Html.F diff --git a/src/lib/eliom_form.eliom b/src/lib/eliom_form.eliom index af61add6c9..99a8dda618 100644 --- a/src/lib/eliom_form.eliom +++ b/src/lib/eliom_form.eliom @@ -1,6 +1,6 @@ (* Ocsigen * http://www.ocsigen.org - * Module Eliom_form + * Module Form * Copyright (C) 2007 Vincent Balat * * This program is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ open%shared Js_of_ocaml open Lwt.Syntax let read_params form y = - Eliom_parameter.reconstruct_params_form (Form.form_elements form) y + Parameter.reconstruct_params_form (Form.form_elements form) y let error_handler = ref @@ fun _ -> Lwt.fail_with "Cannot parse params for client-side service" @@ -42,23 +42,23 @@ let iter_contents y ev f = Lwt.return_true | None -> !error_handler () -type client_form_handler = Eliom_client.client_form_handler +type client_form_handler = Client.client_form_handler let make_hdlr_get service : client_form_handler = fun ev -> - match Eliom_service.client_fun service with + match Service.client_fun service with | None -> Lwt.return_false | Some _ -> - iter_contents (Eliom_service.get_params_type service) ev @@ fun g -> - Eliom_client.change_page ~service g () + iter_contents (Service.get_params_type service) ev @@ fun g -> + Client.change_page ~service g () let make_hdlr_post service g : client_form_handler = fun ev -> - match Eliom_service.client_fun service with + match Service.client_fun service with | None -> Lwt.return_false | Some _ -> - iter_contents (Eliom_service.post_params_type service) ev @@ fun p -> - Eliom_client.change_page ~service g p + iter_contents (Service.post_params_type service) ev @@ fun p -> + Client.change_page ~service g p [%%server type client_form_handler] [%%shared.start] @@ -87,7 +87,7 @@ module type Html = sig -> ([`A | `Form_get | `Form_post] * (bool * string list) option * string option - * Eliom_lib.poly) + * Lib.poly) option Eliom_lazy.request -> Html_types.form_attrib attrib @@ -97,7 +97,7 @@ end let get_xhr = function | Some xhr -> xhr - | None -> Eliom_config.get_default_links_xhr () + | None -> Config.get_default_links_xhr () module Make_links (Html : Html) = struct type +'a attrib = 'a Html.attrib @@ -148,12 +148,12 @@ module Make_links (Html : Html) = struct let f = [%client.unsafe fun ev -> - if not (Eliom_client.middleClick ev) + if not (Client.middleClick ev) then ( Dom.preventDefault ev; Dom_html.stopPropagation ev; Lwt.async @@ fun () -> - Eliom_client.change_page ?absolute:~%absolute + Client.change_page ?absolute:~%absolute ?absolute_path:~%absolute_path ?https:~%https ~service:~%service ?hostname:~%hostname ?port:~%port ?fragment:~%fragment ?keep_nl_params:~%keep_nl_params @@ -264,12 +264,12 @@ module Make (Html : Html) = struct ?hostname ?port ?fragment - ?(nl_params = Eliom_parameter.empty_nl_params_set) + ?(nl_params = Parameter.empty_nl_params_set) ?keep_nl_params f = let issuffix, paramnames = - Eliom_parameter.make_params_names (Eliom_service.get_params_type service) + Parameter.make_params_names (Service.get_params_type service) in let components = Eliom_lazy.from_fun @@ fun () -> @@ -289,7 +289,7 @@ module Make (Html : Html) = struct in match fragment with | None -> uri - | Some f -> String.concat "#" [uri; Eliom_lib.Url.encode f] + | Some f -> String.concat "#" [uri; Lib.Url.encode f] in bind (f paramnames) @@ fun inside -> let inside = @@ -340,14 +340,14 @@ module Make (Html : Html) = struct ?hostname ?port ?fragment - ?(nl_params = Eliom_parameter.empty_nl_params_set) + ?(nl_params = Parameter.empty_nl_params_set) ?(keep_nl_params : [`All | `Persistent | `None] option) ?keep_get_na_params f get_params = let _, paramnames = - Eliom_parameter.make_params_names (Eliom_service.post_params_type service) + Parameter.make_params_names (Service.post_params_type service) in let components = Eliom_lazy.from_fun @@ fun () -> @@ -397,7 +397,7 @@ module Make (Html : Html) = struct let option_map f = function Some x -> Some (f x) | None -> None let gen_input ?a ~input_type ?value ?src ?name string_of = - let name = option_map Eliom_parameter.string_of_param_name name + let name = option_map Parameter.string_of_param_name name and value = option_map string_of value in make_input ?a ?value ~typ:input_type ?name ?src () @@ -407,27 +407,27 @@ module Make (Html : Html) = struct let file_input ?a ~name () = make_input ?a ~typ:`File - ~name:(Eliom_parameter.string_of_param_name name) + ~name:(Parameter.string_of_param_name name) () (* value attribute not supported by browsers for security reasons *) let image_input ?a ~name ?src () = make_input ?a ~typ:`Image - ~name:(Eliom_parameter.string_of_param_name name) + ~name:(Parameter.string_of_param_name name) ?src () let checkbox ?a ?checked ~name ~value y = - let name = Eliom_parameter.string_of_param_name name + let name = Parameter.string_of_param_name name and value = string_of_param y value and typ = `Checkbox in make_input ?a ?checked ~typ ~name ~value () let bool_checkbox_one ?a ?checked ~name () = - let typ = `Checkbox and name = Eliom_parameter.string_of_param_name name in + let typ = `Checkbox and name = Parameter.string_of_param_name name in make_input ?a ?checked ~typ ~name () let radio ?a ?checked ~name ~value y = - let name = Eliom_parameter.string_of_param_name name + let name = Parameter.string_of_param_name name and value = string_of_param y value and typ = `Radio in make_input ?a ?checked ~typ ~name ~value () @@ -440,18 +440,18 @@ module Make (Html : Html) = struct | Some a -> required :: (a :> Html_types.input_attrib attrib list) in make_input ~a ?checked ~typ:`Radio - ~name:(Eliom_parameter.string_of_param_name name) + ~name:(Parameter.string_of_param_name name) ~value () let button ?a ~button_type ~name ~value y c = - let name = Eliom_parameter.string_of_param_name name + let name = Parameter.string_of_param_name name and value = string_of_param y value in make_button ?a ~button_type ~name ~value c let button_no_value ?a ~button_type c = make_button ?a ~button_type c let textarea ?a ~name = - make_textarea ?a ~name:(Eliom_parameter.string_of_param_name name) + make_textarea ?a ~name:(Parameter.string_of_param_name name) type 'a soption = Html_types.option_attrib attrib list @@ -561,26 +561,26 @@ module Make (Html : Html) = struct let select ?a ?required ~name y fl ol = let multiple = false - and name = Eliom_parameter.string_of_param_name name + and name = Parameter.string_of_param_name name and f = string_of_param y in gen_select ?a ?required ~multiple ~name fl ol f let multiple_select ?a ?required ~name y fl ol = let multiple = true - and name = Eliom_parameter.string_of_param_name name + and name = Parameter.string_of_param_name name and f = string_of_param y in gen_select ?a ?required ~multiple ~name fl ol f let make_info ~https kind service hdlr = let f () = - match Eliom_service.xhr_with_cookies service with + match Service.xhr_with_cookies service with | None -> None | Some tmpl -> Some ( (kind : [`Form_get | `Form_post] :> [`Form_get | `Form_post | `A]) , Eliom_uri.make_cookies_info (https, service) , tmpl - , Eliom_lib.to_poly hdlr ) + , Lib.to_poly hdlr ) in Eliom_lazy.from_fun f diff --git a/src/lib/eliom_form.eliomi b/src/lib/eliom_form.eliomi index 674b562012..4c6f5600da 100644 --- a/src/lib/eliom_form.eliomi +++ b/src/lib/eliom_form.eliomi @@ -1,6 +1,6 @@ (* Ocsigen * http://www.ocsigen.org - * Module Eliom_form + * Module Form * Copyright (C) 2007 Vincent Balat * * This program is free software; you can redistribute it and/or modify @@ -50,7 +50,7 @@ module type Html = sig -> ([`A | `Form_get | `Form_post] * (bool * string list) option * string option - * Eliom_lib.poly) + * Lib.poly) option Eliom_lazy.request -> Html_types.form_attrib attrib @@ -61,13 +61,13 @@ end type 'a param module Make_links (H : Html) : - Eliom_form_sigs.LINKS + Form_sigs.LINKS with type +'a elt := 'a H.elt and type +'a attrib := 'a H.attrib and type uri := H.uri module Make (H : Html) : - Eliom_form_sigs.S + Form_sigs.S with type +'a elt := 'a H.elt and type +'a attrib := 'a H.attrib and type uri := H.uri diff --git a/src/lib/eliom_lazy.server.ml b/src/lib/eliom_lazy.server.ml index 1e5cf861f2..5b9a8bead3 100644 --- a/src/lib/eliom_lazy.server.ml +++ b/src/lib/eliom_lazy.server.ml @@ -1,7 +1,7 @@ -type 'a request = {data : unit -> 'a; mark : 'a request Eliom_wrap.wrapper} +type 'a request = {data : unit -> 'a; mark : 'a request Wrap.wrapper} [@@warning "-69"] -let mark = Eliom_wrap.create_wrapper (fun l -> l.data ()) +let mark = Wrap.create_wrapper (fun l -> l.data ()) let from_fun data = {data; mark} let from_val v = {data = (fun () -> v); mark} let force v = v.data () diff --git a/src/lib/eliom_parameter_base.shared.ml b/src/lib/eliom_parameter_base.shared.ml index b1d9a04924..e73e8697bd 100644 --- a/src/lib/eliom_parameter_base.shared.ml +++ b/src/lib/eliom_parameter_base.shared.ml @@ -19,7 +19,7 @@ open Lwt.Syntax * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib let section = Logs.Src.create "eliom:parameter" @@ -78,7 +78,7 @@ let to_from_of_atom x = {to_string = string_of_atom x; of_string = atom_of_string x} type 'a filter = ('a -> unit) option -type raw = Eliom_request_info.raw_post_data +type raw = Request_info.raw_post_data type 'a ocaml = string (* marshaled values of type 'a *) type suff = [`WithoutSuffix | `WithSuffix | `Endsuffix] @@ -804,7 +804,7 @@ let reconstruct_params_ typ params files nosuffixversion urlsuffix : 'a = | TESuffix n -> let v, l = List.assoc_remove n params in (* cannot have prefix or suffix *) - Res_ (Eliom_lib.Url.split_path v, l, files) + Res_ (Lib.Url.split_path v, l, files) | TESuffixs n -> let v, l = List.assoc_remove n params in (* cannot have prefix or suffix *) @@ -868,7 +868,7 @@ let reconstruct_params = match typ, params, files with (* FIXME *) - | TRaw_post_data, None, None -> Eliom_request_info.raw_post_data sp + | TRaw_post_data, None, None -> Request_info.raw_post_data sp | typ, None, None -> ( try Lwt.return (reconstruct_params_ typ [] [] nosuffixversion urlsuffix) with e -> Lwt.fail e) diff --git a/src/lib/eliom_process.client.ml b/src/lib/eliom_process.client.ml index 359af7d29a..8aeb7346d9 100644 --- a/src/lib/eliom_process.client.ml +++ b/src/lib/eliom_process.client.ml @@ -18,7 +18,7 @@ *) open Js_of_ocaml -open Eliom_lib +open Lib (* Logs *) let section = Logs.Src.create "eliom:process" @@ -40,7 +40,7 @@ let get_set_js_serverside_value r name = (fun () -> failwith (name - ^ " not defined. A client Eliom application must either be sent by an Eliom server application or you must call Eliom_client.init_client_app." + ^ " not defined. A client Eliom application must either be sent by an Eliom server application or you must call Client.init_client_app." )) (fun var -> let s = unmarshal_js var in @@ -108,12 +108,11 @@ let set_base_url, get_base_url = | Some s -> s | None -> failwith - "base_url not set. Did you forget to call Eliom_client.init_client_app?" - ) + "base_url not set. Did you forget to call Client.init_client_app?" ) (** None on server side *) let appl_name_r = ref None -(* Set by Eliom_client.init_client_app *) +(* Set by Client.init_client_app *) let get_application_name () = match !appl_name_r with diff --git a/src/lib/eliom_react.client.ml b/src/lib/eliom_react.client.ml index c51f3320a3..919ed9e34e 100644 --- a/src/lib/eliom_react.client.ml +++ b/src/lib/eliom_react.client.ml @@ -48,7 +48,7 @@ module Down = struct let internal_unwrap (channel, _unwrapper) = (* We want to catch more exceptions here than the usual exceptions caught - in Eliom_comet. For example Channel_full. *) + in Comet. For example Channel_full. *) (* We transform the stream into a stream with exception: *) let stream = Lwt_stream.wrap_exn channel in Lwt.async (fun () -> @@ -62,19 +62,17 @@ module Down = struct E.of_stream channel let () = - Eliom_unwrap.register_unwrapper Eliom_common.react_down_unwrap_id - internal_unwrap + Unwrap.register_unwrapper Eliom_common.react_down_unwrap_id internal_unwrap end module Up = struct type 'a t = 'a -> unit Lwt.t let internal_unwrap (service, _unwrapper) x = - Eliom_client.call_service ~service () x >|= fun _ -> () + Client.call_service ~service () x >|= fun _ -> () let () = - Eliom_unwrap.register_unwrapper Eliom_common.react_up_unwrap_id - internal_unwrap + Unwrap.register_unwrapper Eliom_common.react_up_unwrap_id internal_unwrap end module S = struct @@ -86,7 +84,7 @@ module S = struct S.hold ~eq:(fun _ _ -> false) value e let () = - Eliom_unwrap.register_unwrapper Eliom_common.signal_down_unwrap_id + Unwrap.register_unwrapper Eliom_common.signal_down_unwrap_id internal_unwrap end end diff --git a/src/lib/eliom_react.server.ml b/src/lib/eliom_react.server.ml index 3ea6aa1278..13008c39d7 100644 --- a/src/lib/eliom_react.server.ml +++ b/src/lib/eliom_react.server.ml @@ -32,7 +32,7 @@ module Down = struct ; name : string option ; size : int option } - type 'a stateless = 'a Eliom_comet.Channel.t + type 'a stateless = 'a Comet.Channel.t type 'a t' = Stateful of 'a stateful | Stateless of 'a stateless type 'a t = {t : 'a t'; react_down_mark : 'a t Eliom_common.wrapper} @@ -45,9 +45,7 @@ module Down = struct | None -> e | Some t -> E.limit (fun () -> Lwt_unix.sleep t) e in - let channel = - Eliom_comet.Channel.create_from_events ?scope ?name ?size ee - in + let channel = Comet.Channel.create_from_events ?scope ?name ?size ee in channel, Eliom_common.make_unwrapper Eliom_common.react_down_unwrap_id let wrap_stateless channel = @@ -68,8 +66,7 @@ module Down = struct | None -> e | Some t -> E.limit (fun () -> Lwt_unix.sleep t) e in - Stateless - (Eliom_comet.Channel.create_from_events ~scope:`Site ?name ?size ee) + Stateless (Comet.Channel.create_from_events ~scope:`Site ?name ?size ee) let of_react ?scope ?throttling ?name ?size (e : 'a E.t) = let t = @@ -88,16 +85,16 @@ module Up = struct ; service : ( unit , 'a - , Eliom_service.post - , Eliom_service.non_att - , Eliom_service.co - , Eliom_service.non_ext - , Eliom_service.reg + , Service.post + , Service.non_att + , Service.co + , Service.non_ext + , Service.reg , [`WithoutSuffix] , unit - , [`One of 'a Eliom_parameter.ocaml] Eliom_parameter.param_name - , Eliom_registration.Action.return ) - Eliom_service.t + , [`One of 'a Parameter.ocaml] Parameter.param_name + , Registration.Action.return ) + Service.t ; wrapper : 'a t Eliom_common.wrapper } [@@warning "-69"] @@ -120,12 +117,12 @@ module Up = struct | _ -> (Eliom_common.comet_client_process_scope :> Eliom_common.scope) in let e_writer = - Eliom_service.create ?name - ~meth:(Eliom_service.Post (Eliom_parameter.unit, post_params)) - ~path:Eliom_service.No_path () + Service.create ?name + ~meth:(Service.Post (Parameter.unit, post_params)) + ~path:Service.No_path () in - Eliom_registration.Action.register ~scope ~options:`NoReload - ~service:e_writer (fun () value -> push value; Lwt.return_unit); + Registration.Action.register ~scope ~options:`NoReload ~service:e_writer + (fun () value -> push value; Lwt.return_unit); {event = e; service = e_writer; wrapper = up_event_wrapper ()} end @@ -139,7 +136,7 @@ module S = struct [@@warning "-69"] type 'a stateless = - { channel : 'a Eliom_comet.Channel.t + { channel : 'a Comet.Channel.t ; stream : 'a Lwt_stream.t ; (* avoid garbage collection *) sl_signal : 'a S.t } @@ -196,7 +193,7 @@ module S = struct in let store = make_store s in let stream = Lwt_stream.from (read_store store) in - let channel = Eliom_comet.Channel.create_unlimited ?name stream in + let channel = Comet.Channel.create_unlimited ?name stream in let value : 'a = S.value s in ( channel , value @@ -226,7 +223,7 @@ module S = struct let e = S.changes s in let stream = E.to_stream e in Stateless - { channel = Eliom_comet.Channel.create_newest ?name stream + { channel = Comet.Channel.create_newest ?name stream ; stream ; sl_signal = s } diff --git a/src/lib/eliom_react.server.mli b/src/lib/eliom_react.server.mli index bf4316de82..b22e027dde 100644 --- a/src/lib/eliom_react.server.mli +++ b/src/lib/eliom_react.server.mli @@ -24,7 +24,7 @@ Warning: it is not possible to catch exceptions on each channel using Eliom_react (for example channel closed or full). - If you need an error handling, use Eliom_comet.Channel instead. + If you need an error handling, use Comet.Channel instead. *) (** {b Please read the @@ -56,7 +56,7 @@ module Down : sig (** The abstract type of down events. *) val of_react : - ?scope:[< Eliom_comet.Channel.comet_scope] + ?scope:[< Comet.Channel.comet_scope] -> ?throttling:float -> ?name:string -> ?size:int @@ -70,7 +70,7 @@ module Down : sig - [name] for named edges, - [size] for the size of the server side buffer. - [scope] - tell which kind of channel this rely on (See [Eliom_comet.create]). *) + tell which kind of channel this rely on (See [Comet.create]). *) end (** Event from client to server. *) @@ -82,7 +82,7 @@ module Up : sig Example of use: [let e_up = Eliom_react.Up.create - (Eliom_parameter.ocaml "a" [%json: string]) + (Parameter.ocaml "a" [%json: string]) in ... {{ ignore ( %e_up "A") }} ... ] @@ -102,8 +102,8 @@ module Up : sig -> ?name:string -> ( 'a , [`WithoutSuffix] - , [`One of 'a Eliom_parameter.ocaml] Eliom_parameter.param_name ) - Eliom_parameter.params_type + , [`One of 'a Parameter.ocaml] Parameter.param_name ) + Parameter.params_type -> 'a t (** [create param] creates an Up event. If [~name] is present, the coservice used to transmit the event will @@ -120,7 +120,7 @@ module S : sig (** The abstract type of down signals. *) val of_react : - ?scope:[< Eliom_comet.Channel.comet_scope] + ?scope:[< Comet.Channel.comet_scope] -> ?throttling:float -> ?name:string -> 'a React.S.t diff --git a/src/lib/eliom_route_base.shared.ml b/src/lib/eliom_route_base.shared.ml index 8dc79303c4..6c7e7388db 100644 --- a/src/lib/eliom_route_base.shared.ml +++ b/src/lib/eliom_route_base.shared.ml @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib open Lwt let section = Logs.Src.create "eliom:service" @@ -79,7 +79,7 @@ module type PARAM = sig -> t -> ( Table.t ref * Eliom_common.page_table_key , Eliom_common.na_key_serv ) - Eliom_lib.leftright + Lib.leftright -> Node.t val get : t -> (int * int * Table.t Eliom_common.dircontent ref) list diff --git a/src/lib/eliom_runtime.shared.ml b/src/lib/eliom_runtime.shared.ml index 23955f33c7..70cd507cd3 100644 --- a/src/lib/eliom_runtime.shared.ml +++ b/src/lib/eliom_runtime.shared.ml @@ -25,7 +25,7 @@ module Client_value_server_repr = struct type u = { mutable loc : Eliom_lib_base.pos option ; instance_id : int - ; unwrapper : Eliom_wrap.unwrapper } + ; unwrapper : Wrap.unwrapper } [@@warning "-69"] type 'a t = u @@ -258,7 +258,7 @@ type compilation_unit_global_data = { server_sections_data : client_value_datum array array ; client_sections_data : injection_datum array array } -type global_data = compilation_unit_global_data Eliom_lib.String_map.t +type global_data = compilation_unit_global_data Lib.String_map.t type request_data = client_value_datum array let global_data_unwrap_id_int = 8 @@ -267,4 +267,4 @@ type 'a eliom_caml_service_data = {ecs_request_data : request_data; ecs_data : 'a} (* the data sent on channels *) -type 'a eliom_comet_data_type = 'a Eliom_wrap.wrapped_value +type 'a eliom_comet_data_type = 'a Wrap.wrapped_value diff --git a/src/lib/eliom_runtime.shared.mli b/src/lib/eliom_runtime.shared.mli index 27bd426d2c..fd9eb9437d 100644 --- a/src/lib/eliom_runtime.shared.mli +++ b/src/lib/eliom_runtime.shared.mli @@ -31,7 +31,7 @@ module Client_value_server_repr : sig val create : loc:Eliom_lib_base.pos option -> instance_id:int - -> unwrapper:Eliom_wrap.unwrapper + -> unwrapper:Wrap.unwrapper -> _ t (** instance_id is zero for local client values, unique for global client values *) @@ -83,7 +83,7 @@ module RawXML : sig ([`A | `Form_get | `Form_post] * cookie_info option * string option - * Eliom_lib.poly) + * Lib.poly) option Eliom_lazy.request -> internal_event_handler @@ -177,7 +177,7 @@ type compilation_unit_global_data = ; client_sections_data : injection_datum array array } (** Data for initializing client values and injections of one compilation unit *) -type global_data = compilation_unit_global_data Eliom_lib.String_map.t +type global_data = compilation_unit_global_data Lib.String_map.t (** Data for initializing client values and injection of the client program. Sent with the response to the initial request of a client process. *) @@ -192,4 +192,4 @@ type 'a eliom_caml_service_data = {ecs_request_data : request_data; ecs_data : 'a} (* the data sent on channels *) -type 'a eliom_comet_data_type = 'a Eliom_wrap.wrapped_value +type 'a eliom_comet_data_type = 'a Wrap.wrapped_value diff --git a/src/lib/eliom_service_base.eliom b/src/lib/eliom_service_base.eliom index 75ddfdfeab..2c03d60864 100644 --- a/src/lib/eliom_service_base.eliom +++ b/src/lib/eliom_service_base.eliom @@ -21,9 +21,9 @@ [%%shared.start] -module rec Types : Eliom_service_sigs.TYPES = Types +module rec Types : Service_sigs.TYPES = Types include Types -module Url = Eliom_lib.Url +module Url = Lib.Url type suff = [`WithSuffix | `WithoutSuffix] @@ -31,10 +31,10 @@ let params_of_meth : type m gp gn pp pn x. (m, gp, gn, pp, pn, 'tipo, x) meth -> (gp, 'tipo, gn) params * (pp, [`WithoutSuffix], pn) params = function - | Get gp -> gp, Eliom_parameter.unit + | Get gp -> gp, Parameter.unit | Post (gp, pp) -> gp, pp - | Put gp -> gp, Eliom_parameter.raw_post_data - | Delete gp -> gp, Eliom_parameter.raw_post_data + | Put gp -> gp, Parameter.raw_post_data + | Delete gp -> gp, Parameter.raw_post_data let which_meth_internal : type m gp gn pp pn tipo x. (m, gp, gn, pp, pn, tipo, x) meth -> m which_meth @@ -88,7 +88,7 @@ type send_appl_content = | XAlways | XSame_appl of string * string option (** Whether the service is capable to send application content or not. - (application content has type Eliom_service.eliom_appl_answer: + (application content has type Service.eliom_appl_answer: content of the application container, or xhr redirection ...). A link towards a service with send_appl_content = XNever will always answer a regular http frame (this will stop the application if @@ -119,13 +119,13 @@ type ('get , 'rt) t = { pre_applied_parameters : - (string * Eliommod_parameters.param) list Eliom_lib.String.Table.t + (string * Eliommod_parameters.param) list Lib.String.Table.t (* non localized parameters *) * (string * Eliommod_parameters.param) list (* regular parameters *) - ; get_params_type : ('get, 'tipo, 'getnames) Eliom_parameter.params_type + ; get_params_type : ('get, 'tipo, 'getnames) Parameter.params_type ; post_params_type : - ('post, [`WithoutSuffix], 'postnames) Eliom_parameter.params_type + ('post, [`WithoutSuffix], 'postnames) Parameter.params_type ; max_use : int option ; (* Max number of use of this service *) timeout : float option @@ -165,8 +165,8 @@ and result = let pre_wrap s = { s with - get_params_type = Eliom_parameter.wrap_param_type s.get_params_type - ; post_params_type = Eliom_parameter.wrap_param_type s.post_params_type + get_params_type = Parameter.wrap_param_type s.get_params_type + ; post_params_type = Parameter.wrap_param_type s.post_params_type ; service_mark = Eliom_common.empty_wrapper () } type%shared unit_service = @@ -224,11 +224,11 @@ let change_get_num service attser n = (** Static directories **) let static_dir_ ?(https = false) () = - { pre_applied_parameters = Eliom_lib.String.Table.empty, [] + { pre_applied_parameters = Lib.String.Table.empty, [] ; get_params_type = - Eliom_parameter.suffix - (Eliom_parameter.all_suffix Eliom_common.eliom_suffix_name) - ; post_params_type = Eliom_parameter.unit + Parameter.suffix + (Parameter.all_suffix Eliom_common.eliom_suffix_name) + ; post_params_type = Parameter.unit ; max_use = None ; timeout = None ; kind = `Service @@ -238,7 +238,7 @@ let static_dir_ ?(https = false) () = { prefix = "" ; subpath = [""] ; fullpath = - Eliom_common.defer Eliom_request_info.get_site_dir_option + Eliom_common.defer Request_info.get_site_dir_option (fun site_dir -> site_dir @ [Eliom_common.eliom_suffix_internal_name]) ; get_name = Eliom_common.SAtt_no @@ -258,12 +258,12 @@ let static_dir () = static_dir_ () let https_static_dir () = static_dir_ ~https:true () let get_static_dir_ ?(https = false) ?(keep_nl_params = `None) ~get_params () = - { pre_applied_parameters = Eliom_lib.String.Table.empty, [] + { pre_applied_parameters = Lib.String.Table.empty, [] ; get_params_type = - Eliom_parameter.suffix_prod - (Eliom_parameter.all_suffix Eliom_common.eliom_suffix_name) + Parameter.suffix_prod + (Parameter.all_suffix Eliom_common.eliom_suffix_name) get_params - ; post_params_type = Eliom_parameter.unit + ; post_params_type = Parameter.unit ; max_use = None ; timeout = None ; kind = `Service @@ -273,7 +273,7 @@ let get_static_dir_ ?(https = false) ?(keep_nl_params = `None) ~get_params () = { prefix = "" ; subpath = [""] ; fullpath = - Eliom_common.defer Eliom_request_info.get_site_dir_option + Eliom_common.defer Request_info.get_site_dir_option (fun site_dir -> site_dir @ [Eliom_common.eliom_suffix_internal_name]) ; get_name = Eliom_common.SAtt_no @@ -298,7 +298,7 @@ let https_static_dir_with_params ?keep_nl_params ~get_params () = let send_appl_content s = s.send_appl_content let set_send_appl_content s n = s.send_appl_content <- n -(* will be initialized later (in Eliom_content for now), when client +(* will be initialized later (in Content for now), when client syntax is available, with: fun f getparams -> {{ fun _ pp -> %f %getparams pp }} *) @@ -311,13 +311,13 @@ let rec append_suffix l m = let preapply ~service getparams = let nlp, preapp = service.pre_applied_parameters in let suff, nlp, params = - Eliom_parameter.construct_params_list_raw nlp service.get_params_type + Parameter.construct_params_list_raw nlp service.get_params_type getparams in { service with service_mark = service_mark () ; pre_applied_parameters = nlp, params @ preapp - ; get_params_type = Eliom_parameter.unit + ; get_params_type = Parameter.unit ; info = (match service.info with | Attached k -> @@ -345,9 +345,9 @@ let preapply ~service getparams = let reload_action_aux https = { max_use = None ; timeout = None - ; pre_applied_parameters = Eliom_lib.String.Table.empty, [] - ; get_params_type = Eliom_parameter.unit - ; post_params_type = Eliom_parameter.unit + ; pre_applied_parameters = Lib.String.Table.empty, [] + ; get_params_type = Parameter.unit + ; post_params_type = Parameter.unit ; kind = `NonattachedCoservice ; meth = Get' ; info = @@ -382,7 +382,7 @@ let reload_action_https_hidden = reload_action_hidden_aux true services *) let add_non_localized_get_parameters ~params ~service = { service with - get_params_type = Eliom_parameter.nl_prod service.get_params_type params + get_params_type = Parameter.nl_prod service.get_params_type params ; client_fun = Some [%client.unsafe @@ -393,7 +393,7 @@ let add_non_localized_get_parameters ~params ~service = let add_non_localized_post_parameters ~params ~service = { service with - post_params_type = Eliom_parameter.nl_prod service.post_params_type params + post_params_type = Parameter.nl_prod service.post_params_type params ; client_fun = Some [%client.unsafe @@ -432,7 +432,7 @@ let untype s = t) type (_, _, _) path_option = - | Path : Eliom_lib.Url.path -> (att, non_co, _) path_option + | Path : Lib.Url.path -> (att, non_co, _) path_option | No_path : (non_att, co, unit) path_option let eliom_appl_answer_content_type = "application/x-eliom" @@ -448,7 +448,7 @@ let new_state () = (* 72bit of entropy is large enough: CSRF-safe services are short-lived; with 65536 services, the probability of a collision is about 2^-41. *) - Eliom_lib.make_cryptographic_safe_string ~len:12 () + Lib.make_cryptographic_safe_string ~len:12 () let default_csrf_scope = function (* We do not use the classical syntax for default value. Otherwise, @@ -488,7 +488,7 @@ let main_service ~reload_fun () = - { pre_applied_parameters = Eliom_lib.String.Table.empty, [] + { pre_applied_parameters = Lib.String.Table.empty, [] ; get_params_type = get_params ; post_params_type = post_params ; max_use = None @@ -503,7 +503,7 @@ let main_service (match force_site_dir with | Some site_dir -> ref (Some (site_dir @ path)) | None -> - Eliom_common.defer Eliom_request_info.get_site_dir_option + Eliom_common.defer Request_info.get_site_dir_option (fun site_dir -> site_dir @ path)) ; get_name = Eliom_common.SAtt_no ; post_name = Eliom_common.SAtt_no @@ -518,7 +518,7 @@ let main_service let extern ?keep_nl_params ~prefix ~path ~meth () = let get_params, post_params = params_of_meth meth in - let suffix = Eliom_parameter.contains_suffix get_params in + let suffix = Parameter.contains_suffix get_params in let meth = which_meth_internal meth in main_service ~https:false (* not used for external links *) ~prefix diff --git a/src/lib/eliom_syntax.server.ml b/src/lib/eliom_syntax.server.ml index fb4ea411c4..23d213fca1 100644 --- a/src/lib/eliom_syntax.server.ml +++ b/src/lib/eliom_syntax.server.ml @@ -30,10 +30,9 @@ let get_global_data, modify_global_data = available) and eliommodules (site data available). Furthermore, the Eliom services must only send global data from ocsigen extensions and their own site. *) - let global_data = ref Eliom_lib.String_map.empty in + let global_data = ref Lib.String_map.empty in let site_data = - Eliom_reference.Volatile.eref ~scope:Eliom_common.site_scope - Eliom_lib.String_map.empty + Reference.Volatile.eref ~scope:Eliom_common.site_scope Lib.String_map.empty in let is_site_available () = (* Matches valid states for Eliom_common.get_site_data *) @@ -43,23 +42,23 @@ let get_global_data, modify_global_data = let get () = if is_site_available () then - Eliom_lib.String_map.merge + Lib.String_map.merge (fun compilation_unit_id global site -> match global, site with | None, None -> assert false | Some data, None | None, Some data -> Some data | Some _, Some site_data -> - Logs.err ~src:Eliom_lib.eliom_logs_src (fun fmt -> + Logs.err ~src:Lib.eliom_logs_src (fun fmt -> fmt "Compilation unit %s linked globally AND as Eliom module" compilation_unit_id); Some site_data) !global_data - (Eliom_reference.Volatile.get site_data) + (Reference.Volatile.get site_data) else !global_data in let modify f = if is_site_available () - then Eliom_reference.Volatile.modify site_data f + then Reference.Volatile.modify site_data f else global_data := f !global_data in get, modify @@ -67,12 +66,11 @@ let get_global_data, modify_global_data = let current_server_section_data = ref [] let get_compilation_unit_global_data compilation_unit_id = - (if not (Eliom_lib.String_map.mem compilation_unit_id (get_global_data ())) + (if not (Lib.String_map.mem compilation_unit_id (get_global_data ())) then let data = {server_section = []; client_section = []} in - ignore - (modify_global_data (Eliom_lib.String_map.add compilation_unit_id data))); - Eliom_lib.String_map.find compilation_unit_id (get_global_data ()) + ignore (modify_global_data (Lib.String_map.add compilation_unit_id data))); + Lib.String_map.find compilation_unit_id (get_global_data ()) let close_server_section compilation_unit_id = let data = get_compilation_unit_global_data compilation_unit_id in @@ -93,7 +91,7 @@ let close_client_section compilation_unit_id injection_data = Array.map injection_datum injection_data :: data.client_section let get_global_data () = - Eliom_lib.String_map.map + Lib.String_map.map (fun {server_section; client_section} -> { Eliom_runtime.server_sections_data = Array.of_list (List.rev server_section) @@ -102,13 +100,12 @@ let get_global_data () = (* Request data *) -let request_data : - Eliom_runtime.client_value_datum list Eliom_reference.Volatile.eref +let request_data : Eliom_runtime.client_value_datum list Reference.Volatile.eref = - Eliom_reference.Volatile.eref ~scope:Eliom_common.request_scope [] + Reference.Volatile.eref ~scope:Eliom_common.request_scope [] let get_request_data () = - Array.of_list (List.rev (Eliom_reference.Volatile.get request_data)) + Array.of_list (List.rev (Reference.Volatile.get request_data)) (* Register data *) @@ -126,7 +123,7 @@ let register_client_value_data ~closure_id ~args ~value = raise (Eliom_client_value.Client_value_creation_invalid_context closure_id) else - Eliom_reference.Volatile.modify request_data (fun sofar -> + Reference.Volatile.modify request_data (fun sofar -> client_value_datum :: sofar) (*****************************************************************************) @@ -138,7 +135,7 @@ let last_id = ref 0 let client_value ?pos closure_id args = let instance_id = if !is_global then (incr last_id; !last_id) else 0 in let value = Eliom_client_value.create_client_value ~loc:pos ~instance_id in - register_client_value_data ~closure_id ~args:(Eliom_lib.to_poly args) ~value; + register_client_value_data ~closure_id ~args:(Lib.to_poly args) ~value; Eliom_client_value.client_value_from_server_repr value let set_global b = is_global := b diff --git a/src/lib/eliom_syntax.server.mli b/src/lib/eliom_syntax.server.mli index ba27501ef0..2f1353fde8 100644 --- a/src/lib/eliom_syntax.server.mli +++ b/src/lib/eliom_syntax.server.mli @@ -22,11 +22,7 @@ val get_request_data : unit -> Eliom_runtime.request_data (*****************************************************************************) -val client_value : - ?pos:Eliom_lib.pos - -> string - -> 'args - -> 'a Eliom_client_value.t +val client_value : ?pos:Lib.pos -> string -> 'args -> 'a Eliom_client_value.t (** Registers a client value datum for the next server section when executed in a global_data (cf. {!Eliom_syntax.set_global}) or in the request_data when executed in a request. *) @@ -49,11 +45,12 @@ val close_server_section : string -> unit section data of the compilation unit ({!Eliom_lib_base.compilation_unit_global_data}). - Called in parallel with {!Eliom_client.Syntax_helpers.close_server_section}. *) + Called in parallel with <>. *) val close_client_section : string - -> (int * Ocsigen_lib.poly * Eliom_lib.pos * string option) list + -> (int * Ocsigen_lib.poly * Lib.pos * string option) list -> unit (** Called at the end of every client or shared section. The first argument identifies the compilation unit. The second is the list @@ -63,7 +60,8 @@ val close_client_section : of client section data of the compilation unit ({!Eliom_lib_base.compilation_unit_global_data}). - Called in parallel with {!Eliom_client.Syntax_helpers.open_client_section}. *) + Called in parallel with <>. *) val escaped_value : 'a -> Eliom_runtime.escaped_value (** Convert any value to a {! Eliom_runtime.escaped_value} for usage diff --git a/src/lib/eliom_types.server.ml b/src/lib/eliom_types.server.ml index 9549f0e2fa..28b696c3f3 100644 --- a/src/lib/eliom_types.server.ml +++ b/src/lib/eliom_types.server.ml @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib include Eliom_types_base (* let wrap_parameters (v : 'a) : client_expr_parameters = *) @@ -25,7 +25,7 @@ include Eliom_types_base (* if Obj.is_int v *) (* then PImm (Obj.obj v) *) (* else *) -(* let cri = Eliom_request_info.get_sp_client_request_info () in *) +(* let cri = Request_info.get_sp_client_request_info () in *) (* let id = List.length cri.Eliom_common.cri_page_data in *) (* cri.Eliom_common.cri_page_data <- *) (* (Obj.obj v) :: cri.Eliom_common.cri_page_data; *) @@ -35,7 +35,7 @@ include Eliom_types_base (* the string is urlencoded because otherwise js does strange things with strings ... *) let encode_eliom_data r = - Url.encode ~plus:false (Marshal.to_string (Eliom_wrap.wrap r) []) + Url.encode ~plus:false (Marshal.to_string (Wrap.wrap r) []) (* let string_map f s = diff --git a/src/lib/eliom_types_base.shared.ml b/src/lib/eliom_types_base.shared.ml index efdccf9f12..61f3147583 100644 --- a/src/lib/eliom_types_base.shared.ml +++ b/src/lib/eliom_types_base.shared.ml @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib (* Some types are different on client side: *) diff --git a/src/lib/eliom_types_base.shared.mli b/src/lib/eliom_types_base.shared.mli index b68881004e..cfa78f0472 100644 --- a/src/lib/eliom_types_base.shared.mli +++ b/src/lib/eliom_types_base.shared.mli @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib type sitedata = {site_dir : Url.path; site_dir_string : string} type server_params diff --git a/src/lib/eliom_uri.shared.ml b/src/lib/eliom_uri.shared.ml index 47ec1c3c23..5e701fcc4b 100644 --- a/src/lib/eliom_uri.shared.ml +++ b/src/lib/eliom_uri.shared.ml @@ -23,12 +23,12 @@ let rec string_of_url_path' = function | [] -> "" | [a] when a = Eliom_common.eliom_suffix_internal_name -> "" - | [a] -> Eliom_lib.Url.encode ~plus:false a + | [a] -> Lib.Url.encode ~plus:false a | a :: b :: l when b = Eliom_common.eliom_suffix_internal_name -> string_of_url_path' (a :: l) | a :: l when a = Eliom_common.eliom_suffix_internal_name -> string_of_url_path' l - | a :: l -> Eliom_lib.Url.encode ~plus:false a ^ "/" ^ string_of_url_path' l + | a :: l -> Lib.Url.encode ~plus:false a ^ "/" ^ string_of_url_path' l let string_of_url_path_suff u = function | None -> string_of_url_path' u @@ -72,14 +72,12 @@ let make_actual_path = Eliom_common.make_actual_path let make_proto_prefix ?hostname ?port https : string = let sp = Eliom_common.get_sp_option () in let ssl = - match sp with - | Some sp -> Eliom_request_info.get_csp_ssl_sp sp - | None -> false + match sp with Some sp -> Request_info.get_csp_ssl_sp sp | None -> false in let host = match hostname, sp with - | None, Some sp -> Eliom_request_info.get_csp_hostname_sp sp - | None, None -> Eliom_config.get_default_hostname () + | None, Some sp -> Request_info.get_csp_hostname_sp sp + | None, None -> Config.get_default_hostname () | Some h, _ -> h in let port = @@ -87,21 +85,21 @@ let make_proto_prefix ?hostname ?port https : string = | Some p, _ -> p | None, Some sp -> if https = ssl - then Eliom_request_info.get_csp_server_port_sp sp + then Request_info.get_csp_server_port_sp sp else if https - then Eliom_config.get_default_sslport () - else Eliom_config.get_default_port () + then Config.get_default_sslport () + else Config.get_default_port () | None, None -> if https - then Eliom_config.get_default_sslport () - else Eliom_config.get_default_port () + then Config.get_default_sslport () + else Config.get_default_port () in - Eliom_lib.Url.make_absolute_url ~https ~host ~port "/" + Lib.Url.make_absolute_url ~https ~host ~port "/" let is_https https ssl service = https = Some true - || (https = None && Eliom_config.default_protocol_is_https ()) - || Eliom_service.https service + || (https = None && Config.default_protocol_is_https ()) + || Service.https service || (https = None && ssl) let make_uri_components_ @@ -114,24 +112,23 @@ let make_uri_components_ ?(* used to force absolute link without protocol/server/port *) https (type a) - ~(service : (_, _, _, a, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (_, _, _, a, _, _, _, _, _, _, _) Service.t) ?hostname ?port ?fragment ?keep_nl_params - ?(nl_params = Eliom_parameter.empty_nl_params_set) + ?(nl_params = Parameter.empty_nl_params_set) () = let absolute = match absolute with | Some a -> a | None -> - !Eliom_common.is_client_app - && not (Eliom_service.has_client_fun service) + !Eliom_common.is_client_app && not (Service.has_client_fun service) in let ssl = match Eliom_common.get_sp_option () with - | Some sp -> Eliom_request_info.get_csp_ssl_sp sp + | Some sp -> Request_info.get_csp_ssl_sp sp | None -> false in let https = is_https https ssl service in @@ -143,16 +140,14 @@ let make_uri_components_ else None in (*VVV We trust current protocol? *) - let nl_params = Eliom_parameter.table_of_nl_params_set nl_params in + let nl_params = Parameter.table_of_nl_params_set nl_params in let keep_nl_params = match keep_nl_params with - | None -> Eliom_service.keep_nl_params service + | None -> Service.keep_nl_params service | Some b -> b in (* for preapplied non localized and not non localized: *) - let preappnlp, preapplied_params = - Eliom_service.pre_applied_parameters service - in + let preappnlp, preapplied_params = Service.pre_applied_parameters service in let nlp = match Eliom_common.get_sp_option () with | None -> preappnlp @@ -160,55 +155,51 @@ let make_uri_components_ match keep_nl_params with | `All -> (* We replace current nl params by preapplied ones *) - Eliom_lib.String.Table.fold - (fun key v b -> Eliom_lib.String.Table.add key v b) + Lib.String.Table.fold + (fun key v b -> Lib.String.Table.add key v b) preappnlp (Eliommod_parameters.inject_param_table - (Eliom_request_info.get_nl_get_params_sp sp)) + (Request_info.get_nl_get_params_sp sp)) | `Persistent -> (* We replace current nl params by preapplied ones *) - Eliom_lib.String.Table.fold Eliom_lib.String.Table.add preappnlp + Lib.String.Table.fold Lib.String.Table.add preappnlp (Eliommod_parameters.inject_param_table - (Eliom_request_info.get_persistent_nl_get_params_sp sp)) + (Request_info.get_persistent_nl_get_params_sp sp)) | `None -> preappnlp) in let nlp = (* We replace current nl params by nl_params *) - Eliom_lib.String.Table.fold Eliom_lib.String.Table.add nl_params nlp + Lib.String.Table.fold Lib.String.Table.add nl_params nlp in (* remove in nlp the one present in the service parameters *) - let getparamstype = Eliom_service.get_params_type service in - let nlp = Eliom_parameter.remove_from_nlp nlp getparamstype in + let getparamstype = Service.get_params_type service in + let nlp = Parameter.remove_from_nlp nlp getparamstype in let hiddenparams = - Eliom_lib.String.Table.fold (fun _ l beg -> l @ beg) nlp preapplied_params + Lib.String.Table.fold (fun _ l beg -> l @ beg) nlp preapplied_params in - match Eliom_service.info service with - | Eliom_service.Attached attser -> ( + match Service.info service with + | Service.Attached attser -> ( let uri = let suff = None in - if Eliom_service.is_external service + if Service.is_external service then - Eliom_service.prefix attser - ^ "/" + Service.prefix attser ^ "/" ^ (* we add the "/" even if there is no prefix, because we should do absolute links in that case *) - reconstruct_absolute_url_path (Eliom_service.full_path attser) suff + reconstruct_absolute_url_path (Service.full_path attser) suff else match absolute with | Some proto_prefix -> proto_prefix - ^ reconstruct_absolute_url_path - (Eliom_service.full_path attser) - suff + ^ reconstruct_absolute_url_path (Service.full_path attser) suff | None -> let sp = Eliom_common.get_sp () in reconstruct_relative_url_path_string - (Eliom_request_info.get_csp_original_full_path_sp sp) - (Eliom_service.full_path attser) - suff + (Request_info.get_csp_original_full_path_sp sp) + (Service.full_path attser) suff in - match Eliom_service.get_name attser with + match Service.get_name attser with | Eliom_common.SAtt_no -> uri, hiddenparams, fragment | Eliom_common.SAtt_anon s -> ( uri @@ -224,9 +215,7 @@ let make_uri_components_ , fragment ) | Eliom_common.SAtt_csrf_safe csrf_info -> let sp = Eliom_common.get_sp () in - let s = - Eliom_service.register_delayed_get_or_na_coservice ~sp csrf_info - in + let s = Service.register_delayed_get_or_na_coservice ~sp csrf_info in ( uri , ( Eliom_common.get_numstate_param_name , Eliommod_parameters.insert_string s ) @@ -244,23 +233,21 @@ let make_uri_components_ , fragment ) | Eliom_common.SAtt_na_csrf_safe csrf_info -> let sp = Eliom_common.get_sp () in - let s = - Eliom_service.register_delayed_get_or_na_coservice ~sp csrf_info - in + let s = Service.register_delayed_get_or_na_coservice ~sp csrf_info in ( uri , (Eliom_common.naservice_num, Eliommod_parameters.insert_string s) :: hiddenparams , fragment )) - | Eliom_service.Nonattached naser -> + | Service.Nonattached naser -> let sp = Eliom_common.get_sp () in - let na_name = Eliom_service.na_name naser in + let na_name = Service.na_name naser in let params' = let current_get_params = if na_name = Eliom_common.SNa_void_keep - then (Eliom_request_info.get_si sp).Eliom_common.si_all_get_but_nl + then (Request_info.get_si sp).Eliom_common.si_all_get_but_nl else Lazy.force - (Eliom_request_info.get_si sp).Eliom_common.si_all_get_but_na_nl + (Request_info.get_si sp).Eliom_common.si_all_get_but_na_nl in match na_name with | Eliom_common.SNa_void_keep | Eliom_common.SNa_void_dontkeep -> @@ -272,7 +259,7 @@ let make_uri_components_ | Eliom_common.SNa_get_csrf_safe csrf_info -> let sp = Eliom_common.get_sp () in let n = - Eliom_service.register_delayed_get_or_na_coservice ~sp csrf_info + Service.register_delayed_get_or_na_coservice ~sp csrf_info in (Eliom_common.naservice_num, n) :: current_get_params | _ -> assert false @@ -284,12 +271,11 @@ let make_uri_components_ match absolute with | None -> reconstruct_relative_url_path_string - (Eliom_request_info.get_csp_original_full_path_sp sp) - (Eliom_request_info.get_original_full_path_sp sp) + (Request_info.get_csp_original_full_path_sp sp) + (Request_info.get_original_full_path_sp sp) None | Some proto_prefix -> - proto_prefix - ^ Eliom_request_info.get_original_full_path_string_sp sp + proto_prefix ^ Request_info.get_original_full_path_string_sp sp in beg, params, fragment @@ -298,7 +284,7 @@ let make_uri_components ?absolute_path ?https (type a) - ~(service : (_, _, _, a, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (_, _, _, a, _, _, _, _, _, _, _) Service.t) ?hostname ?port ?fragment @@ -312,8 +298,8 @@ let make_uri_components in (* for getparams and non localized params: *) let suff, params = - Eliom_parameter.construct_params_list Eliom_lib.String.Table.empty - (Eliom_service.get_params_type service) + Parameter.construct_params_list Lib.String.Table.empty + (Service.get_params_type service) getparams (* if nl params were already present, they will be replaced by new values *) @@ -327,15 +313,15 @@ let make_uri_components then uri ^ suff else String.concat "/" [uri; suff] in - let fragment = Eliom_lib.Option.map Eliom_lib.Url.encode fragment in + let fragment = Lib.Option.map Lib.Url.encode fragment in uri, params @ pregetparams, fragment let make_string_uri_from_components (uri, params, fragment) = let s = - Eliom_lib.String.may_concat uri ~sep:"?" - (Eliom_parameter.construct_params_string params) + Lib.String.may_concat uri ~sep:"?" + (Parameter.construct_params_string params) in - match fragment with None -> s | Some f -> Eliom_lib.String.concat "#" [s; f] + match fragment with None -> s | Some f -> Lib.String.concat "#" [s; f] let make_string_uri ?absolute @@ -361,20 +347,20 @@ let make_post_uri_components_ ?(absolute_path = false) ?https (type a) - ~(service : (_, _, _, a, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (_, _, _, a, _, _, _, _, _, _, _) Service.t) ?hostname ?port ?fragment ?(keep_nl_params : [`All | `Persistent | `None] option) - ?(nl_params = Eliom_parameter.empty_nl_params_set) + ?(nl_params = Parameter.empty_nl_params_set) ?keep_get_na_params getparams () = - match Eliom_service.info service with - | Eliom_service.Attached attser -> + match Service.info service with + | Service.Attached attser -> let (uri, getparams, fragment), getname = - let getname = Eliom_service.get_name attser in + let getname = Service.get_name attser in match getname with | Eliom_common.SAtt_csrf_safe csrf_info -> (* special case for post-coservices on get csrf safe services: @@ -382,11 +368,10 @@ let make_post_uri_components_ let sp = Eliom_common.get_sp () in let s = Eliom_common.SAtt_anon - (Eliom_service.register_delayed_get_or_na_coservice ~sp - csrf_info) + (Service.register_delayed_get_or_na_coservice ~sp csrf_info) in ( make_uri_components ~absolute ~absolute_path ?https - ~service:(Eliom_service.change_get_num service attser s) + ~service:(Service.change_get_num service attser s) ?hostname ?port ?fragment ?keep_nl_params ~nl_params getparams , s ) | _ -> @@ -395,15 +380,14 @@ let make_post_uri_components_ , getname ) in let postparams = - match Eliom_service.post_name attser with + match Service.post_name attser with | Eliom_common.SAtt_no -> [] | Eliom_common.SAtt_anon s -> [Eliom_common.post_numstate_param_name, s] | Eliom_common.SAtt_named s -> [Eliom_common.post_state_param_name, s] | Eliom_common.SAtt_csrf_safe csrf_info -> let sp = Eliom_common.get_sp () in let s = - Eliom_service.register_delayed_post_coservice ~sp csrf_info - getname + Service.register_delayed_post_coservice ~sp csrf_info getname in [Eliom_common.post_numstate_param_name, s] | Eliom_common.SAtt_na_anon s -> [Eliom_common.naservice_num, s] @@ -411,43 +395,42 @@ let make_post_uri_components_ | Eliom_common.SAtt_na_csrf_safe csrf_info -> let sp = Eliom_common.get_sp () in let s = - Eliom_service.register_delayed_post_coservice ~sp csrf_info - getname + Service.register_delayed_post_coservice ~sp csrf_info getname in [Eliom_common.naservice_num, s] in uri, getparams, fragment, Eliommod_parameters.inject_param_list postparams - | Eliom_service.Nonattached naser -> + | Service.Nonattached naser -> let sp = Eliom_common.get_sp () in - let nl_params = Eliom_parameter.table_of_nl_params_set nl_params in + let nl_params = Parameter.table_of_nl_params_set nl_params in let keep_nl_params = match keep_nl_params with - | None -> Eliom_service.keep_nl_params service + | None -> Service.keep_nl_params service | Some b -> b in - let preappnlp, preapp = Eliom_service.pre_applied_parameters service in + let preappnlp, preapp = Service.pre_applied_parameters service in let nlp = match keep_nl_params with | `All -> (* We replace current nl params by preapplied ones *) - Eliom_lib.String.Table.fold Eliom_lib.String.Table.add preappnlp + Lib.String.Table.fold Lib.String.Table.add preappnlp (Eliommod_parameters.inject_param_table - (Eliom_request_info.get_nl_get_params ())) + (Request_info.get_nl_get_params ())) | `Persistent -> (* We replace current nl params by preapplied ones *) - Eliom_lib.String.Table.fold Eliom_lib.String.Table.add preappnlp + Lib.String.Table.fold Lib.String.Table.add preappnlp (Eliommod_parameters.inject_param_table - (Eliom_request_info.get_persistent_nl_get_params_sp sp)) + (Request_info.get_persistent_nl_get_params_sp sp)) | `None -> preappnlp in let nlp = (* We replace current nl params by nl_params *) - Eliom_lib.String.Table.fold Eliom_lib.String.Table.add nl_params nlp + Lib.String.Table.fold Lib.String.Table.add nl_params nlp in (* for getparams and non localized params: *) let _suff, params = - Eliom_parameter.construct_params_list nlp - (Eliom_service.get_params_type service) + Parameter.construct_params_list nlp + (Service.get_params_type service) getparams (* if nl params were already present, they will be replaced by new values *) @@ -458,19 +441,18 @@ let make_post_uri_components_ let keep_get_na_params = match keep_get_na_params with | Some b -> b - | None -> Eliom_service.na_keep_get_na_params naser + | None -> Service.na_keep_get_na_params naser in let params = params @ Eliommod_parameters.inject_param_list (if keep_get_na_params - then (Eliom_request_info.get_si sp).Eliom_common.si_all_get_but_nl + then (Request_info.get_si sp).Eliom_common.si_all_get_but_nl else Lazy.force - (Eliom_request_info.get_si sp) - .Eliom_common.si_all_get_but_na_nl) + (Request_info.get_si sp).Eliom_common.si_all_get_but_na_nl) in - let ssl = Eliom_request_info.get_csp_ssl_sp sp in + let ssl = Request_info.get_csp_ssl_sp sp in let https = is_https https ssl service in let absolute = if absolute || https <> ssl @@ -486,7 +468,7 @@ let make_post_uri_components_ if !Eliom_common.is_client_app && - let s = Eliom_request_info.get_original_full_path_string_sp sp + let s = Request_info.get_original_full_path_string_sp sp and s' = Eliom_common.client_html_file () in let n = String.length s and n' = String.length s' in n >= n' && String.(sub s (n - n') n') = s' @@ -506,24 +488,22 @@ let make_post_uri_components_ [Eliom_common.client_html_file ()] (default: "eliom.html"), we disregard it and use the site dir as the path. *) - let sd = Eliom_request_info.get_site_dir () in + let sd = Request_info.get_site_dir () in proto_prefix ^ String.concat "/" sd ^ "/" - else - proto_prefix - ^ Eliom_request_info.get_original_full_path_string_sp sp + else proto_prefix ^ Request_info.get_original_full_path_string_sp sp | None -> reconstruct_relative_url_path_string - (Eliom_request_info.get_csp_original_full_path_sp sp) - (Eliom_request_info.get_original_full_path_sp sp) + (Request_info.get_csp_original_full_path_sp sp) + (Request_info.get_original_full_path_sp sp) None in let naservice_line = - match Eliom_service.na_name naser with + match Service.na_name naser with | Eliom_common.SNa_post' n -> Eliom_common.naservice_num, n | Eliom_common.SNa_post_ n -> Eliom_common.naservice_name, n | Eliom_common.SNa_post_csrf_safe csrf_info -> let n = - Eliom_service.register_delayed_get_or_na_coservice ~sp csrf_info + Service.register_delayed_get_or_na_coservice ~sp csrf_info in Eliom_common.naservice_num, n | _ -> assert false @@ -555,8 +535,8 @@ let make_post_uri_components () in let _, postparams = - Eliom_parameter.construct_params_list Eliom_lib.String.Table.empty - (Eliom_service.post_params_type service) + Parameter.construct_params_list Lib.String.Table.empty + (Service.post_params_type service) postparams in uri, getparams, fragment, postparams @ prepostparams @@ -586,21 +566,21 @@ let make_cookies_info (https, service) = ~(* simplified version of make_uri_components. Returns only the absolute path without protocol/server/port AND WITHOUT SUFFIX *) - (service : (_, _, _, a, _, _, _, _, _, _, _) Eliom_service.t) + (service : (_, _, _, a, _, _, _, _, _, _, _) Service.t) = - match Eliom_service.info service with - | Eliom_service.Attached attser -> - if Eliom_service.is_external service + match Service.info service with + | Service.Attached attser -> + if Service.is_external service then None - else Some (Eliom_service.full_path attser) - | Eliom_service.Nonattached _naser -> - Some (Eliom_request_info.get_csp_original_full_path ()) + else Some (Service.full_path attser) + | Service.Nonattached _naser -> + Some (Request_info.get_csp_original_full_path ()) in match get_path_ ~service with | None -> None | Some path -> - let ssl = Eliom_request_info.get_csp_ssl () in + let ssl = Request_info.get_csp_ssl () in let https = - https = Some true || Eliom_service.https service || (https = None && ssl) + https = Some true || Service.https service || (https = None && ssl) in Some (https, path) diff --git a/src/lib/eliom_uri.shared.mli b/src/lib/eliom_uri.shared.mli index cce628d187..d891a64888 100644 --- a/src/lib/eliom_uri.shared.mli +++ b/src/lib/eliom_uri.shared.mli @@ -20,8 +20,8 @@ (** Low-level functions for relative or absolute URL calculation. *) -open Eliom_lib -open Eliom_parameter +open Lib +open Parameter (** {2 Compute service's URL} @@ -35,8 +35,8 @@ open Eliom_parameter To define {e global} link (i.e. outside of a service handler) and recompute a relative URL at each request, use - {!Eliom_registration.Html.a} or other specialized functions from - {!Eliom_registration.Html}. + {!Registration.Html.a} or other specialized functions from + {!Registration.Html}. *) @@ -45,18 +45,7 @@ val make_string_uri : -> ?absolute_path:bool -> ?https:bool -> service: - ( 'get - , unit - , Eliom_service.get - , _ - , _ - , _ - , _ - , _ - , _ - , unit - , 'return ) - Eliom_service.t + ('get, unit, Service.get, _, _, _, _, _, _, unit, 'return) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string @@ -68,8 +57,8 @@ val make_string_uri : string corresponding to the URL of the service [service] applied to the GET parameters [get_params]. - See {!Eliom_registration.Html.make_string_uri} or any other - {!Eliom_registration}[.*.make_string_uri] for a detailed + See {!Registration.Html.make_string_uri} or any other + {!Registration}[.*.make_string_uri] for a detailed description of optional parameters. {e Warning: The function [make_string_uri] should not be called @@ -86,8 +75,7 @@ val make_uri_components : ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ('get, _, Eliom_service.get, _, _, _, _, _, _, _, _) Eliom_service.t + -> service:('get, _, Service.get, _, _, _, _, _, _, _, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string @@ -100,16 +88,15 @@ val make_uri_components : of the URL of [service] applied to the GET parameters [get_params]. - See {!Eliom_registration.Html.make_uri_components} or any other - {!Eliom_registration}[.*.make_uri_components] for a detailed + See {!Registration.Html.make_uri_components} or any other + {!Registration}[.*.make_uri_components] for a detailed description. *) val make_post_uri_components : ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ('get, 'post, Eliom_service.post, _, _, _, _, _, _, _, _) Eliom_service.t + -> service:('get, 'post, Service.post, _, _, _, _, _, _, _, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string @@ -149,13 +136,13 @@ val reconstruct_relative_url_path : string list -> string list -> string list make_string_uri and make_post_uri_components with a less restrictive type. They should be removed once there is way to downcast a "service_method" service to "get" or "post" service. See - Eliom_mkreg and Eliom_client. *) + Mkreg and Client. *) val make_string_uri_ : ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service:('get, _, _, _, _, _, _, _, _, _, _) Eliom_service.t + -> service:('get, _, _, _, _, _, _, _, _, _, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string @@ -168,7 +155,7 @@ val make_post_uri_components__ : ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service:('get, 'post, _, _, _, _, _, _, _, _, _) Eliom_service.t + -> service:('get, 'post, _, _, _, _, _, _, _, _, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string @@ -186,7 +173,7 @@ val make_uri_components_ : ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service:(_, _, _, _, _, _, _, _, _, _, _) Eliom_service.t + -> service:(_, _, _, _, _, _, _, _, _, _, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string @@ -199,7 +186,7 @@ val make_post_uri_components_ : ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service:('get, 'post, _, _, _, _, _, _, _, _, _) Eliom_service.t + -> service:('get, 'post, _, _, _, _, _, _, _, _, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string @@ -221,5 +208,5 @@ val make_proto_prefix : ?hostname:string -> ?port:int -> bool -> string necessary). *) val make_cookies_info : - bool option * (_, _, _, _, _, _, _, _, _, _, _) Eliom_service.t + bool option * (_, _, _, _, _, _, _, _, _, _, _) Service.t -> (bool * Url.path) option diff --git a/src/lib/form_sigs.shared.mli b/src/lib/form_sigs.shared.mli index 2147d7c7bd..feb105b2a4 100644 --- a/src/lib/form_sigs.shared.mli +++ b/src/lib/form_sigs.shared.mli @@ -28,24 +28,12 @@ module type LINKS = sig ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ( 'get - , unit - , Eliom_service.get - , _ - , _ - , _ - , _ - , _ - , _ - , unit - , _ ) - Eliom_service.t + -> service:('get, unit, Service.get, _, _, _, _, _, _, unit, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `Persistent | `None] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> 'get -> uri (** The function [make_uri service get_params] returns the URL of @@ -112,7 +100,7 @@ module type LINKS = sig The optional parameter [keep_nl_params] allows one to override the [keep_nl_params] parameter used when creating the [service], - see {!Eliom_service.create} for a detailed description. + see {!Service.create} for a detailed description. The optional parameter [nl_params] allows one to add non localized GET parameter to the URL. See the eliom manual for @@ -141,7 +129,7 @@ module type LINKS = sig If the CSS is generated by an Eliom service, use {!make_uri} to calculate the service URI. If the CSS is a static file, you may - also use {!Eliom_service.static_dir} or {!Eliom_service.extern} + also use {!Service.static_dir} or {!Service.extern} to abstract the file with a service. The optional parameter [~a] allows one to add extra HTML @@ -157,8 +145,8 @@ module type LINKS = sig If the script content is generated by an Eliom service, use {!make_uri} to calculate the service URI. If it is a static - file, you may also use {!Eliom_service.static_dir} or - {!Eliom_service.extern} to abstract the file with a service. + file, you may also use {!Service.static_dir} or + {!Service.extern} to abstract the file with a service. The optional parameter [~a] allows one to add extra HTML attributes to the generated node. *) @@ -171,7 +159,7 @@ module type LINKS = sig -> service: ( 'get , unit - , Eliom_service.get + , Service.get , _ , _ , _ @@ -179,13 +167,13 @@ module type LINKS = sig , _ , _ , unit - , Eliom_service.non_ocaml ) - Eliom_service.t + , Service.non_ocaml ) + Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `Persistent | `None] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?xhr:bool -> 'a elt list -> 'get @@ -198,14 +186,16 @@ module type LINKS = sig By default, the link is implemented in a way that allows the client-side Eliom application to keep running, irrespectable of - the usage of the link (cf. {!Eliom_client.change_page}). + the usage of the link (cf. {% <> %}). By contrast, if the optional parameter [~xhr:false] is given, the link is realized as a standard HTML link and clicking it discontinues the Eliom application. The [~xhr] parameter has no effect outside an Eliom application. The default value of [~xhr] is configurable through - {!Eliom_config.set_default_links_xhr}. + {% <> %}. The optional parameter [~a] allows one to add extra HTML attributes to the generated node. @@ -222,8 +212,8 @@ module type S = sig (* When modifying this interface, please ensure that the ocamldoc is coherent with the ocamldoc from Eliom_uri. *) - open Eliom_lib - open Eliom_parameter + open Lib + open Parameter type 'a param type +'a elt @@ -243,24 +233,12 @@ module type S = sig ?absolute:bool -> ?absolute_path:bool -> ?https:bool - -> service: - ( 'get - , 'post - , Eliom_service.post - , _ - , _ - , _ - , _ - , _ - , _ - , _ - , _ ) - Eliom_service.t + -> service:('get, 'post, Service.post, _, _, _, _, _, _, _, _) Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `Persistent | `None] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?keep_get_na_params:bool -> 'get -> 'post @@ -279,7 +257,7 @@ module type S = sig -> service: ( _ , unit - , Eliom_service.get + , Service.get , _ , _ , _ @@ -287,13 +265,13 @@ module type S = sig , _ , 'gn , _ - , Eliom_service.non_ocaml ) - Eliom_service.t + , Service.non_ocaml ) + Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `Persistent | `None] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?xhr:bool -> ('gn -> [< Html_types.form_content] elt list) -> [> Html_types.form] elt @@ -305,7 +283,8 @@ module type S = sig By default, the form is realized such that the client-side Eliom application keeps running irrespectable of the usage of the form - (cf. {!Eliom_client.change_page}). + (cf. {% <> %}). By contrast, if the optional parameter [~xhr:false] is given, the form is realized as a standard HTML form and submitting it @@ -313,7 +292,8 @@ module type S = sig effect outside an Eliom application. NB that the default value of [~xhr] is configurable through - {!Eliom_config.set_default_links_xhr}. + {% <> %}. The optional parameter [~a] allows one to add extra HTML attributes to the generated node. @@ -329,7 +309,7 @@ module type S = sig -> service: ( _ , unit - , Eliom_service.get + , Service.get , _ , _ , _ @@ -337,13 +317,13 @@ module type S = sig , _ , 'gn , _ - , Eliom_service.non_ocaml ) - Eliom_service.t + , Service.non_ocaml ) + Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `Persistent | `None] - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?xhr:bool -> ('gn -> [< Html_types.form_content] elt list Lwt.t) -> [> Html_types.form] elt Lwt.t @@ -358,7 +338,7 @@ module type S = sig -> service: ( 'get , _ - , Eliom_service.post + , Service.post , _ , _ , _ @@ -366,14 +346,14 @@ module type S = sig , _ , _ , 'pn - , Eliom_service.non_ocaml ) - Eliom_service.t + , Service.non_ocaml ) + Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `Persistent | `None] -> ?keep_get_na_params:bool - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?xhr:bool -> ('pn -> [< Html_types.form_content] elt list) -> 'get @@ -388,7 +368,7 @@ module type S = sig The optional parameter [~a] allows one to add HTML attributes to the generated node. - See {!Eliom_service.make} for a description of the + See {!Service.make} for a description of the [~keep_get_na_params] optional parameter ; see {!get_form} for [~xhr] and see {!make_uri} for other optional parameters. *) @@ -400,7 +380,7 @@ module type S = sig -> service: ( 'get , _ - , Eliom_service.post + , Service.post , _ , _ , _ @@ -408,14 +388,14 @@ module type S = sig , _ , _ , 'pn - , Eliom_service.non_ocaml ) - Eliom_service.t + , Service.non_ocaml ) + Service.t -> ?hostname:string -> ?port:int -> ?fragment:string -> ?keep_nl_params:[`All | `Persistent | `None] -> ?keep_get_na_params:bool - -> ?nl_params:Eliom_parameter.nl_params_set + -> ?nl_params:Parameter.nl_params_set -> ?xhr:bool -> ('pn -> [< Html_types.form_content] elt list Lwt.t) -> 'get @@ -451,7 +431,7 @@ module type S = sig val checkbox : ?a:[< Html_types.input_attrib] attrib list -> ?checked:bool - -> name:[`Set of 'a] Eliom_parameter.param_name + -> name:[`Set of 'a] Parameter.param_name -> value:'a -> 'a param -> [> Html_types.input] elt @@ -462,7 +442,7 @@ module type S = sig val bool_checkbox_one : ?a:[< Html_types.input_attrib] attrib list -> ?checked:bool - -> name:[`One of bool] Eliom_parameter.param_name + -> name:[`One of bool] Parameter.param_name -> unit -> [> Html_types.input] elt (** Creates a checkbox [] tag of type bool. Only one checkbox diff --git a/src/lib/lib.client.ml b/src/lib/lib.client.ml index 12b376c3c9..4e15ba235f 100644 --- a/src/lib/lib.client.ml +++ b/src/lib/lib.client.ml @@ -62,7 +62,7 @@ module Url = struct let string_of_url_path ~encode l = if encode - then print_endline "Warning: Eliom_lib.string_of_url_path ignores ~encode"; + then print_endline "Warning: Lib.string_of_url_path ignores ~encode"; String.concat "/" l let path_of_url = function @@ -98,7 +98,7 @@ let _ = exn let trace fmts = - if Eliom_config.get_tracing () + if Config.get_tracing () then Printf.ksprintf (fun msg -> Logs.info (fun fmt -> fmt ">> %s" msg)) fmts else Printf.ksprintf ignore fmts diff --git a/src/lib/mkreg.server.ml b/src/lib/mkreg.server.ml index 61d4cd4130..54d5cc1d16 100644 --- a/src/lib/mkreg.server.ml +++ b/src/lib/mkreg.server.ml @@ -2,7 +2,7 @@ open Lwt.Syntax (* Ocsigen * http://www.ocsigen.org - * Module Eliom_mkreg + * Module Mkreg * Copyright (C) 2007 Vincent Balat * * This program is free software; you can redistribute it and/or modify @@ -20,7 +20,7 @@ open Lwt.Syntax * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module S = Eliom_service +module S = Service open Lwt.Infix let suffix_redir_uri_key = Polytables.make_key () @@ -36,7 +36,7 @@ type ('options, 'page, 'result) param = -> Ocsigen_response.t Lwt.t ; send_appl_content : S.send_appl_content (** Whether the service is capable to send application content when - required. This field is usually [Eliom_service.XNever]. This + required. This field is usually [Service.XNever]. This value is recorded inside each service just after registration. *) ; result_of_http_result : Ocsigen_response.t -> 'result } @@ -74,7 +74,7 @@ let check_before name service = | _ -> true (* This test check if there is a header set only by - Eliom_registration.App. This test is sufficient, but it is better + Registration.App. This test is sufficient, but it is better to stop page generation as soon as we know that the content won't be needed: hence we test what we can before page generation. *) let check_after name result = @@ -89,7 +89,7 @@ let check_after name result = let check_process_redir sp f param = let redir = - if Eliom_request_info.expecting_process_page () + if Request_info.expecting_process_page () then match sp.Eliom_common.sp_client_appl_name with (* the appl name as sent by browser *) @@ -101,16 +101,16 @@ let check_process_redir sp f param = in if redir then - let ri = Eliom_request_info.get_ri_sp sp in + let ri = Request_info.get_ri_sp sp in Lwt.fail (* we answer to the xhr by asking an HTTP redirection *) (Eliom_common.Eliom_do_half_xhr_redirection ("/" - ^ Eliom_lib.String.may_concat + ^ Lib.String.may_concat (Ocsigen_request.original_full_path_string ri) ~sep:"?" - (Eliom_parameter.construct_params_string + (Parameter.construct_params_string (Ocsigen_request.get_params_flat ri)))) (* We do not put hostname and port. It is ok with half or full xhr redirections. *) @@ -148,7 +148,7 @@ let send_with_cookies {response with Cohttp.Response.headers} and cookies = Ocsigen_cookie_map.add_multi - (Eliom_request_info.get_user_cookies ()) + (Request_info.get_user_cookies ()) (Ocsigen_response.cookies result) in Lwt.return (Ocsigen_response.update result ~cookies ~response) @@ -178,9 +178,7 @@ let register_aux and sppt = S.post_params_type service in let s_id = if attserget = Eliom_common.SAtt_no || attserpost = Eliom_common.SAtt_no - then - Eliom_parameter.( - anonymise_params_type sgpt, anonymise_params_type sppt) + then Parameter.(anonymise_params_type sgpt, anonymise_params_type sppt) else 0, 0 and s_max_use = S.max_use service and s_expire = @@ -189,7 +187,7 @@ let register_aux | Some t -> Some (t, ref (t +. Unix.time ())) in let f table ((_attserget, _attserpost) as attsernames) = - Eliom_route.add_service priority table (S.sub_path attser) + Route.add_service priority table (S.sub_path attser) { Eliom_common.key_state = attsernames ; Eliom_common.key_meth :> Eliom_common.meth } { s_id @@ -198,34 +196,32 @@ let register_aux ; s_f = (fun nosuffixversion sp -> Lwt.with_value Eliom_common.sp_key (Some sp) (fun () -> - let ri = Eliom_request_info.get_ri_sp sp - and suff = Eliom_request_info.get_suffix_sp sp in + let ri = Request_info.get_ri_sp sp + and suff = Request_info.get_suffix_sp sp in Lwt.catch (fun () -> - Eliom_parameter.reconstruct_params ~sp sgpt + Parameter.reconstruct_params ~sp sgpt (Some (Lwt.return (Ocsigen_request.get_params_flat ri))) (Some (Lwt.return [])) nosuffixversion suff >>= fun g -> - let post_params = - Eliom_request_info.get_post_params_sp sp - in - let files = Eliom_request_info.get_files_sp sp in - Eliom_parameter.reconstruct_params ~sp sppt post_params - files false None + let post_params = Request_info.get_post_params_sp sp in + let files = Request_info.get_files_sp sp in + Parameter.reconstruct_params ~sp sppt post_params files + false None >>= fun p -> (* GRGR TODO: avoid Eliom_uri.make_string_uri_. But we need to "downcast" the type of service to the correct "get service". *) (if - Eliom_request_info.get_http_method () = `GET + Request_info.get_http_method () = `GET && nosuffixversion && suffix_with_redirect then ( if (* it is a suffix service in version without suffix. We redirect. *) - not (Eliom_request_info.expecting_process_page ()) + not (Request_info.expecting_process_page ()) then let redir_uri = Eliom_uri.make_string_uri_ ~absolute:true @@ -264,14 +260,12 @@ let register_aux We don't redirect but we set this special information for url to be displayed by the browser - (see Eliom_request_info.rebuild_uri_without_iternal_form_info_) + (see Request_info.rebuild_uri_without_iternal_form_info_) *) let redir_uri = Eliom_uri.make_string_uri_ ~service g in - let rc = - Eliom_request_info.get_request_cache_sp sp - in + let rc = Request_info.get_request_cache_sp sp in Polytables.set ~table:rc ~key:suffix_redir_uri_key ~value:redir_uri; Lwt.return_unit) @@ -292,11 +286,11 @@ let register_aux , Eliom_common.SAtt_csrf_safe (id, scope, secure_session) ) -> let tablereg, forsession = match table with - | Eliom_lib.Left globtbl -> globtbl, false - | Eliom_lib.Right (sp, ct, sec) -> + | Lib.Left globtbl -> globtbl, false + | Lib.Right (sp, ct, sec) -> if secure_session <> sec || scope <> ct then raise S.Wrong_session_table_for_CSRF_safe_coservice; - ( !(Eliom_state.get_session_service_table ?secure:secure_session + ( !(State.get_session_service_table ?secure:secure_session ~scope ~sp ()) , true ) in @@ -311,8 +305,8 @@ let register_aux (* we do not register in global table, but in the table specified while creating the csrf safe service *) - !(Eliom_state.get_session_service_table - ?secure:secure_session ~scope ~sp ()) + !(State.get_session_service_table ?secure:secure_session + ~scope ~sp ()) in f table (attserget, attserpost); n) @@ -323,7 +317,7 @@ let register_aux | Right (sp, ct, sec) -> if secure_session <> sec || ct <> scope then raise S.Wrong_session_table_for_CSRF_safe_coservice; - ( !(Eliom_state.get_session_service_table ?secure:secure_session + ( !(State.get_session_service_table ?secure:secure_session ~scope ~sp ()) , true ) in @@ -337,8 +331,8 @@ let register_aux (* we do not register in global table, but in the table specified while creating the csrf safe service *) - !(Eliom_state.get_session_service_table ?secure:secure_session - ~scope ~sp ()) + !(State.get_session_service_table ?secure:secure_session ~scope + ~sp ()) in f table (attserget, attserpost); n) @@ -347,14 +341,14 @@ let register_aux match table with | Left globtbl -> globtbl | Right (sp, scope, secure_session) -> - !(Eliom_state.get_session_service_table ?secure:secure_session - ~scope ~sp ()) + !(State.get_session_service_table ?secure:secure_session ~scope + ~sp ()) in f tablereg (attserget, attserpost)) | S.Nonattached naser -> ( let na_name = S.na_name naser in let f table na_name = - Eliom_route.add_naservice table na_name + Route.add_naservice table na_name ( (match S.max_use service with | None -> None | Some i -> Some (ref i)) @@ -363,20 +357,18 @@ let register_aux | Some t -> Some (t, ref (t +. Unix.time ()))) , fun sp -> Lwt.with_value Eliom_common.sp_key (Some sp) (fun () -> - let ri = Eliom_request_info.get_ri_sp sp in + let ri = Request_info.get_ri_sp sp in Lwt.catch (fun () -> - Eliom_parameter.reconstruct_params ~sp + Parameter.reconstruct_params ~sp (S.get_params_type service) (Some (Lwt.return (Ocsigen_request.get_params_flat ri))) (Some (Lwt.return [])) false None >>= fun g -> - let post_params = - Eliom_request_info.get_post_params_sp sp - in - let files = Eliom_request_info.get_files_sp sp in - Eliom_parameter.reconstruct_params ~sp + let post_params = Request_info.get_post_params_sp sp in + let files = Request_info.get_files_sp sp in + Parameter.reconstruct_params ~sp (S.post_params_type service) post_params files false None >>= fun p -> @@ -398,7 +390,7 @@ let register_aux | Right (sp, ct, sec) -> if secure_session <> sec || ct <> scope then raise S.Wrong_session_table_for_CSRF_safe_coservice; - ( !(Eliom_state.get_session_service_table ?secure:secure_session + ( !(State.get_session_service_table ?secure:secure_session ~scope ~sp ()) , true ) in @@ -412,8 +404,8 @@ let register_aux (* we do not register in global table, but in the table specified while creating the csrf safe service *) - !(Eliom_state.get_session_service_table ?secure:secure_session - ~scope ~sp ()) + !(State.get_session_service_table ?secure:secure_session ~scope + ~sp ()) in f table na_name; n) | Eliom_common.SNa_post_csrf_safe (id, scope, secure_session) -> @@ -424,7 +416,7 @@ let register_aux | Right (sp, ct, sec) -> if secure_session <> sec || ct <> scope then raise S.Wrong_session_table_for_CSRF_safe_coservice; - ( !(Eliom_state.get_session_service_table ?secure:secure_session + ( !(State.get_session_service_table ?secure:secure_session ~scope ~sp ()) , true ) in @@ -438,8 +430,8 @@ let register_aux (* we do not register in global table, but in the table specified while creating the csrf safe service *) - !(Eliom_state.get_session_service_table ?secure:secure_session - ~scope ~sp ()) + !(State.get_session_service_table ?secure:secure_session ~scope + ~sp ()) in f table na_name; n) | _ -> @@ -447,8 +439,8 @@ let register_aux match table with | Left globtbl -> globtbl | Right (sp, scope, secure_session) -> - !(Eliom_state.get_session_service_table ?secure:secure_session - ~scope ~sp ()) + !(State.get_session_service_table ?secure:secure_session ~scope + ~sp ()) in f tablereg na_name) @@ -502,7 +494,7 @@ let register | None, Some _ | Some `Site, Some _ -> register_aux pages ?options ?charset ?code ?content_type ?headers ?error_handler - (Eliom_lib.Left (Eliom_state.get_global_table ())) + (Lib.Left (State.get_global_table ())) ~service page_gen | _, None -> raise (failwith "Missing sp while registering service") | Some (#Eliom_common.user_scope as scope), Some sp -> @@ -612,11 +604,11 @@ let create_attached_post service module Make - (Pages : Eliom_registration_sigs.PARAM with type frame := Ocsigen_response.t) = + (Pages : Registration_sigs.PARAM with type frame := Ocsigen_response.t) = struct type page = Pages.page type options = Pages.options - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml type result = Pages.result let pages = @@ -632,8 +624,7 @@ struct end module Make_poly - (Pages : - Eliom_registration_sigs.PARAM_POLY with type frame := Ocsigen_response.t) = + (Pages : Registration_sigs.PARAM_POLY with type frame := Ocsigen_response.t) = struct type 'a page = 'a Pages.page type options = Pages.options diff --git a/src/lib/mkreg.server.mli b/src/lib/mkreg.server.mli index 5a17492407..611752b566 100644 --- a/src/lib/mkreg.server.mli +++ b/src/lib/mkreg.server.mli @@ -1,6 +1,6 @@ (* Ocsigen * http://www.ocsigen.org - * Module Eliom_mkreg + * Module Mkreg * Copyright (C) 2007 Vincent Balat * * This program is free software; you can redistribute it and/or modify @@ -20,12 +20,12 @@ (** This module defines the functor to use to creates modules generating functions to register services for your own types of - pages. It is used for example in {!Eliom_registration}. *) + pages. It is used for example in {!Registration}. *) (** {2 Creates modules to register services for one type of pages} *) module Make - (Pages : Eliom_registration_sigs.PARAM with type frame := Ocsigen_response.t) : - Eliom_registration_sigs.S_with_create + (Pages : Registration_sigs.PARAM with type frame := Ocsigen_response.t) : + Registration_sigs.S_with_create with type page = Pages.page and type options = Pages.options and type result = Pages.result @@ -33,9 +33,8 @@ module Make (** {2 Creating modules to register services for one type of parametrised pages} *) module Make_poly - (Pages : - Eliom_registration_sigs.PARAM_POLY with type frame := Ocsigen_response.t) : - Eliom_registration_sigs.S_poly_with_create + (Pages : Registration_sigs.PARAM_POLY with type frame := Ocsigen_response.t) : + Registration_sigs.S_poly_with_create with type 'a page = 'a Pages.page and type options = Pages.options and type 'a return = 'a Pages.return diff --git a/src/lib/notif.server.ml b/src/lib/notif.server.ml index 41e6e1cf46..7965e6c7f3 100644 --- a/src/lib/notif.server.ml +++ b/src/lib/notif.server.ml @@ -20,7 +20,7 @@ module type S = sig module Ext : sig val unlisten : ?sitedata:Eliom_common.sitedata - -> ([< `Client_process], [< `Data]) Eliom_state.Ext.state + -> ([< `Client_process], [< `Data]) State.Ext.state -> key -> unit end @@ -119,25 +119,25 @@ module Make (A : ARG) : end let identity_r : - (A.identity * notification_react) option Eliom_reference.Volatile.eref + (A.identity * notification_react) option Reference.Volatile.eref = - Eliom_reference.Volatile.eref ~scope:Eliom_common.default_process_scope None + Reference.Volatile.eref ~scope:Eliom_common.default_process_scope None (* notif_e consists in a server side react event, its client side counterpart, and the server side function to trigger it. *) - let notif_e : notification_react Eliom_reference.Volatile.eref = - Eliom_reference.Volatile.eref_from_fun - ~scope:Eliom_common.default_process_scope (fun () -> - let e, send_e = React.E.create () in - let client_ev = - Eliom_react.Down.of_react - (*VVV If we add throttling, some events may be lost + let notif_e : notification_react Reference.Volatile.eref = + Reference.Volatile.eref_from_fun ~scope:Eliom_common.default_process_scope + (fun () -> + let e, send_e = React.E.create () in + let client_ev = + Eliom_react.Down.of_react + (*VVV If we add throttling, some events may be lost even if buffer size is not 1 :O *) - ~size:100 (*VVV ? *) - ~scope:Eliom_common.default_process_scope e - in - client_ev, send_e) + ~size:100 (*VVV ? *) + ~scope:Eliom_common.default_process_scope e + in + client_ev, send_e) let set_identity identity = (* For each tab connected to the app, @@ -145,26 +145,26 @@ module Make (A : ARG) : because the table resourceid -> (identity, notif_ev) option is weak. *) - let notif_e = Eliom_reference.Volatile.get notif_e in - Eliom_reference.Volatile.set identity_r (Some (identity, notif_e)) + let notif_e = Reference.Volatile.get notif_e in + Reference.Volatile.set identity_r (Some (identity, notif_e)) let set_current_identity () = A.get_identity () >>= fun identity -> set_identity identity; Lwt.return_unit let init : unit -> unit Lwt.t = fun () -> set_current_identity () - let deinit () = Eliom_reference.Volatile.set identity_r None + let deinit () = Reference.Volatile.set identity_r None let listen (key : A.key) = - let identity = Eliom_reference.Volatile.get identity_r in + let identity = Reference.Volatile.get identity_r in I.add identity key let unlisten (id : A.key) = - let identity = Eliom_reference.Volatile.get identity_r in + let identity = Reference.Volatile.get identity_r in I.remove identity id module Ext = struct let unlisten ?sitedata:_ state (key : A.key) = - let uc = Eliom_reference.Volatile.Ext.get state identity_r in + let uc = Reference.Volatile.Ext.get state identity_r in I.remove uc key end @@ -174,7 +174,7 @@ module Make (A : ARG) : match notfor with | Some `Me -> (*TODO: fails outside of a request*) - let notif_e = Eliom_reference.Volatile.get notif_e in + let notif_e = Reference.Volatile.get notif_e in notif == notif_e | Some (`Id id) -> identity = id | None -> false @@ -193,7 +193,7 @@ module Make (A : ARG) : I.iter f key let client_ev () = - let ev, _ = Eliom_reference.Volatile.get notif_e in + let ev, _ = Reference.Volatile.get notif_e in ev let clean () = diff --git a/src/lib/notif.server.mli b/src/lib/notif.server.mli index cb408d9aac..a1c8c8cba2 100644 --- a/src/lib/notif.server.mli +++ b/src/lib/notif.server.mli @@ -24,7 +24,7 @@ ~scope:Eliom_common.default_process_scope *) (* TODO: terminology: identity/client/user/listener *) -(** Signature of the functors [Eliom_notif.Make] and [Eliom_notif.Make_Simple]. +(** Signature of the functors [Notif.Make] and [Notif.Make_Simple]. [S] has two types of notifications ([server_notif] and [client_notif]) because we might need to serialise and deserialise the notification twice @@ -66,7 +66,7 @@ module type S = sig module Ext : sig val unlisten : ?sitedata:Eliom_common.sitedata - -> ([< `Client_process], [< `Data]) Eliom_state.Ext.state + -> ([< `Client_process], [< `Data]) State.Ext.state -> key -> unit (** Make a listener stop listening on data [key]. diff --git a/src/lib/parameter.client.ml b/src/lib/parameter.client.ml index 0b4d16be4e..4b9ed8788f 100644 --- a/src/lib/parameter.client.ml +++ b/src/lib/parameter.client.ml @@ -133,8 +133,8 @@ let get_non_localized_get_parameters {name; param; _} = Some (reconstruct_params_ param (try - Eliom_lib.String.Table.find name - (Eliom_request_info.get_sess_info ()).si_nl_get_params + Lib.String.Table.find name + (Request_info.get_sess_info ()).si_nl_get_params with Not_found -> []) [] false None) with Eliom_common.Eliom_Wrong_parameter | Not_found -> None diff --git a/src/lib/parameter.client.mli b/src/lib/parameter.client.mli index 9770933df8..3819e271f8 100644 --- a/src/lib/parameter.client.mli +++ b/src/lib/parameter.client.mli @@ -18,7 +18,7 @@ *) open Js_of_ocaml -include Eliom_parameter_sigs.S with type raw_post_data = unit +include Parameter_sigs.S with type raw_post_data = unit val user_type : of_string:(string -> 'a) diff --git a/src/lib/parameter.server.ml b/src/lib/parameter.server.ml index 61e2928f28..7de787c65c 100644 --- a/src/lib/parameter.server.ml +++ b/src/lib/parameter.server.ml @@ -17,10 +17,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -open Eliom_lib +open Lib include Eliom_parameter_base -type raw_post_data = Eliom_request_info.raw_post_data +type raw_post_data = Request_info.raw_post_data open Ocsigen_extensions diff --git a/src/lib/parameter.server.mli b/src/lib/parameter.server.mli index 8faa27d688..08b60e6712 100644 --- a/src/lib/parameter.server.mli +++ b/src/lib/parameter.server.mli @@ -18,7 +18,7 @@ *) include - Eliom_parameter_sigs.S + Parameter_sigs.S with type raw_post_data = ((string * string) * (string * string) list) option * Cohttp_lwt.Body.t diff --git a/src/lib/parameter_sigs.shared.mli b/src/lib/parameter_sigs.shared.mli index 32222c35df..e3a86d56d7 100644 --- a/src/lib/parameter_sigs.shared.mli +++ b/src/lib/parameter_sigs.shared.mli @@ -32,7 +32,7 @@ module type S = sig type ('a, +'b, 'c) params_type constraint 'b = [< suff] (** Abstract type for service parameters. See for example the - parameter [~get_param] of {!val:Eliom_service.Http.service}. + parameter [~get_param] of {!val:Service.Http.service}. - [ 'a] is the type for the OCaml type of the parameter as expected by the service handler. @@ -41,12 +41,12 @@ module type S = sig of the parameter: suffix or not. - [ 'c] is the type of the parameter name, usually an instance - of {!Eliom_parameter.param_name}, as used by forms + of {!Parameter.param_name}, as used by forms construction functions (e.g., the last parameter of - {!Eliom_content.Html.D.get_form}), and specialized form + {!Content.Html.D.get_form}), and specialized form widget (see for example the section - {{!section:Eliom_content.Html.D.form_widgets}Form widget} of - {!Eliom_content.HTML5.D}). ) *) + {{!section:Content.Html.D.form_widgets}Eliom_form widget} of + {!Content.HTML5.D}). ) *) (** {2 Typed parameter's name} *) @@ -125,9 +125,9 @@ module type S = sig val file : string - -> ( Eliom_lib.file_info + -> ( Lib.file_info , [`WithoutSuffix] - , [`One of Eliom_lib.file_info] param_name ) + , [`One of Lib.file_info] param_name ) params_type (** [file s] means that the service takes a file as the parameter named [s]. *) @@ -216,7 +216,7 @@ module type S = sig (** The service takes a list of parameters. The first parameter of this function is the name of the list. The service handler will receive a list of values. To create the form, an iterator of - type {!Eliom_parameter.listnames} is given to generate the name + type {!Parameter.listnames} is given to generate the name for each value. *) val suffix : @@ -354,7 +354,7 @@ module type S = sig type params = (string * Eliommod_parameters.param) list val construct_params : - params Eliom_lib.String.Table.t + params Lib.String.Table.t -> ('a, [< `WithSuffix | `WithoutSuffix], 'b) params_type -> 'a -> string list option * string @@ -362,13 +362,13 @@ module type S = sig val construct_params_string : params -> string val construct_params_list_raw : - params Eliom_lib.String.Table.t + params Lib.String.Table.t -> ('a, [< `WithSuffix | `WithoutSuffix], 'b) params_type -> 'a - -> string list option * params Eliom_lib.String.Table.t * params + -> string list option * params Lib.String.Table.t * params val construct_params_list : - params Eliom_lib.String.Table.t + params Lib.String.Table.t -> ('a, [< `WithSuffix | `WithoutSuffix], 'b) params_type -> 'a -> string list option * params @@ -377,9 +377,9 @@ module type S = sig sp:Eliom_common.server_params -> ('a, [< `WithSuffix | `WithoutSuffix], 'c) params_type -> (string * string) list Lwt.t option - -> (string * Eliom_lib.file_info) list Lwt.t option + -> (string * Lib.file_info) list Lwt.t option -> bool - -> Eliom_lib.Url.path option + -> Lib.Url.path option -> 'a Lwt.t val make_params_names : ('a, 'b, 'c) params_type -> bool * 'c @@ -393,11 +393,11 @@ module type S = sig -> ('a * 's, 'su, 'an * 'sn) params_type val remove_from_nlp : - (string * 'c) list Eliom_lib.String.Table.t + (string * 'c) list Lib.String.Table.t -> ('a, [< `WithSuffix | `WithoutSuffix], 'b) params_type - -> (string * 'c) list Eliom_lib.String.Table.t + -> (string * 'c) list Lib.String.Table.t - val table_of_nl_params_set : nl_params_set -> params Eliom_lib.String.Table.t + val table_of_nl_params_set : nl_params_set -> params Lib.String.Table.t val list_of_nl_params_set : nl_params_set -> params val string_of_nl_params_set : nl_params_set -> string val wrap_param_type : ('a, 'b, 'c) params_type -> ('a, 'b, 'c) params_type diff --git a/src/lib/reference.server.ml b/src/lib/reference.server.ml index 3abe2bfff1..3574f3545b 100644 --- a/src/lib/reference.server.ml +++ b/src/lib/reference.server.ml @@ -20,7 +20,7 @@ (*****************************************************************************) (** {2 Eliom references} *) -open Eliom_state +open State open Lwt.Infix module Ocsipersist = struct @@ -78,7 +78,7 @@ module Volatile = struct let get ((f, _, table) : _ eref) = match table with | Req key -> ( - let table = Eliom_request_info.get_request_cache () in + let table = Request_info.get_request_cache () in try Polytables.get ~table ~key with Not_found -> let value = f () in @@ -104,7 +104,7 @@ module Volatile = struct let set ((_, _, table) : _ eref) value = match table with | Req key -> - let table = Eliom_request_info.get_request_cache () in + let table = Request_info.get_request_cache () in Polytables.set ~table ~key ~value | Sit key -> let table = Eliom_common.((get_site_data ()).site_value_table) in @@ -118,7 +118,7 @@ module Volatile = struct let unset ((f, _, table) : _ eref) = match table with | Req key -> - let table = Eliom_request_info.get_request_cache () in + let table = Request_info.get_request_cache () in Polytables.remove ~table ~key | Sit key -> let table = Eliom_common.((get_site_data ()).site_value_table) in @@ -131,15 +131,13 @@ module Volatile = struct let get state (f, ext, table) = match table with | Vol t -> ( - try - Eliom_state.Ext.Low_level.get_volatile_data ~state - ~table:(Lazy.force t) + try State.Ext.Low_level.get_volatile_data ~state ~table:(Lazy.force t) with Not_found -> if ext then ( let value = f () in - Eliom_state.Ext.Low_level.set_volatile_data ~state - ~table:(Lazy.force t) value; + State.Ext.Low_level.set_volatile_data ~state ~table:(Lazy.force t) + value; value) else (* I don't want to run f in the wrong context -> I fail *) @@ -149,8 +147,8 @@ module Volatile = struct let set state (_, _, table) value = match table with | Vol t -> - Eliom_state.Ext.Low_level.set_volatile_data ~state - ~table:(Lazy.force t) value + State.Ext.Low_level.set_volatile_data ~state ~table:(Lazy.force t) + value | _ -> failwith "wrong eref for this function" let modify state eref f = set state eref (f (get state eref)) @@ -158,8 +156,7 @@ module Volatile = struct let unset state ((_, _, table) : _ eref) = match table with | Vol t -> - Eliom_state.Ext.Low_level.remove_volatile_data ~state - ~table:(Lazy.force t) + State.Ext.Low_level.remove_volatile_data ~state ~table:(Lazy.force t) | _ -> failwith "wrong eref for this function" end end @@ -244,43 +241,41 @@ let unset ((_, _, table) as eref) = module Ext = struct let get state ((f, ext, table) as r) = - let state = Eliom_state.Ext.untype_state state in + let state = State.Ext.untype_state state in match table with | Vol _ -> Lwt.return (Volatile.Ext.get state r) | Per t -> t >>= fun t -> Lwt.catch - (fun () -> - Eliom_state.Ext.Low_level.get_persistent_data ~state ~table:t) + (fun () -> State.Ext.Low_level.get_persistent_data ~state ~table:t) (function | Not_found -> if ext (* We can run the function from another state *) then let value = f () in - Eliom_state.Ext.Low_level.set_persistent_data ~state ~table:t - value + State.Ext.Low_level.set_persistent_data ~state ~table:t value >>= fun () -> Lwt.return value else Lwt.fail Eref_not_initialized | e -> Lwt.fail e) | _ -> failwith "wrong eref for this function" let set state ((_, _, table) as r) value = - let state = Eliom_state.Ext.untype_state state in + let state = State.Ext.untype_state state in match table with | Vol _ -> Lwt.return (Volatile.Ext.set state r value) | Per t -> t >>= fun t -> - Eliom_state.Ext.Low_level.set_persistent_data ~state ~table:t value + State.Ext.Low_level.set_persistent_data ~state ~table:t value | _ -> Lwt.fail (Failure "wrong eref for this function") let modify state eref f = get state eref >>= fun v -> set state eref (f v) let unset state ((_, _, table) as r) = - let state = Eliom_state.Ext.untype_state state in + let state = State.Ext.untype_state state in match table with | Vol _ -> Lwt.return (Volatile.Ext.unset state r) | Per t -> t >>= fun t -> - Eliom_state.Ext.Low_level.remove_persistent_data ~state ~table:t + State.Ext.Low_level.remove_persistent_data ~state ~table:t | _ -> failwith "wrong eref for this function" end diff --git a/src/lib/reference.server.mli b/src/lib/reference.server.mli index 850747d14f..4728521310 100644 --- a/src/lib/reference.server.mli +++ b/src/lib/reference.server.mli @@ -77,7 +77,7 @@ val eref : {!Eliom_common.Eliom_site_information_not_available}. If you are using static linking, you must delay the call to this function until the configuration file is read, using - {!Eliom_service.register_eliom_module}. Otherwise you will also + {!Service.register_eliom_module}. Otherwise you will also get this exception.} *) @@ -87,13 +87,13 @@ val eref_from_fun : -> ?persistent:string -> (unit -> 'a) -> 'a eref -(** The function [eref_from_fun] works like the above {!Eliom_reference.eref}, +(** The function [eref_from_fun] works like the above {!Reference.eref}, but instead of providing a value for the initial content, a function [f] for {e creating the initial content} is provided (cf. also {!Lazy.from_fun}). In each scope, the function [f] is called for creating the value of the - reference the first time the reference is read (by {!Eliom_reference.get}), - if the value has not been set explicitly before (by {!Eliom_reference.set}). + reference the first time the reference is read (by {!Reference.get}), + if the value has not been set explicitly before (by {!Reference.set}). *) val get : 'a eref -> 'a Lwt.t @@ -152,13 +152,13 @@ val unset : 'a eref -> unit Lwt.t (* That function introduces a Lwt cooperation point only for persistent references. *) -(** Same functions as in [Eliom_reference] but a non-Lwt interface +(** Same functions as in [Reference] but a non-Lwt interface for non-persistent Eliom references. *) module Volatile : sig type 'a eref = ('a, [`Volatile]) eref' (** The type of volatile Eliom references. - Note that [('a Eliom_reference.Volatile.eref :> 'a Eliom_reference.eref)], i.e. wherever you can use an ['a - Eliom_reference.eref] you can also use an ['a Eliom_reference.Volatile.eref :> 'a Eliom_reference.eref]. *) + Note that [('a Reference.Volatile.eref :> 'a Reference.eref)], i.e. wherever you can use an ['a + Reference.eref] you can also use an ['a Reference.Volatile.eref :> 'a Reference.eref]. *) val eref : scope:[< Eliom_common.all_scope] -> ?secure:bool -> 'a -> 'a eref @@ -177,14 +177,14 @@ module Volatile : sig (** This module allows access to volatile references for other groups, sessions, or client processes. Use it in conjunction with functions like - {!Eliom_state.Ext.iter_volatile_sub_states} + {!State.Ext.iter_volatile_sub_states} to get the sessions from a group (or the processes from a session). *) val get : ( [< `Session_group | `Session | `Client_process] , [< `Data] ) - Eliom_state.Ext.state + State.Ext.state -> 'a eref -> 'a (** get the value of a reference from outside the state. @@ -195,7 +195,7 @@ module Volatile : sig val set : ( [< `Session_group | `Session | `Client_process] , [< `Data] ) - Eliom_state.Ext.state + State.Ext.state -> 'a eref -> 'a -> unit @@ -203,7 +203,7 @@ module Volatile : sig val modify : ( [< `Session_group | `Session | `Client_process] , [< `Data] ) - Eliom_state.Ext.state + State.Ext.state -> 'a eref -> ('a -> 'a) -> unit @@ -212,7 +212,7 @@ module Volatile : sig val unset : ( [< `Session_group | `Session | `Client_process] , [< `Data] ) - Eliom_state.Ext.state + State.Ext.state -> 'a eref -> unit end @@ -221,14 +221,14 @@ end (** This module allows access to references for other groups, sessions, or client processes. Use it in conjunction with functions like - {!Eliom_state.Ext.iter_sub_states} + {!State.Ext.iter_sub_states} to get the sessions from a group (or the processes from a session). *) module Ext : sig val get : ( [< `Session_group | `Session | `Client_process] , [< `Data | `Pers] ) - Eliom_state.Ext.state + State.Ext.state -> 'a eref -> 'a Lwt.t (** get the value of a reference from outside the state. @@ -239,7 +239,7 @@ module Ext : sig val set : ( [< `Session_group | `Session | `Client_process] , [< `Data | `Pers] ) - Eliom_state.Ext.state + State.Ext.state -> 'a eref -> 'a -> unit Lwt.t @@ -247,7 +247,7 @@ module Ext : sig val modify : ( [< `Session_group | `Session | `Client_process] , [< `Data | `Pers] ) - Eliom_state.Ext.state + State.Ext.state -> 'a eref -> ('a -> 'a) -> unit Lwt.t @@ -256,7 +256,7 @@ module Ext : sig val unset : ( [< `Session_group | `Session | `Client_process] , [< `Data | `Pers] ) - Eliom_state.Ext.state + State.Ext.state -> 'a eref -> unit Lwt.t end diff --git a/src/lib/registration.client.ml b/src/lib/registration.client.ml index 76c8ce6591..01d70e770e 100644 --- a/src/lib/registration.client.ml +++ b/src/lib/registration.client.ml @@ -22,11 +22,11 @@ open Lwt.Syntax let section = Logs.Src.create "eliom:registration" module type Base = sig - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml end module Base = struct - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml end module Block5 = Base @@ -37,10 +37,10 @@ module String_redirection = Base module Streamlist = Base module Ocaml = struct - type 'a return = 'a Eliom_service.ocaml + type 'a return = 'a Service.ocaml end -type 'a kind = Eliom_service.result +type 'a kind = Service.result type browser_content = [`Browser] type 'a application_content = [`Appl of 'a] @@ -59,13 +59,13 @@ let typed_apply ~service f gp pp l l' suffix = (fun () -> let* g = let l = Some (Lwt.return l) in - Eliom_parameter.reconstruct_params ~sp:() gp l None true suffix + Parameter.reconstruct_params ~sp:() gp l None true suffix and* p = let l' = Some (Lwt.return l') in - Eliom_parameter.reconstruct_params ~sp:() pp l' None true suffix + Parameter.reconstruct_params ~sp:() pp l' None true suffix in - (match Eliom_service.reload_fun service with - | Some _ -> Eliom_client.set_reload_function (fun () () -> f g p) + (match Service.reload_fun service with + | Some _ -> Client.set_reload_function (fun () () -> f g p) | None -> ()); f g p) (function @@ -74,15 +74,15 @@ let typed_apply ~service f gp pp l l' suffix = | exc -> Lwt.reraise exc) let wrap service att f _ suffix = - let gp = Eliom_service.get_params_type service - and pp = Eliom_service.post_params_type service - and l = (Eliom_request_info.get_sess_info ()).si_all_get_but_nl + let gp = Service.get_params_type service + and pp = Service.post_params_type service + and l = (Request_info.get_sess_info ()).si_all_get_but_nl and l' = - match (Eliom_request_info.get_sess_info ()).si_all_post_params with + match (Request_info.get_sess_info ()).si_all_post_params with | Some l -> l | None -> [] in - match Eliom_service.get_name att with + match Service.get_name att with | Eliom_common.SAtt_named s | Eliom_common.SAtt_anon s -> ( try let eliom_name = List.assoc "__eliom__" l @@ -95,58 +95,56 @@ let wrap service att f _ suffix = | _ -> typed_apply ~service f gp pp l l' suffix let wrap_na - (service : (_, _, _, _, _, _, _, _, _, _, _) Eliom_service.t) + (service : (_, _, _, _, _, _, _, _, _, _, _) Service.t) _non_att f _ suffix = - let gp = Eliom_service.get_params_type service - and pp = Eliom_service.post_params_type service - and si = Eliom_request_info.get_sess_info () + let gp = Service.get_params_type service + and pp = Service.post_params_type service + and si = Request_info.get_sess_info () and filter l = fst Eliom_common.(split_prefix_param na_co_param_prefix l) in let l = filter si.si_all_get_but_nl and l' = match si.si_all_post_params with Some l -> filter l | None -> [] in typed_apply ~service f gp pp l l' suffix let register_att ~service ~att f = - let key_meth = Eliom_service.which_meth_untyped service - and gn = Eliom_service.get_name att - and pn = Eliom_service.post_name att - and priority = Eliom_service.priority att in - let sgpt = Eliom_service.get_params_type service - and sppt = Eliom_service.post_params_type service in - (match Eliom_service.timeout service with + let key_meth = Service.which_meth_untyped service + and gn = Service.get_name att + and pn = Service.post_name att + and priority = Service.priority att in + let sgpt = Service.get_params_type service + and sppt = Service.post_params_type service in + (match Service.timeout service with | None -> () | Some _ -> Logs.info ~src:section (fun fmt -> fmt "Service timeout ignored on the client")); let s_id = if gn = Eliom_common.SAtt_no || pn = Eliom_common.SAtt_no - then - Eliom_parameter.(anonymise_params_type sgpt, anonymise_params_type sppt) + then Parameter.(anonymise_params_type sgpt, anonymise_params_type sppt) else 0, 0 - and s_max_use = Eliom_service.max_use service + and s_max_use = Service.max_use service and s_expire = None and s_f = wrap service att f in - Eliom_route.add_service priority Eliom_route.global_tables - (Eliom_service.sub_path att) + Route.add_service priority Route.global_tables (Service.sub_path att) {Eliom_common.key_state = gn, pn; Eliom_common.key_meth :> Eliom_common.meth} {s_id; s_max_use; s_expire; s_f} let register_na ~service ~na f = - Eliom_route.add_naservice - Eliom_service.(na_name na) - (wrap_na service na f) Eliom_route.global_tables + Route.add_naservice + Service.(na_name na) + (wrap_na service na f) Route.global_tables let register (type g p att) - ~(service : (g, p, _, att, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (g, p, _, att, _, _, _, _, _, _, _) Service.t) (f : g -> p -> _) = - match Eliom_service.info service with - | Eliom_service.Attached att -> register_att ~service ~att f - | Eliom_service.Nonattached na -> register_na ~service ~na f + match Service.info service with + | Service.Attached att -> register_att ~service ~att f + | Service.Nonattached na -> register_na ~service ~na f module Make (P : PARAM) = struct type page = P.page @@ -167,7 +165,7 @@ module Make (P : PARAM) = struct ?headers:_ ?secure_session:_ (type g p att) - ~(service : (g, p, _, att, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (g, p, _, att, _, _, _, _, _, _, _) Service.t) ?error_handler:_ (f : g -> p -> _) = @@ -176,26 +174,26 @@ module Make (P : PARAM) = struct P.send ?options page in register ~service f; - Eliom_service.set_client_fun ?app ~service f; - if P.reset_reload_fun then Eliom_service.reset_reload_fun service + Service.set_client_fun ?app ~service f; + if P.reset_reload_fun then Service.reset_reload_fun service end module Html = Make (struct - type page = Html_types.html Eliom_content.Html.elt + type page = Html_types.html Content.Html.elt type options = unit - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml type result = browser_content kind let reset_reload_fun = false let send ?options:_ page = - Lwt.return (Eliom_service.Dom (Eliom_content.Html.To_dom.of_element page)) + Lwt.return (Service.Dom (Content.Html.To_dom.of_element page)) end) module Action = Make (struct type page = unit type options = [`Reload | `NoReload] - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml type result = browser_content kind let reset_reload_fun = true @@ -203,39 +201,37 @@ module Action = Make (struct let send ?options _page = match options with | Some `Reload | None -> - Lwt.return - Eliom_service.(Reload_action {hidden = false; https = false}) - | _ -> Lwt.return Eliom_service.No_contents + Lwt.return Service.(Reload_action {hidden = false; https = false}) + | _ -> Lwt.return Service.No_contents end) module Unit = Make (struct type page = unit type options = unit - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml type result = browser_content kind let reset_reload_fun = true - let send ?options:_ _page = Lwt.return Eliom_service.No_contents + let send ?options:_ _page = Lwt.return Service.No_contents end) type appl_service_options = {do_not_launch : bool} -module App (P : Eliom_registration_sigs.APP_PARAM) = struct +module App (P : Registration_sigs.APP_PARAM) = struct type app_id let application_name = P.application_name include Make (struct - type page = Html_types.html Eliom_content.Html.elt + type page = Html_types.html Content.Html.elt type options = appl_service_options - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml type result = browser_content kind let reset_reload_fun = false let send ?options:_ page = - Lwt.return - (Eliom_service.Dom (Eliom_content.Html.To_dom.of_element page)) + Lwt.return (Service.Dom (Content.Html.To_dom.of_element page)) end) end @@ -243,7 +239,7 @@ type 'a redirection = | Redirection : ( unit , unit - , Eliom_service.get + , Service.get , _ , _ , _ @@ -252,13 +248,13 @@ type 'a redirection = , unit , unit , 'a ) - Eliom_service.t + Service.t -> 'a redirection module Redirection = struct (* not really polymorphic; just adding a type variable to maintain type-level compatibility with server (for injections) *) - type _ page = Eliom_service.non_ocaml redirection + type _ page = Service.non_ocaml redirection type options = [ `MovedPermanently @@ -268,7 +264,7 @@ module Redirection = struct | `UseProxy | `TemporaryRedirect ] - type _ return = Eliom_service.non_ocaml + type _ return = Service.non_ocaml type _ result = browser_content kind let send @@ -279,7 +275,7 @@ module Redirection = struct ?headers:_ (Redirection service) = - Lwt.return (Eliom_service.Redirect service) + Lwt.return (Service.Redirect service) let register ?app @@ -291,7 +287,7 @@ module Redirection = struct ?headers:_ ?secure_session:_ (type g p att) - ~(service : (g, p, _, att, _, _, _, _, _, _, _) Eliom_service.t) + ~(service : (g, p, _, att, _, _, _, _, _, _, _) Service.t) ?error_handler:_ (f : g -> p -> _) = @@ -300,12 +296,12 @@ module Redirection = struct send ?options page in register ~service f; - Eliom_service.set_client_fun ?app ~service f + Service.set_client_fun ?app ~service f end module Any = struct type 'a page = 'a kind - type 'a return = Eliom_service.non_ocaml + type 'a return = Service.non_ocaml type 'a result = 'a kind type options = unit @@ -330,7 +326,7 @@ module Any = struct send page in register ~service f; - Eliom_service.set_client_fun ?app ~service f + Service.set_client_fun ?app ~service f end let appl_self_redirect f x = f x diff --git a/src/lib/registration.client.mli b/src/lib/registration.client.mli index 96eedce201..3bc2fc871a 100644 --- a/src/lib/registration.client.mli +++ b/src/lib/registration.client.mli @@ -20,7 +20,7 @@ (** Client-side service registration. The interface is meant to be compatible with server-side - {!Eliom_registration}. + <>. See {{!page-"clientserver-services"}the manual chapter on client-side services} for details. *) @@ -30,39 +30,39 @@ type browser_content = [`Browser] type 'a application_content = [`Appl of 'a] module Html : - Eliom_registration_sigs.S - with type page = Html_types.html Eliom_content.Html.elt + Registration_sigs.S + with type page = Html_types.html Content.Html.elt and type options = unit - and type return = Eliom_service.non_ocaml + and type return = Service.non_ocaml and type result = browser_content kind module Action : - Eliom_registration_sigs.S + Registration_sigs.S with type page = unit and type options = [`Reload | `NoReload] - and type return = Eliom_service.non_ocaml + and type return = Service.non_ocaml and type result = browser_content kind module Unit : - Eliom_registration_sigs.S + Registration_sigs.S with type page = unit and type options = unit - and type return = Eliom_service.non_ocaml + and type return = Service.non_ocaml and type result = browser_content kind type appl_service_options = {do_not_launch : bool} (** Has no effect on client; for compatibility with server *) -module App (_ : Eliom_registration_sigs.APP_PARAM) : sig +module App (_ : Registration_sigs.APP_PARAM) : sig val application_name : string type app_id include - Eliom_registration_sigs.S - with type page = Html_types.html Eliom_content.Html.elt + Registration_sigs.S + with type page = Html_types.html Content.Html.elt and type options = appl_service_options - and type return = Eliom_service.non_ocaml + and type return = Service.non_ocaml and type result = app_id application_content kind end @@ -70,7 +70,7 @@ type _ redirection = | Redirection : ( unit , unit - , Eliom_service.get + , Service.get , _ , _ , _ @@ -79,15 +79,15 @@ type _ redirection = , unit , unit , 'a ) - Eliom_service.t + Service.t -> 'a redirection (* [page] et al. are not really polymorphic. The type variables are necessary for maintaining type-level compatibility with server (for injections) *) module Redirection : - Eliom_registration_sigs.S_poly_with_send - with type 'a page = Eliom_service.non_ocaml redirection + Registration_sigs.S_poly_with_send + with type 'a page = Service.non_ocaml redirection and type options = [ `MovedPermanently | `Found @@ -95,14 +95,14 @@ module Redirection : | `NotNodifed | `UseProxy | `TemporaryRedirect ] - and type 'a return = Eliom_service.non_ocaml + and type 'a return = Service.non_ocaml and type 'a result = browser_content kind module Any : - Eliom_registration_sigs.S_poly_with_send + Registration_sigs.S_poly_with_send with type 'a page = 'a kind and type options = unit - and type 'a return = Eliom_service.non_ocaml + and type 'a return = Service.non_ocaml and type 'a result = 'a kind val appl_self_redirect : @@ -114,7 +114,7 @@ val appl_self_redirect : (**/**) module type Base = sig - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml end module Block5 : Base @@ -126,7 +126,7 @@ module String_redirection : Base module Streamlist : Base module Ocaml : sig - type 'a return = 'a Eliom_service.ocaml + type 'a return = 'a Service.ocaml end val section : Logs.src diff --git a/src/lib/registration.server.ml b/src/lib/registration.server.ml index 0e67dc3693..7e1de470ea 100644 --- a/src/lib/registration.server.ml +++ b/src/lib/registration.server.ml @@ -2,7 +2,7 @@ open Lwt.Syntax (* Ocsigen * http://www.ocsigen.org - * Module Eliom_registration + * Module Registration * Copyright (C) 2007 Vincent Balat * * This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ let headers_with_content_type ?charset ?content_type headers = String.sub content_type (String.length content_type - 4) 4 in suffix = "/xml" || suffix = "=xml") - then Some (Eliom_config.get_config_default_charset ()) + then Some (Config.get_config_default_charset ()) else None in Cohttp.Header.replace headers @@ -105,60 +105,58 @@ let content_type_html content_type = | Some content_type, _ -> content_type | None, None -> let accept = - Ocsigen_request.header_multi - (Eliom_request_info.get_ri ()) + Ocsigen_request.header_multi (Request_info.get_ri ()) Ocsigen_header.Name.accept in let accept = Ocsigen_header.Accept.parse accept in - Ocsigen_header.Content_type.choose accept - Eliom_content.Html.D.Info.content_type - Eliom_content.Html.D.Info.alternative_content_types + Ocsigen_header.Content_type.choose accept Content.Html.D.Info.content_type + Content.Html.D.Info.alternative_content_types module Html_base = struct - type page = Html_types.html Eliom_content.Html.elt + type page = Html_types.html Content.Html.elt type options = unit type result = browser_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XNever + let send_appl_content = Service.XNever let out = let encode x = fst (Xml_print.Utf8.normalize_html x) in - Eliom_content.Html.Printer.pp ~encode () + Content.Html.Printer.pp ~encode () let send ?options:_ ?charset ?code ?content_type ?headers c = - let status = Eliom_lib.Option.map Cohttp.Code.status_of_code code + let status = Lib.Option.map Cohttp.Code.status_of_code code and content_type = content_type_html content_type and body = Ocsigen_response.Body.of_string (Format.asprintf "%a" out c) in result_of_content ?charset ?headers ?status ~content_type body end -module Html = Eliom_mkreg.Make (Html_base) +module Html = Mkreg.Make (Html_base) module Flow5_base = struct type options = unit type result = block_content kind - type page = Html_types.flow5 Eliom_content.Html.elt list + type page = Html_types.flow5 Content.Html.elt list let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XNever + let send_appl_content = Service.XNever let out = let encode x = fst (Xml_print.Utf8.normalize_html x) in - Eliom_content.Html.Printer.pp_elt ~encode () + Content.Html.Printer.pp_elt ~encode () let body l = Ocsigen_response.Body.make Cohttp.Transfer.Unknown (fun write -> Lwt_list.iter_s (fun x -> write (Format.asprintf "%a" out x)) l) let send ?options:_ ?charset ?code ?content_type ?headers c = - let status = Eliom_lib.Option.map Cohttp.Code.status_of_code code + let status = Lib.Option.map Cohttp.Code.status_of_code code and content_type = content_type_html content_type and body = body c in result_of_content ?charset ?headers ?status ~content_type body end -module Flow5 = Eliom_mkreg.Make (Flow5_base) +module Flow5 = Mkreg.Make (Flow5_base) let add_cache_header cache headers = let ( <-< ) h (n, v) = @@ -178,16 +176,16 @@ module String_base = struct type result = unknown_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XNever + let send_appl_content = Service.XNever let send ?options ?charset ?code ?content_type:_ ?headers (c, content_type) = - let status = Eliom_lib.Option.map Cohttp.Code.status_of_code code + let status = Lib.Option.map Cohttp.Code.status_of_code code and body = Ocsigen_response.Body.of_string c and headers = add_cache_header options (Ocsigen_header.of_option headers) in result_of_content ?charset ?status ~content_type ~headers body end -module String = Eliom_mkreg.Make (String_base) +module String = Mkreg.Make (String_base) module CssText_base = struct type page = string @@ -195,14 +193,14 @@ module CssText_base = struct type result = browser_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XNever + let send_appl_content = Service.XNever let send ?options ?charset ?code ?content_type ?headers content = String_base.send ?options ?charset ?code ?content_type ?headers (content, "text/css") end -module CssText = Eliom_mkreg.Make (CssText_base) +module CssText = Mkreg.Make (CssText_base) module Html_text_base = struct type page = string @@ -210,13 +208,13 @@ module Html_text_base = struct type result = browser_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XNever + let send_appl_content = Service.XNever let send ?options:_ ?charset ?code ?content_type ?headers content = String_base.send ?charset ?code ?content_type ?headers (content, "text/html") end -module Html_text = Eliom_mkreg.Make (Html_text_base) +module Html_text = Mkreg.Make (Html_text_base) (** Actions are like services, but do not generate any page. The current page is reloaded (but if you give the optional parameter @@ -228,7 +226,7 @@ module Action_base = struct type result = browser_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XAlways + let send_appl_content = Service.XAlways (* The post action service will decide later *) let send_directly ri res = @@ -245,12 +243,12 @@ module Action_base = struct let send ?(options = `Reload) ?charset ?(code = 204) ?content_type ?headers () = - let user_cookies = Eliom_request_info.get_user_cookies () in + let user_cookies = Request_info.get_user_cookies () in match options with | `NoReload -> let headers = Ocsigen_header.of_option headers in let headers = - match Eliom_request_info.get_sp_client_appl_name () with + match Request_info.get_sp_client_appl_name () with | Some anr -> Cohttp.Header.replace headers Eliom_common_base.appl_name_header_name anr @@ -271,9 +269,9 @@ module Action_base = struct Be very careful while re-reading this. *) let sp = Eliom_common.get_sp () in - let sitedata = Eliom_request_info.get_sitedata_sp ~sp in - let si = Eliom_request_info.get_si sp in - let ri = Eliom_request_info.get_request_sp sp in + let sitedata = Request_info.get_sitedata_sp ~sp in + let si = Request_info.get_si sp in + let ri = Request_info.get_request_sp sp in let open Ocsigen_extensions in match ( si.Eliom_common.si_nonatt_info @@ -303,7 +301,7 @@ module Action_base = struct If the fallback service is not Eliom_app, they will be lost. *) - let rc = Eliom_request_info.get_request_cache_sp sp in + let rc = Request_info.get_request_cache_sp sp in Polytables.set ~table:rc ~key:Eliom_common.tab_cookie_action_info_key ~value: @@ -339,7 +337,7 @@ module Action_base = struct ~previous_cookies:all_new_cookies ri)) end -module Action = Eliom_mkreg.Make (Action_base) +module Action = Mkreg.Make (Action_base) (** Unit services are like services, do not generate any page, and do not reload the page. To be used carefully. Probably not useful at all. @@ -352,7 +350,7 @@ module Unit_base = struct type result = browser_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XAlways + let send_appl_content = Service.XAlways let send ?options:_ ?charset ?(code = 204) ?content_type ?headers _content = let status = Cohttp.Code.status_of_code code in @@ -360,17 +358,17 @@ module Unit_base = struct Ocsigen_response.Body.empty end -module Unit = Eliom_mkreg.Make (Unit_base) +module Unit = Mkreg.Make (Unit_base) (* Any is a module allowing to register services that decide themselves what they want to send. *) module Any_base = struct type 'a page = 'a kind type options = unit - type 'a return = Eliom_service.non_ocaml + type 'a return = Service.non_ocaml - (* let send_appl_content = Eliom_service.XNever *) - let send_appl_content = Eliom_service.XAlways + (* let send_appl_content = Service.XNever *) + let send_appl_content = Service.XAlways let send ?options:_ @@ -391,7 +389,7 @@ module Any_base = struct end module Any = struct - include Eliom_mkreg.Make_poly (Any_base) + include Mkreg.Make_poly (Any_base) type 'a result = 'a kind @@ -403,13 +401,13 @@ end type 'a application_name = string let appl_self_redirect send page = - if Eliom_request_info.expecting_process_page () + if Request_info.expecting_process_page () then let response = let headers = Cohttp.Header.(add (init ())) Eliom_common.half_xhr_redir_header - (Eliom_request_info.get_full_url ()) + (Request_info.get_full_url ()) in Cohttp.Response.make ~headers () in @@ -425,11 +423,11 @@ module File_base = struct type result = browser_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XNever + let send_appl_content = Service.XNever let send ?options ?charset ?code:_ ?content_type ?headers filename = let sp = Eliom_common.get_sp () in - let request = Eliom_request_info.get_request_sp sp in + let request = Request_info.get_request_sp sp in match try Ocsigen_local_files.resolve ~request ~filename () with @@ -456,11 +454,11 @@ module File_base = struct end module File = struct - include Eliom_mkreg.Make (File_base) + include Mkreg.Make (File_base) let check_file filename = let sp = Eliom_common.get_sp () in - let request = Eliom_request_info.get_request_sp sp in + let request = Request_info.get_request_sp sp in try ignore (Ocsigen_local_files.resolve ~request ~filename ()); true @@ -477,7 +475,7 @@ module File_ct_base = struct type result = browser_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XNever + let send_appl_content = Service.XNever let send ?options @@ -496,7 +494,7 @@ module File_ct_base = struct end module File_ct = struct - include Eliom_mkreg.Make (File_ct_base) + include Mkreg.Make (File_ct_base) let check_file = File.check_file end @@ -504,7 +502,7 @@ end (* FIXME COHTTP TRANSITION: Streamlist (temporarily?) removed *) module Customize - (R : Eliom_registration_sigs.S_with_create) + (R : Registration_sigs.S_with_create) (T : sig type page @@ -628,21 +626,21 @@ module Ocaml_base = struct type result = Ocsigen_response.t let result_of_http_result x = x - let send_appl_content = Eliom_service.XNever + let send_appl_content = Service.XNever let send ?options:_ ?charset ?code ?content_type ?headers content = Result_types.cast_kind_lwt (String.send ?charset ?code ?content_type ?headers - (content, Eliom_service.eliom_appl_answer_content_type)) + (content, Service.eliom_appl_answer_content_type)) end module Ocaml = struct type 'a page = 'a type options = unit - type 'a return = 'a Eliom_service.ocaml + type 'a return = 'a Service.ocaml type 'a result = 'a ocaml_content kind - module M = Eliom_mkreg.Make (Ocaml_base) + module M = Mkreg.Make (Ocaml_base) let prepare_data data = let ecs_request_data = @@ -676,7 +674,7 @@ module Ocaml = struct let code = Printf.sprintf "%06x" (Random.int 0x1000000) in let argument = let sp = Eliom_common.get_sp () in - let si = Eliom_request_info.get_si sp in + let si = Request_info.get_si sp in let post_params = match si.Eliom_common.si_all_post_params with | None -> [] @@ -722,19 +720,18 @@ module Ocaml = struct , _ , _ , _ - , Eliom_service.non_ext - , Eliom_service.reg + , Service.non_ext + , Service.reg , _ , _ , _ - , 'return Eliom_service.ocaml ) - Eliom_service.t) + , 'return Service.ocaml ) + Service.t) ?(error_handler : ((string * exn) list -> 'return Lwt.t) option) (f : 'get -> 'post -> 'return Lwt.t) = M.register ?app ?scope ?options ?charset ?code ?content_type ?headers - ?secure_session - ~service:(Eliom_service.untype service) + ?secure_session ~service:(Service.untype service) ?error_handler:(make_eh error_handler) (make_service_handler ~name:None f) @@ -759,7 +756,7 @@ module Ocaml = struct ?error_handler f = - Eliom_service.untype + Service.untype @@ M.create ?app ?scope ?options ?charset ?code ?content_type ?headers ?secure_session ?https ?name ?csrf_safe ?csrf_scope ?csrf_secure ?max_use ?timeout ~meth ~path ?error_handler:(make_eh error_handler) @@ -786,11 +783,10 @@ module Ocaml = struct ?error_handler f = - Eliom_service.untype + Service.untype @@ M.create_attached_get ?app ?scope ?options ?charset ?code ?content_type ?headers ?secure_session ?https ?name ?csrf_safe ?csrf_scope - ?csrf_secure ?max_use ?timeout - ~fallback:(Eliom_service.untype fallback) + ?csrf_secure ?max_use ?timeout ~fallback:(Service.untype fallback) ~get_params ?error_handler:(make_eh error_handler) (make_service_handler ~name f) @@ -815,11 +811,10 @@ module Ocaml = struct ?error_handler f = - Eliom_service.untype + Service.untype @@ M.create_attached_post ?app ?scope ?options ?charset ?code ?content_type ?headers ?secure_session ?https ?name ?csrf_safe ?csrf_scope - ?csrf_secure ?max_use ?timeout - ~fallback:(Eliom_service.untype fallback) + ?csrf_secure ?max_use ?timeout ~fallback:(Service.untype fallback) ~post_params ?error_handler:(make_eh error_handler) (make_service_handler ~name f) end @@ -829,13 +824,10 @@ type appl_service_options = {do_not_launch : bool} it is not already launched. Default: [false]. *) let default_appl_service_options = {do_not_launch = false} - -let request_template = - Eliom_reference.eref ~scope:Eliom_common.request_scope None +let request_template = Reference.eref ~scope:Eliom_common.request_scope None let global_data_unwrapper = - Eliom_wrap.create_unwrapper - (Eliom_wrap.id_of_int Eliom_runtime.global_data_unwrap_id_int) + Wrap.create_unwrapper (Wrap.id_of_int Eliom_runtime.global_data_unwrap_id_int) let get_global_data ~keep_debug = let data = Eliom_syntax.get_global_data () in @@ -843,7 +835,7 @@ let get_global_data ~keep_debug = if keep_debug then data else - Eliom_lib.String_map.map + Lib.String_map.map (fun {Eliom_runtime.server_sections_data; client_sections_data} -> Array.iter (Array.iter (fun d -> @@ -867,7 +859,7 @@ module type APP = sig ?defer:bool -> ?async:bool -> unit - -> [> `Script] Eliom_content.Html.elt + -> [> `Script] Content.Html.elt val wasm_detection_script : ?defer:bool @@ -875,19 +867,19 @@ module type APP = sig -> ?js_name:string -> ?wasm_name:string -> unit - -> [> `Script] Eliom_content.Html.elt + -> [> `Script] Content.Html.elt val application_name : string val is_initial_request : unit -> bool type app_id - type page = Html_types.html Eliom_content.Html.elt + type page = Html_types.html Content.Html.elt type options = appl_service_options - type return = Eliom_service.non_ocaml + type return = Service.non_ocaml type result = app_id application_content kind include - Eliom_registration_sigs.S_with_create + Registration_sigs.S_with_create with type page := page and type options := options and type return := return @@ -896,9 +888,9 @@ module type APP = sig val typed_name : app_id application_name end -module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct +module App_base (App_param : Registration_sigs.APP_PARAM) = struct type app_id - type page = Html_types.html Eliom_content.Html.elt + type page = Html_types.html Content.Html.elt type options = appl_service_options type result = app_id application_content kind @@ -909,15 +901,15 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct <> Some App_param.application_name let global_data_cache_options () = - (Eliom_request_info.get_sitedata ()).Eliom_common.cache_global_data + (Request_info.get_sitedata ()).Eliom_common.cache_global_data - let eliom_appl_script_id : [`Script] Eliom_content.Html.Id.id = - Eliom_content.Html.Id.new_elt_id ~global:true () + let eliom_appl_script_id : [`Script] Content.Html.Id.id = + Content.Html.Id.new_elt_id ~global:true () (* Generate an inline script for detecting and loading WASM/JS *) let wasm_detection_script ?defer ?async ?js_name ?wasm_name () = let defer', async' = - (Eliom_request_info.get_sitedata ()).Eliom_common.application_script + (Request_info.get_sitedata ()).Eliom_common.application_script in let defer = match defer with Some b -> b | None -> defer' in let async = match async with Some b -> b | None -> async' in @@ -936,25 +928,20 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct in (* Generate full URIs for both JS and WASM versions using make_uri *) let js_uri = - Eliom_content.Html.F.string_of_uri - (Eliom_content.Html.F.make_uri - ~service:(Eliom_service.static_dir ()) - [js_filename]) + Content.Html.F.string_of_uri + (Content.Html.F.make_uri ~service:(Service.static_dir ()) [js_filename]) in let wasm_uri = - Eliom_content.Html.F.string_of_uri - (Eliom_content.Html.F.make_uri - ~service:(Eliom_service.static_dir ()) - [wasm_filename]) + Content.Html.F.string_of_uri + (Content.Html.F.make_uri ~service:(Service.static_dir ()) [wasm_filename]) in let script_content = Printf.sprintf "(function() {\n\ var script = document.createElement('script');\n\ script.defer = %s;\n\ script.async = %s;\n\ \n\ if (window?.WebAssembly?.JSTag) {\n\ script.src = '%s';\n\ } else {\n\ script.src = '%s';\n\ }\n\ \n\ document.head.appendChild(script);\n})();" defer_str async_str wasm_uri js_uri in - Eliom_content.Html.Id.create_named_elt ~id:eliom_appl_script_id - (Eliom_content.Html.F.script - (Eliom_content.Html.F.cdata_script script_content)) + Content.Html.Id.create_named_elt ~id:eliom_appl_script_id + (Content.Html.F.script (Content.Html.F.cdata_script script_content)) let wasm_detection_script = (wasm_detection_script @@ -963,58 +950,56 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct -> ?js_name:_ -> ?wasm_name:_ -> _ - -> [`Script] Eliom_content.Html.elt + -> [`Script] Content.Html.elt :> ?defer:_ -> ?async:_ -> ?js_name:_ -> ?wasm_name:_ -> _ - -> [> `Script] Eliom_content.Html.elt) + -> [> `Script] Content.Html.elt) let js_only_application_script ?defer ?async () = let defer', async' = - (Eliom_request_info.get_sitedata ()).Eliom_common.application_script + (Request_info.get_sitedata ()).Eliom_common.application_script in let defer = match defer with Some b -> b | None -> defer' in let async = match async with Some b -> b | None -> async' in let a = - (if defer then [Eliom_content.Html.D.a_defer ()] else []) - @ if async then [Eliom_content.Html.D.a_async ()] else [] + (if defer then [Content.Html.D.a_defer ()] else []) + @ if async then [Content.Html.D.a_async ()] else [] in - Eliom_content.Html.Id.create_named_elt ~id:eliom_appl_script_id - (Eliom_content.Html.D.js_script ~a + Content.Html.Id.create_named_elt ~id:eliom_appl_script_id + (Content.Html.D.js_script ~a ~uri: - (Eliom_content.Html.F.make_uri - ~service:(Eliom_service.static_dir ()) + (Content.Html.F.make_uri ~service:(Service.static_dir ()) [App_param.application_name ^ ".js"]) ()) (* Automatically return WASM detection script or JS-only script based on config *) let application_script ?defer ?async () = - if (Eliom_request_info.get_sitedata ()).Eliom_common.enable_wasm + if (Request_info.get_sitedata ()).Eliom_common.enable_wasm then wasm_detection_script ?defer ?async () else js_only_application_script ?defer ?async () let application_script = (application_script - : ?defer:_ -> ?async:_ -> _ -> [`Script] Eliom_content.Html.elt - :> ?defer:_ -> ?async:_ -> _ -> [> `Script] Eliom_content.Html.elt) + : ?defer:_ -> ?async:_ -> _ -> [`Script] Content.Html.elt + :> ?defer:_ -> ?async:_ -> _ -> [> `Script] Content.Html.elt) let is_eliom_appl_script elt = - Eliom_content.Html.Id.have_id eliom_appl_script_id elt + Content.Html.Id.have_id eliom_appl_script_id elt - let eliom_appl_data_script_id = - Eliom_content.Html.Id.new_elt_id ~global:true () + let eliom_appl_data_script_id = Content.Html.Id.new_elt_id ~global:true () let make_eliom_appl_data_script ~sp = let script = Printf.sprintf "var __eliom_appl_sitedata = \'%s\';\nvar __eliom_appl_process_info = \'%s\'\nvar __eliom_request_data;\nvar __eliom_request_cookies;\nvar __eliom_request_template;\n" - (Eliom_lib.jsmarshal (Eliommod_cli.client_sitedata sp)) - (Eliom_lib.jsmarshal sp.Eliom_common.sp_client_process_info) + (Lib.jsmarshal (Eliommod_cli.client_sitedata sp)) + (Lib.jsmarshal sp.Eliom_common.sp_client_process_info) in Lwt.return - Eliom_content.Html.( + Content.Html.( Id.create_named_elt ~id:eliom_appl_data_script_id (F.script (F.cdata_script script))) @@ -1039,31 +1024,29 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct create cookies that needs to be sent along the page. Hence, cookies should be calculated after wrapping. *) let eliom_data = - Eliom_content.Xml.wrap - (Eliom_content.Html.D.toelt page) + Content.Xml.wrap + (Content.Html.D.toelt page) { Eliom_common.ejs_global_data ; ejs_request_data ; ejs_event_handler_table = - Eliom_content.Xml.make_event_handler_table - (Eliom_content.Html.D.toelt page) + Content.Xml.make_event_handler_table (Content.Html.D.toelt page) ; ejs_client_attrib_table = - Eliom_content.Xml.make_client_attrib_table - (Eliom_content.Html.D.toelt page) + Content.Xml.make_client_attrib_table (Content.Html.D.toelt page) ; ejs_sess_info = Eliommod_cli.client_si sp.Eliom_common.sp_si } in let* tab_cookies = Eliommod_cookies.compute_cookies_to_send sp.Eliom_common.sp_sitedata sp.Eliom_common.sp_tab_cookie_info sp.Eliom_common.sp_user_tab_cookies in - let* template = Eliom_reference.get request_template in + let* template = Reference.get request_template in let script = Printf.sprintf "__eliom_request_data = \'%s\';\n__eliom_request_cookies = \'%s\';\n__eliom_request_template = \'%s\';" - (Eliom_lib.jsmarshal eliom_data) - (Eliom_lib.jsmarshal tab_cookies) - (Eliom_lib.jsmarshal (template : string option)) + (Lib.jsmarshal eliom_data) + (Lib.jsmarshal tab_cookies) + (Lib.jsmarshal (template : string option)) in - Lwt.return Eliom_content.Html.(F.script (F.cdata_script script)) + Lwt.return Content.Html.(F.script (F.cdata_script script)) let global_data_service = lazy @@ -1074,15 +1057,15 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct in let global_data = get_global_data ~keep_debug:(Ocsigen_config.get_debugmode ()) - |> Eliom_wrap.wrap |> Eliom_lib.jsmarshal + |> Wrap.wrap |> Lib.jsmarshal in let script = Printf.sprintf "__eliom_global_data = \'%s\';" global_data in let name = Digest.to_hex (Digest.string global_data) ^ ".js" in String.create ~options:max_age - ~path:(Eliom_service.Path (path @ [name])) - ~meth:(Get Eliom_parameter.unit) + ~path:(Service.Path (path @ [name])) + ~meth:(Get Parameter.unit) (fun _ _ -> Lwt.return (script, "application/x-javascript"))) let add_eliom_global_data_script rem = @@ -1091,36 +1074,36 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct (* Using the async flag does not make sense here as we need to be sure that this is executed before the application script. *) let defer, _ = - (Eliom_request_info.get_sitedata ()).Eliom_common.application_script + (Request_info.get_sitedata ()).Eliom_common.application_script in let uri = - Eliom_content.Html.F.make_uri ~absolute:false + Content.Html.F.make_uri ~absolute:false ~service:(Lazy.force global_data_service) () in let a = - (if defer then [Eliom_content.Html.F.a_defer ()] else []) - @ [Eliom_content.Html.F.a_src @@ !transform_global_app_uri uri] + (if defer then [Content.Html.F.a_defer ()] else []) + @ [Content.Html.F.a_src @@ !transform_global_app_uri uri] in - Eliom_content.Html.F.script ~a (Eliom_content.Html.F.txt "") :: rem + Content.Html.F.script ~a (Content.Html.F.txt "") :: rem else rem let split_page page : - Html_types.html_attrib Eliom_content.Html.attrib list - * (Html_types.head_attrib Eliom_content.Html.attrib list - * Html_types.title Eliom_content.Html.elt - * Html_types.head_content_fun Eliom_content.Html.elt list) - * Html_types.body Eliom_content.Html.elt + Html_types.html_attrib Content.Html.attrib list + * (Html_types.head_attrib Content.Html.attrib list + * Html_types.title Content.Html.elt + * Html_types.head_content_fun Content.Html.elt list) + * Html_types.body Content.Html.elt = - match Eliom_content.Xml.content page with - | Eliom_content.Xml.Node (_, html_attribs, [head; body]) -> ( - match Eliom_content.Xml.content head with - | Eliom_content.Xml.Node (_, head_attribs, head_elts) -> - ( List.map Eliom_content.Html.D.to_attrib html_attribs - , ( List.map Eliom_content.Html.D.to_attrib head_attribs - , Eliom_content.Html.D.tot (List.hd head_elts) - , Eliom_content.Html.D.totl (List.tl head_elts) ) - , Eliom_content.Html.D.tot body ) + match Content.Xml.content page with + | Content.Xml.Node (_, html_attribs, [head; body]) -> ( + match Content.Xml.content head with + | Content.Xml.Node (_, head_attribs, head_elts) -> + ( List.map Content.Html.D.to_attrib html_attribs + , ( List.map Content.Html.D.to_attrib head_attribs + , Content.Html.D.tot (List.hd head_elts) + , Content.Html.D.totl (List.tl head_elts) ) + , Content.Html.D.tot body ) | _ -> assert false) | _ -> assert false @@ -1128,15 +1111,14 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct let* appl_data_script = make_eliom_appl_data_script ~sp in (* First we build a fake page to build the ref_tree... *) let html_attribs, (head_attribs, title, head_elts), body = - split_page (Eliom_content.Html.D.toelt page) + split_page (Content.Html.D.toelt page) in - let encode_slashs = List.map (Eliom_lib.Url.encode ~plus:false) in + let encode_slashs = List.map (Lib.Url.encode ~plus:false) in let base_url = Eliom_uri.make_proto_prefix - (Eliom_config.default_protocol_is_https () - || Eliom_request_info.get_csp_ssl_sp sp) - ^ Eliom_lib.String.concat "/" - (encode_slashs (Eliom_request_info.get_csp_original_full_path ())) + (Config.default_protocol_is_https () || Request_info.get_csp_ssl_sp sp) + ^ Lib.String.concat "/" + (encode_slashs (Request_info.get_csp_original_full_path ())) in let head_elts = if List.exists is_eliom_appl_script head_elts @@ -1154,20 +1136,20 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct to make it possible to have truly relative URLs in HTML pages. *) :: - (if Eliom_request_info.expecting_process_page () + (if Request_info.expecting_process_page () then - Eliom_content.Html.( + Content.Html.( F.base ~a: [ F.a_id Eliom_common_base.base_elt_id - ; F.a_href (Eliom_content.Xml.uri_of_string base_url) ] + ; F.a_href (Content.Xml.uri_of_string base_url) ] ()) :: head_elts else head_elts) in let fake_page = - Eliom_content.Html.F.html ~a:html_attribs - (Eliom_content.Html.F.head ~a:head_attribs title head_elts) + Content.Html.F.html ~a:html_attribs + (Content.Html.F.head ~a:head_attribs title head_elts) body in let* data_script = @@ -1183,28 +1165,27 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct :: add_eliom_global_data_script (List.tl head_elts) in Lwt.return - (Eliom_content.Html.F.html ~a:html_attribs - (Eliom_content.Html.F.head ~a:head_attribs title head_elts) + (Content.Html.F.html ~a:html_attribs + (Content.Html.F.head ~a:head_attribs title head_elts) body) let remove_eliom_scripts page = let html_attribs, (head_attribs, title, head_elts), body = - split_page (Eliom_content.Html.D.toelt page) + split_page (Content.Html.D.toelt page) in let head_elts = List.filter (fun x -> not (is_eliom_appl_script x)) head_elts in Lwt.return - (Eliom_content.Html.F.html ~a:html_attribs - (Eliom_content.Html.F.head ~a:head_attribs title head_elts) + (Content.Html.F.html ~a:html_attribs + (Content.Html.F.head ~a:head_attribs title head_elts) body) - let send_appl_content = - Eliom_service.XSame_appl (App_param.application_name, None) + let send_appl_content = Service.XSame_appl (App_param.application_name, None) let out = let encode x = fst (Xml_print.Utf8.normalize_html x) in - Eliom_content.Html.Printer.pp ~encode () + Content.Html.Printer.pp ~encode () let send ?(options = default_appl_service_options) @@ -1219,7 +1200,7 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct renvoyer un full_redirect... TODO *) if sp.Eliom_common.sp_client_appl_name <> Some App_param.application_name then - Eliom_state.set_cookie ~cookie_level:`Client_process + State.set_cookie ~cookie_level:`Client_process ~name:Eliom_common.appl_name_cookie_name ~value:App_param.application_name (); let* body = @@ -1238,16 +1219,16 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct try (* If it is a suffix service with redirection, we may have to normalize the uri *) - let table = Eliom_request_info.get_request_cache () in + let table = Request_info.get_request_cache () in Cohttp.Header.replace h Eliom_common_base.response_url_header - (Polytables.get ~table ~key:Eliom_mkreg.suffix_redir_uri_key) + (Polytables.get ~table ~key:Mkreg.suffix_redir_uri_key) with Not_found -> h - and status = Eliom_lib.Option.map Cohttp.Code.status_of_code code + and status = Lib.Option.map Cohttp.Code.status_of_code code and content_type = content_type_html content_type in result_of_content ?charset ?status ~content_type ~headers body end -module App (App_param : Eliom_registration_sigs.APP_PARAM) = struct +module App (App_param : Registration_sigs.APP_PARAM) = struct module Base = App_base (App_param) type app_id = Base.app_id @@ -1256,7 +1237,7 @@ module App (App_param : Eliom_registration_sigs.APP_PARAM) = struct let application_script = Base.application_script let wasm_detection_script = Base.wasm_detection_script - include Eliom_mkreg.Make (Base) + include Mkreg.Make (Base) let application_name = App_param.application_name let typed_name = App_param.application_name @@ -1268,8 +1249,8 @@ module App (App_param : Eliom_registration_sigs.APP_PARAM) = struct match App_param.global_data_path with | Some global_data_path -> ignore - @@ Ocaml.create ~path:(Eliom_service.Path global_data_path) - ~meth:(Get Eliom_parameter.unit) ~https:true data_service_handler + @@ Ocaml.create ~path:(Service.Path global_data_path) + ~meth:(Get Parameter.unit) ~https:true data_service_handler | None -> () end @@ -1277,7 +1258,7 @@ module type TMPL_PARAMS = sig type t val name : string - val make_page : t -> Html_types.html Eliom_content.Html.elt Lwt.t + val make_page : t -> Html_types.html Content.Html.elt Lwt.t val update : t -> unit Eliom_client_value.t end @@ -1290,12 +1271,11 @@ struct let result_of_http_result = Result_types.cast_result let send_appl_content = - Eliom_service.XSame_appl (Appl.application_name, Some Tmpl_param.name) + Service.XSame_appl (Appl.application_name, Some Tmpl_param.name) let nl_template = - Eliom_parameter.make_non_localized_parameters ~prefix:"eliom" - ~name:"template" - (Eliom_parameter.string "name") + Parameter.make_non_localized_parameters ~prefix:"eliom" ~name:"template" + (Parameter.string "name") let send ?(options = default_appl_service_options) @@ -1305,9 +1285,9 @@ struct ?headers content = - match Eliom_parameter.get_non_localized_get_parameters nl_template with + match Parameter.get_non_localized_get_parameters nl_template with | None -> - let* () = Eliom_reference.set request_template (Some Tmpl_param.name) in + let* () = Reference.set request_template (Some Tmpl_param.name) in let* content = Tmpl_param.make_page content in Result_types.cast_kind_lwt (Appl.send ~options ?charset ?code ?content_type ?headers content) @@ -1318,7 +1298,7 @@ struct end module Eliom_tmpl (App : APP) (Tmpl_param : TMPL_PARAMS) = - Eliom_mkreg.Make (Eliom_tmpl_reg_make_param (App) (Tmpl_param)) + Mkreg.Make (Eliom_tmpl_reg_make_param (App) (Tmpl_param)) type redirection_options = [ `MovedPermanently @@ -1352,12 +1332,12 @@ let status_of_redirection_options options code = Here redirections are done towards services without parameters. (possibly preapplied). *) module String_redirection_base = struct - type page = Eliom_lib.Url.uri + type page = Lib.Url.uri type options = redirection_options type result = browser_content kind let result_of_http_result = Result_types.cast_result - let send_appl_content = Eliom_service.XAlways + let send_appl_content = Service.XAlways (* actually, the service will decide itself *) let send ?(options = `Found) ?charset ?code ?content_type ?headers uri = @@ -1367,7 +1347,7 @@ module String_redirection_base = struct XHR done by a client side Eliom program expecting a process page, we do not send an HTTP redirection. In that case, we send a half XHR redirection. *) - if not (Eliom_request_info.expecting_process_page ()) + if not (Request_info.expecting_process_page ()) then (* the browser did not ask application eliom data, we send a regular redirection *) @@ -1380,13 +1360,13 @@ module String_redirection_base = struct Ocsigen_response.Body.empty end -module String_redirection = Eliom_mkreg.Make (String_redirection_base) +module String_redirection = Mkreg.Make (String_redirection_base) type _ redirection = | Redirection : ( unit , unit - , Eliom_service.get + , Service.get , _ , _ , _ @@ -1395,7 +1375,7 @@ type _ redirection = , unit , unit , 'a ) - Eliom_service.t + Service.t -> 'a redirection module Redirection_base = struct @@ -1403,7 +1383,7 @@ module Redirection_base = struct type options = redirection_options type 'a return = 'a - let send_appl_content = Eliom_service.XAlways + let send_appl_content = Service.XAlways (* actually, the service will decide itself *) let send @@ -1430,8 +1410,8 @@ module Redirection_base = struct - a half xhr redirection otherwise (i.e. ask the browser to do an actual redirection). *) match - ( Eliom_request_info.expecting_process_page () - , Eliom_request_info.get_sp_client_appl_name () ) + ( Request_info.expecting_process_page () + , Request_info.get_sp_client_appl_name () ) with | true, None (* should not happen *) | false, _ -> (* the browser did not ask for process data,we @@ -1451,13 +1431,13 @@ module Redirection_base = struct in let headers = Cohttp.Header.replace headers - (match Eliom_service.send_appl_content service with + (match Service.send_appl_content service with (* the appl name of the destination service *) - | Eliom_service.XSame_appl (an, _) when an = anr -> + | Service.XSame_appl (an, _) when an = anr -> (* Same appl, we do a full XHR redirection (not an HTTP redirection, because we want to send back tab cookies) *) Eliom_common.full_xhr_redir_header - | Eliom_service.XAlways -> + | Service.XAlways -> (* It is probably an action, or a void coservice. Full XHR again *) Eliom_common.full_xhr_redir_header @@ -1472,7 +1452,7 @@ module Redirection_base = struct end module Redirection = struct - include Eliom_mkreg.Make_poly (Redirection_base) + include Mkreg.Make_poly (Redirection_base) let send ?options ?charset ?code ?content_type ?headers content = Result_types.cast_result_lwt @@ -1481,6 +1461,5 @@ module Redirection = struct end let set_exn_handler h = - let sitedata = Eliom_request_info.find_sitedata "set_exn_handler" in - Eliom_request_info.set_site_handler sitedata - (Result_types.cast_function_http h) + let sitedata = Request_info.find_sitedata "set_exn_handler" in + Request_info.set_site_handler sitedata (Result_types.cast_function_http h) diff --git a/src/lib/registration.server.mli b/src/lib/registration.server.mli index ca009faf66..b9e06f3122 100644 --- a/src/lib/registration.server.mli +++ b/src/lib/registration.server.mli @@ -1,6 +1,6 @@ (* Ocsigen * http://www.ocsigen.org - * Module Eliom_registration + * Module Registration * Copyright (C) 2007 Vincent Balat * * This program is free software; you can redistribute it and/or modify @@ -38,13 +38,13 @@ type 'a kind {- {!unknown_content}} {- {!ocaml_content}}} *) -(** {3 Return types for {!type:Eliom_service.service} } +(** {3 Return types for {!type:Service.service} } {4 Classical content} *) type browser_content = [`Browser] (** The type [browser_content] is to be used as a phantom type - parameter for {!Eliom_registration.kind}. It means the returned + parameter for {!Registration.kind}. It means the returned content must be interpreted in the browser as stated by the content-type header. This is most common return type for an eliom service, see for example {!Html}, {!CssText}, {!File}, @@ -52,13 +52,13 @@ type browser_content = [`Browser] type block_content (** The type [block_content] is to be used as a phantom type parameter - for {!Eliom_registration.kind}. It means the returned content is a + for {!Registration.kind}. It means the returned content is a subtree of an XML value. See for example {!Block5} or {!Make_typed_xml_registration}. *) type unknown_content (** The type [unknown_content] is to be used as a phantom type - parameter for {!Eliom_registration.kind} when the content-type + parameter for {!Registration.kind} when the content-type can't be determined statically. See {!Text} or {!Any}. *) (** {4 Application content} *) @@ -66,7 +66,7 @@ type unknown_content type 'a application_content = [`Appl of 'a] (** The type [application_content] is a refinement of {!appl_service} to be used as a phantom type parameters for - {!Eliom_registration.kind}. The parameter ['a] is phantom type + {!Registration.kind}. The parameter ['a] is phantom type that is unique for a given application. *) type 'a application_name @@ -76,18 +76,18 @@ type 'a application_name type 'a ocaml_content (** The type [ocaml_content] is an synomyn for - {!Eliom_service.ocaml_service} to be used as a phantom type - parameters for {!Eliom_registration.kind}. See {!Ocaml}. *) + {!Service.ocaml_service} to be used as a phantom type + parameters for {!Registration.kind}. See {!Ocaml}. *) (** {2 Using HTML with services } *) (** Eliom service registration for services that return HTML pages. *) module Html : - Eliom_registration_sigs.S_with_create - with type page = Html_types.html Eliom_content.Html.elt + Registration_sigs.S_with_create + with type page = Html_types.html Content.Html.elt and type options = unit - and type return = Eliom_service.non_ocaml + and type return = Service.non_ocaml and type result = browser_content kind (** {2 Eliom client/server applications} *) @@ -111,7 +111,7 @@ module type APP = sig ?defer:bool -> ?async:bool -> unit - -> [> `Script] Eliom_content.Html.elt + -> [> `Script] Content.Html.elt (** The function [application_name ()] returns a [