
  GNU  m4,     version 1.4   ѱ  Ŵ 
  
                                            ũ ó 
                                           1.4 , 1994  11















   : Rene Seindal
   :   
  

    
  

  1  ԰ غ
    1.1 m4 
    1.2 m4 
    1.3 m4 θ
    1.4  
    1.5  Ŵ 

  2  ֿ  Ģ
    2.1 Ī
    2.2 ǥ ѷ ڿ
    2.3 ٸ ū
    2.4 ּ

  3  ũ ϱ
    3.1 ũ ⺻ 
    3.2 ũ ȣ ϱ
    3.3 ũ ڵ
    3.4 ũ ڸ ǥ  
    3.5 ũ Ȯ
    
  4  ο ũθ ϴ 
    4.1 ũθ ϱ
    4.2 ũο 
    4.3 ũο Ư 
    4.4 ũ 
    4.5 ũ Ī ϱ
    4.6 ӽ÷ ٽ ϴ ũ
    4.7  ũ ȣ
    4.8   ũ ȣϱ
    
  5   , , 
    5.1 ũ  ׽Ʈ
    5.2 ڿ 
    5.3  
    
  6  ũο ԷµǴ   ϴ 
    6.1 ũ Ǹ 
    6.2 ũ ȣ ϱ
    6.3   ϱ 
    6.4   ϱ
    
  7  Է 
    7.1 Է¿ 鹮 ϱ
    7.2 ο  ٲٱ
    7.3 ּ  ϱ 
    7.4  ܾ  ٲٱ
    7.5 Է ϱ
    
  8  
    8.1  ϱ
    8.2   ˻ϱ
    
  9  ȯϱ,  
    9.1  ȯϱ
    9.2   ǵ  
    9.3 ȯ  
    9.4 ȯ ؽƮ ϱ
    
  10  óϴ ũ 
    10.1 ڿ ̸ 
    10.2 ڿ ӿ Ư ڿ ã 
    10.3 ǥ ˻ϱ
    10.4 ڿ Ư ڿ ̱
    10.5 ڸ ȯϱ
    10.6 ǥ ؽƮ ġϱ
    10.7 ȭ 
    
  11     ũ
    11.1 ,  
    11.2  ǥ  ϱ

  12  н  
    12.1   ϱ
    12.2    б
    12.3  ڵ
    12.4 ӽ ̸ 
    
  13   ׿ ũε
    13.1  ޽ 
    13.2 m4 
    
  14    ӵ εϱ

  15   m4  ٸ  ȣȯ
    15.1 GNU m4  Ȯ 
    15.2 GNU m4   System V ġ
    15.3 ٸ ȣȯ

  
    Ӹ :  鼭 
  

  *   1994 11 FSF(Free Software Foundation)  ۼ 
    "GNU m4, version 1.4" ޴ ѱ۷ ű Դϴ.

  *   1997.4.15 Ͽ  ѵ(E-mail: ddoch@hitel.kol.co.kr)
      ϷǾϴ.

  *  1997.4.15 Ͽ ϴ   ޴  ڿ  
        Ŵ Դϴ.

  *  ũ GNU m4  Ŵ   ѱ۷    ֵ 
     ǵθ  Ǿϴ.  GNU   Ǵ İ
     翡 ؼ ʰ ֽϴ.  Ű¡  
     е ֽø ϰڽϴ.

  * ٸ  ű    Ͻð ֽñ ٶ
    HWP  ٸ  ȣȯ  δ ȯ ñ ٶϴ.

  *  ޴ ķ ܼ  ƴ ü Ǵ ѱ۸޴
    Ȯ Դϴ.

  * ߸   س      å 
    ϴ. 

  *  ޴󿡴   غ  ſ Ÿ   ֽϴ. 

  *  ߸  ؼ ڿ  ֽð, m4   
    ޴  ִ ó  ȣȸ  Խǿ ÷ֽñ 
    ϴ.

  *  ޴    ޴  뷫  ϴ.

   ^ Ʈũ ǥ  ִ Ư Ʈ, ڴ ؽƮ Ÿ
     ʾҽϴ.  Ʈũ     
      ʽϴ.  Ư Ͻô    Դϴ.

   ^  ϰ Ϸ  ǹ     ǵ
      ߽ϴ.   κе ޴  ϰ, ؼ
     Ͽ Ű   ֽϴ. ׸  ؼ Ƿ¶ 
      Ƹ κе  ֽϴ. ׸ ϱ⿡ Ƹ Ư
      ϴ ܾ鵵   Ǿ ,  ϸ  
     ƺ  κ ű ʾҽϴ.

   ^   "See [Search Path]"    Ű  "[]"
     ܾ  ƴ϶ ǹ̻  Ű ̹Ƿ ׳ ξϴ.

  * ׿   ϴ.

   ^  3.1(¥ ) ⺻ ġǴ  1.4Դϴ. 
      ġ Ȯ غ ߽ϴ.   ٸ 
       Ʋ  ֽϴ.   

   ^ changeword   ҽ ϼż   Űž 
       ֽϴ.

   ^ ޴  Ÿ forloop    ũ̹Ƿ  
      Ǹ  ּž Ͻ  ֽϴ.

   ^ ޴  Ÿ ⺻ ο빮ڴ '`' (ESCŰ  ) '''(ENTERŰ
      ) ̹Ƿ  ׽Ʈ ÿ Ͻñ ٶϴ.

     ) define('x', 'x') (X)
         define(`x', `x') (0)
              
   ^ ޴       ٸ  찡 
       ̰  ũ debugmode  Ͻø    ֽ
     .
  

  Copyright 1989, 90, 91, 92, 93, 94  Free Software Foundation, Inc.

  Permission is granted to make and distribute verbatim copies of
  this manual provided the copyright notice and this permission notice
  are preserved on all copies.

  Permission is granted to copy and distribute modified versions of this
  manual under the conditions for verbatim copying, provided that the entire
  resulting derived work is distributed under the terms of a permission
  notice identical to this one.

  Permission is granted to copy and distribute translations of this manual
  into another language, under the above conditions for modified versions,
  except that this permission notice may be stated in a translation approved
  by the Foundation.

  
          1  ԰ غ
  


  ù忡 GNU m4 ̰ 𼭺   Ǿ   Ȱ
, m4 α׷ ȣ,     ؼ Ѵ. ƿ﷯ Ŵ
  κ д    ϸ鼭 Ѵ.
  
    m4   ڼ Ư¡  ̴.

1.1 m4 

   m4 ǥԷ¿ о ǥ ũθ Ȯϴ ũ  ó
. ũδ Ǿ ְų ڰ  Ǹ   ִ.  Ѱִ 
   . m4 ũ  Ȯ常 ϴ  ƴ϶  
ų UNIX  Ѵٴ,  ,  óϴ    
  ִ. m4 Ϸ  غ ۾ ǰų ϳ 
 ũ ó    ̴.
  
  ũ ó m4  UNIX а  ϴ. , Ҽ 
ڸ m4 縦 ˰ ִ.  ׷ m4    ̸  
  ̴. GNU  Autoconf αⰡ  'configure' ũƮ 
  ̸ 䱸Ǵ  GNU m4 m4 ġϵ ϴ ڱ  ǰ ִ. 
׷    m4 α׷  ϴ  ͼġ   ̴. GNU 
m4 κ System V,  3     ͸  κ ȣ
ȯȴ.  ڼ  [Compatibility] κ .

    m4 ߵ ߰Ѵ. ó  m4   
ذῡ Ѵ. ׷ٰ   ū   ϸ鼭  m4 ũ 
Ʈ ϴ  ؼ  .    ߵǾ    
 ſ ϰ m4 ø̼ ۼϴ 찡 . ׷  
 ۾ ð 뿡 ġ ð    ⵵ Ѵ. m4 α
 ǰ ġ ؾ ģٴ   .


1.2 m4 

  m4 翡 õ  ⿡ ϰ  ʾҴ.   
 ̴. Ȥ ̿   ˰ ִ   κ    ֵ 
 ֱ ٶ.
  
  m4  GPM̴. C. Stratche " ũ ߻(A General Purpose
Macro generator)", ǻ  8,3 (1965), 255    ٶ. 
David   Cries     GPM   "  ǻ   Ϸ   (Compiler 
Construction for Digital Computers)" ¾.

  GPM ߴٸ, m4  ε    ٷ 
̿. ũδ   ּ νϰ,  鹮ڳ  (end-of-line) 
 ǳʶ  ־,  ڵ ϰ ־.

   m4 cpp  ratfor, Ʈ ó ̿. 

1.3 m4 θ

  m4    .
  
    m4 [option...] [macro-definitions...] [input-file...]

   ɼ  '-' ϰų  ɼ̸  '--'    ִ.  
ɼ̸ ϰ   ʿ . Ȯ  ξ ϴ. m4   
ɼ   ִ.

--version
         α׷  ȣ Ѵ. 
--help
         ڼ  Ѵ. 
-G
--traditional
         System V  Ͽ Ȯ   Ѵ.
-E
--fatal-warnings
         ġ ù °   ﰢ  ߰ Ѵ.
-dflags
-debug=flags
           ÷׸ flags  Ѵ.    ɿ 
          Ǵ    Ѵ.          
-lnum
--arglength=num
         ũ   Ǵ  ũ⸦ Ѵ. [Debug  Levels] 
         κ ϶. 
-ofile
--error-output=file
             Ϸ  ϵ Ѵ. ޽  ״ 
         ǥؿ¿ . [Debug Output] κ ϶.
-Idir
--include=dir
          ۾  丮      쿡 ˻ 
         θ dir Ѵ. 
-e
--interactive
         m4  ȭ ȣѴ.  ǹ̴   ۸   ʰ, 
         ͷƮ õȴٴ ̴.
-s
--synclines
         ü(synchronisation)   Ѵ. ̰  C ó⳪  ٸ 
             ȴ. ̰ m4   Ϸ غ
         (front-end)     δ. ҽ̸  ȣ 
           `#line linenum"filename"'  ڿ  ޵ȴ. ̰
         ʿϴٸ  Է ߰ ־. ׷ ڴ  ο
           ۵ȴٴ  ˸ٰų Է  filename    linenum 
           Ȯȴٴ  ǹѴ. '"filename"' κ   
         ڷκ ̸ ٲ ʾ   Ǳ⵵ Ѵ.
         ü(Synchronisation) ڴ        
         ־. 
         ü ġ  Է¶ ߰  ߻Ѵٸ յ(associated)
         ü ڴ    ۵  ȴ. 
-P
--prefix-builtins
           ũ  Ī տ `m4_' ϵ Ѵ.
          ,   ɼ Ѵٸ, `define'   `m4_define'  
         ؾ Ѵ. 
         ׸ `__file__'  `m4__file__' ؾ Ѵ.
-WREGEXP
--word-regexp=REGEXP
         ũ ̸  Ѵ.   ɼ  GNU m4  
          ϴ  ƴϴ. ([Changeword] κ ϶.) 
-Hn
--hashsize=n
          ɺ  ã ؽ(hash) ̺   .   
         ڰ ù ° ȿϴ. ⺻  509 Ʈ̴.   
         е   ũθ  ʴ´ٸ  ũ̴. 
-Ln
--nesting-limit=n
         (nesting) ũ ȣ n   Ѵ.   
          Ѿ  ÿ α׷   Ѵ.  Ư  õ
           ѵ nesting  250 ̴. 
          ɼ Ȯ    ͺٴ ڱ״ nesting  
            յ ̴.
         ̰  ǹ̿      m4 Է   
          ̴. κ ڿԴ  ǹ̾ ɼ  ̴. 
          Ž  ٸ  ɼ  Ÿ ̴. 
          ɼ  Ӿ ȸϴ  ߰    ִ ɷ 
         . ̷   ִ  `define(`a',  `a')a'  ̴.   
         (׷ [Compatibility] κ .) GNU m4  ̷   
         ϱ⸦ ٶ  ϳ Ϸ ý ѷ ϰ ġ
         ϱ⸦ ٶ Ͱ ٸ . ̰ Ϲ ſ  
         ̳    !
-Q
--quiet
--silent 
         ũ ȣ⿡   Ǽ    ʴ´.
-B
-S
-T  
         ̵ ɼ System V m4  ȣȯ ؼ Ѵ.  ׷ ̰
         ƹϵ  ʴ´. 
-Nn
--diversions=n
         ̵ ɼ  GNU  m4  ȣȯ ؼ  ̴. 
         ׸ ̰   ȯ  Ѵ.   ɼǵ  
         ƹ  ϵ  ʴ´. ̹     ̴.

  ũ ǿ   ο   ִ. `-D'ɼǰ `-U' ɼ 
װ̴. ̰͵     ִ.

-Dname
-Dname=value
--define=name
--define=name=value
           Է   ⵵   ɺ  ̺  name   
         ´. `=value' ٸ    ڿ ȴ. ׸  Է 
         ο ̰ ǵȴٸ value    ڿ̴ٵ   
         ,  ũδ ڸ  ǵ  ִ. 
-Uname
--undefine=name
        ̹ ǵ name  Ѵ. ̹ ǵ  ũθ ̹  
         ִ.
-tname
--trace=name
        name  ɺ̺  ִ´.  ũΰ ǵǱ   
         ϱ Ѵ.
-Ffile
--freeze-state file
              , õ  file   frozen ¸  . 
        ([Frozen files] κ .)
-Rfile
--reload-state file
         ϱ , õ frozen file  `file'    ¸ 
        ´. ([Frozen files] κ .)

    ο  ڴ Է   ̸̴. ̸  
´ٸ, ǥԷ  .  ̸ `-' ǥԷ Ѵ.

  Է    . ǥԷ       ִ. 
 ̸ `-'  ο   Ÿ Ѵ. 

1.4   

  GNU m4  ϸ鼭   ְų ׸ ߰  ִٸ, 
ֱ ٶ. ׺ ۼϱ  , װ ¥  Ȯغ 
.    ٽ Ǳ о  е ó  ִ  ΰ 
˾ƺ. е װ ó  ִ ɷ  ִ  װ͵ ش
. ȿ װ   ִ.

  ׺ ۼϰų    ĺ ,   
   ԷϷ Ѻ. ׸   Էϰ ſ  Ÿ 
m4   ޶.   е ٶ     ش޶. 
̰ 츮   ƴ ϴ    ̴.
  
  Ȯ  ߰ߴٸ e-mail(ͳ) `bug-gnu-utils@prep.ai.mit.edu' 
̳ (UUCP) `mit-eddie!prep.ai.mit.edu!bug-gnu-utils' ޶. е 
ϰ ִ m4      ԽŰ   ̴.    
`m4 --version'   ִ.

  װ ƴ ȵ ׻ ȯѴ.  ̳     
̳ Ȯ Ư¡ ָ . 

1.5  Ŵ 

   Ŵ m4   Է°   ϰ  ִ. ׸ Է° 
, ¿   Ģ ϰ ִ.  Ϲ ؽƮ(ũ
 Ʈ) ǥѴ.  ..

    This is an example of an example!

  ° Է ϱ ؼ  m4    `=>' տ ٴ´. ׸
 ޽    `error=>' ǥѴ. ...

    Example of input line
    =>Output line from m4
    error=>and an error message

   m4  ̹ ǵ , ũ ȣ, ڵ    Ʈ
 ´. 

     regexp(string, regexp, opt replacement)

  m4   ڴ  ڿ̴. ׷   Ưϰ ؼѴ.  
, ̸, ǥ ..

    °   `opt'  û̶   Ų. (ȴٸ, 
ڿ  ̴.)     ȣ(`...')   ڵ 
  Ű ̴.
  
    ϰǰ `builtin'      Ѵ. ̰  m4 
 "builtin primitive"   δ. 

( --------------------   -------------------------------------------
      Ʈũ Ǿ ִ     
    Ϲ ؽƮ   ؼ  ȵǴ  ִ. 

  * Ưϰ ū   Ʈ ٲ ʴ´. 
  *  Ϲ ؽƮ   Ʒ ĭ  ΰ  
     ˾ƺ   ̴. 
  * `builtin'  " ũ" "" Ͽ. 
  * ƿ﷯    Ŵ      е  GNU 
    m4 ʹ  ٸ  Ǿ ִ  ̴  debugmode ɼ
      ָ Ȱ    ִ. 
  * Ʒ     forloop    ũΰ  ƴ  
     ũημ  Ͽ Ͽ Ѵ.    ش  
     ǥϿ.
  -------------------------------------------------------------------------)

  
              2  ֿ  Ģ
  

  m4 Է¿  о װ ū иѴ.  ϳ ū Ḭ̄ų 
ǥ(`, ') ѷ ڿ, Ǵ Ī̳ ڿ Ϻκ ƴ  Ϲ
̴. m4 ԷµǴ  ּ  ִ.

2.1  Ī

  ϳ Ī ùڰ 10   ʴ  , 10, ٹ
(_) ̴.  Ī ũ  Ƕ װ ٽ ũ Ȯ  
̴. ([Macro] κ ϶.)

  ùٸ Ī   .

  `foo', `_tmp', `name01'

  (: C   ϸ ɰ̴.)

2.2 ǥ ѷ ڿ

  ǥ ѷ ڿ  ǥ ` ' ѷο. ڿ  ùκа 
 κп  ٰ  ȴ. ڿ ū  ǥ    
Ʈ̴. 

    `'

    ڿ̴. ׸

    ``quoted''

   ڿ 

    `quoted'
 
  ̴.

  ǥ   ϴ ڴ   ũ changequote   ϸ  
  ִ.  ( ڼ  [Changequote] κ .)

  ( : 뿡 Ͽ Ұ Ѱ ִ. Ī Ÿ ǥ
            ..   `quoted'  ǥ Ű󿡼 ESCؿ 
            ִ ̰,  ǥ Ű  ִ ̴. 򰥷 
             ð   ʱ ٶ.)

2.3 ٸ ū

   ڵ, Ī̳  ǥ ѷ ڿ Ϻκ̰ų  װ
ü ϳ ū.

2.4 ּ

  m4 ּ   '#' newline ڷ еȴ. ּ   ڵ
 '#' newline  ڵ Բ õȴ. ׷ ü  ּ  ǳ
. ּ m4 ؼ ҵ ʴ´ٴ ̾߱. 

  ּ      ٿ     .  '#'  ù  ° 
newlineڷ ּ .  ּ ڴ    ڿδ  
ũ changecom Ͽ   ִ. ( [Changecom] κ .)


  
                  3  ũ ϱ 
  

    ũ  ⺻  ũο ڸ Ѱִ  , ũ
ΰ  ޵Ǵ Ѵ.

3.1 ũ ⺻ 

  ũθ θ  Ʒ  Ѵ.

    name

  ̰ ƹ ڵ  ũθ θ ̴. Ǵ   Ѵ.

    name(arg1, arg2, ..., argN)

  ̰ N ڷ ũθ θ ̴. ũ    
.  ڴ  ڿ̴. ׷ ٸ ũδ  ڸ ٸ ؼ  
ִ.

   ȣ name    ٷ ; Ѵ.  ׷  ũ
 ϳ ڵ  ä ȣȴ. 

  ũθ ϳ  ä ȣ  Ѵٸ, ȣ  Ѵ.   
 ȣѴٸ

    name()

  ̰ ϳ ڸ . װ  ڿ̴. 

3.2 ũ ȣ ϱ

  m4    پ    ũη  Ȯ    ٽ  ȮѴٴ  ̴. 
(Stratchey GPM..)
̰  ȣ ǹϴ ξ    ̵, Ư  ̵ 
ٽ ũθ νѴٴ ̴. ̰  ݸ   õ Ǳ⵵ 
. ġ ʴ ũθ ȣ    ִٴ ̴.  GNU m4 Ī 
ġ ʴ ũη  νϴ  ϴ    ī ũ 
Ѵ. 
   ù °,   ũε ڰ ̴ ȣ  . ̷ 
ũε Ī   ȣ ٷ  ʴ´ٸ  ũδ ȣ
 ʴ´.  ̰  κ  쿡   ذå ȴ. 'include' 
'eval' 찡 ǥ ̴.   Ĺݺο "  ũδ ڰ 
  νĵȴ"  ߾   ̴.

  ̷ ۾ ִ  ȣ  ɼ(--prefix-builtins, Ǵ -P) ִ. 
̰  ũθ ȣ  'm4_' տ ̵ ϴ ̴.  ɼ 
 ũο   ġ ʴ´.   m4_dnl  m4_m4exit
   Ѵٴ ̾߱.

  ڰ  ִ GNU m4 changeword   ִٸ, ̰ 
ũ Ī     Ѵ. ũο    ũ
ο ..
 (̷  Ư¡   ڼ ˰  [Changeword] κ  .)

  , ϳ Ī  ϴ ũη ȣϴ  ؼϴ   
ϴ     װ ǥ   ̴.    Ĺݺ
    ũ ȣ  ϴ  ũ ȣ ϴ 
 Ǵ ο뱸   Ѵ.

  ǥ     ũ ü Ī   ,  Ī Ϻκ
   ִ.  ڿ ǥ  óϴ ͵ ϴ. ׷ ̰
Ī ο ۵Ѵ.  ,

    `divert'
    `d'ivert
    di`ver't
    div`'ert
    
  ̰ δ ڿ `divert' ǹѴ.   ,

    `'divert
    divert`'

   ũ divert ȣ ̴.

  ũ Ȯ  ٽ ˻ȴ.    ڿ `de'ʵ尡   ̴. 
Ȯϰ ̾߱ڸ m4 Է `substr(abcde, 3, 2)'  ̴.

    define(`x', `substr(ab')
    define(`y', `cde, 3, 2)')
    x`'y

  ǥ ó ڿ ʿ ǥ  ڿ ִٸ װ ũ 
Ī ν ̴. Ʒ  ǥ  ڿ dnl ũθ 
ϵ Ѵ. 

    define(`macro', `di$1')
    macro(v)`'dnl

  ǥ ٸ, ڿ `divdnl'  ̴.

  ǥ ó ڵ   μ  ũ  Ȯ   
ִ.  ׿̴.

    define(`macro', `di$1')
    macro(v)`ert'

  Է ڿ `divert'   ̴. ǥ ٸ divert   
ũΰ ȣȴ.

3.3 ũ ڵ

    ϳ Ī̶ װ  κ  ũ ̴. װ 
 ũη Ȯȴ. 

  Īڿ  ȣ ,  ڴ ũθ ȣϱ  . 
 ͺ    ڰ ´ٸ   ڴ  ڿ  ġǰ, 
 ͺ   ڰ ´ٸ  ڴ õȴ.

   m4  ũθ  ȣ   ʴ  ڸ ٸ 
 . ̷   `-Q'  ɼ    ִ. ڰ 
 ũο ־   üũ ʴ´.

  ũδ  ڸ    Ȯǰ, Ȯ ؽƮ  Ÿ ޸
 ǥ(quotes), ȣ ڷ    ȴ. ׷  foo `, b, c'
 Ȯȴٸ, 

    bar(a foo, d)

   ũδ 4 ڸ  ̴. װ `a', `b', `c', `d' ȴ. ù 
° ڰ   ϰ Ǵ  ڸ  ǥ  鹮ڴ 
  Ϻκ ƴ϶  . 

3.4   ũ ڸ ǥ  

   ڴ ǥ    ŵ 鹮ڸ .   
    ȣ ѽ Ǿ Ѵ.  , foo  ũ
.

    foo(() (`(' `(')

  ̰ ϳ ڸ  ũθ ȣѴ. װ `() (() ('̴.

  ũο  ڸ  ǥ    ̴.  ڰ Ȯ
Ǳ⸦ ٶ ʴ  ׷.  ׷,  ȣ  ٸ  
  ϴ ̴.
  
    foo(`() (() (')

   ڿ ǥ   쵵 ִ.  ׷ 쿡  ڿ 
ǥ  ʴ´ٰ ؼ Ʋ  ƴϴ.  ٸ װ ݵ  
 ȵ   ̴. 

3.5  ũ Ȯ

  ũο ڰ   , ũδ Ȯȴ. ׸ Ȯ ؽƮ 
 Է ־  оδ.  ϳ ũ ȣ⿡  Ȯ ؽ
Ʈ  ȿ  Ǵٸ ũ ȣ ԵǾ ִٸ    ũθ ȣ 
 ִ.  쿡 ٽ ù ũ ȣ Ȯȴ. 

    ϳ , Ʒ foo `bar' Ȯǰ, bar `Hello World' 
Ȯȴٰ ϸ 

    foo

    `bar' Ȯǰ, ٽ  `Hello World' Ȯȴ.

         
  
              4  ο ũθ ϴ 
  


  ũδ پ  ǵɼ  , ǵǰų   ִ. 
   Ҿ ʰ  ũθ ϴ  ϸ ߿ 
   ִ.

4.1  ũθ ϱ

  ϰų ϴ Ϲ    ũ define  ϴ 
̴.

    define(name [, expansion])

   name expansion ǵȴ.   expansion ־ ʴ´ٸ 
name     ǵȴ. 

  define  Ȯ ʴ´.

    ũ foo ؽƮ `Hello World.' Ѵ.

    define(`foo', `Hello world.')
    =>
    foo
    =>Hello world.

    Ÿ   ιڴ ũ  Ϻκ ƴ϶
   ̴. ̰ ũ dnl Ͽ   ִ. ڼ
  [Dnl] κ .

  define ũδ ڰ   νĵȴ.

4.2 ũο 

  ũδ ڸ  ִ.  N° ڴ Ȯ ؽƮ $N 
 ̰ ũΰ Ȯ  N°  ڷ üȴ. ⿡  
 ڸ  ũ   ִ. ϰ      ٲ
 ̴.

    define(`exch', `$2, $1')
    =>
    exch(arg1, arg2)
    =>arg2, arg1

  ڸ define ϰ Ѵٸ Ʒ     ִ.

    define(`exch', `$2, $1')
    =>
    define(exch(``expansion text'', ``macro''))
    =>
    macro
    =>expansion text

  ֵǥ ѷ ǥ  [Quoting Arguments] κ .

  GNU m4 `$' ڸ ̻     ִ. ũδ  
  .   ڸ  ü ִ UNIX   m4ʹ ٸ
̴.
    
  Ưϰ, $0  ׻ ũ ڽ ̸ Ȯȴٴ ̴. 

    define(`test', ``Macro name: $0'')
    =>
    test
    =>Macro name: test

   Ȯ ؽƮȿ  ǥ ѷ ؽƮ ְ ʹٸ,   ǥ
 ǥ ó ڿ ӿ Ǿ Ѵ.  ..

    define(`foo', `This is macro `foo'.')
    =>
    foo
    =>This is macro foo.

  Ȯ ؽƮ ȿ ִ `foo' Ȯ ʴ´. װ ǥ  
  ̻ Ī ƴϴ. 

4.3 ũο Ư 

  Ȱȭ   ü ڿ   ִ Ư ǥ ִ. 

  ũ ȣ⿡ Ȱȭ    Ȯ ؽƮ  $#   
 ִ. ׷, ũδ       ִ.

    define(`nargs', `$#')
    =>
    nargs
    =>0
    nargs()
    =>1
    nargs(arg1, arg2, arg3)
    =>3

  $* ǥ Ȯ ؽƮ  Ȱȭ  ڸ   ֵ 
.   ǥ , ̿ ǥ ´.  

    define(`echo', `$*')
    =>
    echo (arg1,    arg2, arg3  ,  arg4)
    =>arg1,arg2,arg3  , arg4

  (: µ ڵ  鿡 ϶.)
  
    ڰ ǥ ó ʿ伺 ִٸ $@ ǥ װ 
Ѵ. ̰  ڸ ǥ óѴٴ  ͸ ϸ $*  . 
  ϳ .

    define(`echo', `$@')
    =>
    echo(arg1,    arg2, arg3 , arg4)
    =>arg1,arg2,arg3 ,arg4

     ؾ  ϴ°?  ̰͵ Ȯ ؽƮ m4 
    .   .

    define(`echo1', `$*')
    =>
    define(`echo2', `$@')
    =>
    define(`foo', `This is macro `foo'.')
    =>
    echo1(foo)
    =>This is macro This is macro foo..
    echo2(foo)
    =>This is macro foo.

  ذ ߵ ʴ ٸ, [Trace] κ .

  Ȯ ؽƮ `$' ȣ  ƹ͵  ʴ´ٸ,  m4 ̰
  ٸ ؽƮó ũ Ȯ Ѵ.  
  
    define(`foo', `$$$ hello $$$')
    =>
    foo
    =>$$$ hello $$$

  `$12'    ũη Ȯϱ⸦ ٶٸ,  $  ѽ 
ǥ ָ ȴ. ̰ m4  Ͽ $ ȣ ڸ  ʵ Ѵ.

4.4 ũ 
 
  ϳ ũ Ǵ undefine   ִ.

    undefine(name)

  name  ũ Ī̴. ũ  Ī  ǥ ѷδ  
ʿ , ׷  Ȯ ̴.

  undefine  Ȯ  ʴ´.

    foo
    =>foo
    define(`foo', `expansion text')
    =>
    foo
    =>expansion text
    undefine(`foo')
    =>
    foo
    =>foo
 
  Ī ƹ  ũ ǵ  ʴ´ٸ  óǰ  undefine 
ƹ ϵ  ʴ´. 

  undefine ũδ ڰ   νĵȴ. 

4.5  ũ Ī ϱ

  ̹ ǵ ũδ   Ī    ִ.  ũ defn   ̷ 
 Ѵ.

    defin(name)

  ̰ ǥ   name  Ƿ Ȯȴ. ڰ  ǵ ũΰ 
϶ Ȯ  ʴ´.

  name     ũζ,  ǥ ִ Ǵ  ϰ ǥִ 
Ȯ ؽƮ  ȴ. name    ̶  Ȯ Ǿ  ִ  
Ǹ Ű Ư ū ȴ.  ū define ̳ pushdef   ° 
ڷμ ǹ̰ ְ ٸ ƿ ȴٸ õȴ.

  ϱ⿡      ̴. Ʒ undefine  zap
 ٲٴ  ش.

    define(`zap', defn(`undefine'))
    =>
    zap(`undefine')
    =>
    undefine(`zap')
    =>undefine(zap)

    defn  ũ ǳ   ũ Ǹ ϴ 
   ִ.   ũΰ ŵǾ  ٸ ̸   
   ִ.

  defn ũδ ڰ   νĵȴ.

4.6 ӽ÷ ٽ ϴ ũ

  ũθ ӽ÷ ٽ   ִ. ߿   ص · ǵ 
  ִ.
̷  ϴ   ũ pushdef  popdef ̴.

    pushdef(name [, expansion])
    popdef(name)

  ̰ define   undefine   ϴ.  ũδ  ð 
 ۵Ѵ.  ϳ ũδ pushdef  Ͽ ӽ÷     ִ. 
pushdef  ̹  ϴ ̸ Ǹ ٸ   ġȯϸ ο Ǹ 
ϱ   ǵ  Ѵ.  ǵ  ٸ, pushdef  
Ȯϰ define  .

   ϳ ũΰ  Ǹ  ִٰ  . 翬   
ϳ Ǹ     ̴.   Ǵ popdef    
 ִ.  ǵ  ٸ popdef  undefine  .

    define(`foo', `Expansion one.')
    =>
    foo
    =>Expansion one.
    pushdef(`foo', `Expansion two.')
    =>
    foo
    =>Expansion two.
    popdef(`foo')
    =>
    foo
    =>Expansion one.
    popdef(`foo')
    =>
    foo
    =>foo

   ǵ ϳ  ũΰ define  ǵȴٸ, ֻ Ǵ 
ο Ƿ ġȴ.  undefine  Ѵٸ, ֻ ϳ ƴ   
ǰ  ̴.

    define(`foo', `Expansion one.')
    =>
    foo
    =>Expansion one.
    pushdef(`foo', `Expansion two.')
    =>
    foo
    =>Expansion two.
    define(`foo', `second expansion two.')
    =>
    foo
    =>second expansion two.
    undefine(`foo')
    =>
    foo
    =>foo

   ũ pushdef  defn  ӽ÷ ϴ  ϴ. 

  pushdef  popdef ũδ ڰ   νĵȴ.


4.7  ũ ȣ

   ũδ indir   ȣ  ִ.

    indir(name, ...)

  ̰ ũ name  ȣ  װ   ڰ ǳ. ̰ 
   Ī ũ ȣ⿡ ȴ. define  ׷ Ī ǵ
  Ѵ.

    define(`$$internal$macro', `Internal macro (name `$0')')
    =>
    $$internal$macro
    =>$$internal$macro
    indir(`$$internal$macro')
    =>Internal macro (name $$internal$macro)

  ⿡    Ŀٶ ũ Ű  ̹ ǵ   
  ִٴ  ,  ׷ٰ 쿬 ȣǴ   ̴. װ͵
   ũ indirθ ȣ   ̴.

4.8   ũ ȣϱ

   ũδ builtin  Ͽ  ȣ  ִ.

    builtin(name, ...)

  ̰  ũ name  ȣϴ    ڰ ǳ. ̷ 
Ѵٸ name   ǿʹ ٸ Ǹ    ̴. 

  builtin ũδ ڰ   νĵȴ.


  
             5   , , 
  

  Ϲ ؽƮ Ȯ, ڸ  ũδ  Ƹ  
  ̴. ⿡ Ǵٸ ũθ Ȯϴ ͵ ִ. ̰͵ 
ÿ ȴ.    Ϲ ǹ ʿ ̴.   
  ͵    ̴.  ⼭     
ٴ, ƴϸ ־   ˻ϴ ͵ Ұ ̴.

5.1 ũ  ׽Ʈ

  m4    ٸ  ǹ  ϴ  ִ. ù ° ifdef 
.

    ifdef(name, string-1, opt string-2)

  ̰ ũΰ  ̹ ǰ Ǿ  ׷  ׽Ʈ ϴ  ̴. 
name   ǵ ũ  Ī̶ ifdef   string-1 Ȯǰ, ƴϸ 
string-2 Ȯȴ. string-2 Ѵٸ,  װ Ϲ Ģ   
ڿ ȴ. 

    ifdef(`foo', ``foo' is defined', ``foo' is not defined')
    =>foo is not defined
    define(`foo', `')
    =>
    ifdef(`foo', ``foo' is defined', ``foo' is not defined')
    =>foo is defined

  ifdef ũδ  ڰ   νĵȴ.

5.2 ڿ 
      
  ٸ  ϴ  ifelse ε, ̰ ξ  ϴ. ifelse   
 ٴ, Ǵ  Ϲ if-else      ְ  
   ִ. ̰  Ǵ   Ѵ.

    ifelse(comment)
    ifelse(string-1, string-2, equal, opt not-equal)
    ifelse(string-1, string-2, equal, ...)

  ϳ ڸ ifelse  Ѵٸ, ifelse    ڸ ϸ, ƹ 
µ  ʴ´. ̰ ּ ϴ    ϴ m4  
 ̴. dnl ϸ µǴ    ִ. ̷ Ư 
 GNU m4  νѴ.  쿡 ־  ڿ õ    
Ʈŵ ʴ´.

      ڷ ȣѴٸ ifelse  string-1 string-2   
(ڴ ) equal  Ȯǰ ٸ  not-equal  Ȯȴ.

    ifelse(foo, bar, `true')
    =>
    ifelse(foo, foo, `true')
    =>true
    ifelse(foo, bar, `true', `false')
    =>false
    ifelse(foo, foo, `true', `false')
    =>true

  ifelse      ڸ   ִ.    ڰ ־
ٸ ifelse  case   switch    α׷    
۵Ѵ. string-1 string-2 ٸ ifelse  equal  Ȯǰ ٸ  
ù   ڴ ǳʶٰ ٽ Ǯ Ѵ. ⿡   ִ.

    ifelse(foo, bar, `third', gnu, gnats, `sixth', `seventh')
    =>seventh
    
       ٴ        ̴. 
ifelse    پ   ũ  ϴ ̴.

  ifelse ũδ ڰ   νĵȴ.

5.3  

  m4     ʴ´.  ũδ    
ִ.  ǥ ܰ   .  ϵ ü  
ѵǴ  ϰ...

    α׷     ǹ ռ    
ִ.

  shift   ũΰ ִ   ̰ ũο Ȱȭ ڵ Ǯ
 ϴ  ȴ. 

    shift(...)

  ȣȿ   ڵ ü , ù  ° ڸ ϰ 
 Ȯȴ. Ȯ  ǥ ó   ǰ ǥ иȴ. 

    shift(bar)
    =>
    shift(foo, bar, baz)
    =>bar,baz

   ũδ shift    , ⼭     Ųٷ 
 ִ.

    define(`reverse', `ifelse($#, 0, , $#, 1, ``$1'',               
      `reverse(shift($@)), `$1'')')
    =>
    reverse
    =>
    reverse(foo)
    =>foo
    reverse(foo, bar, gnats, and gnus)
    =>and gnus, gnats, bar, foo

   ִ  ƴ,   shift  ifelse    
   ִٴ  ش. 

    ũ forloop   ϴ   .   ٿ 
 ̰  ڼ⸦ Ѵ. 

    forloop(`i', 1, 8, `i ')
    =>1 2 3 4 5 6 7 8 
    
  ڴ ʴ ݺ , ó  ,   , ȸ Ȯ ؽ
Ʈ ̴. ⿡  ũ i  ο ǵȴ.    Ŀ
    ״ Ѵ. 

  For-loop  Ǵٽ   ִ.  .. 

    forloop(`i', 1, 4, `forloop(`j', 1, 8, `(i, j) ')
    ')
    =>(1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) 
    =>(2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) 
    =>(3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) 
    =>(4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) 
    =>

  forloop ũδ  װü       ̴. 
׸ ó ȣϸ  ù °   Ǹ ϰ  ũ 
_forloop  ȣѴ. ׸  ù °  Ǹ Ѵ. 

  _forloop ũδ   4 ڷ Ȯϸ  ° ˾ƺ 
 ׽Ʈ  Ѵ.     ʾҴٸ    ̹ ǵ  ũ 
incr Ͽ ϳ Ű ٽ  ȴ. (incr  [Incr] κ
 .)

  ⿡ forloop    ũΰ ִ.

    define(`forloop',
          `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
    define(`_forloop',
          `$4`'ifelse($1, `$3', ,
          `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')

( : GNU m4 1.4  forloop  Ǿ  ʴ  δ. 
    ̿Ϸ m4   Ų ¿  _forloop κк  
define    forloop κ  ϸ   ִ.   
̱ ...)

  ǥ   Ͽ Ѵ.   ° ڸ ǥ  , 
 װ ü   ִ.   ° ڰ  ǥ   ˷, 
ǥ     Ͼ  캸 ȴ. 

  ,     ũθ 캸Ҵ. Ƹ ׷ ̰δ Ϲ
 뿡     ̴.   ΰ ũο ۰ 
ᰪ Ŭ , ù ° ڰ Ī  ƴ϶ ϴ  ⺻
  óϴ κ  ̾ϴ. ̷    ٷ ϴ  
   ܵд.


  
          6  ũο ԷµǴ   ϴ 
  

  m4  ũθ ۼ ,   κе  ǵ  ȴٰ 
 .    α׷  ׷ .. ׷ m4 
  뿡   ִ ũθ Ѵ.

6.1 ũ Ǹ 

  ũ Ī  ȮǴ   Ǹ  ũ dumpdef  
Ͽ   ִ.

    dumpdef(...)

     . ƹ ڷ  ȣѴٸ, װ  ˷
 ִ   Ī Ǹ    ̴. ٸ  ־ ڿ   
Ǹ ش.  ٷ ǥ    ´. 

  dumpdef  Ȯ ʴ´.

    define(`foo', `Hello world.')
    =>
    dumpdef(`foo')
    error=>foo:    Hello world.

    dumpdef(`define')
    error=>define: <define>
    =>

     ũ Ǹ ִ  ش. 

  ޽ ϴ ڼ  [Debug Levels] κ ϶.

6.2  ũ ȣ ϱ

  ũο ȣ ȮǴ    ũ traceon  traceoff   
   ִ. 

    traceon(...)
    traceoff(...)

  ƹ ڵ  ȣѴٸ, traceon   traceoff  ǵ  ũο 
  ϰų   ̴. ڸ ־ ȣѴٸ  ش ũ
  ģ.

  traceon  traceoff  Ȯ ʴ´.

  ũΰ ǰ ִ ¿ ȣǰ ڸ Ѵٸ  ȣ ޽
    ִ. ũ ȣ ȮǴ ̶ ȣ   Ŀ ش.  
 ǥؿ ٷ . 

    define(`foo', `Hello world.')
    =>
    define(`echo', `$@')
    =>
    traceon(`foo', `echo')
    =>
    foo
    error=>m4trace: -1- foo -> `Hello World.'
    =>Hello World.
    echo(gnus, and gnats)
    error=>m4trace: -1- echo(`gnus', `and gnats') -> ``gnus', `and gnats''
    =>gnus, and gnats
  
  (: m4   ⺻δ   ޽  ʴ´.   
           ɼ   Ѵ. )

  ٹ(-)  ڴ ȮǴ ܰ  ̸ Ÿ. ̰  
 쿡 ϳε ϴ.  ׷ ڰ, ǥ   ũ 
ȣ      ִ. 

   ϴ  ڼ  [Debug Levels] κ ϶.

6.3   ϱ 

  m4  '-d' ɼ ũθ   Ǵ   Ѵ. 

  Ʒ flag  ߿ ϳ ̻ ɼ   ִ.

  t   m4  ȣ    ũ ȣ Ѵ.
  a    ũ ȣ⿡ Ȱȭ Ǵ ڸ ش. `t' ɼǰ  
       쿡  ũ ȣ⿡ ǰ ƴϸ traceon   
       ũο ȴ. 
  e   ȮǴ  ũζ  ũ ȮǴ  ش. `t' ɼ  
      Ǿٸ  ũ ȣ⿡ ǰ, ƴϸ traceon   
      ũο ȴ. 
  q    ο뱸   Ȱȭ ڿ ũ Ȯ οȣ ѷ
      Ѵ.
  c     ũ ȣ   ش. ù °   ũ
      ΰ   ְ,  °  ڰ  , ° ȣ 
      Ϸ Ŀ ش.
  x   traceon    µǴ  ٿ  'ũ ȣ ̵' 
      ش. ̰   'c' ÷׿ Բ ϸ ϴ. 
  f    Ǵ  ٿ  Է  ̸ δ.
  l    Ǵ  ٿ  ٹȣ δ.
  p       ˻ ˰  ߰ߵȴٸ Ȱȭ ̸
       Ѵ. 
      ( Ȱȭ  ̸ ϴ  [Search Path] κ . )
  i    Է  ٲ    ̸ Է  ȣ  ޽ 
      Ѵ.
  V      ÷  ϰ ش.

  '-d' ɼǰ Բ  ƹ ÷׵  ʾҴٸ, ⺻ 'aeq'   ȴ. 
     ⺻ ÷װ õǾ ִٰ ߴ.  

   ũ debugmode   µǴ    ϴ  ȯ 
 Ѵ.

    debugmode(opt flags)

  ⼭ flags     κ    ִ. Ư 쿡 
ڰ '+' Ѵٸ  ÷״    ÷׿ ߰ȴ. ׸ 
'-' Ѵٸ  ÷״ ŵȴ. ƹ ڵ ٸ,   ÷״ 
ƹ͵  ʰ  ȴ. ('-d' ɼ   ó  ȴ.) ׸ 
 ڴ ÷׸ ⺻ 缳ϰ ȴ.

6.4   ϱ

      '-o' ɼ Ͽ Ϸ ̷Ʈ    
. Ǵ  ũ debugfile  Ͽ   ִ.

    debugfile(opt filename)

  ̰     ޽   filename  .  filename 
  ٸ,   ޽ ҵǰ debugfile  ƹ ڵ 
 ȣǾٸ,   ޽ ǥؿ .


  
                  7  Է 
  

   忡 پ  ũθ Ͽ Է ϴ  ϰڴ.

7.1  Է¿ 鹮 ϱ

   ũ dnl    ڸ о鿩  ع ù °  
ڸ Ѵ.

    dnl

  dnl   Ʒ  define ȣ  ڸ ϱ ؼ 
 Ѵ.

    define(`foo', `Macro `foo'.')dnl A very simple macro, indeed.
    foo
    =>Macro foo.

  dnl   ڵ   ڰ ҵȴ. ̰ ġ ּ 
ϴ Ͱ ϴ.  ( [Comments] κ ϶.)

  , dnl    ̳  ٸ 鹮   ٷ ´. GNU 
m4   dnl  ȣ   ´ٸ ޽  ߼Ѵ.  쿡 
dnl    ڵ Ͽ ó ̰, ĪǴ  ݴ°ȣ ã 
. dnl  µ  ʴ´. dnl  ݴ ȣ     ڰ 
    ̴.

7.2 ο  ٲٱ

  ⺻ ο빮ڴ changequote  Ͽ ٲ  ִ.

    changequote(opt start, opt end)

  ⿡ start  ο뱸  ˸ ο  ̰ end    
˸ ̴.   ڰ ų ߸Ǿٸ ⺻ (`   ') 
. 

    changequote  Ȯ ʴ´.

    changequote([,])
    =>
    define([foo], [Macro [foo].])
    =>
    foo
    =>Macro foo.

  ο빮ڷ ϳ ڰ   ʴٸ   ڿ ص 
ȴ.

    changequote([[, ]])
    =>
    define([[foo]], [[Macro [[[foo]]].]])
    =>
    foo
    =>Macro [foo].

  ο빮ڸ  ڿ  Ѵٸ ο ī    , ؽ
Ʈ ο  .

    define(`foo', `Macro `FOO'.')
    =>
    changequote(, )
    =>
    foo
    =>Macro `FOO'.
    `foo'
    =>`Macro `FOO'.'

  m4   ο빮ڿ ġ ʴ  ϴ ڿ ο 
 .  ο빮ڸ changequote  ϴ 츦 Ѵٸ...

  ο  ۹ڸ  `_'(ٹ)   ƾ Ѵ. ׷  Է
 Ī     ̴. ̰ δ ο ī  Ұ
     ˾ƾ Ѵ.

7.3 ּ  ϱ 

  ⺻ ּ ڴ  ũ  changecom  Ͽ   
.

    changecom(opt start, opt end)

  start  ο ּ   ڿ̰ end   ̴. ڸ 
 ʴ´ٸ ⺻ ּ ڷ #    ڰ ȴ. ּ 
 ̿  .

  changecom  Ȯ ʴ´.

    define(`comment', `COMMENT')
    =>
    # A normal comment
    =># A normal comment
    changecom(`/*', `*/')
    =>
    # Not a comment anymore
    =># Not a COMMENT anymore
    But: /* This is a comment now */ while this is not a comment
    =>But: /* This is a comment now */ while this is not a COMMENT

  ּȿ ִ ο ڿ ּ óǾ  ״  ȴ. 
 ּ ؽƮ Ȯϰ  ּ   ο빮ڷ 
.

  changecom  ƹ    ȣѴٸ ּ ī  Ұ 
 ȴ.

    define(`comment', `COMMENT')
    =>
    changecom
    =>    
    # Not a comment anymore
    =># Not a COMMENT anymore

7.4  ܾ  ٲٱ

  changeword    ̴.    GNU m4      
configure ũƮ  --enable-changeword ɼ μ  밡
.   ǰų   ̷  ̴. changeword  
 . 

 (:  ýۿ  ҽ  ٰ     
           Ƹ changeword  ۵  ̴. )

   m4  ؼ ó   װ ο ڿ, ܾ( ũ
 ̸),  ū(׿ ٸ ϳ ) иȴ. ܾ   
ǥ ǵȴ. 
  
    [_a-zA-Z][_a-zA-Z0-9]*

  changeword  Ѵٸ  ̷  ǥ ٲ  ִ.  ƺ 
 m4  ֱĢ ڷ   ϴ     
. 

    changeword(`[_a-zA-Z0-9]+')
    define(1, 0)
    =>1

  ֱĢ ̴   ״   ϴ. ֳϸ ĩϸ   
ũθ       𸣱 ̴.  쿬ϰ   ũ
 ȣϰ Ǵ    ִ.  , 

    define(`_indir', defn(`indir'))
    changeword(`_[_a-zA-Z0-9]*')
    esyscmd(foo)
    _indir(`esyscmd', `ls')

  m4  Ѳ ܾ ڷ   , changeword  ǳ 
ǥĿ  ִ.   е ýۿ  ǥ `foo'  
  Ѵٸ `f' `fo'  Ǿ Ѵ. 

  changeword  Ǵٸ    ִ. ǥ  ǥ ȣ
   Ѵٸ, ̰ ó ýƮ  ٱ ɺ ã ҵ
. ׷..

    changecom(`/*', `*/')
    changeword(`#\([_a-zA-Z0-9]*\)')
    #esyscmd(ls)

  m4     ũ ȣ  '#' ǥø ϵ 䱸Ѵ. ׷  
 m4 , ޾Ƶ鿩 ɵ shift    ó  ũƮ  
 ִ. ̷ Ͽ  ؽƮ  پ Ǵ ܾ Ҿ   
̴. 

  TEX    ū   Ѵٸ  m4  ũ  ġȯ  ؽƮ   Ѵ. 
changeword  ̷      ִ.  ٸ TEX 
 m4  Ȱ 翬Ǵ   ְڴ. , TEX ...

    \def\a{\message{Hello}}
    \catcode`\@=0
    \catcode`\\=12
    =>@a
    =>@bye

   m4 ...

    define(a, `errprint(`Hello')')
    changeword(`@\([_a-zA-Z0-9]*\)')
    =>@a

  TEX  , ù °  a ũΰ `Hello' ޽ ϵ 
Ͽ.  °   @  \ ſ ̽  ڷ ϰ   
ֵ Ͽ.  °  \   ̽ ڰ ƴ Ϲ 
  ڷ Ͽ.  °  ũ a ҷ̴ ̴. 
 TEX   Ͽ   `Hello' ޽  ̴. 

   m4    Ѵٸ `errprint(Hello)'   ̴.   
TEX  ũΰ ǵǾ  ǵ ũ  м ϱ ̴. 
m4  ؽƮ ϰ,  м ũΰ   Ѵ.

  changeword  ϸ m4   7 ο ؼ õõ ٿǾ   
 .

7.5 Է ϱ

  m4   Է   ؽƮ ϴ  ϴ. 
Ʈ ǰ,   Է  Ǿ   ٽ о̴  ϴ. 
 Ư¡  Ḧ ϱ  ӽ  شٴ ϴ û ۾ 
ʱȭ ϴ  ȴ. 

  Է ؽƮ Ϸ,  ũ m4wrap ϸ ȴ.

    m4wrap(string, ...)

  string   ڴ   ҿ ǰ, Է  á  ٽ 
. 

    define(`cleanup', `This is the `cleanup' actions.
    ')
    =>
    m4wrap(`cleanup')
    =>
    This is the first and last normal input line.
    =>This is the first and last normal input line.
    ^D
    =>This is the cleanup actions.

   Է  Է  , m4   ϱ ؼ m4exit  
   ٽ . 

   ؽƮ m4wrap  ȣϴ  ϱ ,  ؽƮ
 ٽ  о̴  ǵ ʾҴ.  m4wrap    
ʴ´ٸ,  ؽƮ    ݴ   (LIFO-last in, 
first out).
     

  
        8  
  

  m4  Է߿  ġ Ư    ִ.

8.1  ϱ

  m4  ϴ  ũδ 2 ִ.

    include(filename)
    sinclude(filename)

  Ѵ filename   оδ.    ٴٶٸ Է  
 ԷϷ ȴ. 

  include  sinclude  Ȯ  filename    ȴ.

   include ϴ      . ޽ 
  sinclude ϶.   Ѵٸ  Ȯǰ ׷  
͵ Ȯ ʴ´.

    include(`no-such-file')
    =>
    error=>30.include:2: m4:Cannot open no-such-file: No such file ordirectory
    sinclude(`no-such-file')
    =>

  `incl.m4'     ִٰ .   

    Include file start
    foo
    Include file end

    ϴ       Է Ʈ 
ϴ ̴.    ϳ ũ ȣ Ȯ ̴.

    define(`foo', `FOO')
    =>
    include(`incl.m4')
    =>Include file start
    =>FOO
    =>Include file end
    =>

  , include  sinclude     ȮǴ , ̰   
ü ũθ  ϱ ؼ  Ѵ. , ⿡  `bar' 
`incl.m4' Ȯȴ.

    define(`bar', include(`incl.m4'))
    =>
    This is `bar':  >>>bar<<<
    =>This is bar:  >>>Include file start
    =>foo
    =>Include file end
    =><<<
  
  ̷ include    ο빮ڿ, ǥ,  ȣ   ִ 
ŭ ġ ʴ. δ m4  м ۾ ϴ  ذ   ִ 
̴.

   ũ include  sinclude  ڰ   νĵȴ.

8.2   ˻ϱ

  GNU m4    丮 ƴ ٸ 丮    ã
  Ѵ.

   ̸ θ  ʰ,   ۾丮  ʴ´
,  Ư н ˻Ѵ. , ࿡ '-I' ɼ   
ã´.  °, 'M4PATH'  ȯ溯 Ǿ ִٸ   ˻ 
̴. 'M4PATH'    ݷ е 丮 Ʈ ϴ 
̴. (: BASH  ϰ...)

   Խ ڵ ˻   ߻Ѵٸ, 'p'  ÷׷ ̷ 
   ִ    ִ. (  [Debug Levels] κ 
.)


  
           9   ȯϱ,  
  

  ȯ(Diversion) ӽ÷     ִ   ش.  m4  
  ӽ Ϸ  ȯ  ִ. ׸  Ʈ  ٽ 
   ִ. ߿ ȯ ǵ  ִ.

  ȣٿ ȯ 0  Ʒ. ȯ ȣ  0   Ʈ
̴. ÿ ϴ ȯ ȣ װ ϴ   Ǵ ޸𸮿  
ѵȴ. ׷  GNU m4   ȯ ޸𸮿 Ϸ Ѵ. ׷ 
ü  ȯ ٷ⿡  ޸   Ǿ ִ (
 512K). ִġ Ѿ   ӽ   ū ȯ ޸
 ޴´. ٸ ȯ    ޸𸮴 Ӱ ȴ. ׷ ̰ ̷
 ȯ      ڿ   ȴ. 

9.1  ȯϱ

  divert  Ͽ ȯ  ִ.

    divert(opt number)

  number  ȯϴ  Ǵ ȣ̴.   ȣ ٸ 0 ȴ.  

  divert  Ȯ ʴ´.

  m4   Է ó ,  ϴ ȯ ڵ ȣ 
 ƿ´. 

    divert(1)
    This text is diverted.
    divert
    =>
    This text is not diverted.
    =>This text is not diverted.
    ^D
    =>
    =>This text is diverted.

    ڸ   divert  ȣ   ȯ ؽƮ 
 ʴ´.   ̴.      ʴ ȯ ȯ
ٸ װ  ҵȴ.  ̰ ġ ʴ  Ÿ ʰ  ϴ  
   ִ. ġ ʴ     ũ Ƕ   
ٴ   ̴. ⿡ װ ϴ  ִ.

    divert(-1)
    define(`foo', `Macro `foo'.')
    define(`bar', `Macro `bar'.')
    divert
    =>

  ̰ m4   α׷ ̴.

9.2   ǵ  (Undivering output)

  ȯ ؽƮ   ũ undivert  Ͽ     
.

    undivert(opt number, ...)

  ǵ ȯ ־   ڷ ־ Ѵ. ڰ   
 ȯ  ͵ ȣ  ǵ. 

    divert(1)
    This text is diverted.
    divert
    =>
    This text is not diverted.
    =>This text is not diverted.
    undivert(1)
    =>
    =>This text is diverted.
    =>

   ΰ  ο ϶. ϳ undivert  ؼ Ÿ 
 ϳ  divert  ؼ Ÿ ̴. ȯ  ̿Ͱ 
  ۵ȴ. 

  ȯ ؽƮ ǵ , װ m4  ٽ  ʴ´.   
    ̴. ׷Ƿ ǵ ٽ ȯϴ  
 ƴϴ. ȯ ǵ ٸ, ȯ ؽƮ ҵǰ ̰ ̻ Ų
 ȯŰ  Ұϴ. 

    divert(1)
    This text is diverted first.
    divert(0)undivert(1)dnl
    =>
    =>This text is diverted first.
    undivert(1)
    =>
    divert(1)
    This text is also diverted but not appended.
    divert(0)undivert(1)dnl
    =>
    =>This text is also diverted but not appended.

   ȯ ٽ ǵ õ  ȴ.
  GNU m4  ǵ  ִ. ڷ  ڰ ƴ  ̸ ָ, 
 Ǹ, ؼ ʴ´. ̰ ϴ  ռ ̾߱ 
ũ include ̴ ([Include] κ ϶).   ϱ ؼ,
 `foo'  ܾ `bar' ϰ ִٰ .

    define(`bar', `BAR')
    =>
    undivert(`foo')
    =>bar
    =>
    include(`foo')
    =>BAR
    =>

9.3 ȯ  (Diversion numbers)

   ũ divnum  ִ.

    divnum

  ̰  ȯڷ Ȯȴ.

    Initial divnum
    =>Initial 0
    divert(1)
    Diversion one: divnum
    divert(2)
    Diversion two: divnum
    divert
    =>
    ^D
    =>
    =>Diversion one: 1
    =>
    =>Diversion two: 2

  ڰ   divert ȣ ʿ. ǵ ؽƮ ٸ 쿡
 ڽſԷ ȯ ̴. 
  
9.4 ȯ ؽƮ ϱ

   ȯ , ȯ ؽƮ Ȱȭ ʿ䰡  ̴. 
Է         ȯ    Ʈ 
´.   ϳ ȯ ϴ  ʿ.  ȯȰ͵ 
ϰ ʹٸ,    m4  `divert(-1)' Է  ˸ ٷ
 Ȯϰ `undivert'  ִ ̴.

    divert(1)
    Diversion one: divnum
    divert(2)
    Diversion two: divnum
    divert(-1)
    undivert
    ^D

  ƹ µ   ̴. 
  شϴ ȯ Ͽ Ŭϴ  ߷ ũθ ϸ ϴ. 

    define(`cleardivert',
    `pushdef(`_num',divnum)divert(-1)undivert($@)divert(_num)popdef(`_num')')
    =>

  ̿ undivert  ȣϴ ,   ڷ ־ ȯ Ŭϰ 
ȴ. (  ũο  װ ϳ ִ! װ е ĺ.)


  
             10  óϴ ũ 
  

  m4  پ    óϴ  ũΰ ִ. ,  ڿ
߿ Ϻκи ̾Ƴٴ, Ǵ ˻Ѵٴ, ġѴٴ ϴ  
 ִ.

10.1 ڿ ̸ 

  ڿ ̴ len   ִ.

    len(string)

  ̰ ڿ (10) Ȯȴ.

    len()
    =>0
    len(`abcdef')
    =>6

    ũ len   ڰ   νĵȴ.

10.2 ڿ ӿ Ư ڿ ã 

  ڿ ӿ Ưڿ ġ index ã  ִ.

    index(string, substring)

  ̰ string substring  ó Ÿ ε Ȯȴ. string
  ù ε  0̴. substring  string ȿ Ÿ ʴ´ٸ 
index  `-1'  Ȯȴ.
  
    index(`gnus, gnats, and armadillos', `nat')
    =>7
    index(`gnus, gnats, and armadillos', `dag')
    =>-1

  ũ index  ڰ   νĵȴ.

10.3 ǥ ˻ϱ

  ǥ ˻  ũ regexp    ִ.

    regexp(string, regexp, opt replacement)

  ̰ string  regexp  ˻Ѵ. ǥ GNU Emacs   
ϴ. ڼ  GNU Emacs Manual  "Syntax of Regular Expressions" 
 ϶.

  replacement  ȴٸ, regexp   ڿ regexp  ù °  ġ
ϴ ε Ȯȴ. ڿ ġϴ regexp  ã ߴٸ -1 Ȯ
ȴ.

    regexp(`GNUs not Unix', `\<[a-z]\w+')
    =>5
    regexp(`GNUs not Unix', `\<Q\w*')
    =>-1

  replacement   ִٸ, regexp   Ȯ replacement   Ѵ.  regexp  
regexp  N° ǥİ ġϴ ؽƮ   `\n' ġȴ. `\&' 
 ġϴ ǥ ü ȴ. 

    regexp(`GNUs not Unix', `\w\(\w+\)$', `*** \& *** \1 ***')
    =>*** Unix *** nix ***

   ũ regexp   ڰ   νĵȴ.

10.4  ڿ Ư ڿ ̱

  ڿ߿ Ư κ ڿ substr  ̾Ƴ  ִ.

    substr(string, from, opt lenth)

  ̰ string   κ ڿ Ȯȴ. string  from  ε 
Ͽ length ̸ŭ ̰ų length  Ǿٸ string   ȴ. 
ϳ ڿ  ε ׻ 0̴.

    substr(`gnus, gnats, and armadillos', 6)
    =>gnats, and armadillos
    substr(`gnus, gnats, and armadillos', 6, 5)
    =>gnats

   ũ substr  ڰ   νĵȴ.

10.5 ڸ ȯϱ

  ڸ ȯϴ  translit  Ѵ.

    translit(string, chars, replacement)

  ̰ string  chars   ִ ڿ  ε replacement ڿ 
üϿ ȯѴ.
  
   replacement   chars  ªٸ, ʰϴ ڴ Ȯ忡  . 
replacement  Ǿٸ,  string  chars  Ÿ   ڵ Ȯ
忡 ŵȴ.

  chars   replacement Ѵ ڹ     ִ. `a-z'( ҹ), 
`0-9'( 10).. chars  replacement  ٹ(`-') ϳ Ϲݹ
ڷ Ϸ ó̳  ġѾ Ѵ. 

       ó       ƴϴ.  
쿡   Ųٷ  ̴. `9-0'  `9876543210'  ǹѴ. 

    translit(`GNUs not Unix', `A-Z')
    =>s not nix
    translit(`GNUs not Unix', `a-z', `A-Z')
    =>GNUS NOT UNIX
    translit(`GNUs not Unix', `A-Z', `z-a')
    =>tmfs not fnix

  ù °    빮ڸ ϴ ̰,  ° ȯ  ҹڸ 빮
ڷ ٲٴ ̸,  °  빮ڸ  Ųٷ  ҹڷ ȯ 
̴. ó      δ.

   ũ translit  ڰ  쿡 νĵȴ.

10.6 ǥ ؽƮ ġϱ

  ڿ ü ġ patsubst Ѵ.

    patsubst(string, regexp, opt replacement)

  ̰ string  regexp  ġϴ  ִ  ˻Ѵ. ׷ 
 ġϴ  replacement  ġѴ. ǥ  GNU Emacs 
 .

  string  regexp  ġ  ʴ κ ״ Ǹ鼭 Ȯȴ. 
ġϴ  ߰ߵǸ,   ˻  ġߴ κк ȴ. 
 string  ϳ ڴ   ġ ʴ´. regexp  ڿ 1
̻ ̸ŭ ġ  ʴ´ٸ, ˻ ġ  ݺ  ϱ 
 ϳ Ѵ. 

  replacement   ִٸ, regexp   Ȯ replacement   Ѵ.  regexp  
regexp  N° ǥİ ġϴ ؽƮ   `\n' ġȴ. `\&' 
 ġϴ ǥ ü ȴ. 

  replacement ڰ ȴٸ regexp  ġϴ ؽƮ ȴ.

    patsubst(`GNUs not Unix', `^', `OBS: ')
    =>OBS: GNUs not Unix
    patsubst(`GNUs not Unix', `\<', `OBS: ')
    =>OBS: GNUs OBS: not OBS: Unix
    patsubst(`GNUs not Unix', `\w*', `(\&)')
    =>(GNUs)() (not)() (Unix)
    patsubst(`GNUs not Unix', `\w+', `(\&)')
    =>(GNUs) (not) (Unix)
    patsubst(`GNUs not Unix', `[A-Z][a-z]+')
    =>GN not

         . ̰    ܾ ü    ũ 
upcase  downcase  Ͽ ڿ ġϴ ũθ ȣϴ ̴.

    define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl
    define(`downcase', `translit(`$*', `A-Z', `a-z')')dnl
    define(`capitalize1',
          `regexp(`$1', `^\(\w\)\(\w*\)', `upcase(`\1')`'downcase(`\2')')')dnl
    define(`capitalize',
          `patsubst(`$1', `\w+', `capitalize1(`\&')')')dnl
    capitalize(`GNUs not Unix')
    =>Gnus Not Unix

   ũ patsubst  ڰ   νĵȴ.

10.7 ȭ 

  ȭ  format    ִ.

    format(format-string, ...)

  ̰ C Լ  printf   ϴ. ó  ڴ ȭ ڿ̰, 
⿡ `%' Ưڰ ü ִ. format  ȭ ڿ Ȯȴ.

  ̰    ε  Ǹϰ Ǵ  캼  ִ.

    define(`foo', `The brown fox jumped over the lazy dog')
    =>
    format(`Ths string "%s" is %d characters long', foo, len(foo))
    =>Ths string "The brown fox jumped over the lazy dog" is 38 characters long

  forloop ũ Ǵ [Loops] κ .    format  ǥ  
    ش. 

    forloop(`i', 1, 10, `format(`%6d squared is %10d
    ', i, eval(i**2))')
    =>    1 squared is          1
    =>    2 squared is          4
    =>    3 squared is          9
    =>    4 squared is         16
    =>    5 squared is         25
    =>    6 squared is         36
    =>    7 squared is         49
    =>    8 squared is         64
    =>    9 squared is         81
    =>   10 squared is        100

  format  ũδ  ANSI C `printf' Լ  Ŀ  ȭ Ǿ, 
 `%' Ưڿ  `c', `s', `d', `o', `x',  `X', `u', `e', `E', `f'   
Ѵ. ̰  ʵ ̿ е,  ׸ `+', `-', ` ', `O', `#', 
`h', `l'    ڸ Ѵ.  ڼ  C ̺귯 Ŵ 
printf Լ κ .


  
          11     ũ
  

     m4    Ǿ  ̰ C   
ϴ. ϰ   ũη   굵    ִ.

11.1 ,  

       ũ incr  decr ϸ ȴ.

    incr(number)
    decr(number)

  ̰ number    ϳ ϰų  ڷ Ȯȴ.

    incr(4)
    =>5
    decr(7)
    =>6

  incr, decr  ũδ ڰ   νĵȴ.

11.2  ǥ  ϱ

   ǥ  eval    ִ.

    eval(expression, opt radix, opt width)

  ̰ ǥ  Ȯȴ.

  ǥ  ڸ    ִ. Ʒ   켱  
ͺ Ͽ.

  `-'
     Unary minus

`**'
     Exponentiation

`*  /  %'
     Multiplication, division and modulo

`+  -'
     Addition and subtraction

`<<  >>'
     Shift left or right

`==  !=  >  >=  <  <='
     Relational operators

`!'   
     Logical negation

`~'
     Bitwise negation

`&'
     Bitwise and

`^'
     Bitwise exclusive-or

`|'
     Bitwise or

`&&'
     Logical and

`||'
     Logical or

  ° ϰ  ڴ ʺ յȴ.

   m4   `^'  ° ϴ ڿ ȥ ϸ ٸ ͵
 `^'  Ʈ Ÿ    ϴ  ȴ. GNU m4  °  
`^'  Ͽ  ƮŸ   ϴ  Ѵ.  

  10  ξ  . `0' 8 Ÿ `0x' 16
 Ÿ, `0b' 2 Ÿ. `0r' 1 36  (radix)
 ǥϴ  Ѵ. ξ  ٷ  10ǥ̳ ݷ, 10
  ڰ ; Ѵ.   , 10 `0', `1', `2', ... 
`9' ̰ `9' Ѿ  `a', `b'... `z' ̴. ҹڿ  빮
  ȥϿ   ִ. 

  ȣ  ǥ    ʿϸ  ڴ ̸  1, 
̸ 0 Ѵ.

  ⿡ eval     ִ.

    eval(-3 * 5)
    =>-15
    eval(index(`Hello world', `llo') >= 0)
    =>1
    define(`square', `eval(($1)**2)')
    =>
    square(9)
    =>81
    square(square(5)+1)
    =>676
    define(`foo', `666')
    =>
    eval(`foo'/6)
    error=>51.eval:14: m4: Bad expression in eval: foo/6
    =>
    eval(foo/6)
    =>111

     °  , eval  ũ ̸  ʴ´.  
ũ ̸ մ ǥ Ȯǰų մ ǥ Ϻκ̶  
. ׷Ƿ  ũδ eval  Ѿ  ȮǾ Ѵ. 

  radix   õȴٸ װ Ȯ忡    ֵ ش   ٲ 
ڸ Ѵ. ⺻  10̴. eval   ׻  ȣ 
. width ڴ µ   ּ ̸ Ѵ.  䱸 ̸ 
0 ä. 

    eval(666, 10)
    =>666
    eval(666, 11)
    =>556
    eval(666, 6)
    =>3030
    eval(666, 6, 10)
    =>0000003030
    eval(-666, 6, 10)
    =>-000003030
 
   36 Ŭ ٴ  ϶. 

   ũ eval  ڰ ־߸ ν Ѵ.

 
  
            12  н  
  

  m4 ο н ɾ ϴ ణ  ũΰ غǾ ִ.

12.1    ϱ

    ɾ syscmd  Ͽ   ִ.

    syscmd(shell-command)

  ̰ ɾ shell-command  Ѵ.

  syscmd    Ȯ    shell-command      µ  ʴ´. 
shell-command κ ̳ ޽ m4     ʴ´. 
ɾ  óϰ ʹٸ [Esyscmd] κ . 

  ɾ     ߿  m4   ڽ ¹۸ ûعٴ 
̴. shell-command  ǥԷ, ǥ,  m4  װͰ 
. 

   ũ syscmd  ڰ ־߸ νĵȴ.

12.2    б

  н ɾ ϰ   μ   m4   о̱⸦ 
ٶٸ esyscmd  ϸ ȴ.
  
    esyscmd(shell-command)

  ̰ ɾ shell-command  ǥ ȮѴ. 

  ɾ      m4  ڽ  ۸ û ٴ 
̴. ⺻ shell-command  ǥԷ°   m4  װͰ 
ϴ. shell-command     ȮǴ  Ϻκ ƴϴ. װ  m4 
  Ÿ.

  е  ִ 丮 GNU m4   checks 丮 
. ׷..

    define(`vice', `esyscmd(grep Vice ../COPYING)')
    =>
    vice
    => Ty Coon, President of Vice
    =>

  esyscmd  Ȯ忡 ιڰ  ´ٴ  .

   ũ esyscmd  ڰ  쿡 νĵȴ.

12.3  ڵ

   ɾ  Ǿ  ˷ sysval  ϸ ȴ.

    sysval

  ̰ syscmd  esyscmd     ɾ  ڵ 
Ȯȴ.

    syscmd(`false')
    =>
    ifelse(sysval, 0, zero, non-zero)
    =>non-zero
    syscmd(`true')
    =>
    sysval
    =>0

12.4 ӽ ̸ 

  syscmd  esyscmd  õ     óϱ ؼ 
 ٸ    ӽ ʿ  𸥴.  ũ maketemp 
 ӽ   ̸ .

    maketemp(template)

  ̰ ڿ template   ٰ ؼ  ʴ  ̸  Ȯ
ȴ. ڿ κ `XXXXXX' Ǿ Ѵ.     `X'  
m4 μ  μ ̵ ϴ    ġǾ ̸ 
ϼ Ѵ.

    maketemp(`/tmp/fooXXXXXX')
    =>/tmp/fooa07346
    maketemp(`/tmp/fooXXXXXX')
    =>/tmp/fooa07346

      maketemp   ȣϴ    ڿ Ȯ
.     ȣ⶧   ʾҴٸ  ° ũ  ȣ 
 ̸ Ȯ ̴.

   ũ maketemp  ڰ   νĵȴ.


  
        13   ׿ ũε
  

  忡  忡   پ Լ ҰѴ.

13.1  ޽ 

  errprint  ϸ ϰ  ޽   ִ.

    errprint(message, ...)

  ̰ ϰ message  Ʈ ϰ  ڸ ǥؿ .

  errprint  Ȯ ʴ´.

    errprint(`Illegal arguments to forloop
    ')
    error=>Illegal arguments to forloop
    =>

  ܿ  ڵ   ʴ´.      
  Ϻκ ؾ Ѵ. (BSD m4   errprint ȣ
 ιڸ ߰Ѵ. )

   ġ ˷ֵ Ϸ    ƿƼ ϸ ȴ.

    __file__
    __line__

  ̰  Է ̸  Է¶ ȣ Ȯȴ.

    errprint(`m4:'__file__:__line__: `Input error
    ')
    error=>m4:56.errprint:2: Input error
    =>

13.2 m4 

  ü Է б  m4  ϴ  ʿϴٸ,  m4exit  ϸ 
ȴ.

    m4exit(opt code)

   ڵ带 code  ϰ m4  Ѵ. code  ٸ ڵ 0̴.

    define(`fatal_error', `errprint(`m4: '__file__: __line__`:fatal error: $*
    ')m4exit(1)')
    =>
    fatal_error(`This is a BAD one, buster')
    error=>m4: 57.m4exit: 5: fatal error: This is BAD one, buster

   ũΰ ȣǰ   m4   ڵ 1  ̴.  ũ
δ  Ḧ ֱ  ̴.    Ǵ ؽƮ 
Ѵٴ, undivert   divert  Ѵٴ ϴ  ν 
 ʾҴ ([M4wrap] κ ϶).


  
             14    ӵ εϱ
  

    ū m4  α׷ õ ⺻ ǿ ٸ  
ʱȭ ʿ   ִ. 

  ū α׷ Ǵ ⺻ ͵    Ź   ݺ
ٸ װ  ð . GNU m4   ϳ α׷ ۺκп 
̰ ⺻ ͵ Ͽ ӵ  ϴ ġ Ѵ. 
ڰ ݺ Ѵٰ غ. 

    m4 base.m4 input.m4

  base.m4     , input.m4       
.

    m4 -F base.m4f base.m4

  ó     Ű, Ŀ

    m4 -R base.m4f input.m4

  ̷    Ų. ó ȣ⿡ -F ɼ `base.m4' 
о Ѽ, پ  α׷ ũθ  ϰų ٸ ʱ
ȭ  Ѵ.      `base.m4'  ϰ óȴ.  GNU m4   
`base.m4f' frozen (: , ô  ̶ )  ϴ , ̰
 m4  λ¸  Ǽ  ϰ ִ.

   ȣ -R ɼ  ν m4 ޸  ¸ `base.m4f'
  ٽ ε   ִ. ٸ ϵ  о  ִ.   m4 
 ʱ ޸    ȿ ߰ Ŀ m4  Է о
 ̴.  츮 ,  ȿ  `base.m4' ϴ. ׷ frozen 
 ̰ͺ ξ ȿ  ģ.

  m4      ϳ frozen  ų о  ִ. 
  frozen   Ѳ óϴ  Ұϴ. ׷ frozen  
 ŵǾ Ͽٸ -R  -F ɼ ̿Ͽ  ÿ   ִ. 
 ٸ, ɽ   ٰ .

    m4 file1.m4 file2.m4 file3.m4 file4.m4

  ̰   ɰ  Ǵ Ͱ , µ ϴ. 

    m4 -F file1.m4f file1.m4
    m4 -R file1.m4f -F file2.m4f file2.m4
    m4 -R file2.m4f -F file3.m4f file3.m4
    m4 -R file3.m4f file4.m4

      ׵      ư  Ƿ 
 ǰ ʿϴ. Ưϰ (trace) Ӽ ũδ   changeword  
õǾ  ʴٸ    .   ȣ⿡ ̷  ɼ ȣ
   м  ̴. ׷ pushdef   ÿ ִ Ǵ 
ٸ ڵ  ִ. ׷  undefine ǰų ũη ̸ ٲ  
ο빮ڳ ּ ڿ Ѵ. 

  m4  frozen    ,   ۵ϴ ڵ ȯǵ 
(undiversion)  ȴ. ſ,  Ȯϰ  ȣ  ٿ   ȯ 
frozen Ϸ ȴ. Ȱȭ ȯȣ ۵ȴ.

  ٽ ε frozen    ۾丮 ־  ʿ . 
 include    Ȱ  θ ˻Ѵ. ([Search  Path] κ 
.)

  frozen    Űĸ  ǳʶپ   ϴ.  ϳ  ӽ 
frozen   ˾ƺ  ֵ ,  ٸ ӽ  m4   ϰų, 
GNU m4  ο   Ѵٸ װ о óϴ  ϴ. 
frozen     ؽƮ ̸,   ڷ Ǿ 
.   빮ڷ Ǿ   (NL) . ڰ ־
  ̳ # ڴ ּ .   õȴ. Ʒ 
, length ϴ ڿ ̴. ڴ 10 ǥѴ. ڵ 
 .

V number NL
               ȮѴ. number  1̾ Ѵ.
C length1 , length2 NL string1 string2 NL
             string1 string2  ּ ۰  ڿ Ѵ.
Q length1 , length2 NL string1 string2 NL
             string1 string2 ο뱸 ۰ ڿ Ѵ.   
F length1 , length2 NL string1 string2 NL
             string1  Ī string2 Լ pushdef  Ͽ  
              ȮѴ.
T length1 , length2 NL string1 string2 NL
             string1 ؽƮ string2  pushdef  Ͽ ϸ  ȮѴ.
D number, length NL string NL
               ȯ  ȯȣ  Ѵ.  ׸    ȯ 
             string  Ѵ.
              ʴ  ȯ number      ̴. ܼϰ 
             Ȱȭ ȣ Ѵٸ,  string  Ѵ. ȯȣ 0
             ̸  ڿ ε   ǥ  . ׷ 
              m4 ο  Ѵ.


  
            15    m4  ٸ  ȣȯ
  

  忡 m4 ٸ    Ѵ.  ߿  UNIX  
System V, Release 3 ַ ϰڴ.

  BSD m4 ͵ ټҰ  ִ. ̰ ⿡  ʴ´.

15.1 GNU m4  Ȯ 

  m4  1.4  System V       ִ. ̷
   ࿡ `-G' ɼ μ ٸ ɼǵ 
 ʴ    ִ.   
   
* ũ ڿ $N System V  ڸ  ϳ GNU 
m4  ڸ    ִ. GNU m4     
 ̾߱Ⱑ Ǹ  9θ ѵ ʴ´ٴ ̴̾߱. ([Arguments] κ
 .)

*     include  sinclude   丮 ߰ߵ ʴ´
 ڰ  ˻ ο ã Ǿ ִ. ˻δ `-I' ɼ 
ϰų `M4PATH'  ȯ溯 Ͽ    ִ. ([Search Path]  κ 
.)

* undivert  ڴ ڰ ƴ     ִ.  Ī ڷ 
ٸ     Ȯ  ʰ Ѱ. ([Undivert]  κ 
.)

* ȭ  ũ format  Ͽ   ִ. ̰ C ̺
 Լ printfĿ ȭ Ǿ. ([Format] κ .)

* regexp patsubst ؼ ˻ ؽƮ ġ ǥ  
. ([Regexp], [Patsubst] κ .)

* ɾ   esyscmd Ͽ m4 Ȯ  ִ.  ([Esyscmd] 
κ .)

*  builtin   Ͽ    ũε     ִ. 
([Builtin] κ .)

* ũδ indir  Ͽ  ȣ  ִ. ([Indir] κ .)

*  Է ̸   Է  ȣ  __file__  __line__
 Ͽ   ִ. ([Errprint] κ .)

* dumpdef     ° ũ  debugmode  ɼ 
Ͽ   ִ. ([Debug Levels] κ .)

*      debugfile Ͽ    ִ. ([Debug 
output] κ .)

   ǥ ߰ڸ, GNU  m4     ɼ 
 ִ.
      
    `-F', `-G', `-I', `-L', `-R', `-V', `-W', `-d', `-l', `-o', `-t'

    (ɼǿ ؼ ڼ ˷ [Invoking m4] κ .)

   GNU m4   ,  ġ  κ ٸ m4 麸    
о.

15.2 GNU m4   System V ġ

  System V  m4   GNU m4       ִ.

* System V m4  defn   ڸ Ѵ. GNU m4    
 .   ̰ ٸ   ̴. 

15.3 ٸ ȣȯ

  m4  ̿   ȣȯ κ  ִ. System V m4  
ؼ 캸.

* GNU m4  System V m4  ʹ ٸ, ؽƮ ȯ  sync  ٸ 
  ä.
  GNU m4   ؽƮ ȯ  sync ε ϰ,  System V m4  
  ؽƮ ȯ  Ųٷ  .    ̳  ̸ 
  ̹ ϴ  ؽƮ  ̰ų ȯ   ߻Ѵ. System V 
  m4  ȯ  ؽƮ undivert ȣ ϴ    ҽϿ   
  ɷ Ѵ. ݸ鿡 GNU m4  ȯ ؽƮ ȯ    
  Ѵ. 
   sync  ɼ m4  Ϸ ֿ켱 ó Ǳ⸦ 
  Ѵ.  ȯ   Ϸ  ߱Ѵٸ   ޽ Ƹ 
   κ װ ־   ƴ ȯ    ̱ 
  ̴. 

* GNU m4  ڵ  ǰ ġ   ʴ´.
    define(`x', `x')
    define(`x', `x ')
  ̰ `x'  `x'  ϴ ε   Ʋ  . 
   ߸ κ ִٸ װ ο (unquoted)  `x' Ȯ
  ٴ ̴. m4     ڿ   ؼ ũθ   
  ִ , 츮  ؼ ٸ α׷   ̰ 
    üũ Ѵ. 
    ifelse(defn(`holer'), `value', ...)
   쿡  ڽ ̸ ǵ ũθ ϴ   
  ̴. 

* GNU m4   `-G' ɼ  ʴ ٸ  ũ __gnu__   ڿ 
  Ȯ ̴.
  UNIX ýۿ,  GNU m4  `-G'  ɼ  ʴ ٸ  ̰ ũ 
  __unix__  ̰, ٸ   ũ unix   ̴. Ѵ  
  ڿ Ȯȴ.
 
[]
