aboutsummaryrefslogtreecommitdiffstats
path: root/mps
diff options
context:
space:
mode:
Diffstat (limited to 'mps')
-rwxr-xr-xmps/code/expgen.sh118
-rw-r--r--mps/code/w3gen.def163
2 files changed, 281 insertions, 0 deletions
diff --git a/mps/code/expgen.sh b/mps/code/expgen.sh
new file mode 100755
index 00000000000..54c8daca2dc
--- /dev/null
+++ b/mps/code/expgen.sh
@@ -0,0 +1,118 @@
1#!/bin/sh
2# $Header$
3#
4# Copyright (C) 2004 Ravenbrook Limited. All rights reserved.
5#
6# expgen.sh
7#
8# Export Generator
9#
10# This is a script to generate the a list of exports that is required
11# for Windows DLL creation.
12#
13# It processed the mps header files and produces a .DEF file that is
14# suitable for use with the linker when producing a DLL file on Windows.
15#
16# When run, this script produces the following output files:
17# expgen - a plain text list of functions declared in the header files.
18# w3gen.def - a .def file suitable for use in the linker stage when
19# building a Windows .DLL.
20#
21#
22# Design
23#
24# The script works by using the -fdump-translation-unit option of gcc.
25# This produces a more easily parseable rendering of the header files.
26# A fairly simple awk script is used to process the output.
27#
28#
29# Dependencies
30#
31# This script currently depends fairly heavily on being run in a
32# Unix-like environment with access to the GNU compiler.
33#
34# It's also fairly sensitive to changes in the undocumented format
35# produced by gcc -fdump-translation-unit. Hopefully it is fairly easy
36# to adapt to changes in this output.
37#
38# Assumes it can freely write to the files "fun", "name-s".
39#
40#
41# Awk crash course
42#
43# Awk processes files line-by-line, thus the entire script is executed
44# for each line of the input file (more complex awk scripts can control
45# this using "next" and "getline" and so on).
46#
47# In awk $exp identifies a field within the line. $1 is the first
48# field, $2 is the second and so on. $0 is the whole line. By default
49# fields are separated by whitespace.
50#
51# string ~ RE is a matching expression and evaulated to true iff the
52# string is matched by the regular expression.
53#
54# REFERENCES
55#
56# [SUSV3] Single UNIX Specification Version 3,
57# http://www.unix.org/single_unix_specification/
58#
59# For documenation of the standard utilities: sh, awk, join, sort, sed
60#
61# [MSDN-LINKER-DEF] Module-Definition (.def) files,
62# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_module.2d.definition_files.asp
63#
64# For documentation on the format of .def files.
65
66tu () {
67 # if invoked on a file called spong.h will produce a file named
68 # spong.h.tu
69 gcc -fdump-translation-unit -o /dev/null "$@"
70}
71
72# This list of header files is produced by
73# awk '/^copy.*\.h/{print $2}' w3build.bat
74# followed by manual removal of mpsw3.h mpswin.h.
75# The functions declared in mpsw3.h have to be added to the .def file by
76# hand later in this script.
77f='mps.h
78mpsavm.h
79mpsacl.h
80mpscamc.h
81mpscams.h
82mpscawl.h
83mpsclo.h
84mpscmv.h
85mpscmvff.h
86mpscsnc.h
87mpsio.h
88mpslib.h
89mpstd.h'
90
91tu $f
92
93>expgen
94
95for a in $f
96do
97 >fun
98 awk '
99 $2=="function_decl" && $7=="srcp:" && $8 ~ /^'$a':/ {print $4 >"fun"}
100 $2=="identifier_node"{print $1,$4}
101 ' $a.tu |
102 sort -k 1 >name-s
103
104 echo ';' $a >>expgen
105 sort -k 1 fun |
106 join -o 2.2 - name-s >>expgen
107done
108
109{
110 printf '%sHeader%s\n' '$' '$'
111 echo '; DO NOT EDIT. Automatically generated by $Header$' | sed 's/\$/!/g'
112 echo 'EXPORTS'
113 cat expgen
114 # This is where we manually the functions declared in mpsw3.h
115 echo ';' mpsw3.h - by hand
116 echo mps_SEH_filter
117 echo mps_SEH_handler
118} > w3gen.def
diff --git a/mps/code/w3gen.def b/mps/code/w3gen.def
new file mode 100644
index 00000000000..41b6e4f22c9
--- /dev/null
+++ b/mps/code/w3gen.def
@@ -0,0 +1,163 @@
1$Header$
2; DO NOT EDIT. Automatically generated by !Header!
3EXPORTS
4; mps.h
5mps_ap_fill_with_reservoir_permit
6mps_ap_fill
7mps_commit
8mps_reserve
9mps_ap_destroy
10mps_ap_create_v
11mps_ap_create
12mps_free
13mps_alloc_v
14mps_alloc
15mps_chain_destroy
16mps_chain_create
17mps_pool_destroy
18mps_pool_create_v
19mps_pool_create
20mps_fmt_destroy
21mps_fmt_create_fixed
22mps_fmt_create_auto_header
23mps_fmt_create_B
24mps_fmt_create_A
25mps_arena_retract
26mps_arena_extend
27mps_arena_has_addr
28mps_space_committed
29mps_arena_formatted_objects_walk
30mps_space_reserved
31mps_arena_spare_commit_limit
32mps_arena_spare_commit_limit_set
33mps_arena_commit_limit_set
34mps_arena_commit_limit
35mps_arena_spare_committed
36mps_arena_committed
37mps_arena_reserved
38mps_space_destroy
39mps_space_create
40mps_arena_destroy
41mps_arena_create_v
42mps_arena_create
43mps_space_collect
44mps_space_park
45mps_space_release
46mps_space_clamp
47mps_arena_step
48mps_arena_collect
49mps_arena_start_collect
50mps_arena_unsafe_restore_protection
51mps_arena_unsafe_expose_remember_protection
52mps_arena_expose
53mps_arena_park
54mps_arena_release
55mps_arena_clamp
56mps_telemetry_flush
57mps_fix
58mps_pool_check_fenceposts
59mps_telemetry_label
60mps_telemetry_intern
61mps_telemetry_control
62mps_definalize
63mps_finalize
64mps_message_gc_not_condemned_size
65mps_message_gc_condemned_size
66mps_message_gc_live_size
67mps_message_finalization_ref
68mps_message_type
69mps_message_queue_type
70mps_message_discard
71mps_message_get
72mps_message_type_disable
73mps_message_type_enable
74mps_message_poll
75mps_collections
76mps_ld_isstale
77mps_ld_merge
78mps_ld_add
79mps_ld_reset
80mps_thread_dereg
81mps_thread_reg
82mps_tramp
83mps_stack_scan_ambig
84mps_root_destroy
85mps_root_create_reg
86mps_root_create_fmt
87mps_root_create_table_masked
88mps_root_create_table
89mps_root_create
90mps_reserve_with_reservoir_permit
91mps_reservoir_available
92mps_reservoir_limit
93mps_arena_roots_walk
94mps_reservoir_limit_set
95mps_sac_empty
96mps_pool_check_free_space
97mps_sac_fill
98mps_sac_flush
99mps_sac_free
100mps_sac_alloc
101mps_sac_destroy
102mps_sac_create
103mps_rank_weak
104mps_ap_alloc_pattern_reset
105mps_rank_exact
106mps_ap_alloc_pattern_end
107mps_rank_ambig
108mps_ap_alloc_pattern_begin
109mps_alloc_pattern_ramp_collect_all
110mps_alloc_pattern_ramp
111mps_ap_trip
112mps_ap_frame_pop
113mps_ap_frame_push
114; mpsavm.h
115mps_arena_class_vmnz
116mps_arena_class_vm
117; mpsacl.h
118mps_arena_class_cl
119; mpscamc.h
120mps_class_amc
121mps_amc_apply
122mps_class_amcz
123; mpscams.h
124mps_class_ams_debug
125mps_class_ams
126; mpscawl.h
127mps_class_awl
128; mpsclo.h
129mps_class_lo
130; mpscmv.h
131mps_mv_size
132mps_class_mv_debug
133mps_mv_free_size
134mps_class_mv
135; mpscmvff.h
136mps_mvff_size
137mps_class_mvff_debug
138mps_mvff_free_size
139mps_class_mvff
140; mpscsnc.h
141mps_class_snc
142; mpsio.h
143mps_io_flush
144mps_io_destroy
145mps_io_create
146mps_io_write
147; mpslib.h
148mps_lib_fputc
149mps_lib_get_stdout
150mps_lib_get_stderr
151mps_lib_get_EOF
152mps_clock
153mps_lib_telemetry_control
154mps_lib_memcmp
155mps_lib_memcpy
156mps_lib_memset
157mps_clocks_per_sec
158mps_lib_assert_fail
159mps_lib_fputs
160; mpstd.h
161; mpsw3.h - by hand
162mps_SEH_filter
163mps_SEH_handler