From 58d9823409c590fe0e4cf3220d38dcad1d6dd68d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Jul 2005 22:25:46 +0000 Subject: updated for version 7.0114 --- src/Make_bc3.mak | 1 + src/Make_bc5.mak | 1 + src/Make_cyg.mak | 3 +- src/Make_dice.mak | 4 + src/Make_djg.mak | 1 + src/Make_ivc.mak | 5 + src/Make_manx.mak | 6 + src/Make_ming.mak | 1 + src/Make_morph.mak | 1 + src/Make_mpw.mak | 132 ++ src/Make_mvc.mak | 4 + src/Make_os2.mak | 2 + src/Make_ro.mak | 5 +- src/Make_sas.mak | 5 + src/Make_vms.mms | 10 +- src/Make_w16.mak | 1 + src/Makefile | 14 +- src/ex_cmds2.c | 3522 ----------------------------------------------- src/globals.h | 30 +- src/main.c | 556 ++++---- src/misc2.c | 74 - src/option.c | 17 +- src/os_mswin.c | 2 + src/po/Makefile | 68 +- src/po/README.txt | 1 + src/po/README_mingw.txt | 1 + src/po/cs.cp1250.po | 4 +- src/po/cs.po | 4 +- src/po/uk.cp1251.po | 4 +- src/po/uk.po | 4 +- src/po/zh_CN.UTF-8.po | 2 +- src/po/zh_CN.cp936.po | 2 +- src/po/zh_CN.po | 2 +- src/proto.h | 1 + src/proto/ex_cmds2.pro | 17 - src/proto/misc2.pro | 1 - src/version.h | 4 +- 37 files changed, 575 insertions(+), 3937 deletions(-) (limited to 'src') diff --git a/src/Make_bc3.mak b/src/Make_bc3.mak index e485750515..207b861a8b 100644 --- a/src/Make_bc3.mak +++ b/src/Make_bc3.mak @@ -65,6 +65,7 @@ EXE_dependencies = \ fileio.obj \ fold.obj \ getchar.obj \ + hardcopy.obj \ hashtable.obj \ main.obj \ mark.obj \ diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak index 195d79f9c1..99009c554b 100644 --- a/src/Make_bc5.mak +++ b/src/Make_bc5.mak @@ -546,6 +546,7 @@ vimobj = \ $(OBJDIR)\fileio.obj \ $(OBJDIR)\fold.obj \ $(OBJDIR)\getchar.obj \ + $(OBJDIR)\hardcopy.obj \ $(OBJDIR)\hashtable.obj \ $(OBJDIR)\main.obj \ $(OBJDIR)\mark.obj \ diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index c7f8337974..880f292340 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -1,6 +1,6 @@ # # Makefile for VIM on Win32, using Cygnus gcc -# Last updated by Dan Sharp. Last Change: 2005 Mar 21 +# Last updated by Dan Sharp. Last Change: 2005 Jul 23 # # Also read INSTALLpc.txt! # @@ -403,6 +403,7 @@ OBJ = \ $(OUTDIR)/fileio.o \ $(OUTDIR)/fold.o \ $(OUTDIR)/getchar.o \ + $(OUTDIR)/hardcopy.o \ $(OUTDIR)/hashtable.o \ $(OUTDIR)/main.o \ $(OUTDIR)/mark.o \ diff --git a/src/Make_dice.mak b/src/Make_dice.mak index c5fea5ee30..fe74f520ed 100644 --- a/src/Make_dice.mak +++ b/src/Make_dice.mak @@ -40,6 +40,7 @@ SRC = \ fileio.c \ fold.c \ getchar.c \ + hardcopy.c \ hashtable.c \ main.c \ mark.c \ @@ -82,6 +83,7 @@ OBJ = o/buffer.o \ o/fileio.o \ o/fold.o \ o/getchar.o \ + o/hardcopy.o \ o/hashtable.o \ o/main.o \ o/mark.o \ @@ -157,6 +159,8 @@ o/fold.o: fold.c $(SYMS) o/getchar.o: getchar.c $(SYMS) +o/hardcopy.o: hardcopy.c $(SYMS) + o/hashtable.o: hashtable.c $(SYMS) o/main.o: main.c $(SYMS) diff --git a/src/Make_djg.mak b/src/Make_djg.mak index 0ba5140c5c..fa4af40d30 100644 --- a/src/Make_djg.mak +++ b/src/Make_djg.mak @@ -33,6 +33,7 @@ OBJ = \ obj/fileio.o \ obj/fold.o \ obj/getchar.o \ + obj/hardcopy.o \ obj/hashtable.o \ obj/main.o \ obj/mark.o \ diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak index 2ca070e683..44f58fb94d 100644 --- a/src/Make_ivc.mak +++ b/src/Make_ivc.mak @@ -224,6 +224,7 @@ LINK32_OBJS= \ "$(INTDIR)/fileio.obj" \ "$(INTDIR)/fold.obj" \ "$(INTDIR)/getchar.obj" \ + "$(INTDIR)/hardcopy.obj" \ "$(INTDIR)/hashtable.obj" \ "$(INTDIR)/main.obj" \ "$(INTDIR)/mark.obj" \ @@ -378,6 +379,10 @@ SOURCE=.\getchar.c # End Source File # Begin Source File +SOURCE=.\hardcopy.c +# End Source File +# Begin Source File + SOURCE=.\hashtable.c # End Source File # Begin Source File diff --git a/src/Make_manx.mak b/src/Make_manx.mak index 5bb8e6b5e9..52b9e48336 100644 --- a/src/Make_manx.mak +++ b/src/Make_manx.mak @@ -48,6 +48,7 @@ SRC = buffer.c \ fileio.c \ fold.c \ getchar.c \ + hardcopy.c \ hashtable.c \ main.c \ mark.c \ @@ -92,6 +93,7 @@ OBJ = obj/buffer.o \ obj/fileio.o \ obj/fold.o \ obj/getchar.o \ + obj/hardcopy.o \ obj/hashtable.o \ obj/main.o \ obj/mark.o \ @@ -134,6 +136,7 @@ PRO = proto/buffer.pro \ proto/fileio.pro \ proto/fold.pro \ proto/getchar.pro \ + proto/hardcopy.pro \ proto/hashtable.pro \ proto/main.pro \ proto/mark.pro \ @@ -249,6 +252,9 @@ obj/fold.o: fold.c obj/getchar.o: getchar.c $(CCSYM) $@ getchar.c +obj/hardcopy.o: hardcopy.c + $(CCSYM) $@ hardcopy.c + obj/hashtable.o: hashtable.c $(CCSYM) $@ hashtable.c diff --git a/src/Make_ming.mak b/src/Make_ming.mak index 690627335d..9d78da56c1 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -371,6 +371,7 @@ OBJ = \ $(OUTDIR)/fileio.o \ $(OUTDIR)/fold.o \ $(OUTDIR)/getchar.o \ + $(OUTDIR)/hardcopy.o \ $(OUTDIR)/hashtable.o \ $(OUTDIR)/main.o \ $(OUTDIR)/mark.o \ diff --git a/src/Make_morph.mak b/src/Make_morph.mak index 2c67dab5da..54422feadb 100644 --- a/src/Make_morph.mak +++ b/src/Make_morph.mak @@ -38,6 +38,7 @@ SRC = buffer.c \ fileio.c \ fold.c \ getchar.c \ + hardcopy.c \ hashtable.c \ main.c \ mark.c \ diff --git a/src/Make_mpw.mak b/src/Make_mpw.mak index 4ee0e52acd..5be703a73a 100644 --- a/src/Make_mpw.mak +++ b/src/Make_mpw.mak @@ -32,6 +32,7 @@ SrcFiles = :src:fileio.c ¶ :src:fold.c ¶ :src:getchar.c ¶ + :src:hardcopy.c ¶ :src:hashtable.c ¶ :src:gui.c ¶ :src:gui_mac.c ¶ @@ -84,6 +85,7 @@ ObjFiles-PPC = "{ObjDir}fileio.c.x" ¶ "{ObjDir}fold.c.x" ¶ "{ObjDir}getchar.c.x" ¶ + "{ObjDir}hardcopy.c.x" ¶ "{ObjDir}hashtable.c.x" ¶ "{ObjDir}gui.c.x" ¶ "{ObjDir}gui_mac.c.x" ¶ @@ -167,6 +169,7 @@ VIm "{ObjDir}fileio.c.x" Ä :src:fileio.c "{ObjDir}fold.c.x" Ä :src:fold.c "{ObjDir}getchar.c.x" Ä :src:getchar.c +"{ObjDir}hardcopy.c.x" Ä :src:hardcopy.c "{ObjDir}hashtable.c.x" Ä :src:hashtable.c "{ObjDir}gui.c.x" Ä :src:gui.c "{ObjDir}gui_mac.c.x" Ä :src:gui_mac.c @@ -257,6 +260,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -339,6 +343,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -421,6 +426,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -503,6 +509,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -585,6 +592,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -668,6 +676,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -750,6 +759,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -832,6 +842,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -914,6 +925,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -996,6 +1008,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1078,6 +1091,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1160,6 +1174,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1242,6 +1257,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1366,6 +1382,89 @@ Dependencies :src:proto:if_perl.pro ¶ :src:proto:if_perlsfio.pro +:obj:hardcopy.c.x Ä ¶ + :src:hardcopy.c ¶ + :src:vim.h ¶ + :src:auto:config.h ¶ + :src:feature.h ¶ + :src:os_unix.h ¶ + :src:os_mac.h ¶ + :src:workshop.h ¶ + :src:ascii.h ¶ + :src:keymap.h ¶ + :src:term.h ¶ + :src:macros.h ¶ + :src:structs.h ¶ + :src:globals.h ¶ + :src:option.h ¶ + :src:ex_cmds.h ¶ + :src:proto.h ¶ + :src:integration.h ¶ + :src:wsdebug.h ¶ + :src:regexp.h ¶ + :src:gui.h ¶ + :src:farsi.h ¶ + :src:proto:os_unix.pro ¶ + :src:proto:os_mac.pro ¶ + :src:proto:buffer.pro ¶ + :src:proto:charset.pro ¶ + :src:proto:if_cscope.pro ¶ + :src:proto:diff.pro ¶ + :src:proto:digraph.pro ¶ + :src:proto:edit.pro ¶ + :src:proto:eval.pro ¶ + :src:proto:ex_cmds.pro ¶ + :src:proto:ex_cmds2.pro ¶ + :src:proto:ex_docmd.pro ¶ + :src:proto:ex_eval.pro ¶ + :src:proto:ex_getln.pro ¶ + :src:proto:fileio.pro ¶ + :src:proto:fold.pro ¶ + :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ + :src:proto:hashtable.pro ¶ + :src:proto:hangulin.pro ¶ + :src:proto:main.pro ¶ + :src:proto:mark.pro ¶ + :src:proto:memfile.pro ¶ + :src:proto:memline.pro ¶ + :src:proto:menu.pro ¶ + :src:proto:message.pro ¶ + :src:proto:misc1.pro ¶ + :src:proto:misc2.pro ¶ + :src:proto:move.pro ¶ + :src:proto:multibyte.pro ¶ + :src:proto:normal.pro ¶ + :src:proto:ops.pro ¶ + :src:proto:option.pro ¶ + :src:proto:quickfix.pro ¶ + :src:proto:regexp.pro ¶ + :src:proto:screen.pro ¶ + :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ + :src:proto:syntax.pro ¶ + :src:proto:tag.pro ¶ + :src:proto:term.pro ¶ + :src:proto:termlib.pro ¶ + :src:proto:ui.pro ¶ + :src:proto:undo.pro ¶ + :src:proto:version.pro ¶ + :src:proto:window.pro ¶ + :src:proto:if_python.pro ¶ + :src:proto:if_tcl.pro ¶ + :src:proto:if_ruby.pro ¶ + :src:proto:gui.pro ¶ + :src:proto:pty.pro ¶ + :src:proto:gui_gtk.pro ¶ + :src:proto:gui_gtk_x11.pro ¶ + :src:proto:gui_motif.pro ¶ + :src:proto:gui_athena.pro ¶ + :src:proto:gui_mac.pro ¶ + :src:proto:gui_x11.pro ¶ + :src:proto:workshop.pro ¶ + :src:proto:if_perl.pro ¶ + :src:proto:if_perlsfio.pro + :obj:hashtable.c.x Ä ¶ :src:hashtable.c ¶ :src:vim.h ¶ @@ -1405,6 +1504,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1487,6 +1587,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1569,6 +1670,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1677,6 +1779,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1760,6 +1863,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1842,6 +1946,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -1924,6 +2029,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2006,6 +2112,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2088,6 +2195,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2170,6 +2278,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2253,6 +2362,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2335,6 +2445,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2417,6 +2528,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2499,6 +2611,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2581,6 +2694,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2663,6 +2777,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2745,6 +2860,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2827,6 +2943,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2909,6 +3026,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -2991,6 +3109,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3073,6 +3192,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3155,6 +3275,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3237,6 +3358,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3319,6 +3441,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3401,6 +3524,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3483,6 +3607,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3565,6 +3690,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3648,6 +3774,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3729,6 +3856,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3811,6 +3939,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3894,6 +4023,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -3976,6 +4106,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ @@ -4058,6 +4189,7 @@ Dependencies :src:proto:fileio.pro ¶ :src:proto:fold.pro ¶ :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ :src:proto:hashtable.pro ¶ :src:proto:hangulin.pro ¶ :src:proto:main.pro ¶ diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 599767bb53..e4b3446282 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -384,6 +384,7 @@ OBJ = \ $(OUTDIR)\fileio.obj \ $(OUTDIR)\fold.obj \ $(OUTDIR)\getchar.obj \ + $(OUTDIR)\hardcopy.obj \ $(OUTDIR)\hashtable.obj \ $(OUTDIR)\main.obj \ $(OUTDIR)\mark.obj \ @@ -817,6 +818,8 @@ $(OUTDIR)/fold.obj: $(OUTDIR) fold.c $(INCL) $(OUTDIR)/getchar.obj: $(OUTDIR) getchar.c $(INCL) +$(OUTDIR)/hardcopy.obj: $(OUTDIR) hardcopy.c $(INCL) + $(OUTDIR)/hashtable.obj: $(OUTDIR) hashtable.c $(INCL) $(OUTDIR)/gui.obj: $(OUTDIR) gui.c $(INCL) $(GUI_INCL) @@ -965,6 +968,7 @@ proto.h: \ proto/ex_getln.pro \ proto/fileio.pro \ proto/getchar.pro \ + proto/hardcopy.pro \ proto/hashtable.pro \ proto/main.pro \ proto/mark.pro \ diff --git a/src/Make_os2.mak b/src/Make_os2.mak index c18538ef8d..2c4cdaf9e0 100644 --- a/src/Make_os2.mak +++ b/src/Make_os2.mak @@ -53,6 +53,7 @@ OBJ = \ fileio.o \ fold.o \ getchar.o \ + hardcopy.o \ hashtable.o \ main.o \ mark.o \ @@ -124,6 +125,7 @@ ex_getln.o: ex_getln.c $(INCL) fileio.o: fileio.c $(INCL) fold.o: fold.c $(INCL) getchar.o: getchar.c $(INCL) +hardcopy.o: hardcopy.c $(INCL) hashtable.o: hashtable.c $(INCL) main.o: main.c $(INCL) mark.o: mark.c $(INCL) diff --git a/src/Make_ro.mak b/src/Make_ro.mak index 4297568ad1..38e6324b03 100644 --- a/src/Make_ro.mak +++ b/src/Make_ro.mak @@ -12,7 +12,8 @@ TERMFLAG = -DUP_BC_PC_EXTERN ASMFLAGS = -throwback -objasm -gcc OBJS = o.buffer o.charset o.diff o.digraph o.edit o.eval o.ex_cmds o.ex_cmds2 \ - o.ex_docmd o.ex_eval o.ex_getln o.fileio o.fold o.getchar o.hashtable o.main o.mark o.mbyte \ + o.ex_docmd o.ex_eval o.ex_getln o.fileio o.fold o.getchar \ + o.hardcopy o.hashtable o.main o.mark o.mbyte \ o.memfile o.memline o.menu o.message o.misc1 o.misc2 o.move \ o.normal o.ops o.option o.quickfix o.regexp o.screen o.search \ o.spell o.syntax o.tag o.term o.termlib o.ui o.undo o.version \ @@ -65,6 +66,8 @@ o.fold: c.fold o.getchar: c.getchar +o.hardcopy: c.hardcopy + o.hashtable: c.hashtable o.gui: c.gui diff --git a/src/Make_sas.mak b/src/Make_sas.mak index 3e563f9a53..484f562adf 100644 --- a/src/Make_sas.mak +++ b/src/Make_sas.mak @@ -103,6 +103,7 @@ SRC = \ fileio.c \ fold.c \ getchar.c \ + hardcopy.c \ hashtable.c \ main.c \ mark.c \ @@ -146,6 +147,7 @@ OBJ = \ fileio.o \ fold.o \ getchar.o \ + hardcopy.o \ hashtable.o \ main.o \ mark.o \ @@ -189,6 +191,7 @@ PRO = \ proto/fileio.pro \ proto/fold.pro \ proto/getchar.pro \ + proto/hardcopy.pro \ proto/hashtable.pro \ proto/main.pro \ proto/mark.pro \ @@ -300,6 +303,8 @@ fold.o: fold.c proto/fold.pro: fold.c getchar.o: getchar.c proto/getchar.pro: getchar.c +hardcopy.o: hardcopy.c +proto/hardcopy.pro: hardcopy.c hashtable.o: hashtable.c proto/hashtable.pro: hashtable.c main.o: main.c diff --git a/src/Make_vms.mms b/src/Make_vms.mms index e44c83dc4a..8b83468338 100644 --- a/src/Make_vms.mms +++ b/src/Make_vms.mms @@ -2,7 +2,7 @@ # Makefile for Vim on OpenVMS # # Maintainer: Zoltan Arpadffy -# Last change: 2005 Jul 12 +# Last change: 2005 Jul 23 # # This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64 # with MMS and MMK @@ -287,7 +287,7 @@ ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \ SRC = buffer.c charset.c diff.c digraph.c edit.c eval.c ex_cmds.c ex_cmds2.c \ ex_docmd.c ex_eval.c ex_getln.c if_xcmdsrv.c fileio.c fold.c getchar.c \ - hashtable.c, main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \ + hardcopy.c hashtable.c main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \ misc2.c move.c normal.c ops.c option.c quickfix.c regexp.c search.c \ spell.c syntax.c tag.c term.c termlib.c ui.c undo.c version.c screen.c \ window.c os_unix.c os_vms.c pathdef.c \ @@ -296,7 +296,7 @@ SRC = buffer.c charset.c diff.c digraph.c edit.c eval.c ex_cmds.c ex_cmds2.c \ OBJ = buffer.obj charset.obj diff.obj digraph.obj edit.obj eval.obj \ ex_cmds.obj ex_cmds2.obj ex_docmd.obj ex_eval.obj ex_getln.obj \ - if_xcmdsrv.obj fileio.obj fold.obj getchar.obj hashtable.obj main.obj mark.obj \ + if_xcmdsrv.obj fileio.obj fold.obj getchar.obj hardcopy.obj hashtable.obj main.obj mark.obj \ menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \ move.obj mbyte.obj normal.obj ops.obj option.obj quickfix.obj \ regexp.obj search.obj spell.obj syntax.obj tag.obj term.obj termlib.obj \ @@ -527,6 +527,10 @@ getchar.obj : getchar.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h +hardcopy.obj : hardcopy.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h \ + gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + globals.h farsi.h arabic.h hashtable.obj : hashtable.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ diff --git a/src/Make_w16.mak b/src/Make_w16.mak index 303c662757..42d15470a5 100644 --- a/src/Make_w16.mak +++ b/src/Make_w16.mak @@ -87,6 +87,7 @@ ObjFiles = \ $(INTDIR)\fileio.obj\ $(INTDIR)\fold.obj\ $(INTDIR)\getchar.obj\ + $(INTDIR)\hardcopy.obj\ $(INTDIR)\hashtable.obj\ $(INTDIR)\gui.obj\ $(INTDIR)\gui_w16.obj\ diff --git a/src/Makefile b/src/Makefile index cea05871a8..83732a28a7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1343,6 +1343,7 @@ BASIC_SRC = \ fileio.c \ fold.c \ getchar.c \ + hardcopy.c \ hashtable.c \ if_cscope.c \ if_xcmdsrv.c \ @@ -1411,6 +1412,7 @@ OBJ = \ objects/fileio.o \ objects/fold.o \ objects/getchar.o \ + objects/hardcopy.o \ objects/hashtable.o \ $(HANGULIN_OBJ) \ objects/if_cscope.o \ @@ -1468,6 +1470,7 @@ PRO_AUTO = \ fileio.pro \ fold.pro \ getchar.pro \ + hardcopy.pro \ hashtable.pro \ hangulin.pro \ if_cscope.pro \ @@ -1599,7 +1602,9 @@ xxd/xxd$(EXEEXT): xxd/xxd.c # Generate the converted .mo files separately, it's no problem if this fails. languages: @if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ - cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \ + cd $(PODIR); \ + CC="$(CC)" $(MAKE) check; \ + CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \ fi -@if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \ @@ -2285,6 +2290,9 @@ objects/fold.o: fold.c objects/getchar.o: getchar.c $(CCC) -o $@ getchar.c +objects/hardcopy.o: hardcopy.c + $(CCC) -o $@ hardcopy.c + objects/hashtable.o: hashtable.c $(CCC) -o $@ hashtable.c @@ -2637,6 +2645,10 @@ objects/getchar.o: getchar.c vim.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h +objects/hardcopy.o: hardcopy.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \ + gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \ + globals.h farsi.h arabic.h objects/hashtable.o: hashtable.c vim.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \ diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 923faf9bca..861fa8186c 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3627,3528 +3627,6 @@ ex_checktime(eap) } #endif -#if defined(FEAT_PRINTER) || defined(PROTO) -/* - * Printing code (Machine-independent.) - * To implement printing on a platform, the following functions must be - * defined: - * - * int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) - * Called once. Code should display printer dialogue (if appropriate) and - * determine printer font and margin settings. Reset has_color if the printer - * doesn't support colors at all. - * Returns FAIL to abort. - * - * int mch_print_begin(prt_settings_T *settings) - * Called to start the print job. - * Return FALSE to abort. - * - * int mch_print_begin_page(char_u *msg) - * Called at the start of each page. - * "msg" indicates the progress of the print job, can be NULL. - * Return FALSE to abort. - * - * int mch_print_end_page() - * Called at the end of each page. - * Return FALSE to abort. - * - * int mch_print_blank_page() - * Called to generate a blank page for collated, duplex, multiple copy - * document. Return FALSE to abort. - * - * void mch_print_end(prt_settings_T *psettings) - * Called at normal end of print job. - * - * void mch_print_cleanup() - * Called if print job ends normally or is abandoned. Free any memory, close - * devices and handles. Also called when mch_print_begin() fails, but not - * when mch_print_init() fails. - * - * void mch_print_set_font(int Bold, int Italic, int Underline); - * Called whenever the font style changes. - * - * void mch_print_set_bg(long bgcol); - * Called to set the background color for the following text. Parameter is an - * RGB value. - * - * void mch_print_set_fg(long fgcol); - * Called to set the foreground color for the following text. Parameter is an - * RGB value. - * - * mch_print_start_line(int margin, int page_line) - * Sets the current position at the start of line "page_line". - * If margin is TRUE start in the left margin (for header and line number). - * - * int mch_print_text_out(char_u *p, int len); - * Output one character of text p[len] at the current position. - * Return TRUE if there is no room for another character in the same line. - * - * Note that the generic code has no idea of margins. The machine code should - * simply make the page look smaller! The header and the line numbers are - * printed in the margin. - */ - -#ifdef FEAT_SYN_HL -static const long_u cterm_color_8[8] = -{ - (long_u)0x000000L, (long_u)0xff0000L, (long_u)0x00ff00L, (long_u)0xffff00L, - (long_u)0x0000ffL, (long_u)0xff00ffL, (long_u)0x00ffffL, (long_u)0xffffffL -}; - -static const long_u cterm_color_16[16] = -{ - (long_u)0x000000L, (long_u)0x0000c0L, (long_u)0x008000L, (long_u)0x004080L, - (long_u)0xc00000L, (long_u)0xc000c0L, (long_u)0x808000L, (long_u)0xc0c0c0L, - (long_u)0x808080L, (long_u)0x6060ffL, (long_u)0x00ff00L, (long_u)0x00ffffL, - (long_u)0xff8080L, (long_u)0xff40ffL, (long_u)0xffff00L, (long_u)0xffffffL -}; - -static int current_syn_id; -#endif - -#define PRCOLOR_BLACK (long_u)0 -#define PRCOLOR_WHITE (long_u)0xFFFFFFL - -static int curr_italic; -static int curr_bold; -static int curr_underline; -static long_u curr_bg; -static long_u curr_fg; -static int page_count; - -/* - * These values determine the print position on a page. - */ -typedef struct -{ - int lead_spaces; /* remaining spaces for a TAB */ - int print_pos; /* virtual column for computing TABs */ - colnr_T column; /* byte column */ - linenr_T file_line; /* line nr in the buffer */ - long_u bytes_printed; /* bytes printed so far */ - int ff; /* seen form feed character */ -} prt_pos_T; - -#ifdef FEAT_SYN_HL -static long_u darken_rgb __ARGS((long_u rgb)); -static long_u prt_get_term_color __ARGS((int colorindex)); -#endif -static void prt_set_fg __ARGS((long_u fg)); -static void prt_set_bg __ARGS((long_u bg)); -static void prt_set_font __ARGS((int bold, int italic, int underline)); -static void prt_line_number __ARGS((prt_settings_T *psettings, int page_line, linenr_T lnum)); -static void prt_header __ARGS((prt_settings_T *psettings, int pagenum, linenr_T lnum)); -static void prt_message __ARGS((char_u *s)); -static colnr_T hardcopy_line __ARGS((prt_settings_T *psettings, int page_line, prt_pos_T *ppos)); -static void prt_get_attr __ARGS((int hl_id, prt_text_attr_T* pattr, int modec)); - -#ifdef FEAT_SYN_HL -/* - * If using a dark background, the colors will probably be too bright to show - * up well on white paper, so reduce their brightness. - */ - static long_u -darken_rgb(rgb) - long_u rgb; -{ - return ((rgb >> 17) << 16) - + (((rgb & 0xff00) >> 9) << 8) - + ((rgb & 0xff) >> 1); -} - - static long_u -prt_get_term_color(colorindex) - int colorindex; -{ - /* TODO: Should check for xterm with 88 or 256 colors. */ - if (t_colors > 8) - return cterm_color_16[colorindex % 16]; - return cterm_color_8[colorindex % 8]; -} - - static void -prt_get_attr(hl_id, pattr, modec) - int hl_id; - prt_text_attr_T *pattr; - int modec; -{ - int colorindex; - long_u fg_color; - long_u bg_color; - char *color; - - pattr->bold = (highlight_has_attr(hl_id, HL_BOLD, modec) != NULL); - pattr->italic = (highlight_has_attr(hl_id, HL_ITALIC, modec) != NULL); - pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL); - pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL); - -# ifdef FEAT_GUI - if (gui.in_use) - { - bg_color = highlight_gui_color_rgb(hl_id, FALSE); - if (bg_color == PRCOLOR_BLACK) - bg_color = PRCOLOR_WHITE; - - fg_color = highlight_gui_color_rgb(hl_id, TRUE); - } - else -# endif - { - bg_color = PRCOLOR_WHITE; - - color = (char *)highlight_color(hl_id, (char_u *)"fg", modec); - if (color == NULL) - colorindex = 0; - else - colorindex = atoi(color); - - if (colorindex >= 0 && colorindex < t_colors) - fg_color = prt_get_term_color(colorindex); - else - fg_color = PRCOLOR_BLACK; - } - - if (fg_color == PRCOLOR_WHITE) - fg_color = PRCOLOR_BLACK; - else if (*p_bg == 'd') - fg_color = darken_rgb(fg_color); - - pattr->fg_color = fg_color; - pattr->bg_color = bg_color; -} -#endif /* FEAT_SYN_HL */ - - static void -prt_set_fg(fg) - long_u fg; -{ - if (fg != curr_fg) - { - curr_fg = fg; - mch_print_set_fg(fg); - } -} - - static void -prt_set_bg(bg) - long_u bg; -{ - if (bg != curr_bg) - { - curr_bg = bg; - mch_print_set_bg(bg); - } -} - - static void -prt_set_font(bold, italic, underline) - int bold; - int italic; - int underline; -{ - if (curr_bold != bold - || curr_italic != italic - || curr_underline != underline) - { - curr_underline = underline; - curr_italic = italic; - curr_bold = bold; - mch_print_set_font(bold, italic, underline); - } -} - -/* - * Print the line number in the left margin. - */ - static void -prt_line_number(psettings, page_line, lnum) - prt_settings_T *psettings; - int page_line; - linenr_T lnum; -{ - int i; - char_u tbuf[20]; - - prt_set_fg(psettings->number.fg_color); - prt_set_bg(psettings->number.bg_color); - prt_set_font(psettings->number.bold, psettings->number.italic, psettings->number.underline); - mch_print_start_line(TRUE, page_line); - - /* Leave two spaces between the number and the text; depends on - * PRINT_NUMBER_WIDTH. */ - sprintf((char *)tbuf, "%6ld", (long)lnum); - for (i = 0; i < 6; i++) - (void)mch_print_text_out(&tbuf[i], 1); - -#ifdef FEAT_SYN_HL - if (psettings->do_syntax) - /* Set colors for next character. */ - current_syn_id = -1; - else -#endif - { - /* Set colors and font back to normal. */ - prt_set_fg(PRCOLOR_BLACK); - prt_set_bg(PRCOLOR_WHITE); - prt_set_font(FALSE, FALSE, FALSE); - } -} - -static linenr_T printer_page_num; - - int -get_printer_page_num() -{ - return printer_page_num; -} - -/* - * Get the currently effective header height. - */ - int -prt_header_height() -{ - if (printer_opts[OPT_PRINT_HEADERHEIGHT].present) - return printer_opts[OPT_PRINT_HEADERHEIGHT].number; - return 2; -} - -/* - * Return TRUE if using a line number for printing. - */ - int -prt_use_number() -{ - return (printer_opts[OPT_PRINT_NUMBER].present - && TOLOWER_ASC(printer_opts[OPT_PRINT_NUMBER].string[0]) == 'y'); -} - -/* - * Return the unit used in a margin item in 'printoptions'. - * Returns PRT_UNIT_NONE if not recognized. - */ - int -prt_get_unit(idx) - int idx; -{ - int u = PRT_UNIT_NONE; - int i; - static char *(units[4]) = PRT_UNIT_NAMES; - - if (printer_opts[idx].present) - for (i = 0; i < 4; ++i) - if (STRNICMP(printer_opts[idx].string, units[i], 2) == 0) - { - u = i; - break; - } - return u; -} - -/* - * Print the page header. - */ -/*ARGSUSED*/ - static void -prt_header(psettings, pagenum, lnum) - prt_settings_T *psettings; - int pagenum; - linenr_T lnum; -{ - int width = psettings->chars_per_line; - int page_line; - char_u *tbuf; - char_u *p; -#ifdef FEAT_MBYTE - int l; -#endif - - /* Also use the space for the line number. */ - if (prt_use_number()) - width += PRINT_NUMBER_WIDTH; - - tbuf = alloc(width + IOSIZE); - if (tbuf == NULL) - return; - -#ifdef FEAT_STL_OPT - if (*p_header != NUL) - { - linenr_T tmp_lnum, tmp_topline, tmp_botline; - - /* - * Need to (temporarily) set current line number and first/last line - * number on the 'window'. Since we don't know how long the page is, - * set the first and current line number to the top line, and guess - * that the page length is 64. - */ - tmp_lnum = curwin->w_cursor.lnum; - tmp_topline = curwin->w_topline; - tmp_botline = curwin->w_botline; - curwin->w_cursor.lnum = lnum; - curwin->w_topline = lnum; - curwin->w_botline = lnum + 63; - printer_page_num = pagenum; - - build_stl_str_hl(curwin, tbuf, (size_t)(width + IOSIZE), - p_header, ' ', width, NULL); - - /* Reset line numbers */ - curwin->w_cursor.lnum = tmp_lnum; - curwin->w_topline = tmp_topline; - curwin->w_botline = tmp_botline; - } - else -#endif - sprintf((char *)tbuf, _("Page %d"), pagenum); - - prt_set_fg(PRCOLOR_BLACK); - prt_set_bg(PRCOLOR_WHITE); - prt_set_font(TRUE, FALSE, FALSE); - - /* Use a negative line number to indicate printing in the top margin. */ - page_line = 0 - prt_header_height(); - mch_print_start_line(TRUE, page_line); - for (p = tbuf; *p != NUL; ) - { - if (mch_print_text_out(p, -#ifdef FEAT_MBYTE - (l = (*mb_ptr2len_check)(p)) -#else - 1 -#endif - )) - { - ++page_line; - if (page_line >= 0) /* out of room in header */ - break; - mch_print_start_line(TRUE, page_line); - } -#ifdef FEAT_MBYTE - p += l; -#else - p++; -#endif - } - - vim_free(tbuf); - -#ifdef FEAT_SYN_HL - if (psettings->do_syntax) - /* Set colors for next character. */ - current_syn_id = -1; - else -#endif - { - /* Set colors and font back to normal. */ - prt_set_fg(PRCOLOR_BLACK); - prt_set_bg(PRCOLOR_WHITE); - prt_set_font(FALSE, FALSE, FALSE); - } -} - -/* - * Display a print status message. - */ - static void -prt_message(s) - char_u *s; -{ - screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); - screen_puts(s, (int)Rows - 1, 0, hl_attr(HLF_R)); - out_flush(); -} - - void -ex_hardcopy(eap) - exarg_T *eap; -{ - linenr_T lnum; - int collated_copies, uncollated_copies; - prt_settings_T settings; - long_u bytes_to_print = 0; - int page_line; - int jobsplit; - int id; - - memset(&settings, 0, sizeof(prt_settings_T)); - settings.has_color = TRUE; - -# ifdef FEAT_POSTSCRIPT - if (*eap->arg == '>') - { - char_u *errormsg = NULL; - - /* Expand things like "%.ps". */ - if (expand_filename(eap, eap->cmdlinep, &errormsg) == FAIL) - { - if (errormsg != NULL) - EMSG(errormsg); - return; - } - settings.outfile = skipwhite(eap->arg + 1); - } - else if (*eap->arg != NUL) - settings.arguments = eap->arg; -# endif - - /* - * Initialise for printing. Ask the user for settings, unless forceit is - * set. - * The mch_print_init() code should set up margins if applicable. (It may - * not be a real printer - for example the engine might generate HTML or - * PS.) - */ - if (mch_print_init(&settings, - curbuf->b_fname == NULL - ? (char_u *)buf_spname(curbuf) - : curbuf->b_sfname == NULL - ? curbuf->b_fname - : curbuf->b_sfname, - eap->forceit) == FAIL) - return; - -#ifdef FEAT_SYN_HL -# ifdef FEAT_GUI - if (gui.in_use) - settings.modec = 'g'; - else -# endif - if (t_colors > 1) - settings.modec = 'c'; - else - settings.modec = 't'; - - if (!syntax_present(curbuf)) - settings.do_syntax = FALSE; - else if (printer_opts[OPT_PRINT_SYNTAX].present - && TOLOWER_ASC(printer_opts[OPT_PRINT_SYNTAX].string[0]) != 'a') - settings.do_syntax = - (TOLOWER_ASC(printer_opts[OPT_PRINT_SYNTAX].string[0]) == 'y'); - else - settings.do_syntax = settings.has_color; -#endif - - /* Set up printing attributes for line numbers */ - settings.number.fg_color = PRCOLOR_BLACK; - settings.number.bg_color = PRCOLOR_WHITE; - settings.number.bold = FALSE; - settings.number.italic = TRUE; - settings.number.underline = FALSE; -#ifdef FEAT_SYN_HL - /* - * Syntax highlighting of line numbers. - */ - if (prt_use_number() && settings.do_syntax) - { - id = syn_name2id((char_u *)"LineNr"); - if (id > 0) - id = syn_get_final_id(id); - - prt_get_attr(id, &settings.number, settings.modec); - } -#endif /* FEAT_SYN_HL */ - - /* - * Estimate the total lines to be printed - */ - for (lnum = eap->line1; lnum <= eap->line2; lnum++) - bytes_to_print += (long_u)STRLEN(skipwhite(ml_get(lnum))); - if (bytes_to_print == 0) - { - MSG(_("No text to be printed")); - goto print_fail_no_begin; - } - - /* Set colors and font to normal. */ - curr_bg = (long_u)0xffffffffL; - curr_fg = (long_u)0xffffffffL; - curr_italic = MAYBE; - curr_bold = MAYBE; - curr_underline = MAYBE; - - prt_set_fg(PRCOLOR_BLACK); - prt_set_bg(PRCOLOR_WHITE); - prt_set_font(FALSE, FALSE, FALSE); -#ifdef FEAT_SYN_HL - current_syn_id = -1; -#endif - - jobsplit = (printer_opts[OPT_PRINT_JOBSPLIT].present - && TOLOWER_ASC(printer_opts[OPT_PRINT_JOBSPLIT].string[0]) == 'y'); - - if (!mch_print_begin(&settings)) - goto print_fail_no_begin; - - /* - * Loop over collated copies: 1 2 3, 1 2 3, ... - */ - page_count = 0; - for (collated_copies = 0; - collated_copies < settings.n_collated_copies; - collated_copies++) - { - prt_pos_T prtpos; /* current print position */ - prt_pos_T page_prtpos; /* print position at page start */ - int side; - - memset(&page_prtpos, 0, sizeof(prt_pos_T)); - page_prtpos.file_line = eap->line1; - prtpos = page_prtpos; - - if (jobsplit && collated_copies > 0) - { - /* Splitting jobs: Stop a previous job and start a new one. */ - mch_print_end(&settings); - if (!mch_print_begin(&settings)) - goto print_fail_no_begin; - } - - /* - * Loop over all pages in the print job: 1 2 3 ... - */ - for (page_count = 0; prtpos.file_line <= eap->line2; ++page_count) - { - /* - * Loop over uncollated copies: 1 1 1, 2 2 2, 3 3 3, ... - * For duplex: 12 12 12 34 34 34, ... - */ - for (uncollated_copies = 0; - uncollated_copies < settings.n_uncollated_copies; - uncollated_copies++) - { - /* Set the print position to the start of this page. */ - prtpos = page_prtpos; - - /* - * Do front and rear side of a page. - */ - for (side = 0; side <= settings.duplex; ++side) - { - /* - * Print one page. - */ - - /* Check for interrupt character every page. */ - ui_breakcheck(); - if (got_int || settings.user_abort) - goto print_fail; - - sprintf((char *)IObuff, _("Printing page %d (%d%%)"), - page_count + 1 + side, - prtpos.bytes_printed > 1000000 - ? (int)(prtpos.bytes_printed / - (bytes_to_print / 100)) - : (int)((prtpos.bytes_printed * 100) - / bytes_to_print)); - if (!mch_print_begin_page(IObuff)) - goto print_fail; - - if (settings.n_collated_copies > 1) - sprintf((char *)IObuff + STRLEN(IObuff), - _(" Copy %d of %d"), - collated_copies + 1, - settings.n_collated_copies); - prt_message(IObuff); - - /* - * Output header if required - */ - if (prt_header_height() > 0) - prt_header(&settings, page_count + 1 + side, - prtpos.file_line); - - for (page_line = 0; page_line < settings.lines_per_page; - ++page_line) - { - prtpos.column = hardcopy_line(&settings, - page_line, &prtpos); - if (prtpos.column == 0) - { - /* finished a file line */ - prtpos.bytes_printed += - STRLEN(skipwhite(ml_get(prtpos.file_line))); - if (++prtpos.file_line > eap->line2) - break; /* reached the end */ - } - else if (prtpos.ff) - { - /* Line had a formfeed in it - start new page but - * stay on the current line */ - break; - } - } - - if (!mch_print_end_page()) - goto print_fail; - if (prtpos.file_line > eap->line2) - break; /* reached the end */ - } - - /* - * Extra blank page for duplexing with odd number of pages and - * more copies to come. - */ - if (prtpos.file_line > eap->line2 && settings.duplex - && side == 0 - && uncollated_copies + 1 < settings.n_uncollated_copies) - { - if (!mch_print_blank_page()) - goto print_fail; - } - } - if (settings.duplex && prtpos.file_line <= eap->line2) - ++page_count; - - /* Remember the position where the next page starts. */ - page_prtpos = prtpos; - } - - vim_snprintf((char *)IObuff, IOSIZE, _("Printed: %s"), - settings.jobname); - prt_message(IObuff); - } - -print_fail: - if (got_int || settings.user_abort) - { - sprintf((char *)IObuff, "%s", _("Printing aborted")); - prt_message(IObuff); - } - mch_print_end(&settings); - -print_fail_no_begin: - mch_print_cleanup(); -} - -/* - * Print one page line. - * Return the next column to print, or zero if the line is finished. - */ - static colnr_T -hardcopy_line(psettings, page_line, ppos) - prt_settings_T *psettings; - int page_line; - prt_pos_T *ppos; -{ - colnr_T col; - char_u *line; - int need_break = FALSE; - int outputlen; - int tab_spaces; - long_u print_pos; -#ifdef FEAT_SYN_HL - prt_text_attr_T attr; - int id; -#endif - - if (ppos->column == 0 || ppos->ff) - { - print_pos = 0; - tab_spaces = 0; - if (!ppos->ff && prt_use_number()) - prt_line_number(psettings, page_line, ppos->file_line); - ppos->ff = FALSE; - } - else - { - /* left over from wrap halfway a tab */ - print_pos = ppos->print_pos; - tab_spaces = ppos->lead_spaces; - } - - mch_print_start_line(0, page_line); - line = ml_get(ppos->file_line); - - /* - * Loop over the columns until the end of the file line or right margin. - */ - for (col = ppos->column; line[col] != NUL && !need_break; col += outputlen) - { - outputlen = 1; -#ifdef FEAT_MBYTE - if (has_mbyte && (outputlen = (*mb_ptr2len_check)(line + col)) < 1) - outputlen = 1; -#endif -#ifdef FEAT_SYN_HL - /* - * syntax highlighting stuff. - */ - if (psettings->do_syntax) - { - id = syn_get_id(ppos->file_line, col, 1, NULL); - if (id > 0) - id = syn_get_final_id(id); - else - id = 0; - /* Get the line again, a multi-line regexp may invalidate it. */ - line = ml_get(ppos->file_line); - - if (id != current_syn_id) - { - current_syn_id = id; - prt_get_attr(id, &attr, psettings->modec); - prt_set_font(attr.bold, attr.italic, attr.underline); - prt_set_fg(attr.fg_color); - prt_set_bg(attr.bg_color); - } - } -#endif /* FEAT_SYN_HL */ - - /* - * Appropriately expand any tabs to spaces. - */ - if (line[col] == TAB || tab_spaces != 0) - { - if (tab_spaces == 0) - tab_spaces = curbuf->b_p_ts - (print_pos % curbuf->b_p_ts); - - while (tab_spaces > 0) - { - need_break = mch_print_text_out((char_u *)" ", 1); - print_pos++; - tab_spaces--; - if (need_break) - break; - } - /* Keep the TAB if we didn't finish it. */ - if (need_break && tab_spaces > 0) - break; - } - else if (line[col] == FF - && printer_opts[OPT_PRINT_FORMFEED].present - && TOLOWER_ASC(printer_opts[OPT_PRINT_FORMFEED].string[0]) - == 'y') - { - ppos->ff = TRUE; - need_break = 1; - } - else - { - need_break = mch_print_text_out(line + col, outputlen); -#ifdef FEAT_MBYTE - if (has_mbyte) - print_pos += (*mb_ptr2cells)(line + col); - else -#endif - print_pos++; - } - } - - ppos->lead_spaces = tab_spaces; - ppos->print_pos = print_pos; - - /* - * Start next line of file if we clip lines, or have reached end of the - * line, unless we are doing a formfeed. - */ - if (!ppos->ff - && (line[col] == NUL - || (printer_opts[OPT_PRINT_WRAP].present - && TOLOWER_ASC(printer_opts[OPT_PRINT_WRAP].string[0]) - == 'n'))) - return 0; - return col; -} - -# if defined(FEAT_POSTSCRIPT) || defined(PROTO) - -/* - * PS printer stuff. - * - * Sources of information to help maintain the PS printing code: - * - * 1. PostScript Language Reference, 3rd Edition, - * Addison-Wesley, 1999, ISBN 0-201-37922-8 - * 2. PostScript Language Program Design, - * Addison-Wesley, 1988, ISBN 0-201-14396-8 - * 3. PostScript Tutorial and Cookbook, - * Addison Wesley, 1985, ISBN 0-201-10179-3 - * 4. PostScript Language Document Structuring Conventions Specification, - * version 3.0, - * Adobe Technote 5001, 25th September 1992 - * 5. PostScript Printer Description File Format Specification, Version 4.3, - * Adobe technote 5003, 9th February 1996 - * 6. Adobe Font Metrics File Format Specification, Version 4.1, - * Adobe Technote 5007, 7th October 1998 - * 7. Adobe CMap and CIDFont Files Specification, Version 1.0, - * Adobe Technote 5014, 8th October 1996 - * 8. Adobe CJKV Character Collections and CMaps for CID-Keyed Fonts, - * Adoboe Technote 5094, 8th September, 2001 - * 9. CJKV Information Processing, 2nd Edition, - * O'Reilly, 2002, ISBN 1-56592-224-7 - * - * Some of these documents can be found in PDF form on Adobe's web site - - * http://www.adobe.com - */ - -#define NUM_ELEMENTS(arr) (sizeof(arr)/sizeof((arr)[0])) - -#define PRT_PS_DEFAULT_DPI (72) /* Default user space resolution */ -#define PRT_PS_DEFAULT_FONTSIZE (10) -#define PRT_PS_DEFAULT_BUFFER_SIZE (80) - -struct prt_mediasize_S -{ - char *name; - float width; /* width and height in points for portrait */ - float height; -}; - -#define PRT_MEDIASIZE_LEN (sizeof(prt_mediasize) / sizeof(struct prt_mediasize_S)) - -static struct prt_mediasize_S prt_mediasize[] = -{ - {"A4", 595.0, 842.0}, - {"letter", 612.0, 792.0}, - {"10x14", 720.0, 1008.0}, - {"A3", 842.0, 1191.0}, - {"A5", 420.0, 595.0}, - {"B4", 729.0, 1032.0}, - {"B5", 516.0, 729.0}, - {"executive", 522.0, 756.0}, - {"folio", 595.0, 935.0}, - {"ledger", 1224.0, 792.0}, /* Yes, it is wider than taller! */ - {"legal", 612.0, 1008.0}, - {"quarto", 610.0, 780.0}, - {"statement", 396.0, 612.0}, - {"tabloid", 792.0, 1224.0} -}; - -/* PS font names, must be in Roman, Bold, Italic, Bold-Italic order */ -struct prt_ps_font_S -{ - int wx; - int uline_offset; - int uline_width; - int bbox_min_y; - int bbox_max_y; - char *(ps_fontname[4]); -}; - -#define PRT_PS_FONT_ROMAN (0) -#define PRT_PS_FONT_BOLD (1) -#define PRT_PS_FONT_OBLIQUE (2) -#define PRT_PS_FONT_BOLDOBLIQUE (3) - -/* Standard font metrics for Courier family */ -static struct prt_ps_font_S prt_ps_courier_font = -{ - 600, - -100, 50, - -250, 805, - {"Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique"} -}; - -#ifdef FEAT_MBYTE -/* Generic font metrics for multi-byte fonts */ -static struct prt_ps_font_S prt_ps_mb_font = -{ - 1000, - -100, 50, - -250, 805, - {NULL, NULL, NULL, NULL} -}; -#endif - -/* Pointer to current font set being used */ -static struct prt_ps_font_S* prt_ps_font; - -/* Structures to map user named encoding and mapping to PS equivalents for - * building CID font name */ -struct prt_ps_encoding_S -{ - char *encoding; - char *cmap_encoding; - int needs_charset; -}; - -struct prt_ps_charset_S -{ - char *charset; - char *cmap_charset; - int has_charset; -}; - -#ifdef FEAT_MBYTE - -#define CS_JIS_C_1978 (0x01) -#define CS_JIS_X_1983 (0x02) -#define CS_JIS_X_1990 (0x04) -#define CS_NEC (0x08) -#define CS_MSWINDOWS (0x10) -#define CS_CP932 (0x20) -#define CS_KANJITALK6 (0x40) -#define CS_KANJITALK7 (0x80) - -/* Japanese encodings and charsets */ -static struct prt_ps_encoding_S j_encodings[] = -{ - {"iso-2022-jp", NULL, (CS_JIS_C_1978|CS_JIS_X_1983|CS_JIS_X_1990| - CS_NEC)}, - {"euc-jp", "EUC", (CS_JIS_C_1978|CS_JIS_X_1983|CS_JIS_X_1990)}, - {"sjis", "RKSJ", (CS_JIS_C_1978|CS_JIS_X_1983|CS_MSWINDOWS| - CS_KANJITALK6|CS_KANJITALK7)}, - {"cp932", "RKSJ", CS_JIS_X_1983}, - {"ucs-2", "UCS2", CS_JIS_X_1990}, - {"utf-8", "UTF8" , CS_JIS_X_1990} -}; -static struct prt_ps_charset_S j_charsets[] = -{ - {"JIS_C_1978", "78", CS_JIS_C_1978}, - {"JIS_X_1983", NULL, CS_JIS_X_1983}, - {"JIS_X_1990", "Hojo", CS_JIS_X_1990}, - {"NEC", "Ext", CS_NEC}, - {"MSWINDOWS", "90ms", CS_MSWINDOWS}, - {"CP932", "90ms", CS_JIS_X_1983}, - {"KANJITALK6", "83pv", CS_KANJITALK6}, - {"KANJITALK7", "90pv", CS_KANJITALK7} -}; - -#define CS_GB_2312_80 (0x01) -#define CS_GBT_12345_90 (0x02) -#define CS_GBK2K (0x04) -#define CS_SC_MAC (0x08) -#define CS_GBT_90_MAC (0x10) -#define CS_GBK (0x20) -#define CS_SC_ISO10646 (0x40) - -/* Simplified Chinese encodings and charsets */ -static struct prt_ps_encoding_S sc_encodings[] = -{ - {"iso-2022", NULL, (CS_GB_2312_80|CS_GBT_12345_90)}, - {"gb18030", NULL, CS_GBK2K}, - {"euc-cn", "EUC", (CS_GB_2312_80|CS_GBT_12345_90|CS_SC_MAC| - CS_GBT_90_MAC)}, - {"gbk", "EUC", CS_GBK}, - {"ucs-2", "UCS2", CS_SC_ISO10646}, - {"utf-8", "UTF8", CS_SC_ISO10646} -}; -static struct prt_ps_charset_S sc_charsets[] = -{ - {"GB_2312-80", "GB", CS_GB_2312_80}, - {"GBT_12345-90","GBT", CS_GBT_12345_90}, - {"MAC", "GBpc", CS_SC_MAC}, - {"GBT-90_MAC", "GBTpc", CS_GBT_90_MAC}, - {"GBK", "GBK", CS_GBK}, - {"GB18030", "GBK2K", CS_GBK2K}, - {"ISO10646", "UniGB", CS_SC_ISO10646} -}; - -#define CS_CNS_PLANE_1 (0x01) -#define CS_CNS_PLANE_2 (0x02) -#define CS_CNS_PLANE_1_2 (0x04) -#define CS_B5 (0x08) -#define CS_ETEN (0x10) -#define CS_HK_GCCS (0x20) -#define CS_HK_SCS (0x40) -#define CS_HK_SCS_ETEN (0x80) -#define CS_MTHKL (0x100) -#define CS_MTHKS (0x200) -#define CS_DLHKL (0x400) -#define CS_DLHKS (0x800) -#define CS_TC_ISO10646 (0x1000) - -/* Traditional Chinese encodings and charsets */ -static struct prt_ps_encoding_S tc_encodings[] = -{ - {"iso-2022", NULL, (CS_CNS_PLANE_1|CS_CNS_PLANE_2)}, - {"euc-tw", "EUC", CS_CNS_PLANE_1_2}, - {"big5", "B5", (CS_B5|CS_ETEN|CS_HK_GCCS|CS_HK_SCS| - CS_HK_SCS_ETEN|CS_MTHKL|CS_MTHKS|CS_DLHKL| - CS_DLHKS)}, - {"cp950", "B5", CS_B5}, - {"ucs-2", "UCS2", CS_TC_ISO10646}, - {"utf-8", "UTF8", CS_TC_ISO10646}, - {"utf-16", "UTF16", CS_TC_ISO10646}, - {"utf-32", "UTF32", CS_TC_ISO10646} -}; -static struct prt_ps_charset_S tc_charsets[] = -{ - {"CNS_1992_1", "CNS1", CS_CNS_PLANE_1}, - {"CNS_1992_2", "CNS2", CS_CNS_PLANE_2}, - {"CNS_1993", "CNS", CS_CNS_PLANE_1_2}, - {"BIG5", NULL, CS_B5}, - {"CP950", NULL, CS_B5}, - {"ETEN", "ETen", CS_ETEN}, - {"HK_GCCS", "HKgccs", CS_HK_GCCS}, - {"SCS", "HKscs", CS_HK_SCS}, - {"SCS_ETEN", "ETHK", CS_HK_SCS_ETEN}, - {"MTHKL", "HKm471", CS_MTHKL}, - {"MTHKS", "HKm314", CS_MTHKS}, - {"DLHKL", "HKdla", CS_DLHKL}, - {"DLHKS", "HKdlb", CS_DLHKS}, - {"ISO10646", "UniCNS", CS_TC_ISO10646} -}; - -#define CS_KR_X_1992 (0x01) -#define CS_KR_MAC (0x02) -#define CS_KR_X_1992_MS (0x04) -#define CS_KR_ISO10646 (0x08) - -/* Korean encodings and charsets */ -static struct prt_ps_encoding_S k_encodings[] = -{ - {"iso-2022-kr", NULL, CS_KR_X_1992}, - {"euc-kr", "EUC", (CS_KR_X_1992|CS_KR_MAC)}, - {"johab", "Johab", CS_KR_X_1992}, - {"cp1361", "Johab", CS_KR_X_1992}, - {"uhc", "UHC", CS_KR_X_1992_MS}, - {"cp949", "UHC", CS_KR_X_1992_MS}, - {"ucs-2", "UCS2", CS_KR_ISO10646}, - {"utf-8", "UTF8", CS_KR_ISO10646} -}; -static struct prt_ps_charset_S k_charsets[] = -{ - {"KS_X_1992", "KSC", CS_KR_X_1992}, - {"CP1361", "KSC", CS_KR_X_1992}, - {"MAC", "KSCpc", CS_KR_MAC}, - {"MSWINDOWS", "KSCms", CS_KR_X_1992_MS}, - {"CP949", "KSCms", CS_KR_X_1992_MS}, - {"WANSUNG", "KSCms", CS_KR_X_1992_MS}, - {"ISO10646", "UniKS", CS_KR_ISO10646} -}; - -/* Collections of encodings and charsets for multi-byte printing */ -struct prt_ps_mbfont_S -{ - int num_encodings; - struct prt_ps_encoding_S *encodings; - int num_charsets; - struct prt_ps_charset_S *charsets; - char *ascii_enc; - char *defcs; -}; - -static struct prt_ps_mbfont_S prt_ps_mbfonts[] = -{ - { - NUM_ELEMENTS(j_encodings), - j_encodings, - NUM_ELEMENTS(j_charsets), - j_charsets, - "jis_roman", - "JIS_X_1983" - }, - { - NUM_ELEMENTS(sc_encodings), - sc_encodings, - NUM_ELEMENTS(sc_charsets), - sc_charsets, - "gb_roman", - "GB_2312-80" - }, - { - NUM_ELEMENTS(tc_encodings), - tc_encodings, - NUM_ELEMENTS(tc_charsets), - tc_charsets, - "cns_roman", - "BIG5" - }, - { - NUM_ELEMENTS(k_encodings), - k_encodings, - NUM_ELEMENTS(k_charsets), - k_charsets, - "ks_roman", - "KS_X_1992" - } -}; -#endif /* FEAT_MBYTE */ - -struct prt_ps_resource_S -{ - char_u name[64]; - char_u filename[MAXPATHL + 1]; - int type; - char_u title[256]; - char_u version[256]; -}; - -/* Types of PS resource file currently used */ -#define PRT_RESOURCE_TYPE_PROCSET (0) -#define PRT_RESOURCE_TYPE_ENCODING (1) -#define PRT_RESOURCE_TYPE_CMAP (2) - -/* The PS prolog file version number has to match - if the prolog file is - * updated, increment the number in the file and here. Version checking was - * added as of VIM 6.2. - * The CID prolog file version number behaves as per PS prolog. - * Table of VIM and prolog versions: - * - * VIM Prolog CIDProlog - * 6.2 1.3 - * 7.0 1.4 1.0 - */ -#define PRT_PROLOG_VERSION ((char_u *)"1.4") -#define PRT_CID_PROLOG_VERSION ((char_u *)"1.0") - -/* String versions of PS resource types - indexed by constants above so don't - * re-order! - */ -static char *prt_resource_types[] = -{ - "procset", - "encoding", - "cmap" -}; - -/* Strings to look for in a PS resource file */ -#define PRT_RESOURCE_HEADER "%!PS-Adobe-" -#define PRT_RESOURCE_RESOURCE "Resource-" -#define PRT_RESOURCE_PROCSET "ProcSet" -#define PRT_RESOURCE_ENCODING "Encoding" -#define PRT_RESOURCE_CMAP "CMap" - - -/* Data for table based DSC comment recognition, easy to extend if VIM needs to - * read more comments. */ -#define PRT_DSC_MISC_TYPE (-1) -#define PRT_DSC_TITLE_TYPE (1) -#define PRT_DSC_VERSION_TYPE (2) -#define PRT_DSC_ENDCOMMENTS_TYPE (3) - -#define PRT_DSC_TITLE "%%Title:" -#define PRT_DSC_VERSION "%%Version:" -#define PRT_DSC_ENDCOMMENTS "%%EndComments:" - -struct prt_dsc_comment_S -{ - char *string; - int len; - int type; -}; - -struct prt_dsc_line_S -{ - int type; - char_u *string; - int len; -}; - - -#define SIZEOF_CSTR(s) (sizeof(s) - 1) -static struct prt_dsc_comment_S prt_dsc_table[] = -{ - {PRT_DSC_TITLE, SIZEOF_CSTR(PRT_DSC_TITLE), PRT_DSC_TITLE_TYPE}, - {PRT_DSC_VERSION, SIZEOF_CSTR(PRT_DSC_VERSION), - PRT_DSC_VERSION_TYPE}, - {PRT_DSC_ENDCOMMENTS, SIZEOF_CSTR(PRT_DSC_ENDCOMMENTS), - PRT_DSC_ENDCOMMENTS_TYPE} -}; - -static void prt_write_file_raw_len __ARGS((char_u *buffer, int bytes)); -static void prt_write_file __ARGS((char_u *buffer)); -static void prt_write_file_len __ARGS((char_u *buffer, int bytes)); -static void prt_write_string __ARGS((char *s)); -static void prt_write_int __ARGS((int i)); -static void prt_write_boolean __ARGS((int b)); -static void prt_def_font __ARGS((char *new_name, char *encoding, int height, char *font)); -static void prt_real_bits __ARGS((double real, int precision, int *pinteger, int *pfraction)); -static void prt_write_real __ARGS((double val, int prec)); -static void prt_def_var __ARGS((char *name, double value, int prec)); -static void prt_flush_buffer __ARGS((void)); -static void prt_resource_name __ARGS((char_u *filename, void *cookie)); -static int prt_find_resource __ARGS((char *name, struct prt_ps_resource_S *resource)); -static int prt_open_resource __ARGS((struct prt_ps_resource_S *resource)); -static int prt_check_resource __ARGS((struct prt_ps_resource_S *resource, char_u *version)); -static void prt_dsc_start __ARGS((void)); -static void prt_dsc_noarg __ARGS((char *comment)); -static void prt_dsc_textline __ARGS((char *comment, char *text)); -static void prt_dsc_text __ARGS((char *comment, char *text)); -static void prt_dsc_ints __ARGS((char *comment, int count, int *ints)); -static void prt_dsc_requirements __ARGS((int duplex, int tumble, int collate, int color, int num_copies)); -static void prt_dsc_docmedia __ARGS((char *paper_name, double width, double height, double weight, char *colour, char *type)); -static void prt_dsc_resources __ARGS((char *comment, char *type, char *strings)); -static void prt_dsc_font_resource __ARGS((char *resource, struct prt_ps_font_S *ps_font)); -static float to_device_units __ARGS((int idx, double physsize, int def_number)); -static void prt_page_margins __ARGS((double width, double height, double *left, double *right, double *top, double *bottom)); -static void prt_font_metrics __ARGS((int font_scale)); -static int prt_get_cpl __ARGS((void)); -static int prt_get_lpp __ARGS((void)); -static int prt_add_resource __ARGS((struct prt_ps_resource_S *resource)); -static int prt_resfile_next_line __ARGS((void)); -static int prt_resfile_strncmp __ARGS((int offset, char *string, int len)); -static int prt_resfile_skip_nonws __ARGS((int offset)); -static int prt_resfile_skip_ws __ARGS((int offset)); -static int prt_next_dsc __ARGS((struct prt_dsc_line_S *p_dsc_line)); -#ifdef FEAT_MBYTE -static int prt_build_cid_fontname __ARGS((int font, char_u *name, int name_len)); -static void prt_def_cidfont __ARGS((char *new_name, int height, char *cidfont)); -static void prt_dup_cidfont __ARGS((char *original_name, char *new_name)); -static int prt_match_encoding __ARGS((char *p_encoding, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_encoding_S **pp_mbenc)); -static int prt_match_charset __ARGS((char *p_charset, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_charset_S **pp_mbchar)); -#endif - -/* - * Variables for the output PostScript file. - */ -static FILE *prt_ps_fd; -static int prt_file_error; -static char_u *prt_ps_file_name = NULL; - -/* - * Various offsets and dimensions in default PostScript user space (points). - * Used for text positioning calculations - */ -static float prt_page_width; -static float prt_page_height; -static float prt_left_margin; -static float prt_right_margin; -static float prt_top_margin; -static float prt_bottom_margin; -static float prt_line_height; -static float prt_first_line_height; -static float prt_char_width; -static float prt_number_width; -static float prt_bgcol_offset; -static float prt_pos_x_moveto = 0.0; -static float prt_pos_y_moveto = 0.0; - -/* - * Various control variables used to decide when and how to change the - * PostScript graphics state. - */ -static int prt_need_moveto; -static int prt_do_moveto; -static int prt_need_font; -static int prt_font; -static int prt_need_underline; -static int prt_underline; -static int prt_do_underline; -static int prt_need_fgcol; -static int prt_fgcol; -static int prt_need_bgcol; -static int prt_do_bgcol; -static int prt_bgcol; -static int prt_new_bgcol; -static int prt_attribute_change; -static float prt_text_run; -static int prt_page_num; -static int prt_bufsiz; - -/* - * Variables controlling physical printing. - */ -static int prt_media; -static int prt_portrait; -static int prt_num_copies; -static int prt_duplex; -static int prt_tumble; -static int prt_collate; - -/* - * Buffers used when generating PostScript output - */ -static char_u prt_line_buffer[257]; -static garray_T prt_ps_buffer; - -# ifdef FEAT_MBYTE -static int prt_do_conv; -static vimconv_T prt_conv; - -static int prt_out_mbyte; -static int prt_custom_cmap; -static char prt_cmap[80]; -static int prt_use_courier; -static int prt_in_ascii; -static int prt_half_width; -static char *prt_ascii_encoding; -static char_u prt_hexchar[] = "0123456789abcdef"; -# endif -