Example #1
0
static void CreateDepFile (const char* Name, InputType Types)
/* Create a dependency file with the given name and place dependencies for
 * all files with the given types there.
 */
{
    /* Open the file */
    FILE* F = fopen (Name, "w");
    if (F == 0) {
       	Fatal ("Cannot open dependency file `%s': %s", Name, strerror (errno));
    }

    /* If a dependency target was given, use it, otherwise use the output
     * file name as target, followed by a tab character.
     */
    if (SB_IsEmpty (&DepTarget)) {
        WriteEscaped (F, OutputFilename);
    } else {
        WriteEscaped (F, SB_GetConstBuf (&DepTarget));
    }
    fputs (":\t", F);

    /* Write out the dependencies for the output file */
    WriteDep (F, Types);
    fputs ("\n\n", F);

    /* Write out a phony dependency for the included files */
    WriteDep (F, Types);
    fputs (":\n\n", F);

    /* Close the file, check for errors */
    if (fclose (F) != 0) {
    	remove (Name);
    	Fatal ("Cannot write to dependeny file (disk full?)");
    }
}
Example #2
0
static std::ostream &operator<<(std::ostream &strm, const TMsg &that) {
  assert(&strm);
  assert(&that);
  strm
      << "{ \"time_stamp\": " << that.TimeStamp
      << ", \"sender_id\": " << that.SenderId
      << ", \"receiver_id\": " << that.ReceiverId
      << ", \"visibility\": " << that.Visibility
      << ", \"type\": " << that.Type
      << ", \"content\": ";
  WriteEscaped(strm, that.Content);
  strm << ", \"sender_ips\": ";
  WriteEscaped(strm, that.SenderIps);
  return strm << " }";
}
Example #3
0
static void WriteDep (FILE* F, InputType Types)
/* Helper function. Writes all file names that match Types to the output */
{
    unsigned I;

    /* Loop over all files */
    unsigned FileCount = CollCount (&IFiles);
    for (I = 0; I < FileCount; ++I) {

    	/* Get the next input file */
    	const IFile* IF = (const IFile*) CollAt (&IFiles, I);

        /* Ignore it if it is not of the correct type */
        if ((IF->Type & Types) == 0) {
            continue;
        }

    	/* If this is not the first file, add a space */
       	if (I > 0) {
            fputc (' ', F);
        }

    	/* Print the dependency escaping spaces */
        WriteEscaped (F, IF->Name);
    }
}
void StdCompilerINIWrite::Raw(void *pData, size_t iSize, RawCompileType eType)
{
	switch (eType)
	{
	case RCT_Escaped:
		WriteEscaped(reinterpret_cast<char *>(pData), reinterpret_cast<char *>(pData) + iSize);
		break;
	case RCT_All:
	case RCT_Idtf:
	case RCT_IdtfAllowEmpty:
	case RCT_ID:
		Buf.Append(reinterpret_cast<char *>(pData), iSize);
	}
}
void StdCompilerINIWrite::String(char *szString, size_t iMaxLength, RawCompileType eType)
{
	PrepareForValue();
	switch (eType)
	{
	case RCT_Escaped:
		WriteEscaped(szString, szString + strlen(szString));
		break;
	case RCT_All:
	case RCT_Idtf:
	case RCT_IdtfAllowEmpty:
	case RCT_ID:
		Buf.Append(szString);
	}
}