## library-patchpoints.pkg
#
# Lists of files and patchpoints needed by
# the library-glue dis/integration scripts
# etc.
#
# This shouldn't really be in standard.lib
# because it is not of general interest,
# but at the moment that is the path of least
# resistance. -- 2013-02-19 CrT
# Compiled by:
#
src/lib/std/standard.libstipulate
package pfs = patchfiles; # patchfiles is from
src/lib/make-library-glue/patchfiles.pkg package plf = planfile; # planfile is from
src/lib/make-library-glue/planfile.pkg package sm = string_map; # string_map is from
src/lib/src/string-map.pkg #
Pfs = pfs::Patchfiles;
herein
package library_patchpoints {
#
makefile = "Makefile";
src_c_lib_makefile = "src/c/lib/Makefile";
chapter_library_reference_tex = "doc/tex/chapter-library-reference.tex";
section_api_less_frequently_used_tex = "doc/tex/section-api-less-frequently-used.tex";
section_pkg_less_frequently_used_tex = "doc/tex/section-pkg-less-frequently-used.tex";
make_install = "sh/make-install";
make_uninstall = "sh/make-uninstall";
mythryl_callable_c_libraries_list_h = "src/c/lib/mythryl-callable-c-libraries-list.h";
src_c_o_makefile = "src/c/o/Makefile";
standard_lib = "src/lib/std/standard.lib";
unit_tests_lib = "src/lib/test/unit-tests.lib";
all_unit_tests_pkg = "src/lib/test/all-unit-tests.pkg";
# All of the files which one may need to patch
# in order to integrate a new library glue module
# with the codebase. This includes updating the
# main Makefile and the documentation tree etc:
#
patchfile_paths
=
[
makefile,
src_c_lib_makefile,
chapter_library_reference_tex,
section_api_less_frequently_used_tex,
section_pkg_less_frequently_used_tex,
make_install,
make_uninstall,
mythryl_callable_c_libraries_list_h,
src_c_o_makefile,
standard_lib,
unit_tests_lib,
all_unit_tests_pkg
];
patch_id_'defs'_in_'makefile' = { patchname => "defs", filename => makefile };
patch_id_'rules'_in_'makefile' = { patchname => "rules", filename => makefile };
patch_id_'defs'_in_'src_c_lib_makefile' = { patchname => "defs", filename => src_c_lib_makefile };
patch_id_'glue'_in_'chapter_library_reference_tex' = { patchname => "glue", filename => chapter_library_reference_tex };
patch_id_'glue'_in_'section_api_less_frequently_used_tex' = { patchname => "glue", filename => section_api_less_frequently_used_tex };
patch_id_'glue'_in_'section_pkg_less_frequently_used_tex' = { patchname => "glue", filename => section_pkg_less_frequently_used_tex };
patch_id_'rename'_in_'make_install' = { patchname => "rename", filename => make_install };
patch_id_'install'_in_'make_install' = { patchname => "install", filename => make_install };
patch_id_'remove'_in_'make_uninstall' = { patchname => "remove", filename => make_uninstall };
patch_id_'libs'_in_'mythryl_callable_c_libraries_list_h' = { patchname => "libs", filename => mythryl_callable_c_libraries_list_h };
patch_id_'defs'_in_'src_c_o_makefile' = { patchname => "defs", filename => src_c_o_makefile };
patch_id_'rules'_in_'src_c_o_makefile' = { patchname => "rules", filename => src_c_o_makefile };
patch_id_'exports'_in_'standard_lib' = { patchname => "exports", filename => standard_lib };
patch_id_'components'_in_'standard_lib' = { patchname => "components", filename => standard_lib };
patch_id_'exports'_in_'unit_tests_lib' = { patchname => "exports", filename => unit_tests_lib };
patch_id_'components'_in_'unit_tests_lib' = { patchname => "components", filename => unit_tests_lib };
patch_id_'run'_in_'all_unit_tests_pkg' = { patchname => "run", filename => all_unit_tests_pkg };
patch_ids
=
fold_forward
(\\ ((key, value), result) = sm::set (result, key, value))
sm::empty
[
("patch_id_'defs'_in_'makefile'", patch_id_'defs'_in_'makefile'),
("patch_id_'rules'_in_'makefile'", patch_id_'rules'_in_'makefile'),
("patch_id_'defs'_in_'src_c_lib_makefile'", patch_id_'defs'_in_'src_c_lib_makefile'),
("patch_id_'glue'_in_'chapter_library_reference_tex'", patch_id_'glue'_in_'chapter_library_reference_tex'),
("patch_id_'glue'_in_'section_api_less_frequently_used_tex'", patch_id_'glue'_in_'section_api_less_frequently_used_tex'),
("patch_id_'glue'_in_'section_pkg_less_frequently_used_tex'", patch_id_'glue'_in_'section_pkg_less_frequently_used_tex'),
("patch_id_'rename'_in_'make_install'", patch_id_'rename'_in_'make_install'),
("patch_id_'install'_in_'make_install'", patch_id_'install'_in_'make_install'),
("patch_id_'remove'_in_'make_uninstall'", patch_id_'remove'_in_'make_uninstall'),
("patch_id_'libs'_in_'mythryl_callable_c_libraries_list_h'", patch_id_'libs'_in_'mythryl_callable_c_libraries_list_h'),
("patch_id_'defs'_in_'src_c_o_makefile'", patch_id_'defs'_in_'src_c_o_makefile'),
("patch_id_'rules'_in_'src_c_o_makefile'", patch_id_'rules'_in_'src_c_o_makefile'),
("patch_id_'exports'_in_'standard_lib'", patch_id_'exports'_in_'standard_lib'),
("patch_id_'components'_in_'standard_lib'", patch_id_'components'_in_'standard_lib'),
("patch_id_'exports'_in_'unit_tests_lib'", patch_id_'exports'_in_'unit_tests_lib'),
("patch_id_'components'_in_'unit_tests_lib'", patch_id_'components'_in_'unit_tests_lib'),
("patch_id_'run'_in_'all_unit_tests_pkg'", patch_id_'run'_in_'all_unit_tests_pkg')
];
fun append_to_patch { patchfiles, paragraph: plf::Paragraph, x: X }
=
{ patch_id = the (sm::get (paragraph.fields, "patch_id" )): plf::Field;
text = the (sm::get (paragraph.fields, "text" )): plf::Field;
patch_id = head patch_id.lines;
lines = text.lines;
patch_id = case (sm::get (patch_ids, patch_id))
#
THE patch_id => patch_id;
NULL => raise exception DIE (sprintf "patch_id '%s' not defined by library-patchpoints.pkg" patch_id);
esac;
patchfiles = pfs::append_to_patch patchfiles { patch_id, lines };
patchfiles;
};
append_to_patch__definition
=
{ name => "append_to_patch",
do => append_to_patch,
fields => [ { fieldname => "patch_id", traits => [] },
{ fieldname => "text", traits => [ plf::DO_NOT_TRIM_WHITESPACE, plf::ALLOW_MULTIPLE_LINES ] }
]
};
};
end;