c.srt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. ;;; c.srt --- SRecode templates for c-mode
  2. ;; Copyright (C) 2007-2010, 2012-2016 Free Software Foundation, Inc.
  3. ;; Author: Eric M. Ludlam <eric@siege-engine.com>
  4. ;; This file is part of GNU Emacs.
  5. ;; GNU Emacs is free software: you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; GNU Emacs is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. set mode "c-mode"
  16. set comment_start "/**"
  17. set comment_end " */"
  18. set comment_prefix " *"
  19. ;; OVERRIDE THIS in your user or project template file to whatever
  20. ;; you use for your project.
  21. set HEADEREXT ".h"
  22. context file
  23. template empty :time :user :file :c
  24. ----
  25. {{>:filecomment}}
  26. {{#NOTHEADER}}
  27. {{^}}
  28. {{/NOTHEADER}}
  29. {{#HEADER}}
  30. {{>:header_guard}}
  31. {{/HEADER}}
  32. ----
  33. template header_guard :file :blank :c
  34. ----
  35. #ifndef {{FILENAME_SYMBOL:upcase}}
  36. #define {{FILENAME_SYMBOL:upcase}} 1
  37. {{^}}
  38. #endif // {{FILENAME_SYMBOL:upcase}}
  39. ----
  40. context misc
  41. template arglist
  42. "Insert an argument list for a function.
  43. @todo - Support smart CR in a buffer for not too long lines."
  44. ----
  45. ({{#ARGS}}{{TYPE}} {{NAME}}{{#NOTLAST}},{{/NOTLAST}}{{/ARGS}})
  46. ----
  47. context declaration
  48. prompt TYPE "Return Type: "
  49. template function :indent :blank
  50. "Insert a function declaration."
  51. ----
  52. {{?TYPE}} {{?NAME}}{{>:misc:arglist}}
  53. {{#INITIALIZERS}}{{>B:initializers}}{{/INITIALIZERS}}
  54. {
  55. {{^}}
  56. }
  57. ----
  58. bind "f"
  59. template function-prototype :indent :blank
  60. "Insert a function declaration."
  61. ----
  62. {{?TYPE}} {{?NAME}}{{>:misc:arglist}};
  63. ----
  64. prompt TYPE "Data Type: "
  65. template variable :indent :blank
  66. "Insert a variable declaration."
  67. ----
  68. {{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}};
  69. ----
  70. bind "v"
  71. template variable-prototype :indent :blank
  72. "Insert a variable declaration."
  73. ----
  74. {{?TYPE}} {{?NAME}};
  75. ----
  76. bind "v"
  77. template include :blank
  78. "An include statement."
  79. ----
  80. #include "{{?NAME}}"
  81. ----
  82. bind "i"
  83. template system-include :blank
  84. "An include statement."
  85. ----
  86. #include <{{?NAME}}>
  87. ----
  88. bind "i"
  89. template label :blank :indent
  90. ----
  91. {{?NAME}}:
  92. ----
  93. context declaration
  94. template comment-function :indent :blank
  95. "Used to put a nice comment in front of a function.
  96. Override this with your own preference to avoid using doxygen"
  97. ----
  98. {{>A:declaration:doxygen-function}}
  99. ----
  100. ;;; DOXYGEN FEATURES
  101. ;;
  102. ;;
  103. context declaration
  104. template doxygen-function :indent :blank
  105. ----
  106. /**
  107. * @name {{NAME}} - {{DOC}}{{^}}{{#ARGS}}
  108. * @param {{NAME}} - {{DOC}}{{/ARGS}}
  109. * @return {{TYPE}}
  110. */
  111. ----
  112. template doxygen-variable-same-line
  113. ----
  114. /**< {{DOC}}{{^}} */
  115. ----
  116. template doxygen-section-comment :blank :indent
  117. "Insert a comment that separates sections of an Emacs Lisp file."
  118. ----
  119. /** {{?TITLE}}
  120. *
  121. * {{^}}
  122. */
  123. ----
  124. ;; end