/* * Copyright 1993, 1995 Christopher Seiwald. * * This file is part of Jam - see jam.c for Copyright information. */ /* * command.c - maintain lists of commands * * 01/20/00 (seiwald) - Upgraded from K&R to ANSI C * 09/08/00 (seiwald) - bulletproof PIECEMEAL size computation */ # include "jam.h" # include "lists.h" # include "parse.h" # include "variable.h" # include "rules.h" # include "command.h" /* * cmd_new() - return a new CMD or 0 if too many args */ CMD * cmd_new( RULE *rule, LIST *targets, LIST *sources, LIST *shell, int maxline ) { int len; #ifdef OPT_DYNAMIC_COMMAND_SIZE_EXT int size = MAXLINE; int keepGrowing = 1; #endif CMD *cmd = (CMD *)malloc( sizeof( CMD ) ); #ifdef OPT_DYNAMIC_COMMAND_SIZE_EXT cmd->buf = (char *)malloc( sizeof( char ) * size ); #endif cmd->rule = rule; cmd->shell = shell; cmd->next = 0; lol_init( &cmd->args ); lol_add( &cmd->args, targets ); lol_add( &cmd->args, sources ); #ifndef OPT_DYNAMIC_COMMAND_SIZE_EXT /* Bail if the result won't fit in maxline */ /* We don't free targets/sources/shell if bailing. */ len = var_string( rule->actions, cmd->buf, maxline, &cmd->args ); #else /* Most commands fit in the buffer - so don't worry too much about * sometimes computing the string twice. */ do { len = var_string( rule->actions, cmd->buf, size, &cmd->args ); /* If this is a piecemeal rule, we don't grow */ if (len < 0 && ((rule->flags & RULE_PIECEMEAL) == 0)) { free (cmd->buf); size *= 5; cmd->buf = (char *)malloc( sizeof( char ) * size ); } else keepGrowing = 0; } while (keepGrowing); #endif if( len < 0 ) { cmd_free( cmd ); return 0; } return cmd; } /* * cmd_free() - free a CMD */ void cmd_free( CMD *cmd ) { lol_free( &cmd->args ); list_free( cmd->shell ); #ifdef OPT_DYNAMIC_COMMAND_SIZE_EXT free( (char *)cmd->buf ); #endif free( (char *)cmd ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 3183 | Craig Mcpheeters | Integration of my jam mainline branch into my work branch. | ||
#5 | 1085 | Craig Mcpheeters |
Returned some changes to bring this copy in line with our internal version * Added some double quotes in the Jambase so we can compile files with spaces in the names * Updated our Jambase.aw from the Jambase * Added some debug/optim code to the Jamfile * Fixed a bug in command.c In my dynamic command size extension, it no longer took into account if a target was marked as piecemeal. Now it does * Fixed a bug in execunix.c In jam 2.3 the logic for when to invoke the interpreter directly, and when to go through an intermediate .bat file was changed. This was failing for us, as on NT, cmd.exe does not handle large lines. rc.exe was failing when it went through a .bat file. Reverted it to the 2.2 logic |
||
#4 | 1071 | Craig Mcpheeters | A few tweaks from my jam branch. | ||
#3 | 785 | Craig Mcpheeters |
Integration from //guest/craig_mcpheeters/jam/src/... This work area now contains both the Alias|Wavefront changes, and the latest integrations from the mainline. There are some changes in this area which shouldn't be merged back into the mainline. As I merge this branch back into my jam/src/... branch, I'll leave out a few of the changes. |
||
#2 | 782 | Craig Mcpheeters |
Initial return of the Alias|Wavefront mods to jam 2.2. I made a stab at a configuration system - see the file Jamfile.config. Most of the mods are now enclosed within #ifdef blocks, which kind of pollutes the code, but may make it easier to accept or reject some of these changes. Some of these #ifdefs could disappear completely if they are accepted into the mainline This return implements the following extensions: * header cache * dynamic command block size, allowing for *large* commands * slightly improved warnings and errors * serial output from jam - nice when working with multiple jobs * an extension to variable modifiers: $(>:/) and $(>:\\) * ability to ignore header dependencies for a build (jam -p) * new debug level, -d+10, which outputs the dependency graph * added no-care support to internal nodes. if they fail, dependents are built anyway * time stamps on output * a few minor output modifications * a fix for nt batch file names conflicing when more than one jam runs at a time Each of the above can be enabled/disabled on the command line. For example, to turn on the HeaderCache code: jam -sHeaderCache=1 that is, build jam first, then use that jam to build a new one with the options you want. Some of these changes may have been made in the mainline already, my next step will be to integrate the mainline changes into these ones This return isn't yet ready for prime-time |
||
#1 | 777 | Craig Mcpheeters |
Branch of my jam/src/... area. This new area establishes the integration base for the copy of Jam which has all the changes. |
||
//guest/craig_mcpheeters/jam/src/command.c | |||||
#2 | 617 | Craig Mcpheeters | Integration from mainline as of @3 | ||
#1 | 616 | Craig Mcpheeters | Integration from Jam mainline, as of @2 |