LLVM API Documentation

Program.cpp

Go to the documentation of this file.
00001 //===-- Program.cpp - Implement OS Program Concept --------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This header file implements the operating system Program concept.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "llvm/System/Program.h"
00015 #include "llvm/Config/config.h"
00016 
00017 namespace llvm {
00018 using namespace sys;
00019 
00020 //===----------------------------------------------------------------------===//
00021 //=== WARNING: Implementation here must contain only TRULY operating system
00022 //===          independent code.
00023 //===----------------------------------------------------------------------===//
00024 
00025 int
00026 Program::ExecuteAndWait(const Path& path,
00027                         const char** args,
00028                         const char** envp,
00029                         const Path** redirects,
00030                         unsigned secondsToWait,
00031                         unsigned memoryLimit,
00032                         std::string* ErrMsg) {
00033   Program prg;
00034   if (prg.Execute(path, args, envp, redirects, memoryLimit, ErrMsg))
00035     return prg.Wait(secondsToWait, ErrMsg);
00036   else
00037     return -1;
00038 }
00039 
00040 void
00041 Program::ExecuteNoWait(const Path& path,
00042                        const char** args,
00043                        const char** envp,
00044                        const Path** redirects,
00045                        unsigned memoryLimit,
00046                        std::string* ErrMsg) {
00047   Program prg;
00048   prg.Execute(path, args, envp, redirects, memoryLimit, ErrMsg);
00049 }
00050 
00051 
00052 }
00053 
00054 // Include the platform-specific parts of this class.
00055 #ifdef LLVM_ON_UNIX
00056 #include "Unix/Program.inc"
00057 #endif
00058 #ifdef LLVM_ON_WIN32
00059 #include "Win32/Program.inc"
00060 #endif