KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

281 lines
10KB

  1. <?php
  2. /*************************************************************************************
  3. * c.php
  4. * -----
  5. * Author: Nigel McNie (nigel@geshi.org)
  6. * Contributors:
  7. * - Jack Lloyd (lloyd@randombit.net)
  8. * - Michael Mol (mikemol@gmail.com)
  9. * Copyright: (c) 2004 Nigel McNie (http://qbnz.com/highlighter/)
  10. * Release Version: 1.0.8.11
  11. * Date Started: 2004/06/04
  12. *
  13. * C language file for GeSHi.
  14. *
  15. * CHANGES
  16. * -------
  17. * 2009/01/22 (1.0.8.3)
  18. * - Made keywords case-sensitive.
  19. * 2008/05/23 (1.0.7.22)
  20. * - Added description of extra language features (SF#1970248)
  21. * 2004/XX/XX (1.0.4)
  22. * - Added a couple of new keywords (Jack Lloyd)
  23. * 2004/11/27 (1.0.3)
  24. * - Added support for multiple object splitters
  25. * 2004/10/27 (1.0.2)
  26. * - Added support for URLs
  27. * 2004/08/05 (1.0.1)
  28. * - Added support for symbols
  29. * 2004/07/14 (1.0.0)
  30. * - First Release
  31. *
  32. * TODO (updated 2009/02/08)
  33. * -------------------------
  34. * - Get a list of inbuilt functions to add (and explore C more
  35. * to complete this rather bare language file
  36. *
  37. *************************************************************************************
  38. *
  39. * This file is part of GeSHi.
  40. *
  41. * GeSHi is free software; you can redistribute it and/or modify
  42. * it under the terms of the GNU General Public License as published by
  43. * the Free Software Foundation; either version 2 of the License, or
  44. * (at your option) any later version.
  45. *
  46. * GeSHi is distributed in the hope that it will be useful,
  47. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  48. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  49. * GNU General Public License for more details.
  50. *
  51. * You should have received a copy of the GNU General Public License
  52. * along with GeSHi; if not, write to the Free Software
  53. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  54. *
  55. ************************************************************************************/
  56. $language_data = array (
  57. 'LANG_NAME' => 'C',
  58. 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
  59. 'COMMENT_MULTI' => array('/*' => '*/'),
  60. 'COMMENT_REGEXP' => array(
  61. //Multiline-continued single-line comments
  62. 1 => '/\/\/(?:\\\\\\\\|\\\\\\n|.)*$/m',
  63. //Multiline-continued preprocessor define
  64. 2 => '/#(?:\\\\\\\\|\\\\\\n|.)*$/m'
  65. ),
  66. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  67. 'QUOTEMARKS' => array("'", '"'),
  68. 'ESCAPE_CHAR' => '',
  69. 'ESCAPE_REGEXP' => array(
  70. //Simple Single Char Escapes
  71. 1 => "#\\\\[\\\\abfnrtv\'\"?\n]#i",
  72. //Hexadecimal Char Specs
  73. 2 => "#\\\\x[\da-fA-F]{2}#",
  74. //Hexadecimal Char Specs
  75. 3 => "#\\\\u[\da-fA-F]{4}#",
  76. //Hexadecimal Char Specs
  77. 4 => "#\\\\U[\da-fA-F]{8}#",
  78. //Octal Char Specs
  79. 5 => "#\\\\[0-7]{1,3}#"
  80. ),
  81. 'NUMBERS' =>
  82. GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_INT_CSTYLE | GESHI_NUMBER_BIN_PREFIX_0B |
  83. GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_NONSCI |
  84. GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | GESHI_NUMBER_FLT_SCI_ZERO,
  85. 'KEYWORDS' => array(
  86. 1 => array(
  87. 'if', 'return', 'while', 'case', 'continue', 'default',
  88. 'do', 'else', 'for', 'switch', 'goto'
  89. ),
  90. 2 => array(
  91. 'null', 'false', 'break', 'true', 'function', 'enum', 'extern', 'inline'
  92. ),
  93. 3 => array(
  94. // assert.h
  95. 'assert',
  96. //complex.h
  97. 'cabs', 'cacos', 'cacosh', 'carg', 'casin', 'casinh', 'catan',
  98. 'catanh', 'ccos', 'ccosh', 'cexp', 'cimag', 'cis', 'clog', 'conj',
  99. 'cpow', 'cproj', 'creal', 'csin', 'csinh', 'csqrt', 'ctan', 'ctanh',
  100. //ctype.h
  101. 'digittoint', 'isalnum', 'isalpha', 'isascii', 'isblank', 'iscntrl',
  102. 'isdigit', 'isgraph', 'islower', 'isprint', 'ispunct', 'isspace',
  103. 'isupper', 'isxdigit', 'toascii', 'tolower', 'toupper',
  104. //inttypes.h
  105. 'imaxabs', 'imaxdiv', 'strtoimax', 'strtoumax', 'wcstoimax',
  106. 'wcstoumax',
  107. //locale.h
  108. 'localeconv', 'setlocale',
  109. //math.h
  110. 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', 'exp',
  111. 'fabs', 'floor', 'frexp', 'ldexp', 'log', 'log10', 'modf', 'pow',
  112. 'sin', 'sinh', 'sqrt', 'tan', 'tanh',
  113. //setjmp.h
  114. 'longjmp', 'setjmp',
  115. //signal.h
  116. 'raise',
  117. //stdarg.h
  118. 'va_arg', 'va_copy', 'va_end', 'va_start',
  119. //stddef.h
  120. 'offsetof',
  121. //stdio.h
  122. 'clearerr', 'fclose', 'fdopen', 'feof', 'ferror', 'fflush', 'fgetc',
  123. 'fgetpos', 'fgets', 'fopen', 'fprintf', 'fputc', 'fputchar',
  124. 'fputs', 'fread', 'freopen', 'fscanf', 'fseek', 'fsetpos', 'ftell',
  125. 'fwrite', 'getc', 'getch', 'getchar', 'gets', 'perror', 'printf',
  126. 'putc', 'putchar', 'puts', 'remove', 'rename', 'rewind', 'scanf',
  127. 'setbuf', 'setvbuf', 'snprintf', 'sprintf', 'sscanf', 'tmpfile',
  128. 'tmpnam', 'ungetc', 'vfprintf', 'vfscanf', 'vprintf', 'vscanf',
  129. 'vsprintf', 'vsscanf',
  130. //stdlib.h
  131. 'abort', 'abs', 'atexit', 'atof', 'atoi', 'atol', 'bsearch',
  132. 'calloc', 'div', 'exit', 'free', 'getenv', 'itoa', 'labs', 'ldiv',
  133. 'ltoa', 'malloc', 'qsort', 'rand', 'realloc', 'srand', 'strtod',
  134. 'strtol', 'strtoul', 'system',
  135. //string.h
  136. 'memchr', 'memcmp', 'memcpy', 'memmove', 'memset', 'strcat',
  137. 'strchr', 'strcmp', 'strcoll', 'strcpy', 'strcspn', 'strerror',
  138. 'strlen', 'strncat', 'strncmp', 'strncpy', 'strpbrk', 'strrchr',
  139. 'strspn', 'strstr', 'strtok', 'strxfrm',
  140. //time.h
  141. 'asctime', 'clock', 'ctime', 'difftime', 'gmtime', 'localtime',
  142. 'mktime', 'strftime', 'time',
  143. //wchar.h
  144. 'btowc', 'fgetwc', 'fgetws', 'fputwc', 'fputws', 'fwide',
  145. 'fwprintf', 'fwscanf', 'getwc', 'getwchar', 'mbrlen', 'mbrtowc',
  146. 'mbsinit', 'mbsrtowcs', 'putwc', 'putwchar', 'swprintf', 'swscanf',
  147. 'ungetwc', 'vfwprintf', 'vswprintf', 'vwprintf', 'wcrtomb',
  148. 'wcscat', 'wcschr', 'wcscmp', 'wcscoll', 'wcscpy', 'wcscspn',
  149. 'wcsftime', 'wcslen', 'wcsncat', 'wcsncmp', 'wcsncpy', 'wcspbrk',
  150. 'wcsrchr', 'wcsrtombs', 'wcsspn', 'wcsstr', 'wcstod', 'wcstok',
  151. 'wcstol', 'wcstoul', 'wcsxfrm', 'wctob', 'wmemchr', 'wmemcmp',
  152. 'wmemcpy', 'wmemmove', 'wmemset', 'wprintf', 'wscanf',
  153. //wctype.h
  154. 'iswalnum', 'iswalpha', 'iswcntrl', 'iswctype', 'iswdigit',
  155. 'iswgraph', 'iswlower', 'iswprint', 'iswpunct', 'iswspace',
  156. 'iswupper', 'iswxdigit', 'towctrans', 'towlower', 'towupper',
  157. 'wctrans', 'wctype'
  158. ),
  159. 4 => array(
  160. 'auto', 'char', 'const', 'double', 'float', 'int', 'long',
  161. 'register', 'short', 'signed', 'sizeof', 'static', 'struct',
  162. 'typedef', 'union', 'unsigned', 'void', 'volatile', 'wchar_t',
  163. 'int8', 'int16', 'int32', 'int64',
  164. 'uint8', 'uint16', 'uint32', 'uint64',
  165. 'int_fast8_t', 'int_fast16_t', 'int_fast32_t', 'int_fast64_t',
  166. 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
  167. 'int_least8_t', 'int_least16_t', 'int_least32_t', 'int_least64_t',
  168. 'uint_least8_t', 'uint_least16_t', 'uint_least32_t', 'uint_least64_t',
  169. 'int8_t', 'int16_t', 'int32_t', 'int64_t',
  170. 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
  171. 'intmax_t', 'uintmax_t', 'intptr_t', 'uintptr_t',
  172. 'size_t', 'off_t'
  173. ),
  174. ),
  175. 'SYMBOLS' => array(
  176. '(', ')', '{', '}', '[', ']',
  177. '+', '-', '*', '/', '%',
  178. '=', '<', '>',
  179. '!', '^', '&', '|',
  180. '?', ':',
  181. ';', ','
  182. ),
  183. 'CASE_SENSITIVE' => array(
  184. GESHI_COMMENTS => false,
  185. 1 => true,
  186. 2 => true,
  187. 3 => true,
  188. 4 => true,
  189. ),
  190. 'STYLES' => array(
  191. 'KEYWORDS' => array(
  192. 1 => 'color: #b1b100;',
  193. 2 => 'color: #000000; font-weight: bold;',
  194. 3 => 'color: #000066;',
  195. 4 => 'color: #993333;'
  196. ),
  197. 'COMMENTS' => array(
  198. 1 => 'color: #666666; font-style: italic;',
  199. 2 => 'color: #339933;',
  200. 'MULTI' => 'color: #808080; font-style: italic;'
  201. ),
  202. 'ESCAPE_CHAR' => array(
  203. 0 => 'color: #000099; font-weight: bold;',
  204. 1 => 'color: #000099; font-weight: bold;',
  205. 2 => 'color: #660099; font-weight: bold;',
  206. 3 => 'color: #660099; font-weight: bold;',
  207. 4 => 'color: #660099; font-weight: bold;',
  208. 5 => 'color: #006699; font-weight: bold;',
  209. 'HARD' => '',
  210. ),
  211. 'BRACKETS' => array(
  212. 0 => 'color: #009900;'
  213. ),
  214. 'STRINGS' => array(
  215. 0 => 'color: #ff0000;'
  216. ),
  217. 'NUMBERS' => array(
  218. 0 => 'color: #0000dd;',
  219. GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;',
  220. GESHI_NUMBER_OCT_PREFIX => 'color: #208080;',
  221. GESHI_NUMBER_HEX_PREFIX => 'color: #208080;',
  222. GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;',
  223. GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;',
  224. GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;',
  225. GESHI_NUMBER_FLT_NONSCI => 'color:#800080;'
  226. ),
  227. 'METHODS' => array(
  228. 1 => 'color: #202020;',
  229. 2 => 'color: #202020;'
  230. ),
  231. 'SYMBOLS' => array(
  232. 0 => 'color: #339933;'
  233. ),
  234. 'REGEXPS' => array(
  235. ),
  236. 'SCRIPT' => array(
  237. )
  238. ),
  239. 'URLS' => array(
  240. 1 => '',
  241. 2 => '',
  242. 3 => 'http://www.opengroup.org/onlinepubs/009695399/functions/{FNAMEL}.html',
  243. 4 => ''
  244. ),
  245. 'OOLANG' => true,
  246. 'OBJECT_SPLITTERS' => array(
  247. 1 => '.',
  248. 2 => '::'
  249. ),
  250. 'REGEXPS' => array(
  251. ),
  252. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  253. 'SCRIPT_DELIMITERS' => array(
  254. ),
  255. 'HIGHLIGHT_STRICT_BLOCK' => array(
  256. ),
  257. 'TAB_WIDTH' => 4
  258. );
  259. ?>