From: Brian S. <xue...@us...> - 2007-10-05 18:28:43
|
Update of /cvsroot/popfile/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7211 Modified Files: Tag: b0_22_2 adduser-Version.nsh adduser.nsi CBP.nsh Log Message: Previous releases of POPFile only supported one parser (Kakasi) for Japanese text. Update the "Add POPFile User" wizard to handle the new 'bayes_nihongo_parser' configuration parameter which specifies the parser to be used when processing Japanese text. Where appropriate, make string processing loops more robust by using the string length to test for end-of-string instead of assuming a null character marks the end of the string. "Reserve" the new LockedList plugin (forgot to do this last time) Index: adduser.nsi =================================================================== RCS file: /cvsroot/popfile/windows/adduser.nsi,v retrieving revision 1.59.4.16 retrieving revision 1.59.4.17 diff -C2 -d -r1.59.4.16 -r1.59.4.17 *** adduser.nsi 21 Sep 2007 01:22:09 -0000 1.59.4.16 --- adduser.nsi 5 Oct 2007 18:28:45 -0000 1.59.4.17 *************** *** 2237,2240 **** --- 2237,2245 ---- # libraries (POPFile cannot use SQLite3.x libraries yet). If upgrading an installation that # currently uses DBD::SQLite then change the configuration in popfile.cfg to use DBD::SQLite2. + # + # The 0.22.6 release introduced the ability to select the parser used to split Japanese text + # into words. Previous releases only supported the 'Kakasi' parser but 0.22.6 offers a choice + # of 'Kakasi', 'MeCab' or 'Internal', controlled by the new 'bayes_nihongo_parser' parameter. + # Valid values for this new popfile.cfg parameter are kakasi, mecab or internal. #-------------------------------------------------------------------------- *************** *** 2252,2255 **** --- 2257,2261 ---- !define L_TEXTEND $R0 ; used to ensure correct handling of lines longer than 1023 chars !define L_SKIN $9 ; current skin setting + !define L_PARSER $8 ; current Nihongo parser setting (introduced in 0.22.6 release) Push ${L_CFG} *************** *** 2264,2267 **** --- 2270,2274 ---- Push ${L_TEXTEND} Push ${L_SKIN} + Push ${L_PARSER} StrCpy $G_POP3 "" *************** *** 2275,2278 **** --- 2282,2287 ---- StrCpy ${L_LANG_OLD} "" + StrCpy ${L_PARSER} "" + ; See if we can get the current pop3 and gui port from an existing configuration. ; There may be more than one entry for these ports in the file - use the last one found *************** *** 2309,2312 **** --- 2318,2324 ---- StrCmp ${L_CMPRE} "bayes_dbconnect " got_dbconnect + StrCpy ${L_CMPRE} ${L_LNE} 21 + StrCmp ${L_CMPRE} "bayes_nihongo_parser " got_parser + ; do not transfer any UI language settings to the copy of popfile.cfg *************** *** 2350,2353 **** --- 2362,2369 ---- Goto copy_lne + got_parser: + StrCpy ${L_PARSER} ${L_LNE} "" 21 + Goto loop + got_lang_new: StrCpy ${L_LANG_NEW} ${L_LNE} "" 14 *************** *** 2426,2430 **** StrCmp ${L_TRAYICON} "1" found_trayicon !insertmacro MUI_INSTALLOPTIONS_WRITE "pfi-cfg.ini" "Inherited" "TrayIcon" "?" ! Goto close_cleancopy found_trayicon: --- 2442,2446 ---- StrCmp ${L_TRAYICON} "1" found_trayicon !insertmacro MUI_INSTALLOPTIONS_WRITE "pfi-cfg.ini" "Inherited" "TrayIcon" "?" ! Goto check_parser found_trayicon: *************** *** 2432,2435 **** --- 2448,2468 ---- !insertmacro MUI_INSTALLOPTIONS_WRITE "pfi-cfg.ini" "Inherited" "TrayIcon" "${L_TRAYICON}" + check_parser: + StrCmp ${L_PARSER} "" parser_not_previously_defined + !insertmacro MUI_INSTALLOPTIONS_WRITE "pfi-cfg.ini" "Inherited" "NihongoParser" "${L_PARSER}" + ReadRegStr ${L_CMPRE} HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" + StrCmp ${L_CMPRE} "" retain_setting + StrCpy ${L_PARSER} ${L_CMPRE} + + retain_setting: + FileWrite ${L_CLEANCFG} "bayes_nihongo_parser ${L_PARSER}${MB_NL}" + Goto close_cleancopy + + parser_not_previously_defined: + !insertmacro MUI_INSTALLOPTIONS_WRITE "pfi-cfg.ini" "Inherited" "NihongoParser" "?" + ReadRegStr ${L_CMPRE} HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" + StrCmp ${L_CMPRE} "" close_cleancopy + FileWrite ${L_CLEANCFG} "bayes_nihongo_parser ${L_CMPRE}${MB_NL}" + close_cleancopy: FileClose ${L_CLEANCFG} *************** *** 2521,2524 **** --- 2554,2558 ---- ports_ok: + Pop ${L_PARSER} Pop ${L_SKIN} Pop ${L_TEXTEND} *************** *** 2544,2547 **** --- 2578,2582 ---- !undef L_TEXTEND !undef L_SKIN + !undef L_PARSER FunctionEnd Index: adduser-Version.nsh =================================================================== RCS file: /cvsroot/popfile/windows/adduser-Version.nsh,v retrieving revision 1.6.2.15 retrieving revision 1.6.2.16 diff -C2 -d -r1.6.2.15 -r1.6.2.16 *** adduser-Version.nsh 21 Sep 2007 01:22:09 -0000 1.6.2.15 --- adduser-Version.nsh 5 Oct 2007 18:28:45 -0000 1.6.2.16 *************** *** 7,11 **** #-------------------------------------------------------------------------- ! !define C_PFI_VERSION "0.3.12" #-------------------------------------------------------------------------- --- 7,11 ---- #-------------------------------------------------------------------------- ! !define C_PFI_VERSION "0.3.13" #-------------------------------------------------------------------------- Index: CBP.nsh =================================================================== RCS file: /cvsroot/popfile/windows/CBP.nsh,v retrieving revision 1.33.4.3 retrieving revision 1.33.4.4 diff -C2 -d -r1.33.4.3 -r1.33.4.4 *** CBP.nsh 6 Feb 2006 16:30:05 -0000 1.33.4.3 --- CBP.nsh 5 Oct 2007 18:28:45 -0000 1.33.4.4 *************** *** 6,10 **** # can be overridden by creating suitable "!define" statements in 'adduser.nsi'. # ! # Copyright (c) 2003-2005 John Graham-Cumming # # This file is part of POPFile --- 6,10 ---- # can be overridden by creating suitable "!define" statements in 'adduser.nsi'. # ! # Copyright (c) 2003-2007 John Graham-Cumming # # This file is part of POPFile *************** *** 314,321 **** StrCpy ${CBP_L_RESULT} ${CBP_L_TEMP} 7 StrCmp ${CBP_L_RESULT} "corpus " got_flat_corpus ! StrCpy ${CBP_L_RESULT} ${CBP_L_TEMP} 13 StrCmp ${CBP_L_RESULT} "bayes_corpus " got_bdb_corpus ! StrCpy ${CBP_L_RESULT} ${CBP_L_TEMP} 18 StrCmp ${CBP_L_RESULT} "database_database " got_sql_corpus --- 314,321 ---- StrCpy ${CBP_L_RESULT} ${CBP_L_TEMP} 7 StrCmp ${CBP_L_RESULT} "corpus " got_flat_corpus ! StrCpy ${CBP_L_RESULT} ${CBP_L_TEMP} 13 StrCmp ${CBP_L_RESULT} "bayes_corpus " got_bdb_corpus ! StrCpy ${CBP_L_RESULT} ${CBP_L_TEMP} 18 StrCmp ${CBP_L_RESULT} "database_database " got_sql_corpus *************** *** 1115,1119 **** # CBP.ini --- generated by the 'CBP_CreateINIfile' function${MB_NL}\ #${MB_NL}\ ! # Copyright (c) 2003-2005 John Graham-Cumming${MB_NL}\ #${MB_NL}\ # This file is part of POPFile${MB_NL}\ --- 1115,1119 ---- # CBP.ini --- generated by the 'CBP_CreateINIfile' function${MB_NL}\ #${MB_NL}\ ! # Copyright (c) 2003-2007 John Graham-Cumming${MB_NL}\ #${MB_NL}\ # This file is part of POPFile${MB_NL}\ *************** *** 1871,1915 **** !define CBP_VALIDCHARS "abcdefghijklmnopqrstuvwxyz_-0123456789" ! Exch $0 ; The input string ! Push $1 ; Number of characters in ${CBP_VALIDCHARS} ! Push $2 ; Holds the result (either "" or a valid bucket name derived from the input string) ! Push $3 ; A character from the input string ! Push $4 ; The offset to a character in the "validity check" string ! Push $5 ; A character from the "validity check" string ! Push $6 ; Holds the current "validity check" string ! StrLen $1 "${CBP_VALIDCHARS}" ! StrCpy $2 "" next_input_char: ! StrCpy $3 $0 1 ; Get next character from the input string ! StrCmp $3 "" done ! StrCpy $6 ${CBP_VALIDCHARS}$3 ; Add character to end of "validity check" to guarantee a match ! StrCpy $0 $0 "" 1 ! StrCpy $4 -1 next_valid_char: ! IntOp $4 $4 + 1 ! StrCpy $5 $6 1 $4 ; Extract next "valid" character (from "validity check" string) ! StrCmp $3 $5 0 next_valid_char ! IntCmp $4 $1 invalid_name 0 invalid_name ; if match is with the char we added, name is bad ! StrCpy $2 $2$5 ; Use "valid" character to ensure we store lowercase letters in the result goto next_input_char ! invalid_name: ! StrCpy $2 "" done: ! StrCpy $0 $2 ; Result is either a valid bucket name or "" ! Pop $6 ! Pop $5 ! Pop $4 ! Pop $3 ! Pop $2 ! Pop $1 ! Exch $0 ; place result on top of the stack !undef CBP_VALIDCHARS FunctionEnd --- 1871,1936 ---- !define CBP_VALIDCHARS "abcdefghijklmnopqrstuvwxyz_-0123456789" ! !define L_STRING $0 ; The input string ! !define L_BAD_OFFSET $1 ; Number of characters in ${CBP_VALIDCHARS} string ! !define L_RESULT $2 ; Holds the result (either "" or a valid bucket name derived from the input string) ! !define L_CURRENT $3 ; A character from the input string ! !define L_OFFSET $4 ; The offset to a character in the "validity check" string ! !define L_VALIDCHAR $5 ; A character from the "validity check" string ! !define L_VALIDLIST $6 ; Holds the current "validity check" string ! !define L_CHARSLEFT $7 ; To cater for MBCS input strings, terminate when end of string reached, not when a null byte reached ! Exch ${L_STRING} ! Push ${L_BAD_OFFSET} ! Push ${L_RESULT} ! Push ${L_CURRENT} ! Push ${L_OFFSET} ! Push ${L_VALIDCHAR} ! Push ${L_VALIDLIST} ! Push ${L_CHARSLEFT} ! ! StrLen ${L_BAD_OFFSET} "${CBP_VALIDCHARS}" ! StrCpy ${L_RESULT} "" next_input_char: ! StrLen ${L_CHARSLEFT} ${L_STRING} ! StrCmp ${L_CHARSLEFT} 0 done ! StrCpy ${L_CURRENT} ${L_STRING} 1 ; Get the next character from the input string ! StrCpy ${L_VALIDLIST} ${CBP_VALIDCHARS}${L_CURRENT} ; Add it to end of "validity check" to guarantee a match ! StrCpy ${L_STRING} ${L_STRING} "" 1 ! StrCpy ${L_OFFSET} -1 next_valid_char: ! IntOp ${L_OFFSET} ${L_OFFSET} + 1 ! StrCpy ${L_VALIDCHAR} ${L_VALIDLIST} 1 ${L_OFFSET} ; Extract next "valid" char (from "validity check" string) ! StrCmp ${L_CURRENT} ${L_VALIDCHAR} 0 next_valid_char ! IntCmp ${L_OFFSET} ${L_BAD_OFFSET} bad_name 0 bad_name ; If match is with the char we added, name is bad ! StrCpy ${L_RESULT} ${L_RESULT}${L_VALIDCHAR} ; Use "valid" character to ensure we store lowercase letters in the result goto next_input_char ! bad_name: ! StrCpy ${L_RESULT} "" done: ! StrCpy ${L_STRING} ${L_RESULT} ; Result is either a valid bucket name or "" ! Pop ${L_CHARSLEFT} ! Pop ${L_VALIDLIST} ! Pop ${L_VALIDCHAR} ! Pop ${L_OFFSET} ! Pop ${L_CURRENT} ! Pop ${L_RESULT} ! Pop ${L_BAD_OFFSET} ! Exch ${L_STRING} ; Place result on top of the stack !undef CBP_VALIDCHARS + !undef L_STRING + !undef L_BAD_OFFSET + !undef L_RESULT + !undef L_CURRENT + !undef L_OFFSET + !undef L_VALIDCHAR + !undef L_VALIDLIST + !undef L_CHARSLEFT + FunctionEnd *************** *** 1931,1934 **** --- 1952,1961 ---- # input: "box|||car|van" output: bucket name = "box", revised list = "||car|van" # input: "||car|van" output: bucket name = "", revised list = "car|van" + # + # Bucket names are assumed to be valid, i.e. they are assumed to only contain characters in + # the ranges 'a' to 'z' and '0' to '9', plus the '-' and '_' characters. + # + # The 'CBP_MakePOPFileBuckets' function uses this function to extract a bucket color from + # a list of default color names (these names only use characters in the range 'a' to 'z'). #---------------------------------------------------------------------------------------------- # Inputs: *************** *** 2243,2279 **** Function CBP_StrStr - Exch $R1 ; $R1 = needle, top of stack = old$R1, haystack - Exch ; Top of stack = haystack, old$R1 - Exch $R2 ; $R2 = haystack, top of stack = old$R2, old$R1 ! Push $R3 ! Push $R4 ! Push $R5 ! StrLen $R3 $R1 ! StrCpy $R4 0 ! ; $R1 = needle ! ; $R2 = haystack ! ; $R3 = len(needle) ! ; $R4 = cnt ! ; $R5 = tmp loop: ! StrCpy $R5 $R2 $R3 $R4 ! StrCmp $R5 $R1 done ! StrCmp $R5 "" done ! IntOp $R4 $R4 + 1 ! Goto loop ! done: ! StrCpy $R1 $R2 "" $R4 ! Pop $R5 ! Pop $R4 ! Pop $R3 - Pop $R2 - Exch $R1 FunctionEnd --- 2270,2334 ---- Function CBP_StrStr ! !define L_NEEDLE $R1 ; the string we are trying to match ! !define L_HAYSTACK $R2 ; the string in which we search for a match ! !define L_NEEDLE_LENGTH $R3 ! !define L_HAYSTACK_LIMIT $R4 ! !define L_HAYSTACK_OFFSET $R5 ; the first character has an offset of zero ! !define L_SUBSTRING $R6 ; a string that might match the 'needle' string ! Exch ${L_NEEDLE} ! Exch ! Exch ${L_HAYSTACK} ! Push ${L_NEEDLE_LENGTH} ! Push ${L_HAYSTACK_LIMIT} ! Push ${L_HAYSTACK_OFFSET} ! Push ${L_SUBSTRING} ! StrLen ${L_NEEDLE_LENGTH} ${L_NEEDLE} ! StrLen ${L_HAYSTACK_LIMIT} ${L_HAYSTACK} ! ! ; If 'needle' is longer than 'haystack' then return empty string ! ; (to show 'needle' was not found in 'haystack') ! ! IntCmp ${L_NEEDLE_LENGTH} ${L_HAYSTACK_LIMIT} 0 0 not_found ! ! ; Adjust the search limit as there is no point in testing substrings ! ; which are known to be shorter than the length of the 'needle' string ! ! IntOp ${L_HAYSTACK_LIMIT} ${L_HAYSTACK_LIMIT} - ${L_NEEDLE_LENGTH} ! ! ; The first character is at offset 0 ! ! StrCpy ${L_HAYSTACK_OFFSET} 0 loop: ! StrCpy ${L_SUBSTRING} ${L_HAYSTACK} ${L_NEEDLE_LENGTH} ${L_HAYSTACK_OFFSET} ! StrCmp ${L_SUBSTRING} ${L_NEEDLE} match_found ! IntOp ${L_HAYSTACK_OFFSET} ${L_HAYSTACK_OFFSET} + 1 ! IntCmp ${L_HAYSTACK_OFFSET} ${L_HAYSTACK_LIMIT} loop loop 0 ! not_found: ! StrCpy ${L_NEEDLE} "" ! Goto exit ! match_found: ! StrCpy ${L_NEEDLE} ${L_HAYSTACK} "" ${L_HAYSTACK_OFFSET} ! ! exit: ! Pop ${L_SUBSTRING} ! Pop ${L_HAYSTACK_OFFSET} ! Pop ${L_HAYSTACK_LIMIT} ! Pop ${L_NEEDLE_LENGTH} ! Pop ${L_HAYSTACK} ! Exch ${L_NEEDLE} ! ! !undef L_NEEDLE ! !undef L_HAYSTACK ! !undef L_NEEDLE_LENGTH ! !undef L_HAYSTACK_LIMIT ! !undef L_HAYSTACK_OFFSET ! !undef L_SUBSTRING FunctionEnd |