pcb 4.1.1
An interactive printed circuit board layout editor.
|
Main program, initializes some stuff and handles user input. More...
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <sys/stat.h>
#include <time.h>
#include "global.h"
#include "data.h"
#include "buffer.h"
#include "create.h"
#include "crosshair.h"
#include "draw.h"
#include "error.h"
#include "file.h"
#include "set.h"
#include "action.h"
#include "misc.h"
#include "lrealpath.h"
#include "free_atexit.h"
#include "polygon.h"
#include "gettext.h"
#include "pcb-printf.h"
#include "strflags.h"
#include "hid/common/actions.h"
#include "hid/hidint.h"
#include "core_lists.h"
Go to the source code of this file.
Data Structures | |
struct | UsageNotes |
Defines | |
#define | PCBLIBPATH ".:" PCBLIBDIR |
#define | SSET(F, D, N, H) |
#define | ISET(F, D, N, H) |
#define | BSET(F, D, N, H) |
#define | RSET(F, D, N, H) |
#define | CSET(F, D, N, H) |
#define | COLOR(F, D, N, H) |
#define | LAYERCOLOR(N, D) |
#define | LAYERNAME(N, D) |
#define | LAYERSELCOLOR(N) |
#define | free0(ptr) |
Typedefs | |
typedef struct UsageNotes | UsageNotes |
Functions | |
static void | InitHandler (void) |
Initialize signal and error handlers. | |
void | copyright (void) |
Print the copyright notice. | |
static void | u (const char *fmt,...) |
static void | usage_attr (HID_Attribute *a) |
static void | usage_hid (HID *h) |
static void | usage (void) |
static void | print_defaults_1 (HID_Attribute *a, void *value) |
static void | print_defaults () |
void | save_increments (const Increments *mm, const Increments *mil) |
REGISTER_ATTRIBUTES (main_attribute_list) | |
static void | print_version () |
Print help or version messages. | |
static void | InitPaths (char *argv0) |
See if argv0 has enough of a path to let lrealpath give the real path. | |
void | pcb_main_uninit (void) |
Free up memory allocated to the PCB. | |
int | main (int argc, char *argv[]) |
Main program. | |
Variables | |
static char * | command_line_pcb |
static UsageNotes * | usage_notes = NULL |
static int | show_help = 0 |
static int | show_version = 0 |
static int | show_copyright = 0 |
static int | show_defaults = 0 |
static int | show_actions = 0 |
static int | do_dump_actions = 0 |
static char * | grid_units |
static Increments | increment_mm = { 0 } |
static Increments | increment_mil = { 0 } |
HID_Attribute | main_attribute_list [] |
char * | bindir = NULL |
char * | exec_prefix = NULL |
char * | pcblibdir = NULL |
char * | pcblibpath = NULL |
char * | pcbtreedir = NULL |
char * | pcbtreepath = NULL |
char * | homedir = NULL |
char * | program_name = 0 |
char * | program_basename = 0 |
char * | program_directory = 0 |
Main program, initializes some stuff and handles user input.
PCB, interactive printed circuit board design
Copyright (C) 1994,1995,1996, 2004 Thomas Nau
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Contact addresses for paper mail and Email: Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany Thomas.Nau@rz.uni-ulm.de
Definition in file main.c.
#define BSET | ( | F, | |
D, | |||
N, | |||
H | |||
) |
{ N, H, \ HID_Boolean, 0, 0, { D, 0, 0 }, 0, &Settings.F }
#define COLOR | ( | F, | |
D, | |||
N, | |||
H | |||
) |
{ N, H, \ HID_String, 0, 0, { 0, D, 0 }, 0, &Settings.F }
#define CSET | ( | F, | |
D, | |||
N, | |||
H | |||
) |
#define free0 | ( | ptr | ) |
Referenced by pcb_main_uninit().
#define ISET | ( | F, | |
D, | |||
N, | |||
H | |||
) |
{ N, H, \ HID_Integer, 0, 0, { D, 0, 0 }, 0, &Settings.F }
#define LAYERCOLOR | ( | N, | |
D | |||
) |
{ "layer-color-" #N, "Color for layer " #N, \ HID_String, 0, 0, { 0, D, 0 }, 0, &Settings.LayerColor[N-1] }
#define LAYERNAME | ( | N, | |
D | |||
) |
{ "layer-name-" #N, "Name for layer " #N, \ HID_String, 0, 0, { 0, D, 0 }, 0, &Settings.DefaultLayerName[N-1] }
#define LAYERSELCOLOR | ( | N | ) |
{ "layer-selected-color-" #N, "Color for layer " #N " when selected", \ HID_String, 0, 0, { 0, "#00ffff", 0 }, 0, &Settings.LayerSelectedColor[N-1] }
#define RSET | ( | F, | |
D, | |||
N, | |||
H | |||
) |
#define SSET | ( | F, | |
D, | |||
N, | |||
H | |||
) |
{ N, H, \ HID_String, 0, 0, { 0, D, 0 }, 0, &Settings.F }
typedef struct UsageNotes UsageNotes |
void copyright | ( | void | ) |
static void InitHandler | ( | void | ) | [static] |
static void InitPaths | ( | char * | argv0 | ) | [static] |
See if argv0 has enough of a path to let lrealpath give the real path.
This should be the case if you invoke pcb with something like /usr/local/bin/pcb or ./pcb or ./foo/pcb but if you just use pcb and it exists in your path, you'll just get back pcb again.
Definition at line 1697 of file main.c.
References bindir, HID_Attribute::default_val, exec_prefix, homedir, lrealpath(), main_attribute_list, malloc(), NSTRCMP, pcblibdir, pcblibpath, pcbtreedir, pcbtreepath, and HID_Attr_Val::str_value.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main program.
Init application:
Definition at line 1978 of file main.c.
References _, SettingType::ActionString, ARROW_MODE, bind_textdomain_codeset, bindtextdomain, command_line_pcb, copyright(), CreateNewPCB(), CreateNewPCBPost(), PCBType::Data, SettingType::DefaultLayerName, do_dump_actions, hid_st::do_export, dump_actions(), SettingType::ElementPath, EmergencySave(), EnableAutosave(), hid_st::exporter, exporter, PCBType::Filename, SettingType::FontPath, SettingType::GnetlistProgram, SettingType::Groups, gui, hid_action(), hid_actionl(), hid_find_exporter(), hid_find_gui(), hid_find_printer(), hid_init(), hid_load_settings(), hid_parse_actions(), InitBuffers(), InitCrosshair(), InitHandler(), initialize_units(), SettingType::InitialLayerStack, InitPaths(), SettingType::LayerColor, PCBType::LayerGroups, DataType::LayerN, SettingType::LayerSelectedColor, LayerStringToLayerStack(), leaky_init(), Library, SettingType::LibraryCommandDir, SettingType::LibraryPath, SettingType::LibraryTree, LoadPCB(), SettingType::MakeProgram, LibraryType::MenuN, Message(), hid_st::parse_arguments, ParseGroupString(), PCB, pcb_dbus_finish(), pcb_dbus_setup(), pcb_main_uninit(), polygon_init(), print_actions(), print_defaults(), print_version(), hid_st::printer, Progname, program_basename, program_directory, program_name, ReadLibraryContents(), ResetStackAndVisibility(), SettingType::ScriptFilename, SetMode(), Settings, show_actions, show_copyright, show_defaults, show_help, show_version, stroke_init(), textdomain, UNKNOWN, and usage().
void pcb_main_uninit | ( | void | ) |
Free up memory allocated to the PCB.
Why bother when we're about to exit ?
Because it removes some false positives from heap bug detectors such as lib dmalloc.
Definition at line 1910 of file main.c.
References bindir, exec_prefix, free0, FreePCBMemory(), SettingType::GnetlistProgram, gui, hid_uninit(), homedir, SettingType::MakeProgram, PCB, pcblibdir, program_directory, Settings, hid_st::uninit, uninit_strflags_buf(), uninit_strflags_layerlist(), and UninitBuffers().
Referenced by main(), and QuitApplication().
static void print_defaults | ( | ) | [static] |
Definition at line 378 of file main.c.
References HID_AttrNode::attributes, exporter, hid_st::get_export_options, hid_st::gui, hid_attr_nodes, hid_enumerate(), HID_AttrNode::n, n, hid_st::name, HID_AttrNode::next, print_defaults_1(), and HID_Attribute::value.
Referenced by main().
static void print_defaults_1 | ( | HID_Attribute * | a, |
void * | value | ||
) | [static] |
Definition at line 326 of file main.c.
References c, HID_Attr_Val::coord_value, HID_Attribute::default_val, HID_Attribute::enumerations, get_unit_list(), HID_Boolean, HID_Coord, HID_Enum, HID_Integer, HID_Label, HID_Mixed, HID_Path, HID_Real, HID_String, HID_Unit, HID_Attr_Val::int_value, HID_Attribute::name, pcb_fprintf(), HID_Attr_Val::real_value, s, HID_Attr_Val::str_value, unit::suffix, and HID_Attribute::type.
Referenced by print_defaults().
static void print_version | ( | ) | [static] |
REGISTER_ATTRIBUTES | ( | main_attribute_list | ) |
Definition at line 1586 of file main.c.
References Concat(), copy_nonzero_increments(), unit::family, get_increments_struct(), get_unit_struct(), SettingType::GnetlistProgram, SettingType::grid_unit, grid_units, IMPERIAL, SettingType::increments, SettingType::LibraryCommand, SettingType::LibraryCommandDir, SettingType::LibraryContentsCommand, SettingType::LineThickness, SettingType::MakeProgram, SettingType::MaxHeight, SettingType::MaxWidth, METRIC, MIL_TO_COORD, ParseRouteString(), SettingType::Routes, SettingType::RouteStyle, Settings, SettingType::ViaDrillingHole, and SettingType::ViaThickness.
void save_increments | ( | const Increments * | mm, |
const Increments * | mil | ||
) |
Definition at line 439 of file main.c.
Referenced by config_sizes_apply().
static void u | ( | const char * | fmt, |
... | |||
) | [inline, static] |
Definition at line 147 of file main.c.
Referenced by angle_from_cotan(), cotan(), do_measure(), DumpKeys2(), FlagUnitsMil(), FlagUnitsMm(), GetLowestDistancePolygonPoint(), gts_graph_traverse_next(), gts_surface_traverse_next(), incircleadapt(), lesstif_key_event(), non_shared_vertex1(), orient2dadapt(), orient3dadapt(), point_in_triangle(), push_neighbor(), and usage().
static void usage | ( | void | ) | [static] |
Definition at line 263 of file main.c.
References HID_AttrNode::attributes, exporter, gui, hid_attr_nodes, hid_enumerate(), HID_AttrNode::n, UsageNotes::next, HID_AttrNode::next, Progname, UsageNotes::seen, u(), usage_attr(), and usage_hid().
Referenced by main().
static void usage_attr | ( | HID_Attribute * | a | ) | [static] |
Definition at line 164 of file main.c.
References ATTR_UNDOCUMENTED, HID_Attribute::enumerations, get_n_units(), get_unit_list(), HID_Attribute::help_text, HID_Boolean, HID_Coord, HID_Enum, HID_Integer, HID_Label, HID_Mixed, HID_Path, HID_Real, HID_String, HID_Unit, n, HID_Attribute::name, and HID_Attribute::type.
Referenced by usage(), and usage_hid().
static void usage_hid | ( | HID * | h | ) | [static] |
Definition at line 234 of file main.c.
References exporter, hid_st::get_export_options, hid_st::gui, malloc(), hid_st::name, UsageNotes::next, UsageNotes::seen, usage_attr(), and usage_notes.
Referenced by usage().
char* bindir = NULL |
The dir in which PCB installation was found.
Definition at line 1680 of file main.c.
Referenced by InitPaths(), pcb_main_uninit(), and REGISTER_FLAGS().
char* command_line_pcb [static] |
int do_dump_actions = 0 [static] |
char* exec_prefix = NULL |
Definition at line 1681 of file main.c.
Referenced by hid_init(), InitPaths(), and pcb_main_uninit().
char* grid_units [static] |
Definition at line 435 of file main.c.
Referenced by REGISTER_ATTRIBUTES().
char* homedir = NULL |
Definition at line 1686 of file main.c.
Referenced by config_file_open(), get_menu_filename(), hid_init(), hid_load_settings(), hid_save_settings(), InitPaths(), lesstif_menu(), and pcb_main_uninit().
Increments increment_mil = { 0 } [static] |
Increments increment_mm = { 0 } [static] |
Definition at line 445 of file main.c.
Referenced by InitPaths().
char* pcblibdir = NULL |
The system M4 fp directory.
Definition at line 1682 of file main.c.
Referenced by hid_load_settings(), InitPaths(), load_rc_files(), and pcb_main_uninit().
char* pcblibpath = NULL |
char* pcbtreedir = NULL |
char* pcbtreepath = NULL |
char* program_basename = 0 |
char* program_directory = 0 |
Definition at line 1898 of file main.c.
Referenced by main(), and pcb_main_uninit().
char* program_name = 0 |
int show_actions = 0 [static] |
int show_copyright = 0 [static] |
int show_defaults = 0 [static] |
int show_version = 0 [static] |
UsageNotes* usage_notes = NULL [static] |
Definition at line 161 of file main.c.
Referenced by usage_hid().