summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-19 15:30:46 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-19 15:30:46 +0000
commit8d94751a807c93fe8f2338f941c5d360aa6402f4 (patch)
treed2b3708c82209faf88c6773952a35376faeaa192
parent5999efa3acaaa27764e5899a4329ecc50d4b4c7f (diff)
downloadiconv-8d94751a807c93fe8f2338f941c5d360aa6402f4.tar.gz
iconv-8d94751a807c93fe8f2338f941c5d360aa6402f4.tar.bz2
Move the declarations of iconv_initialise/iconv_finalise to a different header.
This keeps the public iconv.h free of such nonsense. Move the source for the RISC OS stubs to the distribution template tree. We will no longer shipped compiled stubs. People are quite capable of compiling this themselves. Also take the opportunity to tidy it up a bit. Bump the version number to 0.09 Introduce a "riscos-dist" target in Makefile-riscos. Update various bits of documentation. svn path=/trunk/iconv/; revision=5734
-rw-r--r--Makefile-riscos12
-rw-r--r--build/Makefile.common2
-rw-r--r--doc/ChangeLog1
-rw-r--r--include/iconv-internal/iconv.h17
-rw-r--r--include/iconv/iconv.h10
-rw-r--r--module/header.cmhg2
-rw-r--r--module/header.h6
-rw-r--r--module/module.c2
-rw-r--r--riscos/ReadMe8
-rw-r--r--riscos/stubs/ReadMe11
-rw-r--r--riscos/stubs/stubs.c (renamed from module/stubs.c)30
-rw-r--r--src/iconv.c2
-rw-r--r--test/GNU/table-from.c2
-rw-r--r--test/GNU/table-to.c2
-rw-r--r--test/iconv.c2
15 files changed, 79 insertions, 30 deletions
diff --git a/Makefile-riscos b/Makefile-riscos
index bc60875..d1c78a1 100644
--- a/Makefile-riscos
+++ b/Makefile-riscos
@@ -52,3 +52,15 @@ PREFIX ?= $(GCCSDK_INSTALL_ENV)
TARGET := riscos
include build/Makefile.common
+
+# And the RISC OS distribution targets
+
+ITEMS_DISTCLEAN := $(ITEMS_DISTCLEAN) riscos-dist
+
+riscos-dist: module
+ @svn export riscos riscos-dist
+ @$(CP) $(CPFLAGS) Iconv,ffa riscos-dist/!System/310/Modules/
+ @svn export doc riscos-dist/doc
+ @$(RM) $(RMFLAGS) -r riscos-dist/doc/Standards
+ @$(CP) $(CPFLAGS) include/iconv/iconv.h riscos-dist/stubs/
+
diff --git a/build/Makefile.common b/build/Makefile.common
index 7da0315..150f68f 100644
--- a/build/Makefile.common
+++ b/build/Makefile.common
@@ -80,7 +80,7 @@ clean:
-@$(RM) $(RMFLAGS) $(COMPONENT).pc
distclean: clean
- -@$(RM) $(RMFLAGS) $(ITEMS_DISTCLEAN)
+ -@$(RM) $(RMFLAGS) -r $(ITEMS_DISTCLEAN)
-@$(RM) $(RMFLAGS) -r $(TOP)/dist
setup:
diff --git a/doc/ChangeLog b/doc/ChangeLog
index a8c2ac4..811aac9 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -71,3 +71,4 @@ Iconv Changelog
- New build system to go with this.
- Fixes for compiling with GCC4.
- Introduce *Iconv command which performs command line conversion.
+ - Many, many bugfixes.
diff --git a/include/iconv-internal/iconv.h b/include/iconv-internal/iconv.h
new file mode 100644
index 0000000..bcab574
--- /dev/null
+++ b/include/iconv-internal/iconv.h
@@ -0,0 +1,17 @@
+#ifndef _LIB_ICONV_INTERNAL_H
+#define _LIB_ICONV_INTERNAL_H
+
+#include <iconv/iconv.h>
+
+/*
+ * Initialise the iconv library
+ */
+int iconv_initialise(const char *aliases_file);
+
+/*
+ * Finalise the iconv library
+ */
+void iconv_finalise(void);
+
+#endif
+
diff --git a/include/iconv/iconv.h b/include/iconv/iconv.h
index 86b7b95..5e7d3cb 100644
--- a/include/iconv/iconv.h
+++ b/include/iconv/iconv.h
@@ -23,16 +23,6 @@
typedef void *iconv_t;
/*
- * Initialise the iconv library
- */
-int iconv_initialise(const char *aliases_file);
-
-/*
- * Finalise the iconv library
- */
-void iconv_finalise(void);
-
-/*
* Allocate a conversion descriptor suitable for converting byte sequences
* from encoding from code to encoding tocode.
* The resulting conversion descriptor may be used any number of times and
diff --git a/module/header.cmhg b/module/header.cmhg
index 63dbc3e..b7386ee 100644
--- a/module/header.cmhg
+++ b/module/header.cmhg
@@ -1,4 +1,4 @@
-help-string: Iconv 0.08
+help-string: Iconv 0.09
title-string: Iconv
diff --git a/module/header.h b/module/header.h
index 0678cd7..8eda6ee 100644
--- a/module/header.h
+++ b/module/header.h
@@ -11,10 +11,10 @@
#define Module_Title "Iconv"
#define Module_Help "Iconv"
-#define Module_VersionString "0.08"
-#define Module_VersionNumber 8
+#define Module_VersionString "0.09"
+#define Module_VersionNumber 9
#ifndef Module_Date
-#define Module_Date "11 Nov 2008"
+#define Module_Date "19 Nov 2008"
#endif
#ifdef __cplusplus
diff --git a/module/module.c b/module/module.c
index 0631551..417418c 100644
--- a/module/module.c
+++ b/module/module.c
@@ -6,7 +6,7 @@
#include <stdlib.h>
#include <string.h>
-#include <iconv/iconv.h>
+#include <iconv-internal/iconv.h>
#include "errors.h"
#include "header.h"
diff --git a/riscos/ReadMe b/riscos/ReadMe
index 5419b3f..0afd03b 100644
--- a/riscos/ReadMe
+++ b/riscos/ReadMe
@@ -14,19 +14,17 @@ Use the Boot merge facility in Configure to merge the provided !Boot directory
with the one on your system. If there is no !Boot merge facility provided on
your system, simply drag the !Boot directory over your existing boot structure.
-Module source can be found in the "src" directory.
Further documentation can be found in the "doc" directory.
Note for developers:
~~~~~~~~~~~~~~~~~~~~
-The libiconv stubs provided are suitable for use with the SCL.
-UnixLib users should be aware that an interface for this module is provided by
-UnixLib itself.
+The "stubs" directory contains source for a set of C stubs.
+See the ReadMe file in that directory for further information.
Licence
=======
-Iconv is Copyright © 2004-7 J-M Bell
+Iconv is Copyright © 2004-8 J-M Bell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/riscos/stubs/ReadMe b/riscos/stubs/ReadMe
new file mode 100644
index 0000000..40c117a
--- /dev/null
+++ b/riscos/stubs/ReadMe
@@ -0,0 +1,11 @@
+Iconv module stubs
+==================
+
+This directory contains the source code required to build suitable stubs
+for interfacing with the Iconv module from C. The stubs provide the standard
+iconv_open, iconv, and iconv_close API entry points.
+
+UnixLib users should use the veneers provided by that library. These stubs are
+provided for the convenience of those using the Shared C Library, or other
+runtime.
+
diff --git a/module/stubs.c b/riscos/stubs/stubs.c
index 96dee4b..aec8cf6 100644
--- a/module/stubs.c
+++ b/riscos/stubs/stubs.c
@@ -6,16 +6,32 @@
#include "swis.h"
-#include "errors.h" /* for error numbers */
-#include "header.h" /* for SWI numbers */
#include "iconv.h"
+/* SWI numbers */
+#define Iconv_Open (0x57540)
+#define Iconv_Iconv (0x57541)
+#define Iconv_Close (0x57542)
+#define Iconv_Convert (0x57543)
+#define Iconv_CreateMenu (0x57544)
+#define Iconv_DecodeMenu (0x57545)
+
+/* Error numbers */
+#define ERROR_BASE 0x81b900
+
+#define ICONV_NOMEM (ERROR_BASE+0)
+#define ICONV_INVAL (ERROR_BASE+1)
+#define ICONV_2BIG (ERROR_BASE+2)
+#define ICONV_ILSEQ (ERROR_BASE+3)
+
iconv_t iconv_open(const char *tocode, const char *fromcode)
{
iconv_t ret;
_kernel_oserror *error;
- error = _swix(Iconv_Open, _INR(0,1) | _OUT(0), tocode, fromcode, &ret);
+ error = _swix(Iconv_Open, _INR(0,1) | _OUT(0),
+ tocode, fromcode,
+ &ret);
if (error) {
switch (error->errnum) {
case ICONV_NOMEM:
@@ -46,7 +62,9 @@ size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf,
size_t ret;
_kernel_oserror *error;
- error = _swix(Iconv_Iconv, _INR(0,4) | _OUT(0), cd, inbuf, inbytesleft, outbuf, outbytesleft, &ret);
+ error = _swix(Iconv_Iconv, _INR(0,4) | _OUT(0),
+ cd, inbuf, inbytesleft, outbuf, outbytesleft,
+ &ret);
if (error) {
switch (error->errnum) {
case ICONV_NOMEM:
@@ -76,7 +94,9 @@ int iconv_close(iconv_t cd)
int ret;
_kernel_oserror *error;
- error = _swix(Iconv_Close, _IN(0) | _OUT(0), cd, &ret);
+ error = _swix(Iconv_Close, _IN(0) | _OUT(0),
+ cd,
+ &ret);
if (error) {
switch (error->errnum) {
case ICONV_NOMEM:
diff --git a/src/iconv.c b/src/iconv.c
index 8e26c67..0cb31bf 100644
--- a/src/iconv.c
+++ b/src/iconv.c
@@ -11,7 +11,7 @@
#include <unicode/charsets.h>
#include <unicode/encoding.h>
-#include <iconv/iconv.h>
+#include <iconv-internal/iconv.h>
#include "internal.h"
diff --git a/test/GNU/table-from.c b/test/GNU/table-from.c
index 0ae827c..f4ec661 100644
--- a/test/GNU/table-from.c
+++ b/test/GNU/table-from.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <errno.h>
-#include <iconv/iconv.h>
+#include <iconv-internal/iconv.h>
#ifdef __riscos__
#define ALIASES_FILE "Files.Aliases"
diff --git a/test/GNU/table-to.c b/test/GNU/table-to.c
index 0722774..4ababb8 100644
--- a/test/GNU/table-to.c
+++ b/test/GNU/table-to.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <errno.h>
-#include <iconv/iconv.h>
+#include <iconv-internal/iconv.h>
#ifdef __riscos__
#define ALIASES_FILE "Files.Aliases"
diff --git a/test/iconv.c b/test/iconv.c
index fd1eff7..0732040 100644
--- a/test/iconv.c
+++ b/test/iconv.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-#include <iconv/iconv.h>
+#include <iconv-internal/iconv.h>
#include "testutils.h"