summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
Diffstat (limited to 'amiga')
-rw-r--r--amiga/clipboard.c25
-rw-r--r--amiga/gui.c1
-rwxr-xr-xamiga/utf8.c65
-rwxr-xr-xamiga/utf8.h7
4 files changed, 57 insertions, 41 deletions
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index d39e89e4a..6768dde17 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -16,10 +16,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <proto/iffparse.h>
+#include <proto/intuition.h>
+#include <proto/exec.h>
+#include <proto/datatypes.h>
+#include <proto/diskfont.h>
+
+#include <diskfont/diskfonttag.h>
+#include <datatypes/textclass.h>
+#include <datatypes/pictureclass.h>
+
+#include "utils/nsoption.h"
+#include "utils/utf8.h"
#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "desktop/textinput.h"
-#include "utils/nsoption.h"
#include "amiga/bitmap.h"
#include "amiga/clipboard.h"
@@ -31,18 +42,6 @@
#include "amiga/menu.h"
#include "amiga/utf8.h"
-#include "utils/utf8.h"
-
-#include <proto/iffparse.h>
-#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/datatypes.h>
-#include <proto/diskfont.h>
-
-#include <diskfont/diskfonttag.h>
-#include <datatypes/textclass.h>
-#include <datatypes/pictureclass.h>
-
#define ID_UTF8 MAKE_ID('U','T','F','8')
struct IFFHandle *iffh = NULL;
diff --git a/amiga/gui.c b/amiga/gui.c
index 074dfafa6..f186328fe 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5223,6 +5223,7 @@ int main(int argc, char** argv)
.clipboard = amiga_clipboard_table,
.download = amiga_download_table,
.fetch = &amiga_fetch_table,
+ .utf8 = amiga_utf8_table,
};
/* Open popupmenu.library just to check the version.
diff --git a/amiga/utf8.c b/amiga/utf8.c
index d182492e9..a8e415d45 100755
--- a/amiga/utf8.c
+++ b/amiga/utf8.c
@@ -18,13 +18,44 @@
#include <stdlib.h>
#include <string.h>
-
#include <sys/types.h>
+
#include "utils/utf8.h"
+#include "desktop/gui.h"
#include <proto/exec.h>
#include <proto/diskfont.h>
#include <diskfont/diskfonttag.h>
+#include "amiga/utf8.h"
+
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
+{
+ const char *encname = "ISO-8859-1";
+
+#ifdef __amigaos4__
+ LONG charset;
+
+ charset = GetDiskFontCtrl(DFCTRL_CHARSET);
+ encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
+#endif
+
+ return utf8_from_enc(string,encname,len,result,NULL);
+}
+
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
+{
+ const char *encname = "ISO-8859-1";
+
+#ifdef __amigaos4__
+ LONG charset;
+
+ charset = GetDiskFontCtrl(DFCTRL_CHARSET);
+ encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
+#endif
+
+ return utf8_to_enc(string,encname,len,result);
+}
+
void ami_utf8_free(char *ptr)
{
if(ptr) free(ptr);
@@ -58,32 +89,10 @@ char *ami_to_utf8_easy(const char *string)
}
}
-nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
-{
- const char *encname = "ISO-8859-1";
-
-#ifdef __amigaos4__
- LONG charset;
-
- charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
-#endif
-
- return utf8_from_enc(string,encname,len,result,NULL);
-}
-
-nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
-{
- const char *encname = "ISO-8859-1";
-
-#ifdef __amigaos4__
- LONG charset;
-
- charset = GetDiskFontCtrl(DFCTRL_CHARSET);
- encname = (const char *) ObtainCharsetInfo(DFCS_NUMBER, charset, DFCS_MIMENAME);
-#endif
-
- return utf8_to_enc(string,encname,len,result);
-}
+static struct gui_utf8_table utf8_table = {
+ .utf8_to_local = utf8_to_local_encoding,
+ .local_to_utf8 = utf8_from_local_encoding,
+};
+struct gui_utf8_table *amiga_utf8_table = &utf8_table;
diff --git a/amiga/utf8.h b/amiga/utf8.h
index 7956523ee..065a149f2 100755
--- a/amiga/utf8.h
+++ b/amiga/utf8.h
@@ -18,7 +18,14 @@
#ifndef AMIGA_UTF8_H
#define AMIGA_UTF8_H
+
+extern struct gui_utf8_table *ami_utf8_table;
+
char *ami_utf8_easy(const char *string);
void ami_utf8_free(char *ptr);
char *ami_to_utf8_easy(const char *string);
+
+nserror utf8_from_local_encoding(const char *string, size_t len, char **result);
+nserror utf8_to_local_encoding(const char *string, size_t len, char **result);
+
#endif