"Fossies" - the Fresh Open Source Software Archive

Member "scm/scmhob.h" (22 Oct 2017, 4764 Bytes) of package /linux/privat/scm-5f3.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "scmhob.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5f2_vs_5f3.

    1 /* "scmhob.h" is a header file for scheme source compiled with hobbit5x
    2  * Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation
    3  *
    4  * This program is free software: you can redistribute it and/or modify
    5  * it under the terms of the GNU Lesser General Public License as
    6  * published by the Free Software Foundation, either version 3 of the
    7  * License, or (at your option) any later version.
    8  *
    9  * This program is distributed in the hope that it will be useful, but
   10  * WITHOUT ANY WARRANTY; without even the implied warranty of
   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12  * Lesser General Public License for more details.
   13  *
   14  * You should have received a copy of the GNU Lesser General Public
   15  * License along with this program.  If not, see
   16  * <http://www.gnu.org/licenses/>.
   17  */
   18 
   19 /* Author: Tanel Tammet */
   20 
   21 #include "scm.h"
   22 
   23 #define STBL_VECTOR_SET(v,k,o) (v[((long)INUM(k))] = o)
   24 #define STBL_VECTOR_REF(v,k) (v[((long)INUM(k))])
   25 #define CHAR_LESSP(x,y) ((ICHR(x) < ICHR(y)) ? BOOL_T : BOOL_F)
   26 #define CHAR_LEQP(x,y) ((ICHR(x) <= ICHR(y)) ? BOOL_T : BOOL_F)
   27 #define CHCI_EQ(x,y) ((upcase[ICHR(x)]==upcase[ICHR(y)]) ? BOOL_T : BOOL_F)
   28 #define CHCI_LESSP(x,y) ((upcase[ICHR(x)] < upcase[ICHR(y)]) ? BOOL_T : BOOL_F)
   29 #define CHCI_LEQP(x,y) ((upcase[ICHR(x)] <= upcase[ICHR(y)]) ? BOOL_T : BOOL_F)
   30 #define CHAR_ALPHAP(chr) ((isascii(ICHR(chr)) && isalpha(ICHR(chr))) ? BOOL_T : BOOL_F)
   31 #define CHAR_NUMP(chr) ((isascii(ICHR(chr)) && isdigit(ICHR(chr))) ? BOOL_T : BOOL_F)
   32 #define CHAR_WHITEP(chr) ((isascii(ICHR(chr)) && isspace(ICHR(chr))) ? BOOL_T : BOOL_F)
   33 #define CHAR_UPPERP(chr) ((isascii(ICHR(chr)) && isupper(ICHR(chr))) ? BOOL_T : BOOL_F)
   34 #define CHAR_LOWERP(chr) ((isascii(ICHR(chr)) && islower(ICHR(chr))) ? BOOL_T : BOOL_F)
   35 #define CHAR2INT(chr) MAKINUM(ICHR(chr))
   36 #define INT2CHAR(n) MAKICHR(INUM(n))
   37 #define CHAR_UPCASE(chr) MAKICHR(upcase[ICHR(chr)])
   38 #define CHAR_DOWNCASE(chr) MAKICHR(downcase[ICHR(chr)])
   39 #define ST_LENGTH(str) MAKINUM(LENGTH(str))
   40 #define ST_REF(str,k) MAKICHR(CHARS(str)[INUM(k)])
   41 #define VECTOR_LENGTH(v)  MAKINUM(LENGTH(v))
   42 
   43 #ifdef FLOATS
   44 # include <math.h>
   45 #else
   46 # define scm_abs scm_iabs
   47 #endif
   48 #ifdef BIGDIG
   49 # define PRE_TRANSC_FUN(x) (INUMP(x) ? (double) INUM(x) : (REALP(x) ? (double) REALPART(x) : (double) int2dbl(x)))
   50 #else
   51 # define PRE_TRANSC_FUN(x) (INUMP(x) ?  (double) INUM(x) : (double) REALPART(x))
   52 #endif
   53 
   54 #define SIN_FUN(x) (makdbl( sin( PRE_TRANSC_FUN(x)), 0.0))
   55 #define COS_FUN(x) (makdbl( cos( PRE_TRANSC_FUN(x)), 0.0))
   56 #define TAN_FUN(x) (makdbl( tan( PRE_TRANSC_FUN(x)), 0.0))
   57 #define ASIN_FUN(x) (makdbl( asin( PRE_TRANSC_FUN(x)), 0.0))
   58 #define ACOS_FUN(x) (makdbl( acos( PRE_TRANSC_FUN(x)), 0.0))
   59 #define ATAN_FUN(x) (makdbl( atan( PRE_TRANSC_FUN(x)), 0.0))
   60 #define SINH_FUN(x) (makdbl( sinh( PRE_TRANSC_FUN(x)), 0.0))
   61 #define COSH_FUN(x) (makdbl( cosh( PRE_TRANSC_FUN(x)), 0.0))
   62 #define TANH_FUN(x) (makdbl( tanh( PRE_TRANSC_FUN(x)), 0.0))
   63 #define ASINH_FUN(x) (makdbl( asinh( PRE_TRANSC_FUN(x)), 0.0))
   64 #define ACOSH_FUN(x) (makdbl( acosh( PRE_TRANSC_FUN(x)), 0.0))
   65 #define ATANH_FUN(x) (makdbl( atanh( PRE_TRANSC_FUN(x)), 0.0))
   66 #define SQRT_FUN(x) (makdbl( sqrt( PRE_TRANSC_FUN(x)), 0.0))
   67 #define EXPT_FUN(x,y) (makdbl( pow(( PRE_TRANSC_FUN(x)), ( PRE_TRANSC_FUN(y))), 0.0))
   68 #define EXP_FUN(x) (makdbl( exp( PRE_TRANSC_FUN(x)), 0.0))
   69 #define LOG_FUN(x) (makdbl( log( PRE_TRANSC_FUN(x)), 0.0))
   70 #define ABS_FUN(x) (makdbl( fabs( PRE_TRANSC_FUN(x)), 0.0))
   71 #define EX2IN_FUN(x) (makdbl( PRE_TRANSC_FUN(x), 0.0))
   72 #define FLOOR_FUN(x) (makdbl( floor( PRE_TRANSC_FUN(x)), 0.0))
   73 #define CEILING_FUN(x) (makdbl( ceil( PRE_TRANSC_FUN(x)), 0.0))
   74 #define TRUNCATE_FUN(x) (makdbl( ltrunc( PRE_TRANSC_FUN(x)), 0.0))
   75 #define ROUND_FUN(x) (makdbl(round( PRE_TRANSC_FUN(x)), 0.0))
   76 
   77 /* the following defs come from the #ifdef HOBBIT part of scm.h */
   78 
   79 #define SBOOL(x) ((x) ? BOOL_T : BOOL_F)
   80 
   81 #define BOOLEAN_P(x) ((x)==BOOL_T || (x)==BOOL_F)
   82 #define CHAR_P ICHRP
   83 #define SYMBOL_P(x) (ISYMP(x) || (!(IMP(x)) && SYMBOLP(x)))
   84 #define VECTOR_P(x) (!(IMP(x)) && VECTORP(x))
   85 #define PAIR_P(x) (!(IMP(x)) && CONSP(x))
   86 #define NUMBER_P INUMP
   87 #define INTEGER_P INUMP
   88 #define STRING_P(x) (!(IMP(x)) && STRINGP(x))
   89 #define NULL_P NULLP
   90 #define ZERO_P(x) ((x)==INUM0)
   91 #define POSITIVE_P(x) ((x) > INUM0)
   92 #define NEGATIVE_P(x) ((x) < INUM0)
   93 
   94 #define NOT(x) ((x)==BOOL_F ? BOOL_T : BOOL_F)
   95 #define SET_CAR(x,y) (CAR(x) = (SCM)(y))
   96 #define SET_CDR(x,y) (CDR(x) = (SCM)(y))
   97 #define VECTOR_SET(v,k,o) (VELTS(v)[((long)INUM(k))] = o)
   98 #define VECTOR_REF(v,k) (VELTS(v)[((long)INUM(k))])
   99 #define GLOBAL(x) (*(x))
  100 
  101 #define append2(lst1,lst2) (append(cons2(lst1,lst2,EOL)))
  102 #define procedure_pred_(x) (BOOL_T==procedurep(x))
  103 
  104 /* new for hobbit5 - scm5 */
  105 
  106 /*
  107 SCM intp(SCM);
  108 SCM eqv(SCM,SCM);
  109 */