Skip to content

Commit 3fe1790

Browse files
committed
Whitespace tweaks, OTB formatting, Doxygen update while I tour RCXlib
1 parent dcc0381 commit 3fe1790

19 files changed

+338
-316
lines changed

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ SHORT_NAMES = NO
153153
# comments will behave just like regular Qt-style comments
154154
# (thus requiring an explicit @brief command for a brief description.)
155155

156-
JAVADOC_AUTOBRIEF = YES
156+
JAVADOC_AUTOBRIEF = NO
157157

158158
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
159159
# interpret the first line (until the first dot) of a Qt-style

compiler/AddrOfExpr.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* All Rights Reserved.
1212
*
1313
*/
14-
1514
#ifndef __AddrOfExpr_h
1615
#define __AddrOfExpr_h
1716

@@ -26,23 +25,22 @@
2625
class AddrOfExpr : public Expr, public Translatable
2726
{
2827
public:
29-
AddrOfExpr(int value, int offset, const LexLocation &loc);
30-
28+
AddrOfExpr(int value, int offset, const LexLocation &loc);
3129

32-
virtual bool PromiseConstant() const;
30+
virtual bool PromiseConstant() const;
3331

34-
virtual bool Evaluate(int &value) const;
35-
virtual Expr* Clone(Mapping *b) const;
32+
virtual bool Evaluate(int &value) const;
33+
virtual Expr* Clone(Mapping *b) const;
3634

37-
virtual bool Contains(int var) const;
38-
virtual RCX_Value EmitAny_(Bytecode &b) const;
39-
virtual RCX_Value GetStaticEA_() const;
40-
virtual bool LValueIsPointer() const;
35+
virtual bool Contains(int var) const;
36+
virtual RCX_Value EmitAny_(Bytecode &b) const;
37+
virtual RCX_Value GetStaticEA_() const;
38+
virtual bool LValueIsPointer() const;
4139

42-
void Translate(int from, int to);
40+
void Translate(int from, int to);
4341
private:
44-
int fValue;
45-
int foffset;
42+
int fValue;
43+
int foffset;
4644
};
4745

4846

compiler/AsmStmt.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,6 @@
1010
* Portions created by John Hansen are Copyright (C) 2005 John Hansen.
1111
* All Rights Reserved.
1212
*
13-
*/ /*
14-
* The contents of this file are subject to the Mozilla Public License
15-
* Version 1.0 (the "License"); you may not use this file except in
16-
* compliance with the License. You may obtain a copy of the License at
17-
* http://www.mozilla.org/MPL/
18-
*
19-
* Software distributed under the License is distributed on an "AS IS"
20-
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
21-
* License for the specific language governing rights and limitations
22-
* under the License.
23-
*
24-
* The Initial Developer of this code is David Baum.
25-
* Portions created by David Baum are Copyright (C) 1998 David Baum.
26-
* All Rights Reserved.
27-
*
28-
* Portions created by John Hansen are Copyright (C) 2005 John Hansen.
29-
* All Rights Reserved.
30-
*
3113
*/
3214

3315
#ifndef __AsmStmt_h

compiler/LabelStmt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*/
1414

