## planfile-junk.pkg
#
# Convenience fns for use with
#
src/lib/make-library-glue/planfile.pkg# Compiled by:
#
src/lib/std/standard.libstipulate
package lp = library_patchpoints; # library_patchpoints is from
src/lib/make-library-glue/library-patchpoints.pkg 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.pkgherein
# This package is invoked in:
#
#
src/lib/make-library-glue/make-library-glue.pkg package planfile_junk:
Planfile_Junk # Planfile_Junk is from
src/lib/make-library-glue/planfile-junk.api {
fun set_patch { patchfiles: pfs::Patchfiles, paragraph: plf::Paragraph, x: X }
=
{ filename = (the (sm::get (paragraph.fields, "filename" ))): plf::Field;
patchname = (the (sm::get (paragraph.fields, "patchname"))): plf::Field;
text = (the (sm::get (paragraph.fields, "text" ))): plf::Field;
filename = head filename.lines;
patchname = head patchname.lines;
lines = text.lines;
patchfiles = pfs::apply_patch patchfiles { patch_id => { filename, patchname }, lines };
patchfiles;
};
set_patch__definition
=
{ name => "set_patch",
do => set_patch,
fields => [ { fieldname => "filename", traits => [] },
{ fieldname => "patchname", traits => [] },
{ fieldname => "text", traits => [ plf::DO_NOT_TRIM_WHITESPACE, plf::ALLOW_MULTIPLE_LINES ] }
]
};
fun append_patch { patchfiles, paragraph: plf::Paragraph, x: X }
=
{ filename = the (sm::get (paragraph.fields, "filename" )): plf::Field;
patchname = the (sm::get (paragraph.fields, "patchname")): plf::Field;
text = the (sm::get (paragraph.fields, "text" )): plf::Field;
filename = head filename.lines;
patchname = head patchname.lines;
lines = text.lines;
patchfiles = pfs::append_to_patch patchfiles { patch_id => { filename, patchname }, lines };
patchfiles;
};
append_patch__definition
=
{ name => "append_patch",
do => append_patch,
fields => [ { fieldname => "filename", traits => [] },
{ fieldname => "patchname", traits => [] },
{ fieldname => "text", traits => [ plf::DO_NOT_TRIM_WHITESPACE, plf::ALLOW_MULTIPLE_LINES ] }
]
};
fun copy_patch { patchfiles, paragraph: plf::Paragraph, x: X }
=
{ srcfile = the (sm::get (paragraph.fields, "srcfile")): plf::Field;
srcptch = the (sm::get (paragraph.fields, "srcptch")): plf::Field;
dstfile = the (sm::get (paragraph.fields, "dstfile")): plf::Field;
dstptch = the (sm::get (paragraph.fields, "dstptch")): plf::Field;
srcfile = head srcfile.lines;
srcptch = head srcptch.lines;
dstfile = head dstfile.lines;
dstptch = head dstptch.lines;
patch_id = { filename => dstfile, patchname => dstptch };
patch = pfs::get_patch patchfiles { filename => srcfile, patchname => srcptch };
patchfiles = pfs::apply_patch patchfiles { patch_id, lines => patch.lines };
patchfiles;
};
copy_patch__definition
=
{ name => "copy_patch",
do => copy_patch,
fields => [ { fieldname => "srcfile", traits => [] }, { fieldname => "srcptch", traits => [] },
{ fieldname => "dstfile", traits => [] }, { fieldname => "dstptch", traits => [] }
]
};
};
end;
## Code by Jeff Prothero: Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.