static void menu_cb_DrawSelectedSound (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Draw selected sound", nullptr) my v_form_pictureWindow (cmd); LABEL (U"", U"Sound:") BOOLEAN (U"Preserve times", my default_picture_preserveTimes ()); REAL (U"left Vertical range", my default_picture_bottom ()); REAL (U"right Vertical range", my default_picture_top ()); my v_form_pictureMargins (cmd); BOOLEAN (U"Garnish", my default_picture_garnish ()); EDITOR_OK my v_ok_pictureWindow (cmd); SET_INTEGER (U"Preserve times", my pref_picture_preserveTimes ()); SET_REAL (U"left Vertical range", my pref_picture_bottom ()); SET_REAL (U"right Vertical range", my pref_picture_top ()); my v_ok_pictureMargins (cmd); SET_INTEGER (U"Garnish", my pref_picture_garnish ()); EDITOR_DO my v_do_pictureWindow (cmd); my pref_picture_preserveTimes () = GET_INTEGER (U"Preserve times"); my pref_picture_bottom () = GET_REAL (U"left Vertical range"); my pref_picture_top () = GET_REAL (U"right Vertical range"); my v_do_pictureMargins (cmd); my pref_picture_garnish () = GET_INTEGER (U"Garnish"); if (! my d_longSound.data && ! my d_sound.data) Melder_throw (U"There is no sound to draw."); autoSound publish = my d_longSound.data ? LongSound_extractPart (my d_longSound.data, my d_startSelection, my d_endSelection, my pref_picture_preserveTimes ()) : Sound_extractPart (my d_sound.data, my d_startSelection, my d_endSelection, kSound_windowShape_RECTANGULAR, 1.0, my pref_picture_preserveTimes ()); Editor_openPraatPicture (me); Sound_draw (publish.peek(), my pictureGraphics, 0.0, 0.0, my pref_picture_bottom (), my pref_picture_top (), my pref_picture_garnish (), U"Curve"); Editor_closePraatPicture (me); EDITOR_END }
BOOL CALLBACK RHeadlineDepthPage::SelectResItem ( HANDLE hModule, // resource-module handle LPCTSTR /*lpszType*/, // pointer to resource type LPTSTR lpszName, // pointer to resource name LONG lParam) // application-defined parameter { RHeadlineDepthPage* pPage = (RHeadlineDepthPage*) lParam ; DepthPageData data ; DepthPageData& classData = pPage->m_data ; pPage->LoadResData( (HMODULE) hModule, lpszName, data ) ; BOOLEAN fFound = TRUE ; if (classData.nDataType != data.nDataType) { return TRUE ; // Keep looking } if (kBehindType == classData.nDataType) { fFound = BOOLEAN( data.nBehindEffect == classData.nBehindEffect ) ; } else if (kShadowType == classData.nDataType) { fFound = BOOLEAN( data.nOpacity == classData.nOpacity && data.nEdgeSoftness == classData.nEdgeSoftness && data.nOffset == classData.nOffset ); } else { if (classData.nSelProjection || classData.nSelShadow) { fFound = BOOLEAN( data.nSelProjection == classData.nSelProjection && data.nSelShadow == classData.nSelShadow && data.nNumStages == classData.nNumStages && data.flDepth == classData.flDepth && data.fBlend == classData.fBlend) ; } if (fFound) { classData.nVanishPointX = data.nVanishPointX ; classData.nVanishPointY = data.nVanishPointY ; } } if (fFound) { pPage->m_gcImageList.SetCurSel( int(lpszName) - 100 ) ; } return !fFound ; }
bool cc2538_channel_clear(void) { if (RFCORE->XREG_FSMSTAT0bits.FSM_FFCTRL_STATE == FSM_STATE_IDLE) { bool result; cc2538_on(); RFCORE_WAIT_UNTIL(RFCORE->XREG_RSSISTATbits.RSSI_VALID); result = BOOLEAN(RFCORE->XREG_FSMSTAT1bits.CCA); cc2538_off(); return result; } else { RFCORE_WAIT_UNTIL(RFCORE->XREG_RSSISTATbits.RSSI_VALID); return BOOLEAN(RFCORE->XREG_FSMSTAT1bits.CCA); } }
static void menu_cb_print (EDITOR_ARGS) { EDITOR_IAM (HyperPage); EDITOR_FORM (L"Print", 0) SENTENCE (L"Left or inside header", L"") SENTENCE (L"Middle header", L"") LABEL (L"", L"Right or outside header:") TEXTFIELD (L"Right or outside header", L"") SENTENCE (L"Left or inside footer", L"") SENTENCE (L"Middle footer", L"") SENTENCE (L"Right or outside footer", L"") BOOLEAN (L"Mirror even/odd headers", TRUE) INTEGER (L"First page number", L"0 (= no page numbers)") EDITOR_OK my v_defaultHeaders (cmd); if (my d_printingPageNumber) SET_INTEGER (L"First page number", my d_printingPageNumber + 1) EDITOR_DO my insideHeader = GET_STRING (L"Left or inside header"); my middleHeader = GET_STRING (L"Middle header"); my outsideHeader = GET_STRING (L"Right or outside header"); my insideFooter = GET_STRING (L"Left or inside footer"); my middleFooter = GET_STRING (L"Middle footer"); my outsideFooter = GET_STRING (L"Right or outside footer"); my mirror = GET_INTEGER (L"Mirror even/odd headers"); my d_printingPageNumber = GET_INTEGER (L"First page number"); Printer_print (print, me); EDITOR_END }
static void menu_cb_printRange (EDITOR_ARGS) { EDITOR_IAM (Manual); EDITOR_FORM (L"Print range", 0) SENTENCE (L"Left or inside header", L"") SENTENCE (L"Middle header", L"") SENTENCE (L"Right or outside header", L"Manual") SENTENCE (L"Left or inside footer", L"") SENTENCE (L"Middle footer", L"") SENTENCE (L"Right or outside footer", L"") BOOLEAN (L"Mirror even/odd headers", TRUE) LABEL (L"", L"Print all pages whose title starts with:") TEXTFIELD (L"Print pages starting with", L"Intro") INTEGER (L"First page number", L"1") BOOLEAN (L"Suppress \"Links to this page\"", FALSE) EDITOR_OK ManPages manPages = (ManPages) my data; time_t today = time (NULL); char dateA [50]; #ifdef UNIX struct tm *tm = localtime (& today); strftime (dateA, 50, "%B %e, %Y", tm); #else strcpy (dateA, ctime (& today)); #endif wchar_t *date = Melder_peekUtf8ToWcs (dateA), *newline; newline = wcschr (date, '\n'); if (newline) *newline = '\0'; SET_STRING (L"Left or inside header", date) SET_STRING (L"Right or outside header", my name) if (my d_printingPageNumber) SET_INTEGER (L"First page number", my d_printingPageNumber + 1) if (my path >= 1 && my path <= manPages -> pages -> size) { ManPage page = (ManPage) manPages -> pages -> item [my path]; SET_STRING (L"Print pages starting with", page -> title); } EDITOR_DO my insideHeader = GET_STRING (L"Left or inside header"); my middleHeader = GET_STRING (L"Middle header"); my outsideHeader = GET_STRING (L"Right or outside header"); my insideFooter = GET_STRING (L"Left or inside footer"); my middleFooter = GET_STRING (L"Middle footer"); my outsideFooter = GET_STRING (L"Right or outside footer"); my mirror = GET_INTEGER (L"Mirror even/odd headers"); my printPagesStartingWith = GET_STRING (L"Print pages starting with"); my d_printingPageNumber = GET_INTEGER (L"First page number"); my suppressLinksHither = GET_INTEGER (L"Suppress \"Links to this page\""); Printer_print (print, me); EDITOR_END }
static void menu_cb_printRange (Manual me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Print range", 0) SENTENCE (U"Left or inside header", U"") SENTENCE (U"Middle header", U"") SENTENCE (U"Right or outside header", U"Manual") SENTENCE (U"Left or inside footer", U"") SENTENCE (U"Middle footer", U"") SENTENCE (U"Right or outside footer", U"") BOOLEAN (U"Mirror even/odd headers", true) LABEL (U"", U"Print all pages whose title starts with:") TEXTFIELD (U"Print pages starting with", U"Intro") INTEGER (U"First page number", U"1") BOOLEAN (U"Suppress \"Links to this page\"", false) EDITOR_OK ManPages manPages = (ManPages) my data; time_t today = time (nullptr); char dateA [50]; #ifdef UNIX struct tm *tm = localtime (& today); strftime (dateA, 50, "%B %e, %Y", tm); #else strcpy (dateA, ctime (& today)); #endif char32 *date = Melder_peek8to32 (dateA), *newline; newline = str32chr (date, U'\n'); if (newline) *newline = U'\0'; SET_STRING (U"Left or inside header", date) SET_STRING (U"Right or outside header", my name) if (my d_printingPageNumber) SET_INTEGER (U"First page number", my d_printingPageNumber + 1) if (my path >= 1 && my path <= manPages -> pages.size) { ManPage page = manPages -> pages.at [my path]; SET_STRING (U"Print pages starting with", page -> title); } EDITOR_DO my insideHeader = GET_STRING (U"Left or inside header"); my middleHeader = GET_STRING (U"Middle header"); my outsideHeader = GET_STRING (U"Right or outside header"); my insideFooter = GET_STRING (U"Left or inside footer"); my middleFooter = GET_STRING (U"Middle footer"); my outsideFooter = GET_STRING (U"Right or outside footer"); my mirror = GET_INTEGER (U"Mirror even/odd headers"); my printPagesStartingWith = GET_STRING (U"Print pages starting with"); my d_printingPageNumber = GET_INTEGER (U"First page number"); my suppressLinksHither = GET_INTEGER (U"Suppress \"Links to this page\""); Printer_print (print, me); EDITOR_END }
/*! acm_l26_modinit - module init * * This is called immediately after the module is loaded or during * the kernel driver initialization if linked into the kernel. * */ static int acm_l26_modinit (void) { BOOL tty_l26 = FALSE, tty_if = FALSE; int minor_numbers=1; /* register tty and usb interface function drivers */ TTY = otg_trace_obtain_tag(); THROW_UNLESS(tty_l26 = BOOLEAN(!tty_l26_init(ACM_DRIVER_PROCFS_NAME, ACM_TTY_MINORS)), error); THROW_UNLESS(tty_if = BOOLEAN(!tty_if_init()), error); CATCH(error) { if (tty_l26) tty_l26_exit(); if (tty_if) tty_if_exit(); otg_trace_invalidate_tag(TTY); return -EINVAL; } return 0; }
//***************************************************************************** // // Function Name: RColorDialog // // Description: Constructor (Default). // // Returns: None // // Exceptions: None // //***************************************************************************** RColorDialog::RColorDialog( CWnd* pParent, UINT uwFlags ) : CDialog( RColorDialog::IDD, pParent ), m_dlgColorPalette( NULL, BOOLEAN( uwFlags & kShowTransparent ) ), m_pCurrentPage( NULL ), m_uwFlags( uwFlags ), m_nStartPage( 0 ) { //{{AFX_DATA_INIT(RColorDialog) //}}AFX_DATA_INIT }
int Printer_postScriptSettings (void) { static UiForm *dia; if (dia == NULL) { UiForm::UiField *radio; dia = new UiForm (theCurrentPraatApplication -> topShell, L"PostScript settings", DO_Printer_postScriptSettings, NULL, L"PostScript settings...", L"PostScript settings..."); #if defined (_WIN32) || defined (macintosh) BOOLEAN (L"Allow direct PostScript", TRUE); #endif RADIO_ENUM (L"Grey resolution", kGraphicsPostscript_spots, DEFAULT) #if defined (UNIX) RADIO_ENUM (L"Paper size", kGraphicsPostscript_paperSize, DEFAULT); RADIO_ENUM (L"Orientation", kGraphicsPostscript_orientation, DEFAULT); POSITIVE (L"Magnification", L"1.0"); LABEL (L"label", L"Print command:"); #if defined (linux) TEXTFIELD (L"printCommand", L"lpr %s"); #else TEXTFIELD (L"printCommand", L"lp -c %s"); #endif #endif RADIO_ENUM (L"Font choice strategy", kGraphicsPostscript_fontChoiceStrategy, DEFAULT); #if defined (macintosh) BOOLEAN (L"EPS files include preview", TRUE); #endif dia->finish (); } #if defined (_WIN32) || defined (macintosh) SET_INTEGER (L"Allow direct PostScript", thePrinter. allowDirectPostScript); #endif SET_ENUM (L"Grey resolution", kGraphicsPostscript_spots, thePrinter. spots); #if defined (UNIX) SET_ENUM (L"Paper size", kGraphicsPostscript_paperSize, thePrinter. paperSize); SET_ENUM (L"Orientation", kGraphicsPostscript_orientation, thePrinter. orientation); SET_REAL (L"Magnification", thePrinter. magnification); SET_STRING (L"printCommand", Site_getPrintCommand ()); #endif SET_ENUM (L"Font choice strategy", kGraphicsPostscript_fontChoiceStrategy, thePrinter. fontChoiceStrategy); #if defined (macintosh) SET_INTEGER (L"EPS files include preview", thePrinter. epsFilesHavePreview); #endif dia->do_ (false); return 1; }
/*! mcpc_l26_modinit - module init * * This is called immediately after the module is loaded or during * the kernel driver initialization if linked into the kernel. * */ STATIC int mcpc_l26_modinit (void) { BOOL tty_l26 = FALSE, dun_if = FALSE, obex_if = FALSE, atcom_if = FALSE; TTY = otg_trace_obtain_tag(); THROW_UNLESS (tty_l26 = BOOLEAN(!tty_l26_init("mcpc_if", 6)), error); THROW_UNLESS (tty_l26 = BOOLEAN(!dun_if_init()), error); THROW_UNLESS (tty_l26 = BOOLEAN(!obex_if_init()), error); THROW_UNLESS (tty_l26 = BOOLEAN(!atcom_if_init()), error); CATCH(error) { printk(KERN_ERR"%s: ERROR\n", __FUNCTION__); if (tty_l26) tty_l26_exit(); if (dun_if) dun_if_exit(); if (obex_if) obex_if_exit(); if (atcom_if) atcom_if_exit(); otg_trace_invalidate_tag(TTY); return -EINVAL; } return 0; }
/********************************************************************* * rand_s (MSVCRT.@) */ int CDECL rand_s(unsigned int *pval) { BOOLEAN (WINAPI *pSystemFunction036)(PVOID, ULONG); // RtlGenRandom HINSTANCE hadvapi32 = LoadLibraryA("advapi32.dll"); pSystemFunction036 = (void*)GetProcAddress(hadvapi32, "SystemFunction036"); #if 1 if (!pval || (pSystemFunction036 && !pSystemFunction036(pval, sizeof(*pval)))) { _invalid_parameter(NULL,_CRT_WIDE("rand_s"),_CRT_WIDE(__FILE__),__LINE__, 0); *_errno() = EINVAL; return EINVAL; } #endif if(hadvapi32) FreeLibrary(hadvapi32); return 0; }
static void menu_cb_learnOneFromPartialOutput (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (U"Learn one from partial adult output", 0) LABEL (U"", U"Partial adult surface form (e.g. overt form):") SENTENCE (U"Partial output", U"") REAL (U"Evaluation noise", U"2.0") OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy_SYMMETRIC_ALL) REAL (U"Plasticity", U"0.1") REAL (U"Rel. plasticity spreading", U"0.1") BOOLEAN (U"Honour local rankings", 1) NATURAL (U"Number of chews", U"1") EDITOR_OK EDITOR_DO Editor_save (me, U"Learn one from partial output"); OTGrammar_learnOneFromPartialOutput ((OTGrammar) my data, GET_STRING (U"Partial output"), GET_REAL (U"Evaluation noise"), GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Honour local rankings"), GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"), GET_INTEGER (U"Number of chews"), TRUE); OTGrammar_sort ((OTGrammar) my data); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_ExtractSelectedSound_windowed (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Extract selected sound (windowed)", nullptr) WORD (U"Name", U"slice") OPTIONMENU_ENUM (U"Window shape", kSound_windowShape, my default_extract_windowShape ()) POSITIVE (U"Relative width", my default_extract_relativeWidth ()) BOOLEAN (U"Preserve times", my default_extract_preserveTimes ()) EDITOR_OK SET_ENUM (U"Window shape", kSound_windowShape, my pref_extract_windowShape ()) SET_REAL (U"Relative width", my pref_extract_relativeWidth ()) SET_INTEGER (U"Preserve times", my pref_extract_preserveTimes ()) EDITOR_DO Sound sound = my d_sound.data; Melder_assert (sound); my pref_extract_windowShape () = GET_ENUM (kSound_windowShape, U"Window shape"); my pref_extract_relativeWidth () = GET_REAL (U"Relative width"); my pref_extract_preserveTimes () = GET_INTEGER (U"Preserve times"); autoSound extract = Sound_extractPart (sound, my d_startSelection, my d_endSelection, my pref_extract_windowShape (), my pref_extract_relativeWidth (), my pref_extract_preserveTimes ()); Thing_setName (extract.peek(), GET_STRING (U"Name")); Editor_broadcastPublication (me, extract.transfer()); EDITOR_END }
static void menu_cb_learnOne (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (U"Learn one", U"OTGrammar: Learn one...") LABEL (U"", U"Underlying form:") SENTENCE (U"Input string", U"") LABEL (U"", U"Adult surface form:") SENTENCE (U"Output string", U"") REAL (U"Evaluation noise", U"2.0") OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy_SYMMETRIC_ALL) REAL (U"Plasticity", U"0.1") REAL (U"Rel. plasticity spreading", U"0.1") BOOLEAN (U"Honour local rankings", 1) EDITOR_OK EDITOR_DO Editor_save (me, U"Learn one"); OTGrammar_learnOne ((OTGrammar) my data, GET_STRING (U"Input string"), GET_STRING (U"Output string"), GET_REAL (U"Evaluation noise"), GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Honour local rankings"), GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"), TRUE, TRUE, NULL); OTGrammar_sort ((OTGrammar) my data); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
// **************************************************************************** // // Function Name: RMFCCommandUI::GetDroppedState( ) // // Description: This function is for when the update must be for a // combobox. If the RMFCCommandUI object is a combobox or has // a child combobox, this checks the combobox to see if its // list box is dropped. // // Returns: TRUE: List box is dropped // FALSE: List box is not dropped // // Exceptions: None // // **************************************************************************** // BOOLEAN RMFCCommandUI::GetDroppedState( ) { TpsAssert( m_pCmdUI->m_pMenu == NULL, "CommandUI object is not a control" ); TpsAssert( m_pCmdUI->m_pOther, "m_pCmdUI->m_pOther is NULL" ); HWND hWnd = m_pCmdUI->m_pOther->GetSafeHwnd(); CWnd* pWnd = NULL; while ( hWnd ) { pWnd = pWnd->FromHandle( hWnd ); if ( pWnd->IsKindOf( RUNTIME_CLASS( CComboBox ) ) ) { CComboBox* pComboBox = ( CComboBox* )pWnd; return BOOLEAN( pComboBox->GetDroppedState() ); } else hWnd = ::GetWindow( hWnd, GW_CHILD ); } TpsAssertAlways( "RMFCCommandUI object is not a combobox" ); return FALSE; }
static void menu_cb_pathFinder (EDITOR_ARGS) { EDITOR_IAM (PitchEditor); EDITOR_FORM (L"Path finder", 0) REAL (L"Silence threshold", L"0.03") REAL (L"Voicing threshold", L"0.45") REAL (L"Octave cost", L"0.01") REAL (L"Octave-jump cost", L"0.35") REAL (L"Voiced/unvoiced cost", L"0.14") POSITIVE (L"Ceiling (Hz)", L"600") BOOLEAN (L"Pull formants", 0) EDITOR_OK Pitch pitch = (Pitch) my data; SET_REAL (L"Ceiling", pitch -> ceiling) EDITOR_DO Pitch pitch = (Pitch) my data; Editor_save (me, L"Path finder"); Pitch_pathFinder (pitch, GET_REAL (L"Silence threshold"), GET_REAL (L"Voicing threshold"), GET_REAL (L"Octave cost"), GET_REAL (L"Octave-jump cost"), GET_REAL (L"Voiced/unvoiced cost"), GET_REAL (L"Ceiling"), GET_INTEGER (L"Pull formants")); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }
int CHOLMOD(change_factor) ( /* ---- input ---- */ int to_xtype, /* convert to CHOLMOD_PATTERN, _REAL, _COMPLEX, or * _ZOMPLEX */ int to_ll, /* TRUE: convert to LL', FALSE: LDL' */ int to_super, /* TRUE: convert to supernodal, FALSE: simplicial */ int to_packed, /* TRUE: pack simplicial columns, FALSE: do not pack */ int to_monotonic, /* TRUE: put simplicial columns in order, FALSE: not */ /* ---- in/out --- */ cholmod_factor *L, /* factor to modify */ /* --------------- */ cholmod_common *Common ) { /* ---------------------------------------------------------------------- */ /* get inputs */ /* ---------------------------------------------------------------------- */ RETURN_IF_NULL_COMMON (FALSE) ; RETURN_IF_NULL (L, FALSE) ; RETURN_IF_XTYPE_INVALID (L, CHOLMOD_PATTERN, CHOLMOD_ZOMPLEX, FALSE) ; if (to_xtype < CHOLMOD_PATTERN || to_xtype > CHOLMOD_ZOMPLEX) { ERROR (CHOLMOD_INVALID, "xtype invalid") ; return (FALSE) ; } Common->status = CHOLMOD_OK ; PRINT1 (("-----convert from (%d,%d,%d,%d,%d) to (%d,%d,%d,%d,%d)\n", L->xtype, L->is_ll, L->is_super, L_is_packed (L, Common), L->is_monotonic, to_xtype, to_ll, to_super, to_packed, to_monotonic)) ; /* ensure all parameters are TRUE/FALSE */ to_ll = BOOLEAN (to_ll) ; to_super = BOOLEAN (to_super) ; ASSERT (BOOLEAN (L->is_ll) == L->is_ll) ; ASSERT (BOOLEAN (L->is_super) == L->is_super) ; if (to_super && to_xtype == CHOLMOD_ZOMPLEX) { ERROR (CHOLMOD_INVALID, "supernodal zomplex L not supported") ; return (FALSE) ; } /* ---------------------------------------------------------------------- */ /* convert */ /* ---------------------------------------------------------------------- */ if (to_xtype == CHOLMOD_PATTERN) { /* ------------------------------------------------------------------ */ /* convert to symbolic */ /* ------------------------------------------------------------------ */ if (!to_super) { /* -------------------------------------------------------------- */ /* convert any factor into a simplicial symbolic factor */ /* -------------------------------------------------------------- */ any_to_simplicial_symbolic (L, to_ll, Common) ; /* cannot fail */ } else { /* -------------------------------------------------------------- */ /* convert to a supernodal symbolic factor */ /* -------------------------------------------------------------- */ if (L->xtype != CHOLMOD_PATTERN && L->is_super) { /* convert from supernodal numeric to supernodal symbolic. * this preserves symbolic pattern of L, discards numeric * values */ ll_super_to_super_symbolic (L, Common) ; /* cannot fail */ } else if (L->xtype == CHOLMOD_PATTERN && !(L->is_super)) { /* convert from simplicial symbolic to supernodal symbolic. * contents of supernodal pattern are uninitialized. Not meant * for the end user. */ simplicial_symbolic_to_super_symbolic (L, Common) ; } else { /* cannot convert from simplicial numeric to supernodal * symbolic */ ERROR (CHOLMOD_INVALID, "cannot convert L to supernodal symbolic") ; } } } else { /* ------------------------------------------------------------------ */ /* convert to numeric */ /* ------------------------------------------------------------------ */ if (to_super) { /* -------------------------------------------------------------- */ /* convert to supernodal numeric factor */ /* -------------------------------------------------------------- */ if (L->xtype == CHOLMOD_PATTERN) { if (L->is_super) { /* Convert supernodal symbolic to supernodal numeric. * Contents of supernodal numeric values are uninitialized. * This is used by cholmod_super_numeric. Not meant for * the end user. */ super_symbolic_to_ll_super (to_xtype, L, Common) ; } else { /* Convert simplicial symbolic to supernodal numeric. * Contents not defined. This is used by * Core/cholmod_copy_factor only. Not meant for the end * user. */ if (!simplicial_symbolic_to_super_symbolic (L, Common)) { /* failure, convert back to simplicial symbolic */ any_to_simplicial_symbolic (L, to_ll, Common) ; } else { /* conversion to super symbolic OK, allocate numeric * part */ super_symbolic_to_ll_super (to_xtype, L, Common) ; } } } else { /* nothing to do if L is already in supernodal numeric form */ if (!(L->is_super)) { ERROR (CHOLMOD_INVALID, "cannot convert simplicial L to supernodal") ; } /* FUTURE WORK: convert to/from supernodal LL' and LDL' */ } } else { /* -------------------------------------------------------------- */ /* convert any factor to simplicial numeric */ /* -------------------------------------------------------------- */ if (L->xtype == CHOLMOD_PATTERN && !(L->is_super)) { /* ---------------------------------------------------------- */ /* convert simplicial symbolic to simplicial numeric (L=I,D=I)*/ /* ---------------------------------------------------------- */ simplicial_symbolic_to_simplicial_numeric (L, to_ll, to_packed, to_xtype, Common) ; } else if (L->xtype != CHOLMOD_PATTERN && L->is_super) { /* ---------------------------------------------------------- */ /* convert a supernodal LL' to simplicial numeric */ /* ---------------------------------------------------------- */ ll_super_to_simplicial_numeric (L, to_packed, to_ll, Common) ; } else if (L->xtype == CHOLMOD_PATTERN && L->is_super) { /* ---------------------------------------------------------- */ /* convert a supernodal symbolic to simplicial numeric (L=D=I)*/ /* ---------------------------------------------------------- */ any_to_simplicial_symbolic (L, to_ll, Common) ; /* if the following fails, it leaves the factor in simplicial * symbolic form */ simplicial_symbolic_to_simplicial_numeric (L, to_ll, to_packed, to_xtype, Common) ; } else { /* ---------------------------------------------------------- */ /* change a simplicial numeric factor */ /* ---------------------------------------------------------- */ /* change LL' to LDL', LDL' to LL', or leave as-is. pack the * columns of L, or leave as-is. Ensure the columns are * monotonic, or leave as-is. */ change_simplicial_numeric (L, to_ll, to_packed, to_monotonic, Common) ; } } } /* ---------------------------------------------------------------------- */ /* return result */ /* ---------------------------------------------------------------------- */ return (Common->status >= CHOLMOD_OK) ; }
// use native bool parameter jobject X_NewBoolean(JNIEnv *env, bool value) { CHK_NUL_RET_NUL(env, "env"); return env->NewObject(jdk_clsBoolean, jdk_clsBoolean_initID, BOOLEAN(value)); }
/****************************************************************** Registered procedure for filtering if resource requirement Required when the device supports MSI, but the driver decides - will it work with MSI or not (currently MSI is supported but does not work, exactly our case). In this case the resource requirement list must be replaced - we need to remove from it all the "message interrupt" resources. When we are ready to work with MSI (VIRTIO_USE_MSIX_INTERRUPT is DEFINED), we just enumerate allocated resources and do not modify them. *******************************************************************/ static NDIS_STATUS ParaNdis6_FilterResource(IN NDIS_HANDLE MiniportAddDeviceContext, IN PIRP Irp) { DPrintf(0, ("[%s] entered\n", __FUNCTION__)); PIO_RESOURCE_REQUIREMENTS_LIST prrl = (PIO_RESOURCE_REQUIREMENTS_LIST)(PVOID)Irp->IoStatus.Information; #ifdef DBG PrintPRRL(prrl); #endif PIO_RESOURCE_REQUIREMENTS_LIST newPrrl = ParseFilterResourceIrp(MiniportAddDeviceContext, prrl, BOOLEAN(bDisableMSI)); if (newPrrl) { Irp->IoStatus.Information = (ULONG_PTR)newPrrl; NdisFreeMemory(prrl, 0, 0); #ifdef DBG PrintPRRL(newPrrl); #endif } else { DPrintf(0, ("[%s] Resource requirement unchanged\n", __FUNCTION__)); } return NDIS_STATUS_SUCCESS; }
VOID REINITIALIZE_ADAPTER( PVOID ) /*++ Routine Description This routine re-initializes display driver to obtains its DrvCoptBits pointer. This routine executed as a separate thread in the context of CSRSS.EXE Arguments PVOID Thread context, always NULL Return Value None, thread terminates by call PsTerminateSystemThread Environment Separate thread of CSRSS process --*/ { // // This routine runs in the context of csrss.exe // KdPrint(("REINITIALIZE_ADAPTER enter\n")); HANDLE hDrv = EngLoadImage (L"vid_copy.dll"); KdPrint(("vid_copy is %X\n", hDrv)); if (hDrv) { BOOLEAN (NTAPI *pOriginalDrvEnableDriver)( ULONG iEngineVersion, ULONG cj, PDRVENABLEDATA pded ); *(PVOID*)&pOriginalDrvEnableDriver = EngFindImageProcAddress (hDrv, "DrvEnableDriver"); KdPrint(("pOriginalDrvEnableDriver = %X\n", pOriginalDrvEnableDriver)); if (pOriginalDrvEnableDriver) { BOOLEAN Ret; DRVENABLEDATA DrvEnableData = {0}; Ret = pOriginalDrvEnableDriver (DDI_DRIVER_VERSION_NT5_01_SP1, sizeof(DrvEnableData), &DrvEnableData); KdPrint(("pOriginalDrvEnableDriver returned %X\n", Ret)); if (Ret) { for (ULONG i = 0; i<DrvEnableData.c; i++) { if (DrvEnableData.pdrvfn[i].iFunc == INDEX_DrvCopyBits) { KdPrint(("Found DrvCopyBits: %X\n", DrvEnableData.pdrvfn[i].pfn)); HANDLE hKey; wchar_t value[512]; hKey = RegOpenKey (L"\\Registry\\Machine\\Software\\NGdbg", KEY_QUERY_VALUE); if (hKey) { ULONG Len = sizeof(value); if (RegQueryValue (hKey, L"DisplayDriver", REG_SZ, value, &Len)) { KdPrint(("Display driver: %S\n", value)); wcscat (value, L".dll"); PVOID OrigBase = FindImage (value); PVOID VidBase = FindImage (L"vid_copy.dll"); if (OrigBase && VidBase) { ULONG Offset = (ULONG)DrvEnableData.pdrvfn[i].pfn - (ULONG)VidBase; KdPrint(("Offset %X\n", Offset)); pDrvCopyBits = (PUCHAR)OrigBase + Offset; KdPrint(("DrvCopyBits %X\n", pDrvCopyBits)); } else { KdPrint(("FindImage failed: OrigBase %X, VidBase %X\n", OrigBase, VidBase)); } } else { KdPrint(("RegQueryValue failed\n")); } ZwClose (hKey); } else { KdPrint(("RegOpenKey failed\n")); } } } } } EngUnloadImage (hDrv); } KdPrint(("REINITIALIZE_ADAPTER exit\n")); PsTerminateSystemThread (0); }