📄 gnulib.c
字号:
/* Subroutines needed by GCC output code on some machines. *//* Compile this file with the Unix C compiler! */#include "config.h"/* Don't use `fancy_abort' here even if config.h says to use it. */#ifdef abort#undef abort#endif/* Define the C data type to use for an SImode value. */#ifndef SItype#define SItype long int#endif/* Define the type to be used for returning an SF mode value and the method for turning a float into that type. These definitions work for machines where an SF value is returned in the same register as an int. */#ifndef SFVALUE #define SFVALUE int#endif#ifndef INTIFY#define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)#endif#ifdef GNULIB_NEEDS_DOUBLE#define FLOAT_ARG_TYPE double#define FLOATIFY(ARG) ((float) (ARG))#endif#ifndef FLOATIFY#define FLOATIFY(INTVAL) ((INTVAL).f)#endif#ifndef FLOAT_ARG_TYPE#define FLOAT_ARG_TYPE union flt_or_int#endifunion flt_or_int { int i; float f; };#ifdef L_eprintf#include <stdio.h>/* This is used by the `assert' macro. */void__eprintf (string, expression, line, filename) char *string; char *expression; int line; char *filename;{ fprintf (stderr, string, expression, line, filename); fflush (stderr); abort ();}#endif#ifdef L_umulsi3SItype__umulsi3 (a, b) unsigned SItype a, b;{ return a * b;}#endif#ifdef L_mulsi3SItype__mulsi3 (a, b) SItype a, b;{ return a * b;}#endif#ifdef L_udivsi3SItype__udivsi3 (a, b) unsigned SItype a, b;{ return a / b;}#endif#ifdef L_divsi3SItype__divsi3 (a, b) SItype a, b;{ return a / b;}#endif#ifdef L_umodsi3SItype__umodsi3 (a, b) unsigned SItype a, b;{ return a % b;}#endif#ifdef L_modsi3SItype__modsi3 (a, b) SItype a, b;{ return a % b;}#endif#ifdef L_lshrsi3SItype__lshrsi3 (a, b) unsigned SItype a, b;{ return a >> b;}#endif#ifdef L_lshlsi3SItype__lshlsi3 (a, b) unsigned SItype a, b;{ return a << b;}#endif#ifdef L_ashrsi3SItype__ashrsi3 (a, b) SItype a, b;{ return a >> b;}#endif#ifdef L_ashlsi3SItype__ashlsi3 (a, b) SItype a, b;{ return a << b;}#endif#ifdef L_divdf3double__divdf3 (a, b) double a, b;{ return a / b;}#endif#ifdef L_muldf3double__muldf3 (a, b) double a, b;{ return a * b;}#endif#ifdef L_negdf2double__negdf2 (a) double a;{ return -a;}#endif#ifdef L_adddf3double__adddf3 (a, b) double a, b;{ return a + b;}#endif#ifdef L_subdf3double__subdf3 (a, b) double a, b;{ return a - b;}#endif#ifdef L_cmpdf2SItype__cmpdf2 (a, b) double a, b;{ if (a > b) return 1; else if (a < b) return -1; return 0;}#endif#ifdef L_fixunsdfsi#define HIGH_BIT_INT_COEFF (1 << (BITS_PER_WORD - 1))#define HIGH_BIT_COEFF (2 * (double) (1 << (BITS_PER_WORD - 2)))SItype__fixunsdfsi (a) double a;{ if (a < HIGH_BIT_COEFF) return (SItype)a; /* Convert large positive numbers to smaller ones, then increase again after you have a fixed point number. */ else return ((SItype) (a - HIGH_BIT_COEFF)) + HIGH_BIT_INT_COEFF;}#endif#ifdef L_fixdfsiSItype__fixdfsi (a) double a;{ return (SItype) a;}#endif#ifdef L_floatsidfdouble__floatsidf (a) SItype a;{ return (double) a;}#endif#ifdef L_addsf3SFVALUE__addsf3 (a, b) FLOAT_ARG_TYPE a, b;{ union flt_or_int intify; return INTIFY (FLOATIFY (a) + FLOATIFY (b));}#endif#ifdef L_negsf2SFVALUE__negsf2 (a) FLOAT_ARG_TYPE a;{ union flt_or_int intify; return INTIFY (-FLOATIFY (a));}#endif#ifdef L_subsf3SFVALUE__subsf3 (a, b) FLOAT_ARG_TYPE a, b;{ union flt_or_int intify; return INTIFY (FLOATIFY (a) - FLOATIFY (b));}#endif#ifdef L_cmpsf2SItype__cmpsf2 (a, b) FLOAT_ARG_TYPE a, b;{ if (FLOATIFY (a) > FLOATIFY (b)) return 1; else if (FLOATIFY (a) < FLOATIFY (b)) return -1; return 0;}#endif#ifdef L_mulsf3SFVALUE__mulsf3 (a, b) FLOAT_ARG_TYPE a, b;{ union flt_or_int intify; return INTIFY (FLOATIFY (a) * FLOATIFY (b));}#endif#ifdef L_divsf3SFVALUE__divsf3 (a, b) FLOAT_ARG_TYPE a, b;{ union flt_or_int intify; return INTIFY (FLOATIFY (a) / FLOATIFY (b));}#endif#ifdef L_truncdfsf2SFVALUE__truncdfsf2 (a) double a;{ union flt_or_int intify; return INTIFY (a);}#endif#ifdef L_extendsfdf2double__extendsfdf2 (a) FLOAT_ARG_TYPE a;{ return FLOATIFY (a);}#endif#ifdef L_bbint __avoid_ranlib_warning; /* Don't let symbol table be empty. */#if defined (sun) && defined (mc68000)struct bb{ int initialized; char *filename; int *counts; int ncounts; int zero_word; int *addresses;};__bb_init_func (blocks) struct bb *blocks;{ extern int ___tcov_init; if (! ___tcov_init) ___tcov_init_func (); ___bb_link (blocks->filename, blocks->counts, blocks->ncounts);}#endif#endif/* frills for C++ */#ifdef L_builtin_newtypedef void (*vfp)();extern vfp __new_handler;char *__builtin_new (sz) long sz;{ char *p; p = (char *)malloc (sz); if (p == 0) (*__new_handler) (); return p;}#endif#ifdef L_builtin_Newtypedef void (*vfp)();static voiddefault_new_handler ();vfp __new_handler = default_new_handler;char *__builtin_vec_new (p, maxindex, size, ctor) char *p; int maxindex, size; void (*ctor)();{ int i, nelts = maxindex + 1; char *rval; if (p == 0) p = (char *)__builtin_new (nelts * size); rval = p; for (i = 0; i < nelts; i++) { (*ctor) (p); p += size; } return rval;}vfp__set_new_handler (handler) vfp handler;{ vfp prev_handler; prev_handler = __new_handler; if (handler == 0) handler = default_new_handler; __new_handler = handler; return prev_handler;}vfpset_new_handler (handler) vfp handler;{ return __set_new_handler (handler);}static voiddefault_new_handler (){ /* don't use fprintf (stderr, ...) because it may need to call malloc. */ write (2, "default_new_handler: out of memory... aaaiiiiiieeeeeeeeeeeeee!\n", 65); /* don't call exit () because that may call global destructors which may cause a loop. */ _exit (-1);}#endif#ifdef L_builtin_deltypedef void (*vfp)();void__builtin_delete (ptr) char *ptr;{ if (ptr) free (ptr);}void__builtin_vec_delete (ptr, maxindex, size, dtor, auto_delete_vec, auto_delete) char *ptr; int maxindex, size; void (*dtor)(); int auto_delete;{ int i, nelts = maxindex + 1; char *p = ptr; ptr += nelts * size; for (i = 0; i < nelts; i++) { ptr -= size; (*dtor) (ptr, auto_delete); } if (auto_delete_vec) free (p);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -