diff -rcN ../mgdiff/Imakefile ./Imakefile *** ../mgdiff/Imakefile Thu May 19 11:01:00 1994 --- ./Imakefile Tue Apr 21 21:23:47 1998 *************** *** 8,14 **** XCOMM XCOMM for Dell SVR4 XCOMM ! EXTRA_LIBRARIES = -lc -lucb SRCS = mgdiff.c rundiff.c misc.c files.c spawn.c manual.c modal.c legend.c OBJS = mgdiff.o rundiff.o misc.o files.o spawn.o manual.o modal.o legend.o --- 8,15 ---- XCOMM XCOMM for Dell SVR4 XCOMM ! DEFINES = -DI18N -I/usr/ucbinclude -L/usr/ucblib ! EXTRA_LIBRARIES = -lc -lucb -lsocket -lnsl SRCS = mgdiff.c rundiff.c misc.c files.c spawn.c manual.c modal.c legend.c OBJS = mgdiff.o rundiff.o misc.o files.o spawn.o manual.o modal.o legend.o diff -rcN ../mgdiff/files.c ./files.c *** ../mgdiff/files.c Thu May 19 11:01:06 1994 --- ./files.c Tue Apr 21 13:20:20 1998 *************** *** 90,99 **** --- 90,103 ---- bytes = read (fd, (void *) buffer, 1024); (void) close (fd); + #ifdef I18N + return 1; + #else for (i = 0; i < bytes; i++) if (!isascii (buffer[i])) return (0); return (1); + #endif } /* diff -rcN ../mgdiff/mgdiff.c ./mgdiff.c *** ../mgdiff/mgdiff.c Thu Sep 29 10:56:53 1994 --- ./mgdiff.c Tue Apr 21 21:57:53 1998 *************** *** 146,151 **** --- 146,154 ---- static char *diffcmd; static char *diffargs; + #ifdef I18N + static XFontSet fs = NULL; + #endif static int font_height = 10; static int font_width; static int font_descent; *************** *** 307,317 **** --- 310,346 ---- XtGetApplicationResources (toplevel, &gc_values, resources, XtNumber (resources), NULL, 0); xfs = XQueryFont (XtDisplay (w), gc_values.font); + #ifdef I18N + { + char **miss, *def; + int n_miss; + + fs = XCreateFontSet(XtDisplay(w), "-*-fixed-medium-r-normal--14-*", + &miss, &n_miss, &def); + if (!fs) + XCreateFontSet(XtDisplay(w), XtDefaultFontSet, + &miss, &n_miss, &def); + } + { + XRectangle ink, log; + + XmbTextExtents(fs, "W", strlen("W"), &ink, &log); + + font_descent = 2; + font_width = log.width; + font_height = log.height + 1; + font_mono = 0; + + XmbTextExtents(fs, di->longline, strlen(di->longline), &ink, &log); + font_widestline = log.width; + } + #else font_descent = xfs->descent; font_height = xfs->ascent + xfs->descent; font_width = xfs->max_bounds.width; font_mono = ((xfs->per_char == NULL) || (xfs->min_bounds.width == xfs->max_bounds.width)); font_widestline = XTextWidth (xfs, di->longline, strlen (di->longline)); + #endif XFreeFontInfo (NULL, xfs, 1); XtVaGetValues (w, XmNbackground, &gc_values.background, NULL); *************** *** 462,495 **** --- 491,550 ---- if (ths->text != NULL) { if (XRectInRegion (region, 0, stemp - font_height, width, font_height) != RectangleOut) { if (font_mono) { + #ifdef I18N + XmbDrawString(XtDisplay(w), XtWindow(w), fs, fore, + 0, stemp - font_descent, + &ths->text[j][newss.leftcol], + min(ths->tlen[j] - newss.leftcol, columns)); + #else XDrawString (XtDisplay (w), XtWindow (w), fore, 0, stemp - font_descent, &ths->text[j][newss.leftcol], min (ths->tlen[j] - newss.leftcol, columns)); + #endif } else { + #ifdef I18N + XmbDrawString(XtDisplay(w), XtWindow(w), fs, fore, + -newss.leftcol, stemp - font_descent, + ths->text[j], ths->tlen[j]); + #else XDrawString (XtDisplay (w), XtWindow (w), fore, -newss.leftcol, stemp - font_descent, ths->text[j], ths->tlen[j]); + #endif } } } else if (oth->text != NULL) { if (XRectInRegion (region, 0, stemp - font_height, width, font_height) != RectangleOut) { if (font_mono) { + #ifdef I18N + XmbDrawString(XtDisplay(w), XtWindow(w), fs, fore, + 0, stemp - font_descent, + &oth->text[j][newss.leftcol], + min(oth->tlen[j] - newss.leftcol, columns)); + #else XDrawString (XtDisplay (w), XtWindow (w), fore, 0, stemp - font_descent, &oth->text[j][newss.leftcol], min (oth->tlen[j] - newss.leftcol, columns)); + #endif } else { + #ifdef I18N + XmbDrawString(XtDisplay(w), XtWindow(w), fs, fore, + -newss.leftcol, stemp - font_descent, + oth->text[j], oth->tlen[j]); + #else XDrawString (XtDisplay (w), XtWindow (w), fore, -newss.leftcol, stemp - font_descent, oth->text[j], oth->tlen[j]); + #endif } } } *************** *** 1020,1025 **** --- 1075,1084 ---- progname = basename (argv[0]); + #ifdef I18N + XtSetLanguageProc( NULL, NULL, NULL ); + #endif + toplevel = XtVaAppInitialize (&app, "Mgdiff", option_table, XtNumber (option_table), #if X11R5 &argc, *************** *** 1087,1093 **** else XtAppSetWarningHandler (app, xt_warning_handler); ! #if sun (void) on_exit (cleanup_at_exit, NULL); #else (void) atexit (cleanup_at_exit); --- 1146,1152 ---- else XtAppSetWarningHandler (app, xt_warning_handler); ! #ifdef NO_ATEXIT (void) on_exit (cleanup_at_exit, NULL); #else (void) atexit (cleanup_at_exit); diff -rcN ../mgdiff/rundiff.c ./rundiff.c *** ../mgdiff/rundiff.c Thu May 19 11:01:22 1994 --- ./rundiff.c Tue Apr 21 21:13:19 1998 *************** *** 524,529 **** --- 524,568 ---- { int len, i, tabs, ctrls; + #ifdef I18N + /* + * compute length of new string, taking tabs + */ + for (i = 0, len = 0, ctrls = tabs = 0; s[i] != '\0'; i++) { + if (isascii (s[i])) { + if (s[i] == '\t') { + tabs++; + len += 8; + len /= 8; + len *= 8; + } else + len++; + } else + len++; + } + + if (tabs) { + char *ret = (char *) calloc (1, len + 1); + int j; + + for (i = 0, j = 0; s[i] != '\0'; i++) { + if (isascii (s[i])) { + if (s[i] == '\t') { + ret[j++] = ' '; + while ((j % 8) != 0) + ret[j++] = ' '; + } else + ret[j++] = s[i]; + } else + ret[j++] = s[i]; + } + *flag = True; + return ret; + } else { + *flag = False; + return strdup(s); + } + #else /* * compute length of new string, taking tabs and control * characters into account *************** *** 587,592 **** --- 626,632 ---- *flag = False; return (strdup (s)); } + #endif } /*