Changeset 1645
- Timestamp:
- 02/17/98 01:45:16 (11 years ago)
- Files:
-
- branches/GNU/src/w32proc.c (modified) (10 diffs)
- branches/GNU/src/w32select.c (modified) (13 diffs)
- branches/GNU/src/xdisp.c (modified) (1 diff)
- branches/fsf/src/ccl.c (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/GNU/src/w32proc.c
r1641 r1645 304 304 305 305 static BOOL 306 create_child (char *exe, char *cmdline, char *env, int is_gui_app,306 create_child (char *exe, char *cmdline, char *env, 307 307 int * pPid, child_process *cp) 308 308 { … … 319 319 320 320 #ifdef HAVE_NTGUI 321 if (NILP (Vw32_start_process_show_window) && !is_gui_app)321 if (NILP (Vw32_start_process_show_window)) 322 322 start.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; 323 323 else … … 569 569 570 570 void 571 w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app , int * is_gui_app)571 w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app) 572 572 { 573 573 file_data executable; … … 577 577 *is_dos_app = FALSE; 578 578 *is_cygnus_app = FALSE; 579 *is_gui_app = FALSE;580 579 581 580 if (!open_input_file (&executable, filename)) … … 598 597 p = egetenv ("COMSPEC"); 599 598 if (p) 600 w32_executable_type (p, is_dos_app, is_cygnus_app , is_gui_app);599 w32_executable_type (p, is_dos_app, is_cygnus_app); 601 600 } 602 601 else … … 650 649 } 651 650 } 652 653 /* Check whether app is marked as a console or windowed (aka654 GUI) app. Accept Posix and OS2 subsytem apps as console655 apps. */656 *is_gui_app = (nt_header->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI);657 651 } 658 652 } … … 716 710 int pid; 717 711 child_process *cp; 718 int is_dos_app, is_cygnus_app , is_gui_app;712 int is_dos_app, is_cygnus_app; 719 713 int do_quoting = 0; 720 714 char escape_char; … … 758 752 was compiled with the Cygnus GNU toolchain and hence relies on 759 753 cygwin.dll to parse the command line - we use this to decide how to 760 escape quote chars in command line args that must be quoted). 761 762 Also determine whether it is a GUI app, so that we don't hide its 763 initial window unless specifically requested. */ 764 w32_executable_type (cmdname, &is_dos_app, &is_cygnus_app, &is_gui_app); 754 escape quote chars in command line args that must be quoted). */ 755 w32_executable_type (cmdname, &is_dos_app, &is_cygnus_app); 765 756 766 757 /* On Windows 95, if cmdname is a DOS app, we invoke a helper … … 987 978 988 979 /* Now create the process. */ 989 if (!create_child (cmdname, cmdline, env, is_gui_app,&pid, cp))980 if (!create_child (cmdname, cmdline, env, &pid, cp)) 990 981 { 991 982 delete_child (cp); … … 2149 2140 &Vw32_start_process_show_window, 2150 2141 "When nil, new child processes hide their windows.\n\ 2151 When non-nil, they show their window in the method of their choice.\n\ 2152 This variable doesn't affect GUI applications, which will never be hidden."); 2142 When non-nil, they show their window in the method of their choice."); 2153 2143 Vw32_start_process_show_window = Qnil; 2154 2144 branches/GNU/src/w32select.c
r1625 r1645 25 25 #include "w32term.h" /* for all of the w32 includes */ 26 26 #include "dispextern.h" /* frame.h seems to want this */ 27 #include "keyboard.h"28 27 #include "frame.h" /* Need this to get the X window of selected_frame */ 29 28 #include "blockinput.h" … … 38 37 static Lisp_Object Vselection_coding_system; 39 38 40 /* Coding system for the next communicating with other Windows programs. */39 /* Coding system for the next communicating with other X clients. */ 41 40 static Lisp_Object Vnext_selection_coding_system; 42 43 /* The last text we put into the clipboard. This is used to prevent44 passing back our own text from the clipboard, instead of using the45 kill ring. The former is undesirable because the clipboard data46 could be MULEtilated by inappropriately chosen47 (next-)selection-coding-system. For this reason, we must store the48 text *after* it was encoded/Unix-to-DOS-converted. */49 static unsigned char *last_clipboard_text = NULL;50 static size_t clipboard_storage_size = 0;51 41 52 42 #if 0 … … 137 127 /* Since we are now handling multilingual text, we must consider 138 128 encoding text for the clipboard. */ 139 int charset_info = find_charset_in_text (src, XSTRING (string)->size, 140 nbytes, NULL, Qnil); 141 142 if (charset_info == 0) 129 int charsets[MAX_CHARSET + 1]; 130 int num; 131 132 bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); 133 num = ((nbytes <= 1 /* Check the possibility of short cut. */ 134 || !STRING_MULTIBYTE (string) 135 || nbytes == XSTRING (string)->size) 136 ? 0 137 : find_charset_in_str (src, nbytes, charsets, Qnil, 0, 1)); 138 139 if (!num || (num == 1 && charsets[CHARSET_ASCII])) 143 140 { 144 141 /* No multibyte character in OBJ. We need not encode it. */ … … 184 181 else 185 182 { 186 /* We must encode contents of OBJ to the selection coding 187 system. */ 183 /* We must encode contents of OBJ to compound text format. 184 The format is compatible with what the target `STRING' 185 expects if OBJ contains only ASCII and Latin-1 186 characters. */ 188 187 int bufsize; 189 188 struct coding_system coding; … … 194 193 setup_coding_system 195 194 (Fcheck_coding_system (Vnext_selection_coding_system), &coding); 196 coding.src_multibyte = 1;197 coding.dst_multibyte = 0;198 195 Vnext_selection_coding_system = Qnil; 199 196 coding.mode |= CODING_MODE_LAST_BLOCK; … … 205 202 encode_coding (&coding, src, dst, nbytes, bufsize); 206 203 Vlast_coding_system_used = coding.symbol; 207 208 /* Stash away the data we are about to put into the clipboard, so we209 could later check inside Fw32_get_clipboard_data whether210 the clipboard still holds our data. */211 if (clipboard_storage_size < coding.produced)212 {213 clipboard_storage_size = coding.produced + 100;214 last_clipboard_text = (char *) xrealloc (last_clipboard_text,215 clipboard_storage_size);216 }217 if (last_clipboard_text)218 memcpy (last_clipboard_text, dst, coding.produced);219 220 204 GlobalUnlock (htext); 221 222 205 /* Shrink data block to actual size. */ 223 htext2 = GlobalReAlloc (htext, coding.produced, 224 GMEM_MOVEABLE | GMEM_DDESHARE); 206 htext2 = GlobalReAlloc (htext, coding.produced, GMEM_MOVEABLE | GMEM_DDESHARE); 225 207 if (htext2 != NULL) htext = htext2; 226 208 } … … 229 211 if (!OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL)) 230 212 goto error; 231 213 232 214 ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext); 233 215 … … 240 222 ok = FALSE; 241 223 if (htext) GlobalFree (htext); 242 if (last_clipboard_text) 243 *last_clipboard_text = '\0'; 244 224 245 225 done: 246 226 UNBLOCK_INPUT; … … 280 260 nbytes = strlen (src); 281 261 282 /* If the text in clipboard is identical to what we put there283 last time w32_set_clipboard_data was called, pretend there's no284 data in the clipboard. This is so we don't pass our own text285 from the clipboard (which might be troublesome if the killed286 text includes null characters). */287 if (last_clipboard_text288 && clipboard_storage_size >= nbytes289 && memcmp(last_clipboard_text, src, nbytes) == 0)290 goto closeclip;291 292 262 if ( 293 263 #if 1 … … 298 268 ) 299 269 { 270 #if 1 271 /* We have to assume clipboard might contain "compound" text (to 272 use the X terminology), since Emacs itself will default to 273 using iso-2022 encoding which doesn't contain non-ascii 274 characters. */ 275 require_decoding = 1; 276 #else 300 277 /* If the clipboard data contains any non-ascii code, we 301 278 need to decode it. */ … … 310 287 } 311 288 } 289 #endif 312 290 } 313 291 … … 322 300 setup_coding_system 323 301 (Fcheck_coding_system (Vnext_selection_coding_system), &coding); 324 coding.src_multibyte = 0;325 coding.dst_multibyte = 1;326 302 Vnext_selection_coding_system = Qnil; 327 303 coding.mode |= CODING_MODE_LAST_BLOCK; … … 330 306 decode_coding (&coding, src, buf, nbytes, bufsize); 331 307 Vlast_coding_system_used = coding.symbol; 332 ret = make_string_from_bytes ((char *) buf, 333 coding.produced_char, coding.produced); 308 truelen = (coding.fake_multibyte 309 ? multibyte_chars_in_text (buf, coding.produced) 310 : coding.produced_char); 311 ret = make_string_from_bytes ((char *) buf, truelen, coding.produced); 334 312 xfree (buf); 335 313 } branches/GNU/src/xdisp.c
r1617 r1645 1992 1992 XSETFASTINT (w->last_overlay_modified, 0); 1993 1993 if (startp < BEGV) startp = BEGV, startp_byte = BEGV_BYTE; 1994 if (startp > ZV) startp = ZV, startp _byte= ZV_BYTE;1994 if (startp > ZV) startp = ZV, startp = ZV_BYTE; 1995 1995 try_window (window, startp); 1996 1996 if (cursor_vpos < 0) branches/fsf/src/ccl.c
r837 r1645 628 628 #define CCL_NE 0x15 /* X = (X != Y) */ 629 629 630 #define CCL_ENCODE_SJIS 0x16 /* X = HIGHER_BYTE (SJIS (Y, Z)) 630 #define CCL_DECODE_SJIS 0x16 /* X = HIGHER_BYTE (DE-SJIS (Y, Z)) 631 r[7] = LOWER_BYTE (DE-SJIS (Y, Z)) */ 632 #define CCL_ENCODE_SJIS 0x17 /* X = HIGHER_BYTE (SJIS (Y, Z)) 631 633 r[7] = LOWER_BYTE (SJIS (Y, Z) */ 632 #define CCL_DECODE_SJIS 0x17 /* X = HIGHER_BYTE (DE-SJIS (Y, Z))633 r[7] = LOWER_BYTE (DE-SJIS (Y, Z)) */634 634 635 635 /* Terminate CCL program successfully. */ … … 637 637 do { \ 638 638 ccl->status = CCL_STAT_SUCCESS; \ 639 ccl->ic = CCL_HEADER_MAIN; \640 639 goto ccl_finish; \ 641 640 } while (0) … … 671 670 if (dst + len <= (dst_bytes ? dst_end : src)) \ 672 671 { \ 673 bcopy (str, dst, len); \ 674 dst += len; \ 672 while (len--) *dst++ = *str++; \ 675 673 } \ 676 674 else \ … … 710 708 711 709 710 /* Set C to the character code made from CHARSET and CODE. This is 711 like MAKE_CHAR but check the validity of CHARSET and CODE. If they 712 are not valid, set C to (CODE & 0xFF) because that is usually the 713 case that CCL_ReadMultibyteChar2 read an invalid code and it set 714 CODE to that invalid byte. */ 715 716 #define CCL_MAKE_CHAR(charset, code, c) \ 717 do { \ 718 if (charset == CHARSET_ASCII) \ 719 c = code & 0xFF; \ 720 else if (CHARSET_DEFINED_P (charset) \ 721 && (code & 0x7F) >= 32 \ 722 && (code < 256 || ((code >> 7) & 0x7F) >= 32)) \ 723 { \ 724 int c1 = code & 0x7F, c2 = 0; \ 725 \ 726 if (code >= 256) \ 727 c2 = c1, c1 = (code >> 7) & 0x7F; \ 728 c = MAKE_NON_ASCII_CHAR (charset, c1, c2); \ 729 } \ 730 else \ 731 c = code & 0xFF; \ 732 } while (0) 733 734 712 735 /* Execute CCL code on SRC_BYTES length text at SOURCE. The resulting 713 736 text goes to a place pointed by DESTINATION, the length of which … … 729 752 int ic; /* Instruction Counter. */ 730 753 }; 754 755 /* For the moment, we only support depth 256 of stack. */ 756 static struct ccl_prog_stack ccl_prog_stack_struct[256]; 731 757 732 758 int … … 745 771 int jump_address; 746 772 int i, j, op; 747 int stack_idx = 0;748 /* For the moment, we only support depth 256 of stack. */749 struct ccl_prog_stack ccl_prog_stack_struct[256];773 int stack_idx = ccl->stack_idx; 774 /* Instruction counter of the current CCL code. */ 775 int this_ic; 750 776 751 777 if (ic >= ccl->eof_ic) 752 778 ic = CCL_HEADER_MAIN; 779 780 if (ccl->buf_magnification ==0) /* We can't produce any bytes. */ 781 dst = NULL; 753 782 754 783 #ifdef CCL_DEBUG … … 777 806 } 778 807 808 this_ic = ic; 779 809 code = XINT (ccl_prog[ic]); ic++; 780 810 field1 = code >> 8; … … 898 928 j = XINT (ccl_prog[ic]); 899 929 op = field1 >> 6; 900 ic++;930 jump_address = ic + 1; 901 931 goto ccl_set_expr; 902 932 … … 918 948 j = reg[Rrr]; 919 949 op = field1 >> 6; 950 jump_address = ic; 920 951 goto ccl_set_expr; 921 952 … … 974 1005 break; 975 1006 } 1007 if (src) 1008 src = src_end; 1009 /* ccl->ic should points to this command code again to 1010 suppress further processing. */ 1011 ic--; 976 1012 CCL_SUCCESS; 977 1013 … … 1069 1105 case CCL_GE: reg[rrr] = i >= j; break; 1070 1106 case CCL_NE: reg[rrr] = i != j; break; 1107 case CCL_DECODE_SJIS: DECODE_SJIS (i, j, reg[rrr], reg[7]); break; 1071 1108 case CCL_ENCODE_SJIS: ENCODE_SJIS (i, j, reg[rrr], reg[7]); break; 1072 case CCL_DECODE_SJIS: DECODE_SJIS (i, j, reg[rrr], reg[7]); break;1073 1109 default: CCL_INVALID_CMD; 1074 1110 } … … 1078 1114 i = reg[rrr]; 1079 1115 CCL_WRITE_CHAR (i); 1116 ic = jump_address; 1080 1117 } 1081 1118 else if (!reg[rrr]) … … 1089 1126 if (!src) 1090 1127 CCL_INVALID_CMD; 1128 1091 1129 do { 1092 1130 if (src >= src_end) … … 1108 1146 else 1109 1147 ccl->private_state = COMPOSING_NO_RULE_HEAD; 1148 1149 continue; 1110 1150 } 1111 if (ccl->private_state != 0)1151 if (ccl->private_state != COMPOSING_NO) 1112 1152 { 1113 1153 /* composite character */ 1114 if ( *src< 0xA0)1115 ccl->private_state = 0;1154 if (i < 0xA0) 1155 ccl->private_state = COMPOSING_NO; 1116 1156 else 1117 1157 { 1158 if (COMPOSING_WITH_RULE_RULE == ccl->private_state) 1159 { 1160 ccl->private_state = COMPOSING_WITH_RULE_HEAD; 1161 continue; 1162 } 1163 else if (COMPOSING_WITH_RULE_HEAD == ccl->private_state) 1164 ccl->private_state = COMPOSING_WITH_RULE_RULE; 1165 1118 1166 if (i == 0xA0) 1119 1167 { … … 1124 1172 else 1125 1173 i -= 0x20; 1126 1127 if (COMPOSING_WITH_RULE_RULE == ccl->private_state)1128 {1129 ccl->private_state = COMPOSING_WITH_RULE_HEAD;1130 continue;1131 }1132 else if (COMPOSING_WITH_RULE_HEAD == ccl->private_state)1133 ccl->private_state = COMPOSING_WITH_RULE_RULE;1134 1174 } 1135 1175 } 1176 1136 1177 if (i < 0x80) 1137 1178 { … … 1176 1217 else 1177 1218 { 1178 /* INVALID CODE 1179 Returned charset is -1. */1180 reg[ RRR] = -1;1219 /* INVALID CODE. Return a single byte character. */ 1220 reg[RRR] = CHARSET_ASCII; 1221 reg[rrr] = i; 1181 1222 } 1182 } while (0); 1223 break; 1224 } while (1); 1183 1225 break; 1184 1226 … … 1198 1240 i = reg[RRR]; /* charset */ 1199 1241 if (i == CHARSET_ASCII) 1200 i = reg[rrr] & 0x 7F;1242 i = reg[rrr] & 0xFF; 1201 1243 else if (i == CHARSET_COMPOSITION) 1202 1244 i = MAKE_COMPOSITE_CHAR (reg[rrr]); … … 1214 1256 case CCL_TranslateCharacter: 1215 1257 i = reg[RRR]; /* charset */ 1216 if (i == CHARSET_ASCII) 1217 i = reg[rrr] & 0x7F; 1218 else if (i == CHARSET_COMPOSITION) 1258 if (i == CHARSET_COMPOSITION) 1219 1259 { 1220 1260 reg[RRR] = -1; 1221 1261 break; 1222 1262 } 1223 else if (CHARSET_DIMENSION (i) == 1) 1224 i = ((i - 0x70) << 7) | (reg[rrr] & 0x7F); 1225 else if (i < MIN_CHARSET_PRIVATE_DIMENSION2) 1226 i = ((i - 0x8F) << 14) | (reg[rrr] & 0x3FFF); 1227 else 1228 i = ((i - 0xE0) << 14) | (reg[rrr] & 0x3FFF); 1229 1263 CCL_MAKE_CHAR (i, reg[rrr], i); 1230 1264 op = translate_char (GET_TRANSLATION_TABLE (reg[Rrr]), 1231 1265 i, -1, 0, 0); … … 1241 1275 ic++; 1242 1276 i = reg[RRR]; /* charset */ 1243 if (i == CHARSET_ASCII) 1244 i = reg[rrr] & 0x7F; 1245 else if (i == CHARSET_COMPOSITION) 1277 if (i == CHARSET_COMPOSITION) 1246 1278 { 1247 1279 reg[RRR] = -1; 1248 1280 break; 1249 1281 } 1250 else if (CHARSET_DIMENSION (i) == 1) 1251 i = ((i - 0x70) << 7) | (reg[rrr] & 0x7F); 1252 else if (i < MIN_CHARSET_PRIVATE_DIMENSION2) 1253 i = ((i - 0x8F) << 14) | (reg[rrr] & 0x3FFF); 1254 else 1255 i = ((i - 0xE0) << 14) | (reg[rrr] & 0x3FFF); 1256 1282 CCL_MAKE_CHAR (i, reg[rrr], i); 1257 1283 op = translate_char (GET_TRANSLATION_TABLE (op), i, -1, 0, 0); 1258 1284 SPLIT_CHAR (op, reg[RRR], i, j); … … 1461 1487 else if (EQ (content, Qlambda)) 1462 1488 { 1489 reg[RRR] = i; 1463 1490 break; 1464 1491 } … … 1503 1530 else 1504 1531 { 1532 reg[RRR] = 0; 1505 1533 content = XVECTOR (map)->contents[point]; 1506 1534 if (NILP (content)) … … 1508 1536 else if (NUMBERP (content)) 1509 1537 reg[rrr] = XINT (content); 1510 else if (EQ (content, Qt)) 1511 reg[RRR] = i; 1538 else if (EQ (content, Qt)); 1512 1539 else if (CONSP (content)) 1513 1540 { … … 1544 1571 int msglen; 1545 1572 1573 if (!dst) 1574 dst = destination; 1575 1546 1576 switch (ccl->status) 1547 1577 { 1548 1578 case CCL_STAT_INVALID_CMD: 1549 1579 sprintf(msg, "\nCCL: Invalid command %x (ccl_code = %x) at %d.", 1550 code & 0x1F, code, ic);1580 code & 0x1F, code, this_ic); 1551 1581 #ifdef CCL_DEBUG 1552 1582 { … … 1555 1585 1556 1586 msglen = strlen (msg); 1557 if (dst + msglen <= dst_end)1587 if (dst + msglen <= (dst_bytes ? dst_end : src)) 1558 1588 { 1559 1589 bcopy (msg, dst, msglen); … … 1568 1598 sprintf(msg, " %d", ccl_backtrace_table[i]); 1569 1599 msglen = strlen (msg); 1570 if (dst + msglen > dst_end)1600 if (dst + msglen > (dst_bytes ? dst_end : src)) 1571 1601 break; 1572 1602 bcopy (msg, dst, msglen); 1573 1603 dst += msglen; 1574 1604 } 1605 goto ccl_finish; 1575 1606 } 1576 1607 #endif 1577 goto ccl_finish;1608 break; 1578 1609 1579 1610 case CCL_STAT_QUIT: … … 1586 1617 1587 1618 msglen = strlen (msg); 1588 if (dst + msglen <= dst_end)1619 if (dst + msglen <= (dst_bytes ? dst_end : src)) 1589 1620 { 1590 1621 bcopy (msg, dst, msglen); … … 1595 1626 ccl_finish: 1596 1627 ccl->ic = ic; 1628 ccl->stack_idx = stack_idx; 1629 ccl->prog = ccl_prog; 1597 1630 if (consumed) *consumed = src - source; 1598 return dst - destination;1631 return (dst ? dst - destination : 0); 1599 1632 } 1600 1633 1601 1634 /* Setup fields of the structure pointed by CCL appropriately for the 1602 execution of compiled CCL code in VEC (vector of integer). */ 1635 execution of compiled CCL code in VEC (vector of integer). 1636 If VEC is nil, we skip setting ups based on VEC. */ 1603 1637 void 1604 1638 setup_ccl_program (ccl, vec) … … 1608 1642 int i; 1609 1643 1610 ccl->size = XVECTOR (vec)->size; 1611 ccl->prog = XVECTOR (vec)->contents; 1644 if (VECTORP (vec)) 1645 { 1646 struct Lisp_Vector *vp = XVECTOR (vec); 1647 1648 ccl->size = vp->size; 1649 ccl->prog = vp->contents; 1650 ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]); 1651 ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]); 1652 } 1612 1653 ccl->ic = CCL_HEADER_MAIN; 1613 ccl->eof_ic = XINT (XVECTOR (vec)->contents[CCL_HEADER_EOF]);1614 ccl->buf_magnification = XINT (XVECTOR (vec)->contents[CCL_HEADER_BUF_MAG]);1615 1654 for (i = 0; i < 8; i++) 1616 1655 ccl->reg[i] = 0; … … 1618 1657 ccl->private_state = 0; 1619 1658 ccl->status = 0; 1659 ccl->stack_idx = 0; 1620 1660 } 1621 1661
