VirtualBox

Changeset 2548 in kBuild for trunk/src


Ignore:
Timestamp:
Nov 8, 2011 9:28:16 PM (13 years ago)
Author:
bird
Message:

kmk: hacking on a new kmk/kBuild language extension.

Location:
trunk/src/kmk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/Makefile.am

    r2538 r2548  
    5353                alloccache.c \
    5454                kbuild.c \
     55                kbuild-read.c \
    5556                electric.c \
    5657                ../lib/md5.c \
  • trunk/src/kmk/Makefile.kmk

    r2546 r2548  
    205205        main.c \
    206206        kbuild.c \
     207        kbuild-read.c \
    207208        read.c \
    208209        expreval.c \
  • trunk/src/kmk/expand.c

    r2119 r2548  
    11161116#ifdef CONFIG_WITH_VALUE_LENGTH
    11171117/* Handle the most common case in allocated_variable_expand_for_file
    1118    specially and provide some additional string lenght features. */
     1118   specially and provide some additional string length features. */
    11191119
    11201120char *
  • trunk/src/kmk/kbuild.h

    r2413 r2548  
    3939const char *get_default_kbuild_shell(void);
    4040
     41struct kbuild_eval_data;
     42
     43int eval_kbuild_define(struct kbuild_eval_data **kdata, const struct floc *flocp,
     44                       const char *word, unsigned int wlen, const char *line, const char *eos, int ignoring);
     45int eval_kbuild_endef(struct kbuild_eval_data **kdata, const struct floc *flocp,
     46                      const char *word, unsigned int wlen, const char *line, const char *eos, int ignoring);
     47
    4148#endif
    4249
  • trunk/src/kmk/make.h

    r2161 r2548  
    502502char *next_token (const char *);
    503503char *end_of_token (const char *);
     504#ifdef KMK
     505char *find_next_token_eos (const char **ptr, const char *eos, unsigned int *lengthptr);
     506#endif
    504507#ifndef CONFIG_WITH_VALUE_LENGTH
    505508void collapse_continuations (char *);
  • trunk/src/kmk/misc.c

    r2101 r2548  
    727727#endif
    728728}
     729#ifdef KMK
     730
     731/* Same as find_next_token with two exception:
     732      - The string ends at EOS or '\0'.
     733      - We keep track of $() and ${}, allowing functions to be used. */
     734
     735char *
     736find_next_token_eos (const char **ptr, const char *eos, unsigned int *lengthptr)
     737{
     738  const char *p = *ptr;
     739  const char *e;
     740  int level = 0;
     741
     742  /* skip blanks */
     743  for (; p != eos; p++)
     744    {
     745      unsigned char ch = *p;
     746      if (!MY_IS_BLANK(ch))
     747        {
     748          if (!ch)
     749            return NULL;
     750          break;
     751        }
     752    }
     753  if (p == eos)
     754    return NULL;
     755
     756  /* skip ahead until EOS or blanks. */
     757  for (e = p; e != eos; e++)
     758    {
     759      unsigned char ch = *e;
     760      if (MY_IS_BLANK_OR_EOS(ch))
     761        {
     762          if (!ch || level == 0)
     763            break;
     764        }
     765      else if (ch == '$')
     766        {
     767          if (&e[1] != eos && (e[1] == '(' || e[1] == '{'))
     768            {
     769              level++;
     770              e++;
     771            }
     772        }
     773      else if ((ch == ')' || ch == '}') &&  level > 0)
     774        level--;
     775    }
     776
     777  *ptr = e;
     778  if (lengthptr != 0)
     779    *lengthptr = e - p;
     780
     781  return (char *)p;
     782}
     783
     784#endif /* KMK */
    729785
    730786
  • trunk/src/kmk/read.c

    r2426 r2548  
    593593  unsigned int tmp_len;
    594594#endif
     595#ifdef KMK
     596  struct kbuild_eval_data *kdata = 0;
     597  int krc;
     598#endif
    595599
    596600#define record_waiting_files()                                                \
     
    896900        continue;
    897901
     902#ifdef KMK
     903      /* Check for the kBuild language extensions. */
     904      if (   wlen >= sizeof("kBuild-define") - 1
     905          && strneq (p, "kBuild-define", sizeof("kBuild-define") - 1))
     906        krc = eval_kbuild_define (&kdata, fstart, p, wlen, p2, eol, ignoring);
     907      else if (   wlen >= sizeof("kBuild-endef") - 1
     908               && strneq (p, "kBuild-endef", sizeof("kBuild-endef") - 1))
     909        krc = eval_kbuild_endef (&kdata, fstart, p, wlen, p2, eol, ignoring);
     910      else
     911        krc = 42;
     912      if (krc != 42)
     913        {
     914          if (krc != 0)
     915            error (fstart, _("krc=%d"), krc);
     916          continue;
     917        }
     918
     919#endif /* KMK */
    898920      if (word1eq ("export"))
    899921        {
     
    16461668  if (conditionals->if_cmds)
    16471669    fatal (fstart, _("missing `endif'"));
     1670#ifdef KMK
     1671
     1672  if (kdata != NULL)
     1673    fatal (fstart, _("missing `kBuild-endef-*'"));
     1674#endif
    16481675
    16491676  /* At eof, record the last rule.  */
  • trunk/src/kmk/variable.c

    r2532 r2548  
    12791279  && defined (CONFIG_WITH_TOUPPER_TOLOWER) \
    12801280  && defined (CONFIG_WITH_DEFINED) \
    1281   && defined (CONFIG_WITH_VALUE_LENGTH) && defined (CONFIG_WITH_COMPARE) \
     1281  && defined (CONFIG_WITH_VALUE_LENGTH) \
     1282  && defined (CONFIG_WITH_COMPARE) \
    12821283  && defined (CONFIG_WITH_STACK) \
    12831284  && defined (CONFIG_WITH_MATH) \
     
    13021303  (void) define_variable ("KMK_FEATURES", 12,
    13031304                          "append-dash-n abspath includedep-queue install-hard-linking"
     1305                          " kBuild-define"
    13041306                          " rsort"
    13051307                          " abspathex"
     
    13311333# else /* MSC can't deal with strings mixed with #if/#endif, thus the slow way. */
    13321334#  error "All features should be enabled by default!"
    1333   strcpy (buf, "append-dash-n abspath includedep-queue install-hard-linking");
     1335  strcpy (buf, "append-dash-n abspath includedep-queue install-hard-linking"
     1336               " kBuild-define");
    13341337#  if defined (CONFIG_WITH_RSORT)
    13351338  strcat (buf, " rsort");
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette