本文整理汇总了C++中s_log_message函数的典型用法代码示例。如果您正苦于以下问题:C++ s_log_message函数的具体用法?C++ s_log_message怎么用?C++ s_log_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s_log_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: o_picture_unembed
/*! \brief Unembed a picture, reloading the image from disk
*
* \par Function Description
* This function re-reads the image file associated with the picture, and
* discards the embeded copy of the file.
*
* \param [in] toplevel The TOPLEVEL object.
* \param [in] object The picture OBJECT to unembed
*/
void o_picture_unembed (TOPLEVEL *toplevel, OBJECT *object)
{
GError *err = NULL;
GdkPixbuf *pixbuf;
gchar *filename;
pixbuf = gdk_pixbuf_new_from_file (object->picture->filename, &err);
if (err != NULL) {
s_log_message (_("Failed to load image from file [%s]: %s\n"),
object->picture->filename, err->message);
g_error_free (err);
return;
}
/* Change to the new pixbuf loaded from the file. */
if (object->picture->original_picture != NULL)
g_object_unref(object->picture->original_picture);
object->picture->original_picture = pixbuf;
g_free (object->picture->file_content);
object->picture->file_content = NULL;
object->picture->file_length = 0;
object->picture->embedded = 0;
filename = g_path_get_basename(object->picture->filename);
s_log_message (_("Picture [%s] has been unembedded\n"), filename);
g_free(filename);
}
示例2: s_log_message
/*! \brief Add symbol-generating Scheme procedures to the library.
* \par Function Description
* Adds a source to the library based on Scheme procedures. See page
* \ref libscms for more information. Two procedures are required: \a
* listfunc must return a Scheme list of symbol names, and \a getfunc
* must return a string containing symbol data when passed a symbol
* name.
*
* \param listfunc A Scheme function returning a list of symbols.
* \param getfunc A Scheme function returning symbol data.
* \param name A descriptive name for the component source.
*
* \return The new CLibSource.
*/
const CLibSource *s_clib_add_scm (SCM listfunc, SCM getfunc, const gchar *name)
{
CLibSource *source;
gchar *realname;
if (name == NULL) {
s_log_message (_("Cannot add library: name not specified."));
return NULL;
}
realname = uniquify_source_name (name);
if (scm_is_false (scm_procedure_p (listfunc))
&& scm_is_false (scm_procedure_p (getfunc))) {
s_log_message (_("Cannot add Scheme-library [%1$s]: callbacks must be closures."),
realname);
return NULL;
}
source = g_new0 (CLibSource, 1);
source->type = CLIB_SCM;
source->name = realname;
source->list_fn = scm_gc_protect_object (listfunc);
source->get_fn = scm_gc_protect_object (getfunc);
refresh_scm (source);
clib_sources = g_list_prepend (clib_sources, source);
return source;
}
示例3: g_set_error
/*! \brief read a net object from a char buffer
* \par Function Description
* This function reads a net object from the buffer \a buf.
* If the netobject was read successfully, a new net object is
* allocated and appended to the \a object_list.
*
* \param [in] toplevel The TOPLEVEL object
* \param [in] buf a text buffer (usually a line of a schematic file)
* \param [in] release_ver The release number gEDA
* \param [in] fileformat_ver a integer value of the file format
* \return The object list, or NULL on error.
*
*/
OBJECT *o_net_read (TOPLEVEL *toplevel, const char buf[],
unsigned int release_ver, unsigned int fileformat_ver, GError **err)
{
OBJECT *new_obj;
char type;
int x1, y1;
int x2, y2;
int color;
if (sscanf (buf, "%c %d %d %d %d %d\n", &type, &x1, &y1, &x2, &y2, &color) != 6) {
g_set_error(err, EDA_ERROR, EDA_ERROR_PARSE, _("Failed to parse net object"));
return NULL;
}
if (x1 == x2 && y1 == y2) {
s_log_message (_("Found a zero length net [ %c %d %d %d %d %d ]\n"),
type, x1, y1, x2, y2, color);
}
if (toplevel->override_net_color != -1) {
color = toplevel->override_net_color;
}
if (color < 0 || color > MAX_COLORS) {
s_log_message (_("Found an invalid color [ %s ]\n"), buf);
s_log_message (_("Setting color to default color\n"));
color = DEFAULT_COLOR;
}
new_obj = o_net_new (toplevel, type, color, x1, y1, x2, y2);
return new_obj;
}
示例4: g_rc_parse__process_error
static void
g_rc_parse__process_error (GError **err, const gchar *pname)
{
char *pbase;
/* Take no chances; if err was not set for some reason, bail out. */
if (*err == NULL) {
const gchar *msgl =
_("ERROR: An unknown error occurred while parsing configuration files.");
s_log_message ("%s\n", msgl);
fprintf(stderr, "%s\n", msgl);
} else {
/* Config files are allowed to be missing or skipped; check for
* this. */
if (g_error_matches (*err, G_FILE_ERROR, G_FILE_ERROR_NOENT) ||
g_error_matches (*err, EDA_ERROR, EDA_ERROR_RC_TWICE)) {
return;
}
s_log_message (_("ERROR: %s\n"), (*err)->message);
fprintf (stderr, _("ERROR: %s\n"), (*err)->message);
}
/* g_path_get_basename() allocates memory, but we don't care
* because we're about to exit. */
pbase = g_path_get_basename (pname);
fprintf (stderr, _("ERROR: The %s log may contain more information.\n"),
pbase);
exit (1);
}
示例5: s_page_save_all
/*! \brief Saves all the pages of a TOPLEVEL object.
* \par Function Description
* Saves all the pages in the <B>toplevel</B> parameter.
*
* \param [in] toplevel The TOPLEVEL to save pages from.
* \return The number of failed tries to save a page.
*/
gint s_page_save_all (TOPLEVEL *toplevel)
{
const GList *iter;
PAGE *p_current;
gint status = 0;
for ( iter = geda_list_get_glist( toplevel->pages );
iter != NULL;
iter = g_list_next( iter ) ) {
p_current = (PAGE *)iter->data;
if (f_save (toplevel, p_current,
p_current->page_filename, NULL)) {
s_log_message (_("Saved [%s]\n"),
p_current->page_filename);
/* reset the CHANGED flag of p_current */
p_current->CHANGED = 0;
} else {
s_log_message (_("Could NOT save [%s]\n"),
p_current->page_filename);
/* increase the error counter */
status++;
}
}
return status;
}
示例6: sscanf
/*! \brief
* \par Function Description
* This function reads a formatted text buffer describing an arc
* in the gEDA file format and initializes the corresponding object.
*
* Depending on the version of the file format the data extraction is
* performed differently : currently pre-20000704 and 20000704 on one
* hand and post-20000704 file format version on the other hand are supported.
* The version is specified in string pointed by <B>fileformat_ver</B>.
*
* To get information on the various file formats have a
* look to the fileformats.html document.
*
* The object is initialized with the functions #o_set_line_options() and #o_set_fill_options().
* The second one is only used to put initialize unused values for an arc as an arc can not be filled.
*
* The arc is allocated initialized with the function #o_arc_new().
*
* A negative or null radius is not allowed.
*
* \param [in] toplevel The TOPLEVEL object.
* \param [in] buf
* \param [in] release_ver
* \param [in] fileformat_ver
* \return
*/
OBJECT *o_arc_read (TOPLEVEL *toplevel, char buf[],
unsigned int release_ver, unsigned int fileformat_ver)
{
OBJECT *new_obj;
char type;
int x1, y1;
int radius;
int start_angle, end_angle;
int color;
int arc_width, arc_length, arc_space;
int arc_type;
int arc_end;
/*! \note
* Depending on the version of the file format used to describe this arc,
* the buffer is parsed differently. The unknown parameters of the less
* restrictive - the oldest - file format are set to common values
*/
if(release_ver <= VERSION_20000704) {
sscanf(buf, "%c %d %d %d %d %d %d", &type,
&x1, &y1, &radius, &start_angle, &end_angle, &color);
arc_width = 0;
arc_end = END_NONE;
arc_type = TYPE_SOLID;
arc_space = -1;
arc_length= -1;
} else {
sscanf(buf, "%c %d %d %d %d %d %d %d %d %d %d %d", &type,
&x1, &y1, &radius, &start_angle, &end_angle, &color,
&arc_width, &arc_end, &arc_type, &arc_length, &arc_space);
}
/* Error check */
if (radius <= 0) {
s_log_message (_("Found a zero radius arc [ %c %d, %d, %d, %d, %d, %d ]\n"),
type, x1, y1, radius, start_angle, end_angle, color);
}
if (color < 0 || color > MAX_COLORS) {
s_log_message(_("Found an invalid color [ %s ]\n"), buf);
s_log_message(_("Setting color to default color\n"));
color = DEFAULT_COLOR;
}
/* Allocation and initialization */
new_obj = o_arc_new(toplevel, OBJ_ARC, color,
x1, y1, radius, start_angle, end_angle);
o_set_line_options(toplevel, new_obj,
arc_end, arc_type, arc_width, arc_length,
arc_space);
o_set_fill_options(toplevel, new_obj,
FILLING_HOLLOW, -1, -1, -1,
-1, -1);
return new_obj;
}
示例7: refresh_scm
/*! \brief Re-poll a scheme procedure for symbols.
* \par Function Description
* Calls a Scheme procedure to obtain a list of available symbols,
* and updates the source with the new list
*
* Private function used only in s_clib.c.
*/
static void refresh_scm (CLibSource *source)
{
SCM symlist;
SCM symname;
CLibSymbol *symbol;
char *tmp;
g_return_if_fail (source != NULL);
g_return_if_fail (source->type == CLIB_SCM);
/* Clear the current symbol list */
g_list_foreach (source->symbols, (GFunc) free_symbol, NULL);
g_list_free (source->symbols);
source->symbols = NULL;
symlist = scm_call_0 (source->list_fn);
if (scm_is_false (scm_list_p (symlist))) {
s_log_message (_("Failed to scan library [%1$s]: Scheme function returned non-list."),
source->name);
return;
}
while (!scm_is_null (symlist)) {
symname = SCM_CAR (symlist);
if (!scm_is_string (symname)) {
s_log_message (_("Non-string symbol name while scanning library [%1$s]"),
source->name);
} else {
symbol = g_new0 (CLibSymbol, 1);
symbol->source = source;
/* Need to make sure that the correct free() function is called
* on strings allocated by Guile. */
tmp = scm_to_utf8_string (symname);
symbol->name = g_strdup(tmp);
free (tmp);
/* Prepend because it's faster and it doesn't matter what order we
* add them. */
source->symbols = g_list_prepend (source->symbols, symbol);
}
symlist = SCM_CDR (symlist);
}
/* Now sort the list of symbols by name. */
source->symbols = g_list_sort (source->symbols,
(GCompareFunc) compare_symbol_name);
s_clib_flush_search_cache();
s_clib_flush_symbol_cache();
}
示例8: g_funcs_browse_wiki
/*! \brief Use gschemdoc to open a browser to a specific wiki page
*
* \param [in] wikiname the name of the wiki page
*
* \par Function Description
* Invokes gschemdoc with its -w switch to open a browser to the wiki
* page specified by wikiname. If wikiname is empty or not a string,
* will browse to the main wiki page.
*/
SCM g_funcs_browse_wiki(SCM wikiname)
{
char *wikistr;
int pid;
/* Extract wiki name string from Scheme value structure.
* If not a string, use the empty string */
if (scm_is_string (wikiname)) {
wikistr = scm_to_utf8_string(wikiname);
} else {
wikistr = "";
}
#ifndef __MINGW32__
pid = fork();
if (pid < 0) {
/* Fork failed. Still in parent process, so can use the log
* window */
if (scm_is_string (wikiname))
free(wikistr);
s_log_message(_("Could not fork\n"));
return SCM_BOOL_F;
} else if (pid > 0) {
/* Parent process, we're finished here */
if (scm_is_string (wikiname))
free(wikistr);
return SCM_BOOL_T;
}
/* begin daughter process stuff */
/* assume gschemdoc is part of path */
char *gschemdoc = "gschemdoc";
char *wikiarg = "-w";
execlp(gschemdoc, gschemdoc, wikiarg, wikistr, NULL);
/* if we return, then nothing happened */
fprintf(stderr, _("Could not invoke %s\n"), gschemdoc);
_exit(0);
/* end daughter process stuff */
#else /* __MINGW32__ */
s_log_message(_("Documentation commands not supported under MinGW.\n"));
return SCM_BOOL_F;
#endif /* __MINGW32__ */
}
示例9: s_symstruct_print
void
s_symstruct_print(SYMCHECK *s_current)
{
GList *list;
char *msg;
if (verbose_mode > 2) {
list = s_current->info_messages;
while (list != NULL) {
msg = (char *) list->data;
/* printf("found info: %s\n", msg); */
if (msg) {
s_log_message(_("Info: %1$s"), msg);
g_free(msg);
}
list = g_list_next(list);
}
}
if (verbose_mode > 1) {
list = s_current->warning_messages;
while (list != NULL) {
msg = (char *) list->data;
/* printf("found warning: %s\n", msg); */
if (msg) {
s_log_message(_("Warning: %1$s"), msg);
g_free(msg);
}
list = g_list_next(list);
}
}
if (verbose_mode > 0) {
list = s_current->error_messages;
while (list != NULL) {
msg = (char *) list->data;
/* printf("found error: %s\n", msg); */
if (msg && verbose_mode) {
s_log_message(_("ERROR: %1$s"), msg);
g_free(msg);
}
list = g_list_next(list);
}
}
}
示例10: g_set_error
/*! \brief read a pin object from a char buffer
* \par Function Description
* This function reads a pin object from the buffer \a buf.
* If the pin object was read successfully, a new pin object is
* allocated and appended to the \a object_list.
*
* \param [in] toplevel The TOPLEVEL object
* \param [in] buf a text buffer (usually a line of a schematic file)
* \param [in] release_ver The release number gEDA
* \param [in] fileformat_ver a integer value of the file format
* \return The object list, or NULL on error.
*/
OBJECT *o_pin_read (TOPLEVEL *toplevel, const char buf[],
unsigned int release_ver, unsigned int fileformat_ver, GError **err)
{
OBJECT *new_obj;
char type;
int x1, y1;
int x2, y2;
int color;
int pin_type;
int whichend;
if (release_ver <= VERSION_20020825) {
if (sscanf (buf, "%c %d %d %d %d %d\n", &type, &x1, &y1, &x2, &y2, &color) != 6) {
g_set_error(err, EDA_ERROR, EDA_ERROR_PARSE, _("Failed to parse pin object"));
return NULL;
}
pin_type = PIN_TYPE_NET;
whichend = -1;
} else {
if (sscanf (buf, "%c %d %d %d %d %d %d %d\n", &type, &x1, &y1, &x2, &y2,
&color, &pin_type, &whichend) != 8) {
g_set_error(err, EDA_ERROR, EDA_ERROR_PARSE, _("Failed to parse pin object"));
return NULL;
}
}
if (whichend == -1) {
s_log_message (_("Found a pin which did not have the whichone field set.\n"
"Verify and correct manually.\n"));
} else if (whichend < -1 || whichend > 1) {
s_log_message (_("Found an invalid whichend on a pin (reseting to zero): %d\n"),
whichend);
whichend = 0;
}
if (color < 0 || color > MAX_COLORS) {
s_log_message (_("Found an invalid color [ %s ]\n"), buf);
s_log_message (_("Setting color to default color\n"));
color = DEFAULT_COLOR;
}
if (toplevel->override_pin_color != -1) {
color = toplevel->override_pin_color;
}
new_obj = o_pin_new (toplevel, type, color, x1, y1, x2, y2,
pin_type, whichend);
return new_obj;
}
示例11: g_set_error
/*! \brief read a bus object from a char buffer
* \par Function Description
* This function reads a bus object from the buffer \a buf.
* If the bus object was read successfully, a new bus object is
* allocated and appended to the \a object_list.
*
* \param [in] toplevel The TOPLEVEL object
* \param [in] buf a text buffer (usually a line of a schematic file)
* \param [in] release_ver The release number gEDA
* \param [in] fileformat_ver a integer value of the file format
* \return The object list, or NULL on error.
*/
OBJECT *o_bus_read (TOPLEVEL *toplevel, const char buf[],
unsigned int release_ver, unsigned int fileformat_ver, GError **err)
{
OBJECT *new_obj;
char type;
int x1, y1;
int x2, y2;
int color;
int ripper_dir;
if (release_ver <= VERSION_20020825) {
if (sscanf (buf, "%c %d %d %d %d %d\n", &type, &x1, &y1, &x2, &y2, &color) != 6) {
g_set_error(err, EDA_ERROR, EDA_ERROR_PARSE, _("Failed to parse bus object"));
return NULL;
}
ripper_dir = 0;
} else {
if (sscanf (buf, "%c %d %d %d %d %d %d\n", &type, &x1, &y1, &x2, &y2, &color,
&ripper_dir) != 7) {
g_set_error(err, EDA_ERROR, EDA_ERROR_PARSE, _("Failed to parse bus object"));
return NULL;
}
}
if (x1 == x2 && y1 == y2) {
s_log_message (_("Found a zero length bus [ %c %d %d %d %d %d ]\n"),
type, x1, y1, x2, y2, color);
}
if (toplevel->override_bus_color != -1) {
color = toplevel->override_bus_color;
}
if (color < 0 || color > MAX_COLORS) {
s_log_message (_("Found an invalid color [ %s ]\n"), buf);
s_log_message (_("Setting color to default color\n"));
color = DEFAULT_COLOR;
}
if (ripper_dir < -1 || ripper_dir > 1) {
s_log_message (_("Found an invalid bus ripper direction [ %s ]\n"), buf);
s_log_message (_("Resetting direction to neutral (no direction)\n"));
ripper_dir = 0;
}
new_obj = o_bus_new (toplevel, type, color, x1, y1, x2, y2, ripper_dir);
return new_obj;
}
示例12: o_unlock
/* this cannot be called recursively */
void o_unlock(GschemToplevel *w_current)
{
OBJECT *object = NULL;
GList *s_current = NULL;
s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while(s_current != NULL) {
object = (OBJECT *) s_current->data;
if (object) {
/* only unlock if the object is locked */
if (object->selectable == FALSE) {
object->selectable = TRUE;
object->color = object->locked_color;
object->locked_color = -1;
gschem_toplevel_page_content_changed (w_current, w_current->toplevel->page_current);
} else {
s_log_message(_("Object already unlocked\n"));
}
}
s_current = g_list_next(s_current);
}
o_undo_savestate_old(w_current, UNDO_ALL);
}
示例13: o_lock
/* This locks the entire selected list. It does lock components, but does NOT
* change the color (of primatives of the components) though
* this cannot be called recursively */
void o_lock(GSCHEM_TOPLEVEL *w_current)
{
OBJECT *object = NULL;
GList *s_current = NULL;
/* skip over head */
s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while(s_current != NULL) {
object = (OBJECT *) s_current->data;
if (object) {
/* check to see if locked_color is already being used */
if (object->locked_color == -1) {
object->selectable = FALSE;
object->locked_color = object->color;
object->color = LOCK_COLOR;
w_current->toplevel->page_current->CHANGED=1;
} else {
s_log_message(_("Object already locked\n"));
}
}
s_current = g_list_next(s_current);
}
if (!w_current->SHIFTKEY) o_select_unselect_all(w_current);
o_undo_savestate(w_current, UNDO_ALL);
i_update_menus(w_current);
}
示例14: o_unlock
/* this cannot be called recursively */
void o_unlock(GSCHEM_TOPLEVEL *w_current)
{
OBJECT *object = NULL;
GList *s_current = NULL;
s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while(s_current != NULL) {
object = (OBJECT *) s_current->data;
if (object) {
/* only unlock if the object is locked */
if (object->selectable == FALSE) {
object->selectable = TRUE;
object->color = object->locked_color;
object->locked_color = -1;
w_current->toplevel->page_current->CHANGED = 1;
} else {
s_log_message(_("Object already unlocked\n"));
}
}
s_current = g_list_next(s_current);
}
o_undo_savestate(w_current, UNDO_ALL);
}
示例15: o_embed
/*! \brief embed an object into a schematic
* \par Function Description
* This functions embeds an object \a o_current into a
* libgeda. Currently complex objects are just marked to
* be embedded later. Picture objects are embedded immediatly.
*
* \param toplevel The TOPLEVEL object
* \param o_current The OBJECT to embed
*/
void o_embed(TOPLEVEL *toplevel, OBJECT *o_current)
{
PAGE *page = o_get_page_compat (toplevel, o_current);
int page_modified = 0;
/* check o_current is a complex and is not already embedded */
if (o_current->type == OBJ_COMPLEX &&
!o_complex_is_embedded (o_current))
{
/* set the embedded flag */
o_current->complex_embedded = TRUE;
s_log_message (_("Component [%s] has been embedded\n"),
o_current->complex_basename);
page_modified = 1;
}
/* If it's a picture and it's not embedded */
if ( (o_current->type == OBJ_PICTURE) &&
!o_picture_is_embedded (toplevel, o_current) ) {
o_picture_embed (toplevel, o_current);
page_modified = 1;
}
if (page_modified && page != NULL) {
/* page content has been modified */
page->CHANGED = 1;
}
}