texlive[56373] trunk: dviasm (18sep20)

commits+karl at tug.org commits+karl at tug.org
Fri Sep 18 23:30:45 CEST 2020


Revision: 56373
          http://tug.org/svn/texlive?view=revision&revision=56373
Author:   karl
Date:     2020-09-18 23:30:44 +0200 (Fri, 18 Sep 2020)
Log Message:
-----------
dviasm (18sep20)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/dviasm/dviasm.py
    trunk/Master/texmf-dist/scripts/dviasm/dviasm.py
    trunk/Master/tlpkg/libexec/ctan2tds

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/man/man1/dviasm.1
    trunk/Master/texmf-dist/doc/man/man1/dviasm.man1.pdf

Modified: trunk/Build/source/texk/texlive/linked_scripts/dviasm/dviasm.py
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/dviasm/dviasm.py	2020-09-18 05:52:26 UTC (rev 56372)
+++ trunk/Build/source/texk/texlive/linked_scripts/dviasm/dviasm.py	2020-09-18 21:30:44 UTC (rev 56373)
@@ -455,7 +455,7 @@
       if o == SET_RULE:
         s.append([SET_RULE, [p, SignedQuad(fp)]])
       elif o in (PUT1, PUT2, PUT3, PUT4):
-        s.append([PUT1, p])
+        s.append([PUT1, [p]])
       elif o == PUT_RULE:
         s.append([PUT_RULE, [p, SignedQuad(fp)]])
       elif o == NOP:
@@ -492,7 +492,7 @@
       elif o < FNT_NUM_0 + 64 or o in (FNT1, FNT2, FNT3, FNT4):
         s.append([FNT1, p])
       elif o in (XXX1, XXX2, XXX3, XXX4):
-        q = fp.read(p).decode('utf8')
+        q = fp.read(p)
         s.append([XXX1, q])
       elif o in (FNT_DEF1, FNT_DEF2, FNT_DEF3, FNT_DEF4):
         self.DefineFont(p, fp)
@@ -644,10 +644,20 @@
           if cmd[1] < 64: s.append(bytes.fromhex('%02x' % (FNT_NUM_0 + cmd[1])))
           else:           s.append(self.CmdPairU(cmd))
         elif cmd[0] == XXX1:
-          cmd1 = cmd[1].encode('utf8')
-          l = len(cmd[1])
-          if l < 256: s.append(bytes.fromhex('%02x' % XXX1) + bytes.fromhex('%02x' % l) + cmd1)
-          else:       s.append(bytes.fromhex('%02x' % XXX4) + PutSignedQuad(l) + cmd1)
+          if options.xxx_encoding == "none":
+            l = len(cmd[1]) # leave encoding untouched
+          else:
+            cmd1 = cmd[1].encode(options.xxx_encoding)
+            l = len(cmd1)
+          if l < 256:
+            s.append(bytes.fromhex('%02x' % XXX1) + bytes.fromhex('%02x' % l))
+          else:
+            s.append(bytes.fromhex('%02x' % XXX4) + PutSignedQuad(l))
+          if options.xxx_encoding == "none":
+            for o in cmd[1]:
+              s.append(bytes.fromhex('%02x' % ord(o)))
+          else:
+              s.append(cmd1)
         elif cmd[0] == DIR:
           s.append(bytes.fromhex('%02x' % DIR) + bytes.fromhex('%02x' % cmd[1]))
         elif cmd[0] == BEGIN_REFLECT:
@@ -806,7 +816,10 @@
         else:
           self.cur_page.append([SET1, ol])
       elif key == 'put':
-        self.cur_page.append([PUT1, GetStr(val)])
+        ol = GetStr(val)
+        if len(ol) != 1:
+          warning('only one character is allowed for put!')
+        self.cur_page.append([PUT1, ol])
       elif key == 'setrule':
         v = val.split(' ')
         if len(v) != 2:
@@ -937,7 +950,10 @@
           fp.write("push:\n")
           indent += tabsize
         elif cmd[0] == XXX1:
-          fp.write("xxx: %s\n" % repr(cmd[1]))
+          if options.xxx_encoding == "none":
+            fp.write("xxx: %s\n" % PutStrASCII(cmd[1])) # leave encoding untouched
+          else:
+            fp.write("xxx: '%s'\n" % cmd[1].decode(options.xxx_encoding))
         elif cmd[0] == DIR:
           fp.write("dir: %d\n" % cmd[1])
         elif cmd[0] == BEGIN_REFLECT:
@@ -1147,7 +1163,7 @@
 Please report bugs to
   https://github.com/aminophen/dviasm"""
 
-  version = """This is %prog-20200912
+  version = """This is %prog-20200918
 
 Copyright (C) 2007-2008 by Jin-Hwan Cho <chofchof at ktug.or.kr>
 Copyright (C) 2011-2017 by Khaled Hosny <khaledhosny at eglug.org>
