utils

s_util.c

Go to the documentation of this file.
00001 /* gEDA - GPL Electronic Design Automation
00002  * gschlas - gEDA Load and Save
00003  * Copyright (C) 2002-2010 Ales Hvezda
00004  * Copyright (C) 2002-2010 gEDA Contributors (see ChangeLog for details)
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00019  * MA 02111-1301 USA.
00020  */
00021 
00022 #include <config.h>
00023 
00024 #include <stdio.h>
00025 #include <sys/stat.h>
00026 #ifdef HAVE_STDLIB_H
00027 #include <stdlib.h>
00028 #endif
00029 #ifdef HAVE_ASSERT_H
00030 #include <assert.h>
00031 #endif
00032 #ifdef HAVE_UNISTD_H
00033 #include <unistd.h> 
00034 #endif
00035 
00036 #include <libgeda/libgeda.h>
00037 
00038 #include "../include/prototype.h"
00039 
00040 #ifdef HAVE_LIBDMALLOC
00041 #include <dmalloc.h>
00042 #endif
00043 
00044 /* If embed_mode is true, then embed all components in all pages, */
00045 /* otherwise unembed all components in all pages */
00046 void
00047 s_util_embed(TOPLEVEL *pr_current, int embed_mode)
00048 {
00049   GList *p_iter, *o_iter;
00050 
00051   for (p_iter = geda_list_get_glist (pr_current->pages);
00052        p_iter != NULL;
00053        p_iter = g_list_next (p_iter)) {
00054     PAGE *p_current = p_iter->data;
00055 
00056     /* Cast removes const qualifier from return value of
00057      * s_page_objects() */
00058     for (o_iter = (GList *) s_page_objects (p_current);
00059          o_iter != NULL;
00060          o_iter = g_list_next (o_iter)) {
00061 
00062       OBJECT *o_current = o_iter->data;
00063 
00064       if (o_current->type == OBJ_COMPLEX ||
00065                 o_current->type == OBJ_PICTURE) {
00066         if (embed_mode == TRUE) {
00067           o_embed(pr_current, o_current);
00068         } else {
00069           o_unembed(pr_current, o_current);
00070         }
00071       }
00072 
00073     }
00074   }
00075 }
00076 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines