当前位置: 首页>>代码示例>>C++>>正文


C++ Melder_flushError函数代码示例

本文整理汇总了C++中Melder_flushError函数的典型用法代码示例。如果您正苦于以下问题:C++ Melder_flushError函数的具体用法?C++ Melder_flushError怎么用?C++ Melder_flushError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Melder_flushError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Melder_realloc_f

void * Melder_realloc_f (void *ptr, int64 size) {
	void *result;
	if (size <= 0)
		Melder_fatal (U"(Melder_realloc_f:) Can never allocate ", Melder_bigInteger (size), U" bytes.");
	if (sizeof (size_t) < 8 && size > SIZE_MAX)
		Melder_fatal (U"(Melder_realloc_f:) Can never allocate ", Melder_bigInteger (size), U" bytes.");
	result = realloc (ptr, (size_t) size);   // will not show in the statistics...
	if (result == NULL) {
		if (theRainyDayFund != NULL) { free (theRainyDayFund); theRainyDayFund = NULL; }
		result = realloc (ptr, (size_t) size);
		if (result != NULL) {
			Melder_flushError (U"Praat is very low on memory.\nSave your work and quit Praat.\nIf you don't do that, Praat may crash.");
		} else {
			Melder_fatal (U"Out of memory. Could not extend room to ", Melder_bigInteger (size), U" bytes.");
		}
	}
	if (ptr == NULL) {   // is it like malloc?
		totalNumberOfAllocations += 1;
		totalAllocationSize += size;
	} else if (result != ptr) {   // did realloc do a malloc-and-free?
		totalNumberOfAllocations += 1;
		totalAllocationSize += size;
		totalNumberOfDeallocations += 1;
		totalNumberOfMovingReallocs += 1;
	} else {
		totalNumberOfReallocsInSitu += 1;
	}
	return result;
}
开发者ID:davideberdin,项目名称:praat,代码行数:29,代码来源:melder_alloc.cpp

示例2: v_goAway

void structScriptEditor :: v_goAway () {
	if (interpreter -> running) {
		Melder_flushError (U"Cannot close the script window while the script is running or paused. Please close or continue the pause or demo window.");
	} else {
		ScriptEditor_Parent :: v_goAway ();
	}
}
开发者ID:eginhard,项目名称:praat,代码行数:7,代码来源:ScriptEditor.cpp

示例3: Picture_print