@@ -1172,6 +1188,10 @@
                     action="store", type="string", dest="encoding",
                     metavar="STR",
                     help="encoding for input/output [default=%default]")
+  parser.add_option("-x", "--xxx-encoding",
+                    action="store", type="string", dest="xxx_encoding",
+                    metavar="STR",
+                    help="encoding for interpreting xxx strings [default=%default]")
   parser.add_option("-t", "--tabsize",
                     action="store", type="int", dest="tabsize",
                     metavar="INT",
@@ -1183,12 +1203,14 @@
                     action="append", type="string", dest="subfont",
                     metavar="STR",
                     help="the list of fonts with UCS2 subfont scheme (comma separated); disable internal subfont list if STR is empty")
-  parser.set_defaults(unit='pt', encoding='utf8', tabsize=2)
+  parser.set_defaults(unit='pt', encoding='utf8', xxx_encoding='none', tabsize=2)
   (options, args) = parser.parse_args()
   if not options.unit in ['sp', 'pt', 'bp', 'mm', 'cm', 'in']:
     parser.error("invalid unit name '%s'!" % options.unit)
   if options.tabsize < 0:
     parser.error("negative tabsize!")
+  if not options.xxx_encoding in ['none', 'utf8', 'sjis', 'eucjp']:
+    parser.error("invalid xxx-encoding '%s'!" % options.xxx_encoding)
   if not options.encoding in ['ascii', 'latin1', 'utf8', 'sjis', 'eucjp']:
     parser.error("invalid encoding '%s'!" % options.encoding)
   if options.ptex:

