From 87f94469e917f9fa8e90af35d880daeb7f38ec01 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 17 Mar 2014 11:00:59 +0000 Subject: pdfTeX, XeTeX: Avoid extern decls in C/C++ code, Kpathsea and w2c headers are C++ safe git-svn-id: svn://tug.org/texlive/trunk@33203 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/xetexdir/ChangeLog | 11 ++++ Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp | 6 -- .../texk/web2c/xetexdir/XeTeXFontInst_Mac.cpp | 6 -- Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp | 23 +------- .../source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp | 6 -- .../texk/web2c/xetexdir/XeTeXLayoutInterface.cpp | 10 +--- Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp | 18 +----- Build/source/texk/web2c/xetexdir/XeTeX_web.h | 64 ++++++++++++++++++++++ Build/source/texk/web2c/xetexdir/am/xetex.am | 1 + Build/source/texk/web2c/xetexdir/hz.cpp | 15 +---- Build/source/texk/web2c/xetexdir/pdfimage.cpp | 6 -- 11 files changed, 86 insertions(+), 80 deletions(-) create mode 100644 Build/source/texk/web2c/xetexdir/XeTeX_web.h (limited to 'Build/source/texk/web2c/xetexdir') diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog index eb7657cdf13..ffd761b85d5 100644 --- a/Build/source/texk/web2c/xetexdir/ChangeLog +++ b/Build/source/texk/web2c/xetexdir/ChangeLog @@ -1,3 +1,14 @@ +2014-03-17 Peter Breitenlohner + + * XeTeXFontInst.cpp, XeTeXFontInst_Mac.cpp, XeTeXFontMgr.cpp, + XeTeXFontMgr_FC.cpp, XeTeXLayoutInterface.cpp, XeTeXOTMath.cpp, + hz.cpp, pdfimage.cpp: is now C++ safe. + + * XeTeXFontMgr.cpp, XeTeXLayoutInterface.cpp, XeTeXOTMath.cpp, + hz.cpp: Move extern declarations from the Pascal/WEB side ... + * XeTeX_web.h (new): ... to here. + * am/xetex.am: Add the new file. + 2014-02-08 TANAKA Takuji * XeTeX_ext.h: Display output of Unicode characters diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp index cc8267b91bf..5914d1da892 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp @@ -39,13 +39,7 @@ authorization from the copyright holders. * originally based on PortableFontInstance.cpp from ICU */ -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif #include "XeTeXFontInst.h" #include "XeTeXLayoutInterface.h" diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontInst_Mac.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontInst_Mac.cpp index b79ba144dc7..4f725631f8f 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontInst_Mac.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontInst_Mac.cpp @@ -39,13 +39,7 @@ authorization from the copyright holders. * created by: Jonathan Kew */ -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif #include "XeTeXFontInst_Mac.h" #include "XeTeX_ext.h" diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp index dcc4a2fba46..d5b80fc59a5 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp @@ -1,7 +1,7 @@ /****************************************************************************\ Part of the XeTeX typesetting system Copyright (c) 1994-2008 by SIL International - Copyright (c) 2009-2012 by Jonathan Kew + Copyright (c) 2009-2014 by Jonathan Kew SIL Author(s): Jonathan Kew @@ -30,13 +30,9 @@ use or other dealings in this Software without prior written authorization from the copyright holders. \****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif + +#include "XeTeX_web.h" #ifdef XETEX_MAC #include "XeTeXFontMgr_Mac.h" @@ -47,19 +43,6 @@ extern "C" { #include -extern "C" { -extern Fixed loadedfontdesignsize; -} - -// functions from the Pascal/WEB side -extern "C" { - void zprintnl(int s); - void zprintchar(int c); - void begindiagnostic(); - void zenddiagnostic(int nl); - int gettracingfontsstate(); -}; - // see cpascal.h #define printcstring(STR) \ do { \ diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp index f7253f1faa3..e69d85e4b5f 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp @@ -30,13 +30,7 @@ use or other dealings in this Software without prior written authorization from the copyright holders. \****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif #include "XeTeXFontMgr_FC.h" diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp index c3e3b7d1b5d..6eae6dbe5d6 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp @@ -2,7 +2,7 @@ Part of the XeTeX typesetting system Copyright (c) 1994-2008 by SIL International Copyright (c) 2009-2012 by Jonathan Kew - Copyright (c) 2012, 2013 by Khaled Hosny + Copyright (c) 2012-2014 by Khaled Hosny SIL Author(s): Jonathan Kew @@ -31,13 +31,7 @@ use or other dealings in this Software without prior written authorization from the copyright holders. \****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif #include // We need this first #include @@ -49,6 +43,8 @@ extern "C" { #include #include +#include "XeTeX_web.h" + #include "XeTeXLayoutInterface.h" #include "XeTeXFontInst.h" #ifdef XETEX_MAC diff --git a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp index f66a23c6fe6..551101e4878 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp @@ -2,7 +2,7 @@ Part of the XeTeX typesetting system Copyright (c) 1994-2008 by SIL International Copyright (c) 2009 by Jonathan Kew - Copyright (c) 2012 by Khaled Hosny + Copyright (c) 2012-2014 by Khaled Hosny SIL Author(s): Jonathan Kew @@ -31,31 +31,17 @@ use or other dealings in this Software without prior written authorization from the copyright holders. \****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif #include #include "XeTeXOTMath.h" -#include "XeTeX_ext.h" +#include "XeTeX_web.h" #include "XeTeXLayoutInterface.h" #include "XeTeXFontInst.h" #include "XeTeXswap.h" -typedef void* voidptr; - -extern "C" { - extern voidptr* fontlayoutengine; - extern integer* fontarea; - extern integer* fontsize; -} - static int32_t getCoverage(const Coverage* coverage, GlyphID g) { if (SWAP(coverage->format) == 1) { diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_web.h b/Build/source/texk/web2c/xetexdir/XeTeX_web.h new file mode 100644 index 00000000000..480d2dabe80 --- /dev/null +++ b/Build/source/texk/web2c/xetexdir/XeTeX_web.h @@ -0,0 +1,64 @@ +/****************************************************************************\ + Part of the XeTeX typesetting system + Copyright (c) 1994-2008 by SIL International + Copyright (c) 2009-2012 by Jonathan Kew + Copyright (c) 2010-2014 by Han The Thanh + Copyright (c) 2012-2014 by Khaled Hosny + Copyright (c) 2014 by Peter Breitenlohner + + SIL Author(s): Jonathan Kew + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the copyright holders +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in this Software without prior written +authorization from the copyright holders. +\****************************************************************************/ + +#ifndef __XETEX_WEB_H +#define __XETEX_WEB_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// declarations from the Pascal/WEB side used in C++ code + +extern void zprintnl(int s); +extern void zprintchar(int c); +extern void begindiagnostic(void); +extern void zenddiagnostic(int nl); +extern int gettracingfontsstate(void); +extern void set_cp_code(int, unsigned int, int, int); +extern int get_cp_code(int, unsigned int, int); + +extern Fixed loadedfontdesignsize; +extern void **fontlayoutengine; +extern integer *fontarea; +extern integer *fontsize; + +#ifdef __cplusplus +}; +#endif + +#endif /* __XETEX_WEB_H */ diff --git a/Build/source/texk/web2c/xetexdir/am/xetex.am b/Build/source/texk/web2c/xetexdir/am/xetex.am index 7952fe1c86a..7307db3e3ce 100644 --- a/Build/source/texk/web2c/xetexdir/am/xetex.am +++ b/Build/source/texk/web2c/xetexdir/am/xetex.am @@ -144,6 +144,7 @@ libxetex_a_SOURCES = \ xetexdir/XeTeX_ext.c \ xetexdir/XeTeX_ext.h \ xetexdir/XeTeX_pic.c \ + xetexdir/XeTeX_web.h \ xetexdir/XeTeXswap.h \ xetexdir/trans.c \ xetexdir/trans.h \ diff --git a/Build/source/texk/web2c/xetexdir/hz.cpp b/Build/source/texk/web2c/xetexdir/hz.cpp index 927bb3cdf10..113a03f7a28 100644 --- a/Build/source/texk/web2c/xetexdir/hz.cpp +++ b/Build/source/texk/web2c/xetexdir/hz.cpp @@ -1,6 +1,6 @@ /****************************************************************************\ Part of the XeTeX typesetting system - Copyright (c) 2010-2012 by Han The Thanh + Copyright (c) 2010-2014 by Han The Thanh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -27,15 +27,9 @@ use or other dealings in this Software without prior written authorization from the copyright holders. \****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif -#include "XeTeX_ext.h" +#include "XeTeX_web.h" #include #include @@ -46,8 +40,6 @@ typedef pair GlyphId; typedef map ProtrusionFactor; ProtrusionFactor leftProt, rightProt; -extern "C" { - void set_cp_code(int fontNum, unsigned int code, int side, int value) { GlyphId id(fontNum, code); @@ -83,6 +75,3 @@ int get_cp_code(int fontNum, unsigned int code, int side) return it->second; } -} - - diff --git a/Build/source/texk/web2c/xetexdir/pdfimage.cpp b/Build/source/texk/web2c/xetexdir/pdfimage.cpp index a9ccbd02e77..8538913692c 100644 --- a/Build/source/texk/web2c/xetexdir/pdfimage.cpp +++ b/Build/source/texk/web2c/xetexdir/pdfimage.cpp @@ -30,13 +30,7 @@ use or other dealings in this Software without prior written authorization from the copyright holders. \****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif #include "XeTeX_ext.h" -- cgit v1.2.3