split-soapC.cpp revision c7814cf6e1240a519cbec0441e033d0e2470ed00
/** @file
* File splitter: splits soapC.cpp into manageable pieces. It is somewhat
* intelligent and avoids splitting inside functions or similar places.
*/
/*
* Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
{
int rc = 0;
do
{
if (argc != 4)
{
"1) the input file, 2) the directory where to put the output files and\n"
"3) the number chunks to create.\n");
rc = 2;
break;
}
{
rc = 2;
break;
}
if (!pFileIn)
{
rc = 2;
break;
}
{
rc = 2;
break;
}
{
rc = 2;
break;
}
{
rc = 2;
break;
}
unsigned long cFiles = 0;
unsigned long uLimit = 0;
unsigned long cbWritten = 0;
unsigned long cIfNesting = 0;
unsigned long cBraceNesting = 0;
bool fJustZero = false;
do
{
if (!pFileOut)
{
/* construct output filename */
char szFilename[1024];
/* create output file */
{
rc = 2;
break;
}
if (cFiles > 1)
#ifdef RT_OS_WINDOWS
"\r"
#else /* !RT_OS_WINDOWS */
""
#endif /* !RT_OS_WINDOWS */
);
}
/* find begin of next line and print current line */
if (pNextLine)
{
pNextLine++;
}
else
{
rc = 2;
break;
}
/* process nesting depth information */
cIfNesting++;
{
cIfNesting--;
if (!cBraceNesting && !cIfNesting)
fJustZero = true;
}
else
{
{
if (*p == '{')
else if (*p == '}')
{
if (!cBraceNesting && !cIfNesting)
fJustZero = true;
}
}
}
/* look for static variables used for enum conversion. */
if (!strncmp(pLine, "static const struct soap_code_map", sizeof("static const struct soap_code_map") - 1))
cLinesSinceStaticMap = 0;
else
/* start a new output file if necessary and possible */
&& cIfNesting == 0
&& fJustZero
{
}
if (rc)
break;
fJustZero = false;
} while (pLine);
} while (0);
if (pBuffer)
if (pFileIn)
if (pFileOut)
return rc;
}