Commit Graph

37 Commits

Author SHA1 Message Date
R. Timothy Edwards 1afd48e840 Corrected an error in which an invalid client name passed to the
"macro" command will crash magic.  This will happen if, for
example, magic is compiled without OpenGL support, in which case
the "wind3d" client does not exist, and parsing the default
macros from the system .magicrc file will cause an immediate
crash.
2025-10-29 09:32:03 -04:00
R. Timothy Edwards 27c423c2ed Substantially revised the "macro" command callback functions and
the "tool" implementation.  Previously, the "tool" implementation
would overwrite the button bindings for the mouse.  The problem
with that is that if the user customizes one or more of the
bindings, such as using the mouse wheel for zooming instead of
panning, then the custom macro gets obliterated when the tool
changes.  The reimplementation creates multiple macro sets which
are unique to each tool.  The "enable_tools" function sets up
the initial unique default bindings for each tool.  The user
can then customize the bindings for any tool, and the
implementation no longer requires the constant changing of key
bindings.  Note that the new implementation is slightly less
efficient because the macro tables are found by string hash
based on the name of the tool or client type, not the integer
client ID.  The reduction in efficiency is balanced by the
increased flexibility of the macros.
2025-10-09 15:43:54 -04:00
Darryl L. Miles d55a2b74ac header file #ifndef guard namespace consistency (global change)
This add an effective namespace prefix to the guard ifndef
2025-07-29 10:50:32 -04:00
Darryl L. Miles 8b7e0aaec6 Makefile: whitespace only change 2025-07-29 10:50:32 -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 b5d068b0ea CodeQL MemoryMayNotBeFreed.ql rtrCmd.c CmdRoute() 2025-02-22 21:35:23 -05:00
Mamoru TASAKA cb2a79d6b1 gcc: support -Werror=format-security
Support gcc -Werror=format-security which is used by default on Fedora.

ext2spice/ext2spice.c: format not a string literal and no format arguments
extflat/EFargs.c: likewise
windows/windCmdNR.c: likewise
2025-01-10 14:19:52 +09:00
Darryl L. Miles b1a9e10be7 feat: quit [exit_status], option support
Affecting process exit status.
2025-01-07 13:58:45 -05:00
Darryl L. Miles faadb774b4 docs: quit -noprompt
Was looking to implement this feature and found it was already
implemented but is a secret feature.

Updated documentation and modified implementation so it is possible
a user can discover the feature via usage such as "quit -help -invalid"
like other commands.
2025-01-07 13:58:45 -05:00
Darryl L. Miles 6afadf9809 gcc11 -Wall -Wpedantic cleanup (post __attribute__) 2025-01-06 16:25:38 +00:00
Darryl L. Miles c21e182b2c gcc11 -Wall -Wpedantic cleanup (post TCL9) 2025-01-06 16:24:57 +00:00
Darryl L. Miles 3dbcb0759e Lookup() constify call-site
plow/PlowCmd.c: Lookup() constify call-site
plot/plotVers.c: Lookup() constify call-site
plot/plotMain.c: Lookup() constify call-site
plot/plotCmd.c: Lookup() constify call-site
netmenu/NMnetlist.c: Lookup() constify call-site
netmenu/NMcmdLZ.c: Lookup() constify call-site
netmenu/NMcmdAK.c: Lookup() constify call-site
lef/lefTech.c: Lookup() constify call-site
lef/lefCmd.c: Lookup() constify call-site
irouter/irRoute.c: Lookup() constify call-site
irouter/irCommand.c: Lookup() constify call-site
router/rtrCmd.c: Lookup() constify call-site
resis/ResRex.c: Lookup() constify call-site
gcr/gcrShwFlgs.c: Lookup() constify call-site
windows/windCmdSZ.c: Lookup() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles c2d533af3b windows/windCmdNR.c: Lookup() constify call-site (extern data) 2024-12-26 15:20:58 -05:00
Darryl L. Miles 586e9f1e36 Lookup() constify WindGetCommandTable() returns 'const'
This commit related to the dynamic creation of data that is used
to parse commands and options via Lookup.

windows/windows.h: Lookup() constify call-site
tcltk/tclmagic.c: Lookup() constify call-site
graphics/W3Dmain.c: Lookup() constify call-site
windows/windSend.c: Lookup() constify call-site
windows/windMain.c: Lookup() constify call-site
windows/windInt.h: Lookup() constify call-site
textio/txMain.c: Lookup() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles 882d82a8ae Lookup() constify call-site with Tcl_SetResult()
ext2spice/ext2spice.c: Lookup() constify call-site
ext2sim/ext2sim.c: Lookup() constify call-site
windows/windCmdAM.c: Lookup() constify call-site

Tcl_SetResult() uses cast to remove 'const' from type, the pointer
is only used to take a copy of the data, the lack of 'const' is due
to Tcl heritage when supporting C89 era compilers.

TCL9 appears to fix this, in that the macro used ends up at
Tcl_NewStringObj() which has 'const' here.
2024-12-26 15:20:58 -05:00
Darryl L. Miles a224c7e21a GeoDisjoint() unify return type of callback to bool
GeoDisjoint() handles this as 'bool' type internally so make all
consumer call-sites consistent with this type.
2024-12-26 15:10:35 -05:00
Darryl L. Miles e5c3e703c3 HashLookOnly(): passing argument 2 of 'HashLookOnly' makes pointer from integer without a cast
Also HashFind()

GCC14 --without-tk --without-tcl
Related issue: https://github.com/RTimothyEdwards/magic/issues/323
2024-10-09 20:35:19 -04:00
Darryl Miles 9096946a12 windows/windDebug.c: Wrong type of arguments to formatting function
Fix code scanning alert no. 130: Wrong type of arguments to formatting function (#43)

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-10-01 12:36:13 -04:00
Darryl Miles d1dc038cb7 windows/windDisp.c: Redundant null check due to previous dereference
Fix code scanning alert no. 133: Redundant null check due to previous dereference (#40)

* Update windDisp.c

* DLM - AI wanted to guard the '*area' dereference in if() statement, but the code path above has address of '&' operator for the assignment to 'area' so it must always be non-null.  So I rejected this approach and removed the extra null check, replacing it with an assert().

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-10-01 12:36:13 -04:00
Darryl Miles fdc81f5eec windows/windDebug.c: Wrong type of arguments to formatting function
Fix code scanning alert no. 129: Wrong type of arguments to formatting function (#24)

* Update windDebug.c

* AI wanted "%p", DLM changed to (intmax_t) "%lx"

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-10-01 12:36:13 -04:00
Tim Edwards c8a2d06e08 Finally got around to fixing the "logcommands" command, which has
been broken ever since moving to the Tcl/Tk wrapped version.  Added
some new features that allow background commands from the window
handling (like pointer tracking) to be omitted from the log file
via a suspend/resume function.  Added a header file and a few
commands at the top of the log file that align the log file contents
with the screen and box state at the start of logging.  This makes
a log file which can be "played back" by sourcing it from the magic
console prompt.  Per request from Harald Pretl.
2023-06-28 21:31:24 -04: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 e36560fb90 Added a missing include of ctype.h to a source file that uses the
isalnum() subroutine.  Corrected an assignment in utils/tech.c
which was a syntax error that passes through the compiler.
2021-06-19 10:30:47 -04:00
Tim Edwards d1f7e43dcc Revised DBWloadWindow (again) so that boolean flags are passed to
it as a single value "flags" (unsigned char) with meaningful flag
names.  Added new option "-fail" to the load command to allow
magic to fail on loading a cell that does not have a corresponding
file rather than the default action of creating a new cell.  Added
a flag for the "-quiet" option so that behavior on "-fail" can be
done quietly.
2021-02-10 13:05:38 -05:00
Tim Edwards 8519d2f13c Corrected the "macro" command so that if no help text has been given
for the key bindings, then the key bindings themselves will be
printed when "macro help" is run, and not just empty strings.
2020-06-25 20:59:44 -04:00
Tim 'mithro' Ansell b47d4c5642 Removing extra `$Header$` 2020-05-27 20:35:27 -04:00
Tim Edwards 2af38a4191 Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
Tim Edwards 4a0ad45627 Added a "move" command option "move origin" which will move the
coordinate system origin to the specified (current) location.
This is a much more efficient method than selecting everything in
a layout and moving it, especially for very large layouts where
selection and moving becomes prohibitive.
2020-03-20 13:40:16 -04:00
Tim Edwards 80fa495103 Removed the Depend files, which were being tracked with .gitignore
pointing to Depend instead of */Depend.
2020-03-13 15:39:08 -04:00
Tim Edwards b62efea43d Corrected the last commit for fixing the "drc count" command option,
which had been changed a few months back to remove the individual
cell count and only list the top level cell.  The behavior has been
changed a bit so that "list" returns values for the top level cell
only, but "listall" returns a complete list.  "drc list count total"
gives the DRC count for the top cell, but "drc listall count total"
gives the DRC count for everything (probably not very useful).
Also:  Implemented a behavior by request to automatically removed
the (UNNAMED) cell whenever a new cell is loaded and the (UNNAMED)
cell has not been modified.
2020-02-25 09:52:06 -05:00
Tim Edwards bc00b5578b Implemented a new configuration variable "dist_prefix" for
distributed installations, where the immediate installation location
is different from the final installation location, but in the case
where it is not desirable to put the entire install hierarchy as a
subdirectory of DESTDIR.
2020-01-28 10:40:01 -05:00
Tim Edwards 0eb3b1fe1c Corrected an error in ext2spice related to the recent modification to get
rid of redundant port entries in subcircuits.  There is still an outstanding
issue as to whether nodes and connections need to be recursively iterated
to the hierarchy bottom.  The current fix corrected the test case.  Also,
added a "-dereference" option to the "load" command to revert to the
original behavior of using only search paths from "addpath" when searching
for files to load.
2019-11-14 15:18:26 -05:00
Tim Edwards c31b305848 Corrected the dependency list in the Makefile for "modules", which
should depend on database/database.h;  otherwise running distributed
make can start compiling modules before the database.h file is
created.
2019-07-14 12:07:38 -04:00
Tim Edwards 93bcfeb093 Finally worked out how to correctly use the OpenGL general-purpose
frame buffers and render buffers, and use fast frame buffer bit
block transfers to do copies to and from backing store.  Also found
a long-standing problem where multiple windows fail to refresh
properly in OpenGL and Cairo interfaces due to a lack of calling
GrLock() and GrUnlock() around the call to fetch backing store
after an expose event.  The use of the general purpose frame
buffer allows magic to avoid calling any indirect rendering methods
and should now (finally) allow magic to run in OpenGL mode over a
VNC.  Use of direct rendering methods only also means that magic
does not need to be compiled with the ad hoc switch to have Cairo
handle drawing into pixmaps for the icons (this remains to be
tested).
2017-10-04 14:53:01 -04:00
Tim Edwards 35c3510ea7 Finished the implementation of Cairo 2D graphics (yay!).
Specifically, fixed the initial background, display of text,
reinstated supercolor values, and fixed the backing store
coordinates.
2017-09-14 17:03:53 -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