Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
toolpaths.h File Reference
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include "../topsrcdir.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define WCE_BIN   "c:/Program Files/Microsoft Visual Studio 8/VC/ce/bin/x86_arm/"
#define WCE_INC   "c:/Program Files/Microsoft Visual Studio 8/SmartDevices/SDK/PocketPC2003/Include"
#define WCE_LIB   "c:/Program Files/Microsoft Visual Studio 8/SmartDevices/SDK/PocketPC2003/Lib/armv4"
#define SHUNT_LIB   TOPSRCDIR "/build/wince/shunt/build/vs8/"
#define SHUNT_INC   TOPSRCDIR "/build/wince/shunt/include/"
#define ASM_PATH   WCE_BIN "armasm.exe"
#define CL_PATH   WCE_BIN "cl.exe"
#define LIB_PATH   WCE_BIN "lib.exe"
#define LINK_PATH   WCE_BIN "link.exe"
#define MAX_NOLEAK_BUFFERS   100

Functions

int argpath_conv (char **args_in, char **args_out)
void dumpargs (char **args)
void run (char **args)

Variables

char noleak_buffers [MAX_NOLEAK_BUFFERS][1024]
static int next_buffer = 0

Define Documentation

#define ASM_PATH   WCE_BIN "armasm.exe"

Definition at line 35 of file toolpaths.h.

#define CL_PATH   WCE_BIN "cl.exe"

Definition at line 36 of file toolpaths.h.

#define LIB_PATH   WCE_BIN "lib.exe"

Definition at line 37 of file toolpaths.h.

#define LINK_PATH   WCE_BIN "link.exe"

Definition at line 38 of file toolpaths.h.

Definition at line 40 of file toolpaths.h.

#define SHUNT_INC   TOPSRCDIR "/build/wince/shunt/include/"

Definition at line 33 of file toolpaths.h.

#define SHUNT_LIB   TOPSRCDIR "/build/wince/shunt/build/vs8/"

Definition at line 32 of file toolpaths.h.

#define WCE_BIN   "c:/Program Files/Microsoft Visual Studio 8/VC/ce/bin/x86_arm/"

Definition at line 9 of file toolpaths.h.

#define WCE_INC   "c:/Program Files/Microsoft Visual Studio 8/SmartDevices/SDK/PocketPC2003/Include"

Definition at line 26 of file toolpaths.h.

#define WCE_LIB   "c:/Program Files/Microsoft Visual Studio 8/SmartDevices/SDK/PocketPC2003/Lib/armv4"

Definition at line 27 of file toolpaths.h.


Function Documentation

int argpath_conv ( char **  args_in,
char **  args_out 
)

Definition at line 44 of file toolpaths.h.

{
  int i = 0;

  while (args_in[i])
  {
    args_out[i] = args_in[i];

    if (args_in[i])
    {
      char *offset = strstr(args_out[i], "/cygdrive/");
      
      if (offset) {
      
        strcpy(offset, offset+9);
        offset[0] = offset[1];
        offset[1] = ':';
        offset[2] = '/';
      }

      if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
           (args_out[i][1] == 'D'))
      {

        offset = strstr(args_out[i]+2, "=");
        if (offset)
        {
          char* equalsChar = offset;
          
          if (equalsChar[1] == '"')
          {
            *equalsChar = '\0';
     
            strcpy(noleak_buffers[next_buffer], args_out[i]);        
            
            *equalsChar = '=';
            
            strcat(noleak_buffers[next_buffer], "=\\\"");
            strcat(noleak_buffers[next_buffer], equalsChar+1);
            strcat(noleak_buffers[next_buffer], "\\\"");
            
            args_out[i] = noleak_buffers[next_buffer];
            
            next_buffer++;
            
            if (next_buffer > MAX_NOLEAK_BUFFERS) {
              printf("next_buffer>MAX_NOLEAK_BUFFERS\n");
              exit(-1);
            }
          }
        }
      }
    }
    i++;
  }
  args_out[i] = NULL;
  return i;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dumpargs ( char **  args)

Definition at line 103 of file toolpaths.h.

{
  int i = 0;

  if (args[0] == NULL)
    printf(":: first element is null!\n");

  while(args[i])
    printf("%s ", args[i++]);

  printf("\n");
  fflush(stdout);
  fflush(stderr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void run ( char **  args)

Definition at line 119 of file toolpaths.h.

{

  STARTUPINFO si;
  PROCESS_INFORMATION pi;

  char theArgs[1024*16];

  int totalLen = 0;
  int i, j;


  // Clear any link env variable that might get us tangled up
  _putenv("LINK=");
  _putenv("LIBPATH=");
  _putenv("CC=");

  _putenv("INCLUDE=" WCE_INC);
  _putenv("LIB=" WCE_LIB);
  
  for (j=1; args[j]; j++)
  {
    int len = strlen(args[j]);
    strcat(&theArgs[totalLen], args[j]);
    totalLen += len;
    
    strcat(&theArgs[totalLen], " ");
    totalLen++;
  }
  
  i = strlen(args[0]);
  for (j=0; j<i; j++)
  {
    if (args[0][j] == '/')
      args[0][j] = '\\';
  }
  
  ZeroMemory( &si, sizeof(si) );
  si.cb = sizeof(si);
  ZeroMemory( &pi, sizeof(pi));
  
  CreateProcess(args[0],
                theArgs,
                NULL,
                NULL,
                0,
                0,
                NULL,
                NULL,
                &si,              // Pointer to STARTUPINFO structure.
                &pi);
  
  
  // Wait until child process exits.
  WaitForSingleObject( pi.hProcess, INFINITE );
  
  // Close process and thread handles. 
  CloseHandle( pi.hProcess );
  CloseHandle( pi.hThread );
}

Here is the caller graph for this function:


Variable Documentation

int next_buffer = 0 [static]

Definition at line 42 of file toolpaths.h.

Definition at line 41 of file toolpaths.h.