2019-02-04 22:26:45 +00:00
|
|
|
[Git::] Git Support.
|
|
|
|
|
|
|
|
Constructing a suitable gitignore file for a simple inweb project.
|
|
|
|
|
2022-04-23 13:08:38 +00:00
|
|
|
@ This is an extremely simple use of //foundation: Preprocessor//.
|
2019-02-04 22:26:45 +00:00
|
|
|
|
2024-03-09 13:23:53 +00:00
|
|
|
<<*>>=
|
2019-02-04 22:26:45 +00:00
|
|
|
void Git::write_gitignore(web *W, filename *prototype, filename *F) {
|
2022-04-23 13:08:38 +00:00
|
|
|
linked_list *L = NEW_LINKED_LIST(preprocessor_macro);
|
2022-04-23 15:13:47 +00:00
|
|
|
Preprocessor::new_macro(L, I"basics", NULL, Git::basics_expander, NULL);
|
2022-04-23 13:08:38 +00:00
|
|
|
text_stream *header = Str::new();
|
|
|
|
WRITE_TO(header, "# This gitignore was automatically written by inweb -gitignore\n");
|
|
|
|
WRITE_TO(header, "# and is not intended for human editing\n\n");
|
|
|
|
WRITE_TO(STDOUT, "(Read script from %f)\n", prototype);
|
2022-07-25 22:41:35 +00:00
|
|
|
Preprocessor::preprocess(prototype, F, header, L, NULL_GENERAL_POINTER, '#', ISO_ENC);
|
2019-02-04 22:26:45 +00:00
|
|
|
}
|
|
|
|
|
2022-04-23 15:13:47 +00:00
|
|
|
@ Our one non-standard macro simply includes a file of standing material which
|
|
|
|
is the same as the default .giscript file anyway:
|
|
|
|
|
2024-03-09 13:23:53 +00:00
|
|
|
<<*>>=
|
2022-04-23 13:08:38 +00:00
|
|
|
void Git::basics_expander(preprocessor_macro *mm, preprocessor_state *PPS,
|
2022-04-23 15:13:47 +00:00
|
|
|
text_stream **parameter_values, preprocessor_loop *loop, text_file_position *tfp) {
|
2022-04-23 13:08:38 +00:00
|
|
|
filename *prototype = Filenames::in(path_to_inweb_materials, I"default.giscript");
|
|
|
|
TextFiles::read(prototype, FALSE, "can't open basic .gitignore file",
|
|
|
|
TRUE, Preprocessor::scan_line, NULL, PPS);
|
|
|
|
WRITE_TO(STDOUT, "(Read basics.giscript from inweb/");
|
|
|
|
Pathnames::to_text_relative(STDOUT, path_to_inweb, path_to_inweb_materials);
|
|
|
|
WRITE_TO(STDOUT, ")\n");
|
2019-02-04 22:26:45 +00:00
|
|
|
}
|