Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

driver2.cpp File Reference

One of the original OpenC++ source files, considerably modified by Josef Troch. More...

#include <stdio.h>
#include <fstream.h>
#include <string.h>
#include "StdString.h"
#include <windows.h>
#include <process.h>
#include <fcntl.h>
#include <io.h>
#include <direct.h>
#include "occCommon.h"

Include dependency graph for driver2.cpp:

Include dependency graph


#define PREPROCESSOR_EXT   ".i"
#define TRANSLATOR_EXT   ".occ"
#define is_blank(c)   ((c) == ' ' || (c) == '\t' || (c) == '\f' || (c) == '\r' || (c) == '\n')


void SetTargetDirectory (const char *dirPath)
const char * GetTargetDirectory ()
void ParseCmdOptions (int from, int argc, char **argv, char *&source)
void AddCppOption (const char *arg)
void AddCcOption (const char *arg)
void CloseCcOptions ()
bool IsCxxSource (char *fname)
void ShowCommandLine (const char *cmd, const char **args)
void RunLinker ()
char * RunPreprocessor (const char *src)
char * OpenCxxOutputFileName (const char *src)
void RunCompiler (const char *src, const char *occsrc)
void RunSoCompiler (const char *src_file)
void BaseClassUsed (char *name, int len)
void * LoadSoLib (char *file_name)
void * LookupSymbol (void *handle, char *symbol)
bool ParseTargetSpecificOptions (char *arg, char *&source_file)
int Launch (const char *tool, const char *const *argv)
char * MakeTempFilename (const char *src, const char *suffix)
void ParseFileOptions (const char *filename, char *&source_file)
void File2Args (const char *fname, int max, int &argc, char *argv[])
void String2Args (const char *str, int max, int &argc, char *argv[])
char * NewArg (const char *from, size_t size, int argc, int max)
void ParseBackslash (char arg[], size_t &i, const char *&string)
void ParseDoubleQuote (char arg[], size_t &i, const char *&string)
void AddCc2Option (const char *arg)


const char * compilerName = "cl"
char targetDrive [_MAX_DRIVE] = ""
char targetDir [_MAX_DIR] = ""
bool showProgram
bool doCompile
bool makeExecutable
bool doPreprocess
bool doTranslate
bool verboseMode
bool regularCpp
bool makeSharedLibrary
const int NARGS
int cppArgc
int ccArgc
int cc2Argc
const char * cppArgv []
const char * ccArgv []
const char * cc2Argv []
const  NLIBS = 32
int libsArgc = 0
const char * libsArgv [NLIBS]
const  NLINKERARGS = 32
int linkerArgc = 0
bool linkerFlag = FALSE
char * linkerArgv [NLINKERARGS]

Detailed Description

One of the original OpenC++ source files, considerably modified by Josef Troch.

This file contains platform dependent functions of the original OpenC++ plus a few new platform dependent functions added by Josef Troch.

Functions from this file are used on Windows / MSVC platform. The same functions for Linux / gcc platform can be found in driver2l.cpp.

Only functions added or modified by Josef Troch are commented.

Define Documentation

#define PREPROCESSOR_EXT   ".i"

Extension of files generated by preprocessor.

#define TRANSLATOR_EXT   ".occ"

Extension of files that are the results of IOPC SP / OpenC++ translation.

#define is_blank  )     ((c) == ' ' || (c) == '\t' || (c) == '\f' || (c) == '\r' || (c) == '\n')

Function Documentation

void SetTargetDirectory const char *  dirPath  ) 

Sets drive and directory (targetDrive, targetDir) into which files generated by IOPC SP / OpenC++ should be placed.

const char* GetTargetDirectory  ) 

Gets path into which files generated by IOPC SP / OpenC++ should be placed. See SetTargetDirectory().

void ParseCmdOptions int  from,
int  argc,
char **  argv,
char *&  source

void AddCppOption const char *  arg  ) 

void AddCcOption const char *  arg  ) 

void CloseCcOptions  ) 

bool IsCxxSource char *  fname  ) 

void ShowCommandLine const char *  cmd,
const char **  args

void RunLinker  ) 

char* RunPreprocessor const char *  file_in  ) 

Runs preprocessor on file_in.

Because MSVC preprocessor (cl.exe) is unable to generate preprocessed files into specified directory, redirection of standard input is used.

Name of the file that contains preprocessor output. (The name is generated using MakeTempFilename().)
See also:
PREPROCESSOR_EXT, SetTargetDirectory()

char* OpenCxxOutputFileName const char *  src  ) 

void RunCompiler const char *  org_src,
const char *  file_in

Runs compiler (MSVC / cl.exe) on file_in.

Sends the compiler the parameters specified when executing IOPC SP / OpenC++ (only the "compiler" options). Adds to them some parameters specified by IOPC SP / OpenC++ options, if called from IOPC SP adds some parameters needed for translated source to compile (support for RTTI etc.)

org_src The original (not translated) C++ source file name. Used in OpenC++ if generating shared library.
file_in Name of the translated C++ source file - input for the compiler.
See also:

void RunSoCompiler const char *  src_file  ) 

void BaseClassUsed char *  name,
int  len

lt_dlhandle LoadSoLib char *  file_name  ) 

void * LookupSymbol void *  handle,
char *  symbol

bool ParseTargetSpecificOptions char *  arg,
char *&  source_file

int Launch const char *  tool,
const char *const *  argv

char * MakeTempFilename const char *  src,
const char *  suffix

Creates temporary filename from given filename (src) and extension (suffix).

Rewritten by JT - uses targetDir and targetDrive now.

See also:
The filename.

void ParseFileOptions const char *  filename,
char *&  source_file

void File2Args const char *  fname,
int  max,
int &  argc,
char *  argv[]

void String2Args const char *  str,
int  max,
int &  argc,
char *  argv[]

char * NewArg const char *  from,
size_t  size,
int  argc,
int  max

void ParseBackslash char  arg[],
size_t &  i,
const char *&  string

void ParseDoubleQuote char  arg[],
size_t &  i,
const char *&  string

void AddCc2Option const char *  arg  ) 

Variable Documentation

const char* compilerName = "cl"

char targetDrive[_MAX_DRIVE] = ""

Drive on which files generated by IOPC SP / OpenC++ should be placed.

char targetDir[_MAX_DIR] = ""

Directory into which files generated by IOPC SP / OpenC++ should be placed.

bool showProgram

bool doCompile

bool makeExecutable

bool doPreprocess

bool doTranslate

bool verboseMode

bool regularCpp

bool makeSharedLibrary

const int NARGS

int cppArgc

int ccArgc

int cc2Argc

const char* cppArgv[]

const char* ccArgv[]

const char* cc2Argv[]

const NLIBS = 32

int libsArgc = 0 [static]

const char* libsArgv[NLIBS]

const NLINKERARGS = 32

int linkerArgc = 0 [static]

bool linkerFlag = FALSE [static]

char* linkerArgv[NLINKERARGS]

Generated on Wed Aug 11 22:33:46 2004 for IOPC by Doxygen 1.3.6