-
Notifications
You must be signed in to change notification settings - Fork 165
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
More C cleanups #92
Merged
pkgw
merged 14 commits into
tectonic-typesetting:master
from
ronnychevalier:rc/c-cleanups
Jun 12, 2017
Merged
More C cleanups #92
pkgw
merged 14 commits into
tectonic-typesetting:master
from
ronnychevalier:rc/c-cleanups
Jun 12, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In C, a cast from void * to any other pointer type is made implicitly. Only in C++ such cast is needed.
Such special would parse the string provided as a command line argument and would allow to change some parameters of dvipdfmx. Such feature is not really useful since if a user wants to modify some parameters we should provide command line parameters to tectonic to do so directly. This feature also impedes our ability to simplify the code and remove global variables. Removing this feature is equivalent to the parsing of the dvipdfmx config file which was removed.
dvipdfmx_main has a new `pagespec` parameter previously provided via the -s command line option. Currently, it is set to NULL, but it could become a Tectonic command line argument if needed in the future.
Tectonic does not support input from stdin or output to stdout, thus we remove the handling of such case in dvipdfmx_main. Also add asserts to ensure Rust code provides values for dvi_filename and pdfname.
dvipdfmx_main now has opt_flags as a parameter. It is set to 0 by default. It allows to add the ability to modify such flags in the future in Tectonic via a command line option if needed.
Also rename the variable to `enable_object_stream` to avoid to put a comment above.
Change the global variable to a simple macro definition
We do not use getopt anymore here
We include stdbool.h if we need true or false.
Can't say that I understand all of the changes here but I trust that more-than-syntax ones make sense. Thanks! |
Mrmaxmeier
pushed a commit
to Mrmaxmeier/tectonic
that referenced
this pull request
Oct 1, 2019
vlasakm
added a commit
to vlasakm/tectonic
that referenced
this pull request
Oct 15, 2022
In upstream dvipdfmx the `dvidpfmx:config` DVI special can be used to pass arguments to dvipdfmx. This has seen some use in XeTeX packages. For example, the ubiqitous package "hyperref" uses: \special{dvipdfmx:config C 0x0010} This is normally parsed by dvipdfmx as command line arguments, i.e. as if xdvipdfmx was ran as: xdvipdfmx -C 0x0010 The `'C'` option is a bitset of compatibility flags. In this case hyperref needs the option `OPT_PDFDOC_NO_DEST_REMOVE`, which makes dvipdfmx handle PDF destinations differently (I didn't check thoroughly how). The `opt_flags` global variable used to hold these bitflags and the `dvipdfmx:config` special could be used to set them. tectonic-typesetting#92 removed that option. While passing arbitrary command line arguments to dvidpfmx is probably not what we want, I definitely know, that we at least need the compatibility flags to work, and there is probably no other way packages can set them. The code that does the option parsing is mostly port from the 'C' option parsing from dvipdfmx's `read_config_special` and `do_args_second_pass`. IMHO the way `opt_flags` gets modified is undefined behaviour and does other weird things with negative values, but the purpose of this commit is to increase compatibility with upstream, not to fix things (which should preferably be done upstream IMO). Like with other options, instead of having a global variable, the pointer to the value in `dvipdfmx_main` is passed around instead.
vlasakm
added a commit
to vlasakm/tectonic
that referenced
this pull request
Oct 15, 2022
In upstream dvipdfmx the `dvidpfmx:config` DVI special can be used to pass arguments to dvipdfmx. This has seen some use in XeTeX packages. For example, the ubiqitous package "hyperref" uses: \special{dvipdfmx:config C 0x0010} This is normally parsed by dvipdfmx as command line arguments, i.e. as if xdvipdfmx was ran as: xdvipdfmx -C 0x0010 The `C` option is a bitset of compatibility flags. In this case hyperref needs the option `OPT_PDFDOC_NO_DEST_REMOVE`, which makes dvipdfmx handle PDF destinations differently (I didn't check thoroughly how). The `opt_flags` global variable used to hold these bitflags and the `dvipdfmx:config` special could be used to set them. tectonic-typesetting#92 removed that option. While passing arbitrary command line arguments to dvidpfmx is probably not what we want, I definitely know, that we at least need the compatibility flags to work, and there is probably no other way packages can set them. The code that does the option parsing is mostly port from the 'C' option parsing from dvipdfmx's `read_config_special` and `do_args_second_pass`. IMHO the way `opt_flags` gets modified is undefined behaviour and does other weird things with negative values, but the purpose of this commit is to increase compatibility with upstream, not to fix things (which should preferably be done upstream IMO). Like with other options, instead of having a global variable, the pointer to the value in `dvipdfmx_main` is passed around instead. While at it, I also added `z` and `g` options which also seem to be used by LaTeX, so this should be enough for a while. Hopefully fixes tectonic-typesetting#904.
This was referenced Oct 15, 2022
vlasakm
added a commit
to vlasakm/tectonic
that referenced
this pull request
Oct 15, 2022
In upstream dvipdfmx the `dvidpfmx:config` DVI special can be used to pass arguments to dvipdfmx. This has seen some use in XeTeX packages. For example, the ubiqitous package "hyperref" uses: \special{dvipdfmx:config C 0x0010} This is normally parsed by dvipdfmx as command line arguments, i.e. as if xdvipdfmx was ran as: xdvipdfmx -C 0x0010 The `C` option is a bitset of compatibility flags. In this case hyperref needs the option `OPT_PDFDOC_NO_DEST_REMOVE`, which makes dvipdfmx handle PDF destinations differently (I didn't check thoroughly how). The `opt_flags` global variable used to hold these bitflags and the `dvipdfmx:config` special could be used to set them. tectonic-typesetting#92 removed that option. While passing arbitrary command line arguments to dvidpfmx is probably not what we want, I definitely know, that we at least need the compatibility flags to work, and there is probably no other way packages can set them. The code that does the option parsing is mostly port from the 'C' option parsing from dvipdfmx's `read_config_special` and `do_args_second_pass`. IMHO the way `opt_flags` gets modified is undefined behaviour and does other weird things with negative values, but the purpose of this commit is to increase compatibility with upstream, not to fix things (which should preferably be done upstream IMO). Like with other options, instead of having a global variable, the pointer to the value in `dvipdfmx_main` is passed around instead. While at it, I also added `z` and `g` options which also seem to be used by LaTeX, so this should be enough for a while. Hopefully fixes tectonic-typesetting#904.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
They focus mainly on
dpx-dvipdfmx
.