Graphviz  2.29.20120524.0446
tclpkg/gv/gv_tcl_init.c
Go to the documentation of this file.
00001 /* $Id$ $Revision$ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /*************************************************************************
00005  * Copyright (c) 2011 AT&T Intellectual Property 
00006  * All rights reserved. This program and the accompanying materials
00007  * are made available under the terms of the Eclipse Public License v1.0
00008  * which accompanies this distribution, and is available at
00009  * http://www.eclipse.org/legal/epl-v10.html
00010  *
00011  * Contributors: See CVS logs. Details at http://www.graphviz.org/
00012  *************************************************************************/
00013 
00014 #include <tcl.h>
00015 #include "gvc.h"
00016 #include "gvplugin.h"
00017 #include "gvcjob.h"
00018 #include "gvcint.h"
00019 
00020 static size_t gv_string_writer(GVJ_t *job, const char *s, size_t len)
00021 {
00022     Tcl_AppendToObj((Tcl_Obj*)(job->output_file), s, len);
00023     return len;
00024 }
00025 
00026 static size_t gv_channel_writer(GVJ_t *job, const char *s, size_t len)
00027 {
00028     return Tcl_Write((Tcl_Channel)(job->output_file), s, len);
00029 }
00030 
00031 void gv_string_writer_init(GVC_t *gvc)
00032 {
00033     gvc->write_fn = gv_string_writer;
00034 }
00035 
00036 void gv_channel_writer_init(GVC_t *gvc)
00037 {
00038     gvc->write_fn = gv_channel_writer;
00039 }