Skip to content

Commit

Permalink
Code formatting: disallow multi-line C-style comments /* ... */.
Browse files Browse the repository at this point in the history
git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@534 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
julianhyde committed May 21, 2012
1 parent 54664d0 commit 07107aa
Show file tree
Hide file tree
Showing 13 changed files with 318 additions and 409 deletions.
3 changes: 3 additions & 0 deletions checkFile.awk
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ FNR < headerCount {
# beginning of multiline comment "/*"
inComment = 1;
gsub(/\/\*.*$/, "/* comment */", s);
if (strict > 0 && FNR > 1 && $0 !~ /\/\*\*/) {
error(fname, FNR, "Multi-line c-style comment not allowed");
}
} else {
# mask out /* */ comments
gsub(/\/\*.*\*\//, "/* comment */", s);
Expand Down
30 changes: 22 additions & 8 deletions checkFile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ doCheck() {
else
gawk -f "$CHECKFILE_AWK" \
-v fname="$filePath" \
-v lenient="$lenient" \
-v strict="$strict" \
-v maxLineLength="$maxLineLength" \
"$file"
fi
Expand All @@ -172,12 +172,23 @@ doCheckDeferred() {
maxLineLength=80
cat "${deferred_file}" |
xargs gawk -f "$CHECKFILE_AWK" \
-v lenient="$lenient" \
-v strict="$strict" \
-v maxLineLength="$maxLineLength"
fi
rm -f "${deferred_file}"
}

function guessCoreCount() {
if [ -f /proc/cpuinfo ]; then
cat /proc/cpuinfo | awk '$1 == "processor"' | wc -l
else
# File doe not exist on Darwin or cygwin
echo 2
fi
}

export CORE_COUNT=$(guessCoreCount)

export deferred=true

# 'test' is an undocumented flag, overriding the default behavior which is
Expand All @@ -188,9 +199,9 @@ if [ "$1" == --test ]; then
shift
fi

lenient=
strict=1
if [ "$1" == --lenient ]; then
lenient=true
strict=0
shift
fi

Expand All @@ -199,9 +210,8 @@ if [ "$1" == --help ]; then
exit 0
fi

strict=
if [ "$1" == --strict ]; then
strict=true
strict=2
shift
fi

Expand Down Expand Up @@ -240,7 +250,12 @@ fi

if [ ! -f "$CHECKFILE_AWK" ]
then
export CHECKFILE_AWK="$(dirname $(readlink -f $0))/checkFile.awk"
case $(uname) in
(Darwin)
export CHECKFILE_AWK="$(cd $(dirname $0); pwd -P)/checkFile.awk";;
(*)
export CHECKFILE_AWK="$(dirname $(readlink -f $0))/checkFile.awk";;
esac
fi

export deferred_file=/tmp/checkFile_deferred_$$.txt
Expand Down Expand Up @@ -282,7 +297,6 @@ status=0
if [ -s /tmp/checkFile_output_$$.txt ]; then
status=1
fi

rm -f /tmp/checkFile_output_$$.txt

exit $status
Expand Down
8 changes: 3 additions & 5 deletions src/org/olap4j/driver/xmla/XmlaOlap4jCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ protected void populateList(
throws OlapException
{
try {
/*
* Some OLAP servers don't support DBSCHEMA_SCHEMATA
* so we fork the behavior here according to the
* database product name.
*/
// Some OLAP servers don't support DBSCHEMA_SCHEMATA so
// we fork the behavior here according to the database
// product name.
if (XmlaOlap4jCatalog.this.olap4jDatabaseMetaData
.getDatabaseProductName().contains("Mondrian"))
{
Expand Down
82 changes: 39 additions & 43 deletions src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ void populate() throws OlapException {
Element fault =
findChild(body, SOAP_NS, "Fault");
if (fault != null) {
/*
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client.00HSBC01</faultcode>
<faultstring>XMLA connection datasource not found</faultstring>
<faultactor>Mondrian</faultactor>
<detail>
<XA:error xmlns:XA="http://mondrian.sourceforge.net">
<code>00HSBC01</code>
<desc>The Mondrian XML: Mondrian Error:Internal
error: no catalog named 'LOCALDB'</desc>
</XA:error>
</detail>
</SOAP-ENV:Fault>
*/
// <SOAP-ENV:Fault>
// <faultcode>SOAP-ENV:Client.00HSBC01</faultcode>
// <faultstring>XMLA connection datasource not
// found</faultstring>
// <faultactor>Mondrian</faultactor>
// <detail>
// <XA:error xmlns:XA="http://mondrian.sourceforge.net">
// <code>00HSBC01</code>
// <desc>The Mondrian XML: Mondrian Error:Internal
// error: no catalog named 'LOCALDB'</desc>
// </XA:error>
// </detail>
// </SOAP-ENV:Fault>
//
// TODO: log doc to logfile
throw getHelper().createException(
"XMLA provider gave exception: "
Expand Down Expand Up @@ -186,14 +186,12 @@ void populate() throws OlapException {

// todo: use CellInfo element to determine mapping of cell properties
// to XML tags
/*
<CellInfo>
<Value name="VALUE"/>
<FmtValue name="FORMATTED_VALUE"/>
<FormatString name="FORMAT_STRING"/>
</CellInfo>
*/

//
// <CellInfo>
// <Value name="VALUE"/>
// <FmtValue name="FORMATTED_VALUE"/>
// <FormatString name="FORMAT_STRING"/>
// </CellInfo>
final Element axesNode = findChild(root, MDDATASET_NS, "Axes");

// First pass, gather up a list of member unique names to fetch
Expand Down Expand Up @@ -427,27 +425,25 @@ private XmlaOlap4jCellSetMetaData createMetaData(Element root)
findChildren(axisInfo, MDDATASET_NS, "HierarchyInfo");
final List<Hierarchy> hierarchyList =
new ArrayList<Hierarchy>();
/*
<OlapInfo>
<AxesInfo>
<AxisInfo name="Axis0">
<HierarchyInfo name="Customers">
<UName name="[Customers].[MEMBER_UNIQUE_NAME]"/>
<Caption name="[Customers].[MEMBER_CAPTION]"/>
<LName name="[Customers].[LEVEL_UNIQUE_NAME]"/>
<LNum name="[Customers].[LEVEL_NUMBER]"/>
<DisplayInfo name="[Customers].[DISPLAY_INFO]"/>
</HierarchyInfo>
</AxisInfo>
...
</AxesInfo>
<CellInfo>
<Value name="VALUE"/>
<FmtValue name="FORMATTED_VALUE"/>
<FormatString name="FORMAT_STRING"/>
</CellInfo>
</OlapInfo>
*/
// <OlapInfo>
// <AxesInfo>
// <AxisInfo name="Axis0">
// <HierarchyInfo name="Customers">
// <UName name="[Customers].[MEMBER_UNIQUE_NAME]"/>
// <Caption name="[Customers].[MEMBER_CAPTION]"/>
// <LName name="[Customers].[LEVEL_UNIQUE_NAME]"/>
// <LNum name="[Customers].[LEVEL_NUMBER]"/>
// <DisplayInfo name="[Customers].[DISPLAY_INFO]"/>
// </HierarchyInfo>
// </AxisInfo>
// ...
// </AxesInfo>
// <CellInfo>
// <Value name="VALUE"/>
// <FmtValue name="FORMATTED_VALUE"/>
// <FormatString name="FORMAT_STRING"/>
// </CellInfo>
// </OlapInfo>
final List<XmlaOlap4jCellSetMemberProperty> propertyList =
new ArrayList<XmlaOlap4jCellSetMemberProperty>();
for (Element hierarchyInfo : hierarchyInfos) {
Expand Down
Loading

0 comments on commit 07107aa

Please sign in to comment.