Boost logo

Boost-Commit :

From: grafikrobot_at_[hidden]
Date: 2008-01-08 23:32:02


Author: grafik
Date: 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
New Revision: 42632
URL: http://svn.boost.org/trac/boost/changeset/42632

Log:
Revert various changes that break backward compatibility, and also some minor edits.
Text files modified:
   trunk/tools/build/v2/build-system.jam | 6
   trunk/tools/build/v2/test/timedata.py | 34 ++++------
   trunk/tools/jam/doc/bjam.qbk | 8 +-
   trunk/tools/jam/doc/history.qbk | 14 ----
   trunk/tools/jam/src/builtins.c | 38 ++++++------
   trunk/tools/jam/src/execnt.c | 124 ++++++++++++++++++++--------------------
   trunk/tools/jam/src/make1.c | 37 +----------
   trunk/tools/jam/src/regexp.c | 9 +-
   8 files changed, 110 insertions(+), 160 deletions(-)

Modified: trunk/tools/build/v2/build-system.jam
==============================================================================
--- trunk/tools/build/v2/build-system.jam (original)
+++ trunk/tools/build/v2/build-system.jam 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
@@ -764,7 +764,7 @@
         # result of @(...) below (the name of the XML file).
         #
         rule out-xml.generate-action ( args * : xml-file
- : command status start end user system : output-lines * )
+ : command status start end user system : output ? )
         {
             local contents =
                 [ on $(xml-file) return $(.header) $(.contents) $(.footer) ] ;
@@ -784,7 +784,7 @@
         # target.
         #
         rule out-xml.collect ( xml-file : target : command status start end user
- system : output-lines * )
+ system : output ? )
         {
             local nl = "
 " ;
@@ -836,7 +836,7 @@
                 "$(nl) <jam-target><![CDATA[$(target)]]></jam-target>"
                 "$(nl) <path><![CDATA[$(target:G=:R=$(locate))]]></path>"
                 "$(nl) <command><![CDATA[$(command)]]></command>"
- "$(nl) <output><![CDATA[$(output-lines:J=$(nl))$(nl)]]></output>" ;
+ "$(nl) <output><![CDATA[$(output)]]></output>" ;
             .contents on $(xml-file) +=
                 "$(nl) </action>" ;
         }

Modified: trunk/tools/build/v2/test/timedata.py
==============================================================================
--- trunk/tools/build/v2/test/timedata.py (original)
+++ trunk/tools/build/v2/test/timedata.py 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
@@ -6,60 +6,52 @@
 # This tests the build step timing facilities.
 
 import BoostBuild
-import re
 
 t = BoostBuild.Tester(pass_toolset=0)
 