Added: trunk/Master/texmf-dist/doc/man/man1/dviasm.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/dviasm.1	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/man/man1/dviasm.1	2020-09-18 21:30:44 UTC (rev 56373)
@@ -0,0 +1,121 @@
+.TH DVIASM 1
+.SH NAME
+DVIasm \- a TeX utility program for editing DVI files directly
+.SH SYNOPSIS
+\fBdviasm\fR [<\fIoptions\fR>] <\fIdvi_file\fR>|<\fIdvi_dump_file\fR>
+.SH DESCRIPTION
+\fBDVIasm\fR is a TeX utility program which is
+designed for editing DeVice-Independent (DVI) files directly.
+It consists of a single Python script, dviasm.py,
+in a human readable text format.
+It runs on any platform in which Python 3 is installed.
+.TP 2
+Features of \fBDVIasm\fR includes:
+.IP
+1) Disassemble a DVI file (or XeTeX XDV file) into
+a human-readable text file, the contents of which are easy to modify.
+.IP
+2) Assembles the output text file back to the binary format.
+.TP 2
+There are several alternatives for dumping and editing DVI files:
+.IP
+1) \fBDVItype\fR developed by Donald E. Knuth supports
+one-way conversion from DVI to a text format.
+There are also some derivatives: \fBpDVItype\fR for pTeX,
+\fBupDVItype\fR for upTeX, \fBODVItype\fR for Omega.
+.IP
+2) The programs \fBdv2dt\fR and \fBdt2dv\fR can be used
+in pairs to allow two-way conversion between DVI and
+the DVI Text Language (DTL).
+.IP
+3) The program \fBdvispc\fR (part of DVIOUT previewer)
+also has an ability to convert between DVI and text.
+.PP
+Among those, \fBDVIasm\fR is designed to allow users to edit
+DVI files easily, for example by unifying
+``right1''\-``right4'' to a single command ``right''
+which can be used regardless of the amount of move.
+.SH OPTIONS
+.PP
+.TP 10
+\fB--version\fR
+Show program's version number and exit.
+.TP 10
+\fB-h\fR, \fB--help\fR
+Show this help message and exit.
+.TP 10
+\fB-u\fR <\fISTR\fR>, \fB--unit=\fR<\fISTR\fR>
+Set unit [default: `pt'].
+Allowed values are: `sp', `pt', `bp', `mm', `cm' and `in'.
+.TP 10
+\fB-o\fR <\fIFILE\fR>, \fB--output=\fR<\fIFILE\fR>
+Set filename for output instead of stdout.
+.TP 10
+\fB-e\fR <\fISTR\fR>, \fB--encoding=\fR<\fISTR\fR>
+Set encoding for input/output of dumped text [default: `utf8'].
+Allowed values are: `ascii', `latin1', `utf8', `sjis' and `eucjp'.
+When used with the option \fB-p\fR (or \fB--ptex\fR),
+allowed values are only `utf8', `sjis' and `eucjp'.
+.RS 10
+# NOTE: This feature does not support dumping through stdout.
+.RE
+.TP 10
+\fB-x\fR <\fISTR\fR>, \fB--xxx-encoding=\fR<\fISTR\fR>
+Set encoding for interpreting `xxx:' strings [default: `none'].
+Allowed values are: `none', `utf8', `sjis' and `eucjp'.
+.RS 10
+This option allows users to specify the correct encoding for
+dumping/compiling the contents of \\special.
+.TP 2
+Typical usages are as follows:
+.IP
+1) By default, the contents of \\special are dumped/compiled
+as byte-to-byte escape sequences in `\\x..' format.
+This would suffice when you don't need to read/edit
+the contents of \\special.
+.IP
+3) For XeTeX and upTeX users, `\fB-x utf8\fR' would be useful
+since these engines use UTF-8 to encode strings inside
+\\special commands.
+.IP
+2) For pTeX users with ISO-2022-JP-encoded DVI,
+it would be helpful to select the appropriate option
+`\fB-x eucjp\fR' (for Unix) or `\fB-x sjis\fR' (for Windows)
+to be consistent with the internal Kanji encoding used by
+pTeX engine.
+.RE
+.TP 10
+\fB-t\fR <\fIINT\fR>, \fB--tabsize=\fR<\fIINT\fR>
+Set tab size for push/pop [default: 2].
+.TP 10
+\fB-p\fR, \fB--ptex\fR
+Dump and compile ISO-2022-JP-encoded DVI for Japanese pTeX.
+This option is required to decode or encode Japanese characters
+being typeset (using `set2' or `put2') properly.
+.TP 10
+\fB-s\fR <\fISTR\fR>, \fB--subfont=\fR<\fISTR\fR>
+Specify the list of fonts with UCS2 subfont scheme
+in the comma-separated format.
+If <\fISTR\fR> is empty, the pre-defined internal subfont list
+is disabled.
+.RS 10
+This option would be useful for example when using CJK package.
+.RE
+.SH EXAMPLE
+Documentation of
+.B DVIasm
+by the original author Jin-Hwan Cho is published as:
+     http://tug.org/TUGboat/Articles/tb28-2/tb89cho.pdf (TUGboat)
+     http://ajt.ktug.kr/assets/2008/5/1/0201cho.pdf (Asian Journal of TeX)
+.SH AUTHORS
+The first version was written in Python 2 by Jin-Hwan Cho in 2007.
+Khaled Hosny started to support dumping/compiling XeTeX XDV format in 2014.
+Arthur Reutenauer ported the script to Python 3 in 2019.
+Current maintainer of \fBDVIasm\fR is Hironobu Yamashita, since 2020.
+.SH BUG REPORT
+Please visit the GitHub repository <https://github.com/aminophen/dviasm>.
+.SH SEE ALSO
+.BR dvitype (1),
+.BR dv2dt (1),
+.BR dt2dv (1),
+.BR dvispc (1).


Property changes on: trunk/Master/texmf-dist/doc/man/man1/dviasm.1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/man/man1/dviasm.man1.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/man/man1/dviasm.man1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/dviasm.man1.pdf	2020-09-18 05:52:26 UTC (rev 56372)
+++ trunk/Master/texmf-dist/doc/man/man1/dviasm.man1.pdf	2020-09-18 21:30:44 UTC (rev 56373)

Property changes on: trunk/Master/texmf-dist/doc/man/man1/dviasm.man1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/scripts/dviasm/dviasm.py
===================================================================
--- trunk/Master/texmf-dist/scripts/dviasm/dviasm.py	2020-09-18 05:52:26 UTC (rev 56372)
+++ trunk/Master/texmf-dist/scripts/dviasm/dviasm.py	2020-09-18 21:30:44 UTC (rev 56373)
@@ -455,7 +455,7 @@
       if o == SET_RULE:
         s.append([SET_RULE, [p, SignedQuad(fp)]])
       elif o in (PUT1, PUT2, PUT3, PUT4):
-        s.append([PUT1, p])
+        s.append([PUT1, [p]])
       elif o == PUT_RULE:
         s.append([PUT_RULE, [p, SignedQuad(fp)]])
       elif o == NOP:
@@ -492,7 +492,7 @@
       elif o < FNT_NUM_0 + 64 or o in (FNT1, FNT2, FNT3, FNT4):
         s.append([FNT1, p])
       elif o in (XXX1, XXX2, XXX3, XXX4):
-        q = fp.read(p).decode('utf8')
+        q = fp.read(p)
         s.append([XXX1, q])
       elif o in (FNT_DEF1, FNT_DEF2, FNT_DEF3, FNT_DEF4):
         self.DefineFont(p, fp)
@@ -644,10 +644,20 @@
           if cmd[1] < 64: s.append(bytes.fromhex('%02x' % (FNT_NUM_0 + cmd[1])))
           else:           s.append(self.CmdPairU(cmd))
         elif cmd[0] == XXX1:
-          cmd1 = cmd[1].encode('utf8')
-          l = len(cmd[1])
-          if l < 256: s.append(bytes.fromhex('%02x' % XXX1) + bytes.fromhex('%02x' % l) + cmd1)
-          else:       s.append(bytes.fromhex('%02x' % XXX4) + PutSignedQuad(l) + cmd1)
+          if options.xxx_encoding == "none":
+            l = len(cmd[1]) # leave encoding untouched
+          else:
+            cmd1 = cmd[1].encode(options.xxx_encoding)
+            l = len(cmd1)
+          if l < 256:
+            s.append(bytes.fromhex('%02x' % XXX1) + bytes.fromhex('%02x' % l))
+          else:
+            s.append(bytes.fromhex('%02x' % XXX4) + PutSignedQuad(l))
+          if options.xxx_encoding == "none":
+            for o in cmd[1]:
+              s.append(bytes.fromhex('%02x' % ord(o)))
+          else:
+              s.append(cmd1)
         elif cmd[0] == DIR:
           s.append(bytes.fromhex('%02x' % DIR) + bytes.fromhex('%02x' % cmd[1]))
         elif cmd[0] == BEGIN_REFLECT:
@@ -806,7 +816,10 @@
         else:
           self.cur_page.append([SET1, ol])
       elif key == 'put':
-        self.cur_page.append([PUT1, GetStr(val)])
+        ol = GetStr(val)
+        if len(ol) != 1:
+          warning('only one character is allowed for put!')
+        self.cur_page.append([PUT1, ol])
       elif key == 'setrule':
         v = val.split(' ')
         if len(v) != 2:
@@ -937,7 +950,10 @@
           fp.write("push:\n")
           indent += tabsize
         elif cmd[0] == XXX1:
-          fp.write("xxx: %s\n" % repr(cmd[1]))
+          if options.xxx_encoding == "none":
+            fp.write("xxx: %s\n" % PutStrASCII(cmd[1])) # leave encoding untouched
+          else:
+            fp.write("xxx: '%s'\n" % cmd[1].decode(options.xxx_encoding))
         elif cmd[0] == DIR:
           fp.write("dir: %d\n" % cmd[1])
         elif cmd[0] == BEGIN_REFLECT:
@@ -1147,7 +1163,7 @@
 Please report bugs to
   https://github.com/aminophen/dviasm"""
 
-  version = """This is %prog-20200912
+  version = """This is %prog-20200918
 
 Copyright (C) 2007-2008 by Jin-Hwan Cho <chofchof at ktug.or.kr>
 Copyright (C) 2011-2017 by Khaled Hosny <khaledhosny at eglug.org>
@@ -1172,6 +1188,10 @@
                     action="store", type="string", dest="encoding",
                     metavar="STR",
                     help="encoding for input/output [default=%default]")
