OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [pkgadmin/] [win32/] [PkgAdminTclWaitDlg.cpp] - Blame information for rev 26

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
//####COPYRIGHTBEGIN####
2
//                                                                          
3
// ----------------------------------------------------------------------------
4
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5
//
6
// This program is part of the eCos host tools.
7
//
8
// This program is free software; you can redistribute it and/or modify it 
9
// under the terms of the GNU General Public License as published by the Free 
10
// Software Foundation; either version 2 of the License, or (at your option) 
11
// any later version.
12
// 
13
// This program is distributed in the hope that it will be useful, but WITHOUT 
14
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
15
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
16
// more details.
17
// 
18
// You should have received a copy of the GNU General Public License along with
19
// this program; if not, write to the Free Software Foundation, Inc., 
20
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
//
22
// ----------------------------------------------------------------------------
23
//                                                                          
24
//####COPYRIGHTEND####
25
// PkgAdminTclWaitDlg.cpp : implementation file
26
//
27
 
28
#include "stdafx.h"
29
#include "PkgAdmin.h"
30
#include "PkgAdminTclWaitDlg.h"
31
#include "tcl.h"
32
 
33
#ifdef _DEBUG
34
#define new DEBUG_NEW
35
#undef THIS_FILE
36
static char THIS_FILE[] = __FILE__;
37
#endif
38
 
39
/////////////////////////////////////////////////////////////////////////////
40
// CPkgAdminTclWaitDlg dialog
41
 
42
 
43
CPkgAdminTclWaitDlg::CPkgAdminTclWaitDlg(CWnd* pParent /*=NULL*/)
44
        : CDialog(CPkgAdminTclWaitDlg::IDD, pParent)
45
{
46
        //{{AFX_DATA_INIT(CPkgAdminTclWaitDlg)
47
                // NOTE: the ClassWizard will add member initialization here
48
        //}}AFX_DATA_INIT
49
}
50
 
51
 
52
void CPkgAdminTclWaitDlg::DoDataExchange(CDataExchange* pDX)
53
{
54
        CDialog::DoDataExchange(pDX);
55
        //{{AFX_DATA_MAP(CPkgAdminTclWaitDlg)
56
                // NOTE: the ClassWizard will add DDX and DDV calls here
57
        //}}AFX_DATA_MAP
58
}
59
 
60
 
61
BEGIN_MESSAGE_MAP(CPkgAdminTclWaitDlg, CDialog)
62
        //{{AFX_MSG_MAP(CPkgAdminTclWaitDlg)
63
        ON_WM_CREATE()
64
        //}}AFX_MSG_MAP
65
END_MESSAGE_MAP()
66
 
67
/////////////////////////////////////////////////////////////////////////////
68
// CPkgAdminTclWaitDlg message handlers
69
 
70
// The thread function for executing ecosadmin.tcl
71
UINT CPkgAdminTclWaitDlg::EvalTclThread (LPVOID pvParam)
72
{
73
        // invoke the Tcl command specified in the data structure
74
        EvalTclStruct * pParam = (EvalTclStruct *) pvParam;
75
        Tcl_Interp * interp = Tcl_CreateInterp ();
76
        Tcl_Channel outchan = Tcl_OpenFileChannel (interp, "nul", "a+", 777);
77
        Tcl_SetStdChannel (outchan, TCL_STDOUT); // direct standard output to NUL:
78
        char * pszStatus = Tcl_SetVar (interp, "argv0", pParam->argv0, NULL);
79
        pszStatus = Tcl_SetVar (interp, "argv", pParam->argv, NULL);
80
        pszStatus = Tcl_SetVar (interp, "argc", pParam->argc, NULL);
81
        pszStatus = Tcl_SetVar (interp, "gui_mode", "1", NULL); // return errors in result string
82
        pParam->status = Tcl_EvalFile (interp, pParam->argv0);
83
        pParam->result = Tcl_GetStringResult (interp);
84
        Tcl_SetStdChannel (NULL, TCL_STDOUT);
85
        Tcl_UnregisterChannel (interp, outchan);
86
        Tcl_DeleteInterp (interp);
87
 
88
         // close the wait dialog to signal completion
89
        ::PostMessage (pParam->hwnd, WM_CLOSE, 0, 0);
90
        return 0;
91
}
92
 
93
int CPkgAdminTclWaitDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
94
{
95
        if (CDialog::OnCreate(lpCreateStruct) == -1)
96
                return -1;
97
 
98
        etsInfo.hwnd = m_hWnd; // pass the window handle of the wait dialog into the thread
99
        AfxBeginThread (EvalTclThread, &etsInfo, 0, 0, 0, NULL);
100
        return 0;
101
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.