diff options
| -rwxr-xr-x | mps/code/expgen.sh | 118 | ||||
| -rw-r--r-- | mps/code/w3gen.def | 163 |
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 | |||
| 66 | tu () { | ||
| 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. | ||
| 77 | f='mps.h | ||
| 78 | mpsavm.h | ||
| 79 | mpsacl.h | ||
| 80 | mpscamc.h | ||
| 81 | mpscams.h | ||
| 82 | mpscawl.h | ||
| 83 | mpsclo.h | ||
| 84 | mpscmv.h | ||
| 85 | mpscmvff.h | ||
| 86 | mpscsnc.h | ||
| 87 | mpsio.h | ||
| 88 | mpslib.h | ||
| 89 | mpstd.h' | ||
| 90 | |||
| 91 | tu $f | ||
| 92 | |||
| 93 | >expgen | ||
| 94 | |||
| 95 | for a in $f | ||
| 96 | do | ||
| 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 | ||
| 107 | done | ||
| 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! | ||
| 3 | EXPORTS | ||
| 4 | ; mps.h | ||
| 5 | mps_ap_fill_with_reservoir_permit | ||
| 6 | mps_ap_fill | ||
| 7 | mps_commit | ||
| 8 | mps_reserve | ||
| 9 | mps_ap_destroy | ||
| 10 | mps_ap_create_v | ||
| 11 | mps_ap_create | ||
| 12 | mps_free | ||
| 13 | mps_alloc_v | ||
| 14 | mps_alloc | ||
| 15 | mps_chain_destroy | ||
| 16 | mps_chain_create | ||
| 17 | mps_pool_destroy | ||
| 18 | mps_pool_create_v | ||
| 19 | mps_pool_create | ||
| 20 | mps_fmt_destroy | ||
| 21 | mps_fmt_create_fixed | ||
| 22 | mps_fmt_create_auto_header | ||
| 23 | mps_fmt_create_B | ||
| 24 | mps_fmt_create_A | ||
| 25 | mps_arena_retract | ||
| 26 | mps_arena_extend | ||
| 27 | mps_arena_has_addr | ||
| 28 | mps_space_committed | ||
| 29 | mps_arena_formatted_objects_walk | ||
| 30 | mps_space_reserved | ||
| 31 | mps_arena_spare_commit_limit | ||
| 32 | mps_arena_spare_commit_limit_set | ||
| 33 | mps_arena_commit_limit_set | ||
| 34 | mps_arena_commit_limit | ||
| 35 | mps_arena_spare_committed | ||
| 36 | mps_arena_committed | ||
| 37 | mps_arena_reserved | ||
| 38 | mps_space_destroy | ||
| 39 | mps_space_create | ||
| 40 | mps_arena_destroy | ||
| 41 | mps_arena_create_v | ||
| 42 | mps_arena_create | ||
| 43 | mps_space_collect | ||
| 44 | mps_space_park | ||
| 45 | mps_space_release | ||
| 46 | mps_space_clamp | ||
| 47 | mps_arena_step | ||
| 48 | mps_arena_collect | ||
| 49 | mps_arena_start_collect | ||
| 50 | mps_arena_unsafe_restore_protection | ||
| 51 | mps_arena_unsafe_expose_remember_protection | ||
| 52 | mps_arena_expose | ||
| 53 | mps_arena_park | ||
| 54 | mps_arena_release | ||
| 55 | mps_arena_clamp | ||
| 56 | mps_telemetry_flush | ||
| 57 | mps_fix | ||
| 58 | mps_pool_check_fenceposts | ||
| 59 | mps_telemetry_label | ||
| 60 | mps_telemetry_intern | ||
| 61 | mps_telemetry_control | ||
| 62 | mps_definalize | ||
| 63 | mps_finalize | ||
| 64 | mps_message_gc_not_condemned_size | ||
| 65 | mps_message_gc_condemned_size | ||
| 66 | mps_message_gc_live_size | ||
| 67 | mps_message_finalization_ref | ||
| 68 | mps_message_type | ||
| 69 | mps_message_queue_type | ||
| 70 | mps_message_discard | ||
| 71 | mps_message_get | ||
| 72 | mps_message_type_disable | ||
| 73 | mps_message_type_enable | ||
| 74 | mps_message_poll | ||
| 75 | mps_collections | ||
| 76 | mps_ld_isstale | ||
| 77 | mps_ld_merge | ||
| 78 | mps_ld_add | ||
| 79 | mps_ld_reset | ||
| 80 | mps_thread_dereg | ||
| 81 | mps_thread_reg | ||
| 82 | mps_tramp | ||
| 83 | mps_stack_scan_ambig | ||
| 84 | mps_root_destroy | ||
| 85 | mps_root_create_reg | ||
| 86 | mps_root_create_fmt | ||
| 87 | mps_root_create_table_masked | ||
| 88 | mps_root_create_table | ||
| 89 | mps_root_create | ||
| 90 | mps_reserve_with_reservoir_permit | ||
| 91 | mps_reservoir_available | ||
| 92 | mps_reservoir_limit | ||
| 93 | mps_arena_roots_walk | ||
| 94 | mps_reservoir_limit_set | ||
| 95 | mps_sac_empty | ||
| 96 | mps_pool_check_free_space | ||
| 97 | mps_sac_fill | ||
| 98 | mps_sac_flush | ||
| 99 | mps_sac_free | ||
| 100 | mps_sac_alloc | ||
| 101 | mps_sac_destroy | ||
| 102 | mps_sac_create | ||
| 103 | mps_rank_weak | ||
| 104 | mps_ap_alloc_pattern_reset | ||
| 105 | mps_rank_exact | ||
| 106 | mps_ap_alloc_pattern_end | ||
| 107 | mps_rank_ambig | ||
| 108 | mps_ap_alloc_pattern_begin | ||
| 109 | mps_alloc_pattern_ramp_collect_all | ||
| 110 | mps_alloc_pattern_ramp | ||
| 111 | mps_ap_trip | ||
| 112 | mps_ap_frame_pop | ||
| 113 | mps_ap_frame_push | ||
| 114 | ; mpsavm.h | ||
| 115 | mps_arena_class_vmnz | ||
| 116 | mps_arena_class_vm | ||
| 117 | ; mpsacl.h | ||
| 118 | mps_arena_class_cl | ||
| 119 | ; mpscamc.h | ||
| 120 | mps_class_amc | ||
| 121 | mps_amc_apply | ||
| 122 | mps_class_amcz | ||
| 123 | ; mpscams.h | ||
| 124 | mps_class_ams_debug | ||
| 125 | mps_class_ams | ||
| 126 | ; mpscawl.h | ||
| 127 | mps_class_awl | ||
| 128 | ; mpsclo.h | ||
| 129 | mps_class_lo | ||
| 130 | ; mpscmv.h | ||
| 131 | mps_mv_size | ||
| 132 | mps_class_mv_debug | ||
| 133 | mps_mv_free_size | ||
| 134 | mps_class_mv | ||
| 135 | ; mpscmvff.h | ||
| 136 | mps_mvff_size | ||
| 137 | mps_class_mvff_debug | ||
| 138 | mps_mvff_free_size | ||
| 139 | mps_class_mvff | ||
| 140 | ; mpscsnc.h | ||
| 141 | mps_class_snc | ||
| 142 | ; mpsio.h | ||
| 143 | mps_io_flush | ||
| 144 | mps_io_destroy | ||
| 145 | mps_io_create | ||
| 146 | mps_io_write | ||
| 147 | ; mpslib.h | ||
| 148 | mps_lib_fputc | ||
| 149 | mps_lib_get_stdout | ||
| 150 | mps_lib_get_stderr | ||
| 151 | mps_lib_get_EOF | ||
| 152 | mps_clock | ||
| 153 | mps_lib_telemetry_control | ||
| 154 | mps_lib_memcmp | ||
| 155 | mps_lib_memcpy | ||
| 156 | mps_lib_memset | ||
| 157 | mps_clocks_per_sec | ||
| 158 | mps_lib_assert_fail | ||
| 159 | mps_lib_fputs | ||
| 160 | ; mpstd.h | ||
| 161 | ; mpsw3.h - by hand | ||
| 162 | mps_SEH_filter | ||
| 163 | mps_SEH_handler | ||