Ejemplo n.º 1
0
void qq_recvmsg_free(QQRecvMsg *msg)
{
    if(msg == NULL){
        return;
    }

#define FREE_STR(x) g_string_free(msg -> x, TRUE)
    FREE_STR(msg_id);
    FREE_STR(msg_id2);
    FREE_STR(from_uin);
    FREE_STR(to_uin);
    FREE_STR(reply_ip);
    FREE_STR(group_code);
    FREE_STR(send_uin);
    FREE_STR(time);
    FREE_STR(raw_content);
#undef FREE_STR

    guint i;
    for(i = 0; i < msg -> contents -> len; ++i){
        qq_msgcontent_free(
                (QQMsgContent*)g_ptr_array_index(msg -> contents, i));
    }
    g_slice_free(QQRecvMsg, msg);
}
Ejemplo n.º 2
0
void qq_sendmsg_free(QQSendMsg *msg)
{
    if(msg == NULL){
        return;
    }
#define FREE_STR(x) g_string_free(msg -> x, TRUE)
    FREE_STR(to_uin);
    FREE_STR(face);
    FREE_STR(msg_id);
    FREE_STR(clientid);
    FREE_STR(psessionid);
#undef FREE_STR
    guint i;
    for(i = 0; i < msg -> contents -> len; ++i){
        qq_msgcontent_free(
                (QQMsgContent*)g_ptr_array_index(msg -> contents, i));
    }
    g_slice_free(QQSendMsg, msg);
}
Ejemplo n.º 3
0
Archivo: bas1.c Proyecto: LGTMCU/f32c
int
main(int argc, char **argv)
{
	int i = 0;
	int fp;

#ifdef f32c
	setup_f32c();
	maxfiles = MAXFILES;
#else
	catchsignal();
#endif
	startfp();              /* start up the floating point hardware */

	setup_fb();		/* video framebuffer */
#ifndef f32c
	setupfiles(argc,argv);
	setupmyterm();		/* set up files after processing files */
#endif
	program = 0;
	clear();
	prints("Rabbit BASIC version 2.1.3 (built " __DATE__ ")\n");
	if(setexit() == ERR_RESET){
		drop_fns();
		execute();	/* execute the line */
	}
	drop_fns();
	docont();
	stocurlin=0;            /* say we are in immeadiate mode */
	if(cursor)              /* put cursor on a blank line */
		prints( (char *)nl);
	
	if (firstrun && (
#ifdef f32c
	    (fp = open("d:autoexec.bas",0)) > 0 ||
#endif
	    (fp = open("autoexec.bas",0)) > 0)) {
		firstrun = 0;
		readfi(fp, 0, 0);
		close(fp);
        	clear();
        	if (program) {
        		stocurlin=program;
        		point= program->lin;
        		elsecount=0;
        		execute();
		}
	}
	firstrun = 0;

	prints("Ready\n");

	for(;;){
		do{
			trapped=0;
			line[0] = '>';
			line[1] = 0;
			VOID edit( (ival)1, (ival)1, (ival)0);
		}while( trapped || ( !(i=compile(1, nline, 0)) && !linenumber));
		if(!linenumber)
			break;
		insert(i);
	}
	if(inserted){
		inserted=0;
		clear();
		closeall();
	}

#ifdef MSDOS
	lcount = 0;
#endif
	clr_stack(bstack);	/* reset the gosub stack */
	bstack = estack = 0;
	if(str_used)		/* free any spare strings */
		FREE_STR(str_used);

	trap_env.e_stolin = 0;	/* disable error traps */
	intrap=0;               /* say we are not in the error trap */
	trapped=0;              /* say we haven't got a cntrl-c */
	cursor=0;               /* cursor is at start of line */
	elsecount=0;            /* disallow elses as terminators */
	point=nline;            /* start executing at start of input line */
	stocurlin=0;            /* start of current line is null- see 'next' */
	execute();              /* execute the line */
	return(-1);             /* see note below */
}
Ejemplo n.º 4
0
void qq_group_free(QQGroup *grp)
{
    if(grp == NULL){
        return;
    }

#define FREE_STR(x)    g_string_free(grp -> x, TRUE)
    FREE_STR(name);
    FREE_STR(gid);
    FREE_STR(gnumber);
    FREE_STR(createtime);
    FREE_STR(code);
    FREE_STR(flag);
    FREE_STR(owner);
    FREE_STR(mark);
    FREE_STR(mask);
    FREE_STR(memo);
    FREE_STR(fingermemo);
    FREE_STR(option);
    FREE_STR(face);
    FREE_STR(gclass);
    FREE_STR(level);
#undef FREE_STR

    gint i;
    for(i = 0; i < grp -> members -> len; ++i){
        qq_gmember_free((QQGMember*)(grp -> members -> pdata[i]));
    }
    g_ptr_array_free(grp -> members, TRUE);

    g_slice_free(QQGroup, grp);
}
Ejemplo n.º 5
0
void qq_buddy_free(QQBuddy *bd)
{
    if(bd == NULL){
        return;
    }

#define FREE_STR(x) g_string_free(bd -> x, TRUE)
    FREE_STR(uin);
    FREE_STR(qqnumber);
    FREE_STR(status);
    FREE_STR(nick);
    FREE_STR(markname);
    FREE_STR(country);
    FREE_STR(city);
    FREE_STR(province);
    FREE_STR(gender);
    FREE_STR(face);
    FREE_STR(flag);
    FREE_STR(phone);
    FREE_STR(mobile);
    FREE_STR(email);
    FREE_STR(college);
    FREE_STR(occupation);
    FREE_STR(personal);
    FREE_STR(homepage);
    FREE_STR(lnick);
#undef FREE_STR

    g_slice_free(QQBuddy, bd);
}
Ejemplo n.º 6
0
void qq_info_free(QQInfo *info)
{
    if(info == NULL){
        return;
    }
    
    qq_buddy_free(info -> me);
#define FREE_STR(x) if(info -> x != NULL){g_string_free(info -> x, TRUE);}
    FREE_STR(vc_type);
    FREE_STR(vc_image_data);
    FREE_STR(vc_image_type);
    FREE_STR(verify_code);
    FREE_STR(ptvfsession);
    FREE_STR(version);
    FREE_STR(ptuserinfo);
    FREE_STR(ptwebqq);
    FREE_STR(ptcz);
    FREE_STR(skey);
    FREE_STR(cookie);
    FREE_STR(clientid);
    FREE_STR(seskey);
    FREE_STR(cip);
    FREE_STR(index);
    FREE_STR(port);
    FREE_STR(psessionid);
    FREE_STR(vfwebqq);
#undef FREE_STR

    gint i;
    for(i = 0; i < info -> buddies -> len; ++i){
        qq_buddy_free(info -> buddies -> pdata[i]);
    }
    g_ptr_array_free(info -> buddies, TRUE);

    for(i = 0; i < info -> groups -> len; ++i){
        qq_group_free(info -> groups -> pdata[i]);
    }
    g_ptr_array_free(info -> groups, TRUE);

    for(i = 0; i < info -> recentcons -> len; ++i){
        qq_recentcon_free(info -> recentcons -> pdata[i]);
    }
    g_ptr_array_free(info -> recentcons, TRUE);

    for(i = 0; i < info -> categories -> len; ++i){
        qq_category_free(info -> categories -> pdata[i]);
    }
    g_ptr_array_free(info -> categories, TRUE);


    g_hash_table_unref(info -> buddies_ht);
    g_hash_table_unref(info -> groups_ht);
    g_hash_table_unref(info -> buddies_number_ht);
    g_hash_table_unref(info -> groups_number_ht);

    g_mutex_free(info -> lock);
    g_slice_free(QQInfo, info);
}
Ejemplo n.º 7
0
INT_PTR
CALLBACK
DlgProc_TransportLayer(
    HWND hwndDlg,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam
    )
