Next: Core object functions, Up: Core API Reference [Contents][Index]

### 2.1 Core page functions

To use the functions described in this section, you will need to load the `(lepton page)` module.

See Pages.

Function: page? obj ¶

  Returns ‘`#t`’ if and only if obj is a `page`.

Function: active-pages ¶

  Returns a list of all open `page`s.

#### 2.1.1 Page creation, disposal and filenames

Every `page` is associated with a filename. The filename does not necessarily have to be a file which exists and/or is accessible in the filesystem.

Function: make-page filename ¶

  Creates and returns a new, empty `page`, with the given string filename.

Function: close-page! page ¶

  Destroys page. The returned value is undefined.

  Warning: This function closes and destroys page immediately, regardless of whether the page has been modified since loading or saving, and without asking the user.

Function: page-filename page ¶

  Returns the filename associated with page as a string.

Function: set-page-filename! page filename ¶

  Sets the filename of page to filename. Returns page.

#### 2.1.2 Conversion between files and pages

Pages can be converted to and from files in the gEDA schematic file format.

Function: file->page filename [new-page?] ¶

  Return a `page` for filename which must be a string. If such a page has been already opened, that page is returned, otherwise a new page is created. If new-page? is not ‘`#f`’, new page creation is forced. Returns the resulting `page`.

#### 2.1.3 Page serialisation

Pages can be converted to and from strings in the gEDA schematic file format.

Function: string->page filename string ¶

  Parses string, which should be in the gEDA file format, to create a new `page`. The initial filename for the new `page` is filename.

  If the string is not in gEDA format, raises an `string-format` error.

Function: page->string page ¶

  Returns a string representation of page in the gEDA file format.

#### 2.1.4 Page contents

A schematic or symbol `page` is composed of a set of `object`s which determine both its graphical appearance and its electrical meaning.

Function: page-contents page ¶

  Returns a list of the `object`s which make up page. The list can be freely modified without changing the contents of page.

Function: page-append! page objects... ¶

  Appends zero or more objects to the contents of page in the order given. Returns page.

  If any of the objects is already part of a `page` other than page, or is part of a component `object`, raises an `object-state` error. Any of the objects that are already in the page are ignored.

Function: page-remove! page objects... ¶

  Removes zero or more objects from the contents of page. Returns page.

  Any objects that are not part of a `page` or component `object` are ignored.

  An ‘`object-state`’ error will be thrown if any of the objects satisfies any of the following conditions:

  - part of a `page` other than page;
  - part of component `object`;
  - has attached attributes (see Attributes);
  - is attached as an attribute.

Function: object-page object ¶

  Returns the `page` which contains object (either directly or indirectly), or ‘`#f`’ if object is not part of a `page`.

  Note: If the object argument to `object-page` is part of a component `object` which is itself part of a `page`, that `page` will be returned.

#### 2.1.5 Page dirty flags

A `page` has a dirty flag that is used to indicate to applications that the `page` has been modified since it was last loaded or saved.

Function: page-dirty? page ¶

  Returns ‘`#t`’ if the page’s page has been marked as dirty; otherwise, returns ‘`#f`’.

Function: set-page-dirty! page [state] ¶

  Sets the dirty flag for page. If state is ‘`#f`’, clears the dirty flag; otherwise, or if state is omitted, marks the page as dirty. Returns page.

Next: Core object functions, Up: Core API Reference [Contents][Index]