Bumped versions to 1.1.2/20070818/30:2:0 for the next development snapshot
[geda-gaf/whiteaudio.git] / utils / gschlas / s_util.c
blobb656bb893ba151a234e15508a344d9c61ab5eacd
1 /* gEDA - GPL Electronic Design Automation
2 * gschlas - gEDA Load and Save
3 * Copyright (C) 2002-2007 Ales Hvezda
4 * Copyright (C) 2002-2007 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <config.h>
23 #include <stdio.h>
24 #include <sys/stat.h>
25 #ifdef HAVE_STDLIB_H
26 #include <stdlib.h>
27 #endif
28 #ifdef HAVE_ASSERT_H
29 #include <assert.h>
30 #endif
31 #ifdef HAVE_UNISTD_H
32 #include <unistd.h>
33 #endif
35 #include <libgeda/libgeda.h>
37 #include "../include/prototype.h"
39 #ifdef HAVE_LIBDMALLOC
40 #include <dmalloc.h>
41 #endif
43 /* If embed_mode is true, then embed all components in all pages, */
44 /* otherwise unembed all components in all pages */
45 void
46 s_util_embed(TOPLEVEL *pr_current, int embed_mode)
48 PAGE *p_current;
49 OBJECT *o_current;
51 p_current = pr_current->page_head;
53 while (p_current != NULL) {
55 o_current = p_current->object_head;
57 if (p_current->pid != -1) {
59 while (o_current != NULL) {
61 if (o_current->type == OBJ_COMPLEX ||
62 o_current->type == OBJ_PICTURE) {
63 if (embed_mode == TRUE) {
64 o_embed(pr_current, o_current);
65 } else {
66 o_unembed(pr_current, o_current);
70 o_current = o_current->next;
74 p_current = p_current->next;