Пример #1
0
void TestOperators()
{
	WriteHeader("Non-assignment operators");
	ibVec3 a(1, 2, 3), b(4,2,3);
	ibMtx3 mtx( 2.f, 0, 1, 1, .5f, 0, 0, 0, 1 );
	fout << "A + B: " << a + b << std::endl;
	fout << "A - B: " << a - b << std::endl;
	fout << "A * 2: " << a * 2 << std::endl;
	fout << "2A: " << 2 * a << std::endl;
	fout << "A * B: " << a * b << std::endl;
	fout << "A * M: " << a * mtx << std::endl;

	WriteHeader("Assignment operators");
	fout << "A + B: " << (a += b) << std::endl;
	a -= b;
	fout << "A - B: " << (a -= b) << std::endl;
	a += b;
	fout << "A * 2: " << (a *= 2) << std::endl;
	a *= .5f;
	fout << "A * M: " << (a *= mtx) << std::endl;

	WriteHeader("Comparison operators");
	fout << "A == A: " << (a == a) << std::endl;
	fout << "A != A: " << (a != a) << std::endl;
	fout << "A == B: " << (a == b) << std::endl;
	fout << "A != B: " << (a != b) << std::endl;
}
Пример #2
0
void Outbox::WritePacket(const Packet &packet, bool reliable)
{
	if (!reliable)
	{
		if (packetCountUnreliable == 0)
		{
			// Write packet header
			outgoingBufferUnreliable.Reset();
			WriteHeader(1, reliable);

			outgoingBufferUnreliable.WriteHeader(headerBufferUnreliable);
		}

		packet.WriteToBuffer(outgoingBufferUnreliable);
		packetCountUnreliable++;
	}
	else
	{
		if (packetCountReliable == 0)
		{
			// Write packet header
			outgoingBufferReliable.Reset();
			WriteHeader(1, reliable);

			outgoingBufferReliable.WriteHeader(headerBufferReliable);
		}

		packet.WriteToBuffer(outgoingBufferReliable);
		packetCountReliable++;
	}
}
Пример #3
0
void IcyConnector::ProcessHeaders(const QString &hdrs)
{
    QStringList f0;
    QStringList f1;
    QString txt;

    f0=hdrs.split("\r\n");
    if(f0[0]!="OK2") {
        Log(LOG_WARNING,
            QString().sprintf("login to \"%s:%d\" rejected: %s",
                              (const char *)hostHostname().toUtf8(),
                              0xFFFF&hostPort(),
                              (const char *)f0[0].toUtf8()));
        return;
    }
    icy_authenticated=true;
    WriteHeader("icy-name: "+streamName());
    WriteHeader("icy-genre: "+streamGenre());
    WriteHeader("icy-pub: "+QString().sprintf("%d",streamPublic()));
    WriteHeader("icy-br: "+QString().sprintf("%u",audioBitrate()));
    if(icy_protocol_version==1) {
        WriteHeader("icy-url: "+streamUrl());
    }
    WriteHeader("icy-irc: "+streamIrc());
    WriteHeader("icy-icq: "+streamIcq());
    WriteHeader("icy-aim: "+streamAim());
    WriteHeader("Content-Type: "+contentType());
    WriteHeader("");

    setConnected(true);
}
Пример #4
0
int GameMain()
{
	WriteStandardPaths();

	EnumDirs();
	WriteHeader("EnumFiles: kPath_Data");
	EnumFiles(kPath_Data);
	WriteHeader("EnumFiles: kPath_UserSave");
	EnumFiles(kPath_UserSave);

	{
		ibFile<char> inFile = TestOpenData();
		ibFile<char> outFile = TestOpenUser(inFile.Size());
		while (!inFile.IsReady()) {}
		if (!outFile.IsReady())
			fout << "Outfile ready check failed!" << std::endl;
		else
		{
			ibMemcpy(outFile.GetData(), inFile.GetData(), outFile.Size());
			outFile.WriteFile();
		}
		while (!outFile.IsReady()) {}
	}

	fout.flush();
	Sleep(1000);
	fout.close();
	
	return 0;
}
Пример #5
0
void TTXTSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename, wxString const& encoding) const {
	// Convert to TTXT
	AssFile copy(*src);
	ConvertToTTXT(copy);

	// Create XML structure
	wxXmlDocument doc;
	wxXmlNode *root = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, "TextStream");
	root->AddAttribute("version", "1.1");
	doc.SetRoot(root);

	// Create header
	WriteHeader(root);

	// Create lines
	AssDialogue *prev = 0;
	for (LineList::iterator cur = copy.Line.begin(); cur != copy.Line.end(); ++cur) {
		AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
		if (current && !current->Comment) {
			WriteLine(root, prev, current);
			prev = current;
		}
		else
			throw TTXTParseError("Unexpected line type in TTXT file", 0);
	}

	// Save XML
	doc.Save(filename);
}
Пример #6
0
UInt16 OpenPrefsDatabase(void) {
  JMPalmPrefs = DmOpenDatabaseByTypeCreator(JMPalmPrefsType, JMPalmAppID,
					    dmModeReadWrite);

  // the database doesn't exist
  if (!JMPalmPrefs) {
    MemHandle foo;
    UInt16 position = 1;

    if (DmCreateDatabase(0, JMPalmPrefsName,
			 JMPalmAppID, JMPalmPrefsType, false))
      return true;
    
    JMPalmPrefs = DmOpenDatabaseByTypeCreator(JMPalmPrefsType, JMPalmAppID,
					      dmModeReadWrite);
		 		 
    ResetHeader();
    
    // create dummy record
    foo = DmNewRecord(JMPalmPrefs, &position, sizeof(headerdata));
    DmReleaseRecord(JMPalmPrefs, position, true);
    WriteHeader();

    // Do some special handling for the first run of the application
    HandleFirstRun();
  }

  return false;
}
Пример #7
0
 bool Write( ostream& out ) const { 
     return 
         WriteByteOrder( out ) && 
         WriteHeader( out ) && 
         WriteSignature( out ) && 
         WriteData( out ); 
 }
