Skip to content

Commit c65f616

Browse files
some styling cleanup whilst I wait for my build
1 parent d3a609e commit c65f616

7 files changed

Lines changed: 356 additions & 338 deletions

File tree

src/structures/List.sac

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,65 @@ module List deprecated "The List module contains a space leak.";
55
export all;
66

77
/*
8-
* The SAC standard module List provides lists of integers as an
9-
* additional data type offering access functions as usual.
8+
* The SAC standard module List provides lists of integers as an
9+
* additional data type offering access functions as usual.
1010
*/
1111

1212
external typedef list;
13-
//#pragma ctype "list*"
1413
#pragma copyfun "SAClistcopy"
1514
#pragma freefun "SAClistfree"
1615
#pragma linkobj "src/List/List.o"
16+
// #pragma ctype "list*"
1717

1818
external list nil();
1919
#pragma linkname "SAClistnil"
2020
#pragma linkobj "src/List/List.o"
2121
// #pragma header "src/List/List.h"
22-
external list cons( int ELEM, list LIST);
22+
23+
external list cons(int ELEM, list LIST);
2324
#pragma linkname "SAClistcons"
2425
#pragma linkobj "src/List/List.o"
2526
// #pragma header "src/List/List.h"
26-
external int hd( list LIST);
27+
28+
external int hd(list LIST);
2729
#pragma linkname "SAClisthead"
2830
#pragma linkobj "src/List/List.o"
2931
// #pragma header "src/List/List.h"
30-
external list tl( list LIST);
32+
33+
external list tl(list LIST);
3134
#pragma linkname "SAClisttail"
3235
#pragma sacarg [0]
3336
#pragma linkobj "src/List/List.o"
3437
// #pragma header "src/List/List.h"
35-
external bool empty( list LIST);
38+
39+
external bool empty(list LIST);
3640
#pragma linkname "SAC_List_empty"
3741
#pragma linkobj "src/List/List.o"
3842
// #pragma header "src/List/List.h"
39-
external list append( list LIST1, list LIST2);
43+
44+
external list append(list LIST1, list LIST2);
4045
#pragma linkname "SAClistappend"
41-
#pragma sacarg [0, 1, 2]
46+
#pragma sacarg [0,1,2]
4247
#pragma linkobj "src/List/List.o"
4348
// #pragma header "src/List/List.h"
44-
external int nth( int N, list LIST);
49+
50+
external int nth(int N, list LIST);
4551
#pragma linkname "SAClistnth"
4652
#pragma linkobj "src/List/List.o"
4753
// #pragma header "src/List/List.h"
48-
external int length( list LIST);
54+
55+
external int length(list LIST);
4956
#pragma linkname "SAClistlength"
5057
#pragma linkobj "src/List/List.o"
5158
// #pragma header "src/List/List.h"
52-
external list drop( int N, list LIST);
59+
60+
external list drop(int N, list LIST);
5361
#pragma linkname "SAClistdrop"
54-
#pragma sacarg [0, 2]
62+
#pragma sacarg [0,2]
5563
#pragma linkobj "src/List/List.o"
5664
// #pragma header "src/List/List.h"
57-
external list take( int N, list LIST);
65+
66+
external list take(int N, list LIST);
5867
#pragma linkname "SAClisttake"
5968
#pragma linkobj "src/List/List.o"
6069
// #pragma header "src/List/List.h"
61-
62-
63-

src/structures/src/Char/Char.c

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,78 @@
1-
/*
2-
* Implementation of standard module Char ctype functions.
3-
* It is sort of unfortunate that we have to use these
4-
* functions as they incur a per-character overhead.
5-
* However, without them incorrect values were produced.
6-
* There were two problems:
7-
* The isxxx(.) functions work on unsigned chars and not on chars.
8-
* They may segfault when not in the range [-1,255].
9-
* They may return any non-zero value when true, but a SAC bool is true if 1.
10-
*/
11-
121
#include <ctype.h>
2+
133
#include "Char.h"
144

