Skip to content

Commit 0b24006

Browse files
committed
feat: update C/C++ language information
1 parent 8df6816 commit 0b24006

9 files changed

Lines changed: 167 additions & 29 deletions

File tree

LANGUAGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ C Header (h)
4646
C Shell (csh,.cshrc)
4747
C# (cs,csx)
4848
C++ (cc,cpp,cxx,c++,pcc,ino,ccm,cppm,cxxm,c++m,mxx)
49-
C++ Header (hh,hpp,hxx,inl,ipp,ixx)
49+
C++ Header (hh,hpp,hxx,h++,inl,ipp,ixx,tpp)
5050
C3 (c3)
5151
Cabal (cabal)
5252
Cairo (cairo)

SCC-OUTPUT-REPORT.html

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
<tbody><tr>
1414
<th>Go</th>
1515
<th>34</th>
16-
<th>27161</th>
16+
<th>27179</th>
1717
<th>1780</th>
1818
<th>614</th>
19-
<th>24767</th>
19+
<th>24785</th>
2020
<th>1969</th>
21-
<th>553461</th>
22-
<th>8110</th>
21+
<th>553671</th>
22+
<th>8116</th>
2323
</tr><tr>
2424
<td>processor/constants.go</td>
2525
<td></td>
26-
<td>14111</td>
26+
<td>14125</td>
2727
<td>1</td>
2828
<td>2</td>
29-
<td>14108</td>
29+
<td>14122</td>
3030
<td>0</td>
31-
<td>221456</td>
32-
<td>2163</td>
31+
<td>221620</td>
32+
<td>2165</td>
3333
</tr><tr>
3434
<td>processor/workers_test.go</td>
3535
<td></td>
@@ -83,13 +83,13 @@
8383
</tr><tr>
8484
<td>main_test.go</td>
8585
<td></td>
86-
<td>695</td>
86+
<td>699</td>
8787
<td>54</td>
8888
<td>15</td>
89-
<td>626</td>
89+
<td>630</td>
9090
<td>179</td>
91-
<td>16650</td>
92-
<td>391</td>
91+
<td>16696</td>
92+
<td>395</td>
9393
</tr><tr>
9494
<td>cmd/badges/main.go</td>
9595
<td></td>
@@ -320,16 +320,6 @@
320320
<td>0</td>
321321
<td>2209</td>
322322
<td>35</td>
323-
</tr><tr>
324-
<td>processor/bloom.go</td>
325-
<td></td>
326-
<td>37</td>
327-
<td>7</td>
328-
<td>12</td>
329-
<td>18</td>
330-
<td>2</td>
331-
<td>1062</td>
332-
<td>29</td>
333323
</tr><tr>
334324
<td>processor/cocomo_test.go</td>
335325
<td></td>
@@ -340,6 +330,16 @@
340330
<td>6</td>
341331
<td>686</td>
342332
<td>23</td>
333+
</tr><tr>
334+
<td>processor/bloom.go</td>
335+
<td></td>
336+
<td>37</td>
337+
<td>7</td>
338+
<td>12</td>
339+
<td>18</td>
340+
<td>2</td>
341+
<td>1062</td>
342+
<td>29</td>
343343
</tr><tr>
344344
<td>processor/helpers_test.go</td>
345345
<td></td>
@@ -364,15 +364,15 @@
364364
<tfoot><tr>
365365
<th>Total</th>
366366
<th>34</th>
367-
<th>27161</th>
367+
<th>27179</th>
368368
<th>1780</th>
369369
<th>614</th>
370-
<th>24767</th>
370+
<th>24785</th>
371371
<th>1969</th>
372-
<th>553461</th>
373-
<th>8110</th>
372+
<th>553671</th>
373+
<th>8116</th>
374374
</tr>
375375
<tr>
376-
<th colspan="9">Estimated Cost to Develop (organic) $785,529<br>Estimated Schedule Effort (organic) 12.55 months<br>Estimated People Required (organic) 5.56<br></th>
376+
<th colspan="9">Estimated Cost to Develop (organic) $786,128<br>Estimated Schedule Effort (organic) 12.55 months<br>Estimated People Required (organic) 5.56<br></th>
377377
</tr></tfoot>
378378
</table></body></html>

