diff options
| author | Dan Nicolaescu | 2010-07-04 00:50:25 -0700 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-07-04 00:50:25 -0700 |
| commit | 971de7fb158335fbda39525feb2d7776a26bc030 (patch) | |
| tree | 605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/sound.c | |
| parent | b8463cbfbe2c5183cf40772df2746e58b787ddeb (diff) | |
| download | emacs-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/sound.c')
| -rw-r--r-- | src/sound.c | 99 |
1 files changed, 29 insertions, 70 deletions
diff --git a/src/sound.c b/src/sound.c index b362fc8819e..6fa6f548917 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -328,8 +328,7 @@ static int do_play_sound (const char *, unsigned long); | |||
| 328 | /* Like perror, but signals an error. */ | 328 | /* Like perror, but signals an error. */ |
| 329 | 329 | ||
| 330 | static void | 330 | static void |
| 331 | sound_perror (msg) | 331 | sound_perror (char *msg) |
| 332 | char *msg; | ||
| 333 | { | 332 | { |
| 334 | int saved_errno = errno; | 333 | int saved_errno = errno; |
| 335 | 334 | ||
| @@ -347,8 +346,7 @@ sound_perror (msg) | |||
| 347 | /* Display a warning message. */ | 346 | /* Display a warning message. */ |
| 348 | 347 | ||
| 349 | static void | 348 | static void |
| 350 | sound_warning (msg) | 349 | sound_warning (char *msg) |
| 351 | char *msg; | ||
| 352 | { | 350 | { |
| 353 | message (msg); | 351 | message (msg); |
| 354 | } | 352 | } |
| @@ -381,9 +379,7 @@ sound_warning (msg) | |||
| 381 | range [0, 1]. */ | 379 | range [0, 1]. */ |
| 382 | 380 | ||
| 383 | static int | 381 | static int |
| 384 | parse_sound (sound, attrs) | 382 | parse_sound (Lisp_Object sound, Lisp_Object *attrs) |
| 385 | Lisp_Object sound; | ||
| 386 | Lisp_Object *attrs; | ||
| 387 | { | 383 | { |
| 388 | /* SOUND must be a list starting with the symbol `sound'. */ | 384 | /* SOUND must be a list starting with the symbol `sound'. */ |
| 389 | if (!CONSP (sound) || !EQ (XCAR (sound), Qsound)) | 385 | if (!CONSP (sound) || !EQ (XCAR (sound), Qsound)) |
| @@ -452,8 +448,7 @@ parse_sound (sound, attrs) | |||
| 452 | S is the sound file structure to fill in. */ | 448 | S is the sound file structure to fill in. */ |
| 453 | 449 | ||
| 454 | static void | 450 | static void |
| 455 | find_sound_type (s) | 451 | find_sound_type (struct sound *s) |
| 456 | struct sound *s; | ||
| 457 | { | 452 | { |
| 458 | if (!wav_init (s) && !au_init (s)) | 453 | if (!wav_init (s) && !au_init (s)) |
| 459 | error ("Unknown sound format"); | 454 | error ("Unknown sound format"); |
| @@ -463,8 +458,7 @@ find_sound_type (s) | |||
| 463 | /* Function installed by play-sound-internal with record_unwind_protect. */ | 458 | /* Function installed by play-sound-internal with record_unwind_protect. */ |
| 464 | 459 | ||
| 465 | static Lisp_Object | 460 | static Lisp_Object |
| 466 | sound_cleanup (arg) | 461 | sound_cleanup (Lisp_Object arg) |
| 467 | Lisp_Object arg; | ||
| 468 | { | 462 | { |
| 469 | if (current_sound_device->close) | 463 | if (current_sound_device->close) |
| 470 | current_sound_device->close (current_sound_device); | 464 | current_sound_device->close (current_sound_device); |
| @@ -484,8 +478,7 @@ sound_cleanup (arg) | |||
| 484 | to host byte-order. */ | 478 | to host byte-order. */ |
| 485 | 479 | ||
| 486 | static u_int32_t | 480 | static u_int32_t |
| 487 | le2hl (value) | 481 | le2hl (u_int32_t value) |
| 488 | u_int32_t value; | ||
| 489 | { | 482 | { |
| 490 | #ifdef WORDS_BIG_ENDIAN | 483 | #ifdef WORDS_BIG_ENDIAN |
| 491 | unsigned char *p = (unsigned char *) &value; | 484 | unsigned char *p = (unsigned char *) &value; |
| @@ -499,8 +492,7 @@ le2hl (value) | |||
| 499 | to host byte-order. */ | 492 | to host byte-order. */ |
| 500 | 493 | ||
| 501 | static u_int16_t | 494 | static u_int16_t |
| 502 | le2hs (value) | 495 | le2hs (u_int16_t value) |
| 503 | u_int16_t value; | ||
| 504 | { | 496 | { |
| 505 | #ifdef WORDS_BIG_ENDIAN | 497 | #ifdef WORDS_BIG_ENDIAN |
| 506 | unsigned char *p = (unsigned char *) &value; | 498 | unsigned char *p = (unsigned char *) &value; |
| @@ -514,8 +506,7 @@ le2hs (value) | |||
| 514 | to host byte-order. */ | 506 | to host byte-order. */ |
| 515 | 507 | ||
| 516 | static u_int32_t | 508 | static u_int32_t |
| 517 | be2hl (value) | 509 | be2hl (u_int32_t value) |
| 518 | u_int32_t value; | ||
| 519 | { | 510 | { |
| 520 | #ifndef WORDS_BIG_ENDIAN | 511 | #ifndef WORDS_BIG_ENDIAN |
| 521 | unsigned char *p = (unsigned char *) &value; | 512 | unsigned char *p = (unsigned char *) &value; |
| @@ -554,8 +545,7 @@ be2hs (value) | |||
| 554 | Value is non-zero if the file is a WAV file. */ | 545 | Value is non-zero if the file is a WAV file. */ |
| 555 | 546 | ||
| 556 | static int | 547 | static int |
| 557 | wav_init (s) | 548 | wav_init (struct sound *s) |
| 558 | struct sound *s; | ||
| 559 | { | 549 | { |
| 560 | struct wav_header *header = (struct wav_header *) s->header; | 550 | struct wav_header *header = (struct wav_header *) s->header; |
| 561 | 551 | ||
| @@ -590,9 +580,7 @@ wav_init (s) | |||
| 590 | /* Play RIFF-WAVE audio file S on sound device SD. */ | 580 | /* Play RIFF-WAVE audio file S on sound device SD. */ |
| 591 | 581 | ||
| 592 | static void | 582 | static void |
| 593 | wav_play (s, sd) | 583 | wav_play (struct sound *s, struct sound_device *sd) |
| 594 | struct sound *s; | ||
| 595 | struct sound_device *sd; | ||
| 596 | { | 584 | { |
| 597 | struct wav_header *header = (struct wav_header *) s->header; | 585 | struct wav_header *header = (struct wav_header *) s->header; |
| 598 | 586 | ||
| @@ -665,8 +653,7 @@ enum au_encoding | |||
| 665 | Value is non-zero if the file is an AU file. */ | 653 | Value is non-zero if the file is an AU file. */ |
| 666 | 654 | ||
| 667 | static int | 655 | static int |
| 668 | au_init (s) | 656 | au_init (struct sound *s) |
| 669 | struct sound *s; | ||
| 670 | { | 657 | { |
| 671 | struct au_header *header = (struct au_header *) s->header; | 658 | struct au_header *header = (struct au_header *) s->header; |
| 672 | 659 | ||
| @@ -692,9 +679,7 @@ au_init (s) | |||
| 692 | /* Play Sun audio file S on sound device SD. */ | 679 | /* Play Sun audio file S on sound device SD. */ |
| 693 | 680 | ||
| 694 | static void | 681 | static void |
| 695 | au_play (s, sd) | 682 | au_play (struct sound *s, struct sound_device *sd) |
| 696 | struct sound *s; | ||
| 697 | struct sound_device *sd; | ||
| 698 | { | 683 | { |
| 699 | struct au_header *header = (struct au_header *) s->header; | 684 | struct au_header *header = (struct au_header *) s->header; |
| 700 | 685 | ||
| @@ -740,8 +725,7 @@ au_play (s, sd) | |||
| 740 | otherwise use a default device name. */ | 725 | otherwise use a default device name. */ |
| 741 | 726 | ||
| 742 | static void | 727 | static void |
| 743 | vox_open (sd) | 728 | vox_open (struct sound_device *sd) |
| 744 | struct sound_device *sd; | ||
| 745 | { | 729 | { |
| 746 | char *file; | 730 | char *file; |
| 747 | 731 | ||
| @@ -760,8 +744,7 @@ vox_open (sd) | |||
| 760 | /* Configure device SD from parameters in it. */ | 744 | /* Configure device SD from parameters in it. */ |
| 761 | 745 | ||
| 762 | static void | 746 | static void |
| 763 | vox_configure (sd) | 747 | vox_configure (struct sound_device *sd) |
| 764 | struct sound_device *sd; | ||
| 765 | { | 748 | { |
| 766 | int val; | 749 | int val; |
| 767 | 750 | ||
| @@ -814,8 +797,7 @@ vox_configure (sd) | |||
| 814 | /* Close device SD if it is open. */ | 797 | /* Close device SD if it is open. */ |
| 815 | 798 | ||
| 816 | static void | 799 | static void |
| 817 | vox_close (sd) | 800 | vox_close (struct sound_device *sd) |
| 818 | struct sound_device *sd; | ||
| 819 | { | 801 | { |
| 820 | if (sd->fd >= 0) | 802 | if (sd->fd >= 0) |
| 821 | { | 803 | { |
| @@ -845,9 +827,7 @@ vox_close (sd) | |||
| 845 | /* Choose device-dependent format for device SD from sound file S. */ | 827 | /* Choose device-dependent format for device SD from sound file S. */ |
| 846 | 828 | ||
| 847 | static void | 829 | static void |
| 848 | vox_choose_format (sd, s) | 830 | vox_choose_format (struct sound_device *sd, struct sound *s) |
| 849 | struct sound_device *sd; | ||
| 850 | struct sound *s; | ||
| 851 | { | 831 | { |
| 852 | if (s->type == RIFF) | 832 | if (s->type == RIFF) |
| 853 | { | 833 | { |
| @@ -890,8 +870,7 @@ vox_choose_format (sd, s) | |||
| 890 | structure. */ | 870 | structure. */ |
| 891 | 871 | ||
| 892 | static int | 872 | static int |
| 893 | vox_init (sd) | 873 | vox_init (struct sound_device *sd) |
| 894 | struct sound_device *sd; | ||
| 895 | { | 874 | { |
| 896 | char *file; | 875 | char *file; |
| 897 | int fd; | 876 | int fd; |
| @@ -921,10 +900,7 @@ vox_init (sd) | |||
| 921 | /* Write NBYTES bytes from BUFFER to device SD. */ | 900 | /* Write NBYTES bytes from BUFFER to device SD. */ |
| 922 | 901 | ||
| 923 | static void | 902 | static void |
| 924 | vox_write (sd, buffer, nbytes) | 903 | vox_write (struct sound_device *sd, const char *buffer, int nbytes) |
| 925 | struct sound_device *sd; | ||
| 926 | const char *buffer; | ||
| 927 | int nbytes; | ||
| 928 | { | 904 | { |
| 929 | int nwritten = emacs_write (sd->fd, buffer, nbytes); | 905 | int nwritten = emacs_write (sd->fd, buffer, nbytes); |
| 930 | if (nwritten < 0) | 906 | if (nwritten < 0) |
| @@ -939,9 +915,7 @@ vox_write (sd, buffer, nbytes) | |||
| 939 | /* This driver is available on GNU/Linux. */ | 915 | /* This driver is available on GNU/Linux. */ |
| 940 | 916 | ||
| 941 | static void | 917 | static void |
| 942 | alsa_sound_perror (msg, err) | 918 | alsa_sound_perror (char *msg, int err) |
| 943 | char *msg; | ||
| 944 | int err; | ||
| 945 | { | 919 | { |
| 946 | error ("%s: %s", msg, snd_strerror (err)); | 920 | error ("%s: %s", msg, snd_strerror (err)); |
| 947 | } | 921 | } |
| @@ -958,8 +932,7 @@ struct alsa_params | |||
| 958 | otherwise use a default device name. */ | 932 | otherwise use a default device name. */ |
| 959 | 933 | ||
| 960 | static void | 934 | static void |
| 961 | alsa_open (sd) | 935 | alsa_open (struct sound_device *sd) |
| 962 | struct sound_device *sd; | ||
| 963 | { | 936 | { |
| 964 | char *file; | 937 | char *file; |
| 965 | struct alsa_params *p; | 938 | struct alsa_params *p; |
| @@ -986,8 +959,7 @@ alsa_open (sd) | |||
| 986 | } | 959 | } |
| 987 | 960 | ||
| 988 | static int | 961 | static int |
| 989 | alsa_period_size (sd) | 962 | alsa_period_size (struct sound_device *sd) |
| 990 | struct sound_device *sd; | ||
| 991 | { | 963 | { |
| 992 | struct alsa_params *p = (struct alsa_params *) sd->data; | 964 | struct alsa_params *p = (struct alsa_params *) sd->data; |
| 993 | int fact = snd_pcm_format_size (sd->format, 1) * sd->channels; | 965 | int fact = snd_pcm_format_size (sd->format, 1) * sd->channels; |
| @@ -995,8 +967,7 @@ alsa_period_size (sd) | |||
| 995 | } | 967 | } |
| 996 | 968 | ||
| 997 | static void | 969 | static void |
| 998 | alsa_configure (sd) | 970 | alsa_configure (struct sound_device *sd) |
| 999 | struct sound_device *sd; | ||
| 1000 | { | 971 | { |
| 1001 | int val, err, dir; | 972 | int val, err, dir; |
| 1002 | unsigned uval; | 973 | unsigned uval; |
| @@ -1115,8 +1086,7 @@ alsa_configure (sd) | |||
| 1115 | /* Close device SD if it is open. */ | 1086 | /* Close device SD if it is open. */ |
| 1116 | 1087 | ||
| 1117 | static void | 1088 | static void |
| 1118 | alsa_close (sd) | 1089 | alsa_close (struct sound_device *sd) |
| 1119 | struct sound_device *sd; | ||
| 1120 | { | 1090 | { |
| 1121 | struct alsa_params *p = (struct alsa_params *) sd->data; | 1091 | struct alsa_params *p = (struct alsa_params *) sd->data; |
| 1122 | if (p) | 1092 | if (p) |
| @@ -1137,9 +1107,7 @@ alsa_close (sd) | |||
| 1137 | /* Choose device-dependent format for device SD from sound file S. */ | 1107 | /* Choose device-dependent format for device SD from sound file S. */ |
| 1138 | 1108 | ||
| 1139 | static void | 1109 | static void |
| 1140 | alsa_choose_format (sd, s) | 1110 | alsa_choose_format (struct sound_device *sd, struct sound *s) |
| 1141 | struct sound_device *sd; | ||
| 1142 | struct sound *s; | ||
| 1143 | { | 1111 | { |
| 1144 | struct alsa_params *p = (struct alsa_params *) sd->data; | 1112 | struct alsa_params *p = (struct alsa_params *) sd->data; |
| 1145 | if (s->type == RIFF) | 1113 | if (s->type == RIFF) |
| @@ -1194,10 +1162,7 @@ alsa_choose_format (sd, s) | |||
| 1194 | /* Write NBYTES bytes from BUFFER to device SD. */ | 1162 | /* Write NBYTES bytes from BUFFER to device SD. */ |
| 1195 | 1163 | ||
| 1196 | static void | 1164 | static void |
| 1197 | alsa_write (sd, buffer, nbytes) | 1165 | alsa_write (struct sound_device *sd, const char *buffer, int nbytes) |
| 1198 | struct sound_device *sd; | ||
| 1199 | const char *buffer; | ||
| 1200 | int nbytes; | ||
| 1201 | { | 1166 | { |
| 1202 | struct alsa_params *p = (struct alsa_params *) sd->data; | 1167 | struct alsa_params *p = (struct alsa_params *) sd->data; |
| 1203 | 1168 | ||
| @@ -1244,12 +1209,7 @@ alsa_write (sd, buffer, nbytes) | |||
| 1244 | } | 1209 | } |
| 1245 | 1210 | ||
| 1246 | static void | 1211 | static void |
| 1247 | snd_error_quiet (file, line, function, err, fmt) | 1212 | snd_error_quiet (const char *file, int line, const char *function, int err, const char *fmt) |
| 1248 | const char *file; | ||
| 1249 | int line; | ||
| 1250 | const char *function; | ||
| 1251 | int err; | ||
| 1252 | const char *fmt; | ||
| 1253 | { | 1213 | { |
| 1254 | } | 1214 | } |
| 1255 | 1215 | ||
| @@ -1257,8 +1217,7 @@ snd_error_quiet (file, line, function, err, fmt) | |||
| 1257 | structure. */ | 1217 | structure. */ |
| 1258 | 1218 | ||
| 1259 | static int | 1219 | static int |
| 1260 | alsa_init (sd) | 1220 | alsa_init (struct sound_device *sd) |
| 1261 | struct sound_device *sd; | ||
| 1262 | { | 1221 | { |
| 1263 | char *file; | 1222 | char *file; |
| 1264 | snd_pcm_t *handle; | 1223 | snd_pcm_t *handle; |
| @@ -1524,7 +1483,7 @@ Internal use only, use `play-sound' instead. */) | |||
| 1524 | ***********************************************************************/ | 1483 | ***********************************************************************/ |
| 1525 | 1484 | ||
| 1526 | void | 1485 | void |
| 1527 | syms_of_sound () | 1486 | syms_of_sound (void) |
| 1528 | { | 1487 | { |
| 1529 | QCdevice = intern_c_string(":device"); | 1488 | QCdevice = intern_c_string(":device"); |
| 1530 | staticpro (&QCdevice); | 1489 | staticpro (&QCdevice); |
| @@ -1540,7 +1499,7 @@ syms_of_sound () | |||
| 1540 | 1499 | ||
| 1541 | 1500 | ||
| 1542 | void | 1501 | void |
| 1543 | init_sound () | 1502 | init_sound (void) |
| 1544 | { | 1503 | { |
| 1545 | } | 1504 | } |
| 1546 | 1505 | ||