static int parse_sound (Lisp_Object sound, Lisp_Object *attrs) { /* SOUND must be a list starting with the symbol `sound'. */ if (!CONSP (sound) || !EQ (XCAR (sound), Qsound)) return 0; sound = XCDR (sound); attrs[SOUND_FILE] = Fplist_get (sound, QCfile); attrs[SOUND_DATA] = Fplist_get (sound, QCdata); attrs[SOUND_DEVICE] = Fplist_get (sound, QCdevice); attrs[SOUND_VOLUME] = Fplist_get (sound, QCvolume); #ifndef WINDOWSNT /* File name or data must be specified. */ if (!STRINGP (attrs[SOUND_FILE]) && !STRINGP (attrs[SOUND_DATA])) return 0; #else /* WINDOWSNT */ /* Data is not supported in Windows. Therefore a File name MUST be supplied. */ if (!STRINGP (attrs[SOUND_FILE])) { return 0; } #endif /* WINDOWSNT */ /* Volume must be in the range 0..100 or unspecified. */ if (!NILP (attrs[SOUND_VOLUME])) { if (INTEGERP (attrs[SOUND_VOLUME])) { if (XINT (attrs[SOUND_VOLUME]) < 0 || XINT (attrs[SOUND_VOLUME]) > 100) return 0; } else if (FLOATP (attrs[SOUND_VOLUME])) { if (XFLOAT_DATA (attrs[SOUND_VOLUME]) < 0 || XFLOAT_DATA (attrs[SOUND_VOLUME]) > 1) return 0; } else return 0; } #ifndef WINDOWSNT /* Device must be a string or unspecified. */ if (!NILP (attrs[SOUND_DEVICE]) && !STRINGP (attrs[SOUND_DEVICE])) return 0; #endif /* WINDOWSNT */ /* Since device is ignored in Windows, it does not matter what it is. */ return 1; }
static double module_extract_float (emacs_env *env, emacs_value f) { MODULE_FUNCTION_BEGIN (0); Lisp_Object lisp = value_to_lisp (f); CHECK_TYPE (FLOATP (lisp), Qfloatp, lisp); return XFLOAT_DATA (lisp); }
double extract_float (Lisp_Object num) { CHECK_NUMBER_OR_FLOAT (num); if (FLOATP (num)) return XFLOAT_DATA (num); return (double) XINT (num); }
static double module_extract_float (emacs_env *env, emacs_value f) { MODULE_FUNCTION_BEGIN (0); Lisp_Object lisp = value_to_lisp (f); if (! FLOATP (lisp)) { module_wrong_type (env, Qfloatp, lisp); return 0; } return XFLOAT_DATA (lisp); }