Skip to content

Commit 76e7852

Browse files
committed
reformat c/c++ files
1 parent 5424842 commit 76e7852

File tree

495 files changed

+147828
-121960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

495 files changed

+147828
-121960
lines changed

src/emc/canterp/canterp.cc

Lines changed: 377 additions & 273 deletions
Large diffs are not rendered by default.

src/emc/ini/emcIniFile.cc

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,84 +29,88 @@
2929
*
3030
******************************************************************************/
3131

32-
#include <math.h> // M_PI.
32+
#include <math.h> // M_PI.
3333
#include "emcIniFile.hh"
3434

3535

36-
IniFile::StrIntPair EmcIniFile::jointTypeMap[] = {
37-
{"LINEAR", EMC_LINEAR},
36+
IniFile::StrIntPair EmcIniFile::jointTypeMap[] = {
37+
{"LINEAR", EMC_LINEAR },
3838
{"ANGULAR", EMC_ANGULAR},
39-
{ NULL, 0 },
39+
{NULL, 0 },
4040
};
4141

42-
EmcIniFile::ErrorCode
43-
EmcIniFile::Find(EmcJointType *result,
44-
const char *tag, const char *section, int num)
42+
EmcIniFile::ErrorCode EmcIniFile::Find(EmcJointType *result,
43+
const char *tag,
44+
const char *section,
45+
int num)
4546
{
46-
return(IniFile::Find((int *)result, jointTypeMap, tag, section, num));
47+
return (IniFile::Find((int *)result, jointTypeMap, tag, section, num));
4748
}
4849

4950

50-
IniFile::StrIntPair EmcIniFile::boolMap[] = {
51-
{"TRUE", 1},
52-
{"YES", 1},
53-
{"1", 1},
51+
IniFile::StrIntPair EmcIniFile::boolMap[] = {
52+
{"TRUE", 1},
53+
{"YES", 1},
54+
{"1", 1},
5455
{"FALSE", 0},
55-
{"NO", 0},
56-
{"0", 0},
57-
{ NULL, 0 },
56+
{"NO", 0},
57+
{"0", 0},
58+
{NULL, 0},
5859
};
5960

6061
EmcIniFile::ErrorCode
6162
EmcIniFile::Find(bool *result, const char *tag, const char *section, int num)
6263
{
63-
ErrorCode errCode;
64-
int value;
64+
ErrorCode errCode;
65+
int value;
6566

66-
if((errCode = IniFile::Find(&value, boolMap, tag,section,num)) == ERR_NONE){
67+
if ((errCode = IniFile::Find(&value, boolMap, tag, section, num)) ==
68+
ERR_NONE) {
6769
*result = (bool)value;
6870
}
6971

70-
return(errCode);
72+
return (errCode);
7173
}
7274

7375

74-
// The next const struct holds pairs for linear units which are
76+
// The next const struct holds pairs for linear units which are
7577
// valid under the [TRAJ] section. These are of the form {"name", value}.
7678
// If the name "name" is encountered in the INI, the value will be used.
77-
EmcIniFile::StrDoublePair EmcIniFile::linearUnitsMap[] = {
78-
{ "mm", 1.0 },
79-
{ "metric", 1.0 },
80-
{ "in", 1/25.4 },
81-
{ "inch", 1/25.4 },
82-
{ "imperial", 1/25.4 },
83-
{ NULL, 0 },
79+
EmcIniFile::StrDoublePair EmcIniFile::linearUnitsMap[] = {
80+
{"mm", 1.0 },
81+
{"metric", 1.0 },
82+
{"in", 1 / 25.4},
83+
{"inch", 1 / 25.4},
84+
{"imperial", 1 / 25.4},
85+
{NULL, 0 },
8486
};
85-
86-
EmcIniFile::ErrorCode
87-
EmcIniFile::FindLinearUnits(EmcLinearUnits *result,
88-
const char *tag, const char *section, int num)
87+
88+
EmcIniFile::ErrorCode EmcIniFile::FindLinearUnits(EmcLinearUnits *result,
89+
const char *tag,
90+
const char *section,
91+
int num)
8992
{
90-
return(IniFile::Find(result, linearUnitsMap, tag, section, num));
93+
return (IniFile::Find(result, linearUnitsMap, tag, section, num));
9194
}
9295

9396

94-
// The next const struct holds pairs for angular units which are
97+
// The next const struct holds pairs for angular units which are
9598
// valid under the [TRAJ] section. These are of the form {"name", value}.
9699
// If the name "name" is encountered in the INI, the value will be used.
97-
EmcIniFile::StrDoublePair EmcIniFile::angularUnitsMap[] = {
98-
{ "deg", 1.0 },
99-
{ "degree", 1.0 },
100-
{ "grad", 0.9 },
101-
{ "gon", 0.9 },
102-
{ "rad", M_PI / 180 },
103-
{ "radian", M_PI / 180 },
104-
{ NULL, 0 },
100+
EmcIniFile::StrDoublePair EmcIniFile::angularUnitsMap[] = {
101+
{"deg", 1.0 },
102+
{"degree", 1.0 },
103+
{"grad", 0.9 },
104+
{"gon", 0.9 },
105+
{"rad", M_PI / 180},
106+
{"radian", M_PI / 180},
107+
{NULL, 0 },
105108
};
106109

107-
EmcIniFile::ErrorCode
108-
EmcIniFile::FindAngularUnits(EmcAngularUnits *result,
109-
const char *tag, const char *section, int num)
110+
EmcIniFile::ErrorCode EmcIniFile::FindAngularUnits(EmcAngularUnits *result,
111+
const char *tag,
112+
const char *section,
113+
int num)
110114
{
111-
return(IniFile::Find(result, angularUnitsMap, tag, section, num));
115+
return (IniFile::Find(result, angularUnitsMap, tag, section, num));
112116
}

src/emc/ini/iniaxis.cc

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
********************************************************************/
1515

1616
#include <unistd.h>
17-
#include <stdio.h> // NULL
18-
#include <stdlib.h> // atol(), _itoa()
19-
#include <string.h> // strcmp()
20-
#include <ctype.h> // isdigit()
17+
#include <stdio.h> // NULL
18+
#include <stdlib.h> // atol(), _itoa()
19+
#include <string.h> // strcmp()
20+
#include <ctype.h> // isdigit()
2121
#include <sys/types.h>
2222
#include <sys/stat.h>
2323

2424
#include "emc.hh"
2525
#include "rcs_print.hh"
2626
#include "emcIniFile.hh"
27-
#include "iniaxis.hh" // these decls
28-
#include "emcglb.h" // EMC_DEBUG
29-
#include "emccfg.h" // default values for globals
27+
#include "iniaxis.hh" // these decls
28+
#include "emcglb.h" // EMC_DEBUG
29+
#include "emccfg.h" // default values for globals
3030

3131
#include "inihal.hh"
3232

@@ -61,27 +61,27 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
6161
double limit;
6262
double maxVelocity;
6363
double maxAcceleration;
64-
int lockingjnum = -1; // -1 ==> locking joint not used
64+
int lockingjnum = -1; // -1 ==> locking joint not used
6565
double maxJerk;
6666

6767
// compose string to match, axis = 0 -> AXIS_X etc.
6868
switch (axis) {
69-
case 0: snprintf(axisString, sizeof(axisString), "AXIS_X"); break;
70-
case 1: snprintf(axisString, sizeof(axisString), "AXIS_Y"); break;
71-
case 2: snprintf(axisString, sizeof(axisString), "AXIS_Z"); break;
72-
case 3: snprintf(axisString, sizeof(axisString), "AXIS_A"); break;
73-
case 4: snprintf(axisString, sizeof(axisString), "AXIS_B"); break;
74-
case 5: snprintf(axisString, sizeof(axisString), "AXIS_C"); break;
75-
case 6: snprintf(axisString, sizeof(axisString), "AXIS_U"); break;
76-
case 7: snprintf(axisString, sizeof(axisString), "AXIS_V"); break;
77-
case 8: snprintf(axisString, sizeof(axisString), "AXIS_W"); break;
69+
case 0: snprintf(axisString, sizeof(axisString), "AXIS_X"); break;
70+
case 1: snprintf(axisString, sizeof(axisString), "AXIS_Y"); break;
71+
case 2: snprintf(axisString, sizeof(axisString), "AXIS_Z"); break;
72+
case 3: snprintf(axisString, sizeof(axisString), "AXIS_A"); break;
73+
case 4: snprintf(axisString, sizeof(axisString), "AXIS_B"); break;
74+
case 5: snprintf(axisString, sizeof(axisString), "AXIS_C"); break;
75+
case 6: snprintf(axisString, sizeof(axisString), "AXIS_U"); break;
76+
case 7: snprintf(axisString, sizeof(axisString), "AXIS_V"); break;
77+
case 8: snprintf(axisString, sizeof(axisString), "AXIS_W"); break;
7878
}
7979

8080
axisIniFile->EnableExceptions(EmcIniFile::ERR_CONVERSION);
81-
81+
8282
try {
8383
// set min position limit
84-
limit = -1e99; // default
84+
limit = -1e99; // default
8585
axisIniFile->Find(&limit, "MIN_LIMIT", axisString);
8686
if (0 != emcAxisSetMinPositionLimit(axis, limit)) {
8787
if (emc_debug & EMC_DEBUG_CONFIG) {
@@ -92,7 +92,7 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
9292
old_inihal_data.axis_min_limit[axis] = limit;
9393

9494
// set max position limit
95-
limit = 1e99; // default
95+
limit = 1e99; // default
9696
axisIniFile->Find(&limit, "MAX_LIMIT", axisString);
9797
if (0 != emcAxisSetMaxPositionLimit(axis, limit)) {
9898
if (emc_debug & EMC_DEBUG_CONFIG) {
@@ -103,26 +103,29 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
103103
old_inihal_data.axis_max_limit[axis] = limit;
104104

105105
ext_offset_a_or_v_ratio[axis] = DEFAULT_A_OR_V_RATIO;
106-
axisIniFile->Find(&ext_offset_a_or_v_ratio[axis], "OFFSET_AV_RATIO", axisString);
106+
axisIniFile->Find(
107+
&ext_offset_a_or_v_ratio[axis], "OFFSET_AV_RATIO", axisString);
107108

108109
#define REPLACE_AV_RATIO 0.1
109-
#define MAX_AV_RATIO 0.9
110-
if ( (ext_offset_a_or_v_ratio[axis] < 0)
111-
|| (ext_offset_a_or_v_ratio[axis] > MAX_AV_RATIO)
112-
) {
113-
rcs_print_error("\n Invalid:[%s]OFFSET_AV_RATIO= %8.5f\n"
114-
" Using: [%s]OFFSET_AV_RATIO= %8.5f\n",
115-
axisString,ext_offset_a_or_v_ratio[axis],
116-
axisString,REPLACE_AV_RATIO);
117-
ext_offset_a_or_v_ratio[axis] = REPLACE_AV_RATIO;
110+
#define MAX_AV_RATIO 0.9
111+
if ((ext_offset_a_or_v_ratio[axis] < 0) ||
112+
(ext_offset_a_or_v_ratio[axis] > MAX_AV_RATIO)) {
113+
rcs_print_error("\n Invalid:[%s]OFFSET_AV_RATIO= %8.5f\n"
114+
" Using: [%s]OFFSET_AV_RATIO= %8.5f\n",
115+
axisString,
116+
ext_offset_a_or_v_ratio[axis],
117+
axisString,
118+
REPLACE_AV_RATIO);
119+
ext_offset_a_or_v_ratio[axis] = REPLACE_AV_RATIO;
118120
}
119121

120122
// set maximum velocities for axis: vel,ext_offset_vel
121123
maxVelocity = DEFAULT_AXIS_MAX_VELOCITY;
122124
axisIniFile->Find(&maxVelocity, "MAX_VELOCITY", axisString);
123-
if (0 != emcAxisSetMaxVelocity(axis,
124-
(1 - ext_offset_a_or_v_ratio[axis]) * maxVelocity,
125-
( ext_offset_a_or_v_ratio[axis]) * maxVelocity)) {
125+
if (0 != emcAxisSetMaxVelocity(
126+
axis,
127+
(1 - ext_offset_a_or_v_ratio[axis]) * maxVelocity,
128+
(ext_offset_a_or_v_ratio[axis]) * maxVelocity)) {
126129
if (emc_debug & EMC_DEBUG_CONFIG) {
127130
rcs_print_error("bad return from emcAxisSetMaxVelocity\n");
128131
}
@@ -133,9 +136,10 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
133136
// set maximum accels for axis: acc,ext_offset_acc
134137
maxAcceleration = DEFAULT_AXIS_MAX_ACCELERATION;
135138
axisIniFile->Find(&maxAcceleration, "MAX_ACCELERATION", axisString);
136-
if (0 != emcAxisSetMaxAcceleration(axis,
137-
(1 - ext_offset_a_or_v_ratio[axis]) * maxAcceleration,
138-
( ext_offset_a_or_v_ratio[axis]) * maxAcceleration)) {
139+
if (0 != emcAxisSetMaxAcceleration(
140+
axis,
141+
(1 - ext_offset_a_or_v_ratio[axis]) * maxAcceleration,
142+
(ext_offset_a_or_v_ratio[axis]) * maxAcceleration)) {
139143
if (emc_debug & EMC_DEBUG_CONFIG) {
140144
rcs_print_error("bad return from emcAxisSetMaxAcceleration\n");
141145
}
@@ -150,7 +154,7 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
150154
}
151155
return -1;
152156
}
153-
157+
154158
maxJerk = DEFAULT_AXIS_MAX_JERK;
155159
axisIniFile->Find(&maxJerk, "MAX_JERK", axisString);
156160
if (0 != emcAxisSetMaxJerk(axis, maxJerk)) {
@@ -163,7 +167,7 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
163167
}
164168

165169

166-
catch(EmcIniFile::Exception &e){
170+
catch (EmcIniFile::Exception &e) {
167171
e.Print();
168172
return -1;
169173
}
@@ -184,7 +188,7 @@ int iniAxis(int axis, const char *filename)
184188
EmcIniFile::ERR_CONVERSION);
185189

186190
if (axisIniFile.Open(filename) == false) {
187-
return -1;
191+
return -1;
188192
}
189193

190194
// load its values

0 commit comments

Comments
 (0)