m4

å称
     m4 — ãã¯ãè¨èªããã»ããµ

æ¸å¼
     m4 [-d flags] [-t name] [-gs] [-D name[=value]] [-U name] [-I dirname]
     [file ...]

解説
     m4 ã¦ã¼ãã£ãªãã£ã¯ããã¾ãã¾ãªè¨èª (ãã¨ãã° C, ratfor, fortran, lex, yacc
     ãªã©) ã®ããã³ãã¨ã³ãã¨ã㦠å©ç¨ã§ãããã¯ãããã»ããµã§ãã m4
     ã¦ã¼ãã£ãªãã£ã¯ãæ¨æºå¥åããèªã¿è¾¼ã¿ã¾ãã ã¾ããå¦ççµæã®ãã‐
     ã¹ããæ¨æºåºåã¸æ¸ãåºãã¾ãã

     ãã¯ãã®å¼ã³åºã㯠name(argument1[, argument2, ..., argumentN]) ã®
     å½¢å¼ãåã£ã¦ãã¾ãã

     ãã¯ãåã¨ããã«ç¶ãéãæ¬å¼§ (‘(’) ã¨ã®éã«ã¯ã¹ãã¼ã¹ããã£ã¦ã¯ããã¾ããã ãããã¯ã‐
     åã®ç´å¾ã«éãæ¬å¼§ãç¶ãã¦ããªããã°å¼æ°ãªãã®ãã¯ãå¼ã³åºãã¨ã㦠å¦çããã¾ãã

     ãã¯ãåã¨ãã¦åé ã¯ã¢ã«ãã¡ãããã¾ãã¯ã¢ã³ãã¹ã³ã¢ãã2 æåç®ä»¥é㯠è±æ°å‐
     ã¾ãã¯ã¢ã³ãã¹ã³ã¢ã使ãã¾ãã ãã£ã¦æ£ãããã¯ãåã«ãããããæ£è¦è¡¨ç¾ã¯
     “[a-zA-Z_][a-zA-Z0-9_]*” ã¨ãªãã¾ãã

     ãã¯ãã®å¼æ°ã®ãã¡ã§ãåé ã®ã¯ã©ã¼ãããã¦ããªã空ç½ãã¿ãã æ¹è¡æå (‘\n’)
     ã¯ç¡è¦ããã¾ãã æååãã¯ã©ã¼ãããããã«ã¯ãå·¦ãããã³å³ã·ã³ã°ã«ã¯ã©ã¼ãã使ç¨ã㦠ãã ãã
     (ä¾: ‘ this is a string with a leading space’) ã çµã¿è¾¼ã¿ãã¯ã
     changequote ã使ã£ã¦ã¯ã©ã¼ãæåãå¤æ´ãããã¨ãã§ãã¾ãã

     大æµã®çµã¿è¾¼ã¿ãã¯ãã¯ãå¼æ°ããªãã¨æå³ããªãã¾ããã®ã§ã
     éãæ¬å¼§ãå¾ã«ç¶ããªãå ´åãç¹å¥ã®ãã®ã¨ãã¦èªèããã¾ããã

     ãªãã·ã§ã³ã¯ä»¥ä¸ã®éãã§ã:

     -s      cpp(1) ç¨ã«ã #line ãã£ã¬ã¯ãã£ããåºåãã¾ãã

     -D name[=value]
             ã·ã³ãã« name ã®å¤ã value (ç¡æå®æ㯠NULL) ã¨å®ç¾©ãã¾ãã

     -U name
             ã·ã³ãã« name ãæªå®ç¾©ã«ãã¾ãã

     -I dirname
             include ãã¹ã« ãã£ã¬ã¯ã㪠dirname ã追å ãã¾ãã

     -d flags
             ãã¬ã¼ã¹ãã©ã°ãã»ãããã¾ãã flags å¼æ°ã¯ã以ä¸ã®éãã§ã:

             a       ãã¯ãã®å¼æ°ã表示ãã¾ãã
             c       ãã¯ãã®å±éãè¤æ°è¡ã§è¡¨ç¤ºãã¾ãã
             e       ãã¯ãã®å±éçµæã表示ãã¾ãã
             f       ãã¡ã¤ã«åã®å ´æã表示ãã¾ãã
             l       è¡æ°ã表示ãã¾ãã
             q       å¼æ°ã¨ç¾å¨ã®ã¯ã©ã¼ãã®çµæãå¼ç¨ãã¾ãã
             t       ãã¹ã¦ã®ãã¯ãããã¬ã¼ã¹ãã¾ãã
             x       ãã¯ããå±éããæã«çªå·ãä»ãã¾ãã
             V       ãã¹ã¦ã®ãªãã·ã§ã³ãã©ã°ããªã³ã«ãã¾ãã

             ããã©ã«ãã§ã¯ããã¬ã¼ã¹ã¯ eq ã«ã»ãããã¦ãã¾ãã

     -t macro
             macro ããã¬ã¼ã·ã³ã°ãã¾ãã

     -g      GNU-m4 äºæã¢ã¼ããæå¹ã«ãã¾ãã ãã®ã¢ã¼ãã§ã¯ changequote ã« 2
             ã¤ã®ç©ºã®ãã©ã¡ã¼ã¿ãã¤ãããã¨ã§ ã¯ã©ã¼ãã®ä½¿ç¨ãããããã¾ãã translit ã¯ã
             åä¸ã®æåç¯å² (ä¾ãã° a-z) ãæ±ãã æ£è¦è¡¨ç¾ã§ emacs(1) ã®ããã«åä½ãã¾ãã
             å¤æã®æ°ã¯ç¡å¶éã§ãã

ææ³
     m4 ã¦ã¼ãã£ãªãã£ã«ã¯ä»¥ä¸ã«ç¤ºãçµã¿è¾¼ã¿ãã¯ããå®è£ããã¦ãã¾ãã ãããã®ãã¯ã‐
     ã¯åå®ç¾©å¯è½ã§ããããã®å ´åã«ã¯åã®å®ç¾©ã¯å¤±ããã¾ãã ç¹ã«è¨è¿°ã®ãªãéãæ»ãå¤ã¯
     NULL ã§ãã

     builtin      æå®ããçµã¿è¾¼ã¿ãã¯ããå¼ã³åºãã¾ãã
                  ååãåå®ç¾©ããã¦ããã¨ãã¦ãååã®æã¤æ¬æ¥ã®æ©è½ãå¼ã³åºãã¾ãã

     changecom    ã³ã¡ã³ãã®éå§æååã¨çµäºæååãå¤æ´ãã¾ãã ããã©ã«ãã§ã¯ããã³ãè¨å·
                  (‘#’) ã¨æ¹è¡æåã§ãã
                  å¼æ°ãæå®ããªãã£ãå ´åã¯ã³ã¡ã³ãã·ã¼ã±ã³ã¹ããªã»ããããã¾ãã GNU
                  ã¢ã¼ãã® m4 ã§ã¯ãã³ã¡ã³ãã¯ãªãã§ãã è¨å®ã§ããæååã®é·ãã¯æ大㧠5
                  æåã§ãã

     changequote  第 1ã第 2 å¼æ°ãã¯ã©ã¼ãã·ã³ãã«ã¨ãã¦å®ç¾©ãã¾ãã ã·ã³ãã«ã¯ãé·ã
                  5 æå以åã«ãã¦ãã ããã
                  å¼æ°ãä¸ããããªãã£ãå ´åã«ã¯ããã©ã«ãã®å·¦å³ã·ã³ã°ã«ã¯ã©ã¼ãã« è¨‐
                  å®ããã¾ãã

     decr         å¼æ°ã®å¤ã 1 ã ãæ¸å°ããã¾ãã å¼æ°ã¯æ£ããæ°å¤ã表ç¾ããæå‐
                  åã§ãªããã°ãªãã¾ããã

     define       第 1 å¼æ°ã§æå®ããååã®æ°ãããã¯ããå®ç¾©ãã¾ãã å®ç¾©å容ã¯ç¬¬ 2
                  å¼æ°ã§ä¸ãã¾ãã å®ç¾©ä¸ã§ã® ‘$n’ ( n 㯠0 ãã 9 ã¾ã§) ã¯
                  ãããããã®ãã¯ãã«ä¸ãããã 第 n å¼æ°ã«ç½®æããã¾ãã ‘$0’ ã¯ãã¯ã‐
                  åãã®ãã®ã§ãã æå®ãããªãã£ãå¼æ°ã¯ NULL æååã«ç½®æããã¾ãã ã¾ã ‘$#’
                  ã¯å¼æ°ã®æ°ã表ãã ‘$*’ ã¯ã³ã³ãã§åºåãããå¨å¼æ°ã«ãªãã¾ãã ‘$@’ ã¯
                  ‘$*’ ã¨åæ§ã§ãããæ´ãªãç½®æãè¡ãããªãããã«å¨é¨ã®å¼æ°ã
                  ã¯ã©ã¼ãããã¾ãã

     defn         åå¼æ°ã§æå®ããããã¯ãã®å®ç¾©å容ãã¯ã©ã¼ããã¦è¿ãã¾ãã ããã¯ãã¯ã‐
                  å®ç¾©ã®å称å¤æ´ (çµã¿è¾¼ã¿ãã¯ãã§ãã£ã¦ã) ã«å©ç¨ã§ãã¾ãã

     divert       m4 ã«ã¯ 10 æ¬ã®åºåãã¥ã¼ãç¨æããã¦ãã¾ã (0 ãã 9
                  ã¾ã§ã®çªå·ãã¤ãã¦ãã¾ã)ã å¦çã®æå¾ã«ãå¨ã¦ã®ã‐
                  ã¥ã¼ã¯çªå·é ã«é£çµããã¦æçµçãªåºåã çæããããã«ãªã£ã¦ãã¾ãã
                  åæç¶æã§ã¯åºåãã¥ã¼ã¯ 0 çªã«è¨å®ããã¦ãã¾ãã divert ãã¯ã‐
                  ã使ã£ã¦æ°ããåºåãã¥ã¼ãé¸ã¶ãã¨ãåºæ¥ã¾ã ( divert ã«ä¸æ‐
                  £ãªå¼æ°ãä¸ããã¨åºåãç ´æ£ããã¦ãã¾ãã¾ã)ã

     divnum       ç¾å¨ã®åºåãã¥ã¼ã®çªå·ãè¿ãã¾ãã

     dnl          æ¹è¡æåãå«ããè¡æ«ã¾ã§ã®å¥åæåãç ´æ£ãã¾ãã

     dumpdef      å¼æ°ã§æå®ããé ç®ã«é¢ãã¦ããã®ååã¨å®ç¾©ãåºåãã¾ãã
                  å¼æ°ãä¸ããããªãã£ãå ´åã¯å¨ã¦ã®ãã¯ãã«ã¤ãã¦åºåãã¾ãã

     errprint     第 1 å¼æ°ãæ¨æºã¨ã©ã¼åºåã¹ããªã¼ã ã¸åºåãã¾ãã

     esyscmd      ãã®æåã®å¼æ°ãã·ã§ã«ã¸æ¸¡ããã·ã§ã«ã®æ¨æºåºåãè¿ãã¾ãã
                  ã·ã§ã«ã¯ãã®æ¨æºå¥åããã³æ¨æºã¨ã©ã¼åºåã m4
                  ã¨å±æãããã¨ã«æ³¨æãã¦ãã ããã

     eval         第 1 å¼æ°ãè¨ç®å¼ã¨ã¿ãªã㦠32-bit
                  å¹ã®ç®è¡æ¼ç®ãç¨ãã¦è¨ç®ãã¾ãã æ¼ç®åã¨ãã¦ã¯æ¨æºã® C
                  ã§ç¨ãããããã®ãããªãã¡ 3 é ã ç®è¡ãè«çãã·ãããé¢ä¿ããããã®åæ¼ç®å‐
                  ãããã³æ¬å¼§ã å©ç¨å¯è½ã§ãã ã¾ãæ°å¤ã C ã¨åæ§ã« 8 é²ã10 é²ã16
                  é²ã§è¨è¿°ã§ãã¾ãã 第 2 å¼æ°ã§ (ããããã°) æ¼ç®çµæã®åºæ°ãæå®ã§ãã
                  第 3 å¼æ°ã§ (ããããã°) æ¼ç®çµæã®æå°æ¡æ°ãæå®ã§ãã¾ãã

     expr         eval ã®å¥åã§ãã

     ifdef        第 1 å¼æ°ã§æå®ããååã®ãã¯ããå®ç¾©ããã¦ããã°ç¬¬ 2 å¼æ°ãè¿ãã
                  å®ç¾©ããã¦ããªããã°ç¬¬ 3 å¼æ°ãè¿ãã¾ãã 第 3
                  å¼æ°ãçç¥ããã¦ããå ´åã¯ããã®å¤ã¯ NULL ã«ãªãã¾ãã ã¡ãªã¿ã« unix
                  ã¨ããåèªããããããå®ç¾©ããã¦ãã¾ãã

     ifelse       第 1 å¼æ°ã第 2 å¼æ°ã¨ãããããã第 3 å¼æ°ãè¿ãã¾ãã
                  ãããããªãã£ãå ´å (ifelse)ã ãã® 3 åã®å¼æ°ã¯æ¨ã¦ããã¦æ¬¡ã® 3
                  å¼æ°ã ç¨ãã¦åæ§ã®æ¤æ»ãç¹°ãè¿ãã¾ãã ãã®å¦çã¯å¼æ°ããªããªãã ãããã¯
                  1 ã¤ã ãæ®ãã¾ã§ç¹°ãè¿ããã ã©ãã«ããããããªãã£ãå ´åã«ã¯
                  ãã®æå¾ã«æ®ã£ãå¼æ°ã¾ã㯠NULL (å¼æ°ããªããªã£ãå ´å) ãè¿ããã¾ãã

     include      第 1 å¼æ°ã§æå®ããããã¡ã¤ã«ã®å容ãè¿ãã¾ãã
                  æå®éãã®ååã®ãã¡ã¤ã«ãè¦ã¤ãããªãã£ãå ´åã¯ã include ãã¹ãæ¢ãã¾ãã
                  æåã«ã¾ã ã³ãã³ãã©ã¤ã³ã§ -I æå®ããããã£ã¬ã¯ããªãé ã«ã 次ã«
                  ç°å¢å¤æ° M4PATH ã«è¨å®ãããã³ã‐
                  ã³åºåãã®ãã£ã¬ã¯ããªãªã¹ããé ã«æ¢ãã¾ãã ãã¡ã¤ã«ã include
                  ã§ããªãå ´åã¯ã ã¨ã©ã¼ã¡ãã»ã¼ã¸ã表示ãã¦ç°å¸¸çµäºãã¾ãã

     incr         å¼æ°ã 1 ã ãå¢å ããã¾ãã å¼æ°ã¯æ£ããæ°å¤ã表ç¾ããæå‐
                  åã§ãªããã°ããã¾ããã

     index        第 2 å¼æ°ãã第 1 å¼æ°ã®ä¸ã§ãä½æåç®ã«åºç¾ããããè¿ãã¾ã (ãã¨ãã°
                  index(the quick brown fox jumped, fox) ã§ã¯ 16 ãè¿ãã¾ã)ã 第
                  2 å¼æ°ã第 1 å¼æ°ã®ä¸ã«å«ã¾ãã¦ããªãã£ãå ´åã«ã¯ index 㯠-1
                  ãè¿ãã¾ãã

     indir        第 1 å¼æ°ã¨ãã¦æ¸¡ãããé ç®ã®ãã¯ããéæ¥çã«å¼ã³ã¾ãã ãã以éã¯ã第
                  1 å¼æ°ã®ãã¯ãã«å¯¾ããå¼æ°ã§ãã

     len          第 1 å¼æ°ã®æåæ°ãè¿ãã¾ããä½åãªå¼æ°ã¯ç¡è¦ããã¾ãã

     m4exit       第 1 å¼æ° (æå®ãããªãã£ãå ´å㯠0)
                  ãçµäºã³ã¼ãã¨ãã¦å³åº§ã«çµäºãã¾ãã

     m4wrap       å¥åãæå¾ã® EOF ã«éããã¨ãã«ãã©ã®ãããªåä½ãè¡ãããè¨å®ãã¾ãã
                  ä¸è¬ã«ã¯ç¨®ãã®å¾å§æ«ãè¡ããã¯ããè¨å®ãã¾ã (ãã¨ãã°ã
                  m4wrap(cleanup(tempfile)) ) ã¨ããã¨ä»ã®å¨ã¦ã®å¦çãçµäºãã å¾ã«
                  cleanup ãã¯ããå¼ã³åºããã¾ã)ã

     maketemp     第 1 å¼æ°ã®ä¸ã®æåå “XXXXX” ãç¾å¨ã®ããã»ã¹ ID ã«ç½®æãã¾ãã
                  ãã®ä»ã®é¨åã¯ãã®ã¾ã¾ã§ãã
                  ããã¯ã¦ãã¼ã¯ãªãã³ãã©ãªãã¡ã¤ã«åã®çæã«å©ç¨ã§ãã¾ãã

     paste        第 1 å¼æ°ã§æå®ããããã¡ã¤ã«ã®å容ããã¯ãå¦çãä¸åè¡ããã« include
                  ãã¾ãã ãããã¡ã¤ã«ãèª‐
                  ã¿è¾¼ããªãå ´åã«ã¯ã¨ã©ã¼ã¡ãã»ã¼ã¸ãåºåãã¦å¦çã ä¸æãã¾ãã

     patsubst     æååã®ãã¡ãæ£è¦è¡¨ç¾ã«ãããããé¨åãç½®ææååã§ç½®ãæãããã¾ãã
                  é常ã¯æ¬¡ã®ä»£å¥è¦åãé©ç¨ããã¾ã: ã¢ã³ããµã³ã (‘&’) ã¯ãæ‐
                  £è¦è¡¨ç¾ã«ãããããæååã§ç½®ãæãããã¾ãã æåå ‘\#’ (# ã¯æ°å¤)
                  ã¯ãä¸è´ããå¾æ¹åç§ã¨ç½®ãæãããã¾ãã

     popdef       åå¼æ°ã¸ pushdef ããã¦ããå®ç¾©ãæ»ãã¾ãã

     pushdef      define ã¨åæ§ã®å¼æ°ãã¨ã£ã¦ãã¯ããå®ç¾©ãã¾ããåã®å®ç¾©ãã¹ã¿ãã¯ã¸
                  ä¿åãã¦ããã¾ãã ä¿åãããå®ç¾©ã¯å¾ã§ popdef ã§æ»ããã¨ãã§ãã¾ãã

     regexp       æ£è¦è¡¨ç¾ã«åºã¥ããæåãè¦ã¤ãã¾ãã 第 2 å¼æ°ã¾ã§ã®å ´åã¯
                  æåã«ãããããæåä½ç½®ãã ãããããæåããªãå ´å㯠-1 ãè¿ãã¾ãã 第 3
                  å¼æ°ãããå ´åã ãã®ä¸ã«å«ã¾ãããã¿ã¼ã³ãç½®ãæããæååãè¿ãã¾ãã

     shift        第 1 å¼æ°ãé¤ããå¨ã¦ã®å¼æ°ãè¿ãã¾ãã
                  æ®ãã®å¼æ°ã¯ã¯ã©ã¼ãããã¦ã³ã³ãã§åºåããã¾ãã
                  ã¯ã©ã¼ããããã¨ã«ãã£ã¦ä»¥éã®å¦çã§ç½®æãè¡ãããªãããã«ãã¦ãã¾ãã

     sinclude     ã¨ã©ã¼ãèµ·ãã¦ãç¡è¦ãããç¹ãé¤ã㦠include ã¨åãã§ãã

     spaste       ã¨ã©ã¼ãèµ·ãã¦ãç¡è¦ãããç¹ãé¤ã㦠paste ã¨åãã§ãã

     substr       第 1 å¼æ°ã®æååã®ãã¡ã®ã第 2 å¼æ°ã§æå®ããããªãã»ããããå§ã¾ã 第
                  3 å¼æ°ã§æå®ãããæåæ°ã®ç¯å²ã®é¨åæååãè¿ãã¾ãã 第 3
                  å¼æ°ãçç¥ãããå ´åã¯æ®ãã®æååå¨ã¦ãè¿ãã¾ãã

     syscmd       第 1 å¼æ°ãã·ã§ã«ã«æ¸¡ãã¾ããæ»ãå¤ã¯ããã¾ããã

     sysval       æå¾ã«å®è¡ãã syscmd ã®æ»ãå¤ãè¿ãã¾ãã

     traceon      å¼æ°ãããå ´åã¯ãã®ãã¯ãã®å±éããã¬ã¼ã¹ããªã³ã«ãã¾ãã
                  å¼æ°ããªãå ´åã¯ãã¹ã¦ã®ãã¯ãããã¬ã¼ã¹ããªã³ã«ãã¾ãã

     traceoff     å¼æ°ãããå ´åã¯ãã®ãã¯ãã®å±éããã¬ã¼ã¹ããªãã«ãã¾ãã
                  å¼æ°ããªãå ´åã¯ãã¹ã¦ã®ãã¯ãããã¬ã¼ã¹ããªãã«ãã¾ãã

     translit     第 1 å¼æ°ã®ä¸ã®æåãã第 2 å¼æ°ã§æå®ãããæåéåãã第 3 å¼æ°ã§
                  æå®ãããæåéåã¸æ¸ãç´ãã¾ãããã ã tr(1)
                  å¼ã®çç¥æå®ãç¨ãããã¨ã¯ã§ãã¾ããã

     undefine     å¼æ°ã§æå®ããããã¯ããæªå®ç¾©ã«ãã¾ãã

     undivert     æå®ãããåºåãã¥ã¼ (å¼æ°ããªãå ´åã¯å¨ã¦ã®ãã¥ã¼) ã®å容ãæãåºãã¾ãã

     unix         OS ãã©ãããã©ã¼ã ã調ã¹ãããã«äºãå®ç¾©ããã¦ãããã¯ãã§ãã

     __line__     ç¾å¨ã®ãã¡ã¤ã«ã®è¡çªå·ãè¿ãã¾ãã

     __file__     ç¾å¨ã®ãã¡ã¤ã«åãè¿ãã¾ãã

診æ
     The m4 utility exits 0 on success, and >0 if an error occurs.

     å¥åãã¡ã¤ã«ããçµäºç¶æãå¤æ´ããããã«ã m4exit ãã¯ãã使ç¨ãããã¨ãã§ãã¾ãã

äºææ§
     m4 ã¦ã¼ãã£ãªãã£ã¯ãGNU-m4 ããå ããããå°ãã®æ¡å¼µã«å ãã¦ã Version 2 of the
     Single UNIX Specification (“SUSv2”) ã«è¿½å¾ãã¦ãã¾ãã ãã©ã° -I, -d, -t
     ã¯éæ¨æºã§ãã

     ãã¬ã¼ã¹ã¨ dumpdef ã®åºåãã©ã¼ãããã¯ã ã©ã®æ¨æºã§ãè¦å®ããã¦ãã¾ããã®ã§
     å¤æ´ãããå¯è½æ§ãããã¾ãã ãããã«ä¾åããã¹ãã§ã¯ããã¾ããã ç¾å¨ã®ãã¬ã¼ã¹åºåãã©ã¼ãããã¯ã
     autoconf ãæ©è½ã§ãããã GNU-m4 ã«åºã¥ãã¦å³å¯ã«ä½æããã¦ãã¾ãã

     移æ¤æ§ã®ããã«ã¯ã builtin, esyscmd, expr, indir, paste, patsubst, regexp,
     spaste, unix, __line__, ããã³ __file__ ã®ãã¯ãã¯ã使ç¨ããªãã»ããããã§ãã

     ä»ã®å¤ãã® m4 ã®å®è£ã§ã¯ã ãã¹ã¦ã®çµã¿è¾¼ã¿ãã¯ãã¯å¼æ°ãªãã§ãå±éããã¾ãã

     ä»ã®å¤ãã® m4 ã®å®è£ã¯ã ãããã¡ãµã¤ãºã«é¢ãã¦ããã³ããå¶éãããã¾ãã

è¦æ ¼
     m4 ã¦ã¼ãã£ãªãã£ã¯ IEEE Std 1003.1-2001 (“POSIX.1”) ã«é©åãã¾ãã

æ´å²
     m4 ã³ãã³ãã¯ãPWB UNIX ããç»å ´ãã¾ããã

ä½è
     Ozan Yigit <oz@sis.yorku.ca> ããã³ Richard A. O'Keefe
     <ok@goanna.cs.rmit.OZ.AU>.
     Marc Espie <espie@cvs.openbsd.org> ã«ãã GNU-m4 äºææ§æ¡å¼µ

ãã°
     m4 ã¦ã¼ãã£ãªãã£ã¯ããã«ããã¤ãæåãèªèãã¾ããã