155
bool SACisalpha(uchar c)
166
{
17-
return isalpha(c) != 0;
7+
return isalpha(c) != 0;
188
}
199

2010
bool SACisupper(uchar c)
2111
{
22-
return isupper(c) != 0;
12+
return isupper(c) != 0;
2313
}
2414

2515
bool SACislower(uchar c)
2616
{
27-
return islower(c) != 0;
17+
return islower(c) != 0;
2818
}
2919

3020
bool SACisdigit(uchar c)
3121
{
32-
return isdigit(c) != 0;
22+
return isdigit(c) != 0;
3323
}
3424

3525
bool SACisxdigit(uchar c)
3626
{
37-
return isxdigit(c) != 0;
27+
return isxdigit(c) != 0;
3828
}
3929

4030
bool SACisspace(uchar c)
4131
{
42-
return isspace(c) != 0;
32+
return isspace(c) != 0;
4333
}
4434

4535
bool SACispunct(uchar c)
4636
{
47-
return ispunct(c) != 0;
37+
return ispunct(c) != 0;
4838
}
4939

5040
bool SACisalnum(uchar c)
5141
{
52-
return isalnum(c) != 0;
42+
return isalnum(c) != 0;
5343
}
5444

5545
bool SACisprint(uchar c)
5646
{
57-
return isprint(c) != 0;
47+
return isprint(c) != 0;
5848
}
5949

6050
bool SACisgraph(uchar c)
6151
{
62-
return isgraph(c) != 0;
52+
return isgraph(c) != 0;
6353
}
6454

6555
bool SACiscntrl(uchar c)
6656
{
67-
return iscntrl(c) != 0;
57+
return iscntrl(c) != 0;
6858
}
6959

7060
bool SACisascii(sac_int c)
7161
{
72-
return c >= 0 && c < 256 && isascii(c) != 0;
62+
return c >= 0 && c < 256 && isascii(c) != 0;
7363
}
7464

7565
uchar SACtoascii(sac_int c)
7666
{
77-
return toascii(c & 0xFF);
67+
return toascii(c & 0xFF);
7868
}
7969

8070
uchar SACtolower(uchar c)
8171
{
82-
return tolower(c);
72+
return tolower(c);
8373
}
8474

8575
uchar SACtoupper(uchar c)
8676
{
87-
return toupper(c);
77+
return toupper(c);
8878
}
89-

src/structures/src/Char/Char.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
#ifndef STDLIB__CHAR__H
2-
#define STDLIB__CHAR__H
1+
#ifndef _SAC_CHAR_H_
2+
#define _SAC_CHAR_H_
33

44
/*
5-
* Implementation of standard module Char ctype functions.
6-
* It is sort of unfortunate that we have to use these
7-
* functions as they incur a per-character overhead.
8-
* However, without them incorrect values were produced.
9-
* There were two problems:
10-
* The isxxx(.) functions work on unsigned chars and not on chars.
11-
* They may segfault when not in the range [-1,255].
12-
* They may return any non-zero value when true, but a SAC bool is true if 1.
5+
* Implementation of standard module Char ctype functions. It is sort of
6+
* unfortunate that we have to use these functions as they incur a per-character
7+
* overhead. However, without them incorrect values were produced.
8+
* There were two problems:
9+
* - The isxxx(.) functions work on unsigned chars and not on chars.
10+
* They may segfault when not in the range [-1,255].
11+
* - They may return any non-zero value when true, but a SaC bool is true if 1.
1312
*/
1413

15-
#include "sacinterface.h"
1614
#include <stdbool.h>
1715

16+
#include "sacinterface.h"
17+
1818
typedef unsigned char uchar;
1919

2020
bool SACisalpha(uchar c);
@@ -33,4 +33,4 @@ uchar SACtoascii(sac_int c);
3333
uchar SACtolower(uchar c);
3434
uchar SACtoupper(uchar c);
3535

36-
#endif // STDLIB__CHAR__H
36+
#endif /* _SAC_CHAR_H_ */

0 commit comments

Comments
 (0)