You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CCLOC can be used as a static library. You can build the library yourself by running ```make lib```, or download the build static library from the releases section. Include the ```ccloc.h``` header.
3
+
CCLOC can be used as a static library. You can build the library yourself by running ```make lib```, or download the built static library from the releases section. Include the ```ccloc.h``` header.
4
4
5
5
By default the library API exposes only the ```ccloc``` function and the required structures to use it. If you want to use the languages & extensions database use the following defines before including the header:
6
6
```
7
7
#define CCLOC_LANGS_DEFS // for the defines
8
8
#define CCLOC_LANGS // for the languages database
9
-
#define CCLOC_EXTS // for the extensions database
9
+
#define CCLOC_EXTS // for the extensions database
10
10
```
11
11
12
+
All the [options](https://github.com/hypertensiune/ccloc/blob/master/README.md#options) that are used with the ccloc cli tool can be used with the library. The time options doesn't need to be specified, as it is used only by the cli tool to display the time stats (time is calculated regardless of this options). Options are set using the ```loc_options```:
13
+
```
14
+
typedef struct
15
+
{
16
+
int all;
17
+
int time;
18
+
int sort;
19
+
int langs;
20
+
int threads;
21
+
int langs_n;
22
+
char sort_method[10];
23
+
char langs_array[100][20];
24
+
} loc_options;
25
+
```
26
+
27
+
The resulting report is found in the ```report``` parameter of the ```ccloc``` function. If option -a is used ccloc expects that paramter to be a ```loc_file_report``` otherwise a ```loc_report```.
28
+
12
29
### Example
13
30
14
31
```
32
+
// > ccloc .
15
33
#include "ccloc.h"
16
34
17
35
int main()
@@ -20,14 +38,49 @@ int main()
20
38
loc_options options = {0, 0, 0, 0, 20}; // no extra options, 20 threads
0 commit comments