/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/instrument-js.h

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs · C++ Header · 81 lines · 38 code · 23 blank · 20 comment · 0 complexity · b2e36f634a275f1014c8de45e6e65c69 MD5 · raw file

  1. /*
  2. instrument-js.h - JavaScript instrumentation routines
  3. Copyright (C) 2007, 2008 siliconforks.com
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #ifndef INSTRUMENT_JS_H_
  17. #define INSTRUMENT_JS_H_
  18. /* ISO C99 specifies that C++ code must define this to get UINT16_MAX etc. */
  19. #define __STDC_LIMIT_MACROS
  20. #include <stdint.h>
  21. #include "stream.h"
  22. #include "util.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. enum FileType {
  27. FILE_TYPE_JS,
  28. FILE_TYPE_HTML,
  29. FILE_TYPE_OTHER
  30. };
  31. extern bool jscoverage_mozilla;
  32. void jscoverage_set_js_version(const char * version);
  33. void jscoverage_init(void);
  34. void jscoverage_cleanup(void);
  35. void jscoverage_instrument_js(const char * id, const uint16_t * characters, size_t num_characters, Stream * output);
  36. void jscoverage_copy_resources(const char * destination_directory);
  37. typedef struct Coverage Coverage;
  38. typedef struct FileCoverage {
  39. char * id;
  40. int * coverage_lines;
  41. char ** source_lines;
  42. /* SpiderMonkey uses uint32 for array lengths */
  43. uint32_t num_coverage_lines;
  44. uint32_t num_source_lines;
  45. } FileCoverage;
  46. Coverage * Coverage_new(void);
  47. void Coverage_delete(Coverage * coverage);
  48. typedef void (*CoverageForeachFunction) (const FileCoverage * file_coverage, int i, void * p);
  49. void Coverage_foreach_file(Coverage * coverage, CoverageForeachFunction f, void * p);
  50. int jscoverage_parse_json(Coverage * coverage, const uint8_t * data, size_t length) __attribute__((warn_unused_result));
  51. void jscoverage_write_source(const char * id, const uint16_t * characters, size_t num_characters, Stream * output);
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif /* INSTRUMENT_JS_H_ */