-t.write("file.jam", """
+t.write('file.jam', '''
 rule time
 {
     DEPENDS $(<) : $(>) ;
     __TIMING_RULE__ on $(>) = record_time $(<) ;
     DEPENDS all : $(<) ;
 }
-
 actions time
 {
     echo $(>) user: $(__USER_TIME__) system: $(__SYSTEM_TIME__)
     echo timed from $(>) >> $(<)
 }
 
-rule display-action-output ( args * : target : command status start end user system : output-lines * )
-{
- for local line in $(output-lines)
- {
- ECHO $(line) ;
- }
-}
-
 rule record_time ( target : source : start end user system )
 {
- __USER_TIME__ on $(target) = $(user) ;
+ ECHO record_time called: $(target) / $(source) / $(user) / $(system) ;
+ __USER_TIME__ on $(target) = $(user) ;
     __SYSTEM_TIME__ on $(target) = $(system) ;
- __ACTION_RULE__ on $(target) = display-action-output ;
 }
 
 rule make
 {
     DEPENDS $(<) : $(>) ;
 }
-
 actions make
 {
     echo made from $(>) >> $(<)
 }
 
+
 time foo : bar ;
 make bar : baz ;
-""")
+''')
 
-t.write("baz", "nothing\n")
+import re
+t.write('baz', 'nothing\n')
 t.run_build_system(
- "-ffile.jam",
- stdout=r"bar +user: [0-9.]+ +system: +[0-9.]+ *$",
- match=lambda actual,expected: re.search(expected,actual,re.DOTALL))
-t.expect_addition("foo")
-t.expect_addition("bar")
+ '-ffile.jam',
+ stdout=r'bar +user: [0-9\.]+ +system: +[0-9\.]+ *$',
+ match = lambda actual,expected: re.search(expected,actual,re.DOTALL)
+ )
+t.expect_addition('foo')
+t.expect_addition('bar')
 t.expect_nothing_more()
 
 t.cleanup()

Modified: trunk/tools/jam/doc/bjam.qbk
==============================================================================
--- trunk/tools/jam/doc/bjam.qbk (original)
+++ trunk/tools/jam/doc/bjam.qbk 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
@@ -1456,7 +1456,7 @@
 
 And =__ACTION_RULE__= is called as:
 
- rule action-rule ( args * : target : command status start end user system : output-lines * )
+ rule action-rule ( args * : target : command status start end user system : output ? )
 
 The arguments for both are:
 
@@ -1480,9 +1480,9 @@
     [[[^system]]
         [The number of system CPU seconds the executed command spent as a floating
         point value.]]
- [[[^output-lines]]
- [List of lines outputed by the command. The output content reflects the
- use of the =-pX= option.]]
+ [[[^output]]
+ [The output of the command as a single string. The content of the output
+ reflects the use of the =-pX= option.]]
 ]
 
 [note

Modified: trunk/tools/jam/doc/history.qbk
==============================================================================
--- trunk/tools/jam/doc/history.qbk (original)
+++ trunk/tools/jam/doc/history.qbk 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
@@ -1,19 +1,5 @@
 [variablelist
 
-[[3.1.17] [
-
-In development...
-
-[list
- [li __ACTION_RULE__ now receives the action output as a list of output lines
- instead of a single string to work around problems with different
- newline character combinations.
- -- ['Jurko Gospodnetic.]
- ]
-]
-
-]]
-
 [[3.1.16] [
 
 This is mostly a bug fix release.

Modified: trunk/tools/jam/src/builtins.c
==============================================================================
--- trunk/tools/jam/src/builtins.c (original)
+++ trunk/tools/jam/src/builtins.c 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
@@ -840,37 +840,37 @@
 
         for( l = lol_get( frame->args, 0 ); l; l = l->next )
         {
- /* Result is cached and intentionally never freed */
+ /* Result is cached and intentionally never freed */
             regexp *re = regex_compile( l->string );
 
             /* For each string to match against */
- for( r = lol_get( frame->args, 1 ); r; r = r->next )
- {
- if( regexec( re, r->string ) )
+ for( r = lol_get( frame->args, 1 ); r; r = r->next )
             {
- int i, top;
+ if( regexec( re, r->string ) )
+ {
+ int i, top;
 
- /* Find highest parameter */
+ /* Find highest parameter */
 
- for( top = NSUBEXP; top-- > 1; )
- if( re->startp[top] )
- break;
+ for( top = NSUBEXP; top-- > 1; )
+ if( re->startp[top] )
+ break;
 
- /* And add all parameters up to highest onto list. */
- /* Must have parameters to have results! */
+ /* And add all parameters up to highest onto list. */
+ /* Must have parameters to have results! */
 
- for( i = 1; i <= top; i++ )
- {
- string_append_range( buf, re->startp[i], re->endp[i] );
- result = list_new( result, newstr( buf->value ) );
- string_truncate( buf, 0 );
+ for( i = 1; i <= top; i++ )
+ {
+ string_append_range( buf, re->startp[i], re->endp[i] );
+ result = list_new( result, newstr( buf->value ) );
+ string_truncate( buf, 0 );
+ }
                 }
             }
         }
- }
 
- string_free( buf );
- return result;
+ string_free( buf );
+ return result;
 }
 
 LIST *

Modified: trunk/tools/jam/src/execnt.c
==============================================================================
--- trunk/tools/jam/src/execnt.c (original)
+++ trunk/tools/jam/src/execnt.c 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
@@ -41,7 +41,7 @@
  *
  * Each word must be an individual element in a jam variable value.
  *
- * In $(JAMSHELL), % expands to the command string and ! expands to
+ * In $(JAMSHELL), % expands to the command string and ! expands to
  * the slot number (starting at 1) for multiprocess (-j) invocations.
  * If $(JAMSHELL) doesn't include a %, it is tacked on as the last
  * argument.
@@ -96,7 +96,7 @@
 static int try_kill_one();
 /* */
 static double creation_time(HANDLE);
-/* Recursive check if first process is parent (directly or indirectly) of
+/* Recursive check if first process is parent (directly or indirectly) of
 the second one. */
 static int is_parent_child(DWORD, DWORD);
 /* */
@@ -142,7 +142,7 @@
 /* execution unit tests */
 void execnt_unit_test()
 {
-#if !defined(NDEBUG)
+#if !defined(NDEBUG)
     /* vc6 preprocessor is broken, so assert with these strings gets
      * confused. Use a table instead.
      */
@@ -179,17 +179,17 @@
          * literals inside assert
          */
         char** argv = string_to_args("\"g++\" -c -I\"Foobar\"");
- char const expected[] = "-c -I\"Foobar\"";
-
+ char const expected[] = "-c -I\"Foobar\"";
+
         assert(!strcmp(argv[0], "g++"));
         assert(!strcmp(argv[1], expected));
         free_argv(argv);
     }
-#endif
+#endif
 }
 
 /* execcmd() - launch an async command execution */
-void execcmd(
+void execcmd(
     char *command,
     void (*func)( void *closure, int status, timing_info*, char *invoked_command, char *command_output),
     void *closure,
@@ -203,7 +203,7 @@
     char **argv = argv_static;
     char *p;
     char* command_orig = command;
-
+
     /* Check to see if we need to hack around the line-length limitation. */
     /* Look for a JAMSHELL setting of "%", indicating that the command
      * should be invoked directly */
@@ -228,12 +228,12 @@
     {
         const char *tempdir = path_tmpdir();
         DWORD procID = GetCurrentProcessId();
-
+
         /* SVA - allocate 64 other just to be safe */
         cmdtab[ slot ].tempfile_bat = BJAM_MALLOC_ATOMIC( strlen( tempdir ) + 64 );
-
+
         sprintf(
- cmdtab[ slot ].tempfile_bat, "%s\\jam%d-%02d.bat",
+ cmdtab[ slot ].tempfile_bat, "%s\\jam%d-%02d.bat",
             tempdir, procID, slot );
     }
 
@@ -247,14 +247,14 @@
     if( raw_cmd && can_spawn( command ) >= MAXLINE )
     {
         if( DEBUG_EXECCMD )
- printf("Executing raw command directly\n");
+ printf("Executing raw command directly\n");
     }
     else
     {
         FILE *f = 0;
         int tries = 0;
         raw_cmd = 0;
-
+
         /* Write command to bat file. For some reason this open can
            fails intermitently. But doing some retries works. Most likely
            this is due to a previously existing file of the same name that
@@ -274,7 +274,7 @@
         fclose( f );
 
         command = cmdtab[ slot ].tempfile_bat;
-
+
         if( DEBUG_EXECCMD )
         {
             if (shell)
@@ -327,7 +327,7 @@
 
     if( !cmdsrunning++ )
         istat = signal( SIGINT, onintr );
-
+
     /* Start the command */
     {
         SECURITY_ATTRIBUTES sa
@@ -406,8 +406,8 @@
             string_new( &cmdtab[ slot ].target );
         }
         string_copy( &cmdtab[ slot ].command, command_orig );
-
- /* put together the command to run */
+
+ /* put together the comman we run */
         {
             char ** argp = argv;
             string_new(&cmd);
@@ -418,7 +418,7 @@
                 string_append(&cmd,*(argp++));
             }
         }
-
+
         /* create the output buffers */
         string_new( &cmdtab[ slot ].buffer_out );
         string_new( &cmdtab[ slot ].buffer_err );
@@ -442,7 +442,7 @@
             perror( "CreateProcess" );
             exit( EXITBAD );
         }
-
+
         /* clean up temporary stuff */
         string_free(&cmd);
     }
@@ -453,7 +453,7 @@
     while( cmdsrunning >= MAXJOBS || cmdsrunning >= globs.jobs )
         if( !execwait() )
             break;
-
+
     if (argv != argv_static)
     {
         free_argv(argv);
@@ -475,7 +475,7 @@
 
     if( !cmdsrunning )
         return 0;
-
+
     /* wait for a command to complete, while snarfing up any output */
     do
     {
@@ -489,13 +489,13 @@
         if ( i < 0 ) i = try_kill_one();
     }
     while ( i < 0 );
-
+
     /* we have a command... process it */
     --cmdsrunning;
     {
         timing_info time;
         int rstat;
-
+
         /* the time data for the command */
         record_times(cmdtab[i].pi.hProcess, &time);
 
@@ -514,7 +514,7 @@
             rstat = EXEC_CMD_FAIL;
         else
             rstat = EXEC_CMD_OK;
-
+
         /* output the action block */
         out_action(
             cmdtab[i].action.size > 0 ? cmdtab[i].action.value : 0,
@@ -533,7 +533,7 @@
             &time,
             cmdtab[i].command.value,
             cmdtab[i].buffer_out.value );
-
+
         /* clean up the command data, process, etc. */
         string_free(&cmdtab[i].action); string_new(&cmdtab[i].action);
         string_free(&cmdtab[i].target); string_new(&cmdtab[i].target);
@@ -566,7 +566,7 @@
     OSVERSIONINFO os_info;
     os_info.dwOSVersionInfoSize = sizeof(os_info);
     GetVersionEx(&os_info);
-
+
     return (os_info.dwMajorVersion == 3)
         ? 996 /* NT 3.5.1 */
         : 2047 /* NT >= 4.x */
@@ -595,7 +595,7 @@
     /* drop leading and trailing whitespace if any */
     while (isspace(*string))
         ++string;
-
+
     src_len = strlen( string );
     while ( src_len > 0 && isspace( string[src_len - 1] ) )
         --src_len;
@@ -617,7 +617,7 @@
         BJAM_FREE( line );
         return 0;
     }
-
+
     /* Strip quotes from the first command-line argument and find
      * where it ends. Quotes are illegal in Win32 pathnames, so we
      * don't need to worry about preserving escaped quotes here.
@@ -644,7 +644,7 @@
     argv[1] = dst;
 
     /* Copy the rest of the arguments verbatim */
-
+
     src_len -= src - string;
 
     /* Use strncat because it appends a trailing nul */
@@ -652,7 +652,7 @@
     strncat(dst, src, src_len);
 
     argv[2] = 0;
-
+
     return argv;
 }
 
@@ -670,14 +670,14 @@
 long can_spawn(char* command)
 {
     char *p;
-
+
     char inquote = 0;
 
     /* Move to the first non-whitespace */
     command += strspn( command, " \t" );
 
     p = command;
-
+
     /* Look for newlines and unquoted i/o redirection */
     do
     {
@@ -695,7 +695,7 @@
             if (*p)
                 return 0;
             break;
-
+
         case '"':
         case '\'':
             if (p > command && p[-1] != '\\')
@@ -705,10 +705,10 @@
                 else if (inquote == 0)
                     inquote = *p;
             }
-
+
             ++p;
             break;
-
+
         case '<':
         case '>':
         case '|':
@@ -794,7 +794,7 @@
 static void record_times(HANDLE process, timing_info* time)
 {
     FILETIME creation, exit, kernel, user;
-
+
     if (GetProcessTimes(process, &creation, &exit, &kernel, &user))
     {
         time->system = filetime_seconds(kernel);
@@ -815,7 +815,7 @@
 {
     DWORD bytesInBuffer = 0;
     DWORD bytesAvailable = 0;
-
+
     do
     {
         /* check if we have any data to read */
@@ -823,7 +823,7 @@
         {
             bytesAvailable = 0;
         }
-
+
         /* read in the available data */
         if ( bytesAvailable > 0 )
         {
@@ -872,7 +872,7 @@
 static void read_output()
 {
     int i;
-
+
     for ( i = 0; i < globs.jobs && i < MAXJOBS; ++i )
     {
         /* read stdout data */
@@ -912,7 +912,7 @@
             active_procs[num_active] = i;
             num_active += 1;
         }
-
+
         /* wait for a child to complete, or for our timeout window to expire */
         if ( waiting )
         {
@@ -920,7 +920,7 @@
             waiting = 0;
         }
     }
-
+
     return -1;
 }
 
@@ -930,7 +930,7 @@
     if ( globs.timeout > 0 )
     {
         int i;
-
+
         for ( i = 0; i < globs.jobs; ++i )
         {
             double t = running_time(cmdtab[i].pi.hProcess);
@@ -1040,7 +1040,7 @@
         pid = get_process_id(process);
     }
     process_snapshot_h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
-
+
     if (INVALID_HANDLE_VALUE != process_snapshot_h)
     {
         BOOL ok = TRUE;
@@ -1078,9 +1078,9 @@
     return 0.0;
 }
 
-/* Recursive check if first process is parent (directly or indirectly) of
+/* Recursive check if first process is parent (directly or indirectly) of
 the second one. Both processes are passed as process ids, not handles.
-Special return value 2 means that the second process is smss.exe and its
+Special return value 2 means that the second process is smss.exe and its
 parent process is System (first argument is ignored) */
 static int is_parent_child(DWORD parent, DWORD child)
 {
@@ -1098,21 +1098,21 @@
         PROCESSENTRY32 pinfo;
         pinfo.dwSize = sizeof(PROCESSENTRY32);
         for (
- ok = Process32First(process_snapshot_h, &pinfo);
- ok == TRUE;
+ ok = Process32First(process_snapshot_h, &pinfo);
+ ok == TRUE;
             ok = Process32Next(process_snapshot_h, &pinfo) )
         {
             if (pinfo.th32ProcessID == child)
             {
                 /*
- Unfortunately, process ids are not really unique. There might
+ Unfortunately, process ids are not really unique. There might
                 be spurious "parent and child" relationship match between
                 two non-related processes if real parent process of a given
- process has exited (while child process kept running as an
- "orphan") and the process id of such parent process has been
- reused by internals of the operating system when creating
+ process has exited (while child process kept running as an
+ "orphan") and the process id of such parent process has been
+ reused by internals of the operating system when creating
                 another process. Thus additional check is needed - process
- creation time. This check may fail (ie. return 0) for system
+ creation time. This check may fail (ie. return 0) for system
                 processes due to insufficient privileges, and that's OK. */
                 double tchild = 0.0;
                 double tparent = 0.0;
@@ -1122,17 +1122,17 @@
 
                 /* csrss.exe may display message box like following:
                     xyz.exe - Unable To Locate Component
- This application has failed to start because
- boost_foo-bar.dll was not found. Re-installing the
+ This application has failed to start because
+ boost_foo-bar.dll was not found. Re-installing the
                     application may fix the problem
                 This actually happens when starting test process that depends
- on a dynamic library which failed to build. We want to
+ on a dynamic library which failed to build. We want to
                 automatically close these message boxes even though csrss.exe
                 is not our child process. We may depend on the fact that (in
- all current versions of Windows) csrss.exe is directly
+ all current versions of Windows) csrss.exe is directly
                 child of smss.exe process, which in turn is directly child of
                 System process, which always has process id == 4 .
- This check must be performed before comparison of process
+ This check must be performed before comparison of process
                 creation time */
                 if (stricmp(pinfo.szExeFile, "csrss.exe") == 0
                     && is_parent_child(parent, pinfo.th32ParentProcessID) == 2)
@@ -1152,7 +1152,7 @@
                     {
                         tchild = creation_time(hchild);
                         tparent = creation_time(hparent);
-
+
                         CloseHandle(hparent);
                     }
                     CloseHandle(hchild);
@@ -1193,14 +1193,14 @@
 
     if (!GetClassNameA(hwnd, buf, sizeof(buf)))
         return TRUE; /* failed to read class name; presume it's not a dialog */
-
+
     if (strcmp(buf, "#32770") != 0)
         return TRUE; /* not a dialog */
 
     /* GetWindowThreadProcessId returns 0 on error, otherwise thread id
     of window message pump thread */
     tid = GetWindowThreadProcessId(hwnd, &pid);
-
+
     if (tid && is_parent_child(p.pid, pid))
     {
         /* ask really nice */
@@ -1211,7 +1211,7 @@
             PostThreadMessageA(tid, WM_QUIT, 0, 0);
             WaitForSingleObject(p.h, 300);
         }
-
+
         /* done, we do not want to check any other window now */
         return FALSE;
     }
@@ -1222,7 +1222,7 @@
 static void close_alert(HANDLE process)
 {
     DWORD pid = get_process_id(process);
- /* If process already exited or we just cannot get its process id, do not
+ /* If process already exited or we just cannot get its process id, do not
     go any further */
     if (pid)
     {

Modified: trunk/tools/jam/src/make1.c
==============================================================================
--- trunk/tools/jam/src/make1.c (original)
+++ trunk/tools/jam/src/make1.c 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
@@ -751,39 +751,10 @@
                 outf_double(time->system) ) );
 
         /* output ? :: the output of the action command */
- {
- // Split command output into separate lines. We consider both \n and
- // \r\n to be valid newline sequences.
- LIST* output_lines = L0;
- if ( command_output )
- {
- char * line = command_output;
- char index = 0;
- while ( line[index] )
- {
- if ( line[index] != '\r' )
- ++index;
- else
- {
- int next = index + 1;
- if ( line[next] == '\n' ) ++next;
- {
- char temp_char = line[index];
- line[index] = 0;
- output_lines = list_new(output_lines, newstr(line));
- line[index] = temp_char;
- }
- index = 0;
- line += next;
- }
- }
- // Check for the case when there is no trailing newline
- // sequence.
- if ( index )
- output_lines = list_new(output_lines, newstr(line));
- }
- lol_add(frame->args, output_lines);
- }
+ if (command_output)
+ lol_add(frame->args, list_new(L0, newstr(command_output)));
+ else
+ lol_add(frame->args, L0);
 
         /* Call the rule. */
         evaluate_rule( action_rule->string, frame );

Modified: trunk/tools/jam/src/regexp.c
==============================================================================
--- trunk/tools/jam/src/regexp.c (original)
+++ trunk/tools/jam/src/regexp.c 2008-01-08 23:31:58 EST (Tue, 08 Jan 2008)
@@ -345,7 +345,7 @@
         }
 
         /* Make a closing node, and hook it on the end. */
- ender = regnode((paren) ? CLOSE+parno : END);
+ ender = regnode((paren) ? CLOSE+parno : END);
         regtail(ret, ender);
 
         /* Hook the tails of the branches to the closing node. */
@@ -574,7 +574,7 @@
                  * On entry, the char at regparse[-1] is going to go
                  * into the string, no matter what it is. (It could be
                  * following a \ if we are entered from the '\' case.)
- *
+ *
                  * Basic idea is to pick up a good char in ch and
                  * examine the next char. If it's *+? then we twiddle.
                  * If it's \ then we frozzle. If it's other magic char
@@ -629,7 +629,7 @@
                                         default:
                                                 /* Backup point is \, scan * point is after it. */
                                                 regprev = regparse;
- regparse++;
+ regparse++;
                                                 continue; /* NOT break; */
                                         }
                                 }
@@ -1165,6 +1165,7 @@
         register char op = EXACTLY; /* Arbitrary non-END op. */
         register char *next;
 
+
         s = r->program + 1;
         while (op != END) { /* While that wasn't END last time... */
                 op = OP(s);
@@ -1172,7 +1173,7 @@
                 next = regnext(s);
                 if (next == NULL) /* Next ptr. */
                         printf("(0)");
- else
+ else
                         printf("(%d)", (s-r->program)+(next-s));
                 s += 3;
                 if (op == ANYOF || op == ANYBUT || op == EXACTLY) {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk