Commit Graph

23 Commits

Author SHA1 Message Date
Darryl L. Miles dd5fa02556 fix: add missing #include <unistd.h>
Fallout from removing it from tiles.h
2025-07-28 21:28:24 -04:00
Darryl L. Miles 046401cbd8 Use HAVE_SYS_TIME_H and TIME_WITH_SYS_TIME from autoconf where possible 2025-07-27 12:43:04 -04:00
Darryl L. Miles c534eb318d magic/main.c: add missing ifdef SCHEME_INTERPRETER 2025-07-26 17:48:31 -04:00
Darryl L. Miles 272dda3c84 TCL9: TxResetTerminal(bool force) added arguments
This seems like it has 2 use cases.

Internal console management around reprinting command prompt, but many
 modes of operation delegate the prompt processing to tkcon or readline.
Process termination to restore the termios.
2025-01-04 11:08:01 -05:00
Darryl L. Miles 77a7afc8e2 TCL9: Tcl_SetExitProc() API was removed
The Tcl_Exit() replacement proc takes charge of calling exit()

So this function can be easily migrated to libc atexit() which will
now run during exit() not just before.  Which seems ok for the purpose
of restoring the termios state of the tty.

This solution seems compatible with TCL8 as well so all calls to this
removed API are removed.

Note this patch also removes the invalidation (of the callback so
the deefault use of Tcl_Exit() is restored) before returning from
this function.  atexit() usage can not be invalidated after
registration but that can be controlled with application flag
checked inside the callback function if needed.
I have observed scenarios where I need to issue 'reset' manually
after exiting magic, still understanding better the build types
and scenarios that triggers this.
2025-01-04 11:08:01 -05:00
Darryl L. Miles 9ca8697659 strings.h: add #include required when strict
Due to use of strcasecmp() or similar C API.

Maybe HAVE_STRINGS_H is needed ?  If so which platforms needs this ?

clang18 default warning cleanup (strict)
2024-10-09 21:22:37 -04:00
Darryl L. Miles fff3be2f29 utils/main.c: DefRead() Call to function with fewer arguments than declared parameters
Resolution maintains behaviour closest to original behaviour from a37fc1e2

Copilot Autofix no offered.

related git blame lef/defRead.c:
cfb81101 (2022-03-30 13:02:12 -0400 2388)     bool annotate;
f7df5e7c (2022-06-24 15:22:53 -0400 2389)     bool noblockage;

related commits:

commit cfb81101ec
Date:   Wed Mar 30 13:02:12 2022 -0400

commit f7df5e7c86 (tag: 8.3.315)
Date:   Fri Jun 24 15:22:53 2022 -0400

commit a37fc1e242
Date:   Thu Mar 5 14:29:54 2020 -0500

CodeQL: https://github.com/dlmiles/magic/security/code-scanning/29
2024-10-01 12:36:12 -04:00
Darryl L. Miles 3db35216b9 utils/main.c: LefRead() Call to function with fewer arguments than declared parameters
Looks like -1 is accepted as placeholder, maybe it should be the
temporary->fn (filename mtime?).

Copilot Autofix rejected: LefRead(temporary->fn, FALSE, NULL);

