Changeset 13147 in project


Ignore:
Timestamp:
02/02/09 08:07:40 (11 years ago)
Author:
Kon Lovett
Message:

lolevel.scm : check-pointer not in library.scm yet
chicken.h : grouped like, note that swig pointer is now special
chicken-primitive-object-inlines.scm : wrong unbound value C predicate name
Unit lolevel : rmvd empty line

Location:
chicken/branches/chicken-3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/chicken-3/chicken-primitive-object-inlines.scm

    r13143 r13147  
    4848;; Unbound (the unbound value, not is a symbol unbound)
    4949
    50 (define-inline (%unbound? x) (##core#inline "C_unboundp" x))
     50(define-inline (%unbound? x) (##core#inline "C_unboundvaluep" x))
    5151
    5252;; Block (anything not immediate)
  • chicken/branches/chicken-3/chicken.h

    r13143 r13147  
    99;
    1010;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
    11 ;     disclaimer. 
     11;     disclaimer.
    1212;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
    13 ;     disclaimer in the documentation and/or other materials provided with the distribution. 
     13;     disclaimer in the documentation and/or other materials provided with the distribution.
    1414;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
    15 ;     products derived from this software without specific prior written permission. 
     15;     products derived from this software without specific prior written permission.
    1616;
    1717; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
     
    4646#endif
    4747
     48
    4849/* Kind of platform */
    4950
     
    7172# define C_NONUNIX
    7273#endif
     74
    7375
    7476/* Headers */
     
    109111#endif
    110112
    111 #if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
    112 # define C_BIG_ENDIAN
    113 #elif defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
    114 # define C_BIG_ENDIAN
    115 #elif defined(__BIG_ENDIAN__)
    116 # define C_BIG_ENDIAN
    117 #elif defined(__sparc__) || defined(__POWERPC__) || defined(__MC68K__) || defined(__mips__)
    118 # define C_BIG_ENDIAN
    119 #endif
    120 
    121 #if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN
    122 # define C_LITTLE_ENDIAN
    123 #elif defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && BYTE_ORDER == LITTLE_ENDIAN
    124 # define C_LITTLE_ENDIAN
    125 #elif defined(__LITTLE_ENDIAN__)
    126 # define C_LITTLE_ENDIAN
    127 #elif defined (__alpha__) || defined(_M_IX86) || defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
    128 # define C_LITTLE_ENDIAN
    129 #endif
    130 
    131113#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)
    132114# include <malloc.h>
     115#endif
     116
     117#ifdef _MSC_VER
     118# include <io.h>
    133119#endif
    134120
     
    153139#endif
    154140
     141
     142/* Chicken Core C API */
     143
     144#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
     145# define C_BIG_ENDIAN
     146#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
     147# define C_BIG_ENDIAN
     148#elif defined(__BIG_ENDIAN__)
     149# define C_BIG_ENDIAN
     150#elif defined(__sparc__) || defined(__POWERPC__) || defined(__MC68K__) || defined(__mips__)
     151# define C_BIG_ENDIAN
     152#endif
     153
     154#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN
     155# define C_LITTLE_ENDIAN
     156#elif defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && BYTE_ORDER == LITTLE_ENDIAN
     157# define C_LITTLE_ENDIAN
     158#elif defined(__LITTLE_ENDIAN__)
     159# define C_LITTLE_ENDIAN
     160#elif defined (__alpha__) || defined(_M_IX86) || defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
     161# define C_LITTLE_ENDIAN
     162#endif
     163
     164/* Make sure some common C identifiers are availble w/ Windows */
     165
    155166#ifdef _MSC_VER
    156 # include <io.h>
    157167# define strncasecmp       strnicmp
    158168# define isatty            _isatty
     
    168178#endif
    169179
    170 /* */
     180/* Could be used by C++ source */
    171181
    172182#ifdef __cplusplus
     
    179189# define C_END_C_DECLS
    180190#endif
    181  
    182  /* Function declaration options */
    183  
     191
     192
     193/* Function declaration modes */
     194
     195/* Visibility */
    184196#define C_varextern                C_extern
    185197#define C_fctimport
     
    230242#endif
    231243
    232 /* Thread Local Stoarage declaration */
    233 
     244/* Language specifics: */
     245#if defined(__GNUC__) || defined(__INTEL_COMPILER)
     246# ifndef __cplusplus
     247#  define C_cblock                ({
     248#  define C_cblockend             })
     249#  define C_noret                 __attribute__ ((noreturn))
     250#  define C_noret_decl(name)
     251#  define C_aligned               __attribute__ ((aligned))
     252# endif
     253# ifdef __i386__
     254#  define C_regparm               __attribute__ ((regparm(3)))
     255# endif
     256#elif defined(_MSC_VER)
     257# define C_fcall                  __fastcall
     258#elif defined(__WATCOMC__)
     259# define C_ccall                  __cdecl
     260#endif
     261
     262#ifndef C_cblock
     263# define C_cblock                 do{
     264# define C_cblockend              }while(0)
     265# define C_noret
     266# define C_noret_decl(name)
     267#endif
     268
     269#ifndef C_regparm
     270# define C_regparm
     271#endif
     272
     273#ifndef C_fcall
     274# define C_fcall
     275#endif
     276
     277#ifndef C_ccall
     278# define C_ccall
     279#endif
     280
     281#ifndef C_aligned
     282# define C_aligned
     283#endif
     284
     285#define C_c_regparm
     286
     287/* Thread Local Stoarage */
    234288#ifdef C_ENABLE_TLS
    235289# if defined(__GNUC__)
     
    243297# define C_TLS
    244298#endif
     299
    245300
    246301/* Stack growth direction; used to compute stack addresses */
     
    260315#endif
    261316
     317/* Have a GUI? */
     318
    262319#if defined(C_WINDOWS_GUI)
    263320# define C_MICROSOFT_WINDOWS
     
    266323#endif
    267324
     325/* Needed for pre-emptive threading */
     326
    268327#define C_TIMER_INTERRUPTS
    269 
    270 #ifdef C_DEFAULT_TARGET_STACK_SIZE
    271 # define C_resize_stack(n)           C_do_resize_stack(C_DEFAULT_TARGET_STACK_SIZE)
    272 #else
    273 # define C_resize_stack(n)           C_do_resize_stack(n)
    274 #endif
    275328
    276329/* For the easy FFI: */
     
    505558
    506559
    507 /* Language specifics: */
    508 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
    509 # ifndef __cplusplus
    510 #  define C_cblock                ({
    511 #  define C_cblockend             })
    512 #  define C_noret                 __attribute__ ((noreturn))
    513 #  define C_noret_decl(name)
    514 #  define C_aligned               __attribute__ ((aligned))
    515 # endif
    516 # ifdef __i386__
    517 #  define C_regparm               __attribute__ ((regparm(3)))
    518 # endif
    519 #elif defined(_MSC_VER)
    520 # define C_fcall                  __fastcall
    521 #elif defined(__WATCOMC__)
    522 # define C_ccall                  __cdecl
    523 #endif
    524 
    525 #ifndef C_cblock
    526 # define C_cblock                 do{
    527 # define C_cblockend              }while(0)
    528 # define C_noret
    529 # define C_noret_decl(name)
    530 #endif
    531 
    532 #ifndef C_regparm
    533 # define C_regparm
    534 #endif
    535 
    536 #ifndef C_fcall
    537 # define C_fcall
    538 #endif
    539 
    540 #ifndef C_ccall
    541 # define C_ccall
    542 #endif
    543 
    544 #ifndef C_aligned
    545 # define C_aligned
    546 #endif
    547 
    548 #define C_c_regparm
    549 
    550560/* Types: */
    551561
     
    579589# define C_AMD64_ABI_WEIRDNESS      , ...
    580590#else
    581 # define C_AMD64_ABI_WEIRDNESS     
     591# define C_AMD64_ABI_WEIRDNESS
    582592#endif
    583593
     
    745755
    746756#define C_return(x)                return(x)
     757
     758#ifdef C_DEFAULT_TARGET_STACK_SIZE
     759# define C_resize_stack(n)           C_do_resize_stack(C_DEFAULT_TARGET_STACK_SIZE)
     760#else
     761# define C_resize_stack(n)           C_do_resize_stack(n)
     762#endif
    747763
    748764#define C_memcpy_slots(t, f, n)    C_memcpy((t), (f), (n) * sizeof(C_word))
     
    11361152
    11371153C_varextern C_TLS time_t C_startup_time_seconds;
    1138 C_varextern C_TLS C_word 
     1154C_varextern C_TLS C_word
    11391155  *C_temporary_stack,
    11401156  *C_temporary_stack_bottom,
     
    11651181  C_trace_buffer_size,
    11661182  C_main_argc;
    1167 C_varextern C_TLS C_uword 
     1183C_varextern C_TLS C_uword
    11681184  C_heap_growth,
    11691185  C_heap_shrinkage;
    1170 C_varextern C_TLS char 
     1186C_varextern C_TLS char
    11711187  **C_main_argv,
    11721188  *C_dlerror;
     
    14921508C_fctexport C_word C_fcall C_string_to_pbytevector(C_word x) C_regparm;
    14931509C_fctexport C_word C_fcall C_i_null_pointerp(C_word x) C_regparm;
    1494 C_fctexport C_word C_fcall C_i_fixnum_arithmetic_shift(C_word n, C_word c) C_regparm; 
     1510C_fctexport C_word C_fcall C_i_fixnum_arithmetic_shift(C_word n, C_word c) C_regparm;
    14951511C_fctexport C_word C_fcall C_i_locative_set(C_word loc, C_word x) C_regparm;
    14961512C_fctexport C_word C_fcall C_i_locative_to_object(C_word loc) C_regparm;
  • chicken/branches/chicken-3/lolevel.scm

    r13143 r13147  
    6969     extend-procedure ) ) ] )
    7070
     71(register-feature! 'lolevel)
     72
    7173
    7274;;; Helpers:
     
    129131     "bad argument type - not a vector-like object" x) ) )
    130132
     133(define (##sys#check-pointer x . loc)
     134  (unless (%pointer? x)
     135    (##sys#error-hook
     136     (foreign-value "C_BAD_ARGUMENT_TYPE_NO_POINTER_ERROR" int)
     137     (and (pair? loc) (car loc))
     138     "bad argument type - not a pointer" x) ) )
     139
    131140(cond-expand
    132141 [unsafe
    133142  (eval-when (compile)
    134143    (define-macro (##sys#check-block . _) '(##core#undefined))
    135     (define-macro (##sys#check-alist . _) '(##core#undefined))
     144    (define-macro (##sys#check-become-alist . _) '(##core#undefined))
    136145    (define-macro (##sys#check-generic-structure . _) '(##core#undefined))
    137146    (define-macro (##sys#check-generic-vector . _) '(##core#undefined))
     
    160169 [else
    161170  (declare (emit-exports "lolevel.exports"))] )
    162 
    163 (register-feature! 'lolevel)
    164171
    165172
     
    345352   pointer-f64-set!) )
    346353
     354
    347355;;; Tagged-pointers:
    348356
     
    386394
    387395(define (make-locative obj . index)
    388   (##sys#make-locative obj (:optional index 0) #f 'make-locative) )
     396  (##sys#make-locative obj (optional index 0) #f 'make-locative) )
    389397
    390398(define (make-weak-locative obj . index)
    391   (##sys#make-locative obj (:optional index 0) #t 'make-weak-locative) )
     399  (##sys#make-locative obj (optional index 0) #t 'make-weak-locative) )
    392400
    393401(define (locative-set! x y) (##core#inline "C_i_locative_set" x y))
  • chicken/branches/chicken-3/manual/Unit lolevel

    r13135 r13147  
    44
    55== Unit lolevel
    6 
    76
    87This unit provides a number of handy low-level operations. '''Use
     
    795794
    796795Next: [[Interface to external functions and variables]]
    797 
Note: See TracChangeset for help on using the changeset viewer.