Пример #8
0
void BulkStorage_WriteClose(struct BulkStorage *b)
{
  if ( b == NULL ) {
    return;
  }
  if ( b->dirty != 0 ) {
    WritePage(b);
  }
  if ( b->marked != 0 ) {
    uint32_t image_hash = 0;
    uint32_t page_hash ;
    for ( uint32_t i = 1; i < b->token->number_pages ; i ++ ) {
      ReadPage(b,  i);
      page_hash = CalcCRC(b->data, DATAFLASH_PAGESIZE_NORMAL);
      image_hash ^= page_hash;      
    }
    b->head.hash = image_hash;
    b->head.timestamp = 0;
    b->marked = 0;
    WriteHeader(b->token, &b->head);
  }
  
  b->token = NULL;
  b->loaded_page = 0xFFFF;
  b->dirty = 0;
  b->write = 0;
}
Пример #9
0
void AskExit()
{
	if(CheckIfModified()==TRUE)
	{
		SetColor(LIGHTWHITE);
		SetBackColor(RED);
		OpenWindow(10,24,5,32);
		SetColor(YELLOW);
		Print_At(11,29,"Apply Changes on Exit?");
		SetColor(BLUE);
		SetBackColor(WHITE);
		SetBlink(ON);
		Print_At(13,32," <Yes> ");
		Print_At(13,42," <No> ");
		SetBlink(OFF);
		GetKey();
	}
	CloseAllWindows();
	VideoReset();
	if(keycode!=ESC && keychar!='n' && keychar!='N')
		if(WriteHeader(&id32)!=0)
		{
			printf("%s could not write to file\n" ,errstr);
			exit(1);
		}
	CloseFile();
	exit(0);
}
Пример #10
0
int
OpenOut(char	    *filename,
	FieldList   list,
	int	    arch,
	FILE	    **file,
	Annot	    *annotate)
{
    FILE    *output;

    if (filename == NULL)
    {
	DebugMsg(1, "OpenOut: NULL file name.");
	return FALSE;
    }

    if (strcmp(filename, "-") == 0)
	output = stdout;
    else
	output = fopen(filename, "w");

    if (output == NULL)
    {
	DebugMsg(1, "OpenOut: couldn't open file.");
	return FALSE;
    }

    if (file != NULL)
	*file = output;

    return WriteHeader(list, arch, output, annotate);
}
void HuffmanTreeCoder::Compress()
{
    SetSymbolCodes();
    setReaderToBeginning();
    WriteHeader();
    EncodeSymbols();
}
Пример #12
0
void conv1213()
{
   long nper, i;
   long *buf;
   long kk = 0, f1, f2;

   MESSAGE(0,("Permutation on %d points\n",nor));
   buf = NALLOC(long,nor);
   if (buf == NULL) {
      MTX_ERROR("Cannot allocate permutation: %S");
      return;
   }
   WriteHeader(-fl,nor,noc);
   for (nper = noc; nper != 0; --nper) {
      for (i = 0; i < nor; ++i) {
         switch (mod) {
            case 12:
               kk = readlong();
               break;
            case 13:
               f1 = readlong();
               f2 = readlong();
               kk = (f1 - 1) * fl + f2 + 1;
               break;
         }
         buf[i] = kk;
      }
      if (SysWriteLong(out,buf,nor) != nor) {
         MTX_ERROR1("Cannot write %s: %S",outname);
      }
   }
}
Пример #13
0
static void ConvertPermutation()
{
   long i;
   long *buf;
   long kk;

   MESSAGE(0,("Permutation on %d points\n",nor));
   buf = NALLOC(long,nor);
   if (buf == NULL) {
      MTX_ERROR("Cannot allocate permutation: %S");
   }
   WriteHeader(-1,nor,1);

   for (i = 0; i < nor; ++i) {
      kk = readlong();
      buf[i] = kk - 1;
      if ((kk < 1) || (kk > nor)) {
         MTX_ERROR3("%s: Invalid point %d in permutation of degree %d",
                    inpname,(int)kk,nor);
      }
   }
   if (SysWriteLong(out,buf,nor) != nor) {
      MTX_ERROR1("Cannot write to %s",outname);
   }
}
Пример #14
0
const bool AreaLight::Write(std::ostream &stream) const
{
    if( !WriteHeader( stream, "AreaLight" ) )
        return false;

    Indent();
    {
        // Write the base
        if( !Light::Write( stream ) )
            return false;

        if( !WriteVariable( stream, "vertex1", _v1 )                                ||
            !WriteVariable( stream, "vertex2", _v2 )                                ||
            !WriteVariable( stream, "vertex3", _v3 )                                ||
            !WriteVariable( stream, "numHorizontalSamples", _numHorizontalSamples ) ||
            !WriteVariable( stream, "numVerticalSamples", _numVerticalSamples )     )
            return false;
    }
    Unindent();

    if( !WriteFooter( stream, "AreaLight" ) )
        return false;

    return true;
}
Пример #15
0
bool ResourceWriter::Write()
{
  if (!WriteHeader())
  {
    std::cerr << "Could not write header." << std::endl;
    return false;
  }
  if (!WritePayloads())
  {
    std::cerr << "Could not write data blobs." << std::endl;
    return false;
  }
  if (!WriteNames())
  {
    std::cerr << "Could not write file names." << std::endl;
      return false;
  }
  if (!WriteDataTree())
  {
    std::cerr << "Could not write data tree." << std::endl;
    return false;
  }
  if (!WriteRegistrationCode())
  {
    std::cerr << "Could not write footer" << std::endl;
    return false;
  }

  return true;
}
Пример #16
0
void Logger::CreateLogFiles()
{
	unsigned int i = 0;

	CloseLogFiles();

	for (i = 0; i < LOGFILES; i++)
	{
		QString strLogFile;

		while (true)
		{
			strLogFile = Q3FileDialog::getSaveFileName(QString::null, "Log Files (*.txt)", g_pMainWindow, "choose log file dialog", QString("Specify %1...").arg(g_strLogFileNames[i]));
			if (!strLogFile.isEmpty())
			{
				if ((m_pLogFiles[i] = fopen(strLogFile, "w")) == NULL)
				{
					if (!PromptLogError(PACKAGE_TITLE, QString("Could not open %1 for writing").arg(strLogFile), false))
						break; // ignore
				} else {
					WriteHeader(i);
					break;
				}
			} else
				break;
		}
	}
}
Пример #17
0
LONG __stdcall exception_filter(EXCEPTION_POINTERS* exceptionPtrs)
{
    LONG returnCode = EXCEPTION_CONTINUE_SEARCH;
    
    // Ignore multiple calls.
    if (s_inFilter != 0)
        return EXCEPTION_CONTINUE_EXECUTION;
    s_inFilter = 1;
    
    // Cannot really do much in case of stack overflow, it'll probably bomb soon 
    // anyway.
    if (exceptionPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW)
    {
        OutputDebugString("*** FATAL ERROR: EXCEPTION_STACK_OVERFLOW detected!");
    }
    const bool miniDumpOK = WriteMiniDump(exceptionPtrs, s_miniDumpFileName);

    FILE* f = ::fopen(s_reportFileName, "wt");
    WriteHeader(f);
    WriteExceptionInfo(f, exceptionPtrs);
    WriteCallStack(f, exceptionPtrs->ContextRecord);

    WriteEnvironmentInfo(f);
    MemoryStatus memStatus = MemoryStatus::GetCurrent();
    WriteMemoryStatus(f, memStatus);
    WriteRegisters(f, exceptionPtrs);
    WriteBlackBoxMessages(f);

    fprintf(f, (miniDumpOK ? "\nMini dump saved successfully.\n" : "\nFailed to save minidump.\n"));
    ::fclose(f);

    return returnCode;
}
Пример #18
0
	void Bitmap::Save(aiTexture* texture, IOStream* file) {
		if(file != NULL) {
			Header header;
			DIB dib;

			dib.size = DIB::dib_size;
			dib.width = texture->mWidth;
			dib.height = texture->mHeight;
			dib.planes = 1;
			dib.bits_per_pixel = 8 * mBytesPerPixel;
			dib.compression = 0;
			dib.image_size = (((dib.width * mBytesPerPixel) + 3) & 0x0000FFFC) * dib.height;
			dib.x_resolution = 0;
			dib.y_resolution = 0;
			dib.nb_colors = 0;
			dib.nb_important_colors = 0;

			header.type = 0x4D42; // 'BM'
			header.offset = Header::header_size + DIB::dib_size;
			header.size = header.offset + dib.image_size;
			header.reserved1 = 0;
			header.reserved2 = 0;

			WriteHeader(header, file);
			WriteDIB(dib, file);
			WriteData(texture, file);
		}
	}
