From f1cb16648fae0ae67277c12e85645c3375572f35 Mon Sep 17 00:00:00 2001 From: DX-MON Date: Fri, 27 Jun 2014 12:49:11 +0100 Subject: [PATCH] Added samples for .C and .H files to fix the pedantic tests for sample presense --- lib/linguist/languages.yml | 2 - lib/linguist/samples.json | 193 +++++++++++++++++++++++++++---------- samples/C/2D.C | 145 ++++++++++++++++++++++++++++ samples/C/2D.H | 29 ++++++ 4 files changed, 314 insertions(+), 55 deletions(-) create mode 100644 samples/C/2D.C create mode 100644 samples/C/2D.H diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 058127aa..1038cc7a 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -284,11 +284,9 @@ C++: - cpp extensions: - .cpp - - .C - .c++ - .cc - .cxx - - .H - .h++ - .hh - .hpp diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 50dce5c9..9815310d 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -52,6 +52,8 @@ ".brs" ], "C": [ + ".C", + ".H", ".c", ".cats", ".h" @@ -783,8 +785,8 @@ "exception.zep.php" ] }, - "tokens_total": 650044, - "languages_total": 853, + "tokens_total": 650833, + "languages_total": 855, "tokens": { "ABAP": { "*/**": 1, @@ -5400,27 +5402,27 @@ "buttons": 1 }, "C": { - "#ifndef": 93, + "#ifndef": 94, "REFU_USTRING_H": 2, - "#define": 927, - "#include": 186, + "#define": 929, + "#include": 192, "": 1, "#ifdef": 70, "RF_MODULE_STRINGS//": 1, "check": 8, - "if": 1018, - "the": 91, + "if": 1023, + "the": 95, "strings": 5, "are": 6, "included": 2, "as": 4, "a": 80, "module": 3, - "": 8, + "": 9, "": 2, "": 1, - "//": 267, - "for": 92, + "//": 281, + "for": 98, "argument": 1, "count": 17, "": 2, @@ -5433,20 +5435,20 @@ "unicode": 2, "__cplusplus": 22, "extern": 41, - "{": 1616, + "{": 1635, "opening": 2, "bracket": 4, "calling": 4, "from": 16, "C": 14, - "+": 696, - "#endif": 264, + "+": 732, + "#endif": 265, "RF_CASE_IGNORE": 2, "RF_MATCH_WORD": 5, "RF_STRING_INDEX_OUT_OF_BOUNDS": 2, - "(": 6533, + "(": 6594, "uint32_t": 144, - ")": 6543, + ")": 6604, "xFF0FFFF": 1, "rfUTF8_IsContinuationByte2": 1, "b__": 3, @@ -5486,7 +5488,7 @@ "other": 16, "ref": 1, "RF_StringX": 2, - "to": 37, + "to": 39, "see": 2, "what": 1, "operations": 1, @@ -5507,10 +5509,10 @@ "Once": 1, "been": 1, "created": 1, - "it": 12, + "it": 13, "assumed": 1, "stream": 3, - "of": 44, + "of": 45, "bytes": 225, "inside": 2, "valid": 1, @@ -5553,8 +5555,8 @@ "constructor": 1, "i_StringCHandle": 1, "rfString_Create": 4, - ";": 5833, - "}": 1632, + ";": 5912, + "}": 1651, "**": 6, "@endcpp": 1, "@endinternal": 1, @@ -5591,7 +5593,7 @@ "i_SELECT_RF_STRING_CREATELOCAL": 1, "i_SELECT_RF_STRING_CREATELOCAL1": 1, "i_SELECT_RF_STRING_CREATELOCAL0": 1, - "char": 531, + "char": 533, "rfString_Init": 3, "str": 162, "i_rfString_Init": 3, @@ -5616,7 +5618,7 @@ "i_SELECT_RF_STRING_INIT_NC0": 1, "rfString_Create_i": 2, "int32_t": 112, - "i": 434, + "i": 457, "rfString_Init_i": 2, "rfString_Create_f": 2, "float": 231, @@ -5630,7 +5632,7 @@ "//@": 1, "#if": 105, "defined": 55, - "void": 299, + "void": 324, "rfString_Assign": 2, "dest": 7, "void*": 135, @@ -5653,9 +5655,9 @@ "length": 58, "rfString_ToUTF32": 4, "uint32_t*length": 1, - "-": 1856, + "-": 1863, "iteration": 6, - "/": 27, + "/": 28, "rfString_Iterate_Start": 6, "string_": 9, "startCharacterPos_": 4, @@ -5664,8 +5666,8 @@ "j_": 6, "while": 70, "rfUTF8_IsContinuationByte": 12, - "[": 1377, - "]": 1377, + "[": 1381, + "]": 1381, "false": 77, "rfString_BytePosToCodePoint": 7, "rfString_Iterate_End": 4, @@ -5689,7 +5691,7 @@ "c_index_": 3, "rfString_IterateB_End": 1, "rfString_Length": 5, - "*": 505, + "*": 508, "rfString_GetChar": 2, "c": 252, "bytepos": 12, @@ -5725,7 +5727,7 @@ "rfString_ToInt": 1, "int32_t*": 1, "v": 25, - "int": 459, + "int": 509, "rfString_ToDouble": 1, "double*": 1, "rfString_Copy_OUT": 2, @@ -5835,7 +5837,7 @@ "i_SELECT_RF_STRING_BEFORE0": 1, "rfString_After": 4, "after": 6, - "out": 19, + "out": 20, "i_rfString_After": 5, "i_NPSELECT_RF_STRING_AFTER": 1, "i_NPSELECT_RF_STRING_AFTER1": 1, @@ -6005,8 +6007,8 @@ "num": 24, "RF_HEXEQ_UI": 7, "rfFgetc_UTF32BE": 3, - "&": 465, - "else": 190, + "&": 467, + "else": 192, "else//": 14, "undo": 5, "peek": 5, @@ -6021,7 +6023,7 @@ "rfFgetc_UTF32LE": 4, "rfFgets_UTF16BE": 2, "rfFgetc_UTF16BE": 4, - "<": 223, + "<": 231, "rfFgets_UTF16LE": 2, "rfFgetc_UTF16LE": 4, "rfFgets_UTF8": 2, @@ -6101,7 +6103,7 @@ "rfFback_UTF16BE": 2, "rfFback_UTF16LE": 2, "rfFback_UTF8": 2, - "switch": 46, + "switch": 47, "depending": 1, "read": 1, "backwards": 1, @@ -6150,7 +6152,7 @@ "commit_list_sort_by_date": 2, "free_commit_list": 1, "*list": 2, - "enum": 30, + "enum": 42, "cmit_fmt": 3, "CMIT_FMT_RAW": 1, "CMIT_FMT_MEDIUM": 2, @@ -6286,6 +6288,106 @@ "parse_signed_commit": 1, "*message": 1, "*signature": 1, + "__2DGFX": 2, + "": 6, + "": 1, + "": 1, + "VGAPIX": 1, + "x": 95, + "y": 55, + "vgabasemem": 3, + "DPMI_REGS": 1, + "regs": 2, + "//void": 1, + "setvgabasemem": 1, + "drw_chdis": 4, + "mode": 15, + "draw_func_change_display": 1, + "drw_pix": 2, + "COLORS": 12, + "col": 28, + "drw_line": 6, + "x0": 10, + "y0": 10, + "x1": 10, + "y1": 9, + "drw_rectl": 2, + "w": 21, + "h": 12, + "drw_rectf": 2, + "drw_cirl": 1, + "rad": 3, + "drw_tex": 2, + "tex": 3, + "D_init": 2, + "D_exit": 2, + "set_vgabasemem": 2, + "ULONG": 1, + "vgabase": 3, + "SELECTOR": 1, + "tmp": 18, + "asm": 1, + "mov": 1, + "ds": 1, + "dpmi_get_sel_base": 1, + "xa0000": 1, + "change": 2, + "display": 2, + "regs.b.ah": 1, + "seet": 1, + "theh": 1, + "moode": 1, + "regs.b.al": 1, + "like": 1, + "innit": 1, + "regs.h.flags": 1, + "Set": 2, + "dingoes": 1, + "kidneys": 1, + "FLAGS": 1, + "eh": 1, + "regs.h.ss": 1, + "Like": 1, + "totally": 1, + "set": 1, + "stack": 8, + "segment": 1, + "regs.h.sp": 1, + "tha": 1, + "pointaaaaahhhhh": 1, + "dpmi_simulate_real_interrupt": 1, + "*VGAPIX": 6, + "stp": 3, + "abs": 5, + "dx": 4, + "dy": 3, + "err": 43, + "yi": 5, + "j": 222, + "excrement": 1, + "drw_circl": 1, + "mang": 3, + "max": 5, + "angle": 1, + "haha": 1, + "px": 4, + "py": 4, + "Yeah": 1, + "yeah": 1, + "I": 1, + "ll": 1, + "later": 1, + "cos": 15, + "*rad": 2, + "causes": 1, + "some": 1, + "really": 1, + "cools": 1, + "effects": 1, + "D": 9, + "sin": 17, + "i*w": 1, + "j*w": 1, "git_usage_string": 2, "git_more_info_string": 2, "N_": 1, @@ -6481,7 +6583,6 @@ "STRBUF_INIT": 1, "*tmp": 1, "strbuf_addf": 1, - "tmp": 6, "cmd.buf": 1, "run_command_v_opt": 1, "RUN_SILENT_EXEC_FAILURE": 1, @@ -6518,7 +6619,6 @@ "": 1, "": 2, "": 1, - "": 4, "": 1, "sharedObjectsStruct": 1, "shared": 1, @@ -6720,7 +6820,6 @@ "ll2string": 3, "write": 7, "goto": 159, - "err": 38, "time": 10, "close": 13, "oom": 3, @@ -6804,7 +6903,6 @@ "used*100/size": 1, "REDIS_HT_MINFILL": 1, "tryResizeHashTables": 2, - "j": 206, "server.dbnum": 8, "server.db": 23, ".dict": 9, @@ -7746,7 +7844,6 @@ "classes": 1, "depends": 1, "strict": 2, - "mode": 11, "define": 14, "CR": 18, "r": 58, @@ -7869,7 +7966,6 @@ "sd_markdown": 6, "tag": 1, "tag_len": 3, - "w": 9, "is_empty": 4, "htmlblock_end": 3, "*curtag": 2, @@ -7895,7 +7991,6 @@ "columns": 3, "*col_data": 1, "header_flag": 3, - "col": 9, "*row_work": 1, "cb.table_cell": 3, "cb.table_row": 2, @@ -8719,7 +8814,6 @@ "cpumask_test_cpu": 1, "CPU_STARTING_FROZEN": 1, "MASK_DECLARE_1": 3, - "x": 70, "UL": 1, "MASK_DECLARE_2": 3, "MASK_DECLARE_4": 3, @@ -8859,7 +8953,6 @@ "sz": 10, "GLKMatrix4MakeRotation": 5, "radians": 34, - "y": 29, "GLKMatrix4MakeXRotation": 3, "GLKMatrix4MakeYRotation": 3, "GLKMatrix4MakeZRotation": 3, @@ -8954,10 +9047,8 @@ "m.m": 54, "GLKVector3Normalize": 3, "GLKVector3Make": 4, - "cos": 14, "cosf": 4, "cosp": 10, - "sin": 16, "sinf": 4, "v.v": 27, "cotan": 3, @@ -9221,7 +9312,6 @@ "__WGLEW_ARB_multisample": 2, "WGL_ARB_pbuffer": 2, "WGL_DRAW_TO_PBUFFER_ARB": 1, - "D": 8, "WGL_MAX_PBUFFER_PIXELS_ARB": 1, "E": 11, "WGL_MAX_PBUFFER_WIDTH_ARB": 1, @@ -10028,7 +10118,6 @@ "wglewIsSupported": 2, "wglewGetExtension": 1, "": 1, - "stack": 6, "READ_VSNPRINTF_ARGS": 5, "rfUTF8_VerifySequence": 7, "RF_FAILURE": 24, @@ -10104,7 +10193,6 @@ "C0000": 2, "RE_UTF8_INVALID_CODE_POINT": 2, "numLen": 8, - "max": 4, "most": 3, "environment": 3, "so": 4, @@ -10860,7 +10948,6 @@ "__Pyx_c_conjf": 3, "conj": 3, "__Pyx_c_absf": 3, - "abs": 2, "__Pyx_c_powf": 3, "pow": 2, "conjf": 1, @@ -70019,7 +70106,7 @@ "BlitzBasic": 2065, "Bluespec": 1298, "Brightscript": 579, - "C": 65181, + "C": 65970, "C#": 278, "C++": 35125, "COBOL": 90, @@ -70216,7 +70303,7 @@ "BlitzBasic": 3, "Bluespec": 2, "Brightscript": 1, - "C": 34, + "C": 36, "C#": 2, "C++": 32, "COBOL": 4, @@ -70396,5 +70483,5 @@ "fish": 3, "wisp": 1 }, - "md5": "2cef2210615db3d211a7ae06ef9d1df9" + "md5": "6445a23d1a2a3c6a77967a8ea5458359" } \ No newline at end of file diff --git a/samples/C/2D.C b/samples/C/2D.C new file mode 100644 index 00000000..b3d45015 --- /dev/null +++ b/samples/C/2D.C @@ -0,0 +1,145 @@ +#include "2D.h" +#include + +void set_vgabasemem(void) +{ + ULONG vgabase; + SELECTOR tmp; + asm mov [tmp], ds + dpmi_get_sel_base(&vgabase, tmp); + vgabasemem = (char *)(-vgabase + 0xa0000); +} + +void drw_chdis(int mode) // change the display! +{ + regs.b.ah = 0x00; // seet theh display moode + regs.b.al = mode; // change it to the mode like innit + regs.h.flags = 0x72;// Set the dingoes kidneys out of FLAGS eh? + regs.h.ss = 0; // Like, totally set the stack segment + regs.h.sp = 0; // Set tha stack pointaaaaahhhhh!!! + dpmi_simulate_real_interrupt(0x10, ®s); +} + +void drw_pix(int x, int y, enum COLORS col) +{ + *VGAPIX(x, y) = col; +} + +void drw_line(int x0, int y0, int x1, int y1, enum COLORS col) +{ + // Going for the optimized version of bresenham's line algo. + int stp = (abs(y0 - y1) > abs(x0 - x1)); + int tmp, dx, dy, err, yi, i, j; // yi = y excrement + if (stp) { + // swappity swap + tmp = y0; + y0 = x0; + x0 = tmp; + + tmp = y1; + y1 = x1; + x1 = tmp; + } + // AAAAND NOW WE MUST DO ZEES AGAIN :( + // I'm sure there was a func somewhere that does this? :P + if (x0 > x1) { + tmp = x0; + x0 = x1; + x1 = tmp; + + tmp = y0; + y0 = y1; + y1 = tmp; + } + dx = (x1 - x0); + dy = (abs(y1 - y0)); + err = (dx / 2); + + if (y0 < y1) + yi = 1; + else + yi = -1; + j = y0; + for (i = x0; i < x1; i++) + { + if (stp) + *VGAPIX(j, i) = col; + else + *VGAPIX(i, j) = col; + + err -= dy; + if (err < 0) { + j += yi; + err += dx; + } + } +} + +void drw_rectl(int x, int y, int w, int h, enum COLORS col) +{ + drw_line(x, y, x+w, y, col); + drw_line(x+w, y, x+w, y+h, col); + + drw_line(x, y, x, y+h, col); + drw_line(x, y+h, x+w+1, y+h, col); +} + +void drw_rectf(int x, int y, int w, int h, enum COLORS col) +{ + int i, j; + for (j = y; j < x+h; j++) { + for (i = x; i < y+w; i++) { + *VGAPIX(i, j) = col; + } + } +} + +void drw_circl(int x, int y, int rad, enum COLORS col) +{ + int mang, i; // max angle, haha + int px, py; + mang = 360; // Yeah yeah I'll switch to rad later + for (i = 0; i <= mang; i++) + { + px = cos(i)*rad + x; // + px; // causes some really cools effects! :D + py = sin(i)*rad + y; // + py; + *VGAPIX(px, py) = col; + } +} + +void drw_tex(int x, int y, int w, int h, enum COLORS tex[]) +{ // i*w+j + int i, j; + for (i = 0; i < w; i++) + { + for (j = 0; j < h; j++) + { + *VGAPIX(x+i, y+j) = tex[j*w+i]; + } + } +} + +void 2D_init(void) +{ + set_vgabasemem(); + drw_chdis(0x13); +} + +void 2D_exit(void) +{ + drw_chdis(3); +} +/* +int main() +{ + set_vgabasemem(); + drw_chdis(0x13); + + while(!kbhit()) { + if ((getch()) == 0x1b) // escape + break; + } + drw_chdis(3); + return 0; +} +*/ diff --git a/samples/C/2D.H b/samples/C/2D.H new file mode 100644 index 00000000..e3354986 --- /dev/null +++ b/samples/C/2D.H @@ -0,0 +1,29 @@ +#ifndef __2DGFX +#define __2DGFX +// Includes +#include +#include +#include +#include + +// Defines +#define VGAPIX(x,y) (vgabasemem + (x) + (y) * 320) + +// Variables +char * vgabasemem; +DPMI_REGS regs; + +// Drawing functions: +//void setvgabasemem(void); +void drw_chdis(int mode); // draw_func_change_display +void drw_pix(int x, int y, enum COLORS col); +void drw_line(int x0, int y0, int x1, int y1, enum COLORS col); +void drw_rectl(int x, int y, int w, int h, enum COLORS col); +void drw_rectf(int x, int y, int w, int h, enum COLORS col); +void drw_cirl(int x, int y, int rad, enum COLORS col); +void drw_tex(int x, int y, int w, int h, enum COLORS tex[]); +void 2D_init(void); +void 2D_exit(void); + + +#endif