Changeset 1109 for trunk/src/kmk/read.c


Ignore:
Timestamp:
Sep 24, 2007, 4:27:14 AM (18 years ago)
Author:
bird
Message:

New feature: if1of and ifn1of (CONFIG_WITH_SET_CONDITIONALS).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/read.c

    r1022 r1109  
    15191519
    15201520/* Interpret conditional commands "ifdef", "ifndef", "ifeq",
    1521    "ifneq", "else" and "endif".
     1521   "ifneq", "if1of", "ifn1of", "else" and "endif".
    15221522   LINE is the input line, with the command as its first word.
    15231523
     
    15341534{
    15351535  char *cmdname;
     1536#ifdef CONFIG_WITH_SET_CONDITIONALS
     1537  enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, c_if1of, c_ifn1of, c_else, c_endif } cmdtype;
     1538#else
    15361539  enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, c_else, c_endif } cmdtype;
     1540#endif
    15371541  unsigned int i;
    15381542  unsigned int o;
     
    15471551  else chkword ("ifeq", c_ifeq)
    15481552  else chkword ("ifneq", c_ifneq)
     1553#ifdef CONFIG_WITH_SET_CONDITIONALS
     1554  else chkword ("if1of", c_if1of)
     1555  else chkword ("ifn1of", c_ifn1of)
     1556#endif
    15491557  else chkword ("else", c_else)
    15501558  else chkword ("endif", c_endif)
     
    16871695  else
    16881696    {
     1697#ifdef CONFIG_WITH_SET_CONDITIONALS
     1698      /* "ifeq", "ifneq", "if1of" or "ifn1of". */
     1699#else
    16891700      /* "ifeq" or "ifneq".  */
     1701#endif
    16901702      char *s1, *s2;
    16911703      unsigned int l;
     
    17761788
    17771789      s2 = variable_expand (s2);
     1790#ifdef CONFIG_WITH_SET_CONDITIONALS
     1791      if (cmdtype == c_if1of || cmdtype == c_ifn1of)
     1792        {
     1793          const char *s1_cur;
     1794          unsigned int s1_len;
     1795          const char *s1_iterator = s1;
     1796
     1797          conditionals->ignoring[o] = (cmdtype == c_if1of); /* if not found */
     1798          while ((s1_cur = find_next_token (&s1_iterator, &s1_len)) != 0)
     1799            {
     1800              const char *s2_cur;
     1801              unsigned int s2_len;
     1802              const char *s2_iterator = s2;
     1803              while ((s2_cur = find_next_token (&s2_iterator, &s2_len)) != 0)
     1804                if (s2_len == s1_len
     1805                 && strneq (s2_cur, s1_cur, s1_len) )
     1806                  {
     1807                    conditionals->ignoring[o] = (cmdtype != c_if1of); /* found */
     1808                    break;
     1809                  }
     1810            }
     1811        }
     1812      else
     1813        conditionals->ignoring[o] = (streq (s1, s2) == (cmdtype == c_ifneq));
     1814#else
    17781815      conditionals->ignoring[o] = (streq (s1, s2) == (cmdtype == c_ifneq));
     1816#endif
    17791817    }
    17801818
     
    20692107                cmp timestamp maybe.h || cp -f timestamp maybe.h
    20702108
    2071         This is implemented in remake.c where we don't consider the mtime of 
     2109        This is implemented in remake.c where we don't consider the mtime of
    20722110        the maybe-updated targets. */
    20732111      if (multi_mode != m_no && name[0] == '+'
Note: See TracChangeset for help on using the changeset viewer.