Пример #19
0
void CLogEx::Flush()
{
	char str[10240] = {""};

	if (GetLineCount() == 0)
	{
		for (int i=0;i<(int)vecLogItem.size();i++)
		{
			strcat(str, vecLogItem[i].name);
			strcat(str, ",");
		}
		strcat(str, "\n");


		WriteHeader(str);
	}

	for (int i=0;i<(int)vecLogItem.size();i++)
	{			

		WriteLog("%s,", vecLogItem[i].str);	

	}
	WriteLog("\n");
}
Пример #20
0
void WriteResource(addr_t x)
{
	ResHeader *rh = (ResHeader *)x;

	long sType = htonl(rh->type);
	if (verbose) printf("Writing Resource. Type: %4.4s, id: %d, name: %s\n",
		(char*)&sType, rh->id, rh->name);

	if (gDump)
		fwrite(gResData, gResSize, 1, stdout);
	else if (gSaveAsHeader)
		WriteHeader(rh->type, rh->id, (unsigned char *)gResData, gResSize, rh->name);
	else
	{
		if (resFile->HasResource(rh->type, rh->id))
			resFile->RemoveResource(rh->type, rh->id);

		if (resFile->AddResource(rh->type, rh->id, gResData, gResSize, rh->name))
			error("writing resource");
	}

	gResSize = 0;
	free(gResData);
	gResData = NULL;
} /* WriteResource */
Пример #21
0
//********************************************
// SaveFile
//********************************************
int CSceneGraph3d::SaveFile(char *name)
{
	// Check
	if(NbObject() == 0)
	{
		AfxMessageBox("This scene does not contain meshes");
		return 0;
	}

	// Check for valid file
	CStdioFile file;
	CFileException ex;
	
	// Write header
	if(!WriteHeader(file,name))
	{
		AfxMessageBox("Error during writing header");
		return 0;
	}

	// Meshes
	for(int i=0;i<NbObject();i++)
	{
		CObject3d *pObject = m_ArrayObject3d[i];
		if(pObject->GetType() == TYPE_MESH3D)
			((CMesh3d *)pObject)->WriteFile(file);
	}

	// Close file
  file.Close();

	return 1;
}
Пример #22
0
/**
 * Creates
 * @param[in] lpFilename The filename
 * @param[in] nRate The sampling rate
 * @param[in] nBits The bits of the sample
 * @param[in] nChannels The number of the channels
 * @return The handle of wave
 */