15-
/*
15+
/**
1616
* LabelStmts are used to bind a label to another statement. The
1717
* LabelStmt isn't really a statement itself - just a wrapper for
1818
* a single child statement.

nqc/CmdLine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CmdLine
2626
CmdLine() : fPos(0) {};
2727
~CmdLine();
2828

29-
void Add(const char *a); // make copy and add to arglist
29+
void Add(const char *a); // make copy and add to arglist
3030
void Add(int argc, const char * const *argv); // add multiple args
3131

3232
void Parse(const char *line, int skip = 0); // parse line and add args

nqc/SRecord.cpp

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ using std::strncmp;
2020
using std::memcpy;
2121
using std::isspace;
2222

23-
#define kMaxLine 256
23+
#define kMaxLine 256
2424

2525
typedef struct {
2626
int length;
@@ -63,7 +63,7 @@ typedef struct {
6363
#define IMAGE_MAXLEN 0x8000
6464
#define TRANSFER_SIZE 200
6565

66-
#define SEGMENT_BREAK 1024
66+
#define SEGMENT_BREAK 1024
6767

6868
static signed char ctab[256] = {
6969
-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,
@@ -201,15 +201,13 @@ int srec_load (FILE *file, UByte *image, int maxlen, image_t *image_def,
201201
/* Start of a new segment? */
202202
if (srec.addr - prevAddr >= SEGMENT_BREAK) {
203203
segIndex++;
204-
if (segIndex >= numimage_def)
205-
{
204+
if (segIndex >= numimage_def) {
206205
return 0;
207206
}
208-
209-
image_def->segments[segIndex].length = 0;
210-
segStartAddr = srec.addr;
211-
prevAddr = srec.addr - prevCount;
212-
image_def->segments[segIndex].offset = imageIndex + prevCount;
207+
image_def->segments[segIndex].length = 0;
208+
segStartAddr = srec.addr;
209+
prevAddr = srec.addr - prevCount;
210+
image_def->segments[segIndex].offset = imageIndex + prevCount;
213211
}
214212

215213
if (srec.addr < IMAGE_START ||
@@ -242,8 +240,9 @@ int srec_load (FILE *file, UByte *image, int maxlen, image_t *image_def,
242240
image_def->segments[segIndex].length = pos+1;
243241
}
244242

245-
for (i = 0; i <= segIndex; i++)
246-
length += image_def->segments[segIndex].length;
243+
for (i = 0; i <= segIndex; i++) {
244+
length += image_def->segments[segIndex].length;
245+
}
247246

248247
if (length == 0) {
249248
return 0;
@@ -254,13 +253,8 @@ int srec_load (FILE *file, UByte *image, int maxlen, image_t *image_def,
254253

255254
bool SRecord::Read(FILE *fp, int maxLength)
256255
{
257-
//char line[kMaxLine];
258-
//char *ptr;
259-
//int dataLen;
260-
//int byte;
261-
262-
delete [] fData;
263-
fData = new UByte[maxLength];
256+
delete [] fData;
257+
fData = new UByte[maxLength];
264258

265259
segment_t segments[2];
266260
image_t image_def = { 0, &segments[0] };
@@ -277,26 +271,25 @@ bool SRecord::Read(FILE *fp, int maxLength)
277271

278272
int SRecord::ReadHexByte(const char *ptr)
279273
{
280-
int i;
281-
int v = 0;
282-
char c;
283-
int n;
284-
285-
for(i=0; i<2; i++)
286-
{
287-
c = *ptr++;
288-
289-
if (c >= '0' && c <= '9')
290-
n = c - '0';
291-
else if (c >= 'A' && c <= 'F')
292-
n = c - 'A' + 10;
293-
else if (c >= 'a' && c <= 'f')
294-
n = c - 'a' + 10;
295-
else
296-
return -1;
297-
298-
v = (v << 4) + n;
299-
}
300-
301-
return v;
274+
int i;
275+
int v = 0;
276+
char c;
277+
int n;
278+
279+
for (i=0; i<2; i++) {
280+
c = *ptr++;
281+
282+
if (c >= '0' && c <= '9')
283+
n = c - '0';
284+
else if (c >= 'A' && c <= 'F')
285+
n = c - 'A' + 10;
286+
else if (c >= 'a' && c <= 'f')
287+
n = c - 'a' + 10;
288+
else
289+
return -1;
290+
291+
v = (v << 4) + n;
292+
}
293+
294+
return v;
302295
}

nqc/SRecord.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class SRecord
2626
{
2727
public:
2828
SRecord() : fLength(0), fStart(0), fData(0) {}
29-
~SRecord() { delete [] fData; }
29+
~SRecord() { delete [] fData; }
3030

31-
int GetLength() const { return fLength; }
32-
const UByte* GetData() const { return fData; }
33-
int GetStart() const { return fStart; }
31+
int GetLength() const { return fLength; }
32+
const UByte* GetData() const { return fData; }
33+
int GetStart() const { return fStart; }
3434

3535
bool Read(FILE *fp, int maxLength);
3636

nqc/nqc.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,21 +1055,18 @@ void PrintError(RCX_Result error, const char *filename)
10551055
break;
10561056
case kUsageError:
10571057
PrintVersion();
1058-
fprintf(STDERR,"Usage error: try \'nqc -help\' to display options\n");
1058+
fprintf(STDERR, "Usage error: try \'nqc -help\' to display options\n");
10591059
break;
10601060
case kQuietError:
10611061
break;
1062-
10631062
case kRCX_PipeModeError:
1064-
fprintf(STDERR,"USB driver does not support -firmfast, CyberMaster, or Spybotics\n");
1063+
fprintf(STDERR, "USB driver does not support -firmfast, CyberMaster, or Spybotics\n");
10651064
break;
1066-
10671065
case kRCX_USBUnsupportedError:
1068-
fprintf(STDERR,"USB Tower not supported\n");
1066+
fprintf(STDERR, "USB Tower not supported\n");
10691067
break;
1070-
10711068
case kRCX_GhostNotFoundError:
1072-
fprintf(STDERR,"Ghost libraries are not installed properly\n");
1069+
fprintf(STDERR," Ghost libraries are not installed properly\n");
10731070
break;
10741071
default:
10751072
fprintf(STDERR, "Error #%d\n", -error);
@@ -1086,8 +1083,7 @@ void PrintVersion()
10861083

10871084
void PrintUsage()
10881085
{
1089-
string s (sTargetNames[gTargetType]);
1090-
const char* targetName = s.c_str();
1086+
const char *targetName = getTarget(gTargetType)->fName;
10911087

10921088
PrintVersion();
10931089
fprintf(stdout,"Usage: nqc [options] [actions] [ - | filename ] [actions]\n");

rcxlib/RCX_Constants.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
* All Rights Reserved.
1212
*
1313
*/
14+
15+
/**
16+
* @file RCX_Constants.h
17+
* @brief LEGO brick opcodes, IO definitions, and constant values
18+
*/
19+
1420
#ifndef __RCX_Constants_h
1521
#define __RCX_Constants_h
1622

rcxlib/RCX_Pipe.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
* All Rights Reserved.
1212
*
1313
*/
14+
/**
15+
* @file RCX_Pipe.cpp
16+
* @brief Superclass implementation of LEGO IR USB tower pipe
17+
*/
18+
1419
#include "RCX_Pipe.h"
1520

1621
void RCX_Pipe::FlushRead(int delay)

0 commit comments

Comments
 (0)