Skip to content

Commit 93cb422

Browse files
committed
Update formatting with astyle - use K&R
1 parent 74d9062 commit 93cb422

File tree

377 files changed

+29482
-26171
lines changed

Some content is hidden

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

377 files changed

+29482
-26171
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Linux, OSX (LLVM) | Windows (MSVC)
44
[![Build Status](https://travis-ci.org/stepcode/stepcode.svg?branch=master)](https://travis-ci.org/stepcode/stepcode) | [![Build status](https://ci.appveyor.com/api/projects/status/3fbr9t9gfa812oqu?svg=true)](https://ci.appveyor.com/project/mpictor/stepcode)
55

66
***********************************************************************
7-
STEPcode v0.8 -- stepcode.org, github.com/stepcode/stepcode
7+
STEPcode v0.9 -- stepcode.org, github.com/stepcode/stepcode
88

99
* What is STEPcode? SC reads ISO10303-11 EXPRESS schemas and generates
1010
C++ source code that can read and write Part 21 files conforming
@@ -36,14 +36,16 @@ CODING STANDARDS
3636
SC's source has been reformatted with astyle. When making changes, try
3737
to match the current formatting. The main points are:
3838

39-
- compact (java-style) brackets:
39+
- K&R (Kernighan & Ritchie) brackets:
4040
```C
41-
if( a == 3 ) {
42-
c = 5;
43-
function( a, b );
44-
} else {
45-
somefunc( );
46-
}
41+
int Foo(bool isBar)
42+
{
43+
if (isBar) {
44+
bar();
45+
return 1;
46+
} else
47+
return 0;
48+
}
4749
```
4850
- indents are 4 spaces
4951
- no tab characters

include/exppp/exppp.h

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,56 @@ extern SC_EXPPP_EXPORT int exppp_linelength; /**< leave some slop
1515
extern SC_EXPPP_EXPORT bool exppp_alphabetize; /**< if true, alphabetize */
1616
extern SC_EXPPP_EXPORT bool exppp_terse; /**< don't describe action to stdout */
1717
extern SC_EXPPP_EXPORT bool exppp_reference_info; /**< if true, add commentary about where things came from */
18-
extern SC_EXPPP_EXPORT char * exppp_output_filename; /**< force output filename */
18+
extern SC_EXPPP_EXPORT char *exppp_output_filename; /**< force output filename */
1919
extern SC_EXPPP_EXPORT bool exppp_output_filename_reset; /**< if true, force output filename */
2020
extern SC_EXPPP_EXPORT bool exppp_print_to_stdout; /**< if true, print to stdout */
2121
extern SC_EXPPP_EXPORT bool exppp_aggressively_wrap_consts; /**< for constants, print one item per line */
2222
extern SC_EXPPP_EXPORT bool exppp_tail_comment; /**< print tail comment, such as END_ENTITY; --entity_name */
2323

24-
SC_EXPPP_EXPORT void EXPRESSout( Express e );
24+
SC_EXPPP_EXPORT void EXPRESSout(Express e);
2525

26-
SC_EXPPP_EXPORT void ENTITYout( Entity e );
27-
SC_EXPPP_EXPORT void EXPRout( Expression expr );
28-
SC_EXPPP_EXPORT void FUNCout( Function f );
29-
SC_EXPPP_EXPORT void PROCout( Procedure p );
30-
SC_EXPPP_EXPORT void RULEout( Rule r );
31-
SC_EXPPP_EXPORT char * SCHEMAout( Schema s );
32-
SC_EXPPP_EXPORT void SCHEMAref_out( Schema s );
33-
SC_EXPPP_EXPORT void STMTout( Statement s );
34-
SC_EXPPP_EXPORT void TYPEout( Type t );
35-
SC_EXPPP_EXPORT void TYPEhead_out( Type t );
36-
SC_EXPPP_EXPORT void TYPEbody_out( Type t );
37-
SC_EXPPP_EXPORT void WHEREout( Linked_List w );
26+
SC_EXPPP_EXPORT void ENTITYout(Entity e);
27+
SC_EXPPP_EXPORT void EXPRout(Expression expr);
28+
SC_EXPPP_EXPORT void FUNCout(Function f);
29+
SC_EXPPP_EXPORT void PROCout(Procedure p);
30+
SC_EXPPP_EXPORT void RULEout(Rule r);
31+
SC_EXPPP_EXPORT char *SCHEMAout(Schema s);
32+
SC_EXPPP_EXPORT void SCHEMAref_out(Schema s);
33+
SC_EXPPP_EXPORT void STMTout(Statement s);
34+
SC_EXPPP_EXPORT void TYPEout(Type t);
35+
SC_EXPPP_EXPORT void TYPEhead_out(Type t);
36+
SC_EXPPP_EXPORT void TYPEbody_out(Type t);
37+
SC_EXPPP_EXPORT void WHEREout(Linked_List w);
3838

39-
SC_EXPPP_EXPORT char * REFto_string( Dictionary refdict, Linked_List reflist, char * type, int level );
40-
SC_EXPPP_EXPORT char * ENTITYto_string( Entity e );
41-
SC_EXPPP_EXPORT char * SUBTYPEto_string( Expression e );
42-
SC_EXPPP_EXPORT char * EXPRto_string( Expression expr );
43-
SC_EXPPP_EXPORT char * FUNCto_string( Function f );
44-
SC_EXPPP_EXPORT char * PROCto_string( Procedure p );
45-
SC_EXPPP_EXPORT char * RULEto_string( Rule r );
46-
SC_EXPPP_EXPORT char * SCHEMAref_to_string( Schema s );
47-
SC_EXPPP_EXPORT char * STMTto_string( Statement s );
48-
SC_EXPPP_EXPORT char * TYPEto_string( Type t );
49-
SC_EXPPP_EXPORT char * TYPEhead_to_string( Type t );
50-
SC_EXPPP_EXPORT char * TYPEbody_to_string( Type t );
51-
SC_EXPPP_EXPORT char * WHEREto_string( Linked_List w );
39+
SC_EXPPP_EXPORT char *REFto_string(Dictionary refdict, Linked_List reflist, char *type, int level);
40+
SC_EXPPP_EXPORT char *ENTITYto_string(Entity e);
41+
SC_EXPPP_EXPORT char *SUBTYPEto_string(Expression e);
42+
SC_EXPPP_EXPORT char *EXPRto_string(Expression expr);
43+
SC_EXPPP_EXPORT char *FUNCto_string(Function f);
44+
SC_EXPPP_EXPORT char *PROCto_string(Procedure p);
45+
SC_EXPPP_EXPORT char *RULEto_string(Rule r);
46+
SC_EXPPP_EXPORT char *SCHEMAref_to_string(Schema s);
47+
SC_EXPPP_EXPORT char *STMTto_string(Statement s);
48+
SC_EXPPP_EXPORT char *TYPEto_string(Type t);
49+
SC_EXPPP_EXPORT char *TYPEhead_to_string(Type t);
50+
SC_EXPPP_EXPORT char *TYPEbody_to_string(Type t);
51+
SC_EXPPP_EXPORT char *WHEREto_string(Linked_List w);
5252

53-
SC_EXPPP_EXPORT int REFto_buffer( Dictionary refdict, Linked_List reflist, char * type, int level, char * buffer, int length );
54-
SC_EXPPP_EXPORT int ENTITYto_buffer( Entity e, char * buffer, int length );
55-
SC_EXPPP_EXPORT int EXPRto_buffer( Expression e, char * buffer, int length );
56-
SC_EXPPP_EXPORT int FUNCto_buffer( Function e, char * buffer, int length );
57-
SC_EXPPP_EXPORT int PROCto_buffer( Procedure e, char * buffer, int length );
58-
SC_EXPPP_EXPORT int RULEto_buffer( Rule e, char * buffer, int length );
59-
SC_EXPPP_EXPORT int SCHEMAref_to_buffer( Schema s, char * buffer, int length );
60-
SC_EXPPP_EXPORT int STMTto_buffer( Statement s, char * buffer, int length );
61-
SC_EXPPP_EXPORT int TYPEto_buffer( Type t, char * buffer, int length );
62-
SC_EXPPP_EXPORT int TYPEhead_to_buffer( Type t, char * buffer, int length );
63-
SC_EXPPP_EXPORT int TYPEbody_to_buffer( Type t, char * buffer, int length );
64-
SC_EXPPP_EXPORT int WHEREto_buffer( Linked_List w, char * buffer, int length );
53+
SC_EXPPP_EXPORT int REFto_buffer(Dictionary refdict, Linked_List reflist, char *type, int level, char *buffer, int length);
54+
SC_EXPPP_EXPORT int ENTITYto_buffer(Entity e, char *buffer, int length);
55+
SC_EXPPP_EXPORT int EXPRto_buffer(Expression e, char *buffer, int length);
56+
SC_EXPPP_EXPORT int FUNCto_buffer(Function e, char *buffer, int length);
57+
SC_EXPPP_EXPORT int PROCto_buffer(Procedure e, char *buffer, int length);
58+
SC_EXPPP_EXPORT int RULEto_buffer(Rule e, char *buffer, int length);
59+
SC_EXPPP_EXPORT int SCHEMAref_to_buffer(Schema s, char *buffer, int length);
60+
SC_EXPPP_EXPORT int STMTto_buffer(Statement s, char *buffer, int length);
61+
SC_EXPPP_EXPORT int TYPEto_buffer(Type t, char *buffer, int length);
62+
SC_EXPPP_EXPORT int TYPEhead_to_buffer(Type t, char *buffer, int length);
63+
SC_EXPPP_EXPORT int TYPEbody_to_buffer(Type t, char *buffer, int length);
64+
SC_EXPPP_EXPORT int WHEREto_buffer(Linked_List w, char *buffer, int length);
6565

66-
SC_EXPPP_EXPORT int EXPRlength( Expression e );
67-
extern SC_EXPPP_EXPORT void tail_comment( const char * name );
68-
extern SC_EXPPP_EXPORT int count_newlines( char * s );
66+
SC_EXPPP_EXPORT int EXPRlength(Expression e);
67+
extern SC_EXPPP_EXPORT void tail_comment(const char *name);
68+
extern SC_EXPPP_EXPORT int count_newlines(char *s);
6969

7070
#endif

include/express/alg.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
/* typedefs */
5151
/************/
5252

53-
typedef struct Scope_ * Procedure;
54-
typedef struct Scope_ * Function;
55-
typedef struct Scope_ * Rule;
56-
typedef struct Where_ * Where;
53+
typedef struct Scope_ *Procedure;
54+
typedef struct Scope_ *Function;
55+
typedef struct Scope_ *Rule;
56+
typedef struct Where_ *Where;
5757

5858
/***************************/
5959
/* hidden type definitions */
@@ -63,13 +63,13 @@ typedef struct Where_ * Where;
6363
* As each (real) call is resolved, the tag->type is temporarily borrowed
6464
*/
6565
struct tag {
66-
char * name;
66+
char *name;
6767
Type type;
6868
};
6969

7070
/** location of fulltext of algorithm in source file */
7171
struct FullText {
72-
const char * filename;
72+
const char *filename;
7373
unsigned int start, end;
7474
};
7575

@@ -101,7 +101,7 @@ struct Rule_ {
101101

102102
/** define a where clause */
103103
struct Where_ {
104-
Symbol * label;
104+
Symbol *label;
105105
Expression expr;
106106
};
107107

@@ -161,8 +161,8 @@ extern SC_EXPRESS_EXPORT struct freelist_head WHERE_fl;
161161
/* function prototypes */
162162
/***********************/
163163

164-
extern SC_EXPRESS_EXPORT Scope ALGcreate( char );
165-
extern SC_EXPRESS_EXPORT void ALGinitialize( void );
166-
extern SC_EXPRESS_EXPORT void ALGput_full_text( Scope, int, int );
164+
extern SC_EXPRESS_EXPORT Scope ALGcreate(char);
165+
extern SC_EXPRESS_EXPORT void ALGinitialize(void);
166+
extern SC_EXPRESS_EXPORT void ALGput_full_text(Scope, int, int);
167167

168168
#endif /* ALGORITHM_H */

include/express/alloc.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
typedef long Align;
3636

3737
union freelist {
38-
union freelist * next; /**< next block on freelist */
38+
union freelist *next; /**< next block on freelist */
3939
char memory; /**< user data */
4040
Align aligner; /**< force alignment of blocks */
4141
};
@@ -52,13 +52,13 @@ struct freelist_head {
5252
#endif
5353
int size; /**< size of a single elt incl. next ptr */
5454
int bytes; /**< if we run out, allocate memory by this many bytes */
55-
Freelist * freelist;
55+
Freelist *freelist;
5656
#ifdef SPACE_PROFILE
5757
int count;
5858
#endif
5959
};
6060

61-
char * nnew();
61+
char *nnew();
6262

6363
#include "error.h"
6464

@@ -75,10 +75,10 @@ extern SC_EXPRESS_EXPORT int yylineno;
7575
fprintf(stderr,"fedex: out of space");\
7676
} else {}
7777

78-
SC_EXPRESS_EXPORT void _ALLOCinitialize( void );
79-
SC_EXPRESS_EXPORT void ALLOCinitialize( struct freelist_head * flh, unsigned int size, int alloc1, int alloc2 );
80-
SC_EXPRESS_EXPORT void ALLOC_destroy( struct freelist_head *, Freelist * );
81-
SC_EXPRESS_EXPORT void * ALLOC_new( struct freelist_head * );
78+
SC_EXPRESS_EXPORT void _ALLOCinitialize(void);
79+
SC_EXPRESS_EXPORT void ALLOCinitialize(struct freelist_head *flh, unsigned int size, int alloc1, int alloc2);
80+
SC_EXPRESS_EXPORT void ALLOC_destroy(struct freelist_head *, Freelist *);
81+
SC_EXPRESS_EXPORT void *ALLOC_new(struct freelist_head *);
8282

8383
#endif /* ALLOC_H */
8484

include/express/basic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393
/* function pointer types */
9494
/**************************/
9595

96-
typedef void ( *voidFuncptr )();
97-
typedef int ( *intFuncptr )();
96+
typedef void (*voidFuncptr)();
97+
typedef int (*intFuncptr)();
9898

9999
#endif /* BASIC_H */
100100

include/express/caseitem.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
/* typedefs */
4949
/************/
5050

51-
typedef struct Case_Item_ * Case_Item;
51+
typedef struct Case_Item_ *Case_Item;
5252

5353
/****************/
5454
/* modules used */
@@ -63,7 +63,7 @@ typedef struct Case_Item_ * Case_Item;
6363
struct Case_Item_ {
6464
Symbol symbol;
6565
Linked_List labels;
66-
struct Statement_ * action;
66+
struct Statement_ *action;
6767
};
6868

6969
/********************/
@@ -86,7 +86,7 @@ extern SC_EXPRESS_EXPORT struct freelist_head CASE_IT_fl;
8686
#define CASE_IT_new() (struct Case_Item_ *)ALLOC_new(&CASE_IT_fl)
8787
#define CASE_IT_destroy(x) ALLOC_destroy(&CASE_IT_fl,(Freelist *)x)
8888

89-
extern SC_EXPRESS_EXPORT Case_Item CASE_ITcreate( Linked_List, struct Statement_ * );
90-
extern SC_EXPRESS_EXPORT void CASE_ITinitialize( void );
89+
extern SC_EXPRESS_EXPORT Case_Item CASE_ITcreate(Linked_List, struct Statement_ *);
90+
extern SC_EXPRESS_EXPORT void CASE_ITinitialize(void);
9191

9292
#endif /*CASE_ITEM_H*/

include/express/dict.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
/* typedefs */
5656
/************/
5757

58-
typedef struct Hash_Table_ * Dictionary;
58+
typedef struct Hash_Table_ *Dictionary;
5959
typedef HashEntry DictionaryEntry;
6060

6161
/****************/
@@ -97,14 +97,14 @@ extern SC_EXPRESS_EXPORT char DICT_type; /**< set as a side-effect of DICT look
9797
/* function prototypes */
9898
/***********************/
9999

100-
extern SC_EXPRESS_EXPORT void DICTinitialize( void );
101-
extern SC_EXPRESS_EXPORT void DICTcleanup( void );
102-
extern SC_EXPRESS_EXPORT int DICTdefine( Dictionary, char *, void *, Symbol *, char );
103-
extern SC_EXPRESS_EXPORT int DICT_define( Dictionary, char *, void *, Symbol *, char );
104-
extern SC_EXPRESS_EXPORT void DICTundefine( Dictionary, char * );
105-
extern SC_EXPRESS_EXPORT void * DICTlookup( Dictionary, char * );
106-
extern SC_EXPRESS_EXPORT void * DICTlookup_symbol( Dictionary, char *, Symbol ** );
107-
extern SC_EXPRESS_EXPORT void * DICTdo( DictionaryEntry * );
108-
extern SC_EXPRESS_EXPORT void DICTprint( Dictionary );
100+
extern SC_EXPRESS_EXPORT void DICTinitialize(void);
101+
extern SC_EXPRESS_EXPORT void DICTcleanup(void);
102+
extern SC_EXPRESS_EXPORT int DICTdefine(Dictionary, char *, void *, Symbol *, char);
103+
extern SC_EXPRESS_EXPORT int DICT_define(Dictionary, char *, void *, Symbol *, char);
104+
extern SC_EXPRESS_EXPORT void DICTundefine(Dictionary, char *);
105+
extern SC_EXPRESS_EXPORT void *DICTlookup(Dictionary, char *);
106+
extern SC_EXPRESS_EXPORT void *DICTlookup_symbol(Dictionary, char *, Symbol **);
107+
extern SC_EXPRESS_EXPORT void *DICTdo(DictionaryEntry *);
108+
extern SC_EXPRESS_EXPORT void DICTprint(Dictionary);
109109

110110
#endif /*DICTIONARY_H*/

include/express/entity.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
/* typedefs */
7070
/************/
7171

72-
typedef struct Scope_ * Entity;
72+
typedef struct Scope_ *Entity;
7373

7474
/****************/
7575
/* modules used */
@@ -140,19 +140,19 @@ extern SC_EXPRESS_EXPORT int ENTITY_MARK;
140140
/* function prototypes */
141141
/***********************/
142142

143-
extern SC_EXPRESS_EXPORT struct Scope_ * ENTITYcreate( struct Symbol_ * );
144-
extern SC_EXPRESS_EXPORT void ENTITYinitialize( void );
145-
extern SC_EXPRESS_EXPORT void ENTITYadd_attribute( struct Scope_ *, struct Variable_ * );
146-
extern SC_EXPRESS_EXPORT struct Scope_ * ENTITYcopy( struct Scope_ * );
147-
extern SC_EXPRESS_EXPORT Entity ENTITYfind_inherited_entity( struct Scope_ *, char *, int );
148-
extern SC_EXPRESS_EXPORT Variable ENTITYfind_inherited_attribute( struct Scope_ *, char *, struct Symbol_ ** );
149-
extern SC_EXPRESS_EXPORT Variable ENTITYresolve_attr_ref( Entity, Symbol *, Symbol * );
150-
extern SC_EXPRESS_EXPORT bool ENTITYhas_immediate_supertype( Entity, Entity );
151-
extern SC_EXPRESS_EXPORT Variable ENTITYget_named_attribute( Entity, char * );
152-
extern SC_EXPRESS_EXPORT Linked_List ENTITYget_all_attributes( Entity );
153-
extern SC_EXPRESS_EXPORT bool ENTITYhas_supertype( Entity, Entity );
154-
extern SC_EXPRESS_EXPORT void ENTITYadd_instance( Entity, void *);
155-
extern SC_EXPRESS_EXPORT int ENTITYget_initial_offset( Entity );
156-
extern SC_EXPRESS_EXPORT int ENTITYdeclares_variable( Entity, struct Variable_ * );
143+
extern SC_EXPRESS_EXPORT struct Scope_ *ENTITYcreate(struct Symbol_ *);
144+
extern SC_EXPRESS_EXPORT void ENTITYinitialize(void);
145+
extern SC_EXPRESS_EXPORT void ENTITYadd_attribute(struct Scope_ *, struct Variable_ *);
146+
extern SC_EXPRESS_EXPORT struct Scope_ *ENTITYcopy(struct Scope_ *);
147+
extern SC_EXPRESS_EXPORT Entity ENTITYfind_inherited_entity(struct Scope_ *, char *, int);
148+
extern SC_EXPRESS_EXPORT Variable ENTITYfind_inherited_attribute(struct Scope_ *, char *, struct Symbol_ **);
149+
extern SC_EXPRESS_EXPORT Variable ENTITYresolve_attr_ref(Entity, Symbol *, Symbol *);
150+
extern SC_EXPRESS_EXPORT bool ENTITYhas_immediate_supertype(Entity, Entity);
151+
extern SC_EXPRESS_EXPORT Variable ENTITYget_named_attribute(Entity, char *);
152+
extern SC_EXPRESS_EXPORT Linked_List ENTITYget_all_attributes(Entity);
153+
extern SC_EXPRESS_EXPORT bool ENTITYhas_supertype(Entity, Entity);
154+
extern SC_EXPRESS_EXPORT void ENTITYadd_instance(Entity, void *);
155+
extern SC_EXPRESS_EXPORT int ENTITYget_initial_offset(Entity);
156+
extern SC_EXPRESS_EXPORT int ENTITYdeclares_variable(Entity, struct Variable_ *);
157157

158158
#endif /* ENTITY_H */

0 commit comments

Comments
 (0)