Skip to content

Commit 7425eef

Browse files
committed
Make format
1 parent 3bb6718 commit 7425eef

File tree

6 files changed

+116
-121
lines changed

6 files changed

+116
-121
lines changed

programs/get_key.cpp

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/*
2-
Copyright 2011, 2012 Barrett Technology <[email protected]>
2+
Copyright 2011, 2012 Barrett Technology <[email protected]>
33
4-
This file is part of libbarrett.
4+
This file is part of libbarrett.
55
6-
This version of libbarrett is free software: you can redistribute it
7-
and/or modify it under the terms of the GNU General Public License as
8-
published by the Free Software Foundation, either version 3 of the
9-
License, or (at your option) any later version.
6+
This version of libbarrett is free software: you can redistribute it
7+
and/or modify it under the terms of the GNU General Public License as
8+
published by the Free Software Foundation, either version 3 of the
9+
License, or (at your option) any later version.
1010
11-
This version of libbarrett is distributed in the hope that it will be
12-
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
GNU General Public License for more details.
11+
This version of libbarrett is distributed in the hope that it will be
12+
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
1515
16-
You should have received a copy of the GNU General Public License along
17-
with this version of libbarrett. If not, see
18-
<http://www.gnu.org/licenses/>.
16+
You should have received a copy of the GNU General Public License along
17+
with this version of libbarrett. If not, see
18+
<http://www.gnu.org/licenses/>.
1919
20-
Further, non-binding information about licensing is available at:
21-
<http://wiki.barrett.com/libbarrett/wiki/LicenseNotes>
20+
Further, non-binding information about licensing is available at:
21+
<http://wiki.barrett.com/libbarrett/wiki/LicenseNotes>
2222
*/
2323

2424
/*
@@ -29,54 +29,53 @@
2929
* Author: dc
3030
*/
3131

32-
#include <curses.h>
3332
#include "utils.h"
34-
33+
#include <curses.h>
3534

3635
enum Key getKey() {
37-
int c1, c2, c3;
36+
int c1, c2, c3;
3837

39-
// Get the key from ncurses
40-
c1 = getch();
41-
if (c1 == ERR) {
42-
return K_NOKEY;
43-
}
38+
// Get the key from ncurses
39+
c1 = getch();
40+
if (c1 == ERR) {
41+
return K_NOKEY;
42+
}
4443

45-
// Get all keyboard characters
46-
if (32 <= c1 && c1 <= 126) {
47-
return (enum Key) c1;
48-
}
44+
// Get all keyboard characters
45+
if (32 <= c1 && c1 <= 126) {
46+
return (enum Key)c1;
47+
}
4948

50-
// Get special keys
51-
switch (c1) {
52-
case K_TAB:
53-
case K_ENTER:
54-
case K_BACKSPACE:
55-
return (enum Key) c1;
56-
break;
57-
case 27:
58-
// Get extended keyboard chars
59-
c2 = getch();
60-
if (c2 == ERR)
61-
return K_ESCAPE;
62-
if (c2 != 91)
63-
return K_UNKNOWN;
64-
c3 = getch();
65-
switch (c3) {
66-
case 65:
67-
return K_UP;
68-
case 66:
69-
return K_DOWN;
70-
case 67:
71-
return K_RIGHT;
72-
case 68:
73-
return K_LEFT;
74-
default:
75-
return K_UNKNOWN;
76-
}
77-
break;
78-
default:
79-
return K_UNKNOWN;
80-
break;
81-
}
49+
// Get special keys
50+
switch (c1) {
51+
case K_TAB:
52+
case K_ENTER:
53+
case K_BACKSPACE:
54+
return (enum Key)c1;
55+
break;
56+
case 27:
57+
// Get extended keyboard chars
58+
c2 = getch();
59+
if (c2 == ERR)
60+
return K_ESCAPE;
61+
if (c2 != 91)
62+
return K_UNKNOWN;
63+
c3 = getch();
64+
switch (c3) {
65+
case 65:
66+
return K_UP;
67+
case 66:
68+
return K_DOWN;
69+
case 67:
70+
return K_RIGHT;
71+
case 68:
72+
return K_LEFT;
73+
default:
74+
return K_UNKNOWN;
75+
}
76+
break;
77+
default:
78+
return K_UNKNOWN;
79+
break;
80+
}
8281
}

programs/manage_backups.cpp

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/*
2-
Copyright 2011, 2012 Barrett Technology <[email protected]>
2+
Copyright 2011, 2012 Barrett Technology <[email protected]>
33
4-
This file is part of libbarrett.
4+
This file is part of libbarrett.
55
6-
This version of libbarrett is free software: you can redistribute it
7-
and/or modify it under the terms of the GNU General Public License as
8-
published by the Free Software Foundation, either version 3 of the
9-
License, or (at your option) any later version.
6+
This version of libbarrett is free software: you can redistribute it
7+
and/or modify it under the terms of the GNU General Public License as
8+
published by the Free Software Foundation, either version 3 of the
9+
License, or (at your option) any later version.
1010
11-
This version of libbarrett is distributed in the hope that it will be
12-
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
GNU General Public License for more details.
11+
This version of libbarrett is distributed in the hope that it will be
12+
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
1515
16-
You should have received a copy of the GNU General Public License along
17-
with this version of libbarrett. If not, see
18-
<http://www.gnu.org/licenses/>.
16+
You should have received a copy of the GNU General Public License along
17+
with this version of libbarrett. If not, see
18+
<http://www.gnu.org/licenses/>.
1919
20-
Further, non-binding information about licensing is available at:
21-
<http://wiki.barrett.com/libbarrett/wiki/LicenseNotes>
20+
Further, non-binding information about licensing is available at:
21+
<http://wiki.barrett.com/libbarrett/wiki/LicenseNotes>
2222
*/
2323