examples/language/c.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include "cheader.h"
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
5+
// generate table
6+
table_t generate_table(int width)
7+
{
8+
if (width <= 0) {
9+
return NULL;
10+
}
11+
12+
table_t table = (table_t)malloc(sizeof(int*)*width);
13+
for (int i = 0; i < width; ++i) {
14+
int *row = (int*)calloc(width, sizeof(int));
15+
for (int j = 0; j <= i; ++j) {
16+
row[j] = (i+1) * (j+1);
17+
}
18+
table[i] = row;
19+
}
20+
21+
return table;
22+
}
23+
24+
#define WIDTH 9
25+
26+
int main(void)
27+
{
28+
table_t table = generate_table(WIDTH);
29+
if (table == NULL) {
30+
return 1;
31+
}
32+
33+
for (int i = WIDTH; i > 0; --i) {
34+
for (int j = 0; j <= i-1; ++j) {
35+
printf("%dx%d=%d ", (j+1), i, table[i-1][j]);
36+
}
37+
printf("\n");
38+
}
39+
free_table(table, WIDTH);
40+
41+
return 0;
42+
}
43+
44+
void free_table(table_t table, int width)
45+
{
46+
if (table == NULL || width <= 0) {
47+
return;
48+
}
49+
50+
for (int i = 0; i < width; ++i) {
51+
free(table[i]);
52+
}
53+
free(table);
54+
}

examples/language/cheader.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
typedef int **table_t;
4+
5+
extern table_t generate_table(int width);
6+
extern void free_table(table_t table, int width);

examples/language/cplusplus.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// compile with C++23
2+
#include "cplusplusheader.hpp"
3+
4+
int main()
5+
{
6+
constexpr auto table = generate_table<9>();
7+
static_assert(table.size(), "empty table");
8+
print_table(table);
9+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#pragma once
2+
// compile with C++23
3+
#include <array>
4+
#include <print>
5+
6+
template <std::size_t N>
7+
constexpr std::array<std::array<std::size_t, N>, N> generate_table() noexcept
8+
{
9+
if constexpr (N == 0) {
10+
return {};
11+
}
12+
13+
std::array<std::array<std::size_t, N>, N> table;
14+
15+
for (auto i = std::size_t{0}; i < N; ++i) {
16+
auto row = std::array<std::size_t, N>{};
17+
for (auto j = std::size_t{0}; j <= i; ++j) {
18+
row[j] = (i+1) * (j+1);
19+
}
20+
table[i] = std::move(row);
21+
}
22+
23+
return table;
24+
}
25+
26+
template <typename T, std::size_t N>
27+
void print_table(const std::array<std::array<T, N>, N> &table) noexcept
28+
{
29+
if constexpr (N == 0) {
30+
return;
31+
}
32+
33+
for (auto i = N; i > 0; --i) {
34+
for (auto j = std::size_t{0}; j <= i-1; ++j) {
35+
std::print("{}x{}={} ", (j+1), i, table[i-1][j]);
36+
}
37+
std::print("\n");
38+
}
39+
}

languages.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@
883883
"while ",
884884
"while(",
885885
"else ",
886+
"else{",
886887
"|| ",
887888
"&& ",
888889
"!= ",
@@ -910,6 +911,7 @@
910911
"while ",
911912
"while(",
912913
"else ",
914+
"else{",
913915
"|| ",
914916
"&& ",
915917
"!= ",
@@ -1025,6 +1027,11 @@
10251027
"while ",
10261028
"while(",
10271029
"else ",
1030+
"else{",
1031+
"try ",
1032+
"try{",
1033+
"catch ",
1034+
"catch(",
10281035
"|| ",
10291036
"&& ",
10301037
"!= ",
@@ -1051,12 +1058,17 @@
10511058
"while ",
10521059
"while(",
10531060
"else ",
1061+
"else{",
1062+
"try ",
1063+
"try{",
1064+
"catch ",
1065+
"catch(",
10541066
"|| ",
10551067
"&& ",
10561068
"!= ",
10571069
"== "
10581070
],
1059-
"extensions": ["hh", "hpp", "hxx", "inl", "ipp", "ixx"],
1071+
"extensions": ["hh", "hpp", "hxx", "h++", "inl", "ipp", "ixx", "tpp"],
10601072
"line_comment": ["//"],
10611073
"multi_line": [["/*", "*/"]],
10621074
"quotes": [

main_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,13 @@ func TestSpecificLanguages(t *testing.T) {
563563
"Boo",
564564
"Bosque",
565565
"Bru",
566+
"C",
566567
"C3",
568+
"C Header",
567569
"C Shell",
568570
"C#",
571+
"C++",
572+
"C++ Header",
569573
"Cairo",
570574
"Cangjie",
571575
"Chapel",

processor/constants.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)