
and functionality improvements (including support for measuring coverage), primitive argument-checking fixes, and object-file changes resulting in reduced load times (and some backward incompatibility): - annotations are now preserved in object files for debug only, for profiling only, for both, or not at all, depending on the settings of generate-inspector-information and compile-profile. in particular, when inspector information is not enabled but profiling is, source information does not leak into error messages and inspector output, though it is still available via the profile tools. The mechanics of this involved repurposing the fasl a? parameter to hold an annotation flags value when it is not #f and remaking annotations with new flags if necessary before emitting them. compile.ss, fasl.ss, misc.ms - altered a number of mats to produce correct results even when the 's' directory is profiled. misc.ms, cp0.ms, record.ms - profile-release-counters is now generation-friendly; that is, it doesn't look for dropped code objects in generations that have not been collected since the last call to profile-release-counters. also, it no longer allocates memory when it releases counters. pdhtml.ss, gc.c, gcwrapper.c, globals.h, prim5.c - removed unused entry points S_ifile, S_ofile, and S_iofile alloc.c, externs.h - mats that test loading profile info into the compiler's database to guide optimization now weed out preexisting entries, in case the 's' directory is profiled. 4.ms, mat.ss, misc.ms, primvars.ms - counters for dropped code objects are now released at the start of each mat group. mat.ss - replaced ehc (enable-heap-check) option with hci (heap-check-interval) option that allows heap checks to be performed periodically rather than on each collection. hci=0 is equivalent to ehc=f (disabling heap checks) and hci=1 is equivalent to ehc=t (enabling heap checks every collection), while hci=100 enables heap checks only every 100th collection. allx and bullyx mats use this feature to reduce heap-checking overhead to a more reasonable level. this is particularly important when the 's' directory is profiled, since the amount of static memory to be checked is greatly increased due to the counters. mats/Mf-base, mat.ss, primvars.ms - added a mat that calls #%show-allocation, which was otherwise not being tested. misc.ms - removed a broken primvars mat and updated two others. in each case, the mat was looking for information about primitives in the wrong (i.e., old) place and silently succeeding when it didn't find any primitives to tests. the revised mats (along with a few others) now check to make sure at least one identifier has the information they look for. the removed mat was checking for library information that is now compiled in, so the mat is now unnecessary. the others were (not) doing argument-error checks. fixing these turned up a handful of problems that have also been fixed: a couple of unbound variables in the mat driver, two broken primdata declarations, a tardy argument check by profile-load-data, and a bug in char-ready?, which was requiring an argument rather than defaulting it to the current input port. primdata.ss, pdhtml.ss, io.ms, primdvars.ms, 4.ms, 6.ms, misc.ms, patch* - added initial support for recording coverage information. when the new parameter generate-covin-files is set, the compiler generates .covin files containing the universe of all source objects for which profile forms are present in the expander output. when profiling and generation of covin files are enabled in the 's' directory, the mats optionally generate .covout files for each mat file giving the subset of the universe covered by the mat file, along with an all.covout in each mat output directory aggregating the coverage for the directory and another all.covout in the top-level mat directory aggregating the coverage for all directories. back.ss, compile.ss, cprep.ss, primdata.ss, s/Mf-base, mat.ss, mats/Mf-base, mats/primvars.ms - support for generating covout files is now built in. with-coverage-output gathers and dumps coverage information, and aggregate-coverage-output combines (aggregates) covout files. pdhtml.ss, primdata.ss, compile.ss, mat.ss, mats/Mf-base, primvars.ms - profile-clear now adjusts active coverage trackers to avoid losing coverage information. pdhtml.ss, prim5.c - nested with-coverage calls are now supported. pdhtml.ss - switched to a more compact representation for covin and covout files; reduces disk space (compressed or not) by about a factor of four and read time by about a factor of two with no increase in write time. primdata.ss, pdhtml.ss, cprep.ss, compile.ss, mat.ss, mats/Mf-base - added support for determining coverage for an entire run, including coverage for expressions hit during boot time. 'all' mats now produce run.covout files in each output directory, and 'allx' mats produce an aggregate run.covout file in the mat directory. pdhtml.ss, mat.ss, mats/Mf-base - profile-release-counters now adjusts active coverage trackers to account for the counters that have been released. pdhtml.ss, prim5.c - replaced the artificial "examples" target with a real "build-examples" target so make won't think it always has to mats that depend upon the examples directory having been compiled. mats make clean now runs make clean in the examples directory. mats/Mf-base importing a library from an object file now just visits the object file rather than doing a full load so that the run-time code for the library is not retained. The run-time code is still read because the current fasl format forces the entire file to be read, but not retaining the code can lower heap size and garbage-collection cost, particularly when many object-code libraries are imported. The downside is that the file must be revisited if the run-time code turns out to be required. This change exposed several places where the code was failing to check if a revisit is needed. syntax.ss, 7.ms, 8.ms, misc.ms, root-experr* - fixed typos: was passing unquoted load rather than quoted load to $load-library along one path (where it is loading source code and therefore irrelevant), and was reporting src-path rather than obj-path in a message about failing to define a library. syntax.ss - compile-file and friends now put all recompile information in the first fasl object after the header so the library manager can find it without loading the entire fasl file. The library manager now does so. It also now checks to see if library object files need to be recreated before loading them rather than loading them and possibly recompiling them after discovering they are out of date, since the latter requires loading the full object file even if it's out of date, while the former takes advantage of the ability to extract just recompile information. as well as reducing overhead, this eliminates possibly undesirable side effects, such as creation and registration of out-of-date nongenerative record-type descriptors. because the library manager expects to find recompile information at the front of an object file, it will not find all recompile information if object files are "catted" together. also, compile-file has to hold in memory the object code for all expressions in the file so that it can emit the unified recompile information, rather than writing to the object file incrementally, which can significantly increase the memory required to compile a large file full of individual top-level forms. This does not affect top-level programs, which were already handled as a whole, or a typical library file that contains just a single library form. compile.ss, syntax.ss - the library manager now checks include files before library dependencies when compile-imported-libraries is false (as it already did when compile-imported-libraries is true) in case a source change affects the set of imported libraries. (A library change can affect the set of include files as well, but checking dependencies before include files can cause unneeded libraries to be loaded.) The include-file check is based on recompile-info rather than dependencies, but the library checks are still based on dependencies. syntax.ss - fixed check for binding of scheme-version. (the check prevents premature treatment of recompile-info records as Lexpand forms to be passed to $interpret-backend.) scheme.c - strip-fasl-file now preserves recompile-info when compile-time info is stripped. strip.ss - removed include-req* from library/ct-info and ctdesc records; it is no longer needed now that all recompile information is maintained separately. expand-lang.ss, syntax.ss, compile.ss, cprep.ss, syntax.ss - changed the fasl format and reworked a lot of code in the expander, compiler, fasl writer, and fasl reader to allow the fasl reader to skip past run-time information when it isn't needed and compile-time information when it isn't needed. Skipping past still involves reading and decoding when encrypted, but the fasl reader no longer parses or allocates code and data in the portions to be skipped. Side effects of associating record uids with rtds are also avoided, as are the side effects of interning symbols present only in the skipped data. Skipping past code objects also reduces or eliminates the need to synchronize data and instruction caches. Since the fasl reader no longer returns compile-time (visit) or run-time (revisit) code and data when not needed, the fasl reader no longer wraps these objects in a pair with a 0 or 1 visit or revisit marker. To support this change, the fasl writer generates separate top-level fasl entries (and graphs) for separate forms in the same top-level source form (e.g., begin or library). This reliably breaks eq-ness of shared structure across these forms, which was previously broken only when visit or revisit code was loaded at different times (this is an incompatible change). Because of the change, fasl "groups" are no longer needed, so they are no longer handled. 7.ss, cmacros.ss, compile.ss, expand-lang.ss, strip.ss, externs.h, fasl.c, scheme.c, hash.ms - the change above is surfaced in an optional fasl-read "situation" argument (visit, revisit, or load). The default is load. visit causes it to skip past revisit code and data; revisit causes it to skip past visit code and data; and load causes it not to skip past either. visit-revisit data produced by (eval-when (visit revisit) ---) is never skipped. 7.ss, primdata.ss, io.stex - to improve compile-time and run-time error checking, the Lexpand recompile-info, library/rt-info, library-ct-info, and program-info forms have been replaced with list-structured forms, e.g., (recompile-info ,rcinfo). expand-lang.ss, compile.ss, cprep.ss, interpret.ss, syntax.ss - added visit-compiled-from-port and revisit-compiled-from-port to complement the existing load-compiled-from-port. 7.ss, primdata.ss, 7.ms, system.stex - increased amount read when seeking an lz4-encrypted input file from 32 to 1024 bytes at a time compress-io.c - replaced the fasl a? parameter value #t with an "all" flag value so it's value is consistently a mask. cmacros.ss, fasl.ss, compile.ss - split off profile mats into a separate file misc.ms, profile.ms (new), root-experr*, mats/Mf-base - added coverage percent computations to mat allx/bullyx output mat.ss, mats/Mf-base, primvars.ms - replaced coverage tables with more generic and generally useful source tables, which map source objects to arbitrary values. pdhtml.ss, compile.ss, cprep.ss, primdata.ss, mat.ss, mats/Mf-base, primvars.ms, profile.ms, syntax.stex - reduced profile counting overhead by using calls to fold-left instead of calls to apply and map and by using fixnum operations for profile counts on 64-bit machines. pdhtml.ss - used a critical section to fix a race condition in the calculations of profile counts that sometimes resulted in bogus (including negative) counts, especially when the 's' directory is profiled. pdhtml.ss - added discard flag to declaration for hashtable-size primdata.ss - redesigned the printed representation of source tables and rewrote get-source-table! to read and store incrementally to reduce memory overhead. compile.ss - added generate-covin-files to the set of parameters preserved by compile-file, etc. compile.ss, system.stex - moved covop argument before the undocumented machine and hostop arguments to compile-port and compile-to-port. removed the undocumented ofn argument from compile-to-port; using (port-name ip) instead. compile.ss, primdata.ss, 7.ms, system.stex - compile-port now tries to come up with a file position to supply to make-read, which it can do if the port's positions are character positions (presently string ports) or if the port is positioned at zero. compile.ss - audited the argument-type-error fuzz mat exceptions and fixed a host of problems this turned up (entries follow). added #f as an invalid argument for every type for which #f is indeed invalid to catch places where the maybe- prefix was missing on the argument type. the mat tries hard to determine if the condition raised (if any) as the result of an invalid argument is appropriate and redirects the remainder to the mat-output (.mo) file prefixed with 'Expected error', causing them to show up in the expected error output so developers will be encouraged to audit them in the future. primvars.ms, mat.ss - added an initial symbol? test on machine type names so we produce an invalid machine type error message rather than something confusing like "machine type #f is not supported". compile.ss - fixed declarations for many primitives that were specified as accepting arguments of more general types than they actually accept, such as number -> real for various numeric operations, symbol -> endianness for various bytevector operations, time -> time-utc for time-utc->date, and list -> list-of-string-pairs for default-library-search-handler. also replaced some of the sub-xxxx types with specific types such as sub-symbol -> endianness in utf16->string, but only where they were causing issues with the primvars argument-type-error fuzz mat. (this should be done more generally.) primdata.ss - fixed incorrect who arguments (was map instead of fold-right, current-date instead of time-utc->date); switched to using define-who/set-who! generally. 4.ss, date.ss - append! now checks all arguments before any mutation 5_2.ss - with-source-path now properly supplies itself as who for the string? argument check; callers like load now do their own checks. 7.ss - added missing integer? check to $fold-bytevector-native-ref whose lack could have resulted in a compile-time error. cp0.ss - fixed typo in output-port-buffer-mode error message io.ss - fixed who argument (was fx< rather than fx<?) library.ss - fixed declaration of first source-file-descriptor argument (was sfd, now string) primdata.ss - added missing article 'a' in a few error messages prims.ss - fixed the copy-environment argument-type error message for the list of symbols argument. syntax.ss - the environment procedure now catches exceptions that occur and reraises the exception with itself as who if the condition isn't already a who condition. syntax.ss - updated experr and allx patch files for changes to argument-count fuzz mat and fixes for problems turned up by them. root-experr*, patch* - fixed a couple of issues setting port sizes: string and bytevector output port put handlers don't need room to store the character or byte, so they now set the size to the buffer length rather than one less. binary-file-port-clear-output now sets the index rather than size to zero; setting the size to zero is inappropriate for some types of ports and could result in loss of buffering and even suppression of future output. removed a couple of redundant sets of the size that occur immediately after setting the buffer. io.ss - it is now possible to return from a call to with-profile-tracker multiple times and not double-count (or worse) any counts. pdhtml.ss, profile.ms - read-token now requires a file position when it is handed a source-file descriptor (since the source-file descriptor isn't otherwise useful), and the source-file descriptor argument can no longer be #f. the input file position plays the same role as the input file position in get-datum/annotations. these extra read-token arguments are now documented. read.ss, 6.ms, io.stex - the source-file descriptor argument to get-datum/annotations can no longer be #f. it was already documented that way. read.ss - read-token and do-read now look for the character-positions port flag before asking if the port has port-position, since the latter is slightly more expensive. read.ss - rd-error now reports the current port position if it can be determined when fp isn't already set, i.e., when reading from a port without character positions (presently any non string port) and fp has not been passed in explicitly (to read-token or get-datum/annotations). the port position might not be a character position, but it should be better than nothing. read.ss - added comment noting an invariant for s_profile_release_counters. prim5.c - restored accidentally dropped fasl-write formdef and dropped duplicate fasl-read formdef io.stex - added a 'coverage' target that tests the coverage of the Scheme-code portions of Chez Scheme by the mats. Makefile.in, Makefile-workarea.in - added .PHONY declarations for all of the targets in the top-level and workarea make files, and renamed the create-bintar, create-rpm, and create-pkg targets bintar, rpm, and pkg. Makefile.in, Makefile-workarea.in - added missing --retain-static-relocation command-line argument and updated the date scheme.1.in - removed a few redundant conditional variable settings configure - fixed declaration of condition wait (timeout -> maybe-timeout) primdata.ss original commit: 88501743001393fa82e89c90da9185fc0086fbcb
402 lines
16 KiB
C
402 lines
16 KiB
C
/* externs.h
|
|
* Copyright 1984-2017 Cisco Systems, Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
/* This file sets up platform-dependent includes and extern declarations
|
|
* for Scheme globals not intended for use outside of the system (prefixed
|
|
* with S_). Scheme globals intended for use outside of the system
|
|
* (prefixed with S) are declared in scheme.h
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
|
|
#ifndef WIN32
|
|
#include <unistd.h>
|
|
|
|
#if (machine_type == machine_type_i3qnx || machine_type == machine_type_ti3qnx)
|
|
off64_t lseek64(int,off64_t,int);
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef SOLARIS
|
|
#include <fcntl.h>
|
|
#include <sys/wait.h>
|
|
#include <setjmp.h>
|
|
#endif
|
|
|
|
#ifdef WIN32
|
|
#include <fcntl.h>
|
|
#include <direct.h> /* for _getcwd */
|
|
#include <setjmp.h>
|
|
#endif
|
|
|
|
#if !defined(NORETURN)
|
|
# if defined(__GNUC__) || defined(__clang__)
|
|
# define NORETURN __attribute__((noreturn))
|
|
# elif defined(_MSC_VER)
|
|
# define NORETURN __declspec(noreturn)
|
|
# else
|
|
# define NORETURN
|
|
# endif /* defined(__GNUC__) || defined(__clang__) */
|
|
#endif /* !defined(NORETURN) */
|
|
|
|
/* external procedure declarations */
|
|
/* prototypes gen. by ProtoGen Version 0.31 (Haydn Huntley) 1/18/93 */
|
|
|
|
/* alloc.c */
|
|
extern void S_alloc_init PROTO((void));
|
|
extern void S_protect PROTO((ptr *p));
|
|
extern void S_reset_scheme_stack PROTO((ptr tc, iptr n));
|
|
extern void S_reset_allocation_pointer PROTO((ptr tc));
|
|
extern ptr S_compute_bytes_allocated PROTO((ptr xg, ptr xs));
|
|
extern ptr S_find_more_room PROTO((ISPC s, IGEN g, iptr n, ptr old));
|
|
extern void S_dirty_set PROTO((ptr *loc, ptr x));
|
|
extern void S_scan_dirty PROTO((ptr **p, ptr **endp));
|
|
extern void S_scan_remembered_set PROTO((void));
|
|
extern void S_get_more_room PROTO((void));
|
|
extern ptr S_get_more_room_help PROTO((ptr tc, uptr ap, uptr type, uptr size));
|
|
extern ptr S_cons_in PROTO((ISPC s, IGEN g, ptr car, ptr cdr));
|
|
extern ptr S_symbol PROTO((ptr name));
|
|
extern ptr S_rational PROTO((ptr n, ptr d));
|
|
extern ptr S_tlc PROTO((ptr keyval, ptr tconc, ptr next));
|
|
extern ptr S_vector_in PROTO((ISPC s, IGEN g, iptr n));
|
|
extern ptr S_vector PROTO((iptr n));
|
|
extern ptr S_fxvector PROTO((iptr n));
|
|
extern ptr S_bytevector PROTO((iptr n));
|
|
extern ptr S_null_immutable_vector PROTO((void));
|
|
extern ptr S_null_immutable_fxvector PROTO((void));
|
|
extern ptr S_null_immutable_bytevector PROTO((void));
|
|
extern ptr S_null_immutable_string PROTO((void));
|
|
extern ptr S_record PROTO((iptr n));
|
|
extern ptr S_closure PROTO((ptr cod, iptr n));
|
|
extern ptr S_mkcontinuation PROTO((ISPC s, IGEN g, ptr nuate, ptr stack,
|
|
iptr length, iptr clength, ptr link, ptr ret, ptr winders));
|
|
extern ptr S_inexactnum PROTO((double rp, double ip));
|
|
extern ptr S_exactnum PROTO((ptr a, ptr b));
|
|
extern ptr S_thread PROTO((ptr tc));
|
|
extern ptr S_string PROTO((const char *s, iptr n));
|
|
extern ptr S_bignum PROTO((iptr n, IBOOL sign));
|
|
extern ptr S_code PROTO((ptr tc, iptr type, iptr n));
|
|
extern ptr S_relocation_table PROTO((iptr n));
|
|
extern ptr S_weak_cons PROTO((ptr car, ptr cdr));
|
|
|
|
/* fasl.c */
|
|
extern void S_fasl_init PROTO((void));
|
|
ptr S_fasl_read PROTO((ptr file, IBOOL gzflag, IFASLCODE situation, ptr path));
|
|
ptr S_bv_fasl_read PROTO((ptr bv, ptr path));
|
|
/* S_boot_read's f argument is really gzFile, but zlib.h is not included everywhere */
|
|
ptr S_boot_read PROTO((glzFile file, const char *path));
|
|
char *S_format_scheme_version PROTO((uptr n));
|
|
char *S_lookup_machine_type PROTO((uptr n));
|
|
extern void S_set_code_obj PROTO((char *who, IFASLCODE typ, ptr p, iptr n,
|
|
ptr x, iptr o));
|
|
extern ptr S_get_code_obj PROTO((IFASLCODE typ, ptr p, iptr n, iptr o));
|
|
|
|
/* flushcache.c */
|
|
extern void S_record_code_mod PROTO((ptr tc, uptr addr, uptr bytes));
|
|
extern void S_flush_instruction_cache PROTO((ptr tc));
|
|
extern void S_flushcache_init PROTO((void));
|
|
|
|
/* foreign.c */
|
|
extern void S_foreign_init PROTO((void));
|
|
extern void S_foreign_entry PROTO((void));
|
|
|
|
/* gcwrapper.c */
|
|
extern void S_ptr_tell PROTO((ptr p));
|
|
extern void S_addr_tell PROTO((ptr p));
|
|
extern void S_gc_init PROTO((void));
|
|
#ifndef WIN32
|
|
extern void S_register_child_process PROTO((INT child));
|
|
#endif /* WIN32 */
|
|
extern void S_fixup_counts PROTO((ptr counts));
|
|
extern void S_do_gc PROTO((IGEN g, IGEN gtarget));
|
|
extern void S_gc PROTO((ptr tc, IGEN mcg, IGEN tg));
|
|
extern void S_gc_init PROTO((void));
|
|
extern void S_set_maxgen PROTO((IGEN g));
|
|
extern IGEN S_maxgen PROTO((void));
|
|
extern void S_set_minfreegen PROTO((IGEN g));
|
|
extern IGEN S_minfreegen PROTO((void));
|
|
#ifndef WIN32
|
|
extern void S_register_child_process PROTO((INT child));
|
|
#endif /* WIN32 */
|
|
extern IBOOL S_enable_object_counts PROTO((void));
|
|
extern void S_set_enable_object_counts PROTO((IBOOL eoc));
|
|
extern ptr S_object_counts PROTO((void));
|
|
extern void S_do_gc PROTO((IGEN g, IGEN gtarget));
|
|
extern ptr S_locked_objects PROTO((void));
|
|
extern void S_compact_heap PROTO((void));
|
|
extern void S_check_heap PROTO((IBOOL aftergc));
|
|
|
|
/* gc-ocd.c */
|
|
extern void S_gc_ocd PROTO((ptr tc, IGEN mcg, IGEN tg));
|
|
|
|
/* gc-oce.c */
|
|
extern void S_gc_oce PROTO((ptr tc, IGEN mcg, IGEN tg));
|
|
|
|
/* intern.c */
|
|
extern void S_intern_init PROTO((void));
|
|
extern void S_resize_oblist PROTO((void));
|
|
extern ptr S_intern PROTO((const unsigned char *s));
|
|
extern ptr S_intern_sc PROTO((const string_char *s, iptr n, ptr name_str));
|
|
extern ptr S_intern3 PROTO((const string_char *pname, iptr plen, const string_char *uname, iptr ulen, ptr pname_str, ptr uame_str));
|
|
extern void S_intern_gensym PROTO((ptr g));
|
|
extern void S_retrofit_nonprocedure_code PROTO((void));
|
|
|
|
/* io.c */
|
|
extern IBOOL S_file_existsp PROTO((const char *inpath, IBOOL followp));
|
|
extern IBOOL S_file_regularp PROTO((const char *inpath, IBOOL followp));
|
|
extern IBOOL S_file_directoryp PROTO((const char *inpath, IBOOL followp));
|
|
extern IBOOL S_file_symbolic_linkp PROTO((const char *inpath));
|
|
#ifdef WIN32
|
|
extern ptr S_find_files PROTO((const char *wildpath));
|
|
#else
|
|
extern ptr S_directory_list PROTO((const char *inpath));
|
|
#endif
|
|
extern char *S_malloc_pathname PROTO((const char *inpath));
|
|
#ifdef WIN32
|
|
extern wchar_t *S_malloc_wide_pathname PROTO((const char *inpath));
|
|
#endif
|
|
extern IBOOL S_fixedpathp PROTO((const char *inpath));
|
|
|
|
/* compress-io.c */
|
|
extern glzFile S_glzdopen_output PROTO((INT fd, INT compress_format, INT compress_level));
|
|
extern glzFile S_glzdopen_input PROTO((INT fd));
|
|
extern glzFile S_glzopen_input PROTO((const char *path));
|
|
#ifdef WIN32
|
|
extern glzFile S_glzopen_input_w PROTO((const wchar_t *path));
|
|
#endif
|
|
extern IBOOL S_glzdirect PROTO((glzFile file));
|
|
extern INT S_glzclose PROTO((glzFile file));
|
|
|
|
extern INT S_glzread PROTO((glzFile file, void *buffer, UINT count));
|
|
extern INT S_glzwrite PROTO((glzFile file, void *buffer, UINT count));
|
|
extern long S_glzseek PROTO((glzFile file, long offset, INT whence));
|
|
extern INT S_glzgetc PROTO((glzFile file));
|
|
extern INT S_glzungetc PROTO((INT c, glzFile file));
|
|
extern INT S_glzrewind PROTO((glzFile file));
|
|
|
|
extern void S_glzerror PROTO((glzFile file, INT *errnum));
|
|
extern void S_glzclearerr PROTO((glzFile fdfile));
|
|
|
|
|
|
/* new-io.c */
|
|
extern INT S_gzxfile_fd PROTO((ptr x));
|
|
extern glzFile S_gzxfile_gzfile PROTO((ptr x));
|
|
extern ptr S_new_open_input_fd PROTO((const char *filename, IBOOL compressed));
|
|
extern ptr S_new_open_output_fd PROTO((
|
|
const char *filename, INT mode,
|
|
IBOOL no_create, IBOOL no_fail, IBOOL no_truncate,
|
|
IBOOL append, IBOOL lock, IBOOL replace, IBOOL compressed));
|
|
extern ptr S_new_open_input_output_fd PROTO((
|
|
const char *filename, INT mode,
|
|
IBOOL no_create, IBOOL no_fail, IBOOL no_truncate,
|
|
IBOOL append, IBOOL lock, IBOOL replace, IBOOL compressed));
|
|
extern ptr S_close_fd PROTO((ptr file, IBOOL gzflag));
|
|
extern ptr S_compress_input_fd PROTO((INT fd, I64 fp));
|
|
extern ptr S_compress_output_fd PROTO((INT fd));
|
|
|
|
extern ptr S_bytevector_read PROTO((ptr file, ptr buffer, iptr start, iptr count, IBOOL gzflag));
|
|
extern ptr S_bytevector_read_nb PROTO((ptr file, ptr buffer, iptr start, iptr count, IBOOL gzflag));
|
|
extern ptr S_bytevector_write PROTO((ptr file, ptr buffer, iptr start, iptr count, IBOOL gzflag));
|
|
extern ptr S_put_byte PROTO((ptr file, INT byte, IBOOL gzflag));
|
|
|
|
extern ptr S_get_fd_pos PROTO((ptr file, IBOOL gzflag));
|
|
extern ptr S_set_fd_pos PROTO((ptr file, ptr pos, IBOOL gzflag));
|
|
extern ptr S_get_fd_non_blocking PROTO((ptr file, IBOOL gzflag));
|
|
extern ptr S_set_fd_non_blocking PROTO((ptr file, IBOOL x, IBOOL gzflag));
|
|
extern ptr S_get_fd_length PROTO((ptr file, IBOOL gzflag));
|
|
extern ptr S_set_fd_length PROTO((ptr file, ptr length, IBOOL gzflag));
|
|
extern void S_new_io_init PROTO((void));
|
|
|
|
extern uptr S_bytevector_compress_size PROTO((iptr s_count, INT compress_format));
|
|
extern ptr S_bytevector_compress PROTO((ptr dest_bv, iptr d_start, iptr d_count,
|
|
ptr src_bv, iptr s_start, iptr s_count,
|
|
INT compress_format));
|
|
extern ptr S_bytevector_uncompress PROTO((ptr dest_bv, iptr d_start, iptr d_count,
|
|
ptr src_bv, iptr s_start, iptr s_count,
|
|
INT compress_format));
|
|
|
|
/* thread.c */
|
|
extern void S_thread_init PROTO((void));
|
|
extern ptr S_create_thread_object PROTO((const char *who, ptr p_tc));
|
|
#ifdef PTHREADS
|
|
extern ptr S_fork_thread PROTO((ptr thunk));
|
|
extern scheme_mutex_t *S_make_mutex PROTO((void));
|
|
extern void S_mutex_free PROTO((scheme_mutex_t *m));
|
|
extern void S_mutex_acquire PROTO((scheme_mutex_t *m));
|
|
extern INT S_mutex_tryacquire PROTO((scheme_mutex_t *m));
|
|
extern void S_mutex_release PROTO((scheme_mutex_t *m));
|
|
extern s_thread_cond_t *S_make_condition PROTO((void));
|
|
extern void S_condition_free PROTO((s_thread_cond_t *c));
|
|
extern IBOOL S_condition_wait PROTO((s_thread_cond_t *c, scheme_mutex_t *m, ptr t));
|
|
extern INT S_activate_thread PROTO((void));
|
|
extern void S_unactivate_thread PROTO((int mode));
|
|
#endif
|
|
|
|
/* scheme.c */
|
|
extern void S_generic_invoke PROTO((ptr tc, ptr code));
|
|
|
|
/* number.c */
|
|
extern void S_number_init PROTO((void));
|
|
extern ptr S_normalize_bignum PROTO((ptr x));
|
|
extern IBOOL S_integer_valuep PROTO((ptr x));
|
|
extern iptr S_integer_value PROTO((const char *who, ptr x));
|
|
extern I64 S_int64_value PROTO((char *who, ptr x));
|
|
extern IBOOL S_big_eq PROTO((ptr x, ptr y));
|
|
extern IBOOL S_big_lt PROTO((ptr x, ptr y));
|
|
extern ptr S_add PROTO((ptr x, ptr y));
|
|
extern ptr S_sub PROTO((ptr x, ptr y));
|
|
extern ptr S_mul PROTO((ptr x, ptr y));
|
|
extern ptr S_div PROTO((ptr x, ptr y));
|
|
extern ptr S_rem PROTO((ptr x, ptr y));
|
|
extern ptr S_trunc PROTO((ptr x, ptr y));
|
|
extern void S_trunc_rem PROTO((ptr x, ptr y, ptr *q, ptr *r));
|
|
extern ptr S_gcd PROTO((ptr x, ptr y));
|
|
extern ptr S_ash PROTO((ptr x, ptr n));
|
|
extern ptr S_big_positive_bit_field PROTO((ptr x, ptr fxstart, ptr fxend));
|
|
extern ptr S_integer_length PROTO((ptr x));
|
|
extern ptr S_big_first_bit_set PROTO((ptr x));
|
|
extern double S_random_double PROTO((U32 m1, U32 m2,
|
|
U32 m3, U32 m4, double scale));
|
|
extern double S_floatify PROTO((ptr x));
|
|
extern ptr S_decode_float PROTO((double d));
|
|
extern ptr S_logand PROTO((ptr x, ptr y));
|
|
extern ptr S_logbitp PROTO((ptr k, ptr x));
|
|
extern ptr S_logbit0 PROTO((ptr k, ptr x));
|
|
extern ptr S_logbit1 PROTO((ptr k, ptr x));
|
|
extern ptr S_logtest PROTO((ptr x, ptr y));
|
|
extern ptr S_logor PROTO((ptr x, ptr y));
|
|
extern ptr S_logxor PROTO((ptr x, ptr y));
|
|
extern ptr S_lognot PROTO((ptr x));
|
|
|
|
/* prim.c */
|
|
extern ptr S_lookup_library_entry PROTO((iptr n, IBOOL errorp));
|
|
extern ptr S_lookup_c_entry PROTO((iptr i));
|
|
extern void S_prim_init PROTO((void));
|
|
|
|
/* prim5.c */
|
|
extern ptr S_strerror PROTO((INT errnum));
|
|
extern void S_prim5_init PROTO((void));
|
|
extern void S_dump_tc PROTO((ptr tc));
|
|
|
|
/* print.c */
|
|
extern void S_print_init PROTO((void));
|
|
extern void S_prin1 PROTO((ptr x));
|
|
|
|
/* schsig.c */
|
|
extern ptr S_get_scheme_arg PROTO((ptr tc, iptr n));
|
|
extern void S_put_scheme_arg PROTO((ptr tc, iptr n, ptr x));
|
|
extern iptr S_continuation_depth PROTO((ptr k));
|
|
extern ptr S_single_continuation PROTO((ptr k, iptr n));
|
|
extern void S_split_and_resize PROTO((void));
|
|
extern void S_handle_overflow PROTO((void));
|
|
extern void S_handle_overflood PROTO((void));
|
|
extern void S_handle_apply_overflood PROTO((void));
|
|
extern void S_overflow PROTO((ptr tc, iptr frame_request));
|
|
extern NORETURN void S_error_reset PROTO((const char *s));
|
|
extern NORETURN void S_error_abort PROTO((const char *s));
|
|
extern NORETURN void S_abnormal_exit PROTO((void));
|
|
extern NORETURN void S_error PROTO((const char *who, const char *s));
|
|
extern NORETURN void S_error1 PROTO((const char *who, const char *s, ptr x));
|
|
extern NORETURN void S_error2 PROTO((const char *who, const char *s, ptr x, ptr y));
|
|
extern NORETURN void S_error3 PROTO((const char *who, const char *s, ptr x, ptr y, ptr z));
|
|
extern NORETURN void S_boot_error PROTO((const ptr who, ptr s, ptr args));
|
|
extern void S_handle_docall_error PROTO((void));
|
|
extern void S_handle_arg_error PROTO((void));
|
|
extern void S_handle_nonprocedure_symbol PROTO((void));
|
|
extern void S_handle_values_error PROTO((void));
|
|
extern void S_handle_mvlet_error PROTO((void));
|
|
extern void S_register_scheme_signal PROTO((iptr sig));
|
|
extern void S_fire_collector PROTO((void));
|
|
extern NORETURN void S_noncontinuable_interrupt PROTO((void));
|
|
extern void S_schsig_init PROTO((void));
|
|
#ifdef DEFINE_MATHERR
|
|
#include <math.h>
|
|
extern INT matherr PROTO((struct exception *x));
|
|
#endif /* DEFINE_MATHERR */
|
|
|
|
/* segment.c */
|
|
extern void S_segment_init PROTO((void));
|
|
extern void *S_getmem PROTO((iptr bytes, IBOOL zerofill));
|
|
extern void S_freemem PROTO((void *addr, iptr bytes));
|
|
extern iptr S_find_segments PROTO((ISPC s, IGEN g, iptr n));
|
|
extern void S_free_chunk PROTO((chunkinfo *chunk));
|
|
extern void S_free_chunks PROTO((void));
|
|
extern uptr S_curmembytes PROTO((void));
|
|
extern uptr S_maxmembytes PROTO((void));
|
|
extern void S_resetmaxmembytes PROTO((void));
|
|
extern void S_move_to_chunk_list PROTO((chunkinfo *chunk, chunkinfo **pchunk_list));
|
|
|
|
/* stats.c */
|
|
extern void S_stats_init PROTO((void));
|
|
extern ptr S_cputime PROTO((void));
|
|
extern ptr S_realtime PROTO((void));
|
|
extern ptr S_clock_gettime PROTO((I32 typeno));
|
|
extern ptr S_gmtime PROTO((ptr tzoff, ptr tspair));
|
|
extern ptr S_asctime PROTO((ptr dtvec));
|
|
extern ptr S_mktime PROTO((ptr dtvec));
|
|
extern ptr S_unique_id PROTO((void));
|
|
extern void S_gettime PROTO((INT typeno, struct timespec *tp));
|
|
|
|
/* symbol.c */
|
|
extern ptr S_symbol_value PROTO((ptr sym));
|
|
extern void S_set_symbol_value PROTO((ptr sym, ptr val));
|
|
|
|
/* machine-dependent .c files, e.g., x88k.c */
|
|
#ifdef FLUSHCACHE
|
|
extern INT S_flushcache_max_gap PROTO((void));
|
|
extern void S_doflush PROTO((uptr start, uptr end));
|
|
#endif
|
|
extern void S_machine_init PROTO((void));
|
|
|
|
/* schlib.c */
|
|
extern void S_initframe PROTO((ptr tc, iptr n));
|
|
extern void S_put_arg PROTO((ptr tc, iptr i, ptr x));
|
|
extern void S_return PROTO((void));
|
|
extern void S_call_help PROTO((ptr tc, IBOOL singlep, IBOOL lock_ts));
|
|
extern void S_call_one_result PROTO((void));
|
|
extern void S_call_any_results PROTO((void));
|
|
|
|
#ifdef WIN32
|
|
/* windows.c */
|
|
extern INT S_getpagesize(void);
|
|
extern ptr S_LastErrorString(void);
|
|
extern void *S_ntdlopen(const char *path);
|
|
extern void *S_ntdlsym(void *h, const char *s);
|
|
extern char *S_ntdlerror(void);
|
|
extern int S_windows_flock(int fd, int operation);
|
|
extern int S_windows_chdir(const char *pathname);
|
|
extern int S_windows_chmod(const char *pathname, int mode);
|
|
extern int S_windows_mkdir(const char *pathname);
|
|
extern int S_windows_open(const char *pathname, int flags, int mode);
|
|
extern int S_windows_rename(const char *oldpathname, const char *newpathname);
|
|
extern int S_windows_rmdir(const char *pathname);
|
|
extern int S_windows_stat64(const char *pathname, struct STATBUF *buffer);
|
|
extern int S_windows_system(const char *command);
|
|
extern int S_windows_unlink(const char *pathname);
|
|
extern char *S_windows_getcwd(char *buffer, int maxlen);
|
|
#endif /* WIN32 */
|
|
|
|
#ifdef FEATURE_EXPEDITOR
|
|
/* expeditor.c */
|
|
extern void S_expeditor_init PROTO((void));
|
|
#endif /* FEATURE_EXPEDITOR */
|
|
|
|
/* statics.c */
|
|
extern void scheme_statics();
|