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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [pkgadmin/] [win32/] [PkgAdminTclWaitDlg.cpp] - Blame information for rev 790

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

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

powered by: WebSVN 2.1.0

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