Changeset 13177 in project


Ignore:
Timestamp:
02/04/09 01:35:11 (11 years ago)
Author:
Kon Lovett
Message:

runtime.c : use of C defines for platform info, reflowed some comments & code since > 100 chars long.
chicken.h : use of C defines for platform info

Location:
chicken/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/chicken.h

    r13167 r13177  
    448448# define C_BUCKET_TYPE            (0x0f000000)
    449449#endif
    450 
     450#define C_VECTOR_TYPE             0x00000000
     451#define C_BYTEVECTOR_TYPE         (C_VECTOR_TYPE | C_BYTEBLOCK_BIT | C_8ALIGN_BIT)
     452
     453#define C_SIZEOF_LIST(n)          ((n) * 3 + 1)
     454#define C_SIZEOF_PAIR             3
     455#define C_SIZEOF_STRING(n)        (C_bytestowords(n) + 2)
     456#define C_SIZEOF_SYMBOL           4
     457#define C_SIZEOF_INTERNED_SYMBOL(n) (C_SIZEOF_SYMBOL + C_SIZEOF_BUCKET + C_SIZEOF_STRING(n))
     458#ifdef C_DOUBLE_IS_32_BITS
     459# define C_SIZEOF_FLONUM          2
     460#else
     461# define C_SIZEOF_FLONUM          4
     462#endif
     463#define C_SIZEOF_POINTER          2
     464#define C_SIZEOF_TAGGED_POINTER   3
     465#define C_SIZEOF_SWIG_POINTER     3
     466#define C_SIZEOF_VECTOR(n)        ((n) + 1)
     467#define C_SIZEOF_BUCKET           3
     468#define C_SIZEOF_LOCATIVE         5
     469#define C_SIZEOF_PORT             16
     470
     471/* Fixed size types have pre-computed header tags */
     472#define C_PAIR_TAG                (C_PAIR_TYPE | (C_SIZEOF_PAIR - 1))
     473#define C_POINTER_TAG             (C_POINTER_TYPE | (C_SIZEOF_POINTER - 1))
     474#define C_LOCATIVE_TAG            (C_LOCATIVE_TYPE | (C_SIZEOF_LOCATIVE - 1))
     475#define C_TAGGED_POINTER_TAG      (C_TAGGED_POINTER_TYPE | (C_SIZEOF_TAGGED_POINTER - 1))
     476#define C_SWIG_POINTER_TAG        (C_SWIG_POINTER_TYPE | (C_wordstobytes(C_SIZEOF_SWIG_POINTER - 1)))
     477#define C_SYMBOL_TAG              (C_SYMBOL_TYPE | (C_SIZEOF_SYMBOL - 1))
     478#define C_FLONUM_TAG              (C_FLONUM_TYPE | sizeof(double))
     479
     480/* Locative subtypes */
    451481#define C_SLOT_LOCATIVE           0
    452482#define C_CHAR_LOCATIVE           1
     
    459489#define C_F32_LOCATIVE            8
    460490#define C_F64_LOCATIVE            9
    461 
    462 #define C_VECTOR_TYPE             0x00000000
    463 #define C_BYTEVECTOR_TYPE         (C_VECTOR_TYPE | C_BYTEBLOCK_BIT | C_8ALIGN_BIT)
    464 
    465 #define C_SIZEOF_LIST(n)          ((n) * 3 + 1)
    466 #define C_SIZEOF_PAIR             3
    467 #define C_SIZEOF_STRING(n)        (C_bytestowords(n) + 2)
    468 #define C_SIZEOF_SYMBOL           4
    469 #define C_SIZEOF_INTERNED_SYMBOL(n) (C_SIZEOF_SYMBOL + C_SIZEOF_BUCKET + C_SIZEOF_STRING(n))
    470 #ifdef C_DOUBLE_IS_32_BITS
    471 # define C_SIZEOF_FLONUM          2
    472 #else
    473 # define C_SIZEOF_FLONUM          4
    474 #endif
    475 #define C_SIZEOF_POINTER          2
    476 #define C_SIZEOF_TAGGED_POINTER   3
    477 #define C_SIZEOF_SWIG_POINTER     3
    478 #define C_SIZEOF_VECTOR(n)        ((n) + 1)
    479 #define C_SIZEOF_BUCKET           3
    480 #define C_SIZEOF_LOCATIVE         5
    481 #define C_SIZEOF_PORT             16
    482 
    483 #define C_PAIR_TAG                (C_PAIR_TYPE | (C_SIZEOF_PAIR - 1))
    484 #define C_POINTER_TAG             (C_POINTER_TYPE | (C_SIZEOF_POINTER - 1))
    485 #define C_LOCATIVE_TAG            (C_LOCATIVE_TYPE | (C_SIZEOF_LOCATIVE - 1))
    486 #define C_TAGGED_POINTER_TAG      (C_TAGGED_POINTER_TYPE | (C_SIZEOF_TAGGED_POINTER - 1))
    487 #define C_SWIG_POINTER_TAG        (C_SWIG_POINTER_TYPE | (C_wordstobytes(C_SIZEOF_SWIG_POINTER - 1)))
    488 #define C_SYMBOL_TAG              (C_SYMBOL_TYPE | (C_SIZEOF_SYMBOL - 1))
    489 #define C_FLONUM_TAG              (C_FLONUM_TYPE | sizeof(double))
    490491
    491492#ifdef C_SIXTY_FOUR
     
    552553
    553554
    554 #define CHICKEN_gc_root_ref(root)      (((C_GC_ROOT *)(root))->value)
    555 #define CHICKEN_gc_root_set(root, x)   C_mutate(&((C_GC_ROOT *)(root))->value, (x))
    556 
    557 #define CHICKEN_global_ref(root)       C_u_i_car(((C_GC_ROOT *)(root))->value)
    558 #define CHICKEN_global_set(root, x)    C_mutate(&C_u_i_car(((C_GC_ROOT *)(root))->value), (x))
    559 
    560 #define CHICKEN_default_toplevel       ((void *)C_default_stub_toplevel)
     555/* Platform information */
     556#if defined(C_BIG_ENDIAN)
     557# define C_MACHINE_BYTE_ORDER "big-endian"
     558#elif defined(C_LITTLE_ENDIAN)
     559# define C_MACHINE_BYTE_ORDER "little-endian"
     560#endif
     561
     562#if defined(__alpha__)
     563# define C_MACHINE_TYPE "alpha"
     564#elif defined(__mips__)
     565# define C_MACHINE_TYPE "mips"
     566#elif defined(__hppa__)
     567# define C_MACHINE_TYPE "hppa"
     568#elif defined(__sparc_v9__) || defined(__sparcv9)
     569# define C_MACHINE_TYPE "ultrasparc"
     570#elif defined(__sparc__)
     571# define C_MACHINE_TYPE "sparc"
     572#elif defined(__powerpc64__)
     573# define C_MACHINE_TYPE "ppc64"
     574#elif defined(__ppc__) || defined(__powerpc__)
     575# define C_MACHINE_TYPE "ppc"
     576#elif defined(_M_IX86) || defined(__i386__)
     577# define C_MACHINE_TYPE "x86"
     578#elif defined(__ia64__)
     579# define C_MACHINE_TYPE "ia64"
     580#elif defined(__x86_64__)
     581# define C_MACHINE_TYPE "x86-64"
     582#elif defined(__arm__)
     583# define C_MACHINE_TYPE "arm"
     584#else
     585# define C_MACHINE_TYPE "unknown"
     586#endif
     587
     588#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(_WIN32) || defined(__WINNT__)
     589# define C_SOFTWARE_TYPE "windows"
     590#elif defined(__unix__) || defined(C_XXXBSD)
     591# define C_SOFTWARE_TYPE "unix"
     592#elif defined(ECOS)
     593# define C_SOFTWARE_TYPE "ecos"
     594#else
     595# define C_SOFTWARE_TYPE "unknown"
     596#endif
     597
     598#if defined(__CYGWIN__)
     599# define C_BUILD_PLATFORM "cygwin"
     600#elif defined(_MSC_VER)
     601# define C_BUILD_PLATFORM "msvc"
     602#elif defined(__SUNPRO_C)
     603# define C_BUILD_PLATFORM "sun"
     604#elif defined(__MINGW32__)
     605# define C_BUILD_PLATFORM "mingw32"
     606#elif defined(__GNUC__)
     607# define C_BUILD_PLATFORM "gnu"
     608#elif defined(__MWERKS__)
     609# define C_BUILD_PLATFORM "metrowerks"
     610#elif defined(__INTEL_COMPILER)
     611# define C_BUILD_PLATFORM "intel"
     612#elif defined(__WATCOMC__)
     613# define C_BUILD_PLATFORM "watcom"
     614#else
     615# define C_BUILD_PLATFORM "unknown"
     616#endif
     617
     618#if defined(_MSC_VER)
     619# if defined(_DLL)
     620#   define C_RUNTIME_VERSION "dynamic"
     621# else
     622#   define C_RUNTIME_VERSION "static"
     623# endif
     624#else
     625# define C_RUNTIME_VERSION "unknown"
     626#endif
     627
     628#if defined(__linux__)
     629# define C_SOFTWARE_VERSION "linux"
     630#elif defined(__FreeBSD__)
     631# define C_SOFTWARE_VERSION "freebsd"
     632#elif defined(__NetBSD__)
     633# define C_SOFTWARE_VERSION "netbsd"
     634#elif defined(__OpenBSD__)
     635# define C_SOFTWARE_VERSION "openbsd"
     636#elif defined(C_MACOSX)
     637# define C_SOFTWARE_VERSION "macosx"
     638#elif defined(__hpux__)
     639# define C_SOFTWARE_VERSION "hpux"
     640#elif defined(__DragonFly__)
     641# define C_SOFTWARE_VERSION "dragonfly"
     642#elif defined(__sun__)
     643# if defined(__svr4__)
     644#   define C_SOFTWARE_VERSION "solaris"
     645# else
     646#   define C_SOFTWARE_VERSION "sunos"
     647# endif
     648#else
     649# define C_SOFTWARE_VERSION "unknown"
     650#endif
    561651
    562652
     
    661751
    662752/* Macros: */
     753
     754#define CHICKEN_gc_root_ref(root)      (((C_GC_ROOT *)(root))->value)
     755#define CHICKEN_gc_root_set(root, x)   C_mutate(&((C_GC_ROOT *)(root))->value, (x))
     756
     757#define CHICKEN_global_ref(root)       C_u_i_car(((C_GC_ROOT *)(root))->value)
     758#define CHICKEN_global_set(root, x)    C_mutate(&C_u_i_car(((C_GC_ROOT *)(root))->value), (x))
     759
     760#define CHICKEN_default_toplevel       ((void *)C_default_stub_toplevel)
    663761
    664762#define C_align4(n)                (((n) + 3) & ~3)
  • chicken/trunk/runtime.c

    r13167 r13177  
    528528static C_PTABLE_ENTRY *create_initial_ptable();
    529529
    530 #if !defined(NO_DLOAD2) &&(defined(HAVE_DLFCN_H) || defined(HAVE_DL_H) || (defined(HAVE_LOADLIBRARY) && defined(HAVE_GETPROCADDRESS)))
     530#if !defined(NO_DLOAD2) && (defined(HAVE_DLFCN_H) || defined(HAVE_DL_H) || (defined(HAVE_LOADLIBRARY) && defined(HAVE_GETPROCADDRESS)))
    531531static void dload_2(void *dummy) C_noret;
    532532#endif
     
    655655  finalizer_list = NULL;
    656656  finalizer_free_list = NULL;
    657   pending_finalizer_indices = (FINALIZER_NODE **)C_malloc(C_max_pending_finalizers * sizeof(FINALIZER_NODE *));
     657  pending_finalizer_indices =
     658      (FINALIZER_NODE **)C_malloc(C_max_pending_finalizers * sizeof(FINALIZER_NODE *));
    658659
    659660  if(pending_finalizer_indices == NULL) return 0;
    660661
    661662  /* Initialize forwarding table: */
    662   forwarding_table = (C_word *)C_malloc((DEFAULT_FORWARDING_TABLE_SIZE + 1) * 2 * sizeof(C_word));
     663  forwarding_table =
     664      (C_word *)C_malloc((DEFAULT_FORWARDING_TABLE_SIZE + 1) * 2 * sizeof(C_word));
    663665
    664666  if(forwarding_table == NULL) return 0;
     
    16841686
    16851687    if(C_getrusage(RUSAGE_SELF, &ru) == -1) return 0;
    1686     else return (ru.ru_utime.tv_sec + ru.ru_stime.tv_sec) * 1000 + (ru.ru_utime.tv_usec + ru.ru_stime.tv_usec) / 1000;
     1688    else return (ru.ru_utime.tv_sec + ru.ru_stime.tv_sec) * 1000
     1689                 + (ru.ru_utime.tv_usec + ru.ru_stime.tv_usec) / 1000;
    16871690#endif
    16881691}
     
    18361839void C_zap_strings(C_word str)
    18371840{
    1838   C_word bucket, sym;
    18391841  int i;
    18401842 
    1841   for(i = 0; i < symbol_table->size; ++i)
    1842     for(bucket = symbol_table->table[ i ]; bucket != C_SCHEME_END_OF_LIST; bucket = C_u_i_cdr(bucket)) {
     1843  for(i = 0; i < symbol_table->size; ++i) {
     1844    C_word bucket, sym;
     1845
     1846    for(bucket = symbol_table->table[ i ];
     1847        bucket != C_SCHEME_END_OF_LIST;
     1848        bucket = C_u_i_cdr(bucket)) {
    18431849      sym = C_u_i_car(bucket);
    18441850      C_set_block_item(sym, 1, str);
    1845     } 
     1851    }
     1852  }
    18461853}
    18471854
     
    20442051    s = C_u_i_cdr(sym);
    20452052
    2046     if(C_header_size(s) == (C_word)len && !C_memcmp(str, (C_char *)((C_SCHEME_BLOCK *)s)->data, len))
     2053    if(C_header_size(s) == (C_word)len
     2054       && !C_memcmp(str, (C_char *)((C_SCHEME_BLOCK *)s)->data, len))
    20472055      return sym;
    20482056  }
     
    24352443  double m;
    24362444
    2437   if(n <= (double)C_MOST_POSITIVE_FIXNUM && n >= (double)C_MOST_NEGATIVE_FIXNUM && modf(n, &m) == 0.0)
     2445  if(n <= (double)C_MOST_POSITIVE_FIXNUM
     2446     && n >= (double)C_MOST_NEGATIVE_FIXNUM && modf(n, &m) == 0.0)
    24382447    return C_fix(n);
    24392448
     
    26222631      assert(mutation_stack_top == mutation_stack_limit);
    26232632      mssize = mutation_stack_top - mutation_stack_bottom;
    2624       mutation_stack_bottom = (C_word **)realloc(mutation_stack_bottom, (mssize + MUTATION_STACK_GROWTH) * sizeof(C_word *));
    2625      
     2633      mutation_stack_bottom =
     2634          (C_word **)realloc(mutation_stack_bottom,
     2635                             (mssize + MUTATION_STACK_GROWTH) * sizeof(C_word *));
     2636
    26262637      if(mutation_stack_bottom == NULL)
    26272638        panic(C_text("out of memory - cannot re-allocate mutation stack"));
     
    28812892
    28822893    if(C_enable_gcweak) {
    2883       /* Check entries in weak item table and recover items ref'd only once and which are unbound symbols: */
     2894      /* Check entries in weak item table and recover items ref'd only
     2895      * once and which are unbound symbols: */
    28842896      weakn = 0;
    28852897      wep = weak_item_table;
     
    33373349    }
    33383350
    3339     /* Link points into nursery, fromspace or the old tospace: fetch new pointer + header and copy... */
     3351    /* Link points into nursery, fromspace or the old tospace:
     3352    * fetch new pointer + header and copy... */
    33403353    p = (C_SCHEME_BLOCK *)val;
    33413354    h = p->header;
     
    33433356
    33443357    while(is_fptr(h)) {
    3345       /* Link points into fromspace or old tospace and into a link which points into tospace or new-tospace: */
     3358      /* Link points into fromspace or old tospace and into a link which
     3359       * points into tospace or new-tospace: */
    33463360      val = fptr_to_ptr(h);
    33473361       
     
    33913405  C_uword ptr2;
    33923406
    3393   /*  C_printf("major: %d, %d locs in %d\n", major, locative_table_count, locative_table_size); */
     3407  /*C_printf("major: %d, %d locs in %d\n", major, locative_table_count, locative_table_size); */
    33943408
    33953409  for(i = 0; i < locative_table_count; ++i) {
     
    34043418        if(is_fptr(h))          /* forwarded? update l-table entry */
    34053419          loc = locative_table[ i ] = fptr_to_ptr(h);
    3406         else if(C_in_stackp(loc)) { /* otherwise it must have been GC'd (since this is a minor one) */
     3420        /* otherwise it must have been GC'd (since this is a minor one) */
     3421        else if(C_in_stackp(loc)) {
    34073422          locative_table[ i ] = C_SCHEME_UNDEFINED;
    34083423          C_set_block_item(loc, 0, 0);
     
    34103425        }
    34113426
    3412         ptr = C_block_item(loc, 0); /* forwarded. fix up ptr and check pointed-at object for being forwarded... */
     3427        /* forwarded. fix up ptr and check pointed-at object for being forwarded... */
     3428        ptr = C_block_item(loc, 0);
    34133429        offset = C_unfix(C_block_item(loc, 1));
    34143430        obj = ptr - offset;
     
    35173533  /* Build vector with context information: */
    35183534  n = C_temporary_stack_bottom - C_temporary_stack;
    3519   p = C_alloc(19 + n); /* 19 <=> 2 headers + trampoline + proc + 1 extra slot + 9 for interning + 5 for string */
     3535  /* 19 <=> 2 headers + trampoline + proc + 1 extra slot + 9 for interning + 5 for string */
     3536  p = C_alloc(19 + n);
    35203537  x = (C_word)p;
    35213538  *(p++) = C_VECTOR_TYPE | C_BYTEBLOCK_BIT | (2 * sizeof(C_word));
     
    35453562  last_interrupt_latency = c;
    35463563  C_timer_interrupt_counter = C_initial_timer_interrupt_period; /* just in case */
    3547   C_do_apply(2, x, C_SCHEME_UNDEFINED);  /* <- no continuation is passed: "##sys#interrupt-hook" may not return! */
     3564  /* <- no continuation is passed: "##sys#interrupt-hook" may not return! */
     3565  C_do_apply(2, x, C_SCHEME_UNDEFINED);
    35483566}
    35493567
     
    35793597  if(val == C_SCHEME_UNBOUND) {
    35803598    len = C_strlen(name);
    3581     p = C_alloc(C_SIZEOF_STRING(len));  /* this is ok: we won't return from `C_retrieve2' (or the value isn't needed). */
     3599    /* this is ok: we won't return from `C_retrieve2'
     3600     * (or the value isn't needed). */
     3601    p = C_alloc(C_SIZEOF_STRING(len));
    35823602    return get_unbound_variable_value(C_string2(&p, name));
    35833603  }
     
    36513671  if(val == C_SCHEME_UNBOUND) {
    36523672    len = C_strlen(name);
    3653     p = C_alloc(C_SIZEOF_STRING(len));  /* this is ok: we won't return from `C_retrieve2' (or the value isn't needed). */
     3673    /* this is ok: we won't return from `C_retrieve2' (or the value isn't needed). */
     3674    p = C_alloc(C_SIZEOF_STRING(len));
    36543675    val = get_unbound_variable_value(C_string2(&p, name));
    36553676  }
     
    38043825      if(ptr >= trace_buffer_limit) ptr = trace_buffer;
    38053826
    3806       C_mutate(&C_block_item(buffer, p++), (C_word)ptr->raw); /* outside-pointer, will be ignored by GC */
     3827      /* outside-pointer, will be ignored by GC */
     3828      C_mutate(&C_block_item(buffer, p++), (C_word)ptr->raw);
    38073829      C_mutate(&C_block_item(buffer, p++), ptr->cooked1);
    38083830      C_mutate(&C_block_item(buffer, p++), ptr->cooked2);
     
    43634385  double m, f = C_flonum_magnitude(n);
    43644386
    4365   if(f <= (double)C_MOST_POSITIVE_FIXNUM && f >= (double)C_MOST_NEGATIVE_FIXNUM && modf(f, &m) == 0.0)
     4387  if(f <= (double)C_MOST_POSITIVE_FIXNUM
     4388     && f >= (double)C_MOST_NEGATIVE_FIXNUM && modf(f, &m) == 0.0)
    43664389    return C_fix(f);
    43674390  else return n;
     
    45804603  n = C_header_size(x);
    45814604
    4582   return C_mk_bool(n == C_header_size(y) && !C_memcmp((char *)C_data_pointer(x), (char *)C_data_pointer(y), n));
     4605  return C_mk_bool(n == C_header_size(y)
     4606                   && !C_memcmp((char *)C_data_pointer(x), (char *)C_data_pointer(y), n));
    45834607}
    45844608
     
    45894613
    45904614  n = C_header_size(x);
    4591   return C_mk_bool(n == C_header_size(y) && !C_memcmp((char *)C_data_pointer(x), (char *)C_data_pointer(y), n));
     4615  return C_mk_bool(n == C_header_size(y)
     4616         && !C_memcmp((char *)C_data_pointer(x), (char *)C_data_pointer(y), n));
    45924617}
    45934618
     
    46724697C_regparm C_word C_fcall C_i_numberp(C_word x)
    46734698{
    4674   return C_mk_bool((x & C_FIXNUM_BIT) || (!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG));
     4699  return C_mk_bool((x & C_FIXNUM_BIT)
     4700         || (!C_immediatep(x) && C_block_header(x) == C_FLONUM_TAG));
    46754701}
    46764702
     
    59956021C_regparm C_word C_fcall C_i_foreign_tagged_pointer_argumentp(C_word x, C_word t)
    59966022{
    5997   if(C_immediatep(x) || (C_header_bits(x) & C_SPECIALBLOCK_BIT) == 0 || (t != C_SCHEME_FALSE && !C_equalp(C_block_item(x, 1), t)))
     6023  if(C_immediatep(x) || (C_header_bits(x) & C_SPECIALBLOCK_BIT) == 0
     6024     || (t != C_SCHEME_FALSE && !C_equalp(C_block_item(x, 1), t)))
    59986025    barf(C_BAD_ARGUMENT_TYPE_NO_TAGGED_POINTER_ERROR, NULL, x, t);
    59996026
     
    81138140  int n = 0, total;
    81148141  C_SYMBOL_TABLE *stp;
    8115   C_word x, y, ab[ WORDS_PER_FLONUM * 2 + 5 ], *a = ab; /* 2 flonums + 1 vector of 4 elements */
     8142  C_word x, y,
     8143         ab[ WORDS_PER_FLONUM * 2 + 5 ], /* 2 flonums + 1 vector of 4 elements */
     8144         *a = ab;
    81168145
    81178146  for(stp = symbol_table_list; stp != NULL; stp = stp->next)
     
    82088237void C_ccall C_machine_byte_order(C_word c, C_word closure, C_word k)
    82098238{
     8239  char *str;
    82108240  C_word *a, s;
    82118241
    82128242  if(c != 2) C_bad_argc(c, 2);
    82138243
    8214 #if defined(C_BIG_ENDIAN)
    8215   a = C_alloc(2 + C_bytestowords(10));
    8216   s = C_string2(&a, "big-endian");
    8217 #elif defined(C_LITTLE_ENDIAN)
    8218   a = C_alloc(2 + C_bytestowords(13));
    8219   s = C_string2(&a, "little-endian");
     8244#if defined(C_MACHINE_BYTE_ORDER)
     8245  str = C_MACHINE_BYTE_ORDER;
    82208246#else
    82218247  C_cblock
    82228248    static C_word one_two_three = 123;
    8223     if(*((C_char *)&one_two_three) != 123) {
    8224       a = C_alloc(2 + C_bytestowords(10));
    8225       s = C_string2(&a, "big-endian");
    8226     } else {
    8227       a = C_alloc(2 + C_bytestowords(13));
    8228       s = C_string2(&a, "little-endian");
    8229     }
     8249    str = (*((C_char *)&one_two_three) != 123) ? "big-endian" : "little-endian";
    82308250  C_cblockend
    82318251#endif
    82328252
     8253  a = C_alloc(2 + C_bytestowords(strlen(str)));
     8254  s = C_string2(&a, str);
     8255
    82338256  C_kontinue(k, s);
    82348257}
     
    82418264  if(c != 2) C_bad_argc(c, 2);
    82428265
    8243 #if defined(__alpha__)
    8244   a = C_alloc(2 + C_bytestowords(5));
    8245   s = C_string2(&a, "alpha");
    8246 #elif defined(__mips__)
    8247   a = C_alloc(2 + C_bytestowords(4));
    8248   s = C_string2(&a, "mips");
    8249 #elif defined(__hppa__)
    8250   a = C_alloc(2 + C_bytestowords(4));
    8251   s = C_string2(&a, "hppa");
    8252 #elif defined(__sparc_v9__) || defined(__sparcv9)
    8253   a = C_alloc(2 + C_bytestowords(10));
    8254   s = C_string2(&a, "ultrasparc");
    8255 #elif defined(__sparc__)
    8256   a = C_alloc(2 + C_bytestowords(5));
    8257   s = C_string2(&a, "sparc");
    8258 #elif defined(__powerpc64__)
    8259   a = C_alloc(2 + C_bytestowords(5));
    8260   s = C_string2(&a, "ppc64");
    8261 #elif defined(__ppc__) || defined(__powerpc__)
    8262   a = C_alloc(2 + C_bytestowords(3));
    8263   s = C_string2(&a, "ppc");
    8264 #elif defined(_M_IX86) || defined(__i386__)
    8265   a = C_alloc(2 + C_bytestowords(3));
    8266   s = C_string2(&a, "x86");
    8267 #elif defined(__ia64__)
    8268   a = C_alloc(2 + C_bytestowords(4));
    8269   s = C_string2(&a, "ia64");
    8270 #elif defined(__x86_64__)
    8271   a = C_alloc(2 + C_bytestowords(6));
    8272   s = C_string2(&a, "x86-64");
    8273 #elif defined(__arm__)
    8274   a = C_alloc(2 + C_bytestowords(3));
    8275   s = C_string2(&a, "arm");
    8276 #else
    8277   a = C_alloc(2 + C_bytestowords(7));
    8278   s = C_string2(&a, "unknown");
    8279 #endif
     8266  a = C_alloc(2 + C_bytestowords(strlen(C_MACHINE_TYPE)));
     8267  s = C_string2(&a, C_MACHINE_TYPE);
    82808268 
    82818269  C_kontinue(k, s);
     
    82898277  if(c != 2) C_bad_argc(c, 2);
    82908278
    8291 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(_WIN32) || defined(__WINNT__)
    8292   a = C_alloc(2 + C_bytestowords(7));
    8293   s = C_string2(&a, "windows");
    8294 #elif defined(__unix__) || defined(C_XXXBSD)
    8295   a = C_alloc(2 + C_bytestowords(4));
    8296   s = C_string2(&a, "unix");
    8297 #elif defined(ECOS)
    8298   a = C_alloc(2 + C_bytestowords(4));
    8299   s = C_string2(&a, "ecos");
    8300 #else
    8301   a = C_alloc(2 + C_bytestowords(7));
    8302   s = C_string2(&a, "unknown");
    8303 #endif
     8279  a = C_alloc(2 + C_bytestowords(strlen(C_SOFTWARE_TYPE)));
     8280  s = C_string2(&a, C_SOFTWARE_TYPE);
    83048281
    83058282 C_kontinue(k, s);
     
    83138290  if(c != 2) C_bad_argc(c, 2);
    83148291
    8315 #if defined(__CYGWIN__)
    8316   a = C_alloc(2 + C_bytestowords(6));
    8317   s = C_string2(&a, "cygwin");
    8318 #elif defined(_MSC_VER)
    8319   a = C_alloc(2 + C_bytestowords(4));
    8320   s = C_string2(&a, "msvc");
    8321 #elif defined(__SUNPRO_C)
    8322   a = C_alloc(2 + C_bytestowords(3));
    8323   s = C_string2(&a, "sun");
    8324 #elif defined(__MINGW32__)
    8325   a = C_alloc(2 + C_bytestowords(7));
    8326   s = C_string2(&a, "mingw32");
    8327 #elif defined(__GNUC__)
    8328   a = C_alloc(2 + C_bytestowords(3));
    8329   s = C_string2(&a, "gnu");
    8330 #elif defined(__INTEL_COMPILER)
    8331   a = C_alloc(2 + C_bytestowords(5));
    8332   s = C_string2(&a, "intel");
    8333 #else
    8334   a = C_alloc(2 + C_bytestowords(7));
    8335   s = C_string2(&a, "unknown");
    8336 #endif
     8292  a = C_alloc(2 + C_bytestowords(strlen(C_BUILD_PLATFORM)));
     8293  s = C_string2(&a, C_BUILD_PLATFORM);
    83378294
    83388295 C_kontinue(k, s);
     
    83478304  if(c != 2) C_bad_argc(c, 2);
    83488305
    8349 #if defined(_MSC_VER)
    8350 # if defined(_DLL)
    8351   a = C_alloc(2 + C_bytestowords(7));
    8352   s = C_string2(&a, "dynamic");
    8353 # else
    8354   a = C_alloc(2 + C_bytestowords(6));
    8355   s = C_string2(&a, "static");
    8356 # endif
    8357 #else
    8358   a = C_alloc(2 + C_bytestowords(7));
    8359   s = C_string2(&a, "unknown");
    8360 #endif
     8306  a = C_alloc(2 + C_bytestowords(strlen(C_RUNTIME_VERSION)));
     8307  s = C_string2(&a, C_RUNTIME_VERSION);
    83618308
    83628309 C_kontinue(k, s);
     
    83708317  if(c != 2) C_bad_argc(c, 2);
    83718318
    8372 #if defined(__linux__)
    8373   a = C_alloc(2 + C_bytestowords(5));
    8374   s = C_string2(&a, "linux");
    8375 #elif defined(__FreeBSD__)
    8376   a = C_alloc(2 + C_bytestowords(7));
    8377   s = C_string2(&a, "freebsd");
    8378 #elif defined(__NetBSD__)
    8379   a = C_alloc(2 + C_bytestowords(6));
    8380   s = C_string2(&a, "netbsd");
    8381 #elif defined(__OpenBSD__)
    8382   a = C_alloc(2 + C_bytestowords(7));
    8383   s = C_string2(&a, "openbsd");
    8384 #elif defined(C_MACOSX)
    8385   a = C_alloc(2 + C_bytestowords(6));
    8386   s = C_string2(&a, "macosx");
    8387 #elif defined(__hpux__)
    8388   a = C_alloc(2 + C_bytestowords(4));
    8389   s = C_string2(&a, "hpux");
    8390 #elif defined(__DragonFly__)
    8391   a = C_alloc(2 + C_bytestowords(9));
    8392   s = C_string2(&a, "dragonfly");
    8393 #elif defined(__sun__)
    8394  #if defined(__svr4__)
    8395   a = C_alloc(2 + C_bytestowords(7));
    8396   s = C_string2(&a, "solaris");
    8397  #else
    8398   a = C_alloc(2 + C_bytestowords(5));
    8399   s = C_string2(&a, "sunos");
    8400  #endif
    8401 #else
    8402   a = C_alloc(2 + C_bytestowords(7));
    8403   s = C_string2(&a, "unknown");
    8404 #endif
     8319  a = C_alloc(2 + C_bytestowords(strlen(C_SOFTWARE_VERSION)));
     8320  s = C_string2(&a, C_SOFTWARE_VERSION);
    84058321
    84068322 C_kontinue(k, s);
     
    85938509
    85948510    if(p != NULL) {
    8595       /* check whether dloaded code is not a library unit and matches current safety setting: */
     8511      /* check whether dloaded code is not a library unit
     8512       * and matches current safety setting: */
    85968513      if((p2 = C_dlsym(handle, C_text("C_dynamic_and_unsafe"))) == NULL)
    85978514        p2 = C_dlsym(handle, C_text("_C_dynamic_and_unsafe"));
     
    86038520#endif
    86048521     
    8605       if(!ok && !C_strcmp(topname, "C_toplevel")) /* unsafe marker not found and this is not a library unit? */
     8522      /* unsafe marker not found and this is not a library unit? */
     8523      if(!ok && !C_strcmp(topname, "C_toplevel"))
    86068524#ifdef C_UNSAFE_RUNTIME
    86078525        barf(C_RUNTIME_UNSAFE_DLOAD_SAFE_ERROR, NULL);
     
    86688586  if((handle = LoadLibrary(mname)) != NULL) {
    86698587    if ((p = GetProcAddress(handle, topname)) != NULL) {
    8670       /* check whether dloaded code is not a library unit and matches current safety setting: */
     8588      /* check whether dloaded code is not a library unit
     8589       * and matches current safety setting: */
    86718590      p2 = GetProcAddress(handle, C_text("C_dynamic_and_unsafe"));
    86728591
     
    86778596#endif
    86788597     
    8679       if(!ok && !C_strcmp(topname, "C_toplevel")) /* unsafe marker not found and this is not a library unit? */
     8598      /* unsafe marker not found and this is not a library unit? */
     8599      if(!ok && !C_strcmp(topname, "C_toplevel"))
    86808600#ifdef C_UNSAFE_RUNTIME
    86818601        barf(C_RUNTIME_UNSAFE_DLOAD_SAFE_ERROR, NULL);
Note: See TracChangeset for help on using the changeset viewer.