~ubuntu-branches/ubuntu/precise/puredata/precise

« back to all changes in this revision

Viewing changes to src/t_main.c

  • Committer: Bazaar Package Importer
  • Author(s): Paul Brossier
  • Date: 2009-12-22 21:29:31 UTC
  • mfrom: (1.2.6 upstream) (4.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091222212931-nhwkzapjwsmjao1l
Tags: 0.42.5-3
* debian/control:
  - add community site to homepage field
  - improve long description
  - remove Replaces and Conflicts fields
  - add Suggests on pd-csound, pd-pdp, pd-zexy, pd-aubio
* debian/rules: add per-arch configuration flags
* debian/patches/02_kfreebsd.diff:
  - also define pd_tilde_dllextent on FreeBSD
  - fix typo (really closing #414414 this time)
  - also add hurd glue
* debian/patches/04_hurd.diff:
  - add hurd glue and s_midi_dummy.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 1997-1999 Miller Puckette.
 
2
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
 
3
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
 
4
 
 
5
/* This file should be compared with the corresponding thing in the TK
 
6
* distribution whenever updating to newer versions of TCL/TK. */
 
7
 
 
8
/* 
 
9
 * Copyright (c) 1993 The Regents of the University of California.
 
10
 * Copyright (c) 1994 Sun Microsystems, Inc.
 
11
 *
 
12
 * See the file "license.terms" for information on usage and redistribution
 
13
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
14
 */
 
15
 
 
16
 
 
17
#ifndef __APPLE__     /* linux and IRIX only; in __APPLE__ we don't link this in */
 
18
#include "tk.h"
 
19
#include <stdlib.h>
 
20
 
 
21
/*
 
22
 *----------------------------------------------------------------------
 
23
 *
 
24
 * main --
 
25
 *
 
26
 *      This is the main program for the application.
 
27
 *
 
28
 * Results:
 
29
 *      None: Tk_Main never returns here, so this procedure never
 
30
 *      returns either.
 
31
 *
 
32
 * Side effects:
 
33
 *      Whatever the application does.
 
34
 *
 
35
 *----------------------------------------------------------------------
 
36
 */
 
37
 
 
38
void pdgui_startup(Tcl_Interp *interp);
 
39
void pdgui_setname(char *name);
 
40
void pdgui_setsock(int port);
 
41
void pdgui_sethost(char *name);
 
42
 
 
43
int
 
44
main(int argc, char **argv)
 
45
{
 
46
    pdgui_setname(argv[0]);
 
47
    if (argc >= 2)
 
48
    {
 
49
        pdgui_setsock(atoi(argv[1]));
 
50
        argc--; argv++;
 
51
        argv[0] = "Pd";
 
52
    }
 
53
    if (argc >= 2)
 
54
    {
 
55
        pdgui_sethost(argv[1]);
 
56
        argc--; argv++;
 
57
        argv[0] = "Pd";
 
58
    }
 
59
    Tk_Main(argc, argv, Tcl_AppInit);
 
60
    return 0;                   /* Needed only to prevent compiler warning. */
 
61
}
 
62
 
 
63
 
 
64
/*
 
65
 *----------------------------------------------------------------------
 
66
 *
 
67
 * Tcl_AppInit --
 
68
 *
 
69
 *      This procedure performs application-specific initialization.
 
70
 *      Most applications, especially those that incorporate additional
 
71
 *      packages, will have their own version of this procedure.
 
72
 *
 
73
 * Results:
 
74
 *      Returns a standard Tcl completion code, and leaves an error
 
75
 *      message in interp->result if an error occurs.
 
76
 *
 
77
 * Side effects:
 
78
 *      Depends on the startup script.
 
79
 *
 
80
 *----------------------------------------------------------------------
 
81
 */
 
82
 
 
83
 
 
84
int
 
85
Tcl_AppInit(interp)
 
86
    Tcl_Interp *interp;         /* Interpreter for application. */
 
87
{
 
88
    Tk_Window mainwindow;
 
89
 
 
90
    if (Tcl_Init(interp) == TCL_ERROR) {
 
91
        return TCL_ERROR;
 
92
    }
 
93
    if (Tk_Init(interp) == TCL_ERROR) {
 
94
        return TCL_ERROR;
 
95
    }
 
96
 
 
97
    /* setup specific to pd-gui: */
 
98
 
 
99
    pdgui_startup(interp);
 
100
 
 
101
    /*
 
102
     * Specify a user-specific startup file to invoke if the application
 
103
     * is run interactively.  Typically the startup file is "~/.apprc"
 
104
     * where "app" is the name of the application.  If this line is deleted
 
105
     * then no user-specific startup file will be run under any conditions.
 
106
     */
 
107
 
 
108
#if 0
 
109
    tcl_RcFileName = "~/.apprc";
 
110
#endif
 
111
 
 
112
    return TCL_OK;
 
113
}
 
114
 
 
115
#endif  /* __APPLE__ */