Added png and embedded graphs to ps and pdf export
This commit is contained in:
parent
2fa0155ca6
commit
e29bfe2c98
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"cmake.debugConfig": {
|
||||
"cwd": "/home/rafmag/.xschem/xschem_library/XSCHEM_HBT",
|
||||
"args": [],
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
project(xschem LANGUAGES C)
|
||||
|
||||
file(GLOB_RECURSE PROJECT_SOURCE_FILES CONFIGURE_DEPENDS src/*.c)
|
||||
list(REMOVE_ITEM PROJECT_SOURCE_FILES /home/rafmag/xschem/src/rawtovcd.c)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${PROJECT_SOURCE_FILES})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src/ /usr/include/cairo /usr/include/tcl8.6)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CMAKE_DL_LIBS} tcl8.6 tk8.6 cairo xcb X11 xcb-render X11-xcb Xpm m jpeg)
|
||||
|
||||
set(EXPAND_LABEL expandlabel)
|
||||
add_custom_target(expandlabel
|
||||
bison -d -o ../src/expandlabel.c ../src/expandlabel.y
|
||||
)
|
||||
set(PARSE_LABEL parselabel)
|
||||
add_custom_target(parselabel
|
||||
flex -l -o ../src/parselabel.c ../src/parselabel.l
|
||||
)
|
||||
add_dependencies(${PROJECT_NAME} ${EXPAND_LABEL} ${PARSE_LABEL})
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
###############################################################
|
||||
# Generated by scconfig - DO NOT EDIT - will be overwritten #
|
||||
# Source: Makefile.conf.in; to regenerate run ./configure #
|
||||
###############################################################
|
||||
|
||||
PREFIX=/usr/local
|
||||
CC=gcc
|
||||
CFLAGS=-pipe -O2 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/tcl8.6
|
||||
LDFLAGS=-lm -lcairo -lX11 -lxcb -lxcb-render -lX11-xcb -lXpm -ltcl8.6 -ltk8.6
|
||||
|
||||
BINDIR=$(DESTDIR)$(install_root)$(PREFIX)/bin
|
||||
SHAREDIR=$(DESTDIR)$(install_root)$(PREFIX)/share
|
||||
DOCDIR=$(DESTDIR)$(install_root)$(PREFIX)/share/doc
|
||||
XSHAREDIR=$(SHAREDIR)/xschem
|
||||
XDOCDIR=$(DOCDIR)/xschem
|
||||
MANDIR=$(SHAREDIR)/man
|
||||
USER_CONF_DIR=~/.xschem
|
||||
SCCBOX=$(ROOT)/scconfig/sccbox
|
||||
|
||||
## specify user schematic/symbol libraries;
|
||||
## you may redefine it later in .xschem or xschemrc startup files
|
||||
user_library_dir=~/.xschem/xschem_library
|
||||
|
||||
## specify system-wide symbol libraries;
|
||||
## you may redefine it later in ~/.xschem/xschemrc or
|
||||
## `pwd`/.xschemrc startup files
|
||||
system_library_dir=$(DESTDIR)$(install_root)/usr/local/share/xschem/xschem_library/devices
|
||||
|
||||
## default search path
|
||||
xschem_library_path=~/.xschem/xschem_library:/usr/local/share/xschem/xschem_library/devices:/usr/local/share/doc/xschem/examples:/usr/local/share/doc/xschem/ngspice:/usr/local/share/doc/xschem/logic:/usr/local/share/doc/xschem/xschem_simulator:/usr/local/share/doc/xschem/generators:/usr/local/share/doc/xschem/binto7seg:/usr/local/share/doc/xschem/pcb:/usr/local/share/doc/xschem/rom8k
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*************************************************************/
|
||||
/* Generated by scconfig - DO NOT EDIT - will be overwritten */
|
||||
/* Source: config.h.in; to regenerate run ./configure */
|
||||
/*************************************************************/
|
||||
|
||||
/* Define this var if cairo is available and is to be used */
|
||||
#define HAS_CAIRO 1
|
||||
|
||||
/* Define this var if Xlib's xcb is available */
|
||||
#define HAS_XCB 1
|
||||
|
||||
/* Define this var if dup2(2) is available */
|
||||
#define HAS_DUP2 1
|
||||
|
||||
/* Define this var if popen(3) is available */
|
||||
#define HAS_POPEN 1
|
||||
|
||||
/* Define this var if popen(3) is not available but fork(2) and pipe(2) are available */
|
||||
/*#undef HAS_PIPE */
|
||||
|
||||
#define PREFIX "/usr/local"
|
||||
#define XSCHEM_LIBRARY_PATH "~/.xschem/xschem_library:/usr/local/share/xschem/xschem_library/devices:/usr/local/share/doc/xschem/examples:/usr/local/share/doc/xschem/ngspice:/usr/local/share/doc/xschem/logic:/usr/local/share/doc/xschem/xschem_simulator:/usr/local/share/doc/xschem/generators:/usr/local/share/doc/xschem/binto7seg:/usr/local/share/doc/xschem/pcb:/usr/local/share/doc/xschem/rom8k"
|
||||
#define USER_CONF_DIR "~/.xschem"
|
||||
#define XSCHEM_SHAREDIR PREFIX "/share/xschem"
|
||||
|
||||
/* Extra includes required by the detected libs (may be empty): */
|
||||
|
||||
#define _XOPEN_SOURCE
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
|
||||
.\" xschem - manual
|
||||
.\" Copyright (C) 2018 Tibor 'Igor2' Palinkas
|
||||
.\"
|
||||
.\" This program is free software; you can redistribute it and/or modify
|
||||
.\" it under the terms of the GNU General Public License as published by
|
||||
.\" the Free Software Foundation; either version 2 of the License, or
|
||||
.\" (at your option) any later version.
|
||||
.\"
|
||||
.\" This program is distributed in the hope that it will be useful,
|
||||
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
.\" GNU General Public License for more details.
|
||||
.\"
|
||||
.\" You should have received a copy of the GNU General Public License along
|
||||
.\" with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
.\"
|
||||
.\" Contact: TODO: an email address
|
||||
.TH xschem 1 2018-01-01 "" "xschem manual"
|
||||
.SH NAME
|
||||
xschem - schematic capture and netlisting EDA tool
|
||||
.SH SYNPOSIS
|
||||
.nf
|
||||
.sp
|
||||
\fBxschem [\fIoptions\fB] [\fIinputfile\fB]
|
||||
.fi
|
||||
.SH DECSRIPTION
|
||||
|
||||
.BR Xschem
|
||||
is a schematic capture program, it allows creation of
|
||||
hierarchical representation of circuits with a top down approach.
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
|
||||
.B -h, --help
|
||||
Print help and exit.
|
||||
.TP
|
||||
|
||||
.B -b, --detach
|
||||
Detach xschem from console.
|
||||
.TP
|
||||
|
||||
.B -n, --netlist
|
||||
Do a netlist of the given schematic cell.
|
||||
.TP
|
||||
|
||||
.B -v, --version
|
||||
Print version information and exit.
|
||||
.TP
|
||||
|
||||
.B -V, --vhdl
|
||||
Set netlist type to VHDL.
|
||||
.TP
|
||||
|
||||
.B -S, --simulate
|
||||
Run a simulation of the current schematc file (spice/Verilog/VHDL, depending on the netlist type chosen).
|
||||
.TP
|
||||
|
||||
.B -w, --verilog
|
||||
Set netlist type to Verilog.
|
||||
.TP
|
||||
|
||||
.B --tcl <tcl_script>
|
||||
Execute specified tcl instructions before any other action, this can be used to change xschemrc variables.
|
||||
.TP
|
||||
|
||||
.B --command <tcl_cmd>
|
||||
Execute specified tcl commands after completing startup.
|
||||
.TP
|
||||
|
||||
.B --script <file>
|
||||
Execute specified tcl file as a command script (perhaps with xschem commands).
|
||||
.TP
|
||||
|
||||
.B --tcp-port <number>
|
||||
Listen to specified tcp port for client connections. (number >=1024).
|
||||
.TP
|
||||
|
||||
.B -i, --no_rcload
|
||||
Do not load any xschemrc file.
|
||||
.TP
|
||||
|
||||
.B -o, --netlist_path
|
||||
Set output for netlist.
|
||||
.TP
|
||||
|
||||
.B -N, --netlist_filename
|
||||
Set name (only name, not path) of top level netlist file.
|
||||
.TP
|
||||
|
||||
.B -t, --tedax
|
||||
Set netlist type to tEDAx.
|
||||
.TP
|
||||
|
||||
.B -s, --spice
|
||||
Set netlist type to SPICE.
|
||||
.TP
|
||||
|
||||
.B -y, --symbol
|
||||
Set netlist type to symbol global property edit.
|
||||
.TP
|
||||
|
||||
.B -x, --no_x
|
||||
Dont use X (only command mode).
|
||||
.TP
|
||||
|
||||
.B -z, --rainbow
|
||||
Use a raibow-looking layer color table.
|
||||
.TP
|
||||
|
||||
.B -W, --waves
|
||||
Show simulation waveforms.
|
||||
.TP
|
||||
|
||||
.B -f, --flat_netlist
|
||||
Set flat netlist (for spice format only).
|
||||
.TP
|
||||
|
||||
.B -r, --no_readline
|
||||
Start without the tclreadline package ( this is necessary if stdin and stdout are to be redirected for example to /dev/null).
|
||||
.TP
|
||||
|
||||
.B -c, --color_ps
|
||||
Set color postscript.
|
||||
.TP
|
||||
|
||||
.B --plotfile <file>
|
||||
Use <file> as output for plot export (png, svg, postscript/pdf)
|
||||
.TP
|
||||
|
||||
.B --rcfile <file>
|
||||
Use <file> as a rc file for startup instead of the default xschemrc.
|
||||
.TP
|
||||
|
||||
.B -p, --postscript, --pdf
|
||||
Export pdf schematic.
|
||||
.TP
|
||||
|
||||
.B --png
|
||||
Export png schematic.
|
||||
.TP
|
||||
|
||||
.B --svg
|
||||
Export svg schematic.
|
||||
.TP
|
||||
|
||||
.B -q, --quit
|
||||
Quit after doing things (no interactive mode).
|
||||
.TP
|
||||
|
||||
.B -l file, --log file
|
||||
Set a log file.
|
||||
.TP
|
||||
|
||||
.B -d n, --debug n
|
||||
Set debug level: 1, 2, 3,...: C program debug, -1, -2, -3...: TCL frontend debug.
|
||||
|
||||
|
||||
.SH FILES
|
||||
|
||||
.TP
|
||||
|
||||
.B /usr/local/share/xschem/xschemrc
|
||||
default configuration.
|
||||
.TP
|
||||
|
||||
.B ~/.xschem/xschemrc
|
||||
user configuration; if exists overrides settings from default configuration;
|
||||
may be partial: settings not overridden will remain as set from the system
|
||||
config.
|
||||
.TP
|
||||
|
||||
.B ./xschemrc
|
||||
local/per-project configuration; if exists overrides settings from
|
||||
the user configuration and default configuration.
|
||||
.TP
|
||||
|
||||
.B /usr/local/share/xschem/systemlib
|
||||
builtin essentials, such as font and missing symbol graphics.
|
||||
.TP
|
||||
|
||||
.B /usr/local/share/xschem/utile
|
||||
TODO.
|
||||
.TP
|
||||
|
|
@ -0,0 +1,237 @@
|
|||
/tmpasm/IFS=" \t\r\n"
|
||||
/runtime/libs/gui/xopendisplay/Lflags=
|
||||
/runtime/cc/cc=gcc
|
||||
/runtime/sys/ext_stalib=.a
|
||||
/runtime/sys/ext_dynlib=.so
|
||||
/runtime/libs/io/dup2/includes=
|
||||
/runtime/libs/gui/cairo-xcb/cflags=-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
|
||||
/runtime/libs/gui/cairo-xcb/presents=true
|
||||
/runtime/parsgen/flex=flex
|
||||
/runtime/sys/system_name=GNU/Linux
|
||||
/runtime/libs/gui/xopendisplay/includes=
|
||||
/runtime/libs/gui/xgetxcbconnection/presents=true
|
||||
/runtime/sys/path_sep_escaped=/
|
||||
/runtime/sys/cross=false
|
||||
/runtime/libs/gui/cairo/cflags=-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
|
||||
/runtime/sys/shell_eats_backslash=true
|
||||
/runtime/sys/ext_exe=
|
||||
/runtime/libs/script/tk/includes=
|
||||
/runtime/libs/io/popen/presents=true
|
||||
/runtime/sys/ext_dynlib_native=.so
|
||||
/runtime/libs/gui/cairo/ldflags=-lcairo
|
||||
/runtime/libs/gui/xcb_render/includes=
|
||||
/runtime/parsgen/flex/presents=true
|
||||
/runtime/parsgen/bison=bison
|
||||
/runtime/libs/gui/cairo/includes=
|
||||
/runtime/sys/uname=Linux MSI 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
|
||||
/runtime/sys/class=UNIX
|
||||
/runtime/cc/cflags= -pipe -O2
|
||||
/runtime/libs/script/tcl/includes=
|
||||
/runtime/libs/gui/xpm/includes=
|
||||
/runtime/libs/gui/xpm/ldflags=-lX11 -lXpm
|
||||
/runtime/libs/gui/cairo-xcb/ldflags=-lcairo
|
||||
/runtime/libs/gui/xcb_render/ldflags=-lX11 -lxcb-render
|
||||
/runtime/libs/io/dup2/presents=true
|
||||
/runtime/sys/shell_needs_quote=true
|
||||
/runtime/libs/gui/xpm/cflags=
|
||||
/runtime/libs/gui/xopendisplay/cflags=
|
||||
/runtime/libs/gui/xopendisplay/presents=true
|
||||
/runtime/fstools/awk=awk
|
||||
/runtime/sys/tmp=/home/rafmag/xschem/scconfig/
|
||||
/runtime/libs/script/tk/presents=true
|
||||
/runtime/sys/machine_name=x86_64
|
||||
/runtime/libs/gui/xcb_render/cflags=
|
||||
/runtime/libs/script/tcl/ldflags=-ltcl8.6
|
||||
/runtime/libs/gui/xcb_render/presents=true
|
||||
/runtime/libs/gui/xcb/includes=
|
||||
/runtime/libs/gui/xcb/ldflags=-lX11 -lxcb
|
||||
/runtime/cc/fpic=-fPIC
|
||||
/runtime/libs/gui/cairo/presents=true
|
||||
/runtime/sys/path_sep=/
|
||||
/runtime/libs/script/tcl/presents=true
|
||||
/runtime/libs/gui/xpm/presents=true
|
||||
/runtime/libs/gui/xcb/cflags=
|
||||
/runtime/libs/gui/cairo-xcb/includes=#include <cairo-xcb.h>\n
|
||||
/runtime/cc/ldflags=
|
||||
/runtime/sys/shell_escape_char=\
|
||||
/runtime/sys/emu=
|
||||
/runtime/libs/gui/xgetxcbconnection/includes=
|
||||
/runtime/libs/gui/xopendisplay/ldflags=-lX11
|
||||
/runtime/libs/script/tk/cflags=-I/usr/include/tcl8.6
|
||||
/runtime/libs/gui/xgetxcbconnection/ldflags=-lX11 -lX11-xcb
|
||||
/runtime/libs/io/popen/includes=#define _XOPEN_SOURCE\n
|
||||
/runtime/libs/io/popen/ldflags=
|
||||
/runtime/sys/name=Linux
|
||||
/runtime/libs/gui/xgetxcbconnection/cflags=
|
||||
/runtime/libs/io/dup2/cflags=
|
||||
/runtime/parsgen/bison/presents=true
|
||||
/runtime/libs/script/tcl/cflags=-I/usr/include/tcl8.6
|
||||
/runtime/sys/cross_blind=false
|
||||
/runtime/libs/io/popen/cflags=
|
||||
/runtime/sys/shell=/bin/sh -c
|
||||
/runtime/libs/io/dup2/ldflags=
|
||||
/runtime/libs/script/tk/ldflags=-ltcl8.6 -ltk8.6
|
||||
/runtime/libs/gui/xcb/presents=true
|
||||
/target/libs/gui/xopendisplay/Lflags=
|
||||
/target/cc/cc=gcc
|
||||
/target/sys/ext_stalib=.a
|
||||
/target/sys/ext_dynlib=.so
|
||||
/target/libs/io/dup2/includes=
|
||||
/target/libs/gui/cairo-xcb/cflags=-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
|
||||
/target/libs/gui/cairo-xcb/presents=true
|
||||
/target/parsgen/flex=flex
|
||||
/target/sys/system_name=GNU/Linux
|
||||
/target/libs/gui/xopendisplay/includes=
|
||||
/target/libs/gui/xgetxcbconnection/presents=true
|
||||
/target/sys/path_sep_escaped=/
|
||||
/target/sys/cross=false
|
||||
/target/libs/gui/cairo/cflags=-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
|
||||
/target/sys/shell_eats_backslash=true
|
||||
/target/sys/ext_exe=
|
||||
/target/libs/script/tk/includes=
|
||||
/target/libs/io/popen/presents=true
|
||||
/target/sys/ext_dynlib_native=.so
|
||||
/target/libs/gui/cairo/ldflags=-lcairo
|
||||
/target/libs/gui/xcb_render/includes=
|
||||
/target/parsgen/flex/presents=true
|
||||
/target/parsgen/bison=bison
|
||||
/target/libs/gui/cairo/includes=
|
||||
/target/sys/uname=Linux MSI 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
|
||||
/target/sys/class=UNIX
|
||||
/target/cc/cflags= -pipe -O2
|
||||
/target/libs/script/tcl/includes=
|
||||
/target/libs/gui/xpm/includes=
|
||||
/target/libs/gui/xpm/ldflags=-lX11 -lXpm
|
||||
/target/libs/gui/cairo-xcb/ldflags=-lcairo
|
||||
/target/libs/gui/xcb_render/ldflags=-lX11 -lxcb-render
|
||||
/target/libs/io/dup2/presents=true
|
||||
/target/sys/shell_needs_quote=true
|
||||
/target/libs/gui/xpm/cflags=
|
||||
/target/libs/gui/xopendisplay/cflags=
|
||||
/target/libs/gui/xopendisplay/presents=true
|
||||
/target/fstools/awk=awk
|
||||
/target/sys/tmp=/home/rafmag/xschem/scconfig/
|
||||
/target/libs/script/tk/presents=true
|
||||
/target/sys/machine_name=x86_64
|
||||
/target/libs/gui/xcb_render/cflags=
|
||||
/target/libs/script/tcl/ldflags=-ltcl8.6
|
||||
/target/libs/gui/xcb_render/presents=true
|
||||
/target/libs/gui/xcb/includes=
|
||||
/target/libs/gui/xcb/ldflags=-lX11 -lxcb
|
||||
/target/cc/fpic=-fPIC
|
||||
/target/libs/gui/cairo/presents=true
|
||||
/target/sys/path_sep=/
|
||||
/target/libs/script/tcl/presents=true
|
||||
/target/libs/gui/xpm/presents=true
|
||||
/target/libs/gui/xcb/cflags=
|
||||
/target/libs/gui/cairo-xcb/includes=#include <cairo-xcb.h>\n
|
||||
/target/cc/ldflags=
|
||||
/target/sys/shell_escape_char=\
|
||||
/target/sys/emu=
|
||||
/target/libs/gui/xgetxcbconnection/includes=
|
||||
/target/libs/gui/xopendisplay/ldflags=-lX11
|
||||
/target/libs/script/tk/cflags=-I/usr/include/tcl8.6
|
||||
/target/libs/gui/xgetxcbconnection/ldflags=-lX11 -lX11-xcb
|
||||
/target/libs/io/popen/includes=#define _XOPEN_SOURCE\n
|
||||
/target/libs/io/popen/ldflags=
|
||||
/target/sys/name=Linux
|
||||
/target/libs/gui/xgetxcbconnection/cflags=
|
||||
/target/libs/io/dup2/cflags=
|
||||
/target/parsgen/bison/presents=true
|
||||
/target/libs/script/tcl/cflags=-I/usr/include/tcl8.6
|
||||
/target/sys/cross_blind=false
|
||||
/target/libs/io/popen/cflags=
|
||||
/target/sys/shell=/bin/sh -c
|
||||
/target/libs/io/dup2/ldflags=
|
||||
/target/libs/script/tk/ldflags=-ltcl8.6 -ltk8.6
|
||||
/target/libs/gui/xcb/presents=true
|
||||
/local/xschem/user-lib-path=~/.xschem/xschem_library
|
||||
/local/global_cflags=-fPIC
|
||||
/local/xschem/profile=false
|
||||
/local/xschem/includes="#define _XOPEN_SOURCE\n"
|
||||
/local/install_shares="\n keys.help xschem.help xschem.tcl break.awk convert_to_verilog2001.awk\n flatten.awk flatten_tedax.awk flatten_savenodes.awk make_sym.awk make_sym_lcc.awk\n symgen.awk order_labels.awk sort_labels.awk spice.awk tedax.awk verilog.awk\n vhdl.awk hspice_backannotate.tcl add_custom_menu.tcl\n add_custom_button.tcl change_index.tcl icon.xpm resources.tcl xschemrc\n ngspice_backannotate.tcl gschemtoxschem.awk traversal.tcl\n"
|
||||
/local/xschem/xschem-lib-path=~/.xschem/xschem_library:/usr/local/share/xschem/xschem_library/devices:/usr/local/share/doc/xschem/examples:/usr/local/share/doc/xschem/ngspice:/usr/local/share/doc/xschem/logic:/usr/local/share/doc/xschem/xschem_simulator:/usr/local/share/doc/xschem/generators:/usr/local/share/doc/xschem/binto7seg:/usr/local/share/doc/xschem/pcb:/usr/local/share/doc/xschem/rom8k
|
||||
/local/xschem/debug=false
|
||||
/local/obj= icon.o callback.o actions.o move.o check.o clip.o draw.o globals.o main.o netlist.o hash_iterator.o findnet.o scheduler.o store.o xinit.o select.o font.o editprop.o save.o paste.o token.o psprint.o node_hash.o hilight.o options.o vhdl_netlist.o svgdraw.o spice_netlist.o tedax_netlist.o verilog_netlist.o parselabel.o expandlabel.o in_memory_undo.o
|
||||
/local/src="\n icon.c callback.c actions.c move.c check.c clip.c draw.c globals.c\n main.c netlist.c hash_iterator.c findnet.c scheduler.c store.c xinit.c\n select.c font.c editprop.c save.c paste.c token.c psprint.c node_hash.c\n hilight.c options.c vhdl_netlist.c svgdraw.c spice_netlist.c\n tedax_netlist.c verilog_netlist.c parselabel.c expandlabel.c\n in_memory_undo.c\n"
|
||||
/local/xschem/ldflags=-lm -lcairo -lX11 -lxcb -lxcb-render -lX11-xcb -lXpm -ltcl8.6 -ltk8.6
|
||||
/local/xschem/sys-lib-path=/usr/local/share/xschem/xschem_library/devices
|
||||
/local/xschem/cflags=-pipe -O2 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/tcl8.6
|
||||
/local/xschem/symbols=false
|
||||
/local/xschem/prefix=/usr/local
|
||||
/local/xschem/user-conf-dir=~/.xschem
|
||||
/local/n=traversal.tcl
|
||||
/local/o=in_memory_undo.o
|
||||
/host/libs/gui/xopendisplay/Lflags=
|
||||
/host/cc/cc=gcc
|
||||
/host/sys/ext_stalib=.a
|
||||
/host/sys/ext_dynlib=.so
|
||||
/host/libs/io/dup2/includes=
|
||||
/host/libs/gui/cairo-xcb/cflags=-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
|
||||
/host/libs/gui/cairo-xcb/presents=true
|
||||
/host/parsgen/flex=flex
|
||||
/host/sys/system_name=GNU/Linux
|
||||
/host/libs/gui/xopendisplay/includes=
|
||||
/host/libs/gui/xgetxcbconnection/presents=true
|
||||
/host/sys/path_sep_escaped=/
|
||||
/host/sys/cross=false
|
||||
/host/libs/gui/cairo/cflags=-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
|
||||
/host/sys/shell_eats_backslash=true
|
||||
/host/sys/ext_exe=
|
||||
/host/libs/script/tk/includes=
|
||||
/host/libs/io/popen/presents=true
|
||||
/host/sys/ext_dynlib_native=.so
|
||||
/host/libs/gui/cairo/ldflags=-lcairo
|
||||
/host/libs/gui/xcb_render/includes=
|
||||
/host/parsgen/flex/presents=true
|
||||
/host/parsgen/bison=bison
|
||||
/host/libs/gui/cairo/includes=
|
||||
/host/sys/uname=Linux MSI 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
|
||||
/host/sys/class=UNIX
|
||||
/host/cc/cflags= -pipe -O2
|
||||
/host/libs/script/tcl/includes=
|
||||
/host/libs/gui/xpm/includes=
|
||||
/host/libs/gui/xpm/ldflags=-lX11 -lXpm
|
||||
/host/libs/gui/cairo-xcb/ldflags=-lcairo
|
||||
/host/libs/gui/xcb_render/ldflags=-lX11 -lxcb-render
|
||||
/host/libs/io/dup2/presents=true
|
||||
/host/sys/shell_needs_quote=true
|
||||
/host/libs/gui/xpm/cflags=
|
||||
/host/libs/gui/xopendisplay/cflags=
|
||||
/host/libs/gui/xopendisplay/presents=true
|
||||
/host/fstools/awk=awk
|
||||
/host/sys/tmp=/home/rafmag/xschem/scconfig/
|
||||
/host/libs/script/tk/presents=true
|
||||
/host/sys/machine_name=x86_64
|
||||
/host/libs/gui/xcb_render/cflags=
|
||||
/host/libs/script/tcl/ldflags=-ltcl8.6
|
||||
/host/libs/gui/xcb_render/presents=true
|
||||
/host/libs/gui/xcb/includes=
|
||||
/host/libs/gui/xcb/ldflags=-lX11 -lxcb
|
||||
/host/cc/fpic=-fPIC
|
||||
/host/libs/gui/cairo/presents=true
|
||||
/host/sys/path_sep=/
|
||||
/host/libs/script/tcl/presents=true
|
||||
/host/libs/gui/xpm/presents=true
|
||||
/host/libs/gui/xcb/cflags=
|
||||
/host/libs/gui/cairo-xcb/includes=#include <cairo-xcb.h>\n
|
||||
/host/cc/ldflags=
|
||||
/host/sys/shell_escape_char=\
|
||||
/host/sys/emu=
|
||||
/host/libs/gui/xgetxcbconnection/includes=
|
||||
/host/libs/gui/xopendisplay/ldflags=-lX11
|
||||
/host/libs/script/tk/cflags=-I/usr/include/tcl8.6
|
||||
/host/libs/gui/xgetxcbconnection/ldflags=-lX11 -lX11-xcb
|
||||
/host/libs/io/popen/includes=#define _XOPEN_SOURCE\n
|
||||
/host/libs/io/popen/ldflags=
|
||||
/host/sys/name=Linux
|
||||
/host/libs/gui/xgetxcbconnection/cflags=
|
||||
/host/libs/io/dup2/cflags=
|
||||
/host/parsgen/bison/presents=true
|
||||
/host/libs/script/tcl/cflags=-I/usr/include/tcl8.6
|
||||
/host/sys/cross_blind=false
|
||||
/host/libs/io/popen/cflags=
|
||||
/host/sys/shell=/bin/sh -c
|
||||
/host/libs/io/dup2/ldflags=
|
||||
/host/libs/script/tk/ldflags=-ltcl8.6 -ltk8.6
|
||||
/host/libs/gui/xcb/presents=true
|
||||
|
|
@ -0,0 +1,321 @@
|
|||
CLI arg 0: './configure'
|
||||
(Required node: 'sys/name')
|
||||
(Required node: 'sys/tmp')
|
||||
(Required node: 'sys/shell')
|
||||
###report### Looking for a shell... finding a shell
|
||||
testing '/bin/sh -c' as shell
|
||||
run: ' /bin/sh -c echo hello >scc_30886 2>>scc_89383.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: '
|
||||
'
|
||||
refused.
|
||||
testing '/bin/sh -c' as shell
|
||||
run: ' /bin/sh -c "echo hello" >scc_36915 2>>scc_92777.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'hello
|
||||
'
|
||||
accepted.
|
||||
###report### /bin/sh -c
|
||||
found a shell '/bin/sh -c', need quote: true
|
||||
###report### Looking for a shell escape character... finding shell escape character...
|
||||
run: ' echo \\\ \{\}\&\;\| >scc_38335 2>>scc_47793.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: '\ {}&;|
|
||||
'
|
||||
###report### found: '\'
|
||||
found shell escape char '\'
|
||||
###report### Detecting temp dir... Finding temp dir (current working directory)...
|
||||
testing if shell eats \...
|
||||
run: ' /bin/sh -c "echo c:\n" >scc_60492 2>>scc_85386.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'c:n
|
||||
'
|
||||
shell eats \...
|
||||
run: ' /bin/sh -c "pwd" >scc_41421 2>>scc_16649.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: '/home/rafmag/xschem/scconfig
|
||||
'
|
||||
cwd is '/home/rafmag/xschem/scconfig/'
|
||||
trying detected temp dir '/home/rafmag/xschem/scconfig/'
|
||||
validating temp dir '/home/rafmag/xschem/scconfig/'
|
||||
temp dir works!
|
||||
###report### validated /home/rafmag/xschem/scconfig/
|
||||
Detected temp dir '/home/rafmag/xschem/scconfig/'
|
||||
Path sep: '/'
|
||||
###report### Checking for system type... [find_uname] checking for sys/name
|
||||
not set, running
|
||||
run: ' /bin/sh -c "uname -a" >/home/rafmag/xschem/scconfig/scc_68690 2>>/home/rafmag/xschem/scconfig/scc_90027.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'Linux MSI 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
|
||||
'
|
||||
run: ' /bin/sh -c "uname -m" >/home/rafmag/xschem/scconfig/scc_97763 2>>/home/rafmag/xschem/scconfig/scc_20059.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'x86_64
|
||||
'
|
||||
run: ' /bin/sh -c "uname -o" >/home/rafmag/xschem/scconfig/scc_80540 2>>/home/rafmag/xschem/scconfig/scc_13926.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'GNU/Linux
|
||||
'
|
||||
###report### OK (name: Linux; class: UNIX)
|
||||
(Required node: 'cc/fpic')
|
||||
(Required node: 'cc/cc')
|
||||
###report### Checking for cc (target)... find_cc: trying to find cc (target)...
|
||||
find_cc: Detecting cc (host)
|
||||
trying cc:try_flags with cc='gcc' cflags='' ldflags=''
|
||||
compile: '/bin/sh -c "gcc /home/rafmag/xschem/scconfig/scc_83426.c -o /home/rafmag/xschem/scconfig/scc_55736 2>&1" >/home/rafmag/xschem/scconfig/scc_89172.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_55736 >/home/rafmag/xschem/scconfig/scc_95368 2>>/home/rafmag/xschem/scconfig/scc_5211.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
find_cc: Detecting -pipe
|
||||
compile: '/bin/sh -c "gcc -pipe /home/rafmag/xschem/scconfig/scc_2567.c -o /home/rafmag/xschem/scconfig/scc_65782 2>&1" >/home/rafmag/xschem/scconfig/scc_56429.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_65782 >/home/rafmag/xschem/scconfig/scc_22862 2>>/home/rafmag/xschem/scconfig/scc_21530.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
find_cc: final test on cc and all flags
|
||||
compile: '/bin/sh -c "gcc -pipe /home/rafmag/xschem/scconfig/scc_65123.c -o /home/rafmag/xschem/scconfig/scc_3135 2>&1" >/home/rafmag/xschem/scconfig/scc_74067.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_3135 >/home/rafmag/xschem/scconfig/scc_79802 2>>/home/rafmag/xschem/scconfig/scc_13929.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('gcc', ' -pipe', '')
|
||||
find_cc: conclusion: cc='gcc' cflags=' -pipe' ldflags=''
|
||||
###report### Checking for -fpic... find_fpic: trying to find -fpic...
|
||||
trying cc:try_flags with cc='gcc' cflags='' ldflags='-fPIC'
|
||||
compile: '/bin/sh -c "gcc -pipe /home/rafmag/xschem/scconfig/scc_34022.c -fPIC -o /home/rafmag/xschem/scconfig/scc_33069 2>&1" >/home/rafmag/xschem/scconfig/scc_23058.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_33069 >/home/rafmag/xschem/scconfig/scc_61393 2>>/home/rafmag/xschem/scconfig/scc_98167.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK (-fPIC)
|
||||
(Required node: 'libs/io/popen/*')
|
||||
###report### Checking for popen(3)... find_io_popen: trying to find popen(3)...
|
||||
trying '#define _XOPEN_SOURCE' and '' and '', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_18456.c -o /home/rafmag/xschem/scconfig/scc_78042 2>&1" >/home/rafmag/xschem/scconfig/scc_75011.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_78042 >/home/rafmag/xschem/scconfig/scc_77373 2>>/home/rafmag/xschem/scconfig/scc_76229.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
|
||||
'
|
||||
###report### OK ('#define _XOPEN_SOURCE\n', '' and '')
|
||||
(Required node: 'libs/io/dup2/*')
|
||||
###report### Checking for dup2(2)... find_io_dup2: trying to find dup2(2)...
|
||||
trying '' and '' and '', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_84421.c -o /home/rafmag/xschem/scconfig/scc_13784 2>&1" >/home/rafmag/xschem/scconfig/scc_44919.out'
|
||||
========= output dump start ============
|
||||
/home/rafmag/xschem/scconfig/scc_84421.c: In function ‘main’:
|
||||
/home/rafmag/xschem/scconfig/scc_84421.c:6:17: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
|
||||
6 | write(4, "OK\n", 3);
|
||||
| ^~~~~~~~~~~~~~~~~~~
|
||||
========= output dump end ==============
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_13784 >/home/rafmag/xschem/scconfig/scc_75198 2>>/home/rafmag/xschem/scconfig/scc_98537.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('', '' and '')
|
||||
(Required node: 'parsgen/flex/presents')
|
||||
###report### Checking for flex... find_flex: trying to find flex...
|
||||
run: ' flex /home/rafmag/xschem/scconfig/scc_94324.lex >/home/rafmag/xschem/scconfig/scc_64370 2>>/home/rafmag/xschem/scconfig/scc_98315.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: ''
|
||||
###report### Found.
|
||||
(Required node: 'parsgen/bison/presents')
|
||||
###report### Checking for bison... find_bison: trying to find bison...
|
||||
run: ' bison /home/rafmag/xschem/scconfig/scc_66413.y >/home/rafmag/xschem/scconfig/scc_76091 2>>/home/rafmag/xschem/scconfig/scc_3526.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: ''
|
||||
###report### Found.
|
||||
(Required node: 'libs/script/tk/*')
|
||||
(Required node: 'libs/gui/xopendisplay/cflags')
|
||||
###report### Checking for XOpenDisplay... find_xopendisplay:
|
||||
trying '' and '' and '-lX11', with no run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_68980.c -lX11 -o /home/rafmag/xschem/scconfig/scc_41873 2>&1" >/home/rafmag/xschem/scconfig/scc_59956.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
###report### OK ('', '' and '-lX11')
|
||||
###report### Checking for tk... find_tk: trying to find tk...
|
||||
###report### 8.6... trying '' and '' and '-ltcl86', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_6862.c -ltcl86 -o /home/rafmag/xschem/scconfig/scc_6996 2>&1" >/home/rafmag/xschem/scconfig/scc_99170.out'
|
||||
========= output dump start ============
|
||||
/home/rafmag/xschem/scconfig/scc_6862.c:3:10: fatal error: tcl.h: No such file or directory
|
||||
3 | #include <tcl.h>
|
||||
| ^~~~~~~
|
||||
compilation terminated.
|
||||
========= output dump end ==============
|
||||
compile result: 256
|
||||
trying '' and '' and '-ltcl8.6', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_97281.c -ltcl8.6 -o /home/rafmag/xschem/scconfig/scc_20925 2>&1" >/home/rafmag/xschem/scconfig/scc_2305.out'
|
||||
========= output dump start ============
|
||||
/home/rafmag/xschem/scconfig/scc_97281.c:3:10: fatal error: tcl.h: No such file or directory
|
||||
3 | #include <tcl.h>
|
||||
| ^~~~~~~
|
||||
compilation terminated.
|
||||
========= output dump end ==============
|
||||
compile result: 256
|
||||
trying '' and '-I/usr/include/tcl86' and '-ltcl86', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 -I/usr/include/tcl86 /home/rafmag/xschem/scconfig/scc_77084.c -ltcl86 -o /home/rafmag/xschem/scconfig/scc_60336 2>&1" >/home/rafmag/xschem/scconfig/scc_36327.out'
|
||||
========= output dump start ============
|
||||
/home/rafmag/xschem/scconfig/scc_77084.c:3:10: fatal error: tcl.h: No such file or directory
|
||||
3 | #include <tcl.h>
|
||||
| ^~~~~~~
|
||||
compilation terminated.
|
||||
========= output dump end ==============
|
||||
compile result: 256
|
||||
trying '' and '-I/usr/include/tcl8.6' and '-ltcl8.6', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 -I/usr/include/tcl8.6 /home/rafmag/xschem/scconfig/scc_26505.c -ltcl8.6 -o /home/rafmag/xschem/scconfig/scc_21729 2>&1" >/home/rafmag/xschem/scconfig/scc_50846.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_21729 >/home/rafmag/xschem/scconfig/scc_25857 2>>/home/rafmag/xschem/scconfig/scc_61313.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('', '-I/usr/include/tcl8.6' and '-ltcl8.6')
|
||||
trying '' and '-I/usr/include/tcl8.6 ' and '-ltcl8.6 -ltk86', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 -I/usr/include/tcl8.6 /home/rafmag/xschem/scconfig/scc_16124.c -ltcl8.6 -ltk86 -o /home/rafmag/xschem/scconfig/scc_19582 2>&1" >/home/rafmag/xschem/scconfig/scc_53895.out'
|
||||
========= output dump start ============
|
||||
/usr/bin/ld: cannot find -ltk86
|
||||
collect2: error: ld returned 1 exit status
|
||||
========= output dump end ==============
|
||||
compile result: 256
|
||||
trying '' and '-I/usr/include/tcl8.6 ' and '-ltcl8.6 -ltk8.6', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 -I/usr/include/tcl8.6 /home/rafmag/xschem/scconfig/scc_545.c -ltcl8.6 -ltk8.6 -o /home/rafmag/xschem/scconfig/scc_33367 2>&1" >/home/rafmag/xschem/scconfig/scc_98814.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_33367 >/home/rafmag/xschem/scconfig/scc_90364 2>>/home/rafmag/xschem/scconfig/scc_15434.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('', '-I/usr/include/tcl8.6 ' and '-ltcl8.6 -ltk8.6')
|
||||
(Required node: 'fstools/awk')
|
||||
###report### Checking for awk... find_fstools_awk: trying to find awk...
|
||||
trying 'awk'
|
||||
run: ' /bin/sh -c "awk -v "t=blobb" -f /home/rafmag/xschem/scconfig/scc_44043.awk" >/home/rafmag/xschem/scconfig/scc_71087 2>>/home/rafmag/xschem/scconfig/scc_13750.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'BloBB
|
||||
'
|
||||
###report### OK (awk)
|
||||
(Required node: 'libs/gui/xpm/*')
|
||||
###report### Checking for xpm... find_xpm:
|
||||
trying '' and '' and '-lX11 -lXpm', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_26808.c -lX11 -lXpm -o /home/rafmag/xschem/scconfig/scc_47178 2>&1" >/home/rafmag/xschem/scconfig/scc_17276.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_47178 >/home/rafmag/xschem/scconfig/scc_93584 2>>/home/rafmag/xschem/scconfig/scc_95788.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('', '' and '-lX11 -lXpm')
|
||||
(Required node: 'libs/gui/cairo/*')
|
||||
###report### Checking for cairo... find_cairo: running pkg-config...
|
||||
run: ' pkg-config --cflags cairo >/home/rafmag/xschem/scconfig/scc_2651 2>>/home/rafmag/xschem/scconfig/scc_5403.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: '-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
|
||||
'
|
||||
run: ' pkg-config --libs cairo >/home/rafmag/xschem/scconfig/scc_12399 2>>/home/rafmag/xschem/scconfig/scc_92754.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: '-lcairo
|
||||
'
|
||||
trying '' and '-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16' and '-lcairo', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 /home/rafmag/xschem/scconfig/scc_99932.c -lcairo -o /home/rafmag/xschem/scconfig/scc_49676 2>&1" >/home/rafmag/xschem/scconfig/scc_95060.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_49676 >/home/rafmag/xschem/scconfig/scc_47739 2>>/home/rafmag/xschem/scconfig/scc_93368.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('', '-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16' and '-lcairo')
|
||||
(Required node: 'libs/gui/cairo-xcb/*')
|
||||
(Required node: 'libs/gui/cairo')
|
||||
###report### Checking for cairo... find_cairo: running pkg-config...
|
||||
run: ' pkg-config --cflags cairo >/home/rafmag/xschem/scconfig/scc_36226 2>>/home/rafmag/xschem/scconfig/scc_10012.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: '-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
|
||||
'
|
||||
run: ' pkg-config --libs cairo >/home/rafmag/xschem/scconfig/scc_48094 2>>/home/rafmag/xschem/scconfig/scc_98586.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: '-lcairo
|
||||
'
|
||||
trying '' and '-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16' and '-lcairo', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 /home/rafmag/xschem/scconfig/scc_97539.c -lcairo -o /home/rafmag/xschem/scconfig/scc_80570 2>&1" >/home/rafmag/xschem/scconfig/scc_40795.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_80570 >/home/rafmag/xschem/scconfig/scc_60378 2>>/home/rafmag/xschem/scconfig/scc_51434.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('', '-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16' and '-lcairo')
|
||||
###report### Checking for cairo-xcb... find_cairo-xcb:
|
||||
trying '#include <cairo-xcb.h>' and '-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16' and '-lcairo', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 /home/rafmag/xschem/scconfig/scc_97467.c -lcairo -o /home/rafmag/xschem/scconfig/scc_10097 2>&1" >/home/rafmag/xschem/scconfig/scc_66601.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_10097 >/home/rafmag/xschem/scconfig/scc_73317 2>>/home/rafmag/xschem/scconfig/scc_12902.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('#include <cairo-xcb.h>\n', '-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16' and '-lcairo')
|
||||
(Required node: 'libs/gui/xcb/*')
|
||||
###report### Checking for xcb... find_xcb:
|
||||
trying '' and '' and '-lX11 -lxcb', with a run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_70492.c -lX11 -lxcb -o /home/rafmag/xschem/scconfig/scc_60756 2>&1" >/home/rafmag/xschem/scconfig/scc_26652.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
run: ' /home/rafmag/xschem/scconfig/scc_60756 >/home/rafmag/xschem/scconfig/scc_60280 2>>/home/rafmag/xschem/scconfig/scc_97301.out'
|
||||
========= empty stderr =================
|
||||
run result: 0
|
||||
stdout: 'OK
|
||||
'
|
||||
###report### OK ('', '' and '-lX11 -lxcb')
|
||||
(Required node: 'libs/gui/xgetxcbconnection/*')
|
||||
###report### Checking for xgetxcbconnection... find_xgetxcbconnection:
|
||||
trying '' and '' and '-lX11 -lX11-xcb', with no run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_24286.c -lX11 -lX11-xcb -o /home/rafmag/xschem/scconfig/scc_53865 2>&1" >/home/rafmag/xschem/scconfig/scc_9441.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
###report### OK ('', '' and '-lX11 -lX11-xcb')
|
||||
(Required node: 'libs/gui/xcb_render/*')
|
||||
###report### Checking for xcb_render... find_xcb_render:
|
||||
trying '' and '' and '-lX11 -lxcb-render', with no run
|
||||
compile: '/bin/sh -c "gcc -pipe -O2 /home/rafmag/xschem/scconfig/scc_29689.c -lX11 -lxcb-render -o /home/rafmag/xschem/scconfig/scc_46619 2>&1" >/home/rafmag/xschem/scconfig/scc_28444.out'
|
||||
========= empty stderr =================
|
||||
compile result: 0
|
||||
###report### OK ('', '' and '-lX11 -lxcb-render')
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,207 @@
|
|||
|
||||
###############################################################
|
||||
# Generated by scconfig - DO NOT EDIT - will be overwritten #
|
||||
# Source: Makefile.in; to regenerate run ./configure #
|
||||
###############################################################
|
||||
|
||||
ROOT = ..
|
||||
OBJ = icon.o callback.o actions.o move.o check.o clip.o draw.o globals.o main.o netlist.o hash_iterator.o findnet.o scheduler.o store.o xinit.o select.o font.o editprop.o save.o paste.o token.o psprint.o node_hash.o hilight.o options.o vhdl_netlist.o svgdraw.o spice_netlist.o tedax_netlist.o verilog_netlist.o parselabel.o expandlabel.o in_memory_undo.o
|
||||
|
||||
all: xschem rawtovcd
|
||||
|
||||
include $(ROOT)/Makefile.conf
|
||||
|
||||
rawtovcd: rawtovcd.o
|
||||
$(CC) -o rawtovcd rawtovcd.o -lm
|
||||
|
||||
xschem: $(OBJ)
|
||||
$(CC) -o xschem $(OBJ) $(LDFLAGS)
|
||||
|
||||
parselabel.c: parselabel.l expandlabel.h
|
||||
flex -l -oparselabel.c parselabel.l
|
||||
|
||||
expandlabel.c expandlabel.h: expandlabel.y
|
||||
bison -d -o expandlabel.c expandlabel.y
|
||||
|
||||
parselabel.o: expandlabel.h
|
||||
|
||||
$(OBJ): xschem.h ../config.h Makefile
|
||||
|
||||
clean: FORCE
|
||||
rm -rf rawtovcd xschem *.o expandlabel.[ch] parselabel.c
|
||||
|
||||
# Explicit rule for each object:
|
||||
|
||||
icon.o: icon.c
|
||||
$(CC) -c $(CFLAGS) -o icon.o icon.c
|
||||
|
||||
callback.o: callback.c
|
||||
$(CC) -c $(CFLAGS) -o callback.o callback.c
|
||||
|
||||
actions.o: actions.c
|
||||
$(CC) -c $(CFLAGS) -o actions.o actions.c
|
||||
|
||||
move.o: move.c
|
||||
$(CC) -c $(CFLAGS) -o move.o move.c
|
||||
|
||||
check.o: check.c
|
||||
$(CC) -c $(CFLAGS) -o check.o check.c
|
||||
|
||||
clip.o: clip.c
|
||||
$(CC) -c $(CFLAGS) -o clip.o clip.c
|
||||
|
||||
draw.o: draw.c
|
||||
$(CC) -c $(CFLAGS) -o draw.o draw.c
|
||||
|
||||
globals.o: globals.c
|
||||
$(CC) -c $(CFLAGS) -o globals.o globals.c
|
||||
|
||||
main.o: main.c
|
||||
$(CC) -c $(CFLAGS) -o main.o main.c
|
||||
|
||||
netlist.o: netlist.c
|
||||
$(CC) -c $(CFLAGS) -o netlist.o netlist.c
|
||||
|
||||
hash_iterator.o: hash_iterator.c
|
||||
$(CC) -c $(CFLAGS) -o hash_iterator.o hash_iterator.c
|
||||
|
||||
findnet.o: findnet.c
|
||||
$(CC) -c $(CFLAGS) -o findnet.o findnet.c
|
||||
|
||||
scheduler.o: scheduler.c
|
||||
$(CC) -c $(CFLAGS) -o scheduler.o scheduler.c
|
||||
|
||||
store.o: store.c
|
||||
$(CC) -c $(CFLAGS) -o store.o store.c
|
||||
|
||||
xinit.o: xinit.c
|
||||
$(CC) -c $(CFLAGS) -o xinit.o xinit.c
|
||||
|
||||
select.o: select.c
|
||||
$(CC) -c $(CFLAGS) -o select.o select.c
|
||||
|
||||
font.o: font.c
|
||||
$(CC) -c $(CFLAGS) -o font.o font.c
|
||||
|
||||
editprop.o: editprop.c
|
||||
$(CC) -c $(CFLAGS) -o editprop.o editprop.c
|
||||
|
||||
save.o: save.c
|
||||
$(CC) -c $(CFLAGS) -o save.o save.c
|
||||
|
||||
paste.o: paste.c
|
||||
$(CC) -c $(CFLAGS) -o paste.o paste.c
|
||||
|
||||
token.o: token.c
|
||||
$(CC) -c $(CFLAGS) -o token.o token.c
|
||||
|
||||
psprint.o: psprint.c
|
||||
$(CC) -c $(CFLAGS) -o psprint.o psprint.c
|
||||
|
||||
node_hash.o: node_hash.c
|
||||
$(CC) -c $(CFLAGS) -o node_hash.o node_hash.c
|
||||
|
||||
hilight.o: hilight.c
|
||||
$(CC) -c $(CFLAGS) -o hilight.o hilight.c
|
||||
|
||||
options.o: options.c
|
||||
$(CC) -c $(CFLAGS) -o options.o options.c
|
||||
|
||||
vhdl_netlist.o: vhdl_netlist.c
|
||||
$(CC) -c $(CFLAGS) -o vhdl_netlist.o vhdl_netlist.c
|
||||
|
||||
svgdraw.o: svgdraw.c
|
||||
$(CC) -c $(CFLAGS) -o svgdraw.o svgdraw.c
|
||||
|
||||
spice_netlist.o: spice_netlist.c
|
||||
$(CC) -c $(CFLAGS) -o spice_netlist.o spice_netlist.c
|
||||
|
||||
tedax_netlist.o: tedax_netlist.c
|
||||
$(CC) -c $(CFLAGS) -o tedax_netlist.o tedax_netlist.c
|
||||
|
||||
verilog_netlist.o: verilog_netlist.c
|
||||
$(CC) -c $(CFLAGS) -o verilog_netlist.o verilog_netlist.c
|
||||
|
||||
parselabel.o: parselabel.c
|
||||
$(CC) -c $(CFLAGS) -o parselabel.o parselabel.c
|
||||
|
||||
expandlabel.o: expandlabel.c
|
||||
$(CC) -c $(CFLAGS) -o expandlabel.o expandlabel.c
|
||||
|
||||
in_memory_undo.o: in_memory_undo.c
|
||||
$(CC) -c $(CFLAGS) -o in_memory_undo.o in_memory_undo.c
|
||||
|
||||
rawtovcd.o: rawtovcd.c
|
||||
$(CC) -c $(CFLAGS) -o rawtovcd.o rawtovcd.c
|
||||
|
||||
|
||||
install: xschem rawtovcd FORCE
|
||||
$(SCCBOX) mkdir -p "$(BINDIR)"
|
||||
$(SCCBOX) mkdir -p "$(XSHAREDIR)"
|
||||
$(SCCBOX) install -f xschem "$(BINDIR)"/xschem
|
||||
$(SCCBOX) install -f rawtovcd "$(BINDIR)"/rawtovcd
|
||||
$(SCCBOX) install -f -d systemlib/* "$(XSHAREDIR)"/systemlib
|
||||
$(SCCBOX) install -f keys.help "$(XSHAREDIR)"/keys.help
|
||||
$(SCCBOX) install -f xschem.help "$(XSHAREDIR)"/xschem.help
|
||||
$(SCCBOX) install -f xschem.tcl "$(XSHAREDIR)"/xschem.tcl
|
||||
$(SCCBOX) install -f break.awk "$(XSHAREDIR)"/break.awk
|
||||
$(SCCBOX) install -f convert_to_verilog2001.awk "$(XSHAREDIR)"/convert_to_verilog2001.awk
|
||||
$(SCCBOX) install -f flatten.awk "$(XSHAREDIR)"/flatten.awk
|
||||
$(SCCBOX) install -f flatten_tedax.awk "$(XSHAREDIR)"/flatten_tedax.awk
|
||||
$(SCCBOX) install -f flatten_savenodes.awk "$(XSHAREDIR)"/flatten_savenodes.awk
|
||||
$(SCCBOX) install -f make_sym.awk "$(XSHAREDIR)"/make_sym.awk
|
||||
$(SCCBOX) install -f make_sym_lcc.awk "$(XSHAREDIR)"/make_sym_lcc.awk
|
||||
$(SCCBOX) install -f symgen.awk "$(XSHAREDIR)"/symgen.awk
|
||||
$(SCCBOX) install -f order_labels.awk "$(XSHAREDIR)"/order_labels.awk
|
||||
$(SCCBOX) install -f sort_labels.awk "$(XSHAREDIR)"/sort_labels.awk
|
||||
$(SCCBOX) install -f spice.awk "$(XSHAREDIR)"/spice.awk
|
||||
$(SCCBOX) install -f tedax.awk "$(XSHAREDIR)"/tedax.awk
|
||||
$(SCCBOX) install -f verilog.awk "$(XSHAREDIR)"/verilog.awk
|
||||
$(SCCBOX) install -f vhdl.awk "$(XSHAREDIR)"/vhdl.awk
|
||||
$(SCCBOX) install -f hspice_backannotate.tcl "$(XSHAREDIR)"/hspice_backannotate.tcl
|
||||
$(SCCBOX) install -f add_custom_menu.tcl "$(XSHAREDIR)"/add_custom_menu.tcl
|
||||
$(SCCBOX) install -f add_custom_button.tcl "$(XSHAREDIR)"/add_custom_button.tcl
|
||||
$(SCCBOX) install -f change_index.tcl "$(XSHAREDIR)"/change_index.tcl
|
||||
$(SCCBOX) install -f icon.xpm "$(XSHAREDIR)"/icon.xpm
|
||||
$(SCCBOX) install -f resources.tcl "$(XSHAREDIR)"/resources.tcl
|
||||
$(SCCBOX) install -f xschemrc "$(XSHAREDIR)"/xschemrc
|
||||
$(SCCBOX) install -f ngspice_backannotate.tcl "$(XSHAREDIR)"/ngspice_backannotate.tcl
|
||||
$(SCCBOX) install -f gschemtoxschem.awk "$(XSHAREDIR)"/gschemtoxschem.awk
|
||||
$(SCCBOX) install -f traversal.tcl "$(XSHAREDIR)"/traversal.tcl
|
||||
|
||||
distclean: clean
|
||||
|
||||
uninstall: FORCE
|
||||
$(SCCBOX) rm "$(BINDIR)"/xschem
|
||||
$(SCCBOX) rm "$(BINDIR)"/rawtovcd
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/systemlib/*
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/keys.help
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/xschem.help
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/xschem.tcl
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/break.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/convert_to_verilog2001.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/flatten.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/flatten_tedax.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/flatten_savenodes.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/make_sym.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/make_sym_lcc.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/symgen.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/order_labels.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/sort_labels.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/spice.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/tedax.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/verilog.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/vhdl.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/hspice_backannotate.tcl
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/add_custom_menu.tcl
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/add_custom_button.tcl
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/change_index.tcl
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/icon.xpm
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/resources.tcl
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/xschemrc
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/ngspice_backannotate.tcl
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/gschemtoxschem.awk
|
||||
$(SCCBOX) rm "$(XSHAREDIR)"/traversal.tcl
|
||||
|
||||
FORCE:
|
||||
|
||||
|
|
@ -0,0 +1,625 @@
|
|||
/* Copyright 2018 Bernhard R. Fischer, 4096R/8E24F29D <bf@abenteuerland.at>
|
||||
*
|
||||
* This file is part of Cairo_JPG.
|
||||
*
|
||||
* Cairo_JPG is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cairo_JPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cairo_JPG. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*! \file cairo_jpg.c
|
||||
* This file contains two functions for reading and writing JPEG files from
|
||||
* and to Cairo image surfaces. It uses the functions from the libjpeg.
|
||||
* Most of the code is directly derived from the online example at
|
||||
* http://libjpeg-turbo.virtualgl.org/Documentation/Documentation
|
||||
*
|
||||
* All prototypes are defined in cairo_jpg.h All functions and their parameters
|
||||
* and return values are described below directly at the functions. You may
|
||||
* also have a look at the preprocessor macros defined below.
|
||||
*
|
||||
* To compile this code you need to have installed the packages libcairo2-dev
|
||||
* and libjpeg-dev. Compile with the following to create an object file to link
|
||||
* with your code:
|
||||
* gcc -std=c99 -Wall -c `pkg-config cairo libjpeg --cflags --libs` cairo_jpg.c
|
||||
* Use the following command to include the main() function and create an
|
||||
* executable for testing of this code:
|
||||
* gcc -std=c99 -Wall -o cairo_jpg -DCAIRO_JPEG_MAIN `pkg-config cairo libjpeg --cflags --libs` cairo_jpg.c
|
||||
*
|
||||
* @author Bernhard R. Fischer, 4096R/8E24F29D bf@abenteuerland.at
|
||||
* @version 2020/01/18
|
||||
* @license LGPL3.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "unistd.h"
|
||||
#include <cairo.h>
|
||||
#include <jpeglib.h>
|
||||
|
||||
#include "cairo_jpg.h"
|
||||
|
||||
/*! Macro to activate main() function. This is only used for testing. Comment
|
||||
* it out (#undef) if you link this file to your own program.
|
||||
*/
|
||||
//#define CAIRO_JPEG_MAIN
|
||||
//
|
||||
/*! Define this to use an alternate implementation of
|
||||
* cairo_image_surface_create_from_jpeg() which fstat(3)s the file before
|
||||
* reading (see below). For huge files this /may/ be slightly faster.
|
||||
*/
|
||||
#undef CAIRO_JPEG_USE_FSTAT
|
||||
|
||||
/*! This is the read block size for the stream reader
|
||||
* cairo_image_surface_create_from_jpeg_stream().
|
||||
*/
|
||||
#ifdef USE_CAIRO_READ_FUNC_LEN_T
|
||||
#define CAIRO_JPEG_IO_BLOCK_SIZE 4096
|
||||
#else
|
||||
/*! Block size has to be one if cairo_read_func_t is in use because of the lack
|
||||
* to detect EOF (truncated reads).
|
||||
*/
|
||||
#define CAIRO_JPEG_IO_BLOCK_SIZE 1
|
||||
/*! In case of original cairo_read_func_t is used fstat() should be used for
|
||||
* performance reasons (see CAIRO_JPEG_USE_FSTAT above).
|
||||
*/
|
||||
#define CAIRO_JPEG_USE_FSTAT
|
||||
#endif
|
||||
|
||||
/*! Define this to test jpeg creation with non-image surfaces. This is only for
|
||||
* testing and is to be used together with CAIRO_JPEG_MAIN.
|
||||
*/
|
||||
#undef CAIRO_JPEG_TEST_SIMILAR
|
||||
#if defined(CAIRO_JPEG_TEST_SIMILAR) && defined(CAIRO_JPEG_MAIN)
|
||||
#include <cairo-pdf.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef LIBJPEG_TURBO_VERSION
|
||||
/*! This function makes a covnersion for "odd" pixel sizes which typically is a
|
||||
* conversion from a 3-byte to a 4-byte (or more) pixel size or vice versa.
|
||||
* The conversion is done from the source buffer src to the destination buffer
|
||||
* dst. The caller MUST ensure that src and dst have the correct memory size.
|
||||
* This is dw * num for dst and sw * num for src. src and dst may point to the
|
||||
* same memory address.
|
||||
* @param dst Pointer to destination buffer.
|
||||
* @param dw Pixel width (in bytes) of pixels in destination buffer, dw >= 3.
|
||||
* @param src Pointer to source buffer.
|
||||
* @param sw Pixel width (in bytes) of pixels in source buffer, sw >= 3.
|
||||
* @param num Number of pixels to convert, num >= 1;
|
||||
*/
|
||||
static void pix_conv(unsigned char *dst, int dw, const unsigned char *src, int sw, int num)
|
||||
{
|
||||
int si, di;
|
||||
|
||||
// safety check
|
||||
if (dw < 3 || sw < 3 || dst == NULL || src == NULL)
|
||||
return;
|
||||
|
||||
num--;
|
||||
for (si = num * sw, di = num * dw; si >= 0; si -= sw, di -= dw)
|
||||
{
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
dst[di + 2] = src[si ];
|
||||
dst[di + 1] = src[si + 1];
|
||||
dst[di + 0] = src[si + 2];
|
||||
#else
|
||||
// FIXME: This is untested, it may be wrong.
|
||||
dst[di - 3] = src[si - 3];
|
||||
dst[di - 2] = src[si - 2];
|
||||
dst[di - 1] = src[si - 1];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*! This function creates a JPEG file in memory from a Cairo image surface.
|
||||
* @param sfc Pointer to a Cairo surface. It should be an image surface of
|
||||
* either CAIRO_FORMAT_ARGB32 or CAIRO_FORMAT_RGB24. Other formats are
|
||||
* converted to CAIRO_FORMAT_RGB24 before compression.
|
||||
* Please note that this may give unexpected results because JPEG does not
|
||||
* support transparency. Thus, default background color is used to replace
|
||||
* transparent regions. The default background color is black if not specified
|
||||
* explicitly. Thus converting e.g. PDF surfaces without having any specific
|
||||
* background color set will apear with black background and not white as you
|
||||
* might expect. In such cases it is suggested to manually convert the surface
|
||||
* to RGB24 before calling this function.
|
||||
* @param data Pointer to a memory pointer. This parameter receives a pointer
|
||||
* to the memory area where the final JPEG data is found in memory. This
|
||||
* function reserves the memory properly and it has to be freed by the caller
|
||||
* with free(3).
|
||||
* @param len Pointer to a variable of type size_t which will receive the final
|
||||
* lenght of the memory buffer.
|
||||
* @param quality Compression quality, 0-100.
|
||||
* @return On success the function returns CAIRO_STATUS_SUCCESS. In case of
|
||||
* error CAIRO_STATUS_INVALID_FORMAT is returned.
|
||||
*/
|
||||
cairo_status_t cairo_image_surface_write_to_jpeg_mem(cairo_surface_t *sfc, unsigned char **data, size_t *len, int quality)
|
||||
{
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
JSAMPROW row_pointer[1];
|
||||
cairo_surface_t *other = NULL;
|
||||
|
||||
// check valid input format (must be IMAGE_SURFACE && (ARGB32 || RGB24))
|
||||
if (cairo_surface_get_type(sfc) != CAIRO_SURFACE_TYPE_IMAGE ||
|
||||
(cairo_image_surface_get_format(sfc) != CAIRO_FORMAT_ARGB32 &&
|
||||
cairo_image_surface_get_format(sfc) != CAIRO_FORMAT_RGB24))
|
||||
{
|
||||
// create a similar surface with a proper format if supplied input format
|
||||
// does not fulfill the requirements
|
||||
double x1, y1, x2, y2;
|
||||
other = sfc;
|
||||
cairo_t *ctx = cairo_create(other);
|
||||
// get extents of original surface
|
||||
cairo_clip_extents(ctx, &x1, &y1, &x2, &y2);
|
||||
cairo_destroy(ctx);
|
||||
|
||||
// create new image surface
|
||||
sfc = cairo_surface_create_similar_image(other, CAIRO_FORMAT_RGB24, x2 - x1, y2 - y1);
|
||||
if (cairo_surface_status(sfc) != CAIRO_STATUS_SUCCESS)
|
||||
return CAIRO_STATUS_INVALID_FORMAT;
|
||||
|
||||
// paint original surface to new surface
|
||||
ctx = cairo_create(sfc);
|
||||
cairo_set_source_surface(ctx, other, 0, 0);
|
||||
cairo_paint(ctx);
|
||||
cairo_destroy(ctx);
|
||||
}
|
||||
|
||||
// finish queued drawing operations
|
||||
cairo_surface_flush(sfc);
|
||||
|
||||
// init jpeg compression structures
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_compress(&cinfo);
|
||||
|
||||
// set compression parameters
|
||||
jpeg_mem_dest(&cinfo, data, len);
|
||||
cinfo.image_width = cairo_image_surface_get_width(sfc);
|
||||
cinfo.image_height = cairo_image_surface_get_height(sfc);
|
||||
#ifdef LIBJPEG_TURBO_VERSION
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
//cinfo.in_color_space = JCS_EXT_BGRX;
|
||||
cinfo.in_color_space = cairo_image_surface_get_format(sfc) == CAIRO_FORMAT_ARGB32 ? JCS_EXT_BGRA : JCS_EXT_BGRX;
|
||||
#else
|
||||
//cinfo.in_color_space = JCS_EXT_XRGB;
|
||||
cinfo.in_color_space = cairo_image_surface_get_format(sfc) == CAIRO_FORMAT_ARGB32 ? JCS_EXT_ARGB : JCS_EXT_XRGB;
|
||||
#endif
|
||||
cinfo.input_components = 4;
|
||||
#else
|
||||
cinfo.in_color_space = JCS_RGB;
|
||||
cinfo.input_components = 3;
|
||||
#endif
|
||||
jpeg_set_defaults(&cinfo);
|
||||
jpeg_set_quality(&cinfo, quality, TRUE);
|
||||
|
||||
// start compressor
|
||||
jpeg_start_compress(&cinfo, TRUE);
|
||||
|
||||
// loop over all lines and compress
|
||||
while (cinfo.next_scanline < cinfo.image_height)
|
||||
{
|
||||
#ifdef LIBJPEG_TURBO_VERSION
|
||||
row_pointer[0] = cairo_image_surface_get_data(sfc) + (cinfo.next_scanline
|
||||
* cairo_image_surface_get_stride(sfc));
|
||||
#else
|
||||
unsigned char* row_buf = malloc(3 * cinfo.image_width);
|
||||
//unsigned char row_buf[3 * cinfo.image_width];
|
||||
pix_conv(row_buf, 3, cairo_image_surface_get_data(sfc) +
|
||||
(cinfo.next_scanline * cairo_image_surface_get_stride(sfc)), 4, cinfo.image_width);
|
||||
row_pointer[0] = row_buf;
|
||||
#endif
|
||||
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
}
|
||||
|
||||
// finalize and close everything
|
||||
jpeg_finish_compress(&cinfo);
|
||||
jpeg_destroy_compress(&cinfo);
|
||||
|
||||
// destroy temporary image surface (if available)
|
||||
if (other != NULL)
|
||||
cairo_surface_destroy(sfc);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*! This is the internal write function which is called by
|
||||
* cairo_image_surface_write_to_jpeg(). It is not exported.
|
||||
*/
|
||||
static cairo_status_t cj_write(void *closure, const unsigned char *data, unsigned int length)
|
||||
{
|
||||
return write((intptr_t) closure, data, length) < length ?
|
||||
CAIRO_STATUS_WRITE_ERROR : CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*! This function writes JPEG file data from a Cairo image surface by using the
|
||||
* user-supplied stream writer function write_func().
|
||||
* @param sfc Pointer to a Cairo *image* surface. Its format must either be
|
||||
* CAIRO_FORMAT_ARGB32 or CAIRO_FORMAT_RGB24. Other formats are not supported
|
||||
* by this function, yet.
|
||||
* @param write_func Function pointer to a function which is actually writing
|
||||
* the data.
|
||||
* @param closure Pointer to user-supplied variable which is directly passed to
|
||||
* write_func().
|
||||
* @param quality Compression quality, 0-100.
|
||||
* @return This function calles cairo_image_surface_write_to_jpeg_mem() and
|
||||
* returns its return value.
|
||||
*/
|
||||
cairo_status_t cairo_image_surface_write_to_jpeg_stream(cairo_surface_t *sfc, cairo_write_func_t write_func, void *closure, int quality)
|
||||
{
|
||||
cairo_status_t e;
|
||||
unsigned char *data = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
// create JPEG data in memory from surface
|
||||
if ((e = cairo_image_surface_write_to_jpeg_mem(sfc, &data, &len, quality)) != CAIRO_STATUS_SUCCESS)
|
||||
return e;
|
||||
|
||||
// write whole memory block with stream function
|
||||
e = write_func(closure, data, len);
|
||||
|
||||
// free JPEG memory again and return the return value
|
||||
free(data);
|
||||
return e;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*! This function creates a JPEG file from a Cairo image surface.
|
||||
* @param sfc Pointer to a Cairo *image* surface. Its format must either be
|
||||
* CAIRO_FORMAT_ARGB32 or CAIRO_FORMAT_RGB24. Other formats are not supported
|
||||
* by this function, yet.
|
||||
* @param filename Pointer to the filename.
|
||||
* @param quality Compression quality, 0-100.
|
||||
* @return In case of success CAIRO_STATUS_SUCCESS is returned. If an error
|
||||
* occured while opening/creating the file CAIRO_STATUS_DEVICE_ERROR is
|
||||
* returned. The error can be tracked down by inspecting errno(3). The function
|
||||
* internally calles cairo_image_surface_write_to_jpeg_stream() and returnes
|
||||
* its return value respectively (see there).
|
||||
*/
|
||||
cairo_status_t cairo_image_surface_write_to_jpeg(cairo_surface_t *sfc, const char *filename, int quality)
|
||||
{
|
||||
cairo_status_t e;
|
||||
int outfile;
|
||||
|
||||
// Open/create new file
|
||||
if ((outfile = open(filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1)
|
||||
return CAIRO_STATUS_DEVICE_ERROR;
|
||||
|
||||
// write surface to file
|
||||
e = cairo_image_surface_write_to_jpeg_stream(sfc, cj_write, (void*)(intptr_t) outfile, quality);
|
||||
|
||||
// close file again and return
|
||||
close(outfile);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! This function decompresses a JPEG image from a memory buffer and creates a
|
||||
* Cairo image surface.
|
||||
* @param data Pointer to JPEG data (i.e. the full contents of a JPEG file read
|
||||
* into this buffer).
|
||||
* @param len Length of buffer in bytes.
|
||||
* @return Returns a pointer to a cairo_surface_t structure. It should be
|
||||
* checked with cairo_surface_status() for errors.
|
||||
*/
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg_mem(void *data, size_t len)
|
||||
{
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
JSAMPROW row_pointer[1];
|
||||
cairo_surface_t *sfc;
|
||||
|
||||
// initialize jpeg decompression structures
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_decompress(&cinfo);
|
||||
jpeg_mem_src(&cinfo, data, len);
|
||||
(void) jpeg_read_header(&cinfo, TRUE);
|
||||
|
||||
#ifdef LIBJPEG_TURBO_VERSION
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
cinfo.out_color_space = JCS_EXT_BGRA;
|
||||
#else
|
||||
cinfo.out_color_space = JCS_EXT_ARGB;
|
||||
#endif
|
||||
#else
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
#endif
|
||||
|
||||
// start decompressor
|
||||
(void) jpeg_start_decompress(&cinfo);
|
||||
|
||||
// create Cairo image surface
|
||||
sfc = cairo_image_surface_create(CAIRO_FORMAT_RGB24, cinfo.output_width, cinfo.output_height);
|
||||
if (cairo_surface_status(sfc) != CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return sfc;
|
||||
}
|
||||
|
||||
// loop over all scanlines and fill Cairo image surface
|
||||
while (cinfo.output_scanline < cinfo.output_height)
|
||||
{
|
||||
unsigned char *row_address = cairo_image_surface_get_data(sfc) +
|
||||
(cinfo.output_scanline * cairo_image_surface_get_stride(sfc));
|
||||
row_pointer[0] = row_address;
|
||||
(void) jpeg_read_scanlines(&cinfo, row_pointer, 1);
|
||||
#ifndef LIBJPEG_TURBO_VERSION
|
||||
pix_conv(row_address, 4, row_address, 3, cinfo.output_width);
|
||||
#endif
|
||||
}
|
||||
|
||||
// finish and close everything
|
||||
cairo_surface_mark_dirty(sfc);
|
||||
(void) jpeg_finish_decompress(&cinfo);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
// set jpeg mime data
|
||||
cairo_surface_set_mime_data(sfc, CAIRO_MIME_TYPE_JPEG, data, len, free, data);
|
||||
|
||||
return sfc;
|
||||
}
|
||||
|
||||
|
||||
/*! This function reads a JPEG image from a stream and creates a Cairo image
|
||||
* surface.
|
||||
* @param read_func Pointer to function which reads data.
|
||||
* @param closure Pointer which is passed to read_func().
|
||||
* @return Returns a pointer to a cairo_surface_t structure. It should be
|
||||
* checked with cairo_surface_status() for errors.
|
||||
* @note If the surface returned is invalid you can use errno(3) to determine
|
||||
* further reasons. Errno is set according to realloc(3). If you
|
||||
* intend to check errno you shall set it to 0 before calling this function
|
||||
* because it modifies errno only in case of an error.
|
||||
*/
|
||||
#ifdef USE_CAIRO_READ_FUNC_LEN_T
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg_stream(cairo_read_func_len_t read_func, void *closure)
|
||||
#else
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg_stream(cairo_read_func_t read_func, void *closure)
|
||||
#endif
|
||||
{
|
||||
cairo_surface_t *sfc;
|
||||
unsigned char *data, *tmp;
|
||||
ssize_t len, rlen;
|
||||
int eof = 0;
|
||||
|
||||
// read all data into memory buffer in blocks of CAIRO_JPEG_IO_BLOCK_SIZE
|
||||
for (len = 0, data = NULL; !eof; len += rlen)
|
||||
{
|
||||
// grow memory buffer and check for error
|
||||
if ((tmp = realloc(data, len + CAIRO_JPEG_IO_BLOCK_SIZE)) == NULL)
|
||||
break;
|
||||
data = tmp;
|
||||
|
||||
// read bytes into buffer and check for error
|
||||
rlen = read_func(closure, data + len, CAIRO_JPEG_IO_BLOCK_SIZE);
|
||||
#ifdef USE_CAIRO_READ_FUNC_LEN_T
|
||||
// check for error
|
||||
if (rlen == -1)
|
||||
break;
|
||||
|
||||
// check if EOF occured
|
||||
if (rlen < CAIRO_JPEG_IO_BLOCK_SIZE)
|
||||
eof++;
|
||||
#else
|
||||
// check for error
|
||||
if (rlen == CAIRO_STATUS_READ_ERROR)
|
||||
eof++;
|
||||
#endif
|
||||
}
|
||||
|
||||
// check for error in read loop
|
||||
if (!eof)
|
||||
{
|
||||
free(data);
|
||||
return cairo_image_surface_create(CAIRO_FORMAT_INVALID, 0, 0);
|
||||
}
|
||||
|
||||
// call jpeg decompression and return surface
|
||||
sfc = cairo_image_surface_create_from_jpeg_mem(data, len);
|
||||
if (cairo_surface_status(sfc) != CAIRO_STATUS_SUCCESS)
|
||||
free(data);
|
||||
|
||||
return sfc;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CAIRO_JPEG_USE_FSTAT
|
||||
/*! This function reads an JPEG image from a file an creates a Cairo image
|
||||
* surface. Internally the filesize is determined with fstat(2) and then the
|
||||
* whole data is read at once.
|
||||
* @param filename Pointer to filename of JPEG file.
|
||||
* @return Returns a pointer to a cairo_surface_t structure. It should be
|
||||
* checked with cairo_surface_status() for errors.
|
||||
* @note If the returned surface is invalid you can use errno to determine
|
||||
* further reasons. Errno is set according to fopen(3) and malloc(3). If you
|
||||
* intend to check errno you shall set it to 0 before calling this function
|
||||
* because it does not modify errno itself.
|
||||
*/
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg(const char *filename)
|
||||
{
|
||||
void *data;
|
||||
int infile;
|
||||
struct stat stat;
|
||||
|
||||
// open input file
|
||||
if ((infile = open(filename, O_RDONLY)) == -1)
|
||||
return cairo_image_surface_create(CAIRO_FORMAT_INVALID, 0, 0);
|
||||
|
||||
// get stat structure for file size
|
||||
if (fstat(infile, &stat) == -1)
|
||||
return cairo_image_surface_create(CAIRO_FORMAT_INVALID, 0, 0);
|
||||
|
||||
// allocate memory
|
||||
if ((data = malloc(stat.st_size)) == NULL)
|
||||
return cairo_image_surface_create(CAIRO_FORMAT_INVALID, 0, 0);
|
||||
|
||||
// read data
|
||||
int s = read(infile, data, stat.st_size);
|
||||
if ( s < stat.st_size)
|
||||
return cairo_image_surface_create(CAIRO_FORMAT_INVALID, 0, 0);
|
||||
|
||||
close(infile);
|
||||
|
||||
return cairo_image_surface_create_from_jpeg_mem(data, stat.st_size);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
/*! This is the read function which is called by
|
||||
* cairo_image_surface_create_from_jpeg_stream() (non-fstat-version below). It
|
||||
* is not exported.
|
||||
*/
|
||||
#ifdef USE_CAIRO_READ_FUNC_LEN_T
|
||||
static ssize_t cj_read(void *closure, unsigned char *data, unsigned int length)
|
||||
{
|
||||
return read((intptr_t) closure, data, length);
|
||||
}
|
||||
#else
|
||||
static cairo_status_t cj_read(void *closure, unsigned char *data, unsigned int length)
|
||||
{
|
||||
return read((intptr_t) closure, data, length) < length ? CAIRO_STATUS_READ_ERROR : CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*! This function reads an JPEG image from a file an creates a Cairo image
|
||||
* surface. Internally the function calls
|
||||
* cairo_image_surface_create_from_jpeg_stream() to actually read the data.
|
||||
* @param filename Pointer to filename of JPEG file.
|
||||
* @return Returns a pointer to a cairo_surface_t structure. It should be
|
||||
* checked with cairo_surface_status() for errors.
|
||||
* @note If the returned surface is invalid you can use errno to determine
|
||||
* further reasons. Errno is set according to fopen(3) and malloc(3). If you
|
||||
* intend to check errno you shall set it to 0 before calling this function
|
||||
* because it does not modify errno itself.
|
||||
*/
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg(const char *filename)
|
||||
{
|
||||
cairo_surface_t *sfc;
|
||||
int infile;
|
||||
|
||||
// open input file
|
||||
if ((infile = open(filename, O_RDONLY)) == -1)
|
||||
return cairo_image_surface_create(CAIRO_FORMAT_INVALID, 0, 0);
|
||||
|
||||
// call stream loading function
|
||||
sfc = cairo_image_surface_create_from_jpeg_stream(cj_read, (void*)(intptr_t) infile);
|
||||
close(infile);
|
||||
|
||||
return sfc;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CAIRO_JPEG_MAIN
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
int strrcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
int off = (int) strlen(s1) - (int) strlen(s2); // typecast size_t to int because size_t typically is unsigned
|
||||
return strcasecmp(s1 + (off < 0 ? 0 : off), s2);
|
||||
}
|
||||
|
||||
/*! Main routine, only for testing. #undef CAIRO_JPEG_MAIN or simply delete
|
||||
* this part if you link this file to your own program.
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
cairo_surface_t *sfc;
|
||||
|
||||
#ifndef CAIRO_JPEG_TEST_SIMILAR
|
||||
if (argc < 3)
|
||||
{
|
||||
fprintf(stderr, "usage: %s <infile> <outfile>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// test input file type and read file
|
||||
if (!strrcasecmp(argv[1], ".png"))
|
||||
{
|
||||
// read PNG file
|
||||
sfc = cairo_image_surface_create_from_png(argv[1]);
|
||||
}
|
||||
else if (!strrcasecmp(argv[1], ".jpg"))
|
||||
{
|
||||
// read JPEG file
|
||||
sfc = cairo_image_surface_create_from_jpeg(argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "source file is neither JPG nor PNG\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// check surface status
|
||||
if (cairo_surface_status(sfc) != CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "error loading image: %s", cairo_status_to_string(cairo_surface_status(sfc)));
|
||||
return 2;
|
||||
}
|
||||
|
||||
// test output file type and write file
|
||||
if (!strrcasecmp(argv[2], ".png"))
|
||||
{
|
||||
// write PNG file
|
||||
cairo_surface_write_to_png(sfc, argv[2]);
|
||||
}
|
||||
else if (!strrcasecmp(argv[2], ".jpg"))
|
||||
{
|
||||
// write JPEG file
|
||||
cairo_image_surface_write_to_jpeg(sfc, argv[2], 90);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "destination file is neither JPG nor PNG\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
cairo_surface_destroy(sfc);
|
||||
|
||||
#else
|
||||
sfc = cairo_pdf_surface_create("xyz.pdf", 595.276, 841.890);
|
||||
|
||||
cairo_t *ctx = cairo_create(sfc);
|
||||
cairo_set_source_rgb(ctx, 1, 1, 1);
|
||||
cairo_paint(ctx);
|
||||
cairo_move_to(ctx, 100, 100);
|
||||
cairo_set_source_rgb(ctx, 1, 0, 0);
|
||||
cairo_set_line_width(ctx, 3);
|
||||
cairo_line_to(ctx, 400, 400);
|
||||
cairo_stroke(ctx);
|
||||
cairo_destroy(ctx);
|
||||
|
||||
cairo_image_surface_write_to_jpeg(sfc, "xyz.jpg", 90);
|
||||
cairo_surface_destroy(sfc);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
HostUrl=https://raw.githubusercontent.com/rahra/cairo_jpg/master/src/cairo_jpg.c
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/* Copyright 2018 Bernhard R. Fischer, 4096R/8E24F29D <bf@abenteuerland.at>
|
||||
*
|
||||
* This file is part of Cairo_JPG.
|
||||
*
|
||||
* Cairo_JPG is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cairo_JPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cairo_JPG. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CAIRO_JPEG_H
|
||||
#define CAIRO_JPEG_H
|
||||
|
||||
/*! \file cairo_jpg.h
|
||||
* This file contains all prototypes for the Cairo-JPEG functions implemented
|
||||
* in cairo_jpg.c. See there for the function documentation.
|
||||
*
|
||||
* @author Bernhard R. Fischer, 4096R/8E24F29D <bf@abenteuerland.at>
|
||||
* @version 2018/12/11
|
||||
* @license LGPL3
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <cairo.h>
|
||||
|
||||
#ifdef USE_CAIRO_READ_FUNC_LEN_T
|
||||
/*! This is the type for the stream read function. Which must be implemented by
|
||||
* the user if cairo_image_surface_create_from_jpeg_stream() is used. Please
|
||||
* note that this prototype is slightly different from cairo_read_func_t which
|
||||
* is used by cairo_image_surface_create_from_png_stream().
|
||||
* This new prototype is defined because the original prototype
|
||||
* cairo_read_func_t does not allow to detect truncated reads. This issue was
|
||||
* discussed on the cairographics mailinglist, see
|
||||
* https://lists.cairographics.org/archives/cairo/2016-March/027298.html
|
||||
* @param closure This parameter is directly passed through by
|
||||
* cairo_image_surface_create_from_jpeg_stream().
|
||||
* @param data Pointer to data buffer which will receive the data.
|
||||
* @param length Size of the data buffer in bytes.
|
||||
* @return This function must return the actually length that was read into the
|
||||
* buffer. This may actually be less than length which indicates an EOF. In
|
||||
* case of any fatal unrecoverable error on the input stream -1 shall be
|
||||
* returned.
|
||||
*/
|
||||
typedef ssize_t (*cairo_read_func_len_t) (void *closure, unsigned char *data, unsigned int length);
|
||||
#endif
|
||||
|
||||
|
||||
cairo_status_t cairo_image_surface_write_to_jpeg_mem(cairo_surface_t *sfc, unsigned char **data, size_t *len, int quality);
|
||||
cairo_status_t cairo_image_surface_write_to_jpeg_stream(cairo_surface_t *sfc, cairo_write_func_t write_func, void *closure, int quality);
|
||||
cairo_status_t cairo_image_surface_write_to_jpeg(cairo_surface_t *sfc, const char *filename, int quality);
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg_mem(void *data, size_t len);
|
||||
#ifdef USE_CAIRO_READ_FUNC_LEN_T
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg_stream(cairo_read_func_len_t read_func, void *closure);
|
||||
#else
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg_stream(cairo_read_func_t read_func, void *closure);
|
||||
#endif
|
||||
cairo_surface_t *cairo_image_surface_create_from_jpeg(const char *filename);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
HostUrl=https://raw.githubusercontent.com/rahra/cairo_jpg/master/src/cairo_jpg.h
|
||||
255
src/psprint.c
255
src/psprint.c
|
|
@ -98,7 +98,242 @@ static Ps_color *ps_colors;
|
|||
static char ps_font_name[80] = "Helvetica"; /* Courier Times Helvetica Symbol */
|
||||
static char ps_font_family[80] = "Helvetica"; /* Courier Times Helvetica Symbol */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char* buffer;
|
||||
size_t pos;
|
||||
size_t size;
|
||||
} png_to_byte_closure_t;
|
||||
|
||||
cairo_status_t png_reader(void* in_closure, unsigned char* out_data, unsigned int length)
|
||||
{
|
||||
png_to_byte_closure_t* closure = (png_to_byte_closure_t*)in_closure;
|
||||
if (!closure->buffer) return CAIRO_STATUS_READ_ERROR;
|
||||
memcpy(out_data, closure->buffer + closure->pos, length);
|
||||
closure->pos += length;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
char* bin2hex(const unsigned char* bin, size_t len)
|
||||
{
|
||||
char* out;
|
||||
size_t i;
|
||||
|
||||
if (bin == NULL || len == 0)
|
||||
return NULL;
|
||||
|
||||
out = malloc(len * 2 + 1);
|
||||
for (i = 0; i < len; i++) {
|
||||
out[i * 2] = "0123456789abcdef"[bin[i] >> 4];
|
||||
out[i * 2 + 1] = "0123456789abcdef"[bin[i] & 0x0F];
|
||||
}
|
||||
out[len * 2] = '\0';
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2)
|
||||
{
|
||||
size_t data_size;
|
||||
png_to_byte_closure_t closure;
|
||||
char* filter = NULL;
|
||||
my_strdup(1484, &filter, get_tok_value(r->prop_ptr, "filter", 0));
|
||||
unsigned char* image_data64_ptr = get_tok_value(r->prop_ptr, "image_data", 0);
|
||||
|
||||
|
||||
if (filter) {
|
||||
size_t filtersize = 0;
|
||||
char* filterdata = NULL;
|
||||
closure.buffer = NULL;
|
||||
filterdata = (char*)base64_decode(image_data64_ptr, strlen(image_data64_ptr), &filtersize);
|
||||
filter_data(filterdata, filtersize, (char**)&closure.buffer, &data_size, filter);
|
||||
my_free(1488, &filterdata);
|
||||
}
|
||||
else {
|
||||
closure.buffer = base64_decode(image_data64_ptr, strlen(image_data64_ptr), &data_size);
|
||||
}
|
||||
closure.pos = 0;
|
||||
closure.size = data_size; /* should not be necessary */
|
||||
cairo_surface_t* surface = cairo_image_surface_create_from_png_stream(png_reader, &closure);
|
||||
|
||||
int png_size_x = cairo_image_surface_get_width(surface);
|
||||
int png_size_y = cairo_image_surface_get_height(surface);
|
||||
|
||||
cairo_surface_flush(surface);
|
||||
unsigned char* png_data = cairo_image_surface_get_data(surface);
|
||||
|
||||
unsigned char* invertImage = get_tok_value(r->prop_ptr, "InvertOnExport", 0);
|
||||
unsigned char BG_r = 0xFF, BG_g = 0xFF, BG_b = 0xFF;
|
||||
for (int i = 0; i < (png_size_x * png_size_y * 4); i += 4)
|
||||
{
|
||||
|
||||
unsigned char png_r = png_data[i + 0];
|
||||
unsigned char png_g = png_data[i + 1];
|
||||
unsigned char png_b = png_data[i + 2];
|
||||
unsigned char png_a = png_data[i + 3];
|
||||
|
||||
if(invertImage[0]=='1')
|
||||
{
|
||||
png_data[i + 0] = (0xFF-png_r) + (unsigned char)((double)BG_r * ((double)(0xFF - png_a)) / ((double)(0xFF)));
|
||||
png_data[i + 1] = (0xFF-png_g) + (unsigned char)((double)BG_g * ((double)(0xFF - png_a)) / ((double)(0xFF)));
|
||||
png_data[i + 2] = (0xFF-png_b) + (unsigned char)((double)BG_b * ((double)(0xFF - png_a)) / ((double)(0xFF)));
|
||||
png_data[i + 3] = 0xFF;
|
||||
}else
|
||||
{
|
||||
png_data[i + 0] = png_r + (unsigned char)((double)BG_r * ((double)(0xFF - png_a)) / ((double)(0xFF)));
|
||||
png_data[i + 1] = png_g + (unsigned char)((double)BG_g * ((double)(0xFF - png_a)) / ((double)(0xFF)));
|
||||
png_data[i + 2] = png_b + (unsigned char)((double)BG_b * ((double)(0xFF - png_a)) / ((double)(0xFF)));
|
||||
png_data[i + 3] = 0xFF;
|
||||
}
|
||||
|
||||
}
|
||||
cairo_surface_mark_dirty(surface);
|
||||
|
||||
cairo_image_surface_write_to_jpeg(surface, "temp.jpg", 100);
|
||||
unsigned char* jpgData;
|
||||
FILE* fp;
|
||||
fp = fopen("temp.jpg", "rb"); /* Open the file for reading */
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
int fileSize = ftell(fp);
|
||||
rewind(fp);
|
||||
jpgData = malloc(fileSize);
|
||||
fread(jpgData, sizeof(jpgData[0]), fileSize, fp);
|
||||
fclose(fp);
|
||||
|
||||
unsigned char* hexEncodedJPG = bin2hex(jpgData, fileSize);
|
||||
|
||||
fprintf(fd, "gsave\n");
|
||||
fprintf(fd, "%g %g translate\n", X_TO_PS(x1), Y_TO_PS(y1));
|
||||
fprintf(fd, "%g %g scale\n", X_TO_PS(x2) - X_TO_PS(x1), Y_TO_PS(y2) - Y_TO_PS(y1));
|
||||
fprintf(fd, "%d\n", png_size_x);
|
||||
fprintf(fd, "%d\n", png_size_y);
|
||||
fprintf(fd, "8\n");
|
||||
fprintf(fd, "[%d 0 0 %d 0 0]\n", png_size_x, png_size_y);
|
||||
fprintf(fd, "(%s)\n", hexEncodedJPG);
|
||||
fprintf(fd, "/ASCIIHexDecode\n");
|
||||
fprintf(fd, "filter\n");
|
||||
fprintf(fd, "0 dict\n");
|
||||
fprintf(fd, "/DCTDecode\n");
|
||||
fprintf(fd, "filter\n");
|
||||
fprintf(fd, "false\n");
|
||||
fprintf(fd, "3\n");
|
||||
fprintf(fd, "colorimage\n");
|
||||
fprintf(fd, "grestore\n");
|
||||
|
||||
free(hexEncodedJPG); free(jpgData);
|
||||
}
|
||||
|
||||
|
||||
void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
|
||||
{
|
||||
#if defined(HAS_CAIRO)
|
||||
char* ptr = NULL;
|
||||
double x1, y1, x2, y2, w, h, rw, rh, scale;
|
||||
char transform[150];
|
||||
png_to_byte_closure_t closure;
|
||||
cairo_surface_t* png_sfc;
|
||||
int save_draw_window, save_draw_grid, rwi, rhi;
|
||||
size_t olength;
|
||||
const double max_size = 2000.0;
|
||||
|
||||
if (!has_x) return;
|
||||
rw = fabs(rx2 - rx1);
|
||||
rh = fabs(ry2 - ry1);
|
||||
scale = 2.0;
|
||||
if (rw > rh && rw > max_size) {
|
||||
scale = max_size / rw;
|
||||
}
|
||||
else if (rh > max_size) {
|
||||
scale = max_size / rh;
|
||||
}
|
||||
rwi = (int)(rw * scale + 1.0);
|
||||
rhi = (int)(rh * scale + 1.0);
|
||||
save_restore_zoom(1);
|
||||
set_viewport_size(rwi, rhi, 1.0);
|
||||
zoom_box(rx1-2, ry1-2, rx2+2, ry2+2, 1.0);
|
||||
resetwin(1, 1, 1, rwi, rhi);
|
||||
save_draw_grid = tclgetboolvar("draw_grid");
|
||||
tclsetvar("draw_grid", "0");
|
||||
save_draw_window = xctx->draw_window;
|
||||
xctx->draw_window = 0;
|
||||
xctx->draw_pixmap = 1;
|
||||
xctx->do_copy_area = 0;
|
||||
int d_c = tclgetboolvar("dark_colorscheme");
|
||||
tclsetboolvar("dark_colorscheme", 0);
|
||||
build_colors(0, 0);
|
||||
draw();
|
||||
#ifdef __unix__
|
||||
png_sfc = cairo_xlib_surface_create(display, xctx->save_pixmap, visual,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height);
|
||||
#else
|
||||
/* pixmap doesn't work on windows
|
||||
Copy from cairo_save_sfc and use cairo
|
||||
to draw in the data points to embed the graph */
|
||||
png_sfc = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xctx->xrect[0].width, xctx->xrect[0].height);
|
||||
cairo_t* ct = cairo_create(png_sfc);
|
||||
cairo_set_source_surface(ct, xctx->cairo_save_sfc, 0, 0);
|
||||
cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint(ct);
|
||||
for (int i = 0; i < xctx->rects[GRIDLAYER]; i++) {
|
||||
xRect* r2 = &xctx->rect[GRIDLAYER][i];
|
||||
if (r2->flags & 1) {
|
||||
setup_graph_data(i, 8, 0, &xctx->graph_struct);
|
||||
draw_graph(i, 8, &xctx->graph_struct, (void*)ct);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
closure.buffer = NULL;
|
||||
closure.size = 0;
|
||||
closure.pos = 0;
|
||||
|
||||
|
||||
cairo_image_surface_write_to_jpeg(png_sfc, "temp.jpg", 100);
|
||||
|
||||
unsigned char* jpgData;
|
||||
FILE* fp;
|
||||
fp = fopen("temp.jpg", "rb");
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
int fileSize = ftell(fp);
|
||||
rewind(fp);
|
||||
jpgData = malloc(fileSize);
|
||||
fread(jpgData, sizeof(jpgData[0]), fileSize, fp);
|
||||
fclose(fp);
|
||||
|
||||
unsigned char* hexEncodedJPG = bin2hex(jpgData, fileSize);
|
||||
|
||||
cairo_surface_destroy(png_sfc);
|
||||
xctx->draw_pixmap = 1;
|
||||
xctx->draw_window = save_draw_window;
|
||||
xctx->do_copy_area = 1;
|
||||
tclsetboolvar("draw_grid", save_draw_grid);
|
||||
save_restore_zoom(0);
|
||||
resetwin(1, 1, 1, 0, 0);
|
||||
change_linewidth(-1.);
|
||||
tclsetboolvar("dark_colorscheme", d_c);
|
||||
build_colors(0, 0);
|
||||
draw();
|
||||
|
||||
fprintf(fd, "gsave\n");
|
||||
fprintf(fd, "%f %f translate\n", X_TO_PS(rx1), Y_TO_PS(ry1));
|
||||
fprintf(fd, "%f %f scale\n", X_TO_PS(rx2) - X_TO_PS(rx1), Y_TO_PS(ry2) - Y_TO_PS(ry1));
|
||||
fprintf(fd, "%d\n", rwi);
|
||||
fprintf(fd, "%d\n", rhi);
|
||||
fprintf(fd, "8\n");
|
||||
fprintf(fd, "[%d 0 0 %d 0 0]\n", rwi, rhi);
|
||||
fprintf(fd, "(%s)\n", hexEncodedJPG);
|
||||
fprintf(fd, "/ASCIIHexDecode\n");
|
||||
fprintf(fd, "filter\n");
|
||||
fprintf(fd, "0 dict\n");
|
||||
fprintf(fd, "/DCTDecode\n");
|
||||
fprintf(fd, "filter\n");
|
||||
fprintf(fd, "false\n");
|
||||
fprintf(fd, "3\n");
|
||||
fprintf(fd, "colorimage\n");
|
||||
fprintf(fd, "grestore\n");
|
||||
|
||||
free(hexEncodedJPG); free(jpgData);
|
||||
#endif
|
||||
}
|
||||
static void set_lw(void)
|
||||
{
|
||||
if(xctx->lw==0.0)
|
||||
|
|
@ -605,6 +840,11 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot,
|
|||
ROTATION(rot, flip, 0.0,0.0,rect.x1,rect.y1,x1,y1);
|
||||
ROTATION(rot, flip, 0.0,0.0,rect.x2,rect.y2,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
if (rect.flags & 1024)//image
|
||||
{
|
||||
ps_drawPNG(&rect, x0 + x1, y0 + y1, x0 + x2, y0 + y2);
|
||||
continue;
|
||||
}
|
||||
ps_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, rect.dash, rect.fill);
|
||||
}
|
||||
if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) ||
|
||||
|
|
@ -682,6 +922,8 @@ static void fill_ps_colors()
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void create_ps(char **psfile, int what)
|
||||
{
|
||||
double dx, dy, scale, scaley;
|
||||
|
|
@ -690,8 +932,8 @@ void create_ps(char **psfile, int what)
|
|||
double margin=10; /* in postscript points, (1/72)". No need to add margin as xschem zoom full already has margins.*/
|
||||
|
||||
/* Legal: 612 792 */
|
||||
double pagex=842;/* a4, in postscript points, (1/72)" */
|
||||
double pagey=595;/* a4, in postscript points, (1/72)" */
|
||||
double pagex=792;/* a4, in postscript points, (1/72)" */
|
||||
double pagey=612;/* a4, in postscript points, (1/72)" */
|
||||
xRect boundbox;
|
||||
int c,i, textlayer;
|
||||
int old_grid;
|
||||
|
|
@ -867,6 +1109,15 @@ void create_ps(char **psfile, int what)
|
|||
ps_filledrect(c, xctx->rect[c][i].x1, xctx->rect[c][i].y1,
|
||||
xctx->rect[c][i].x2, xctx->rect[c][i].y2, xctx->rect[c][i].dash, xctx->rect[c][i].fill);
|
||||
}
|
||||
if (c == GRIDLAYER && (xctx->rect[c][i].flags & 1024)) { /* image */
|
||||
xRect* r = &xctx->rect[c][i];
|
||||
//PNG Code Here
|
||||
ps_drawPNG(r, r->x1, r->y1, r->x2, r->y2);
|
||||
}
|
||||
if (c == GRIDLAYER && (xctx->rect[c][i].flags & 1)) { /* graph */
|
||||
xRect* r = &xctx->rect[c][i];
|
||||
ps_embedded_graph(r, r->x1, r->y1, r->x2, r->y2);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#if HAS_CAIRO==1
|
||||
#define DRAW_ALL_CAIRO 0 /* use cairo for all graphics. Work in progress! */
|
||||
#include <cairo.h>
|
||||
#include "cairo_jpg.h"
|
||||
#ifdef __unix__
|
||||
#include <cairo-xlib.h>
|
||||
#include "cairo-xlib-xrender.h"
|
||||
|
|
|
|||
Loading…
Reference in New Issue