File: tclplot.c

package info (click to toggle)
magic 8.3.105%2Bds.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 17,128 kB
  • sloc: ansic: 175,615; sh: 7,634; tcl: 4,536; lisp: 2,554; makefile: 946; cpp: 587; python: 389; csh: 148; awk: 140
file content (74 lines) | stat: -rw-r--r-- 1,950 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*--------------------------------------------------------------*/
/* tclplot.c							*/
/*								*/
/*	Allows the "plot" feature to be loaded as a module	*/
/*	under the Tcl/Tk version of magic.  Loading is		*/
/*	automatic upon invoking the "plot" command.		*/
/*--------------------------------------------------------------*/

#ifdef PLOT_AUTO

#include <stdio.h>
#include <string.h>

#include "tcltk/tclmagic.h"
#include "utils/magic.h"
#include "utils/geometry.h"
#include "tiles/tile.h"
#include "utils/hash.h"
#include "database/database.h"
#include "windows/windows.h"
#include "commands/commands.h"
#include "utils/tech.h"
#include "plot/plot.h"
#include "dbwind/dbwind.h"

/* External routines */

extern void CmdPlot();

/*
 * ----------------------------------------------------------------------------
 *
 * Tcl package initialization function
 *
 * ----------------------------------------------------------------------------
 */

int
Tclplot_Init(interp)
    Tcl_Interp *interp;
{
    int n;
    SectionID invplot;

    /* Sanity checks! */
    if (interp == NULL) return TCL_ERROR;
    if (Tcl_PkgRequire(interp, "Tclmagic", MAGIC_VERSION, 0) == NULL)
	return TCL_ERROR;
    if (Tcl_InitStubs(interp, "8.5", 0) == NULL) return TCL_ERROR;

    TxPrintf("Auto-loading PLOT module\n");
    TxFlushOut();

    /* Replace the auto-load function with the ones defined in	*/
    /* this package in the command functions list.		*/

    if (WindReplaceCommand(DBWclientID, "plot", CmdPlot) < 0)
	return TCL_ERROR;

    /* Now we need to do TechAddClient and reload the tech file */

    TechAddClient("plot", PlotTechInit, PlotTechLine, PlotTechFinal,
		(SectionID) 0, (SectionID *) 0, FALSE);

    /* No initialization function to go here */

    invplot = TechSectionGetMask("plot", NULL);
    if (!TechLoad(NULL, invplot)) return TCL_ERROR;

    Tcl_PkgProvide(interp, "Plot", MAGIC_VERSION);
    return TCL_OK;
}

#endif /* PLOT_AUTO */