PreviousUpNext

15.3.336  src/lib/make-library-glue/patchfiles.api

## patchfiles.api
#
# Adding content to files in spots
# marked by linepairs like
#
#    # Do not edit this or following lines --- they are autobuilt.
#    ...
#    # Do not edit this or preceding lines --- they are autobuilt.

# Compiled by:
#     src/lib/std/standard.lib

stipulate
    package pf  =  patchfile;                                                                                   # patchfile             is from   src/lib/make-library-glue/patchfile.pkg
    package sm  =  string_map;                                                                                  # string_map            is from   src/lib/src/string-map.pkg
herein

    # This api is implemented in:
    #
    #     src/lib/make-library-glue/patchfiles.pkg
    #
    api  Patchfiles
    {
        Patch_Id  =   { filename:       String,
                        patchname:      String
                      };

        Patch     =   { patch_id:       Patch_Id,
                        lines:          List(String)
                      };

        Patchfiles;                                                                                             # Collection of 'Patchfile's, indexed by filename.

        empty:                  Patchfiles;

        load_patchfile:         (String, Patchfiles) -> Patchfiles;                                             # No-op if already loaded.
        load_patchfiles:        List(String) -> Patchfiles;

        get_filenames:          Patchfiles -> List(String);

        write_patchfiles:       Patchfiles -> List(String);                                                     # Return value is informative messages for human consumption, generated in   src/lib/make-library-glue/patchfile.pkg
                                                                                                                # via:    sprintf "Successfully patched %4d lines in %s\n"  *patch_lines_written  filename;
        get_patchfile:          Patchfiles -> String -> pf::Patchfile;

        get_patch:              Patchfiles ->  Patch_Id -> Patch;                                               # Get patch by name.

        apply_patch:            Patchfiles ->      Patch   -> Patchfiles;                                       # 
        apply_patches:          Patchfiles -> List(Patch)  -> Patchfiles;                                       # 

        append_to_patch:        Patchfiles -> Patch -> Patchfiles;                                              # Append  given lines to named patch.
        prepend_to_patch:       Patchfiles -> Patch -> Patchfiles;                                              # Prepend given lines to named patch.

        map:                    (Patch -> List(String)) -> Patchfiles -> Patchfiles;                            # Set contents of each patch to some function of that patch.
        apply:                  (Patch -> Void)         -> Patchfiles -> Void;                                  # Call user_fn on every patch in file.
        fold:                   ((Patch, Y) -> Y)  -> Y -> Patchfiles -> Y;                                     # Compute some statistic over all patches.

        empty_all_patches:      Patchfiles -> Patchfiles;                                                       # Set every patch to contain the empty list.
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext