Add -t output text option#97
Conversation
|
Sorry, but I have no clue what would be added there! Also ...
It seems like the code was incorrect from the beginning, and this PR adding a CLI option is overkill. Can we start with that first ... why would |
Yes this design makes more sense to me. We can change the default behavior to use |
|
67c6612 to
9066c67
Compare
|
Okay the changes are done. One note ... two tests were already broken on Windows due to CRLF. More accurately, they were broken depending on the setting of PS Y:\source\cppo> git reset --hard master
PS Y:\source\cppo> dune build -w --auto-promote
PS Y:\source\cppo> git diff
diff --git a/test/ext.ref b/test/ext.ref
index 4626b21..3459392 100644
--- a/test/ext.ref
+++ b/test/ext.ref
@@ -1,28 +1,28 @@
-# 1 "ext.cppo"
-hello
-nop
-#raqrkg
-qrs
-# 7 "ext.cppo"
-goodbye
-
-# 9
-(*
-hello
-#ext rot13
-abc
-\#endext
-def
-#endext
-goodbye
-
-#ext source
-#endext
-*)
-(*
- Environment variables:
- CPPO_FILE=ext.cppo
- CPPO_FIRST_LINE=9
- CPPO_LAST_LINE=11
-*)
-# 11
+# 1 "ext.cppo"^M
+hello^M
+nop^M
+#raqrkg^M
+qrs^M
+# 7 "ext.cppo"^M
+goodbye^M
+^M
+# 9^M
+(*^M
+hello^M
+#ext rot13^M
+abc^M
+\#endext^M
+def^M
+#endext^M
+goodbye^M
+^M
+#ext source^M
+#endext^M
+*)^M
+(*^M
+ Environment variables:^M
+ CPPO_FILE=ext.cppo^M
+ CPPO_FIRST_LINE=9^M
+ CPPO_LAST_LINE=11^M
+*)^M
+# 11^M
diff --git a/test/int_expansion_error.ref b/test/int_expansion_error.ref
index 7bd1d63..c1b8584 100644
--- a/test/int_expansion_error.ref
+++ b/test/int_expansion_error.ref
@@ -1,4 +1,4 @@
-Error: File "int_expansion_error.cppo", line 2, characters 4-7
-Error: Variable FOO found in cppo boolean expression must expand
-into an int literal, into a tuple of int literals,
-or into a variable with the same properties.
+Error: File "int_expansion_error.cppo", line 2, characters 4-7^M
+Error: Variable FOO found in cppo boolean expression must expand^M
+into an int literal, into a tuple of int literals,^M
+or into a variable with the same properties.^M |
|
It has become clear that the project was already broken on Windows, and that I shouldn't be doing this PR as I'm neither an expert nor a user of |
|
So what do we do to either advance this or close it? |
|
If someone could help fix the build and tests, then I'd approve for merging. |
Problem
Because cppo writes with
open_out, CRLF are added to output files on Windows even when the input files are LF.Context
.cmiCRC checksums are computed on the marshalled signatures of.mlifiles. These CRC checksums are the source of theThe files xxx.cmi and yyy.cmi makes inconsistent assumptions on interface Zzzocamlc/ocamlopt errors..mlifiles (because the marshalledTypes.signatureindirectly referencesLexer.position). Easy to see in theutop-fulltoplevel on any.cmifile:.mliwill therefore have different CRC checksums than original LF-ending.mlifilesThe net effect is that I can't share
.cmi/.cmabetween Unix and Windows machines if CPPO is used as a preprocessor.The files xxx.cmi and yyy.cmi makes inconsistent assumptions on interface Zzzis the result.Solution
Use
open_out_bin. This PR hides it behind a command line option, but I actually think binary mode should always have been used.