]> granicus.if.org Git - icu/commitdiff
ICU-12766 z: library and tools build: C linkage for makeconv/pluggable malloc
authorSteven R. Loomis <srl@icu-project.org>
Tue, 14 Feb 2017 01:22:12 +0000 (01:22 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Tue, 14 Feb 2017 01:22:12 +0000 (01:22 +0000)
X-SVN-Rev: 39672

icu4c/source/common/unicode/uclean.h
icu4c/source/tools/makeconv/genmbcs.cpp
icu4c/source/tools/makeconv/makeconv.h

index 8aefee45821f114bb85c09da017880620eb8a5d9..5beb1f7c37af8ec30ae49b181aac9cb24c5aba9e 100644 (file)
@@ -101,7 +101,7 @@ u_init(UErrorCode *status);
 U_STABLE void U_EXPORT2 
 u_cleanup(void);
 
-
+U_CDECL_BEGIN
 /**
   *  Pointer type for a user supplied memory allocation function.
   *  @param context user supplied value, obtained from from u_setMemoryFunctions().
@@ -149,9 +149,10 @@ typedef void  U_CALLCONV UMemFreeFn (const void *context, void *mem);
  *  @system
  */  
 U_STABLE void U_EXPORT2 
-u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMemFreeFn *f, 
+u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV a, UMemReallocFn * U_CALLCONV r, UMemFreeFn * U_CALLCONV f, 
                     UErrorCode *status);
 
+U_CDECL_END
 
 #ifndef U_HIDE_DEPRECATED_API
 /*********************************************************************************
@@ -172,6 +173,7 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem
   */
 typedef void *UMTX;
 
+U_CDECL_BEGIN
 /**
   *  Function Pointer type for a user supplied mutex initialization function.
   *  The user-supplied function will be called by ICU whenever ICU needs to create a
@@ -201,7 +203,7 @@ typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX  *mutex, UErrorCod
   *  @system
   */
 typedef void U_CALLCONV UMtxFn   (const void *context, UMTX  *mutex);
-
+U_CDECL_END
 
 /**
   *  Set the functions that ICU will use for mutex operations
index 8f4a7247623d501aa1f290a8098c19e54a84c209..79f185fe0e04b4670e4d8882d8b3e0b1382e39b3 100644 (file)
@@ -64,6 +64,7 @@ struct MBCSData {
 };
 
 /* prototypes */
+U_CDECL_BEGIN
 static void
 MBCSClose(NewConverter *cnvData);
 
@@ -101,6 +102,7 @@ MBCSAddTable(NewConverter *cnvData, UCMTable *table, UConverterStaticData *stati
 static uint32_t
 MBCSWrite(NewConverter *cnvData, const UConverterStaticData *staticData,
           UNewDataMemory *pData, int32_t tableType);
+U_CDECL_END
 
 /* helper ------------------------------------------------------------------- */
 
@@ -127,6 +129,7 @@ printBytes(char *buffer, const uint8_t *bytes, int32_t length) {
 
 static MBCSData gDummy;
 
+
 U_CFUNC const MBCSData *
 MBCSGetDummy() {
     uprv_memset(&gDummy, 0, sizeof(MBCSData));
@@ -160,7 +163,7 @@ MBCSInit(MBCSData *mbcsData, UCMFile *ucm) {
     mbcsData->newConverter.write=MBCSWrite;
 }
 
-NewConverter *
+U_CFUNC NewConverter *
 MBCSOpen(UCMFile *ucm) {
     MBCSData *mbcsData=(MBCSData *)uprv_malloc(sizeof(MBCSData));
     if(mbcsData==NULL) {
@@ -178,6 +181,7 @@ MBCSDestruct(MBCSData *mbcsData) {
     uprv_free(mbcsData->fromUBytes);
 }
 
+U_CDECL_BEGIN
 static void
 MBCSClose(NewConverter *cnvData) {
     MBCSData *mbcsData=(MBCSData *)cnvData;
@@ -186,6 +190,7 @@ MBCSClose(NewConverter *cnvData) {
         uprv_free(mbcsData);
     }
 }
+U_CDECL_END
 
 static UBool
 MBCSStartMappings(MBCSData *mbcsData) {
@@ -546,6 +551,7 @@ MBCSAddToUnicode(MBCSData *mbcsData,
     }
 }
 
+U_CDECL_BEGIN
 /* is this byte sequence valid? (this is almost the same as MBCSAddToUnicode()) */
 static UBool
 MBCSIsValid(NewConverter *cnvData,
@@ -554,7 +560,7 @@ MBCSIsValid(NewConverter *cnvData,
 
     return (UBool)(1==ucm_countChars(&mbcsData->ucm->states, bytes, length));
 }
-
+U_CDECL_END
 static UBool
 MBCSSingleAddFromUnicode(MBCSData *mbcsData,
                          const uint8_t *bytes, int32_t /*length*/,
@@ -936,6 +942,7 @@ MBCSOkForBaseFromUnicode(const MBCSData *mbcsData,
     return TRUE;
 }
 
+U_CDECL_BEGIN
 /* we can assume that the table only contains 1:1 mappings with <=4 bytes each */
 static UBool
 MBCSAddTable(NewConverter *cnvData, UCMTable *table, UConverterStaticData *staticData) {
@@ -1071,7 +1078,7 @@ MBCSAddTable(NewConverter *cnvData, UCMTable *table, UConverterStaticData *stati
 
     return isOK;
 }
-
+U_CDECL_END
 static UBool
 transformEUC(MBCSData *mbcsData) {
     uint8_t *p8;
@@ -1410,6 +1417,7 @@ MBCSPostprocess(MBCSData *mbcsData, const UConverterStaticData * /*staticData*/)
     }
 }
 
+U_CDECL_BEGIN
 static uint32_t
 MBCSWrite(NewConverter *cnvData, const UConverterStaticData *staticData,
           UNewDataMemory *pData, int32_t tableType) {
@@ -1564,3 +1572,4 @@ MBCSWrite(NewConverter *cnvData, const UConverterStaticData *staticData,
     /* return the number of bytes that should have been written */
     return top;
 }
+U_CDECL_END
index 6d63b21d1dcfa27109de278f32874cd144f98673..e17439348f376555700626da6aca3638d464294a 100644 (file)
@@ -41,21 +41,22 @@ enum {
 struct NewConverter;
 typedef struct NewConverter NewConverter;
 
+U_CDECL_BEGIN
 struct NewConverter {
     void
-    (*close)(NewConverter *cnvData);
+    (* U_CALLCONV close)(NewConverter *cnvData);
 
     /** is this byte sequence valid? */
     UBool
-    (*isValid)(NewConverter *cnvData,
+    (* U_CALLCONV isValid)(NewConverter *cnvData,
                const uint8_t *bytes, int32_t length);
 
     UBool
-    (*addTable)(NewConverter *cnvData, UCMTable *table, UConverterStaticData *staticData);
+    (* U_CALLCONV addTable)(NewConverter *cnvData, UCMTable *table, UConverterStaticData *staticData);
 
     uint32_t
-    (*write)(NewConverter *cnvData, const UConverterStaticData *staticData,
+    (* U_CALLCONV write)(NewConverter *cnvData, const UConverterStaticData *staticData,
              UNewDataMemory *pData, int32_t tableType);
 };
-
+U_CDECL_END
 #endif /* __MAKECONV_H__ */