2424
/*
@@ -28,53 +28,49 @@
2828
* Author: dc
2929
*/
3030

31-
#include <fstream>
31+
#include <cassert>
3232
#include <cstdio>
3333
#include <cstring>
34-
#include <cassert>
34+
#include <fstream>
3535

3636
#include "utils.h"
3737

38-
39-
bool fileExists(const char* file)
40-
{
41-
std::ifstream fs(file);
42-
return (bool)fs;
38+
bool fileExists(const char *file) {
39+
std::ifstream fs(file);
40+
return (bool)fs;
4341
}
4442

45-
void backupFileName(char* str, const char* baseFileName, int backupNumer)
46-
{
47-
sprintf(str, "%s.%d", baseFileName, backupNumer);
43+
void backupFileName(char *str, const char *baseFileName, int backupNumer) {
44+
sprintf(str, "%s.%d", baseFileName, backupNumer);
4845
}
4946

50-
51-
void manageBackups(const char* file, int numBackups) {
52-
assert(numBackups <= 9); // Otherwise our strings won't be long enough
53-
char* backupFile1 = new char[strlen(file) + 2 + 1];
54-
char* backupFile2 = new char[strlen(file) + 2 + 1];
55-
56-
backupFileName(backupFile2, file, numBackups);
57-
for (int i = numBackups - 1; i >= 0; --i) {
58-
if (i == 0) {
59-
strcpy(backupFile1, file);
60-
} else {
61-
backupFileName(backupFile1, file, i);
62-
}
63-
64-
if (fileExists(backupFile1)) {
65-
if (fileExists(backupFile2)) {
66-
remove(backupFile2);
67-
}
68-
rename(backupFile1, backupFile2);
69-
}
70-
strcpy(backupFile2, backupFile1);
71-
}
72-
73-
backupFileName(backupFile1, file, 1);
74-
if (fileExists(backupFile1)) {
75-
printf(">>> Old data saved: %s\n", backupFile1);
76-
}
77-
78-
delete[] backupFile1;
79-
delete[] backupFile2;
47+
void manageBackups(const char *file, int numBackups) {
48+
assert(numBackups <= 9); // Otherwise our strings won't be long enough
49+
char *backupFile1 = new char[strlen(file) + 2 + 1];
50+
char *backupFile2 = new char[strlen(file) + 2 + 1];
51+
52+
backupFileName(backupFile2, file, numBackups);
53+
for (int i = numBackups - 1; i >= 0; --i) {
54+
if (i == 0) {
55+
strcpy(backupFile1, file);
56+
} else {
57+
backupFileName(backupFile1, file, i);
58+
}
59+
60+
if (fileExists(backupFile1)) {
61+
if (fileExists(backupFile2)) {
62+
remove(backupFile2);
63+
}
64+
rename(backupFile1, backupFile2);
65+
}
66+
strcpy(backupFile2, backupFile1);
67+
}
68+
69+
backupFileName(backupFile1, file, 1);
70+
if (fileExists(backupFile1)) {
71+
printf(">>> Old data saved: %s\n", backupFile1);
72+
}
73+
74+
delete[] backupFile1;
75+
delete[] backupFile2;
8076
}

src/bus/bus_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int BusManager::receive(int expectedBusId, unsigned char *data, size_t &len,
9999
// if (!realtime) {
100100
// int lc = m.fullUnlock();
101101
// btsleepRT(0.0001); // Yield this thread, give CAN
102-
//thread
102+
// thread
103103
// time to process data m.relock(lc);
104104
// }
105105
}

src/bus/can_socket-linux.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ void CANSocket::open(int port) {
147147
// RTCAN_RTIOC_RCV_TIMEOUT, &timeout); if (ret != 0) {
148148
// close();
149149
// (logMessage("CANSocket::%s(): Could not open CAN port.
150-
// ioctl(RCV_TIMEOUT): (%d) %s") % __func__ % -ret
151-
// % strerror(-ret)).raise<std::runtime_error>();
150+
// ioctl(RCV_TIMEOUT): (%d) %s") % __func__ %
151+
// -ret % strerror(-ret)).raise<std::runtime_error>();
152152
// }
153153
// ret = ioctl(handle->h, RTCAN_RTIOC_SND_TIMEOUT, &timeout);
154154
// if (ret != 0) {
155155
// close();
156156
// (logMessage("CANSocket::%s(): Could not open CAN port.
157-
// ioctl(SND_TIMEOUT): (%d) %s") % __func__ % -ret
158-
// % strerror(-ret)).raise<std::runtime_error>();
157+
// ioctl(SND_TIMEOUT): (%d) %s") % __func__ %
158+
// -ret % strerror(-ret)).raise<std::runtime_error>();
159159
// }
160160
}
161161

src/bus/can_socket-rtcan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ int CANSocket::receiveRaw(int &busId, unsigned char *data, size_t &len,
280280
case -EAGAIN: // -EWOULDBLOCK
281281
// logMessage("CANSocket::%s: "
282282
// "rt_dev_recv(): no data available during non-blocking
283-
//read") % __func__;
283+
// read") % __func__;
284284
return 1;
285285
break;
286286
case -ETIMEDOUT:

src/products/python/product_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void pythonProductsProductManagerInterface() {
7878
return_internal_reference<>())
7979

8080
// .def("getWamPucks", &ProductManager::getWamPucks) //
81-
//TODO(dc):
81+
// TODO(dc):
8282
// Need return_internal_reference<>()?
8383
.def("foundWam", &ProductManager::foundWam)
8484
.def("foundWam4", &ProductManager::foundWam4)

0 commit comments

Comments
 (0)