WAVEFILEH wavefile_create(const OEMCHAR *lpFilename, UINT nRate, UINT nBits, UINT nChannels)
{
	FILEH fh = FILEH_INVALID;
	WAVEFILEH hWave = NULL;

	do
	{
		if (lpFilename == NULL)
		{
			break;
		}
		if (nRate == 0)
		{
			break;
		}
		if ((nBits != 8) && (nBits != 16))
		{
			break;
		}
		if ((nChannels != 1) && (nChannels != 2))
		{
			break;
		}

		fh = file_create(lpFilename);
		if (fh == FILEH_INVALID)
		{
			break;
		}

		hWave = (WAVEFILEH)_MALLOC(sizeof(*hWave), "WAVEFILEH");
		if (hWave == NULL)
		{
			break;
		}

		memset(hWave, 0, sizeof(*hWave));
		hWave->fh = fh;
		hWave->nRate = nRate;
		hWave->nBits = nBits;
		hWave->nChannels = nChannels;
		if (WriteHeader(hWave) != SUCCESS)
		{
			break;
		}
		hWave->lpCurrent = hWave->buffer;
		hWave->nRemain = sizeof(hWave->buffer);
		return hWave;
	} while (FALSE /*CONSTCOND*/);

	if (hWave)
	{
		_MFREE(hWave);
	}
	if (fh != FILEH_INVALID)
	{
		file_close(fh);
	}
	return NULL;
}
Пример #23
0
void EnPartCntSample::Init(pdb_setup::Atoms const& atoms,
                           config_setup::Output const& output)
{
   InitVals(output.statistics.settings.hist);
   if (enableOut)
   {
      stepsPerSample = output.state.files.hist.stepsPerHistSample;
      uint samplesPerFrame =
	 output.statistics.settings.hist.frequency / stepsPerSample + 1;
      samplesCollectedInFrame = 0;
      for (uint b = 0; b < BOXES_WITH_U_NB; ++b)
      {
         name[b] = GetFName(output.state.files.hist.sampleName,
                            output.state.files.hist.number,
                            output.state.files.hist.letter,
                            b);
         samplesE[b] = new double [samplesPerFrame];
         samplesN[b] = new uint * [var->numKinds];
         for (uint k = 0; k < var->numKinds; ++k)
         {
            samplesN[b][k] = new uint [samplesPerFrame];
         }
	 outF[b].open(name[b].c_str(), std::ofstream::out);
      }
      WriteHeader();
   }
}
Пример #24
0
static HPDF_STATUS
InternalSaveToStream  (HPDF_Doc      pdf,
                       HPDF_Stream   stream)
{
    HPDF_STATUS ret;

    if ((ret = WriteHeader (pdf, stream)) != HPDF_OK)
        return ret;

    /* prepare trailer */
    if ((ret = PrepareTrailer (pdf)) != HPDF_OK)
        return ret;

    /* prepare encription */
    if (pdf->encrypt_on) {
        HPDF_Encrypt e= HPDF_EncryptDict_GetAttr (pdf->encrypt_dict);

        if ((ret = HPDF_Doc_PrepareEncryption (pdf)) != HPDF_OK)
            return ret;

        if ((ret = HPDF_Xref_WriteToStream (pdf->xref, stream, e)) != HPDF_OK)
            return ret;
    } else {
        if ((ret = HPDF_Xref_WriteToStream (pdf->xref, stream, NULL)) !=
                HPDF_OK)
            return ret;
    }

    return HPDF_OK;
}
BOOL CDataIndex::UpdateChecksum(LPCTSTR DataFileName)
{
	BOOL retcode = FALSE;

	// build index filename
	CFileSpec fs(DataFileName);
	fs.SetExt(".ldx");

	// build cell starts filename
	CFileSpec ifs(DataFileName);
	ifs.SetExt(".ldi");

	// update the checksum for the index file
	FILE* f = fopen(fs.GetFullSpec(), "rb+");
	if (f) {
		if (ReadHeader(f)) {
			// make sure we have a valid data index file
			if (strcmp(m_Header.Signature, "LDAindex") == 0) {
				m_Header.Checksum = ComputeChecksum(DataFileName);
				m_Header.Version = 1.1f;

				WriteHeader(f);
				fclose(f);

				retcode = TRUE;
			}
		}
	}

	// update the checksum for the starts file
	if (retcode) {
		f = fopen(ifs.GetFullSpec(), "rb+");
		if (f) {
			if (ReadHeader(f)) {
				if (strcmp(m_Header.Signature, "LDAstarts") == 0) {
					m_Header.Checksum = ComputeChecksum(DataFileName);
					m_Header.Version = 1.1f;

					WriteHeader(f);
					fclose(f);
				}
			}
		}
	}

	return(retcode);
}
Пример #26
0
/**
 * Read in data produced by DTMConverter and produce file containing
 * the scalars and header information.
*/
int main ( int argc, char* argv[] )
{
  if ( argc != 3 )
    {
    std::cout << "Need input file and output file." << std::endl;
    return 1;
    }

  std::string ifn = argv[1];
  std::string ofn = argv[2];

  std::cerr << "Input file: " << ifn << std::endl;
  std::cerr << "Output file: " << ofn << std::endl;

  if ( ifn == ofn )
    {
    std::cerr << "File names cannot be the same." << std::endl;
    return 1;
    }

  std::ifstream ifs(ifn.c_str(),std::ios::binary);
  if ( !ifs )
    {
    std::cout << "Opening of:" << ifn << " failed." << std::endl;
    return 1;
    }
  std::ofstream ofs(ofn.c_str(),std::ios::binary);
  if ( !ofs )
    {
    std::cout << "Opening of:" << ofn << " failed." << std::endl;
    return 1;
    }

  int dimensions[3];
  double origin[3];
  double spacing[3];
  int increment[3];
  int scalarType;

  size_t pos = ReadHeader(ifs,dimensions,origin,spacing,increment,scalarType);
  std::vector< double > scalars;
  ReadScalars<double>(ifs,pos,scalars);

  WriteHeader(ofs,dimensions,origin,spacing,increment,scalarType);
  switch ( scalarType )
    {
    case 11:
      WriteScalars<double>(ofs,scalars,dimensions,false,false,false);
      break;
    default:
      std::cerr << "Unknown type, cannot write out scalars." << std::endl;
    }

  ifs.close();
  ofs.close();

  return 0;

}
Пример #27
0
// GenerateVCXProj
//------------------------------------------------------------------------------
const AString & SLNGenerator::GenerateSLN(  const AString & solutionFile,
        const AString & solutionBuildProject,
        const AString & solutionVisualStudioVersion,
        const AString & solutionMinimumVisualStudioVersion,
        const Array< VSProjectConfig > & configs,
        const Array< VCXProjectNode * > & projects,
        const Array< SLNDependency > & slnDeps,
        const Array< SLNSolutionFolder > & folders )
{
    // preallocate to avoid re-allocations
    m_Output.SetReserved( MEGABYTE );
    m_Output.SetLength( 0 );

    // determine folder for project
    const char * lastSlash = solutionFile.FindLast( NATIVE_SLASH );
    AStackString<> solutionBasePath( solutionFile.Get(), lastSlash ? lastSlash + 1 : solutionFile.Get() );

    AStackString<> solutionBuildProjectGuid;
    Array< AString > projectGuids( projects.GetSize(), false );
    Array< AString > solutionProjectsToFolder( projects.GetSize(), true );
    Array< AString > solutionFolderPaths( folders.GetSize(), true );

    // Create solution configs (solves Visual Studio weirdness)
    const size_t configCount = configs.GetSize();
    Array< SolutionConfig > solutionConfigs( configCount, false );
    solutionConfigs.SetSize( configCount );
    for ( size_t i = 0 ; i < configCount ;  ++i )
    {
        const VSProjectConfig & projectConfig = configs[ i ];
        SolutionConfig & solutionConfig = solutionConfigs[ i ];

        solutionConfig.m_Config = projectConfig.m_Config;
        solutionConfig.m_Platform = projectConfig.m_Platform;

        if ( projectConfig.m_Platform.MatchesI( "Win32" ) )
        {
            solutionConfig.m_SolutionPlatform = "x86";
        }
        else
        {
            solutionConfig.m_SolutionPlatform = projectConfig.m_Platform;
        }
    }

    // Sort again with substituted solution platforms
    solutionConfigs.Sort();

    // construct sln file
    WriteHeader( solutionVisualStudioVersion, solutionMinimumVisualStudioVersion );
    WriteProjectListings( solutionBasePath, solutionBuildProject, projects, folders, slnDeps, solutionBuildProjectGuid, projectGuids, solutionProjectsToFolder );
    WriteSolutionFolderListings( folders, solutionFolderPaths );
    Write( "Global\r\n" );
    WriteSolutionConfigurationPlatforms( solutionConfigs );
    WriteProjectConfigurationPlatforms( solutionBuildProjectGuid, solutionConfigs, projectGuids );
    WriteNestedProjects( solutionProjectsToFolder, solutionFolderPaths );
    WriteFooter();

    return m_Output;
}
Пример #28
0
int main(int argc, char *argv[])
{
    int len, i;
    char* tagline = NULL;
    File* phile;
    FILE *f;
    char buf[1024];
    int abi = 
#ifndef ARRAYPERSTR
	X_DEFAULT_ABI;
#else
	X_ARRAYPER_ABI;
#endif

    f = stdin;
    if (argc > 1) {
	for (i = 1; i < argc; i++) {
	    if (strcmp (argv[i], "-f") == 0) {
		if (++i < argc)
		    f = fopen (argv[i], "r");
		else
		    return 1;
	    }
	    if (strcmp (argv[i], "-sparcabi") == 0)
		abi = X_SPARC_ABI;
	    if (strcmp (argv[i], "-intelabi") == 0)
		abi = X_INTEL_ABI;
	    if (strcmp (argv[i], "-functionabi") == 0)
		abi = X_FUNCTION_ABI;
	    if (strcmp (argv[i], "-earlyR6bc") == 0 && abi == X_INTEL_ABI)
		abi = X_INTEL_ABI_BC;
	    if (strcmp (argv[i], "-arrayperabi") == 0)
		abi = X_ARRAYPER_ABI;
#ifdef ARRAYPERSTR
	    if (strcmp (argv[i], "-defaultabi") == 0)
		abi = X_DEFAULT_ABI;
#endif
	}
    }

    if (f == NULL) return 1;
    while (fgets(buf, sizeof buf, f)) {
	if (!buf[0] || buf[0] == '\n') 
	    continue;
	if (buf[0] == '!') {
	    if (tagline) continue;
	    tagline = DoComment (buf);
	    continue;
	}
	if (buf[(len = strlen (buf) - 1)] == '\n') buf[len] = '\0';
	DoLine(buf);
    }
    for (phile = file; phile; phile = phile->next) {
	if (abi != X_ARRAYPER_ABI) IndexEntries (phile, abi);
	WriteHeader (tagline, phile, abi);
    }
    WriteSource(tagline, abi);
    return 0;
}
Пример #29
0
void DotGraph::Generate(Object root, String const &filename)
{
	this->Clear();
	WriteHeader();
	*this << root;
	WriteFooter();
	WriteToFile(filename.c_str());
}
void
ADataStore::Close() {	// ** NOT THREAD SAFE **
	if (mFileOpen) {
		WriteHeader(kFileIsClosed);
	}
	mFileOpen = false;
	DB_LOG("Closed Database");
}