⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 data.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 3 页
字号:
     Lisp_Object num;{  char buffer[20];  CHECK_NUMBER (num, 0);  sprintf (buffer, "%d", XINT (num));  return build_string (buffer);}DEFUN ("string-to-int", Fstring_to_int, Sstring_to_int, 1, 1, 0,  "Convert STRING to an integer by parsing it as a decimal number.")  (str, flag)     register Lisp_Object str, flag;{  CHECK_STRING (str, 0);  return make_number (atoi (XSTRING (str)->data));}  enum arithop  { Aadd, Asub, Amult, Adiv, Alogand, Alogior, Alogxor, Amax, Amin };Lisp_Objectarith_driver  (code, nargs, args)     enum arithop code;     int nargs;     register Lisp_Object *args;{  register Lisp_Object val;  register int argnum;  register int accum;  register int next;#ifdef SWITCH_ENUM_BUG  switch ((int) code)#else  switch (code)#endif    {    case Alogior:    case Alogxor:    case Aadd:    case Asub:      accum = 0; break;    case Amult:      accum = 1; break;    case Alogand:      accum = -1; break;    }  for (argnum = 0; argnum < nargs; argnum++)    {      val = args[argnum];    /* using args[argnum] as argument to CHECK_NUMBER_... */      CHECK_NUMBER_COERCE_MARKER (val, argnum);      args[argnum] = val;    /* runs into a compiler bug. */      next = XINT (args[argnum]);#ifdef SWITCH_ENUM_BUG      switch ((int) code)#else      switch (code)#endif	{	case Aadd: accum += next; break;	case Asub:	  if (!argnum && nargs != 1)	    next = - next;	  accum -= next;	  break;	case Amult: accum *= next; break;	case Adiv:	  if (!argnum) accum = next;	  else accum /= next;	  break;	case Alogand: accum &= next; break;	case Alogior: accum |= next; break;	case Alogxor: accum ^= next; break;	case Amax: if (!argnum || next > accum) accum = next; break;	case Amin: if (!argnum || next < accum) accum = next; break;	}    }  XSET (val, Lisp_Int, accum);  return val;}DEFUN ("+", Fplus, Splus, 0, MANY, 0,  "Return sum of any number of numbers.")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Aadd, nargs, args);}DEFUN ("-", Fminus, Sminus, 0, MANY, 0,  "Negate number or subtract numbers.\n\With one arg, negates it.  With more than one arg,\n\subtracts all but the first from the first.")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Asub, nargs, args);}DEFUN ("*", Ftimes, Stimes, 0, MANY, 0,  "Returns product of any number of numbers.")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Amult, nargs, args);}DEFUN ("/", Fquo, Squo, 2, MANY, 0,  "Returns first argument divided by rest of arguments.")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Adiv, nargs, args);}DEFUN ("%", Frem, Srem, 2, 2, 0,  "Returns remainder of first arg divided by second.")  (num1, num2)     register Lisp_Object num1, num2;{  Lisp_Object val;  CHECK_NUMBER (num1, 0);  CHECK_NUMBER (num2, 1);  XSET (val, Lisp_Int, XINT (num1) % XINT (num2));  return val;}DEFUN ("max", Fmax, Smax, 1, MANY, 0,  "Return largest of all the arguments (which must be numbers.)")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Amax, nargs, args);}DEFUN ("min", Fmin, Smin, 1, MANY, 0,  "Return smallest of all the arguments (which must be numbers.)")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Amin, nargs, args);}DEFUN ("logand", Flogand, Slogand, 0, MANY, 0,  "Return bitwise and of all the arguments (numbers).")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Alogand, nargs, args);}DEFUN ("logior", Flogior, Slogior, 0, MANY, 0,  "Return bitwise or of all the arguments (numbers).")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Alogior, nargs, args);}DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0,  "Return bitwise exclusive-or of all the arguments (numbers).")  (nargs, args)     int nargs;     Lisp_Object *args;{  return arith_driver (Alogxor, nargs, args);}DEFUN ("ash", Fash, Sash, 2, 2, 0,  "Return VALUE with its bits shifted left by COUNT.\n\If COUNT is negative, shifting is actually to the right.\n\In this case, the sign bit is duplicated.")  (num1, num2)     register Lisp_Object num1, num2;{  register Lisp_Object val;  CHECK_NUMBER (num1, 0);  CHECK_NUMBER (num2, 1);  if (XINT (num2) > 0)    XSET (val, Lisp_Int, XINT (num1) << XFASTINT (num2));  else    XSET (val, Lisp_Int, XINT (num1) >> -XINT (num2));  return val;}DEFUN ("lsh", Flsh, Slsh, 2, 2, 0,  "Return VALUE with its bits shifted left by COUNT.\n\If COUNT is negative, shifting is actually to the right.\n\In this case,  zeros are shifted in on the left.")  (num1, num2)     register Lisp_Object num1, num2;{  register Lisp_Object val;  CHECK_NUMBER (num1, 0);  CHECK_NUMBER (num2, 1);  if (XINT (num2) > 0)    XSET (val, Lisp_Int, (unsigned) XFASTINT (num1) << XFASTINT (num2));  else    XSET (val, Lisp_Int, (unsigned) XFASTINT (num1) >> -XINT (num2));  return val;}DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0,  "Return NUMBER plus one.")  (num)     register Lisp_Object num;{  CHECK_NUMBER_COERCE_MARKER (num, 0);  XSETINT (num, XFASTINT (num) + 1);  return num;}DEFUN ("1-", Fsub1, Ssub1, 1, 1, 0,  "Return NUMBER minus one.")  (num)     register Lisp_Object num;{  CHECK_NUMBER_COERCE_MARKER (num, 0);  XSETINT (num, XFASTINT (num) - 1);  return num;}DEFUN ("lognot", Flognot, Slognot, 1, 1, 0,  "Return the bitwise complement of ARG.")  (num)     register Lisp_Object num;{  CHECK_NUMBER (num, 0);  XSETINT (num, ~XFASTINT (num));  return num;}voidsyms_of_data (){  Qquote = intern ("quote");  Qlambda = intern ("lambda");  Qsubr = intern ("subr");  Qerror_conditions = intern ("error-conditions");  Qerror_message = intern ("error-message");  Qtop_level = intern ("top-level");  Qerror = intern ("error");  Qquit = intern ("quit");  Qwrong_type_argument = intern ("wrong-type-argument");  Qargs_out_of_range = intern ("args-out-of-range");  Qvoid_function = intern ("void-function");  Qvoid_variable = intern ("void-variable");  Qsetting_constant = intern ("setting-constant");  Qinvalid_read_syntax = intern ("invalid-read-syntax");  Qinvalid_function = intern ("invalid-function");  Qwrong_number_of_arguments = intern ("wrong-number-of-arguments");  Qno_catch = intern ("no-catch");  Qend_of_file = intern ("end-of-file");  Qarith_error = intern ("arith-error");  Qbeginning_of_buffer = intern ("beginning-of-buffer");  Qend_of_buffer = intern ("end-of-buffer");  Qbuffer_read_only = intern ("buffer-read-only");  Qlistp = intern ("listp");  Qconsp = intern ("consp");  Qsymbolp = intern ("symbolp");  Qintegerp = intern ("integerp");  Qnatnump = intern ("natnump");  Qstringp = intern ("stringp");  Qarrayp = intern ("arrayp");  Qsequencep = intern ("sequencep");  Qbufferp = intern ("bufferp");  Qvectorp = intern ("vectorp");  Qchar_or_string_p = intern ("char-or-string-p");  Qmarkerp = intern ("markerp");  Qinteger_or_marker_p = intern ("integer-or-marker-p");  Qboundp = intern ("boundp");  Qfboundp = intern ("fboundp");  Qcdr = intern ("cdr");  /* ERROR is used as a signaler for random errors for which nothing else is right */  Fput (Qerror, Qerror_conditions,	Fcons (Qerror, Qnil));  Fput (Qerror, Qerror_message,	build_string ("error"));  Fput (Qquit, Qerror_conditions,	Fcons (Qquit, Qnil));  Fput (Qquit, Qerror_message,	build_string ("Quit"));  Fput (Qwrong_type_argument, Qerror_conditions,	Fcons (Qwrong_type_argument, Fcons (Qerror, Qnil)));  Fput (Qwrong_type_argument, Qerror_message,	build_string ("Wrong type argument"));  Fput (Qargs_out_of_range, Qerror_conditions,	Fcons (Qargs_out_of_range, Fcons (Qerror, Qnil)));  Fput (Qargs_out_of_range, Qerror_message,	build_string ("Args out of range"));  Fput (Qvoid_function, Qerror_conditions,	Fcons (Qvoid_function, Fcons (Qerror, Qnil)));  Fput (Qvoid_function, Qerror_message,	build_string ("Symbol's function definition is void"));  Fput (Qvoid_variable, Qerror_conditions,	Fcons (Qvoid_variable, Fcons (Qerror, Qnil)));  Fput (Qvoid_variable, Qerror_message,	build_string ("Symbol's value as variable is void"));  Fput (Qsetting_constant, Qerror_conditions,	Fcons (Qsetting_constant, Fcons (Qerror, Qnil)));  Fput (Qsetting_constant, Qerror_message,	build_string ("Attempt to set a constant symbol"));  Fput (Qinvalid_read_syntax, Qerror_conditions,	Fcons (Qinvalid_read_syntax, Fcons (Qerror, Qnil)));  Fput (Qinvalid_read_syntax, Qerror_message,	build_string ("Invalid read syntax"));  Fput (Qinvalid_function, Qerror_conditions,	Fcons (Qinvalid_function, Fcons (Qerror, Qnil)));  Fput (Qinvalid_function, Qerror_message,	build_string ("Invalid function"));  Fput (Qwrong_number_of_arguments, Qerror_conditions,	Fcons (Qwrong_number_of_arguments, Fcons (Qerror, Qnil)));  Fput (Qwrong_number_of_arguments, Qerror_message,	build_string ("Wrong number of arguments"));  Fput (Qno_catch, Qerror_conditions,	Fcons (Qno_catch, Fcons (Qerror, Qnil)));  Fput (Qno_catch, Qerror_message,	build_string ("No catch for tag"));  Fput (Qend_of_file, Qerror_conditions,	Fcons (Qend_of_file, Fcons (Qerror, Qnil)));  Fput (Qend_of_file, Qerror_message,	build_string ("End of file during parsing"));  Fput (Qarith_error, Qerror_conditions,	Fcons (Qarith_error, Fcons (Qerror, Qnil)));  Fput (Qarith_error, Qerror_message,	build_string ("Arithmetic error"));  Fput (Qbeginning_of_buffer, Qerror_conditions,	Fcons (Qbeginning_of_buffer, Fcons (Qerror, Qnil)));  Fput (Qbeginning_of_buffer, Qerror_message,	build_string ("Beginning of buffer"));  Fput (Qend_of_buffer, Qerror_conditions,	Fcons (Qend_of_buffer, Fcons (Qerror, Qnil)));  Fput (Qend_of_buffer, Qerror_message,	build_string ("End of buffer"));  Fput (Qbuffer_read_only, Qerror_conditions,	Fcons (Qbuffer_read_only, Fcons (Qerror, Qnil)));  Fput (Qbuffer_read_only, Qerror_message,	build_string ("Buffer is read-only"));  staticpro (&Qnil);  staticpro (&Qt);  staticpro (&Qquote);  staticpro (&Qlambda);  staticpro (&Qsubr);  staticpro (&Qunbound);  staticpro (&Qerror_conditions);  staticpro (&Qerror_message);  staticpro (&Qtop_level);  staticpro (&Qerror);  staticpro (&Qquit);  staticpro (&Qwrong_type_argument);  staticpro (&Qargs_out_of_range);  staticpro (&Qvoid_function);  staticpro (&Qvoid_variable);  staticpro (&Qsetting_constant);  staticpro (&Qinvalid_read_syntax);  staticpro (&Qwrong_number_of_arguments);  staticpro (&Qinvalid_function);  staticpro (&Qno_catch);  staticpro (&Qend_of_file);  staticpro (&Qarith_error);  staticpro (&Qbeginning_of_buffer);  staticpro (&Qend_of_buffer);  staticpro (&Qbuffer_read_only);  staticpro (&Qlistp);  staticpro (&Qconsp);  staticpro (&Qsymbolp);  staticpro (&Qintegerp);  staticpro (&Qnatnump);  staticpro (&Qstringp);  staticpro (&Qarrayp);  staticpro (&Qsequencep);  staticpro (&Qbufferp);  staticpro (&Qvectorp);  staticpro (&Qchar_or_string_p);  staticpro (&Qmarkerp);  staticpro (&Qinteger_or_marker_p);  staticpro (&Qboundp);  staticpro (&Qfboundp);  staticpro (&Qcdr);  defsubr (&Seq);  defsubr (&Snull);  defsubr (&Slistp);  defsubr (&Snlistp);  defsubr (&Sconsp);  defsubr (&Satom);  defsubr (&Sintegerp);  defsubr (&Snatnump);  defsubr (&Ssymbolp);  defsubr (&Sstringp);  defsubr (&Svectorp);  defsubr (&Sarrayp);  defsubr (&Ssequencep);  defsubr (&Sbufferp);  defsubr (&Smarkerp);  defsubr (&Sinteger_or_marker_p);  defsubr (&Ssubrp);  defsubr (&Schar_or_string_p);  defsubr (&Scar);  defsubr (&Scdr);  defsubr (&Scar_safe);  defsubr (&Scdr_safe);  defsubr (&Ssetcar);  defsubr (&Ssetcdr);  defsubr (&Ssymbol_function);  defsubr (&Ssymbol_plist);  defsubr (&Ssymbol_name);  defsubr (&Smakunbound);  defsubr (&Sfmakunbound);  defsubr (&Sboundp);  defsubr (&Sfboundp);  defsubr (&Sfset);  defsubr (&Ssetplist);  defsubr (&Ssymbol_value);  defsubr (&Sset);  defsubr (&Sdefault_value);  defsubr (&Sset_default);  defsubr (&Ssetq_default);  defsubr (&Smake_variable_buffer_local);  defsubr (&Smake_local_variable);  defsubr (&Skill_local_variable);  defsubr (&Saref);  defsubr (&Saset);  defsubr (&Sint_to_string);  defsubr (&Sstring_to_int);  defsubr (&Seqlsign);  defsubr (&Slss);  defsubr (&Sgtr);  defsubr (&Sleq);  defsubr (&Sgeq);  defsubr (&Sneq);  defsubr (&Szerop);  defsubr (&Splus);  defsubr (&Sminus);  defsubr (&Stimes);  defsubr (&Squo);  defsubr (&Srem);  defsubr (&Smax);  defsubr (&Smin);  defsubr (&Slogand);  defsubr (&Slogior);  defsubr (&Slogxor);  defsubr (&Slsh);  defsubr (&Sash);  defsubr (&Sadd1);  defsubr (&Ssub1);  defsubr (&Slognot);}arith_error (signo)     int signo;{#ifdef USG  /* USG systems forget handlers when they are used;     must reestablish each time */  signal (signo, arith_error);#endif /* USG */#ifdef VMS  /* VMS systems are like USG.  */  signal (signo, arith_error);#endif /* VMS */#ifdef BSD4_1  sigrelse (SIGFPE);#else /* not BSD4_1 */  sigsetmask (0);#endif /* not BSD4_1 */  Fsignal (Qarith_error, Qnil);}init_data (){  /* Don't do this if just dumping out.     We don't want to call `signal' in this case     so that we don't have trouble with dumping     signal-delivering routines in an inconsistent state.  */#ifndef CANNOT_DUMP  if (!initialized)    return;#endif /* CANNOT_DUMP */  signal (SIGFPE, arith_error);#ifdef uts  signal (SIGEMT, arith_error);#endif /* uts */}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -