1 /***************************************************************************
3 codesets.library - Amiga shared library for handling different codesets
4 Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
5 Copyright (C) 2005-2014 codesets.library Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 codesets.library project: http://sourceforge.net/projects/codesetslib/
19 Most of the code included in this file was relicensed from GPL to LGPL
20 from the source code of SimpleMail (http://www.sf.net/projects/simplemail)
21 with full permissions by its authors.
25 ***************************************************************************/
27 #include <proto/codesets.h>
29 #if defined(__MORPHOS__)
30 #if defined(USE_INLINE_STDARG)
31 #undef USE_INLINE_STDARG
34 #define INTUITION_NO_INLINE_STDARG
35 #define MUIMASTER_NO_INLINE_STDARG
37 #include <clib/alib_protos.h>
39 #include <proto/exec.h>
40 #include <proto/dos.h>
41 #include <proto/utility.h>
42 #include <proto/muimaster.h>
43 #include <proto/intuition.h>
44 #include <libraries/asl.h>
45 #include <libraries/gadtools.h>
46 #include <libraries/mui.h>
47 #include <mui/TextEditor_mcc.h>
52 #include "SDI_compiler.h"
54 #include "SDI_stdarg.h"
56 /***********************************************************************/
62 #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
65 #if defined(__amigaos4__)
66 #define GETINTERFACE(iface, base) (iface = (APTR)GetInterface((struct Library *)(base), "main", 1L, NULL))
67 #define DROPINTERFACE(iface) (DropInterface((struct Interface *)iface), iface = NULL)
69 #define GETINTERFACE(iface, base) TRUE
70 #define DROPINTERFACE(iface)
73 /***********************************************************************/
78 char __ver
[] = "\0$VER: CodesetsDemo1 1.0 (10.11.2004)";
81 struct Library
*MUIMasterBase
= NULL
;
82 struct Library
*CodesetsBase
= NULL
;
84 struct UtilityBase
*UtilityBase
= NULL
;
86 struct Library
*UtilityBase
= NULL
;
89 #if defined(__amigaos4__)
90 struct MUIMasterIFace
*IMUIMaster
= NULL
;
91 struct CodesetsIFace
*ICodesets
= NULL
;
92 struct IntuitionIFace
*IIntuition
= NULL
;
93 struct UtilityIFace
*IUtility
= NULL
;
94 struct Library
*IntuitionBase
= NULL
;
96 struct IntuitionBase
*IntuitionBase
= NULL
;
100 struct MUI_CustomClass
*appClass
, *popupCodesetsClass
, *editorClass
;
102 /***********************************************************************/
108 #define MUIA_App_Win (TAG_USER+1)
111 #define MUIM_App_DisposeWin (TAG_USER+2)
112 #define MUIM_App_About (TAG_USER+3)
114 struct MUIP_App_DisposeWin
120 /* Editor attributes */
121 #define MUIA_Editor_CodesetsObj (TAG_USER+5)
124 #define MUIM_Editor_Load (TAG_USER+6)
125 #define MUIM_Editor_Save (TAG_USER+7)
127 struct MUIP_Editor_Load
133 /* Classes object creation macros */
134 #define appObject NewObject(appClass->mcc_Class,NULL
135 #define editorObject NewObject(editorClass->mcc_Class,NULL
136 #define popupCodesetObject NewObject(popupCodesetsClass->mcc_Class,NULL
138 /***********************************************************************/
140 ** Usual DoSuperNew funct
144 // Calls parent NEW method within a subclass
145 #if !defined(__MORPHOS__)
147 #define DoSuperNew(cl, obj, ...) DoSuperNewTags(cl, obj, NULL, __VA_ARGS__)
149 Object
* STDARGS VARARGS68K
DoSuperNew(struct IClass
*cl
, Object
*obj
, ...)
155 rc
= (Object
*)DoSuperMethod(cl
, obj
, OM_NEW
, VA_ARG(args
, ULONG
), NULL
);
164 /***********************************************************************/
166 ** Codesets popup open window hook funct
169 HOOKPROTONH(popupWindowFun
, void, Object
*pop
, Object
*win
)
171 set(win
,MUIA_Window_DefaultObject
,pop
);
173 MakeStaticHook(popupWindowHook
, popupWindowFun
);
175 /***********************************************************************/
177 ** Codesets popup open hook funct
178 ** Sets the active entry in the list
181 HOOKPROTONH(popupOpenFun
, ULONG
, Object
*list
, Object
*str
)
186 get(str
, MUIA_Text_Contents
, &s
);
192 DoMethod(list
,MUIM_List_GetEntry
,i
,&x
);
195 set(list
,MUIA_List_Active
,MUIV_List_Active_Off
);
199 if (stricmp(x
,s
) == 0)
201 set(list
,MUIA_List_Active
,i
);
209 MakeStaticHook(popupOpenHook
, popupOpenFun
);
211 /***********************************************************************/
213 ** Codesets popup close hook funct
214 ** Set the string contents
217 HOOKPROTONH(popupCloseFun
, void, Object
*list
, Object
*str
)
221 DoMethod(list
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&e
);
222 set(str
,MUIA_Text_Contents
,e
);
224 MakeStaticHook(popupCloseHook
, popupCloseFun
);
226 /***********************************************************************/
228 ** Codesets popup new method
232 mpopupNew(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
234 Object
*str
, *bt
, *lv
, *l
;
236 if((obj
= (Object
*)DoSuperNew(cl
,obj
,
238 MUIA_Popstring_String
, str
= TextObject
,
240 MUIA_Background
, MUII_TextBack
,
243 MUIA_Popstring_Button
, bt
= MUI_MakeObject(MUIO_PopButton
,MUII_PopUp
),
245 MUIA_Popobject_Object
, lv
= ListviewObject
,
246 MUIA_Listview_List
, l
= ListObject
,
247 MUIA_Frame
, MUIV_Frame_InputList
,
248 MUIA_Background
, MUII_ListBack
,
249 MUIA_List_AutoVisible
, TRUE
,
250 MUIA_List_ConstructHook
, MUIV_List_ConstructHook_String
,
251 MUIA_List_DestructHook
, MUIV_List_DestructHook_String
,
254 MUIA_Popobject_WindowHook
, &popupWindowHook
,
255 MUIA_Popobject_StrObjHook
, &popupOpenHook
,
256 MUIA_Popobject_ObjStrHook
, &popupCloseHook
,
258 TAG_MORE
,msg
->ops_AttrList
)))
260 struct codeset
*codeset
;
263 set(bt
,MUIA_CycleChain
,TRUE
);
264 DoMethod(lv
,MUIM_Notify
,MUIA_Listview_DoubleClick
,TRUE
,obj
,2,MUIM_Popstring_Close
,TRUE
);
266 /* Build list of available codesets */
267 if((array
= CodesetsSupportedA(NULL
)))
269 DoMethod(l
,MUIM_List_Insert
,array
,-1,MUIV_List_Insert_Sorted
);
270 CodesetsFreeA(array
,NULL
);
272 else SetSuperAttrs(cl
,obj
,MUIA_Disabled
,TRUE
,TAG_DONE
);
274 /* Use the default codeset */
275 codeset
= CodesetsFindA(NULL
,NULL
);
276 set(str
,MUIA_Text_Contents
,codeset
->name
);
282 /***********************************************************************/
284 ** Codesets popup dispatcher
287 DISPATCHER(popupDispatcher
)
289 switch (msg
->MethodID
)
291 case OM_NEW
: return (IPTR
)mpopupNew(cl
,obj
,(APTR
)msg
);
292 default: return DoSuperMethodA(cl
,obj
,msg
);
296 /***********************************************************************/
304 struct FileRequester
*req
;
307 /***********************************************************************/
313 meditorNew(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
315 struct FileRequester
*req
;
317 if ((req
= MUI_AllocAslRequest(ASL_FileRequest
,NULL
)) &&
318 (obj
= (Object
*)DoSuperNew(cl
,obj
,
319 TAG_MORE
,msg
->ops_AttrList
)))
321 struct editorData
*data
= INST_DATA(cl
,obj
);
323 data
->codesetsObj
= (Object
*)GetTagData(MUIA_Editor_CodesetsObj
, 0, msg
->ops_AttrList
);
329 if (req
) MUI_FreeAslRequest(req
);
335 /***********************************************************************/
337 ** Editor dispose method
341 meditorDispose(struct IClass
*cl
,Object
*obj
,Msg msg
)
343 struct editorData
*data
= INST_DATA(cl
,obj
);
345 if (data
->req
) MUI_FreeAslRequest(data
->req
);
347 return DoSuperMethodA(cl
,obj
,msg
);
350 /***********************************************************************/
352 ** Editor load method
356 meditorLoad(struct IClass
*cl
,Object
*obj
,struct MUIP_Editor_Load
*msg
)
358 struct editorData
*data
= INST_DATA(cl
,obj
);
360 set(_app(obj
),MUIA_Application_Sleep
,TRUE
);
361 SetSuperAttrs(cl
,obj
,MUIA_TextEditor_Quiet
,FALSE
,TAG_DONE
);
363 /* Request file name */
364 if (MUI_AslRequestTags(data
->req
,ASLFR_TitleText
,msg
->plain
?
365 "Select a file to load" : "Select a file to load as UTF8",TAG_DONE
))
370 strlcpy(fname
,data
->req
->fr_Drawer
,sizeof(fname
));
371 AddPart(fname
,data
->req
->fr_File
,sizeof(fname
));
374 if((lock
= Lock(fname
,SHARED_LOCK
)))
376 struct FileInfoBlock
*fib
;
377 ULONG go
= FALSE
, size
= 0;
379 if((fib
= AllocDosObject(DOS_FIB
,NULL
)))
381 if (Examine(lock
,fib
))
383 size
= fib
->fib_Size
;
387 FreeDosObject(DOS_FIB
,fib
);
394 DoSuperMethod(cl
,obj
,MUIM_TextEditor_ClearText
);
400 /* Alloc whole file buf */
401 if((buf
= AllocMem(size
+1,MEMF_ANY
)))
405 if((file
= Open(fname
,MODE_OLDFILE
)))
409 r
= Read(file
,buf
,size
);
416 /* If plain just set it */
417 set(obj
,MUIA_TextEditor_Contents
,buf
);
421 struct codeset
*codeset
;
425 /* Get used codeset */
426 get(data
->codesetsObj
, MUIA_Text_Contents
, &cname
);
427 codeset
= CodesetsFindA(cname
,NULL
);
430 str
= CodesetsUTF8ToStr(CSA_Source
, (IPTR
)buf
,
431 CSA_SourceCodeset
, (IPTR
)codeset
,
435 SetSuperAttrs(cl
,obj
,MUIA_TextEditor_Contents
,str
,TAG_DONE
);
436 CodesetsFreeA(str
,NULL
);
448 SetSuperAttrs(cl
,obj
,MUIA_TextEditor_CursorX
, 0,
449 MUIA_TextEditor_CursorY
, 0,
455 SetSuperAttrs(cl
,obj
,MUIA_TextEditor_Quiet
,FALSE
,TAG_DONE
);
456 set(_app(obj
),MUIA_Application_Sleep
,FALSE
);
461 /***********************************************************************/
463 ** Editor save method
467 meditorSave(struct IClass
*cl
, Object
*obj
, UNUSED Msg msg
)
469 struct editorData
*data
= INST_DATA(cl
,obj
);
472 set(_app(obj
),MUIA_Application_Sleep
,TRUE
);
474 /* Get editor text */
475 if((text
= (STRPTR
)DoSuperMethod(cl
,obj
,MUIM_TextEditor_ExportText
)))
477 struct codeset
*codeset
;
482 /* Get current user codeset */
483 get(data
->codesetsObj
, MUIA_Text_Contents
, &cname
);
484 codeset
= CodesetsFindA(cname
,NULL
);
486 /* Convert text as utf8 */
487 if((utf8
= CodesetsUTF8Create(CSA_Source
, (IPTR
)text
,
488 CSA_SourceCodeset
, (IPTR
)codeset
,
489 CSA_DestLenPtr
, (IPTR
)&dlen
,
492 /* Save converted text to a file */
494 if (MUI_AslRequestTags(data
->req
,ASLFR_DoSaveMode
,TRUE
,ASLFR_TitleText
,"Select a file to save as UTF8",TAG_DONE
))
499 strlcpy(fname
,data
->req
->fr_Drawer
,sizeof(fname
));
500 AddPart(fname
,data
->req
->fr_File
,sizeof(fname
));
502 if((file
= Open(fname
,MODE_NEWFILE
)))
504 Write(file
,utf8
,dlen
);
509 /* Free converted string */
510 CodesetsFreeA(utf8
,NULL
);
516 set(_app(obj
),MUIA_Application_Sleep
,FALSE
);
521 /***********************************************************************/
526 DISPATCHER(editorDispatcher
)
528 switch (msg
->MethodID
)
530 case OM_NEW
: return (IPTR
)meditorNew(cl
,obj
,(APTR
)msg
);
531 case OM_DISPOSE
: return meditorDispose(cl
,obj
,(APTR
)msg
);
532 case MUIM_Editor_Save
: return meditorSave(cl
,obj
,(APTR
)msg
);
533 case MUIM_Editor_Load
: return meditorLoad(cl
,obj
,(APTR
)msg
);
534 default: return DoSuperMethodA(cl
,obj
,msg
);
538 /***********************************************************************/
551 /***********************************************************************/
557 #define MTITLE(t) {NM_TITLE,(STRPTR)(t),0,0,0,0}
558 #define MITEM(t,d) {NM_ITEM,(STRPTR)(t),0,0,0,(APTR)(d)}
559 #define MBAR {NM_ITEM,(STRPTR)NM_BARLABEL,0,0,0,NULL}
560 #define MEND {NM_END,NULL,0,0,0,NULL}
570 static struct NewMenu appMenu
[] =
573 MITEM("?\0About...",MABOUT
),
574 MITEM("M\0About MUI...",MABOUTMUI
),
576 MITEM("Q\0Quit",MQUIT
),
579 MITEM("M\0MUI Settings...",MMUI
),
585 mappNew(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
587 Object
*strip
, *win
, *codesets
= NULL
, *editor
, *sb
, *loadPlain
, *loadUTF8
, *save
, *cancel
;
589 codesets
= popupCodesetObject
, End
;
591 if((obj
= (Object
*)DoSuperNew(cl
,obj
,
592 MUIA_Application_Title
, "Codesets Demo1",
593 MUIA_Application_Version
, "$VER: CodesetsDemo1 1.0 (10.11.2004)",
594 MUIA_Application_Copyright
, "Copyright 2004 by Alfonso Ranieri",
595 MUIA_Application_Author
, "Alfonso Ranieri <alforan@tin.it>",
596 MUIA_Application_Description
, "Codesets example",
597 MUIA_Application_Base
, "CODESETSEXAMPLE",
598 MUIA_Application_Menustrip
, strip
= MUI_MakeObject(MUIO_MenustripNM
,appMenu
,MUIO_MenustripNM_CommandKeyCheck
),
600 SubWindow
, win
= WindowObject
,
601 MUIA_Window_ID
, MAKE_ID('M','A','I','N'),
602 MUIA_Window_Title
, "Codesets Demo1",
603 WindowContents
, VGroup
,
606 Child
, Label2("Charset"),
611 MUIA_Group_Horiz
, TRUE
,
612 MUIA_Group_Spacing
, 0,
613 Child
, editor
= editorObject
,
614 MUIA_Editor_CodesetsObj
, codesets
,
616 Child
, sb
= ScrollbarObject
, End
,
620 Child
, loadPlain
= MUI_MakeObject(MUIO_Button
,"Load _plain"),
621 Child
, RectangleObject
, MUIA_Weight
, 50, End
,
622 Child
, loadUTF8
= MUI_MakeObject(MUIO_Button
,"_Load utf8"),
623 Child
, RectangleObject
, MUIA_Weight
, 50, End
,
624 Child
, save
= MUI_MakeObject(MUIO_Button
,"_Save utf8"),
625 Child
, RectangleObject
, MUIA_Weight
, 50, End
,
626 Child
, cancel
= MUI_MakeObject(MUIO_Button
,"_Cancel"),
631 TAG_MORE
,msg
->ops_AttrList
)))
633 struct appData
*data
= INST_DATA(cl
,obj
);
636 set(editor
,MUIA_TextEditor_Slider
,sb
);
638 set(loadPlain
,MUIA_CycleChain
,TRUE
);
639 set(loadUTF8
,MUIA_CycleChain
,TRUE
);
640 set(save
,MUIA_CycleChain
,TRUE
);
641 set(cancel
,MUIA_CycleChain
,TRUE
);
643 DoMethod(win
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,MUIV_Notify_Application
,2,
644 MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
646 DoMethod(loadPlain
,MUIM_Notify
,MUIA_Pressed
,FALSE
,editor
,2,MUIM_Editor_Load
,TRUE
);
647 DoMethod(loadUTF8
,MUIM_Notify
,MUIA_Pressed
,FALSE
,editor
,2,MUIM_Editor_Load
,FALSE
);
648 DoMethod(save
,MUIM_Notify
,MUIA_Pressed
,FALSE
,editor
,1,MUIM_Editor_Save
);
649 DoMethod(cancel
,MUIM_Notify
,MUIA_Pressed
,FALSE
,MUIV_Notify_Application
,2,
650 MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
652 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MABOUT
),MUIM_Notify
,
653 MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,1,MUIM_App_About
);
655 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MABOUTMUI
),MUIM_Notify
,
656 MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,1,MUIM_Application_AboutMUI
);
658 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MQUIT
),MUIM_Notify
,
659 MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,2,MUIM_Application_ReturnID
,
660 MUIV_Application_ReturnID_Quit
);
662 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MMUI
),MUIM_Notify
,
663 MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,2,MUIM_Application_OpenConfigWindow
,0);
665 set(win
,MUIA_Window_Open
,TRUE
);
671 /***********************************************************************/
673 ** App dispose win method
677 mappDisposeWin(struct IClass
*cl
,Object
*obj
,struct MUIP_App_DisposeWin
*msg
)
679 struct appData
*data
= INST_DATA(cl
,obj
);
680 Object
*win
= msg
->win
;
682 set(win
,MUIA_Window_Open
,FALSE
);
683 DoSuperMethod(cl
,obj
,OM_REMMEMBER
,win
);
684 MUI_DisposeObject(win
);
686 if (win
==data
->about
) data
->about
= NULL
;
687 else if (win
==data
->aboutMUI
) data
->aboutMUI
= NULL
;
692 /***********************************************************************/
698 mappAbout(struct IClass
*cl
,Object
*obj
,UNUSED Msg msg
)
700 struct appData
*data
= INST_DATA(cl
,obj
);
702 SetSuperAttrs(cl
,obj
,MUIA_Application_Sleep
,TRUE
,TAG_DONE
);
708 if((data
->about
= WindowObject
,
709 MUIA_Window_RefWindow
, data
->win
,
710 MUIA_Window_Title
, "About Codesets Demo1",
711 WindowContents
, VGroup
,
713 MUIA_Text_Contents
, "\n"
715 "Copyright 2004 by Alfonso Ranieri <alforan@tin.it>\n",
716 MUIA_Text_PreParse
, MUIX_C
,
718 Child
, RectangleObject
, MUIA_Weight
, 0, MUIA_Rectangle_HBar
, TRUE
, End
,
720 Child
, RectangleObject
, MUIA_Weight
, 200, End
,
721 Child
, ok
= MUI_MakeObject(MUIO_Button
,"_OK"),
722 Child
, RectangleObject
, MUIA_Weight
, 200, End
,
727 DoSuperMethod(cl
,obj
,OM_ADDMEMBER
,data
->about
);
729 set(data
->about
,MUIA_Window_ActiveObject
,ok
);
731 DoMethod(data
->about
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,obj
,5,
732 MUIM_Application_PushMethod
,obj
,2,MUIM_App_DisposeWin
,data
->about
);
734 DoMethod(ok
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,5,
735 MUIM_Application_PushMethod
,obj
,2,MUIM_App_DisposeWin
,data
->about
);
739 set(data
->about
,MUIA_Window_Open
,TRUE
);
741 SetSuperAttrs(cl
,obj
,MUIA_Application_Sleep
,FALSE
,TAG_DONE
);
746 /***********************************************************************/
748 ** App MUI settings method
752 mappOpenMUIConfigWindow(struct IClass
*cl
,Object
*obj
,Msg msg
)
756 SetSuperAttrs(cl
,obj
,MUIA_Application_Sleep
,TRUE
,TAG_DONE
);
757 res
= DoSuperMethodA(cl
,obj
,msg
);
758 SetSuperAttrs(cl
,obj
,MUIA_Application_Sleep
,FALSE
,TAG_DONE
);
763 /***********************************************************************/
768 DISPATCHER(appDispatcher
)
770 switch (msg
->MethodID
)
772 case OM_NEW
: return (IPTR
)mappNew(cl
,obj
,(APTR
)msg
);
773 case MUIM_App_DisposeWin
: return mappDisposeWin(cl
,obj
,(APTR
)msg
);
774 case MUIM_App_About
: return mappAbout(cl
,obj
,(APTR
)msg
);
775 case MUIM_Application_OpenConfigWindow
: return mappOpenMUIConfigWindow(cl
,obj
,(APTR
)msg
);
776 default: return DoSuperMethodA(cl
,obj
,msg
);
780 /***********************************************************************/
786 main(UNUSED
int argc
,char **argv
)
788 int res
= RETURN_FAIL
;
790 if((IntuitionBase
= (APTR
)OpenLibrary("intuition.library", 39)) && // open intuition.library
791 GETINTERFACE(IIntuition
, IntuitionBase
))
793 if((UtilityBase
= (APTR
)OpenLibrary("utility.library", 39)) && // open utility.library
794 GETINTERFACE(IUtility
, UtilityBase
))
796 if((CodesetsBase
= OpenLibrary(CODESETSNAME
, CODESETSVER
)) && // open codesets.library
797 GETINTERFACE(ICodesets
, CodesetsBase
))
799 /* Open muimaster.library */
800 if((MUIMasterBase
= OpenLibrary("muimaster.library",19)) &&
801 GETINTERFACE(IMUIMaster
, MUIMasterBase
))
804 if ((appClass
= MUI_CreateCustomClass(NULL
, MUIC_Application
, NULL
, sizeof(struct appData
), ENTRY(appDispatcher
))) &&
805 (popupCodesetsClass
= MUI_CreateCustomClass(NULL
, MUIC_Popobject
, NULL
, 0, ENTRY(popupDispatcher
))) &&
806 (editorClass
= MUI_CreateCustomClass(NULL
, MUIC_TextEditor
, NULL
, sizeof(struct editorData
), ENTRY(editorDispatcher
))))
810 /* Create application */
811 if((app
= appObject
, End
))
816 while (DoMethod(app
,MUIM_Application_NewInput
,&sigs
) != (ULONG
)MUIV_Application_ReturnID_Quit
)
820 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
821 if (sigs
& SIGBREAKF_CTRL_C
) break;
825 MUI_DisposeObject(app
);
831 printf("%s: can't create application\n",argv
[0]);
834 MUI_DeleteCustomClass(popupCodesetsClass
);
835 MUI_DeleteCustomClass(editorClass
);
836 MUI_DeleteCustomClass(appClass
);
842 if (popupCodesetsClass
) MUI_DeleteCustomClass(popupCodesetsClass
);
843 MUI_DeleteCustomClass(appClass
);
846 printf("%s: can't create custom classes\n",argv
[0]);
849 DROPINTERFACE(IMUIMaster
);
850 CloseLibrary(MUIMasterBase
);
854 printf("%s: Can't open muimaster.library ver 19 or higher\n",argv
[0]);
858 DROPINTERFACE(ICodesets
);
859 CloseLibrary(CodesetsBase
);
863 printf("%s: Can't open codesets.library ver %d or higher.\n", argv
[0], CODESETSVER
);
867 DROPINTERFACE(IUtility
);
868 CloseLibrary((struct Library
*)UtilityBase
);
871 DROPINTERFACE(IIntuition
);
872 CloseLibrary((struct Library
*)IntuitionBase
);
878 /***********************************************************************/