mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-5118 Local Service Hook
X-SVN-Rev: 19782
This commit is contained in:
parent
c2804f52e4
commit
144e4c137c
3 changed files with 48 additions and 3 deletions
icu4c/source/common
|
@ -19,8 +19,12 @@ include $(top_builddir)/icudefs.mk
|
|||
## Build directory information
|
||||
subdir = common
|
||||
|
||||
# for service hook
|
||||
LOCALSVC_CPP=localsvc.cpp
|
||||
SVC_HOOK_INC=$(top_builddir)/common/svchook.mk
|
||||
|
||||
## Extra files to remove for 'make clean'
|
||||
CLEANFILES = *~ $(DEPS) $(IMPORT_LIB) $(MIDDLE_IMPORT_LIB) $(FINAL_IMPORT_LIB)
|
||||
CLEANFILES = *~ $(DEPS) $(IMPORT_LIB) $(MIDDLE_IMPORT_LIB) $(FINAL_IMPORT_LIB) $(SVC_HOOK_INC)
|
||||
|
||||
## Target information
|
||||
|
||||
|
@ -90,6 +94,9 @@ DEPS = $(OBJECTS:.o=.d)
|
|||
|
||||
-include Makefile.local
|
||||
|
||||
-include $(SVC_HOOK_INC)
|
||||
|
||||
|
||||
## List of phony targets
|
||||
.PHONY : all all-local install install-local clean clean-local \
|
||||
distclean distclean-local install-library install-headers dist \
|
||||
|
@ -134,6 +141,14 @@ ifneq ($(MIDDLE_IMPORT_LIB),$(FINAL_IMPORT_LIB))
|
|||
endif
|
||||
endif
|
||||
|
||||
$(SVC_HOOK_INC):
|
||||
@echo generating $@
|
||||
@-test -f $(top_srcdir)/common/$(LOCALSVC_CPP) && ( echo "have $(LOCALSVC_CPP) - U_LOCAL_SERVICE_HOOK=1" ; \
|
||||
echo 'CPPFLAGS +=-DU_LOCAL_SERVICE_HOOK=1' > $@ ; \
|
||||
echo 'OBJECTS += $(LOCALSVC_CPP:%.cpp=%.o)' >> $@ \
|
||||
) ; true
|
||||
@echo "# Autogenerated by Makefile" >> $@
|
||||
|
||||
install-headers:
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(includedir)/unicode
|
||||
@for file in $(HEADERS); do \
|
||||
|
@ -148,11 +163,11 @@ clean-local:
|
|||
$(RMV) $(OBJECTS) $(STATIC_OBJECTS) $(ALL_TARGETS) $(SO_VERSION_DATA)
|
||||
|
||||
distclean-local: clean-local
|
||||
$(RMV) Makefile icucfg.h unicode/platform.h
|
||||
$(RMV) Makefile icucfg.h unicode/platform.h $(SVC_HOOK_INC)
|
||||
|
||||
check-local:
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(SVC_HOOK_INC)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
|
25
icu4c/source/common/localsvc.h
Normal file
25
icu4c/source/common/localsvc.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
***************************************************************************
|
||||
* Copyright (C) 2006 International Business Machines Corporation *
|
||||
* and others. All rights reserved. *
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef LOCALSVC_H
|
||||
#define LOCALSVC_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if U_LOCAL_SERVICE_HOOK
|
||||
/**
|
||||
* Prototype for user-supplied service hook. This function is expected to return
|
||||
* a type of factory object specific to the requested service.
|
||||
*
|
||||
* @param what service-specific string identifying the specific user hook
|
||||
* @param status error status
|
||||
* @return a service-specific hook, or NULL on failure.
|
||||
*/
|
||||
U_CAPI void* uprv_svc_hook(const char *what, UErrorCode *status);
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -30,6 +30,11 @@
|
|||
#include "uassert.h"
|
||||
#include "uvector.h"
|
||||
|
||||
// if U_LOCAL_SERVICE_HOOK is defined, then localsvc.cpp is expected to be included.
|
||||
#if U_LOCAL_SERVICE_HOOK
|
||||
#include "localsvc.h"
|
||||
#endif
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue