PageRenderTime 48ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/js/config/mkdepend/pr.c

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
C | 124 lines | 81 code | 10 blank | 33 comment | 20 complexity | 063c1d9b72fef97099eca7f0f8323818 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /* $Xorg: pr.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
  2. /*
  3. Copyright (c) 1993, 1994, 1998 The Open Group
  4. Permission to use, copy, modify, distribute, and sell this software and its
  5. documentation for any purpose is hereby granted without fee, provided that
  6. the above copyright notice appear in all copies and that both that
  7. copyright notice and this permission notice appear in supporting
  8. documentation.
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  15. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. Except as contained in this notice, the name of The Open Group shall not be
  18. used in advertising or otherwise to promote the sale, use or other dealings
  19. in this Software without prior written authorization from The Open Group.
  20. */
  21. /* $XFree86: xc/config/makedepend/pr.c,v 1.5 2001/12/14 19:53:21 dawes Exp $ */
  22. #include "def.h"
  23. extern struct inclist inclist[ MAXFILES ],
  24. *inclistp;
  25. extern char *objprefix;
  26. extern char *objsuffix;
  27. extern int width;
  28. extern boolean printed;
  29. extern boolean verbose;
  30. extern boolean show_where_not;
  31. void
  32. add_include(struct filepointer *filep, struct inclist *file,
  33. struct inclist *file_red, char *include, int type,
  34. boolean failOK)
  35. {
  36. register struct inclist *newfile;
  37. register struct filepointer *content;
  38. /*
  39. * First decide what the pathname of this include file really is.
  40. */
  41. newfile = inc_path(file->i_file, include, type);
  42. if (newfile == NULL) {
  43. if (failOK)
  44. return;
  45. if (file != file_red)
  46. warning("%s (reading %s, line %d): ",
  47. file_red->i_file, file->i_file, filep->f_line);
  48. else
  49. warning("%s, line %d: ", file->i_file, filep->f_line);
  50. warning1("cannot find include file \"%s\"\n", include);
  51. show_where_not = TRUE;
  52. newfile = inc_path(file->i_file, include, type);
  53. show_where_not = FALSE;
  54. }
  55. if (newfile) {
  56. included_by(file, newfile);
  57. if (!(newfile->i_flags & SEARCHED)) {
  58. newfile->i_flags |= SEARCHED;
  59. content = getfile(newfile->i_file);
  60. find_includes(content, newfile, file_red, 0, failOK);
  61. freefile(content);
  62. }
  63. }
  64. }
  65. static void
  66. pr(struct inclist *ip, char *file, char *base)
  67. {
  68. static char *lastfile;
  69. static int current_len;
  70. register int len, i;
  71. char buf[ BUFSIZ ];
  72. printed = TRUE;
  73. len = strlen(ip->i_file)+1;
  74. if (current_len + len > width || file != lastfile) {
  75. lastfile = file;
  76. sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix,
  77. ip->i_file);
  78. len = current_len = strlen(buf);
  79. }
  80. else {
  81. buf[0] = ' ';
  82. strcpy(buf+1, ip->i_file);
  83. current_len += len;
  84. }
  85. fwrite(buf, len, 1, stdout);
  86. /*
  87. * If verbose is set, then print out what this file includes.
  88. */
  89. if (! verbose || ip->i_list == NULL || ip->i_flags & NOTIFIED)
  90. return;
  91. ip->i_flags |= NOTIFIED;
  92. lastfile = NULL;
  93. printf("\n# %s includes:", ip->i_file);
  94. for (i=0; i<ip->i_listlen; i++)
  95. printf("\n#\t%s", ip->i_list[ i ]->i_incstring);
  96. }
  97. void
  98. recursive_pr_include(struct inclist *head, char *file, char *base)
  99. {
  100. int i;
  101. if (head->i_flags & MARKED)
  102. return;
  103. head->i_flags |= MARKED;
  104. if (head->i_file != file)
  105. pr(head, file, base);
  106. for (i=0; i<head->i_listlen; i++)
  107. recursive_pr_include(head->i_list[ i ], file, base);
  108. }