From: Ian Jackson Date: Sun, 5 Jul 2009 10:49:13 +0000 (+0100) Subject: Change ##. filenames to _. X-Git-Tag: 1.9.2~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=commitdiff_plain;h=124bfe502b5841d6d05f3f7e9fc825f918d3109d Change ##. filenames to _. --- diff --git a/pctb/Makefile b/pctb/Makefile index e458c6b..8223583 100644 --- a/pctb/Makefile +++ b/pctb/Makefile @@ -48,5 +48,8 @@ clean: realclean: clean rm -f $(TARGETS) + rm -f raw.tsv + rm -f _pages.ppm _upload-*.html _commodmap.tsv + rm -f _master-*.txt _local-*.txt rm -f ./#pages#.ppm ./#upload-*#.html ./#commodmap#.tsv rm -f ./#master-*#.txt ./#local-*#.txt raw.tsv diff --git a/pctb/README b/pctb/README index e6d7707..59a3646 100644 --- a/pctb/README +++ b/pctb/README @@ -31,10 +31,10 @@ Setting the operation mode: Options to vary the processing: --single-page One screenful, no paging - results will be incomplete --quiet Suppress progress messages - --screenshot-file F Store or read screenshots in F rather than #pages#.pnm + --screenshot-file F Store or read screenshots in F rather than _pages.ppm --window-id ID Specified X window is the YPP client - do not search --edit-charset Enable character set editing. See README.dictionary. - --no-edit-charset Do not edit charset even if #local-char*#.txt exists. + --no-edit-charset Do not edit charset even if _local-char*.txt exists. --find-island Find and print the ocean and island. Suppresses OCR and output unless used with result processing option. --test-servers Set default servers to be the test servers, not @@ -103,7 +103,7 @@ Reporting problems If you need to report a bug, for example an inability to recognise, please be sure to remember the exact error message and circumstances. Also, for recognition problems there will probably be a very useful -screenshot file called `#pages#.pnm'. This is likely to be very large +screenshot file called `_pages.ppm'. This is likely to be very large so don't just email it to me, but if you can put it up on a webpage for me to download that will help. At least keep a copy of it. @@ -111,7 +111,7 @@ If the problem is a failure to cope with some particular YPP client display and is reproducible, try running: ./ypp-commodities --raw-tsv --single-page If this reproduces the problem, please email me the screenshot file -#pages#.pnm, which will consist only of the single screen, plus the +_pages.ppm, which will consist only of the single screen, plus the error messasge. I'll then be able to understand what's wrong, hopefully. diff --git a/pctb/README.charset b/pctb/README.charset index 25eb5d8..770d3f3 100644 --- a/pctb/README.charset +++ b/pctb/README.charset @@ -140,17 +140,17 @@ errors. If you think you have made mistakes answering OCR queries (for example, the recognised data is wrong), you should delete the file -#local-char*#.txt, which contains your local updates. It will then +_local-char*.txt, which contains your local updates. It will then only use the centrally provided (and vetted) master file (which is automatically updated when you run the PCTB client, by default). It is also possible to have the OCR system reject particular strings. -If you put a regexp in #local-reject#.txt, any OCR result which +If you put a regexp in _local-reject.txt, any OCR result which matches this string will instead cause an OCR failure, invoking the -OCR dictionary editor if appropriate. #master-reject#.txt is the +OCR dictionary editor if appropriate. _master-reject.txt is the centrally maintained version of this file. -Alternatively you can edit #local-char15#.txt with a text editor. The +Alternatively you can edit _local-char*.txt with a text editor. The format is not documented at the moment. @@ -161,7 +161,7 @@ Now that you have read this document, you should rerun your OCR job with the --edit-charset option. So run ./ypp-commodities --edit-charset In future, this option is not usually needed, because it is the -default if there is a local character set dictionary #local-#.txt +default if there is a local character set dictionary _local-.txt for the relevant character height. With --edit-charset, when the OCR finds characters it does not diff --git a/pctb/README.files b/pctb/README.files index 254217a..b2384a1 100644 --- a/pctb/README.files +++ b/pctb/README.files @@ -3,7 +3,7 @@ Files we use and update The program reads and writes the following files: - * #pages#.pnm + * _pages.ppm Contains one or more images (as raw ppms, end-to-end) which are the screenshots taken in the last run. This is (over)written whenever @@ -14,10 +14,10 @@ The program reads and writes the following files: You can specify a different file with --screenshot-file. If you want to display the contents of this file, `display' can do - it. Don't try `display vid:#pages#.pnm' as this will consume + it. Don't try `display vid:_pages.ppm' as this will consume truly stupendous quantities of RAM - it wedged my laptop. - * #master-newcommods#.txt #local-newcommods#.txt + * _master-newcommods.txt _local-newcommods.txt Dictionary of newly introduced commodities. When a new commodity appears in Puzzle Pirates, the PCTB server operators need to add it @@ -35,7 +35,7 @@ The program reads and writes the following files: double-check what you're doing before overriding the uploader by telling it to ignore an unrecognised commodity. - * #master-reject#.txt #local-reject#.txt + * _master-reject.txt _local-reject.txt Dictionary of regexps which, when the OCR appears to match, we reject instead. At the moment this is used to stop us thinking @@ -43,41 +43,41 @@ The program reads and writes the following files: character set dictionary is missing the lowercase `y ' glyph. See README.charset. - * #master-char*#.txt #local-char*#.txt - #master-pixmap#.txt #local-pixmap#.txt + * _master-char*.txt _local-char*.txt + _master-pixmap.txt _local-pixmap.txt Character set and image dictionaries. For the semantics of the char* files README.charset. There is not currently any accurate documentation of this dictionary format. - #master-*#.txt contain the centrally defined and approved data. + _master-*.txt contain the centrally defined and approved data. They are downloaded automatically from the SC PCTB server and updated each run. You can safely delete this file, if everything is online, if you want to fetch a fresh copy. - #local-*#.txt are a local copy of your submissions, so that they + _local-*.txt are a local copy of your submissions, so that they will be used by your client pending approval by me. You can delete this file if you think you may have made a mistake. See README.privacy for details of the communications with the SC server about the contents of these dictionaries. - * #commodmap#.tsv + * _commodmap.tsv Map from commodity names to the numbers required by the PCTB server. This is fetched and updated automatically as necessary. It can safely be deleted as it will then be refetched. - * #upload-1#.html #upload-2#.html + * _upload-1.html _upload-2.html _upload-3.html We screenscrape the pages from the PCTB upload server. The actual HTML returned from the upload server is left in these dropping files for debugging etc. - * .tmp + * _.tmp When any of these tools overwrite one of the persistent dictionary - files, they temporarily write to .tmp. We also use a couple + files, they temporarily write to _.tmp. We also use a couple of other temporary files. Future versions may have more helpers and more data files. diff --git a/pctb/commod-results-processor b/pctb/commod-results-processor index e391e47..4a70ddf 100755 --- a/pctb/commod-results-processor +++ b/pctb/commod-results-processor @@ -224,7 +224,7 @@ our ($ua)= LWP::UserAgent->new; sub load_commodmap() { undef %commodmap; - my $c= new IO::File "#commodmap#.tsv"; + my $c= new IO::File "_commodmap.tsv"; if (!$c) { $!==&ENOENT or die $!; return; } while (<$c>) { m/^(\S.*\S)\t(\d+)\n$/ or die "$_"; @@ -244,7 +244,7 @@ sub refresh_commodmap() { my $incommodmap=0; my $intag=''; my %got; - my $o= new IO::File "#commodmap#.tsv.tmp",'w' or die $!; + my $o= new IO::File "_commodmap.tsv.tmp",'w' or die $!; undef %commodmap; my $xp= new XML::Parser @@ -292,7 +292,7 @@ sub refresh_commodmap() { # print STDERR "[[[$content]]]\n"; $xp->parse($content); close $o or die $!; - rename "#commodmap#.tsv.tmp","#commodmap#.tsv" or die $!; + rename "_commodmap.tsv.tmp","_commodmap.tsv" or die $!; } our %newcommods; @@ -317,7 +317,7 @@ sub refresh_newcommods() { my $rsync= $ENV{'YPPSC_PCTB_RSYNC'}; $rsync= 'rsync' if !defined $rsync; - my $local= "#master-newcommods#.txt"; + my $local= "_master-newcommods.txt"; my $src= $ENV{'YPPSC_PCTB_DICT_UPDATE'}; if ($src) { my $remote= "$src/master-newcommods.txt"; @@ -325,7 +325,7 @@ sub refresh_newcommods() { die "$? $!" if $! or $?; } read_newcommods($local); - read_newcommods('#local-newcommods#.txt'); + read_newcommods('_local-newcommods.txt'); } our (%stallmap, @stallmap); @@ -430,7 +430,7 @@ sub main__genmarketdata () { sub save_upload_html ($$) { my ($which, $resptxt) = @_; - open R, ">./#upload-$which#.html" or die $!; + open R, ">./_upload-$which.html" or die $!; print R $resptxt or die $!; close R or die $!; } @@ -458,7 +458,7 @@ sub main__upload () { my $resptxt= $resp->content(); save_upload_html('1', $resptxt); - open R, ">./#upload-1#.html" or die $!; + open R, ">./_upload-1.html" or die $!; print R $resptxt or die $!; close R or die $!; @@ -514,7 +514,7 @@ sub main__upload () { save_upload_html('3', $resptxt); print "\n" or die $!; - system('w3m -T text/html -dump < \#upload-3#.html'); + system('w3m -T text/html -dump < _upload-3.html'); print "\n" or die $!; } diff --git a/pctb/convert.c b/pctb/convert.c index 3c5af99..9531da0 100644 --- a/pctb/convert.c +++ b/pctb/convert.c @@ -125,7 +125,7 @@ void fetch_with_rsync(const char *stem) { const char *src= getenv("YPPSC_PCTB_DICT_UPDATE"); char *remote= masprintf("%s/master-%s.txt", src, stem); - char *local= masprintf("#master-%s#.txt", stem); + char *local= masprintf("_master-%s.txt", stem); if (DEBUGP(rsync)) fprintf(stderr,"executing rsync to fetch %s to %s\n",remote,local); execlp(rsync, "rsync", @@ -267,7 +267,7 @@ int main(int argc, char **argv) { o_serv_dict_submit, o_flags & ff_dict_submit); if (!o_screenshot_fn) - o_screenshot_fn= masprintf("%s/#pages#.ppm",get_vardir()); + o_screenshot_fn= masprintf("%s/_pages.ppm",get_vardir()); /* Actually do the work */ diff --git a/pctb/decode-pctb-marketdata b/pctb/decode-pctb-marketdata index d798aad..0c0fe38 100755 --- a/pctb/decode-pctb-marketdata +++ b/pctb/decode-pctb-marketdata @@ -2,7 +2,7 @@ use IO::Handle; -open CM, "#commodmap#.tsv" or die $!; +open CM, "_commodmap.tsv" or die $!; $debug=1 if @ARGV; diff --git a/pctb/dictionary-manager b/pctb/dictionary-manager index 19e067c..2c91a2a 100755 --- a/pctb/dictionary-manager +++ b/pctb/dictionary-manager @@ -95,7 +95,7 @@ proc bgerror {m} { } proc execpnm_createphoto {photoname args} { - set tmpfile ./#dictimage#.tmp + set tmpfile ./_dictimage.tmp eval exec $args > $tmpfile image create photo $photoname -file $tmpfile file delete $tmpfile @@ -257,7 +257,7 @@ proc write_database {} { proc select_database {dbname_spec} { global dbname set dbname $dbname_spec - read_database "./#local-$dbname#.txt" + read_database "./_local-$dbname.txt" } proc do_database_update {im def} { diff --git a/pctb/ocr.c b/pctb/ocr.c index 8d1b88b..37ca7d2 100644 --- a/pctb/ocr.c +++ b/pctb/ocr.c @@ -122,7 +122,7 @@ static void readdb1(OcrReader *rd, const char *which, int local) { int h, endsword; char lbuf[100]; - char *dbfname= masprintf("%s/#%s-char%d#.txt", + char *dbfname= masprintf("%s/_%s-char%d.txt", get_vardir(), which, rd->h); if (!dbfile_open(dbfname)) @@ -238,7 +238,7 @@ Rejection *rejections; static void load_rejections(const char *which) { char lbuf[1000]; - char *fname= masprintf("%s/#%s-reject#.txt", get_vardir(), which); + char *fname= masprintf("%s/_%s-reject.txt", get_vardir(), which); int c, lno=0; Rejection *rej; @@ -649,7 +649,7 @@ void ocr_showcharsets(void) { memset(found,0,sizeof(found)); - fnpat= pcre_compile("\\#(?:master|local)\\-char([1-9]\\d{0,2})\\#\\.txt$", + fnpat= pcre_compile("_(?:master|local)\\-char([1-9]\\d{0,2})\\.txt$", PCRE_ANCHORED|PCRE_DOLLAR_ENDONLY, &pcre_err,&pcre_erroffset, 0); debugf("pcre_compile %p %s\n",fnpat,pcre_err); diff --git a/pctb/rgbimage.c b/pctb/rgbimage.c index 0e89892..dfcd180 100644 --- a/pctb/rgbimage.c +++ b/pctb/rgbimage.c @@ -51,7 +51,7 @@ static int identify1(const RgbImage *base, Rect portion, char result[MAXIMGIDENT], const char *what, const char *which) { - char *dbfile_name= masprintf("#%s-pixmap#.txt",which); + char *dbfile_name= masprintf("_%s-pixmap.txt",which); if (!dbfile_open(dbfile_name)) goto not_found;