Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]New-year-gift
- To: ml@example.com
- Subject: New-year-gift
- From: Gaspar Sinai <gsinai@example.com>
- Date: Wed, 1 Jan 1997 21:43:52 +0900 (JST)
- cc: tlug@example.com
- Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1169529124-852122632=:2343"
- Reply-To: tlug@example.com
- Sender: owner-tlug
Hi, These Japanese o-shogatsu days gave me a lot of free time so I made a patch for ml. It can be used to READ Japanese mail under Linux. Unfortunatelly not many Japanese people use this excellent program. This patch is very minor, and it barely suits the need to demonstrate the power of this program for those who never thought of using it because of the lack of Japanese support. To Mike, or whoever feels like maintaining further releases: I would be grateful if somebody could integrate it somehow with ml, unlike all the other Japanese patches of xv, mosaic e.t.c. :(. Unfortulatelly I dont have much time to upgrade it any further. It would be beneficial to make it able to send Japanese mail - lets hope some student will jump on it :) Have a happy and successful new year. gaspar ----- Why Windows 95 when there is Linux 97? Gaspar Sinai mailto:gsinai@example.com http://www2.gol.com/users/gsinai/both.htmlDescription =========== This is an attempt to make ml display Japanese email messages. I only wanted to demonstrate that things are possible so I am waiting for some guy, with more free time than I have, to jump on this patch and make it fully functional. When I made this patch I was faced with a buggy Motif (Moo-Tiff) and a linux C library that has no notion of Japanese characters. When I wanted to make a text widget accept Japanese input then it dumped in some place inside Motif. As I have no source code for Motif I could not proceed - even now Japanese input is not possible. When xmTextWidgetClass is used, the text was not displayed but sometimes it turned up when I pressed the mouse on the text. So, I replaced xmTextWidgetClass with xmCSTextWidgetClass and things started to look better. I had to provide horizontal scrollbar to avoid ugly dumps when text is longer than the widget can hold. Installation: ============ o get ml-2.3 from http://camis.Stanford.EDU/projects/imap/ml/ o Apply the patch from ml-2.3-root directory patch < ml-2.3.linux.japanese-patch o remake reinstall o Make a japanese ML by copying the old one and modyifying fonts and sizes in /usr/lib/X11/ja_JP.ujis/app-defaults/ML important new properties in ML: ------------------------------------------------------------------------ *XmCSText*fontList: -*-courier-medium-r-*-*-14-*-*-*-*-*-iso8859-1;\ -*-*-medium-*-*-*-14-*-*-*-*-*-jisx0208.1983-*;\ -*-*-medium-*-*-*-14-*-*-*-*-*-jisx0201.1976-*: *XmCSText*width: 120 ------------------------------------------------------------------------ or ------------------------------------------------------------------------ *XmCSText*fontList: *-14-*: *XmCSText*width: 120 ------------------------------------------------------------------------ o in csh: setenv ML_SETLANG ja_JP.ujis setenv LANG ja_JP.ujis in bash: export ML_SETLANG=ja_JP.ujis export LANG=ja_JP.ujis o pray o try o It will dump if you try to cut and paste - it uses widechar chars - which does not support Japanes in linux libc. Oh I wish I had the Motif source! Current limitations: =================== o Japanese works only reading o cut and paste mostly dumps on Japanese characters. Gaspar Sinai <gsinai@example.com> 1 January 1997 *** src/compose.c- Wed Jan 1 16:28:25 1997 --- src/compose.c Wed Jan 1 16:06:13 1997 *************** *** 4266,4269 **** --- 4266,4270 ---- char *tmp; Boolean found = FALSE; + XmString str; push_cursor(WATCH_CURSOR); *************** *** 4271,4282 **** for(read = session->read; read != NULL; read = read->next) { if(read->is_realized == TRUE) { ! XmTextGetSelectionPosition(read->read_text,&left,&right); if(left != right) { ! tmp = XmTextGetSelection(read->read_text); ! the_text = copywrap(tmp, ! (COMPOSEWIDTH - 2) ! - strlen(preferences.reply_prefix)); ! fs_give((void **) &tmp); ! found = TRUE; } } --- 4272,4293 ---- for(read = session->read; read != NULL; read = read->next) { if(read->is_realized == TRUE) { ! XmCSTextGetSelectionPosition(read->read_text,&left,&right); if(left != right) { ! tmp=NULL; ! str = XmCSTextGetSelection(read->read_text); ! if (str != NULL) ! { ! if (!XmStringGetLtoR (str, XmFONTLIST_DEFAULT_TAG, &tmp)) ! { ! str=NULL; ! } ! else ! { ! the_text = copywrap(tmp, (COMPOSEWIDTH - 2) ! - strlen(preferences.reply_prefix)); ! XtFree (tmp); ! found = TRUE; ! } ! } } } *** src/msgfncs.c- Wed Jan 1 16:28:24 1997 --- src/msgfncs.c Tue Dec 31 21:29:36 1996 *************** *** 420,423 **** --- 420,425 ---- Tm->tm_min = elt->minutes; Tm->tm_sec = elt->seconds; + /* Let it be always Sunday :) */ + Tm->tm_wday = 0; Tm->tm_isdst = (-1); /* Unavailable */ } *** src/preferences.h- Wed Jan 1 16:28:24 1997 --- src/preferences.h Wed Jan 1 05:35:50 1997 *************** *** 49,52 **** --- 49,53 ---- int news_fetch; int note_save; + Boolean japanese; Boolean confirmDestroy; Boolean useIspell; *** src/read.c- Wed Jan 1 16:28:25 1997 --- src/read.c Wed Jan 1 18:15:51 1997 *************** *** 592,598 **** XtSetArg(args[n], XmNcolumns, 80); n ++; XtSetArg(args[n], XmNscrollVertical, TRUE); n ++; ! XtSetArg(args[n], XmNscrollHorizontal, FALSE ); n ++; read->read_text = ! XmCreateScrolledText(read->pane, "text", args, n); n = 0; XtManageChild(read->read_text); --- 592,600 ---- XtSetArg(args[n], XmNcolumns, 80); n ++; XtSetArg(args[n], XmNscrollVertical, TRUE); n ++; ! ! /* This is the only way to survive dumping */ ! XtSetArg(args[n], XmNscrollHorizontal, TRUE ); n ++; read->read_text = ! XmCreateScrolledCSText(read->pane, "text", args, n); n = 0; XtManageChild(read->read_text); *************** *** 1109,1112 **** --- 1111,1115 ---- char *temp_url = NULL; char *url = NULL; + XmString str; if(*preferences.url_command == NUL_TERM) { *************** *** 1120,1126 **** } ! XmTextGetSelectionPosition(read->read_text, &left, &right); if(left != right) { ! temp_url = XmTextGetSelection(read->read_text); } else { --- 1123,1139 ---- } ! XmCSTextGetSelectionPosition(read->read_text, &left, &right); ! str = NULL; if(left != right) { ! temp_url=NULL; ! str = XmCSTextGetSelection(read->read_text); ! if (str != NULL) ! { ! if (!XmStringGetLtoR (str, XmFONTLIST_DEFAULT_TAG, &temp_url)) ! { ! str=NULL; ! } ! } ! } else { *************** *** 1134,1138 **** url = input_string(read->shell, MLGetLocalized(XtNmsgShowURL,MsgShowURL), temp_url, SHOWURLHELPFILE); ! fs_give((void **) &temp_url); if(url == NULL) --- 1147,1159 ---- url = input_string(read->shell, MLGetLocalized(XtNmsgShowURL,MsgShowURL), temp_url, SHOWURLHELPFILE); ! if (str == NULL) ! { ! fs_give((void **) &temp_url); ! } ! else ! { ! XtFree (temp_url); ! temp_url = NULL; ! } if(url == NULL) *************** *** 2134,2138 **** XmTextSetString(read->read_header, EMPTYSTR); ! XmTextSetString(read->read_text,EMPTYSTR); XmListDeselectAllItems(read->read_attach); XmListDeleteAllItems(read->read_attach); --- 2155,2159 ---- XmTextSetString(read->read_header, EMPTYSTR); ! XmCSTextSetString(read->read_text,NULL); XmListDeselectAllItems(read->read_attach); XmListDeleteAllItems(read->read_attach); *************** *** 2152,2163 **** if(new->visible) { if(new->alt_text) ! XmTextSetString(read->read_text,new->alt_text); ! else ! if(new->current_text) ! XmTextSetString(read->read_text,new->current_text); } else ! XmTextSetString(read->read_text,MLGetLocalized(XtNmsgBinaryMessage, ! MsgBinaryMessage)); XtSetKeyboardFocus(read->shell, read->read_text); --- 2173,2198 ---- if(new->visible) { if(new->alt_text) ! { ! XmString str = XmStringCreateLtoR (localize_text ((unsigned char**)&new->alt_text), ! XmFONTLIST_DEFAULT_TAG); ! XmCSTextSetString(read->read_text, str); ! XmStringFree (str); ! } ! else if(new->current_text) ! { ! XmString str = XmStringCreateLtoR (localize_text ((unsigned char**)&new->current_text), ! XmFONTLIST_DEFAULT_TAG); ! XmCSTextSetString(read->read_text, str); ! XmStringFree (str); ! } } else ! { ! XmString str = XmStringCreateLtoR (MLGetLocalized (XtNmsgBinaryMessage, ! MsgBinaryMessage), ! XmFONTLIST_DEFAULT_TAG); ! XmCSTextSetString(read->read_text, str); ! XmStringFree (str); ! } XtSetKeyboardFocus(read->shell, read->read_text); *************** *** 2737,2741 **** return; } - - - --- 2772,2773 ---- *** src/textfncs.c- Wed Jan 1 16:28:24 1997 --- src/textfncs.c Wed Jan 1 18:44:32 1997 *************** *** 2664,2671 **** } ! ! ! ! ! ! --- 2664,2805 ---- } ! /* ! * convert the text to localized text ! * and replace the text with it ! * convert SJIS to EUC if japanese ! */ ! #ifdef __STDC__ ! unsigned char *localize_text(unsigned char **text) ! #else ! unsigned char *localize_text(text) ! unsigned char **text; ! #endif ! { ! int i, o; ! unsigned char *new_text; ! int length; ! int kanji; ! ! if (!preferences.japanese || !getenv(ML_SETLANG)) return *text; ! ! length = strlen(*text); ! new_text = fs_get (length +2); ! kanji = 0; ! i =0; ! o =0; ! while (i<length) ! { ! /* wait for kanji escape */ ! if (kanji) ! { ! /* ! * is the third one B or J ? never will find it out ! */ ! if (length>i-2 && (*text)[i] == '\033' ! && (*text)[i+1] == '(' ) ! { ! kanji=0; i+=3; ! } ! else if (length>i-1) ! { ! /* one byte escape */ ! if ((*text)[i] <= ' ' || (*text)[i] >= 0x80) ! { ! new_text[o++] = (*text)[i++]; ! } ! else ! { ! new_text[o++] = (*text)[i++] | 0x80; ! new_text[o++] = (*text)[i++] | 0x80; ! } ! } ! else /* recovery */ ! { ! kanji = 0; ! } ! } ! else ! { ! if (length>i-2 && (*text)[i] == '\033' && ! (*text)[i+1] == '$') ! { ! kanji=1; i+=3; ! } ! else ! { ! new_text[o++] = (*text)[i++]; ! } ! } ! } ! new_text[o++] = 0; ! fs_give ((void **)text); ! *text = new_text; ! return *text; ! } ! ! /* ! * convert the text from localized text to mail format ! * convert EUC to SJIS if japanese ! */ ! #ifdef __STDC__ ! unsigned char* unlocalize_text (unsigned char **text) ! #else ! unsigned char* unlocalize_text (text) ! unsigned char **text; ! #endif ! { ! int i, o; ! int length; ! int kanji; ! unsigned char *new_text; ! ! if (!preferences.japanese || !getenv (ML_SETLANG)) return *text; ! ! /* ! * worst case ! */ ! new_text = fs_get (strlen (*text) * 4 +1); ! kanji = 0; ! i =0; ! o =0; ! length = strlen(*text); ! while (i<length) ! { ! /* wait for kanji escape */ ! if (kanji) ! { ! if (length>i-1 && (*text)[i] > 0x80 && ! (*text)[i+1] > 0x80 ) ! { ! new_text[o++] = (*text)[i++] & 0x7f; ! new_text[o++] = (*text)[i++] & 0x7f; ! } ! else /* recovery */ ! { ! new_text[o++] = '\033'; ! new_text[o++] = '('; ! new_text[o++] = 'B'; ! kanji = 0; ! } ! } ! else ! { ! if (length>i-1 && (*text)[i] > 0x80 && ! (*text)[i+1] > 0x80 ) ! { ! new_text[o++] = '\033'; ! new_text[o++] = '$'; ! new_text[o++] = 'B'; ! kanji = 1; ! } ! else ! { ! new_text[o++] = (*text)[i++]; ! } ! } ! } ! new_text[o++] = 0; ! fs_give ((void **)text); ! *text = new_text; ! return *text; ! } *** src/ml.h- Wed Jan 1 16:28:24 1997 --- src/ml.h Wed Jan 1 15:27:32 1997 *************** *** 22,25 **** --- 22,26 ---- #include <time.h> + #ifdef STRICT_BSD #include <sys/dir.h> *************** *** 54,57 **** --- 55,59 ---- #include <Xm/DialogS.h> #include <Xm/TextF.h> + #include <Xm/CSText.h> #include <Xm/List.h> #include <Xm/PanedW.h> *** src/preferences.c- Wed Jan 1 16:28:24 1997 --- src/preferences.c Wed Jan 1 05:35:25 1997 *************** *** 199,202 **** --- 199,206 ---- XtOffset(Preferences*,note_save), XtRString, (void*) DEFAULT_RESOURCE_NOTE_SAVE }, + { "japanese","Japanese", + XtRBoolean, sizeof(Boolean), + XtOffset(Preferences*,japanese), + XtRBoolean, (void *) &default_false }, { "auto_open", "Auto_open", XtRBoolean, sizeof (Boolean), *** src/prototypes.h- Wed Jan 1 16:28:24 1997 --- src/prototypes.h Wed Jan 1 15:33:27 1997 *************** *** 3853,3856 **** --- 3853,3868 ---- extern char *add_prefix(); #endif + #ifdef __STDC__ + extern unsigned char *localize_text(unsigned char **text) + ; + #else + extern unsigned char *localize_text(); + #endif + #ifdef __STDC__ + extern unsigned char* unlocalize_text (unsigned char **text) + ; + #else + extern unsigned char* unlocalize_text (); + #endif /* view.c */ #ifdef __STDC__ *** src/resources.c- Wed Jan 1 16:28:24 1997 --- src/resources.c Wed Jan 1 05:29:21 1997 *************** *** 813,816 **** --- 813,817 ---- "*mbox_cancel_btn.labelString: Cancel", "*mbox_dismiss_btn.labelString: Dismiss", + "*Japanese: True", NULL, };
Home | Main Index | Thread Index
- Prev by Date: kinput2 with mule
- Next by Date: Debian 1.2 / Mule input
- Prev by thread: kinput2 with mule
- Next by thread: Debian 1.2 / Mule input
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links