related git blame utils/main.c:
8e80644d (2022-01-22 13:30:11 -0500 2078)     int lefTimestamp;         /* If not -1, use the value pointed to
8e80644d (2022-01-22 13:30:11 -0500 2884)     int lefTimestamp;

related commit:
commit 8e80644dd7
Date:   Sat Jan 22 13:30:11 2022 -0500

CodeQL: https://github.com/dlmiles/magic/security/code-scanning/28
2024-10-01 12:36:12 -04:00
Darryl L. Miles 49f4daa715 utils/main.c: Call to function with fewer arguments than declared parameters
Copilot Autofix rejected: DBFileRecovery(MainFileName);

database/DBio.c looks to take NULL as a value for automatic recovery.

Related commits:
commit 231a299b16 (tag: 8.2.0)
Date:   Tue Apr 25 08:41:48 2017 -0400
    Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky
2024-10-01 12:36:12 -04:00
Tim Edwards 006c07082b Inadvertently introduced a segfault on exit on the last commit,
while trying to get rid of a compiler warning.  Fixed by this
update.
2024-01-01 15:36:05 -05:00
Tim Edwards 8f9c328150 Got rid of two compiler warnings; one recently introduced, the
other from some time ago.
2023-12-30 15:00:18 -05:00
Tim Edwards 11080465ad Corrected the Tcl exit hook routine so that it passes on the
client data value as the exit status value (this was not at
all clear from the documentation and required a bit of
experimentation).  The fix allows Tcl scripts to exit magic
with a non-zero status by invoking "exit" in Tcl.
2023-11-11 13:09:59 -05:00
Alessandro De Laurenzis b306a39560 Compatibility with C99 standard
This commit makes the code (mostly) C99-compatible, enabling to compile
it without the -Wno-error=implicit-function-declaration flag. This
way, Magic becomes usable on arm64 architectures, specifically on Apple
computers with M1/M2 SoC.
2022-10-29 06:07:46 +02:00
Tim Edwards 6ecd077ab4 Restored compiling of the non-Tcl/Tk version of magic. This has
traditionally been kept for backwards compatibility.  However, the
operation of "ext2spice" and "ext2sim" as separate programs has
become extremely difficult to maintain, and so it has been dropped
in favor of folding both into the program as commands, as was done
a long time ago in the Tcl/Tk version.
2022-02-08 16:12:07 -05:00
Tim Edwards 355399d3ef Modified the startup behavior so that if a ".tcl" script file is
presented on the command line, then all following arguments are
assumed to be arguments of the script and not additional input
to be processed by magic.  This allows arguments to be passed to
scripts passed to magic on the command line.
2021-07-08 16:03:05 -04:00
Anton Blanchard bdeb4bab50 Restore terminal if exit is called inside a TCL script at startup
If exit is called in a TCL script that is executed at startup, the libc
exit() function is called directly and we don't get a chance to reset
the terminal. We return to the shell with echo off, and have to run
"reset". A simple example:

echo exit > test.tcl
magic -noconsole -dnull  test.tcl

There are a few ways we could solve this. We could register an exit
handler using atexit(). Here I use Tcl_SetExitProc() to register a
callback with the TCL interpreter.
2021-02-18 11:38:42 +11:00
Tim Edwards e7074e5723 Added two small features: (1) Added the "-annotate" option to "lef
read".  While "lef read" normally annotates existing layout, this
option ensures that no additional cells are created from macros in
the input LEF file.  (2) Added a check on the "Input off lambda grid"
warning during CIF/GDS input such that it is not repeated once issued,
as it tends to be output many times when it occurs.
2020-10-14 17:20:45 -04:00
Tim Edwards 1ee9309d15 Fixed a long-standing but unnoticed (or unreported) error in which
using the "-rcfile" switch fails if running magic from a user home
directory.
2020-08-08 15:27:01 -04:00
Tim Edwards 2af38a4191 Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
Tim Edwards a37fc1e242 Implemented the "def read ... -labels" option, which labels each net
with the name given to the net in the DEF file.  Especially useful
for LVS.
2020-03-05 14:29:54 -05:00
Tim Edwards 42ec70d4dc Re-implemented plow setup for the first time since about 2006,
enabling the "plow" command.  At this time, however, not all
rules are being implemented correctly given the numerous changes
to the DRC handling since the last time "plow" was working.  Fixes
are ongoing.
2018-04-01 14:40:10 -04:00
Tim Edwards 088fc759c4 Set of changes updating version 8.2 to the level of 8.1, since 8.2
development had been halted since it was first created back in April.
Version 8.2 is now the official development version, with the first
development push to create a Cairo graphics interface.
2017-08-01 22:14:42 -04:00
Tim Edwards 231a299b16 Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00