Index: trunk/src/sch-rnd/Makefile.in =================================================================== --- trunk/src/sch-rnd/Makefile.in (revision 1333) +++ trunk/src/sch-rnd/Makefile.in (revision 1334) @@ -13,6 +13,7 @@ search.o select.o operation.o + build_run.o @] Index: trunk/src/sch-rnd/build_run.c =================================================================== --- trunk/src/sch-rnd/build_run.c (nonexistent) +++ trunk/src/sch-rnd/build_run.c (revision 1334) @@ -0,0 +1,247 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * (this file is based on PCB, interactive printed circuit board design) + * Copyright (C) 1994,1995,1996,2006 Thomas Nau + * pcb-rnd Copyright (C) 2017,2018 Alain Vigne + * pcb-rnd Copyright (C) 2018,2020,2021 Tibor 'Igor2' Palinkas + * sch-rnd Copyright (C) 2022 Tibor 'Igor2' Palinkas + * + * 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: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + * + */ + +#include +#include +#include +#include "conf_core.h" +#include "build_run.h" +#include +#include + +extern void sch_rnd_main_uninit(void); + +void sch_quit_app(void) +{ + /* save data if necessary. It not needed, then don't trigger EmergencySave + * via our atexit() registering of sch_emergency_save(). We presumably wanted to + * exit here and thus it is not an emergency. */ +TODO("implemnent this:"); +#if 0 + if (PCB->Changed && conf_core.editor.save_in_tmp) + sch_emergency_save(); + else + sch_disable_emergency_save(); +#endif + + if (rnd_gui->do_exit == NULL) { + sch_rnd_main_uninit(); + exit(0); + } + else + rnd_gui->do_exit(rnd_gui); +} + +TODO("implement these in scconfig") +#define SCH_VERSION "" +#define SCH_REVISION "" + +char *sch_get_info_program(void) +{ + static gds_t info; + static int first_time = 1; + + if (first_time) { + first_time = 0; + gds_init(&info); + gds_append_str(&info, "This is sch-rnd " SCH_VERSION " (" SCH_REVISION ")" "\nan interactive "); + gds_append_str(&info, "schematics editor\nfrom the Ringdove EDA suite\ncompiled using librnd version " RND_VER_STR "\n"); + } + return info.array; +} + +char *sch_get_info_copyright(void) +{ + static gds_t info; + static int first_time = 1; + + if (first_time) { + first_time = 0; + gds_init(&info); + + gds_append_str(&info, "Recent pcb-rnd copyright:\n"); + gds_append_str(&info, "Copyright (C) Tibor Palinkas 2019..2022\n"); + gds_append_str(&info, "With some code copied from fellow Ringdove application pcb-rnd\n(see http://www.repo.hu/projects/pcb-rnd)\n\n"); + } + return info.array; +} + +char *sch_get_info_websites(const char **url_out) +{ + static gds_t info; + static int first_time = 1; + static const char *URL = "http://repo.hu/projects/sch-rnd\n"; + + if (first_time) { + first_time = 0; + gds_init(&info); + + gds_append_str(&info, "For more information see:\n"); + gds_append_str(&info, URL); + } + + if (url_out != NULL) + *url_out = URL; + + return info.array; +} + +char *sch_get_info_comments(void) +{ + static gds_t info; + static int first_time = 1; + char *tmp; + + if (first_time) { + first_time = 0; + gds_init(&info); + + tmp = sch_get_info_program(); + gds_append_str(&info, tmp); + tmp = sch_get_info_websites(NULL); + gds_append_str(&info, tmp); + } + return info.array; +} + + +char *sch_get_info_compile_options(void) +{ + rnd_hid_t **hids; + int i; + static gds_t info; + static int first_time = 1; + +#define TAB " " + + if (first_time) { + first_time = 0; + gds_init(&info); + + gds_append_str(&info, "----- Run Time Options -----\n"); + gds_append_str(&info, "GUI: "); + if (rnd_gui != NULL) { + gds_append_str(&info, rnd_gui->name); + gds_append_str(&info, "\n"); + } + else + gds_append_str(&info, "none\n"); + + gds_append_str(&info, "\n----- Compile Time Options -----\n"); + hids = rnd_hid_enumerate(); + gds_append_str(&info, "GUI:\n"); + for (i = 0; hids[i]; i++) { + if (hids[i]->gui) { + gds_append_str(&info, TAB); + gds_append_str(&info, hids[i]->name); + gds_append_str(&info, " : "); + gds_append_str(&info, hids[i]->description); + gds_append_str(&info, "\n"); + } + } + + gds_append_str(&info, "Exporters:\n"); + for (i = 0; hids[i]; i++) { + if (hids[i]->exporter) { + gds_append_str(&info, TAB); + gds_append_str(&info, hids[i]->name); + gds_append_str(&info, " : "); + gds_append_str(&info, hids[i]->description); + gds_append_str(&info, "\n"); + } + } + + gds_append_str(&info, "Printers:\n"); + for (i = 0; hids[i]; i++) { + if (hids[i]->printer) { + gds_append_str(&info, TAB); + gds_append_str(&info, hids[i]->name); + gds_append_str(&info, " : "); + gds_append_str(&info, hids[i]->description); + gds_append_str(&info, "\n"); + } + } + } +#undef TAB + return info.array; +} + +char *sch_get_info_license(void) +{ + static gds_t info; + static int first_time = 1; + + if (first_time) { + first_time = 0; + gds_init(&info); + + gds_append_str(&info, "sch-rnd is licensed under the terms of the GNU\n"); + gds_append_str(&info, "General Public License version 2\n"); + gds_append_str(&info, "See the COPYING file for more information\n\n"); + } + return info.array; +} + +/* Catches signals which abort the program. */ +void sch_catch_signal(int Signal) +{ + const char *s; + + switch (Signal) { +#ifdef SIGHUP + case SIGHUP: + s = "SIGHUP"; + break; +#endif + case SIGINT: + s = "SIGINT"; + break; +#ifdef SIGQUIT + case SIGQUIT: + s = "SIGQUIT"; + break; +#endif + case SIGABRT: + s = "SIGABRT"; + break; + case SIGTERM: + s = "SIGTERM"; + break; + case SIGSEGV: + s = "SIGSEGV"; + break; + default: + s = "unknown"; + break; + } + rnd_message(RND_MSG_ERROR, "aborted by %s signal\n", s); + exit(1); +} Index: trunk/src/sch-rnd/build_run.h =================================================================== --- trunk/src/sch-rnd/build_run.h (nonexistent) +++ trunk/src/sch-rnd/build_run.h (revision 1334) @@ -0,0 +1,58 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * (this file is xopied from pcb-rnd, interactive printed circuit board design) + * Copyright (C) 1994,1995,1996,2006 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: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + * + */ + +#ifndef PCB_BUILD_RUN_H +#define PCB_BUILD_RUN_H + +void sch_quit_app(void); + +/* Returns a string that has a bunch of information about this program. */ +char *sch_get_info_program(void); + +/* Returns a string that has a bunch of information about the copyrights. */ +char *sch_get_info_copyright(void); + +/* Returns a string about how the program is licensed. */ +char *sch_get_info_license(void); + +/* Returns a string that has a bunch of information about the websites. */ +char *sch_get_info_websites(const char **url_out); + +/* Returns a string as the concatenation of sch_get_info_program() and sch_get_info_websites() */ +char *sch_get_info_comments(void); + +/* Returns a string that has a bunch of information about the options selected at compile time. */ +char *sch_get_info_compile_options(void); + +/* Author's name: either from the config system (typically from the design) or + as a last resort from the OS */ +const char *sch_author(void); + +void sch_catch_signal(int Signal); + +#endif Index: trunk/src/sch-rnd/sch-rnd.c =================================================================== --- trunk/src/sch-rnd/sch-rnd.c (revision 1333) +++ trunk/src/sch-rnd/sch-rnd.c (revision 1334) @@ -158,7 +158,7 @@ csch_init_actions(); } -static void sch_rnd_main_uninit(void) +void sch_rnd_main_uninit(void) { if (prj != NULL) csch_project_free(prj);