aboutsummaryrefslogtreecommitdiffstats
path: root/src/character.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-07-04 00:50:25 -0700
committerDan Nicolaescu2010-07-04 00:50:25 -0700
commit971de7fb158335fbda39525feb2d7776a26bc030 (patch)
tree605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/character.c
parentb8463cbfbe2c5183cf40772df2746e58b787ddeb (diff)
downloademacs-971de7fb158335fbda39525feb2d7776a26bc030.tar.gz
emacs-971de7fb158335fbda39525feb2d7776a26bc030.zip
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C. * src/atimer.c: * src/bidi.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/ccl.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/doprnt.c: * src/ecrt0.c: * src/editfns.c: * src/fileio.c: * src/filelock.c: * src/filemode.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/ftfont.c: * src/ftxfont.c: * src/gtkutil.c: * src/indent.c: * src/insdel.c: * src/intervals.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/md5.c: * src/menu.c: * src/minibuf.c: * src/prefix-args.c: * src/print.c: * src/ralloc.c: * src/regex.c: * src/region-cache.c: * src/scroll.c: * src/search.c: * src/sound.c: * src/strftime.c: * src/syntax.c: * src/sysdep.c: * src/termcap.c: * src/terminal.c: * src/terminfo.c: * src/textprop.c: * src/tparam.c: * src/undo.c: * src/unexelf.c: * src/window.c: * src/xfaces.c: * src/xfns.c: * src/xfont.c: * src/xftfont.c: * src/xgselect.c: * src/xmenu.c: * src/xrdb.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: * src/xterm.c: Likewise.
Diffstat (limited to 'src/character.c')
-rw-r--r--src/character.c75
1 files changed, 20 insertions, 55 deletions
diff --git a/src/character.c b/src/character.c
index 7cd1eedcef4..a6c38df9e85 100644
--- a/src/character.c
+++ b/src/character.c
@@ -93,8 +93,7 @@ Lisp_Object Vunicode_category_table;
93 character code if possible. Return the resulting code. */ 93 character code if possible. Return the resulting code. */
94 94
95int 95int
96char_resolve_modifier_mask (c) 96char_resolve_modifier_mask (int c)
97 int c;
98{ 97{
99 /* A non-ASCII character can't reflect modifier bits to the code. */ 98 /* A non-ASCII character can't reflect modifier bits to the code. */
100 if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK))) 99 if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
@@ -143,9 +142,7 @@ char_resolve_modifier_mask (c)
143 handle them appropriately. */ 142 handle them appropriately. */
144 143
145int 144int
146char_string (c, p) 145char_string (unsigned int c, unsigned char *p)
147 unsigned c;
148 unsigned char *p;
149{ 146{
150 int bytes; 147 int bytes;
151 148
@@ -199,10 +196,7 @@ char_string (c, p)
199 character) of the multibyte form. */ 196 character) of the multibyte form. */
200 197
201int 198int
202string_char (p, advanced, len) 199string_char (const unsigned char *p, const unsigned char **advanced, int *len)
203 const unsigned char *p;
204 const unsigned char **advanced;
205 int *len;
206{ 200{
207 int c; 201 int c;
208 const unsigned char *saved_p = p; 202 const unsigned char *saved_p = p;
@@ -245,9 +239,7 @@ string_char (p, advanced, len)
245 case, translace C by all tables. */ 239 case, translace C by all tables. */
246 240
247int 241int
248translate_char (table, c) 242translate_char (Lisp_Object table, int c)
249 Lisp_Object table;
250 int c;
251{ 243{
252 if (CHAR_TABLE_P (table)) 244 if (CHAR_TABLE_P (table))
253 { 245 {
@@ -272,9 +264,7 @@ translate_char (table, c)
272 future. */ 264 future. */
273 265
274int 266int
275multibyte_char_to_unibyte (c, rev_tbl) 267multibyte_char_to_unibyte (int c, Lisp_Object rev_tbl)
276 int c;
277 Lisp_Object rev_tbl;
278{ 268{
279 if (c < 0x80) 269 if (c < 0x80)
280 return c; 270 return c;
@@ -287,8 +277,7 @@ multibyte_char_to_unibyte (c, rev_tbl)
287 by charset_unibyte. */ 277 by charset_unibyte. */
288 278
289int 279int
290multibyte_char_to_unibyte_safe (c) 280multibyte_char_to_unibyte_safe (int c)
291 int c;
292{ 281{
293 if (c < 0x80) 282 if (c < 0x80)
294 return c; 283 return c;
@@ -446,9 +435,7 @@ c_string_width (const unsigned char *str, int len, int precision, int *nchars, i
446 occupies on the screen. */ 435 occupies on the screen. */
447 436
448int 437int
449strwidth (str, len) 438strwidth (unsigned char *str, int len)
450 unsigned char *str;
451 int len;
452{ 439{
453 return c_string_width (str, len, -1, NULL, NULL); 440 return c_string_width (str, len, -1, NULL, NULL);
454} 441}
@@ -461,9 +448,7 @@ strwidth (str, len)
461 in *NCHARS and *NBYTES respectively. */ 448 in *NCHARS and *NBYTES respectively. */
462 449
463int 450int
464lisp_string_width (string, precision, nchars, nbytes) 451lisp_string_width (Lisp_Object string, int precision, int *nchars, int *nbytes)
465 Lisp_Object string;
466 int precision, *nchars, *nbytes;
467{ 452{
468 int len = SCHARS (string); 453 int len = SCHARS (string);
469 /* This set multibyte to 0 even if STRING is multibyte when it 454 /* This set multibyte to 0 even if STRING is multibyte when it
@@ -573,9 +558,7 @@ usage: (char-direction CHAR) */)
573 nil, we treat each byte as a character. */ 558 nil, we treat each byte as a character. */
574 559
575EMACS_INT 560EMACS_INT
576chars_in_text (ptr, nbytes) 561chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
577 const unsigned char *ptr;
578 EMACS_INT nbytes;
579{ 562{
580 /* current_buffer is null at early stages of Emacs initialization. */ 563 /* current_buffer is null at early stages of Emacs initialization. */
581 if (current_buffer == 0 564 if (current_buffer == 0
@@ -591,9 +574,7 @@ chars_in_text (ptr, nbytes)
591 ignores enable-multibyte-characters. */ 574 ignores enable-multibyte-characters. */
592 575
593EMACS_INT 576EMACS_INT
594multibyte_chars_in_text (ptr, nbytes) 577multibyte_chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
595 const unsigned char *ptr;
596 EMACS_INT nbytes;
597{ 578{
598 const unsigned char *endp = ptr + nbytes; 579 const unsigned char *endp = ptr + nbytes;
599 int chars = 0; 580 int chars = 0;
@@ -618,9 +599,7 @@ multibyte_chars_in_text (ptr, nbytes)
618 represented by 2-byte in a multibyte text. */ 599 represented by 2-byte in a multibyte text. */
619 600
620void 601void
621parse_str_as_multibyte (str, len, nchars, nbytes) 602parse_str_as_multibyte (const unsigned char *str, int len, int *nchars, int *nbytes)
622 const unsigned char *str;
623 int len, *nchars, *nbytes;
624{ 603{
625 const unsigned char *endp = str + len; 604 const unsigned char *endp = str + len;
626 int n, chars = 0, bytes = 0; 605 int n, chars = 0, bytes = 0;
@@ -662,9 +641,7 @@ parse_str_as_multibyte (str, len, nchars, nbytes)
662 resulting text. */ 641 resulting text. */
663 642
664int 643int
665str_as_multibyte (str, len, nbytes, nchars) 644str_as_multibyte (unsigned char *str, int len, int nbytes, int *nchars)
666 unsigned char *str;
667 int len, nbytes, *nchars;
668{ 645{
669 unsigned char *p = str, *endp = str + nbytes; 646 unsigned char *p = str, *endp = str + nbytes;
670 unsigned char *to; 647 unsigned char *to;
@@ -740,9 +717,7 @@ str_as_multibyte (str, len, nbytes, nchars)
740 `str_to_multibyte'. */ 717 `str_to_multibyte'. */
741 718
742int 719int
743parse_str_to_multibyte (str, len) 720parse_str_to_multibyte (unsigned char *str, int len)
744 unsigned char *str;
745 int len;
746{ 721{
747 unsigned char *endp = str + len; 722 unsigned char *endp = str + len;
748 int bytes; 723 int bytes;
@@ -760,9 +735,7 @@ parse_str_to_multibyte (str, len)
760 enough. */ 735 enough. */
761 736
762int 737int
763str_to_multibyte (str, len, bytes) 738str_to_multibyte (unsigned char *str, int len, int bytes)
764 unsigned char *str;
765 int len, bytes;
766{ 739{
767 unsigned char *p = str, *endp = str + bytes; 740 unsigned char *p = str, *endp = str + bytes;
768 unsigned char *to; 741 unsigned char *to;
@@ -791,9 +764,7 @@ str_to_multibyte (str, len, bytes)
791 unibyte. */ 764 unibyte. */
792 765
793int 766int
794str_as_unibyte (str, bytes) 767str_as_unibyte (unsigned char *str, int bytes)
795 unsigned char *str;
796 int bytes;
797{ 768{
798 const unsigned char *p = str, *endp = str + bytes; 769 const unsigned char *p = str, *endp = str + bytes;
799 unsigned char *to; 770 unsigned char *to;
@@ -835,11 +806,7 @@ str_as_unibyte (str, bytes)
835 Note: Currently the arg ACCEPT_LATIN_1 is not used. */ 806 Note: Currently the arg ACCEPT_LATIN_1 is not used. */
836 807
837EMACS_INT 808EMACS_INT
838str_to_unibyte (src, dst, chars, accept_latin_1) 809str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, int accept_latin_1)
839 const unsigned char *src;
840 unsigned char *dst;
841 EMACS_INT chars;
842 int accept_latin_1;
843{ 810{
844 EMACS_INT i; 811 EMACS_INT i;
845 812
@@ -859,8 +826,7 @@ str_to_unibyte (src, dst, chars, accept_latin_1)
859 826
860 827
861int 828int
862string_count_byte8 (string) 829string_count_byte8 (Lisp_Object string)
863 Lisp_Object string;
864{ 830{
865 int multibyte = STRING_MULTIBYTE (string); 831 int multibyte = STRING_MULTIBYTE (string);
866 int nbytes = SBYTES (string); 832 int nbytes = SBYTES (string);
@@ -890,8 +856,7 @@ string_count_byte8 (string)
890 856
891 857
892Lisp_Object 858Lisp_Object
893string_escape_byte8 (string) 859string_escape_byte8 (Lisp_Object string)
894 Lisp_Object string;
895{ 860{
896 int nchars = SCHARS (string); 861 int nchars = SCHARS (string);
897 int nbytes = SBYTES (string); 862 int nbytes = SBYTES (string);
@@ -1088,14 +1053,14 @@ character is not ASCII nor 8-bit character, an error is signalled. */)
1088 1053
1089 1054
1090void 1055void
1091init_character_once () 1056init_character_once (void)
1092{ 1057{
1093} 1058}
1094 1059
1095#ifdef emacs 1060#ifdef emacs
1096 1061
1097void 1062void
1098syms_of_character () 1063syms_of_character (void)
1099{ 1064{
1100 DEFSYM (Qcharacterp, "characterp"); 1065 DEFSYM (Qcharacterp, "characterp");
1101 DEFSYM (Qauto_fill_chars, "auto-fill-chars"); 1066 DEFSYM (Qauto_fill_chars, "auto-fill-chars");