/*++
Routine Description:
    This routine contains the window procedure for transport dll selection
    dialog

    Editing of transport layers is not allowed when doing kernel debugging or
    the debugging of kernel and user mode dumps.

Arguments:
Return Value:
    See docs for "DialogBox"
--*/
{
    // fKernelDebugger cover kernel and kernel dumps
    BOOL bTL_EditingAllowed = !g_contWorkspace_WkSp.m_bKernelDebugger &&
                              !g_contWorkspace_WkSp.m_bUserCrashDump;

    static DWORD HelpArray[]=
    {
       IDC_LIST1, IDH_TRANSPORT,
       IDC_STEXT_SELECT, IDH_TLSELECT,
       IDC_BUT_SELECT, IDH_TLSELECT,
       IDC_BUT_ADD, IDH_TLADD,
       IDC_BUT_EDIT, IDH_TLEDIT,
       IDC_BUT_DELETE, IDH_TLDEL,
       0, 0
    };

    static DWORD NOEDIT_HelpArray[]=
    {
       IDC_LIST1, IDH_TRANSPORT_DISABLED,
       IDC_STEXT_SELECT, IDH_TRANSPORT_DISABLED,
       IDC_BUT_SELECT, IDH_TRANSPORT_DISABLED,
       IDC_BUT_ADD, IDH_TRANSPORT_DISABLED,
       IDC_BUT_EDIT, IDH_TRANSPORT_DISABLED,
       IDC_BUT_DELETE, IDH_TRANSPORT_DISABLED,
       0, 0
    };

    PDWORD pdwHelpArray = bTL_EditingAllowed ? HelpArray : NOEDIT_HelpArray;

    HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST1);
    HWND hwndEdit = GetDlgItem(hwndDlg, IDC_BUT_EDIT);
    HWND hwndDelete = GetDlgItem(hwndDlg, IDC_BUT_DELETE);
    HWND hwndSelect = GetDlgItem(hwndDlg, IDC_BUT_SELECT);

    switch (uMsg) {
        
    default:
        return FALSE;

    case WM_HELP:
        WinHelp((HWND)((LPHELPINFO) lParam)->hItemHandle,
                "windbg.hlp",
                HELP_WM_HELP,
                (ULONG_PTR) pdwHelpArray );
        return TRUE;

    case WM_CONTEXTMENU:
        WinHelp((HWND) wParam,
                "windbg.hlp",
                HELP_CONTEXTMENU,
                (ULONG_PTR) pdwHelpArray );
        return TRUE;

    case WM_INITDIALOG:
        if (!bTL_EditingAllowed) {
            EnableWindow(GetDlgItem(hwndDlg, IDC_LIST1), FALSE);
            EnableWindow(GetDlgItem(hwndDlg, IDC_BUT_SELECT), FALSE);
            EnableWindow(GetDlgItem(hwndDlg, IDC_STEXT_SELECT), FALSE);
            EnableWindow(GetDlgItem(hwndDlg, IDC_BUT_ADD), FALSE);
            EnableWindow(GetDlgItem(hwndDlg, IDC_BUT_EDIT), FALSE);
            EnableWindow(GetDlgItem(hwndDlg, IDC_BUT_DELETE), FALSE);
        }

        // This section sets up the dialog and initializes the fields.        
        
        // Make a copy of the registry, and screw with the copy.
        Assert(NULL == g_pCCopyOf_All_TLs_WrkSpc);
        g_pCCopyOf_All_TLs_WrkSpc = new CAll_TLs_WKSP();
        
        g_pCCopyOf_All_TLs_WrkSpc->m_bDynamicList = TRUE;
        g_pCCopyOf_All_TLs_WrkSpc->Duplicate(g_dynacontAll_TLs_WkSp);

        Assert(NULL == pszSelectedTL);
        Assert(g_contWorkspace_WkSp.m_pszSelectedTL);
        pszSelectedTL = _strdup(g_contWorkspace_WkSp.m_pszSelectedTL);
        
        //
        // Set the extended style
        //
        ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT);       
        
        ///////////////////////////////////////////
        // Setup the column header for the list view
        ///////////////////////////////////////////
        
        //
        // Add Column headers
        //            
        {
            char            szColHdr[MAX_MSG_TXT];
            LV_COLUMN       lvc;
            
            // Initialize the LV_COLUMN structure. 
            lvc.mask = lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
            lvc.fmt = LVCFMT_LEFT;
            lvc.cx = 100;
            lvc.pszText = szColHdr;  
            
            // Add the 1st column hdr
            Dbg(LoadString(g_hInst, SYS_TRANSPORT_LAYER_COL_HDR1, 
                szColHdr, sizeof(szColHdr)));
            lvc.iSubItem = 0;
            Dbg(ListView_InsertColumn(hwndList, lvc.iSubItem, &lvc) != -1);
            
            // Add the 2nd col hdr
            Dbg(LoadString(g_hInst, SYS_TRANSPORT_LAYER_COL_HDR2, 
                szColHdr, sizeof(szColHdr)));
            lvc.iSubItem = 1;
            Dbg(ListView_InsertColumn(hwndList, lvc.iSubItem, &lvc) != -1);
            
            // Add the 3rd col hdr
            Dbg(LoadString(g_hInst, SYS_TRANSPORT_LAYER_COL_HDR3, 
                szColHdr, sizeof(szColHdr)));
            lvc.iSubItem = 2;
            Dbg(ListView_InsertColumn(hwndList, lvc.iSubItem, &lvc) != -1);
            
            // Add the 4th col hdr
            Dbg(LoadString(g_hInst, SYS_TRANSPORT_LAYER_COL_HDR4, 
                szColHdr, sizeof(szColHdr)));
            lvc.iSubItem = 3;
            Dbg(ListView_InsertColumn(hwndList, lvc.iSubItem, &lvc) != -1);
        }            
        
        //
        // Add the actual data to the list
        //
        AddDataToList(hwndDlg, g_pCCopyOf_All_TLs_WrkSpc);
        return TRUE;

    case WM_COMMAND:
        if (bTL_EditingAllowed) {
            WORD wNotifyCode = HIWORD(wParam);  // notification code 
            WORD wID = LOWORD(wParam);          // item, control, or accelerator identifier 
            HWND hwndCtl = (HWND) lParam;       // handle of control 
            
            switch (wID) {
                
            default:
                return FALSE;
                
            case IDC_BUT_RESET:
                {
                    // Reset it to the original contents
                    CAll_TLs_WKSP * pAll_TLs_Tmp = new CAll_TLs_WKSP();
                    
                    if (pAll_TLs_Tmp) {
                        g_pCCopyOf_All_TLs_WrkSpc->Duplicate(*pAll_TLs_Tmp);
                        
                        // Data has been changed, repopulate the list.
                        AddDataToList(hwndDlg, g_pCCopyOf_All_TLs_WrkSpc);
                        
                        BOOL bEmpty = ListView_GetItemCount(hwndList) <= 0;
                        EnableWindow(hwndEdit, !bEmpty);
                        EnableWindow(hwndDelete, !bEmpty);
                        EnableWindow(hwndSelect, !bEmpty);
                        
                        delete pAll_TLs_Tmp;
                    }
                }
                return FALSE;
                
            case IDC_BUT_SELECT:
                if (BN_CLICKED == wNotifyCode) {                   
                    int nCurSel = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
                    Assert(-1 != nCurSel);
                    
                    if (nCurSel >= 0) {
                        char sz[MAX_PATH];
                        
                        ListView_GetItemText(hwndList, nCurSel, 0, sz, sizeof(sz));
                        
                        SetDlgItemText(hwndDlg, IDC_STEXT_SELECT, sz);
                        
                        FREE_STR(pszSelectedTL);
                        pszSelectedTL = _strdup(sz);
                    }
                }
                return FALSE;
                
            case IDC_BUT_DELETE:
                if (BN_CLICKED == wNotifyCode) {                   
                    int nCurSel = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
                    Assert(-1 != nCurSel);
                    
                    char szTransName[MAX_MSG_TXT]; // Transport name
                    ListView_GetItemText(hwndList, nCurSel, 0, szTransName, sizeof(szTransName));
                    
                    char szMsg[MAX_VAR_MSG_TXT];
                    {
                        char szQuestion[MAX_MSG_TXT]; // Question confirming deletion
                        
                        Dbg(LoadString(g_hInst, DBG_Deleting_DLL, szQuestion, sizeof(szQuestion)));
                        
                        wsprintf(szMsg, szQuestion, szTransName);
                    }
                    
                    char szTitle[MAX_MSG_TXT];
                    Dbg(LoadString(g_hInst, DLG_Deleting_DLL_Title, szTitle, sizeof(szTitle)));
                    strcat(szTitle, "'");
                    strcat(szTitle, szTransName);
                    strcat(szTitle, "'");
                    
                    if (MessageBox(hwndDlg, szMsg, szTitle, MB_OKCANCEL | MB_TASKMODAL) == IDOK) {
                        // Did we erase the selected transport layer
                        if (pszSelectedTL && !strcmp(szTransName, pszSelectedTL)) {
                            
                            // Erased
                            FREE_STR(pszSelectedTL);
                        }
                        
                        // Remove the deleted TL from the reg list.
                        {
                            TListEntry<CIndiv_TL_WKSP *> * pContEntry =
                                g_pCCopyOf_All_TLs_WrkSpc->
                                m_listConts.Find(szTransName, WKSP_Generic_CmpRegName);
                            
                            Assert(pContEntry);
                            delete pContEntry->m_tData;
                            delete pContEntry;
                        }
                        
                        Dbg(ListView_DeleteItem(hwndList, nCurSel));
                        
                        // Select the first item, make sure something is always selected.
                        ListView_SetItemState(hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED, 0x000F);
                        
                        BOOL bEmpty = ListView_GetItemCount(hwndList) <= 0;
                        EnableWindow(hwndEdit, !bEmpty);
                        EnableWindow(hwndSelect, !bEmpty);
                        EnableWindow(hwndDelete, !bEmpty);
                        
                        SetDlgItemText(hwndDlg, IDC_STEXT_SELECT, pszSelectedTL);
                    }
                }
                return FALSE;
                
            case IDC_BUT_EDIT:
                if (BN_CLICKED == wNotifyCode) {
                    int nCurSel = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
                    Assert(-1 != nCurSel);
                    
                    char szTransName[MAX_MSG_TXT]; // Transport name
                    ListView_GetItemText(hwndList, nCurSel, 0, szTransName, sizeof(szTransName));
                    
                    TListEntry<CIndiv_TL_WKSP *> * pContEntry =
                        g_pCCopyOf_All_TLs_WrkSpc->
                        m_listConts.Find(szTransName, WKSP_Generic_CmpRegName);
                    
                    if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DLG_TRANSPORTLAYER), hwndDlg,
                        (DLGPROC)EditTransportLayersDlgProc, (LPARAM)pContEntry->m_tData)) {
                        
                        // Data has been changed, repopulate the list.
                        AddDataToList(hwndDlg, g_pCCopyOf_All_TLs_WrkSpc);
                    }
                    
                    BOOL bEmpty = ListView_GetItemCount(hwndList) <= 0;
                    EnableWindow(hwndEdit, !bEmpty);
                    EnableWindow(hwndDelete, !bEmpty);
                    EnableWindow(hwndSelect, !bEmpty);
                }                
                return FALSE;
                
            case IDC_BUT_ADD:
                if (BN_CLICKED == wNotifyCode) {
                    CIndiv_TL_WKSP * pTL = new CIndiv_TL_WKSP;
                    
                    if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DLG_TRANSPORTLAYER), hwndDlg,
                        (DLGPROC)EditTransportLayersDlgProc, (LPARAM)pTL)) {
                        
                        pTL->SetParent(g_pCCopyOf_All_TLs_WrkSpc);
                        g_pCCopyOf_All_TLs_WrkSpc->AddToContainerList(pTL);
                        
                        // Data has been changed, repopulate the list.
                        AddDataToList(hwndDlg, g_pCCopyOf_All_TLs_WrkSpc);
                        
                        BOOL bEmpty = ListView_GetItemCount(hwndList) <= 0;
                        EnableWindow(hwndEdit, !bEmpty);
                        EnableWindow(hwndDelete, !bEmpty);
                        EnableWindow(hwndSelect, !bEmpty);
                    } else {
                        delete pTL;
                    }
                }                
                return FALSE;
            }
        }
        return FALSE;

    case WM_NOTIFY:
        switch (((LPNMHDR) lParam)->code) {
        default:
            return FALSE;

        case NM_DBLCLK:
           if (bTL_EditingAllowed) {
                LPNMHDR lpnmh = (LPNMHDR) lParam;
                
                switch (lpnmh->idFrom) {
                case IDC_LIST1:
                    // Dbl clicking will work the same as a pressing the "select" button.
                    // Let the Select button process the dbl click
                    PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_BUT_SELECT, BN_CLICKED),
                        (LPARAM) lpnmh->hwndFrom);
                    break;
                }
            }
            return FALSE;

        case PSN_KILLACTIVE:
            // Error checking: must select a TL, and that TL must exist
            if (!ValidateAllTransportLayers(hwndDlg, g_pCCopyOf_All_TLs_WrkSpc)) {
                MessageBeep(MB_ICONEXCLAMATION);
                SetWindowLong(hwndDlg, DWLP_MSGRESULT, TRUE);
            }
            
            if (NULL == pszSelectedTL) {
                
                PSTR pszTitle = WKSP_DynaLoadString(g_hInst, SYS_Warning);
                WKSP_MsgBox(pszTitle, ERR_Please_Select_A_TL);
                free(pszTitle);

                MessageBeep(MB_ICONEXCLAMATION);
                SetWindowLong(hwndDlg, DWLP_MSGRESULT, TRUE);
                
            } else if (NULL == g_pCCopyOf_All_TLs_WrkSpc->
                m_listConts.Find(pszSelectedTL, WKSP_Generic_CmpRegName)) {
                
                PSTR pszTitle = WKSP_DynaLoadString(g_hInst, SYS_Warning);
                WKSP_MsgBox(pszTitle, ERR_Transport_Doesnt_Exist, pszSelectedTL);
                free(pszTitle);

                MessageBeep(MB_ICONEXCLAMATION);
                SetWindowLong(hwndDlg, DWLP_MSGRESULT, TRUE);
            }
            
            SetWindowLong(hwndDlg, DWLP_MSGRESULT, FALSE);
            return TRUE;

        case PSN_APPLY:
            g_dynacontAll_TLs_WkSp.Duplicate(*g_pCCopyOf_All_TLs_WrkSpc);
            g_dynacontAll_TLs_WkSp.Save(FALSE, FALSE);
            
            Assert(SetTransportLayer(pszSelectedTL, g_pCCopyOf_All_TLs_WrkSpc));
            return TRUE;
        }
        break;

    case WM_DESTROY:
        delete g_pCCopyOf_All_TLs_WrkSpc;
        g_pCCopyOf_All_TLs_WrkSpc = NULL;
                
        if (pszSelectedTL) {
            free(pszSelectedTL);
            pszSelectedTL = NULL;
        }
        return FALSE;
    }
}
Ejemplo n.º 8
0
INT_PTR
WINAPI
EditTransportLayersDlgProc(
    HWND    hwndDlg,
    UINT    uMsg,
    WPARAM  wParam,
    LPARAM  lParam
    )
