Changeset 225 for trunk/src/gmake/job.c


Ignore:
Timestamp:
Feb 9, 2005, 9:31:14 AM (20 years ago)
Author:
bird
Message:

kMk builtin command basics. KMK_VERSION variable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/job.c

    r218 r225  
    2828#include "variable.h"
    2929#include "debug.h"
     30#ifdef CONFIG_WITH_KMK_BUILTIN
     31#include "kmkbuiltin.h"
     32#endif
     33
    3034
    3135#include <string.h>
     
    965969        child->noerror = 1;
    966970      else if (!isblank ((unsigned char)*p))
    967         break;
     971        {
     972#ifdef CONFIG_WITH_KMK_BUILTIN
     973          if (   !(flags & COMMANDS_BUILTIN)
     974              && !strncmp(p, "kmk_builtin_", sizeof("kmk_builtin_") - 1))
     975            flags |= COMMANDS_BUILTIN;
     976#endif /* CONFIG_WITH_KMK_BUILTIN */
     977          break;
     978        }
    968979      ++p;
    969980    }
     
    10951106      goto next_command;
    10961107    }
     1108
     1109#ifdef CONFIG_WITH_KMK_BUILTIN
     1110  /* If builtin command then pass it on to the builtin shell interpreter. */
     1111
     1112  if ((flags & COMMANDS_BUILTIN) && !just_print_flag)
     1113    {
     1114      char **p2 = argv;
     1115      while (*p2 && strncmp(*p2, "kmk_builtin_", sizeof("kmk_builtin_") - 1))
     1116          p2++;
     1117      assert(*p2);
     1118      set_command_state (child->file, cs_running);
     1119      int rc = kmk_builtin_command(p2);
     1120#ifndef VMS
     1121      free (argv[0]);
     1122      free ((char *) argv);
     1123#endif
     1124      if (!rc)
     1125          goto next_command;
     1126      child->file->update_status = 2;
     1127      notice_finished_file (child->file);
     1128      return;
     1129    }
     1130#endif /* CONFIG_WITH_KMK_BUILTIN */
    10971131
    10981132  /* Flush the output streams so they won't have things written twice.  */
     
    13881422{
    13891423  struct file *f = c->file;
     1424  DB (DB_KMK, (_("start_waiting_job %p (`%s') command_flags=%#x\n"), c, c->file->name, c->file->command_flags));
    13901425
    13911426  /* If we can start a job remotely, we always want to, and don't care about
     
    13971432  /* If we are running at least one job already and the load average
    13981433     is too high, make this one wait.  */
    1399   if (!c->remote && job_slots_used > 0 && 
     1434  if (!c->remote && job_slots_used > 0 &&
    14001435      (not_parallel || (c->file->command_flags & COMMANDS_NOTPARALLEL) || load_too_high ()))
    14011436    {
     
    14051440      c->next = waiting_jobs;
    14061441      if (c->next && (c->file->command_flags & COMMANDS_NOTPARALLEL))
    1407         { 
     1442        {
    14081443          struct child *prev = waiting_jobs;
    14091444          while (prev->next)
     
    14141449      else
    14151450        waiting_jobs = c;
     1451      DB (DB_KMK, (_("queued child %p (`%s')\n"), c, c->file->name));
    14161452      return 0;
    14171453    }
Note: See TracChangeset for help on using the changeset viewer.