Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PProcess::PProcess ( const char *  manuf = "",
const char *  name = "",
WORD  majorVersion = 1,
WORD  minorVersion = 0,
CodeStatus  status = ReleaseCode,
WORD  buildNumber = 1 
)

Create a new process instance.

Parameters:
manufName of manufacturer
nameName of product
majorVersionMajor version number of the product
minorVersionMinor version number of the product
statusDevelopment status of the product
buildNumberBuild number of the product

Definition at line 1934 of file osutils.cxx.

References PTrace::Blocks, PFile::Exists(), PTrace::FileAndLine, PFilePath::GetTitle(), PTrace::Initialise(), PString::IsEmpty(), PArgList::ReadFrom(), PArgList::SetArgs(), PTrace::Thread, PTrace::Timestamp, and PString::ToLower().

  : manufacturer(manuf), productName(name)
{
  PProcessInstance = this;
  terminationValue = 0;

  majorVersion = major;
  minorVersion = minor;
  status = stat;
  buildNumber = build;

  // This flag must never be destroyed before it is finished with. As we
  // cannot assure destruction at the right time we simply allocate it and
  // NEVER destroy it! This is OK as the only reason for its destruction is
  // the program is exiting and then who cares?
#if PMEMORY_CHECK
  BOOL ignoreAllocations = PMemoryHeap::SetIgnoreAllocations(TRUE);
#endif
  PTraceMutex = new PMutex;
#if PMEMORY_CHECK
  PMemoryHeap::SetIgnoreAllocations(ignoreAllocations);
#endif

#ifndef P_RTEMS
  if (p_argv != 0 && p_argc > 0) {
    arguments.SetArgs(p_argc-1, p_argv+1);

    executableFile = PString(p_argv[0]);
    if (!PFile::Exists(executableFile)) {
      PString execFile = executableFile + ".exe";
      if (PFile::Exists(execFile))
        executableFile = execFile;
    }

    if (productName.IsEmpty())
      productName = executableFile.GetTitle().ToLower();
  }
#else
  cout << "Enter program arguments:\n";
  arguments.ReadFrom(cin);
#endif

  InitialiseProcessThread();

  Construct();
  
#ifdef __MACOSX__
  
#ifdef HAS_VIDEO
  PWLibStupidOSXHacks::loadFakeVideoStuff = 1;
#ifdef USE_SHM_VIDEO_DEVICES
  PWLibStupidOSXHacks::loadShmVideoStuff = 1;
#endif // USE_SHM_VIDEO_DEVICES
#endif // HAS_VIDEO
  
#ifdef HAS_AUDIO
  PWLibStupidOSXHacks::loadCoreAudioStuff = 1;
#endif // HAS_AUDIO
  
#endif // __MACOSX__

  // create one instance of each class registered in the 
  // PProcessStartup abstract factory
  PProcessStartupList & startups = GetPProcessStartupList();
  {
    PProcessStartup * levelSet = PFactory<PProcessStartup>::CreateInstance("SetTraceLevel");
    if (levelSet != NULL) 
      levelSet->OnStartup();
    else {
      char * env = ::getenv("PWLIB_TRACE_STARTUP");
      if (env != NULL) 
        PTrace::Initialise(atoi(env), NULL, PTrace::Blocks | PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine);
    }

    PProcessStartupFactory::KeyList_T list = PProcessStartupFactory::GetKeyList();
    PProcessStartupFactory::KeyList_T::const_iterator r;
    for (r = list.begin(); r != list.end(); ++r) {
      if (*r != "SetTraceLevel") {
        PProcessStartup * instance = PProcessStartupFactory::CreateInstance(*r);
        instance->OnStartup();
        startups.insert(std::pair<PString, PProcessStartup *>(*r, instance));
      }
    }
  }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index