Commit Graph

70 Commits

Author SHA1 Message Date
Dietrich Epp
d980169ec6 Add byte order conversion utilities 2022-03-29 15:34:27 -04:00
Dietrich Epp
16f3764790 Update README to reflect new project direction 2022-03-25 15:42:02 -04:00
Dietrich Epp
8e2efa707e Refactor allocation API
This way we don't need to expose MemError() to platform-independent
code.
2022-03-25 13:33:24 -04:00
Dietrich Epp
617bf831d8 Extract common code into //lib package 2022-03-25 01:45:55 -04:00
Dietrich Epp
66d46452ab Remove usage of Carbon from command-line tool
The use of Carbon turns out to be less useful than originally thought,
so it makes sense to remove it.
2022-03-24 23:44:37 -04:00
Dietrich Epp
ee685ec9ea Update Xcode project
Test passes on Mac OS X 10.4 again.
2022-03-24 23:44:37 -04:00
Dietrich Epp
ecc7b30844 VS Code: refine indentation settings 2022-03-24 23:44:37 -04:00
Dietrich Epp
5ad207f785 Embed character map tables in executable
This simplifies the conversion test, since we don't need to be careful
about which data we run the conversion test in. It will also simplify
the command-line conversion tool and its distribution. The classic Mac
OS version of this program will continue to embed conversion tables in
the resource fork.
2022-03-24 23:44:37 -04:00
Dietrich Epp
6267606293 Run test on Mac OS X
Add an Xcode 2.5 project, and define USE_CARBON for Mac OS X testing.
Tested on Mac OS X 10.4.
2022-03-24 12:26:38 -04:00
Dietrich Epp
651a2fb674 Add .gitignore for generated data 2022-03-24 12:03:20 -04:00
Dietrich Epp
d6cb7935fe Define include path in one place 2022-03-23 18:04:39 -04:00
Dietrich Epp
bc46e1e982 Rename src directory to convert 2022-03-23 17:51:55 -04:00
Dietrich Epp
491950e57d Allow data generator to be run directly from Bazel
When run from Bazel without additional arguments, it will write data
files directly to the source directory.
2022-03-23 12:00:18 -04:00
Dietrich Epp
7e7a6a9da2 Test line break conversions 2022-03-23 03:00:52 -04:00
Dietrich Epp
798d5eca5c Remove unused Bazel setting 2022-03-23 02:08:01 -04:00
Dietrich Epp
c96bb9cd0a Implement extended ASCII converter engine
This adds support for the simplest 8-bit character encodings, which are
compatible with ASCII.
2022-03-23 01:26:25 -04:00
Dietrich Epp
612aad382f VS Code: use tabs 2022-03-23 01:25:59 -04:00
Dietrich Epp
43cb03c572 Adjust clang-format settings
The main intent is to not allow enums to get condensed to a single line,
but this has the side effect of making clang-format stop attaching
braces to the start of the enum. I felt it made sense to use a different
brace style everywhere rather than live with just enums with braces on a
separate line.
2022-03-23 01:24:16 -04:00
Dietrich Epp
6ec3549cd7 Build charmap.c generated file 2022-03-22 19:05:13 -04:00
Dietrich Epp
a4d2de2120 Create replacements for Mac OS toolbox functions 2022-03-22 19:04:29 -04:00
Dietrich Epp
f2317d0ce7 Create build rules for generated data
Add flags to the generator code to specify the location of input and
output files.
2022-03-22 19:02:57 -04:00
Dietrich Epp
094f2c5016 Add Bazel build scripts 2022-03-22 19:02:57 -04:00
Dietrich Epp
3d8bf3721e Add VS Code settings 2022-03-17 12:46:04 -04:00
Dietrich Epp
3f1b059de2 Add missing MacTypes.r include to Rez file 2022-03-15 17:35:03 -04:00
Dietrich Epp
7c5699b508 Update README to reflect changes 2022-03-15 16:27:52 -04:00
Dietrich Epp
f94a65d245 Generate conversion data for extended ASCII
This creates conversion tables for 11 of the 21 character sets.
2022-03-15 16:19:56 -04:00
Dietrich Epp
f49e81388c Generate charmap string resources
The string resources contain names of scripts, regions, and character
maps.
2022-03-15 15:34:39 -04:00
Dietrich Epp
ca074ce387 Write conversion from script and region to charmap
The generation tool creates a GetCharmap function in C which takes the
script and region as input and returns the charmap index.
2022-03-15 14:31:12 -04:00
Dietrich Epp
e901b5baaa Parse script and region constants as numbers
This simplifies code generation, since we don't have to worry about what
happens if two symbolic constants have the same value.
2022-03-15 13:51:23 -04:00
Dietrich Epp
022d11fa14 Parse character map information
This adds associations between scripts, regions, and character maps, and
parses them from a Go utility.
2022-03-15 13:38:45 -04:00
Dietrich Epp
7bc44f4a5a Add script and region constants
These are extracted from the Universal Interfaces Script.h file.
2022-03-15 12:07:16 -04:00
Dietrich Epp
8713cb96aa Remove duplicate README
This prevented the source code from being checked out on
case-insensitive file systems.
2022-03-14 21:54:16 -04:00
Dietrich Epp
faa2460468 Add charmap parser 2021-12-14 23:48:47 -05:00
Dietrich Epp
d2401b963a Add Apple Unicode mapping data
Mirrored from ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/APPLE
2021-12-14 15:50:04 -05:00
Dietrich Epp
db4187b65b Refactor table generator, handle line breaks
Extract table generation to its own file, table.go, and refactor the
interface. This exposed an inconsistency in the way that line breaks
were handled: both CR and LF on the Mac side were mapped to LF on the
UTF-8 side, but when the conversion table was inverted, the reverse
mappings would conflict. Previously, there was no explicit handling for
it, and whichever Mac charecter had a higher byte value would take
precedence. Conflicts are now detected and return an error, so line
breaks must be mapped explicitly. The new code maps CR, LF, and CRLF to
CR when converting UTF-8 to Mac.
2021-12-14 13:12:52 -05:00
Dietrich Epp
d77ccf009e Extract packbits into separate repository 2021-12-14 12:23:14 -05:00
Dietrich Epp
f39ab85222 Ignore conversion table generator binary 2021-12-14 11:01:37 -05:00
Dietrich Epp
2768a0c856 Add plain text and XML files to filter list
GitOrigin-RevId: 2c5ded355b43463d20e6e9e65c32a6c566df82a7
2021-03-26 03:47:55 -04:00
Dietrich Epp
4d82709bd4 Implement resource file handling
This was previously implemented, but lost. The previous implementation
was probably destroyed when testing this tool.