void Picture_print (Picture me) {
	try {
		Printer_print (print, me);
	} catch (MelderError) {
		Melder_flushError (U"Picture not printed.");
	}
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:7,代码来源:Picture.cpp

示例4: _GuiGtkDrawingArea_exposeCallback

	static gboolean _GuiGtkDrawingArea_exposeCallback (GuiObject widget, GdkEventExpose *expose, gpointer void_me) {
		trace (U"begin");
		iam (GuiDrawingArea);
		Melder_assert (me);
		// TODO: that helps against the damaged regions outside the rect where the
		// Graphics drawing is done, but where does that margin come from in the
		// first place?? Additionally this causes even more flickering
		//gdk_window_clear_area ((GTK_WIDGET (widget)) -> window, expose->area.x, expose->area.y, expose->area.width, expose->area.height);
		if (my d_exposeCallback) {
			struct structGuiDrawingArea_ExposeEvent event { me, 0 };
			event. x = expose -> area. x;
			event. y = expose -> area. y;
			event. width = expose -> area. width;
			event. height = expose -> area. height;
			try {
				//GdkRectangle rect = { event. x, event. y, event. width, event. height };
				//gdk_window_begin_paint_rect ((GTK_WIDGET (widget)) -> window, & rect);
				trace (U"send the expose callback");
				trace (U"locale is ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
				my d_exposeCallback (my d_exposeBoss, & event);
				trace (U"the expose callback finished");
				trace (U"locale is ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
				//gdk_window_end_paint ((GTK_WIDGET (widget)) -> window);
				//gdk_window_flush ((GTK_WIDGET (widget)) -> window);
				//gdk_flush ();
			} catch (MelderError) {
				Melder_flushError (U"Redrawing not completed");
			}
			trace (U"the expose callback handled drawing");
			return true;
		}
		trace (U"GTK will handle redrawing");
		return false;
	}
开发者ID:READSEARCH,项目名称:praat,代码行数:34,代码来源:GuiDrawingArea.cpp

示例5: _GuiGtkDrawingArea_keyCallback

	static gboolean _GuiGtkDrawingArea_keyCallback (GuiObject widget, GdkEvent *gevent, gpointer void_me) {
		iam (GuiDrawingArea);
		trace (U"begin");
		if (my d_keyCallback && gevent -> type == GDK_KEY_PRESS) {
			struct structGuiDrawingArea_KeyEvent event { me, 0 };
			GdkEventKey *gkeyEvent = (GdkEventKey *) gevent;
			event. key = gkeyEvent -> keyval;
			/*
			 * Translate with the help of /usr/include/gtk-2.0/gdk/gdkkeysyms.h
			 */
			if (event. key == GDK_KEY_Escape) event. key = 27;
			if (event. key == GDK_KEY_Left)   event. key = 0x2190;
			if (event. key == GDK_KEY_Up)     event. key = 0x2191;
			if (event. key == GDK_KEY_Right)  event. key = 0x2192;
			if (event. key == GDK_KEY_Down)   event. key = 0x2193;
			event. shiftKeyPressed = (gkeyEvent -> state & GDK_SHIFT_MASK) != 0;
			event. commandKeyPressed = (gkeyEvent -> state & GDK_CONTROL_MASK) != 0;
			event. optionKeyPressed = (gkeyEvent -> state & GDK_MOD1_MASK) != 0;
			event. extraControlKeyPressed = false;
			try {
				my d_keyCallback (my d_keyBoss, & event);
			} catch (MelderError) {
				Melder_flushError (U"Key press not completely handled.");
			}
			/*
			 * FIXME: here we should empty the type-ahead buffer
			 */
			return true;
		}
		return false;   // if the drawing area has no keyCallback, the system will send the key press to a text field.
	}
开发者ID:READSEARCH,项目名称:praat,代码行数:31,代码来源:GuiDrawingArea.cpp

示例6: Melder_realloc_f

void * Melder_realloc_f (void *ptr, long size) {
	void *result;
	if (size <= 0)
		Melder_fatal ("(Melder_realloc_f:) Can never allocate %ld bytes.", size);
	result = realloc (ptr, size);   /* Will not show in the statistics... */
	if (result == NULL) {
		if (theRainyDayFund != NULL) free (theRainyDayFund);
		result = realloc (ptr, size);
		if (result != NULL) {
			Melder_flushError ("Praat is very low on memory.\nSave your work and quit Praat.\nIf you don't do that, Praat may crash.");
		} else {
			Melder_fatal ("Out of memory. Could not extend room to %ld bytes.", size);
		}
	}
	if (ptr == NULL) {   /* Is it like malloc? */
		totalNumberOfAllocations += 1;
		totalAllocationSize += size;
	} else if (result != ptr) {   /* Did realloc do a malloc-and-free? */
		totalNumberOfAllocations += 1;
		totalAllocationSize += size;
		totalNumberOfDeallocations += 1;
		totalNumberOfMovingReallocs += 1;
	} else {
		totalNumberOfReallocsInSitu += 1;
	}
	return result;
}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:27,代码来源:melder_alloc.cpp

示例7: Pitch_difference

void Pitch_difference (Pitch me, Pitch thee) {
	long nuvtov = 0, nvtouv = 0, ndfdown = 0, ndfup = 0;
	if (my nx != thy nx || my dx != thy dx || my x1 != thy x1) {
		Melder_flushError ("Pitch_difference: these Pitches are not aligned.");
		return;
	}
	for (long i = 1; i <= my nx; i ++) {
		double myf = my frame [i]. candidate [1]. frequency, thyf = thy frame [i]. candidate [1]. frequency;
		int myUnvoiced = myf == 0 || myf > my ceiling;
		int thyUnvoiced = thyf == 0 || thyf > thy ceiling;
		double t = Sampled_indexToX (me, i);
		if (myUnvoiced && ! thyUnvoiced) {
			Melder_casual ("Frame %ld time %f: unvoiced to voiced.", i, t);
			nuvtov ++;
		} else if (! myUnvoiced && thyUnvoiced) {
			Melder_casual ("Frame %ld time %f: voiced to unvoiced.", i, t);
			nvtouv ++;
		} else if (! myUnvoiced && ! thyUnvoiced) {
			if (myf > thyf) {
				//Melder_casual ("Frame %ld time %f: downward frequency jump from %.5g Hz to %.5g Hz.", i, t, myf, thyf);
				ndfdown ++;
			} else if (myf < thyf) {
				//Melder_casual ("Frame %ld time %f: upward frequency jump from %.5g Hz to %.5g Hz.", i, t, myf, thyf);
				ndfup ++;
			}
		}
	}
	MelderInfo_open ();
	MelderInfo_writeLine (L"Difference between two Pitches:");
	MelderInfo_writeLine (L"Unvoiced to voiced: ", Melder_integer (nuvtov), L" frames.");
	MelderInfo_writeLine (L"Voiced to unvoiced: ", Melder_integer (nvtouv), L" frames.");
	MelderInfo_writeLine (L"Downward frequency jump: ", Melder_integer (ndfdown), L" frames.");
	MelderInfo_writeLine (L"Upward frequency jump: ", Melder_integer (ndfup), L" frames.");
	MelderInfo_close ();
}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:35,代码来源:Pitch.cpp

示例8: _GuiGtkButton_activateCallback

	static void _GuiGtkButton_activateCallback (GuiObject widget, gpointer userData) {
		GuiButton me = (GuiButton) userData;
		struct structGuiButtonEvent event { me, false, false, false, false };
		if (my d_activateCallback) {
			try {
				my d_activateCallback (my d_activateBoss, & event);
			} catch (MelderError) {
				Melder_flushError (U"Your click on button \"", Melder_peek8to32 (GTK_WIDGET (widget) -> name), U"\" was not completely handled.");
			}
		}
	}
开发者ID:DsRQuicke,项目名称:praat,代码行数:11,代码来源:GuiButton.cpp

示例9: _GuiGtkButton_activateCallback

	static void _GuiGtkButton_activateCallback (GuiObject widget, gpointer void_me) {
		iam (GuiButton);
		struct structGuiButtonEvent event = { me, 0 };
		if (my d_activateCallback != NULL) {
			try {
				my d_activateCallback (my d_activateBoss, & event);
			} catch (MelderError) {
				Melder_flushError (U"Your click on button \"", Melder_peek8to32 (GTK_WIDGET (widget) -> name), U"\" was not completely handled.");
			}
		}
	}
开发者ID:psibre,项目名称:praat,代码行数:11,代码来源:GuiButton.cpp

示例10: GuiFileSelect_getOutfileName

void UiOutfile::do_ (const wchar_t *defaultName) {
	wchar_t *outfileName = GuiFileSelect_getOutfileName (NULL, _name, defaultName);
	if (outfileName == NULL) return;   // cancelled
	if (_allowExecutionHook && ! _allowExecutionHook (_allowExecutionClosure)) {
		Melder_flushError ("Dialog `%s' cancelled.", _name);
		return;
	}
	Melder_pathToFile (outfileName, & _file);
	structMelderFile file;
	MelderFile_copy (& _file, & file);   // save, because okCallback could destroy me
	UiForm::history.write (L"\n");
	UiForm::history.write (_invokingButtonTitle);
	if (! _okCallback (this, NULL, NULL, _invokingButtonTitle, false, _okClosure)) {
		Melder_error3 (L"File ", MelderFile_messageName (& file), L" not finished.");
		Melder_flushError (NULL);
	}
	UiForm::history.write (L" ");
	UiForm::history.write (outfileName);
	Melder_free (outfileName);
}
开发者ID:alekstorm,项目名称:tala,代码行数:20,代码来源:UiFile.cpp

示例11: _GuiWinButton_handleClick

	void _GuiWinButton_handleClick (GuiObject widget) {
		iam_button;
		if (my activateCallback != NULL) {
			struct structGuiButtonEvent event = { widget, 0 };
			try {
				my activateCallback (my activateBoss, & event);
			} catch (MelderError) {
				Melder_error_ ("Your click on button \"", widget -> name, "\" was not completely handled.");
				Melder_flushError (NULL);
			}
		}
	}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:12,代码来源:GuiButton.cpp

示例12: menu_cb_reopen

static void menu_cb_reopen (TextEditor me, EDITOR_ARGS_DIRECT) {
	if (my name [0]) {
		try {
			openDocument (me, & my file);
		} catch (MelderError) {
			Melder_flushError ();
			return;
		}
	} else {
		Melder_throw (U"Cannot reopen from disk, because the text has never been saved yet.");
	}
}
开发者ID:ffostertw,项目名称:praat,代码行数:12,代码来源:TextEditor.cpp

示例13: menu_cb_save

static void menu_cb_save (TextEditor me, EDITOR_ARGS_CMD) {
	if (my name [0]) {
		try {
			saveDocument (me, & my file);
		} catch (MelderError) {
			Melder_flushError ();
			return;
		}
	} else {
		menu_cb_saveAs (me, cmd, nullptr, 0, nullptr, nullptr, nullptr);
	}
}
开发者ID:ffostertw,项目名称:praat,代码行数:12,代码来源:TextEditor.cpp

示例14: main

int main (int argc, char *argv []) {
	try {
		praat_setLogo (130, 80, logo);
		praat_init ("Praat", argc, argv);
		INCLUDE_LIBRARY (praat_uvafon_init)
		INCLUDE_LIBRARY (praat_contrib_Ola_KNN_init)
		praat_run ();
	} catch (MelderError) {
		Melder_flushError ("This error message percolated all the way to the top.");   // an attempt to catch Apache errors
	}
	return 0;
}
开发者ID:danrasband,项目名称:libpraat,代码行数:12,代码来源:main_Praat.cpp

示例15: _GuiMacDrawingArea_shellResize

		void _GuiMacDrawingArea_shellResize (GuiObject widget) {
			iam_drawingarea;
			if (my resizeCallback) {
				struct structGuiDrawingAreaResizeEvent event = { widget, 0 };
				event. width = widget -> width;
				event. height = widget -> height;
				try {
					my resizeCallback (my resizeBoss, & event);
				} catch (MelderError) {
					Melder_flushError ("Window resizing not completely handled.");
				}
			}
		}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:13,代码来源:GuiDrawingArea.cpp


注:本文中的Melder_flushError函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。