+  parser.add_option("-x", "--xxx-encoding",
+                    action="store", type="string", dest="xxx_encoding",
+                    metavar="STR",
+                    help="encoding for interpreting xxx strings [default=%default]")
   parser.add_option("-t", "--tabsize",
                     action="store", type="int", dest="tabsize",
                     metavar="INT",
@@ -1183,12 +1203,14 @@
                     action="append", type="string", dest="subfont",
                     metavar="STR",
                     help="the list of fonts with UCS2 subfont scheme (comma separated); disable internal subfont list if STR is empty")
-  parser.set_defaults(unit='pt', encoding='utf8', tabsize=2)
+  parser.set_defaults(unit='pt', encoding='utf8', xxx_encoding='none', tabsize=2)
   (options, args) = parser.parse_args()
   if not options.unit in ['sp', 'pt', 'bp', 'mm', 'cm', 'in']:
     parser.error("invalid unit name '%s'!" % options.unit)
   if options.tabsize < 0:
     parser.error("negative tabsize!")
+  if not options.xxx_encoding in ['none', 'utf8', 'sjis', 'eucjp']:
+    parser.error("invalid xxx-encoding '%s'!" % options.xxx_encoding)
   if not options.encoding in ['ascii', 'latin1', 'utf8', 'sjis', 'eucjp']:
     parser.error("invalid encoding '%s'!" % options.encoding)
   if options.ptex:

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2020-09-18 05:52:26 UTC (rev 56372)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2020-09-18 21:30:44 UTC (rev 56373)
@@ -3373,6 +3373,7 @@
  'ctan-o-mat'           => '\.1$',
  'ctanify'              => '\.1$',
  'dosepsbin'            => 'dosepsbin.man',
+ 'dviasm'		=> '\.1$',
  'epstopdf'             => 'r?epstopdf.1|epstopdf.man1.pdf', # don't keep pdf
  'findhyph'             => 'findhyph.1',
  'fontools'             => '\.1$',



More information about the tex-live-commits mailing list.