GitOrigin-RevId: e1a41fc5290e57510c252c8404db86afa1913eba
2021-03-26 03:47:55 -04:00
Dietrich Epp
6b7a783916 Move extension patterns from code to data
GitOrigin-RevId: 2ea4f224f7f00bf7be5f73dd77c4ebe3d69f53ae
2021-03-26 03:47:55 -04:00
Dietrich Epp
79bca732c8 Convert resource files
GitOrigin-RevId: ee47a60e097c818def27f799dfd97c1396be2a68
2021-03-24 04:20:46 -04:00
Dietrich Epp
03ae6a672d Refactor: Pass conversion mode to file converter
This is preparation for the resource fork converter.

GitOrigin-RevId: b50299047964e2d6d4a8b6ce3178639ac23f8d50
2021-03-24 04:20:46 -04:00
Dietrich Epp
910039b77a Convert files incrementally
The previous implementation read the entire file into memory and then
processed it. This version uses reasonably-sized buffers and can handle
files of any size.

Since this new conversion code is a bit more complicated, a test suite
has been added which can be run on ordinary Unix systems.

GitOrigin-RevId: acc7be277103fad1da2d0ca16d1a84be11802fbf
2021-03-24 04:20:45 -04:00
Dietrich Epp
25055b63dc Spin cursor during tool execution
GitOrigin-RevId: 3e081374ffbad7e8b5359892733c4b0463fc6a43
2021-03-24 04:20:45 -04:00
Dietrich Epp
d74cfbf9b1 Don't print progress when -quiet is specified
GitOrigin-RevId: de4cedd537717df4b68e18c2027f3ecad218cbbc
2021-03-19 14:27:28 -04:00
Dietrich Epp
a85d31c36a Fix Unix to Mac line ending conversion
GitOrigin-RevId: fac10ee30d9bcbb6f902c46509d64efb249b6cd4
2021-03-19 14:27:27 -04:00
Dietrich Epp
f591e3ac64 Add MIT license
GitOrigin-RevId: c69146b5d3e315380a24b9f168cc50cdcfa25149
2021-03-17 21:11:13 -04:00
Dietrich Epp
a6ad0d0a96 Copy C++ files with SyncFiles
GitOrigin-RevId: e1b21d525476815ba8b10780eb2e69b57264a212
2021-03-17 21:05:19 -04:00
Dietrich Epp
c058e68d93 Add README for table generator
GitOrigin-RevId: 8062aa48890eb74a92b3322fdf306df9e5ecdee2
2021-03-17 21:05:19 -04:00
Dietrich Epp
912c13f193 Add README for SyncFiles
GitOrigin-RevId: fc9eef02792debc4929a47830ac534d4c1c4515d
2021-03-17 21:05:19 -04:00