Query: patterns
OS: ultrix
Section: 5int
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
patterns(5int) patterns(5int) Name patterns - patterns for use with internationalization tools Syntax See the Description section. Description The patterns file contains the patterns that must be matched for the internationalization tools and The pattern file in the following example is the default patterns file located in # 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 regex(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:(1) In the $SRCHEAD1 section, the and commands place text in this section at the beginning of the first new source program, which is pre- fixed by These commands define the native language file descriptors that point to the message catalog.(2) In the $SRCHEAD2 section, the and 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.(3) In the $CATHEAD section, the and commands place text in this section at the beginning of the message catalog.(4) In the $REWRITE section, you specify how the and commands should replace the extracted strings in the new source program. You can sup- ply three options to the command: %s This option increments the set number for each source. This option applies only if you are using the command. For more informa- tion on set numbers, see the reference page. %n This option increments the message number for each string extracted. This option applies if you are using either the or commands. %t 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 command. For example, if you want an error message to appear when is unable to retrieve the message from the mes- sage catalog, you would include the following line: catgets(_m_catd, %s, %n, "BAD STRING") When fails, it returns the message BAD STRING.(5) In the $MATCH section, you specify the patterns in the form of a regular expression that you want the and commands to find and match. The regular expression follows the same syntax rules as defined in reference page.(6) In the $REJECT section, you specify the matched strings that you do not want the and commands to replace in your source program. The regular expression follows the same syntax rules as defined in reference page.(7) In the $ERROR section, the and commands look for bad matches and notify you with a warning message. The regular expression follows the same syntax rules as defined in the reference page. See Also intro(3int), extract(1int), strextract(1int), strmerge(1int), trans(1int), regex(3) Guide to Developing International Software patterns(5int)
Related Man Pages |
---|
switch(n) - mojave |
extract(1int) - ultrix |
catgets(3int) - ultrix |
strextract(1) - osf1 |
patterns(4) - osf1 |