## makelib-preprocessor-state-g.pkg
# Compiled by:
#
src/app/makelib/makelib.sublib# Building a host/OS-specific dictionary
# for makelib "preprocessor" variables.
# We are invoked from;
#
#
src/app/makelib/main/makelib-g.pkg#
src/app/makelib/mythryl-compiler-compiler/mythryl-compiler-compiler-g.pkgstipulate
package mcv = mythryl_compiler_version; # mythryl_compiler_version is from
src/lib/core/internal/mythryl-compiler-version.pkg package mpd = makelib_preprocessor_dictionary; # makelib_preprocessor_dictionary is from
src/app/makelib/main/makelib-preprocessor-dictionary.pkg package sa = supported_architectures; # supported_architectures is from
src/lib/compiler/front/basics/main/supported-architectures.pkgherein
generic package makelib_preprocessor_state_g (
#
architecture: sa::Supported_Architectures; # PWRPC32/SPARC32/INTEL32.
os_kind: platform_properties::os::Kind;
abi_variant: Null_Or( String );
)
{
stipulate
extra_symbols
=
case abi_variant
#
NULL => [];
THE s => ["ABI_" + s];
esac;
dict0 # error_message is from
src/lib/compiler/front/basics/errormsg/error-message.pkg =
mpd::make_default_makelib_preprocessor_dictionary
{
architecture,
os_kind,
compiler_version => mcv::mythryl_compiler_version.compiler_version_id, # Something like: [110, 58, 3, 0, 2],
extra_symbols
};
dictionary_state
=
REF dict0; # More icky thread-hostile mutable global state. :-/ This should be in makelib_session or such. XXX BUGGO FIXME
herein
# This is the client runtime interface to makelib's
# preprocessor dictionary state -- the set of variables
# you can test by writing
#
# #if defined(FOO)
#
# in a foo.lib file
#
# Here, given a string, we return get/set functions for
# accessint its value in the preprocessor dictionary state:
#
fun find_makelib_preprocessor_symbol (string: String)
=
{ fun get () # Return current value of 'string' in dictionary.
=
mpd::get *dictionary_state string;
fun set (null_or_value: Null_Or(Int)) # Set value of 'string' in dictionary to given int. (Drop 'string' from dictionary if 'value' is NULL.)
=
dictionary_state
:=
mpd::define (*dictionary_state, string, null_or_value);
#
{ get, set };
};
end;
};
end;
## (C) 1999 Lucent Technologies, Bell Laboratories
## Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.