*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> patterns (4)              
Title
Content
Arch
Section
 

patterns(4)

Contents


NAME    [Toc]    [Back]

       patterns  -  Patterns  for  use  with internationalization
       tools

SYNOPSIS    [Toc]    [Back]

       See the Description section.

DESCRIPTION    [Toc]    [Back]

       The patterns file  contains  the  patterns  that  must  be
       matched for the internationalization tools extract, strextract,
 and strmerge.

       The pattern file in the following example is  the  default
       patterns file located in /usr/lib/nls/patterns.

       #  This  is  the  header to insert at the beginning of the
       first new # source file

       $SRCHEAD1 (1) \#include <nl_types.h> nl_catd _m_catd; \

       # The header to insert at the beginning of the rest of the
       new # source files

       $SRCHEAD2   (2)   \#include  <nl_types.h>  extern  nl_catd
       _m_catd; \

       # This is the header to insert at  the  beginning  of  the
       message # catalogues

       $CATHEAD (3) \$ /* \$  * X/OPEN message catalogue \$  */ \
       \$quote "

       # This is how patterns that are matched will  get  rewritten.


       $REWRITE (4) catgets(_m_catd, %s, %n, %t)

       #  Following is a list of the sort of strings we are looking
 for.  # The regular expression syntax is based on regexp(3).

       $MATCH (5)

       #    Match    on   strings   containing   an   escaped   "
       "[^\\]*\\"[^"]*"

       # Match on general strings "[^"]*"

       # Now reject some special C constructs.

       $REJECT         (6) # the empty string ""0

       # string with just one format descriptor "%."  "%.\."

       # string with just line control in "\\."

       # string with just line control and one format  descriptor
       in "%.\\."  "\\.%."

       #  ignore  cpp  include lines \#[  ]*include[  ]*".*"  \#[
       ]*ident[  ]*".*"

       # reject some common  C  functions  and  expressions  with
       quoted   #   strings  [sS][cC][cC][sS][iI][dD]\[\][   ]*=[
       ]*".*"   open[   ]*([^,]*,[^)]*)  creat[   ]*([^,]*,[^)]*)
       access[   ]*([^,]*,[^)]*)  chdir[   ]*([^,]*,[^)]*) chmod[
       ]*([^,]*,[^)]*) chown[  ]*([^,]*,[^)]*)

       # Reject any strings in single line comments /\*.*\*/

       # Print a warning for initialised strings.

       $ERROR initialised strings cannot be replaced          (7)
       char[^=]*=[    ]*"[^"]*"  char[^=]*=[   ]*"[^\\]*\\"[^"]*"
       char[ ]*\**[A-Za-z][A-Za-z0-9]*\[[^\]*\][ ]*=[  {]*"[^"]*"
       char[       ]*\**[A-Za-z][A-Za-z0-9]*\[[^\]*\][       ]*=[
       {]*"[^\\]*\\"[^"]*"

       The default patterns file is divided  into  the  following
       sections:  In  the  $SRCHEAD1  section,  the  strmerge and
       extract commands place text in this section at the  beginning
 of the first new source program, which is prefixed by
       nl_.  These  commands  define  the  native  language  file
       descriptors  that  point  to  the message catalog.  In the
       $SRCHEAD2 section, the strmerge and extract commands place
       text  in  this  section at the beginning of the second and
       remaining source programs. These commands also define  the
       native language file descriptors that point to the message
       catalog. $SRCHEAD2 contains the  external  declaration  of
       the  nl  file  descriptor.   In  the $CATHEAD section, the
       strmerge and extract commands place text in  this  section
       at  the beginning of the message catalog.  In the $REWRITE
       section, you specify how the strmerge and extract commands
       should  replace  the  extracted  strings in the new source
       program. You can supply three options to the catgets  command:
  This  option  increments  the  set  number for each
       source. This option applies only  if  you  are  using  the
       strmerge  command.   For  more information on set numbers,
       see the catgets(3) reference page.  This option increments
       the  message number for each string extracted. This option
       applies if you are using either the  strmerge  or  extract
       commands.   This  option  expands the text from the string
       extracted. The string  can  be  a  error  message  or  the
       default  string  extracted and printed by the catgets command.
 For example, if you want an error message to  appear
       when  catgets  is  unable to retrieve the message from the
       message catalog, you would  include  the  following  line:
       catgets(_m_catd, %s, %n, "BAD STRING")

              When  catgets  fails,  it  returns  the message BAD
              STRING.  In the $MATCH  section,  you  specify  the
              patterns  in  the form of a regular expression that
              you want the strextract, strmerge, and extract commands
  to  find  and match.  The regular expression
              follows the same syntax rules as  defined  in  regexp(3) reference page.  In the $REJECT section, you
              specify the matched strings that you  do  not  want
              the  strmerge  and  extract  commands to replace in
              your source program.  The regular  expression  follows
  the same syntax rules as defined in regexp(3)
              reference page.  In the $ERROR section, the  strextract,
  strmerge, and extract commands look for bad
              matches and notify you with a warning message.  The
              regular expression follows the same syntax rules as
              defined in the regexp(3) reference page.

RELATED INFORMATION    [Toc]    [Back]

       extract(1),    strextract(1),    strmerge(1),    trans(1),
       regexp(3)
       Writing Software for the International Market delim off



                                                      patterns(4)
[ Back ]
 Similar pages
Name OS Title
defpattern IRIX defines patterns
fgrep Tru64 Searches a file for patterns
fnmatch Tru64 Match filename patterns
egrep Tru64 Searches a file for patterns
sshregex Tru64 Glob (wildcard) patterns
grep Tru64 Searches a file for patterns
refcnt IRIX Analysis of memory access patterns
glob IRIX Return names of files that match patterns
LC_ALL Tru64 Introduction to internationalization (I18N)
i18n Tru64 Introduction to internationalization (I18N)
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service