-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -t output text option #97
base: master
Are you sure you want to change the base?
Add -t output text option #97
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example in the test
directory.
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 |
Problem
Because cppo writes with
open_out
, CRLF are added to output files on Windows even when the input files are LF.Context
.cmi
CRC checksums are computed on the marshalled signatures of.mli
files. These CRC checksums are the source of theThe files xxx.cmi and yyy.cmi makes inconsistent assumptions on interface Zzz
ocamlc/ocamlopt errors..mli
files (because the marshalledTypes.signature
indirectly referencesLexer.position
). Easy to see in theutop-full
toplevel on any.cmi
file:.mli
will therefore have different CRC checksums than original LF-ending.mli
filesThe net effect is that I can't share
.cmi
/.cma
between Unix and Windows machines if CPPO is used as a preprocessor.The files xxx.cmi and yyy.cmi makes inconsistent assumptions on interface Zzz
is 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.