Module: dfmc-mangling
Author: Jonathan Bachrach
Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
All rights reserved.
License: Functional Objects Library Public License Version 1.0
Dual-license: GNU Lesser General Public License
Warranty: Distributed WITHOUT WARRANTY OF ANY KIND
define constant $module-separator = "Y";
define constant $library-separator = "V";
define constant $local-suffix = "_";
define constant $hygiene-marker = "F";
define constant $escape-separator = "Z";
define constant $constant-prefix = "K";
define constant $symbol-prefix = "J";
define constant $indirection-prefix = "I";
define constant $wrapper-suffix = "W";
define constant $iep-suffix = "I";
define constant $method-mangled-marker-string = "M";
define constant $slot-mangled-marker-string = "H";
define constant $dylan-module-separator = "K";
define constant $domain-mangled-marker-string = "RD_";
// Note that the following must be characters rather than strings, since
// the initialization of mangles tables assumes that.
define constant $method-marker = '#';
define constant $method-mangled-marker = $method-mangled-marker-string[0];
define constant $slot-marker = ',';
define constant $slot-mangled-marker = $slot-mangled-marker-string[0];
define constant $constant-marker = $constant-prefix[0];
define constant $iep-marker = $iep-suffix[0];
define constant $indirection-marker = $indirection-prefix[0];
define constant $wrapper-marker = $wrapper-suffix[0];
define constant $module-marker = $module-separator[0];
define constant $library-marker = $library-separator[0];
define constant $escape-marker = $escape-separator[0];
define constant $symbol-marker = $symbol-prefix[0];
define constant $local-marker = $local-suffix[0];
define constant $hygiene-char = $hygiene-marker[0];
define constant $dylan-module-marker = $dylan-module-separator[0];
define constant $all-prefix-markers
= vector($constant-marker, $indirection-marker, $symbol-marker);
define constant $all-suffix-markers
= vector($local-marker, $wrapper-marker, $iep-marker);
define constant $all-decoration-markers
= concatenate($all-prefix-markers, $all-suffix-markers);
define table $mangle-dylan-module =
{ #"dylan" => 'd',
#"internal" => 'i',
#"dylan-primitives" => 'p',
#"dylan-extensions" => 'e',
#"dylan-c-ffi" => 'c',
#"dylan-incremental" => 'n',
#"dylan-threads" => 't',
#"dispatch-engine" => 'g',
#"machine-word-lowlevel" => 'm' };
define constant $demangle-dylan-module =
begin
let tbl = make(
);
for (abbrev keyed-by mod in $mangle-dylan-module)
element(tbl, abbrev) := mod;
end for;
tbl
end;
define constant $min-character-code = 0;
define constant $max-character-code = 255; // We allow 8 bit ascii.
/// MANGLING
define constant $mangles-data
= vector(#('-', '_'), #('!', 'X'), #('$', 'D'), #('%', 'P'), #('*', 'T'),
#('/', 'S'), #('<', 'L'), #('>', 'G'), #('?', 'Q'), #('+', 'A'),
#('&', 'B'), #('^', 'C'), #('_', 'U'), #('@', 'O'), #('=', 'E'),
#('~', 'N'),
list($method-marker, $method-mangled-marker),
list($slot-marker, $slot-mangled-marker));
define abstract class (