/*++
Routine Description:
    Edit a transport layer

Arguments:
Return Value:
    See docs for "DialogBox"
--*/
{
    static DWORD HelpArray[]=
    {
        ID_CHDBDLL_NAME, IDH_DISPNAME,
        ID_CHDBDLL_DESC, IDH_DESC,
        ID_CHDBDLL_PATH, IDH_PATH,
        ID_CHDBDLL_PARAM, IDH_PARAMETERS,
        0, 0
    };
    static CIndiv_TL_WKSP * pTL = NULL;
    
    switch (uMsg) {        
    case WM_INITDIALOG:
        //
        // lParam point to a transport layer.
        
        Assert(lParam);
        pTL = (CIndiv_TL_WKSP *) lParam;
        AssertType(*pTL, CIndiv_TL_WKSP);
        
        SetDlgItemText(hwndDlg, ID_CHDBDLL_NAME, pTL->m_pszRegistryName);
        SetDlgItemText(hwndDlg, ID_CHDBDLL_DESC, pTL->m_pszDescription);
        SetDlgItemText(hwndDlg, ID_CHDBDLL_PATH, pTL->m_pszDll);
        SetDlgItemText(hwndDlg, ID_CHDBDLL_PARAM, pTL->m_pszParams);
        return TRUE;
        
    case WM_DESTROY:
        pTL = NULL;
        return TRUE;
        
    case WM_COMMAND:       
        switch (wParam) {
        case IDOK:
            {
                char szName[MAX_MSG_TXT];
                char szDesc[MAX_MSG_TXT];
                char szDll[MAX_MSG_TXT];
                char szParams[MAX_MSG_TXT];
                
                GetDlgItemText(hwndDlg, ID_CHDBDLL_NAME, szName, sizeof(szName));
                GetDlgItemText(hwndDlg, ID_CHDBDLL_DESC, szDesc, sizeof(szDesc));
                GetDlgItemText(hwndDlg, ID_CHDBDLL_PATH, szDll, sizeof(szDll));
                GetDlgItemText(hwndDlg, ID_CHDBDLL_PARAM, szParams, sizeof(szParams));

                //
                // Verify that key is not empty, and unique
                //
                
                if (0 == strlen(szName)) {
                    WKSP_MsgBox(NULL, ERR_Empty_Shortname);
                    return TRUE;
                }

                // Are we adding or editing
                if (NULL == pTL->m_pszRegistryName) {
                    // If it doesn't have a registry name, then we are adding
                    // Make sure the name isn't duplicated.
                    if (g_pCCopyOf_All_TLs_WrkSpc->
                            m_listConts.Find(szName, WKSP_Generic_CmpRegName) ) {

                        WKSP_MsgBox(NULL, ERR_Not_Unique_Shortname, szName);
                        return TRUE;
                    }
                } else {
                    // If it does have a registry name, then we are editing
                    if (strcmp(szName, pTL->m_pszRegistryName)) {
                        // The name has changed, then make sure it isn't duplicated.
                        if (g_pCCopyOf_All_TLs_WrkSpc->
                                m_listConts.Find(szName, WKSP_Generic_CmpRegName) ) {

                            WKSP_MsgBox(NULL, ERR_Not_Unique_Shortname, szName);
                            return TRUE;
                        }
                    }                
                }

                pTL->SetRegistryName(szName);

                FREE_STR(pTL->m_pszDescription);
                pTL->m_pszDescription = _strdup(szDesc);
                
                FREE_STR(pTL->m_pszDll);
                pTL->m_pszDll = _strdup(szDll);
                
                FREE_STR(pTL->m_pszParams);
                pTL->m_pszParams = _strdup(szParams);

                EndDialog(hwndDlg, TRUE);
            }
            return TRUE;
            
        case IDCANCEL:
            EndDialog(hwndDlg, FALSE);
            return TRUE;
            
        case WM_HELP:
            WinHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, "windbg.hlp", HELP_WM_HELP,
                (ULONG_PTR)(LPVOID) HelpArray );
            return TRUE;
        
        case WM_CONTEXTMENU:
            WinHelp ((HWND) wParam, "windbg.hlp", HELP_CONTEXTMENU,
                (ULONG_PTR)(LPVOID) HelpArray );
            return TRUE;
        
        }
    }
    return FALSE;
}
Ejemplo n.º 9
0
Archivo: bas5.c Proyecto: LGTMCU/f32c
int
input()
{
	CHAR   *p;
	ival   i = 0;
	value	*l;
	int     c;
	char    vty;
	int	(*infunc)(void);
	int     firsttime=0;
	int	noerr;
	int	frfile = 0;
	STR	st = NULL;

	infunc = in1line;
	c=getch();
	if(c=='"'){
		p=line;
		while(*point && *point != '"'){
			*p++ = *point++;
			i++;
		}
		if(*point)
			point++;
		if(getch()!=';')
			error(SYNTAX);
		*p=0;
		firsttime++;
	}
	else if(c=='#'){
		i=evalint();
		if(getch()!=',')
			error(SYNTAX);
		_curinfile = getf(i, _READ);
		infunc = in1file;
		frfile = 1;
	}
	else
		point--;
	l= (value *)getname(0);
	vty=vartype;
for(;;){
	if(!frfile){
		if(!firsttime){
			*line='?';
			i=1;
		}
		firsttime=0;
		VOID edit(i,i,(ival)0);
		if(trapped){
			point=savepoint; /* restore point to start of in. */
			return(-1);     /* will trap at start of this in. */
		}
		in1iline = line + i;
	}
	do {
		/* ignore leading spaces */
		while( (c = (*infunc)()) == ' ');
		if(!c && vty != SVAL)
			continue;
		pushback = c;
		if(vty == SVAL){
			st = ALLOC_STR( (ival)LOC_BUF_SIZ);
			noerr = getstrdt(infunc, st);
		}
		else
			noerr = getdata(infunc);
		if(noerr)
			while( (c = (*infunc)()) == ' ');
		if(!noerr || (c && c != ',')){
			if(vty == SVAL && st != NULL)
				FREE_STR(st);
			if(frfile)
				error(26);
			prints("Bad data redo\n");
			break;
		}
		if(vty == SVAL)
			stringassign( (stringp)l, curentry, st, 0);
		else
			putin(l, (int)vty);

		if(getch()!=','){
			point--;
			normret;
		}

		l= (value *)getname(0);
		vty=vartype;
	} while(c);
	}
}