Ohm-Management - Projektarbeit B-ME
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.

memory-code-points.js 969B

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. const fs = require('fs');
  3. const path = require('path');
  4. const bitfield = require('sparse-bitfield');
  5. /* eslint-disable-next-line security/detect-non-literal-fs-filename */
  6. const memory = fs.readFileSync(path.resolve(__dirname, '../code-points.mem'));
  7. let offset = 0;
  8. /**
  9. * Loads each code points sequence from buffer.
  10. * @returns {bitfield}
  11. */
  12. function read() {
  13. const size = memory.readUInt32BE(offset);
  14. offset += 4;
  15. const codepoints = memory.slice(offset, offset + size);
  16. offset += size;
  17. return bitfield({ buffer: codepoints });
  18. }
  19. const unassigned_code_points = read();
  20. const commonly_mapped_to_nothing = read();
  21. const non_ASCII_space_characters = read();
  22. const prohibited_characters = read();
  23. const bidirectional_r_al = read();
  24. const bidirectional_l = read();
  25. module.exports = {
  26. unassigned_code_points,
  27. commonly_mapped_to_nothing,
  28. non_ASCII_space_characters,
  29. prohibited_characters,
  30. bidirectional_r_al,
  31. bidirectional_l,
  32. };