summaryrefslogtreecommitdiff
path: root/regen/regen_lib.pl
Commit message (Collapse)AuthorAgeFilesLines
* On failure, regen_lib.pl now generates diagnostics, not just "not ok".Nicholas Clark2013-07-241-2/+33
| | | | | We have to stop using File::Compare's compare(), as it doesn't return diagnostics about what went wrong.
* Add an "always update" parameter to regen_lib's open_new().Nicholas Clark2013-07-071-11/+18
| | | | | | | | | | | | | | | | | | By default the code in regen_lib compares the newly written file it has just closed with the (assumed) existing file, and only overwrites the existing file if the new file differs. This is a useful behaviour for regeneration scripts. However, it's not ideal for build scripts called from the Makefile, as make assumes that targets will be regenerated (and the timestamp touched). So add an "always update" parameter for the use of Makefile invoked scripts, such as autodoc.pl. If set, delete any existing file early (so that fatal errors during the generation don't confuse the build by leaving an existing stale file around), skip the comparison and skip the diagnostic output listing the changed files. Change autodoc.pl to set this parameter. Correct a typo in an error message in regen_lib's open_new().
* Refactor the Text::Wrap::wrap() logic in regen/regen_lib.plNicholas Clark2013-07-071-6/+9
| | | | | | Provide a local subroutine wrap(). Pass columns as its first parameter and set $Text::Wrap::columns, as all uses of Text::Wrap::wrap() were setting this variable.
* Refactor regen_lib.pl to reduce verbosity.Nicholas Clark2013-07-071-14/+12
| | | | | Use hash slices to avoid repeated typeglob dereferences on $fh. In read_only_top() use a lexical to avoid repeated $args{lang} lookups.
* In regen/regen_lib.pl, add 'Pod' as a third supported 'language'.Nicholas Clark2013-05-231-5/+9
| | | | Pod needs a commenting style distinct from C and Perl. (ie the empty string)
* typo fixes for regen scriptsDavid Steinbrunner2013-05-221-1/+1
|
* Port regen/regen_lib.pl to 5.6.2Father Chrysostomos2011-12-241-1/+1
| | | | | | Since the regen scripts use the system perl, I thought I might as well test regen/feature.pl with 5.6.2, the earliest I have installed. It failed.
* Add a 'quote' argument to read_only_top(), to pass in an optional Tolkien.Nicholas Clark2011-05-191-0/+1
| | | | Use this in embed.pl for perlapi.c, and reentr.pl for reentr.c.
* Add an optional third argument to open_new(), to invoke read_only_top() with.Nicholas Clark2011-05-191-2/+4
| | | | Merge together many calls to open_new() and read_only_top().
* In regen/uconfig_h.pl use read_only_bottom_close_and_rename().Nicholas Clark2011-05-191-13/+7
| | | | | This eliminates the only remaining external caller of read_only_bottom(), so inline read_only_bottom() into read_only_bottom_close_and_rename().
* Merge safer_close() and rename_if_different() into close_and_rename()Nicholas Clark2011-05-191-32/+24
| | | | Inline safer_rename() into its only caller, close_and_rename().
* Add an optional 'mode' argument to open_new(), to open for appending.Nicholas Clark2011-05-191-5/+11
| | | | Use this in regen/uconfig_h.pl
* Rename safer_open() to open_new(), and eliminate the first parameter.Nicholas Clark2011-05-191-7/+6
| | | | Update the SHA256s where necessary in the generated files.
* Extract read_only_bottom() from read_only_bottom_close_and_rename()'s code.Nicholas Clark2011-03-281-8/+16
|
* Store the SHA-256 of the source in files generated by regen_perly.plNicholas Clark2011-01-231-3/+32
| | | | | | | bison isn't available everywhere, so we can't simply re-run regen_perly.pl to verify that perly.{act,h,tab} are up to date. So instead store the SHA-256 of the input files, and extend t/porting/regen.t to check that the input files haven't been changed subsequently.
* Output "read only" editor blocks from regen_perly.plNicholas Clark2011-01-231-1/+1
| | | | | | | | | Use safer_open() and read_only_bottom_close_and_rename() from regen_lib.pl Consistently use 3 argument open and lexical file handles. A side effect of this change is that the generated files are no longer made read-only on disk - if this is desirable, then probably better to change regen_lib.pl so that all generated files are made read-only.
* Move the duplicated subroutine tab() into regen_lib.plNicholas Clark2011-01-231-0/+6
|
* Change close_and_rename() to read_only_bottom_close_and_rename()Nicholas Clark2011-01-231-2/+8
| | | | | | | | | | All users of close_and_rename() were printing out the appropriate "ex: set ro:" string to the file handle immediately before closing it. So move that into the common function and rename it to reflect what it now does. [Except overload.pl, which should have been, given that it calls read_only_top()] Print a newline above the "ex: set ro:" line. This removes many newlines from the regen scripts, but does add newlines to a couple of generated files.
* In regen/*.pl, refactor the repeated code for close and rename if different.Nicholas Clark2011-01-231-1/+11
| | | | | | | Pass the final file name as an optional second argument of safer_open() and store it with the file handle. Add a function close_and_rename() which closes the file handle, then retrieves the final name, and renames the temporary file if the two differ.
* In regen_lib.pl, when opening, first unlink a previous file of that name.Nicholas Clark2011-01-231-0/+3
| | | | | | Previously regcomp.pl had an explicit unlink for the file it creates, but none of the other regen/*.pl scripts did. Also, remove commented out code relating to unlink.
* In regen_lib.pl use a meaningful key for storing the file's name.Nicholas Clark2011-01-231-2/+2
| | | | | | regen_lib.pl is actually using the hash slot of the typeglob, not the scalar slot. Typeglob syntax is particularly confusing and prone to errors, although in this case it doesn't make any behaviour difference.
* Move all the generated file header printing into read_only_top()Nicholas Clark2011-01-231-0/+51
| | | | | | | | | Previously all the scripts in regen/ had code to generate header comments (buffer-read-only, "do not edit this file", and optionally regeneration script, regeneration data, copyright years and filename). This change results in some minor reformatting of header blocks, and standardises the copyright line as "Larry Wall and others".
* Move regen scripts to regen/Steffen Mueller2010-10-101-0/+77
Moves the various scripts that are called by regen.pl to a subdirectory to reduce clutter.