Commit Graph

24 Commits

Author SHA1 Message Date
Darryl L. Miles f88c7a86cb utils/magic_zlib.h: limit #include <zlib.h> to files that need it
Remove limited use HAVE_ZLIB wrapper API into separate header as
utils.h is used in many places and most source files don't need
to drag in the header file from this external dependency.

Copyright date(s) taken from original source file / git blame.
2025-07-29 10:50:32 -04:00
Darryl L. Miles df0623a435 include <unistd.h> where necessary in files using API calls
When global <sys/mman.h> was removed from tile.h it also removed
<unistd.h> nearby.  This exposes the lack of <unistd.h> being
included where needed using APIs like close()/read()/unlink()/isatty()
the WASM build seems to show this as the header file set is structured
differently.
2025-07-27 12:42:05 -04:00
Darryl L. Miles a60259ab63 CodeQL FileMayNotBeClosed.ql PaCheckCompressed() apparently leaks an 'fd'
CodeQL complains of a _potential_ leak (I can't see it), seems false
positive but also a clear case to use POSIX access(R_OK) instead.
2025-02-22 21:02:49 -05:00
Darryl L. Miles 265ace5c9f path.c: PaEnum() constify and add prototype 2024-12-26 15:20:58 -05:00
Darryl L. Miles 6bccbef0d4 path.c: PaSubsWD() constify and no prototype exists
This function does not appear used across the codebase.
No prototype exists in utils.h
2024-12-26 15:20:58 -05:00
Darryl L. Miles c77d3852d5 path.c: PaOpen() constify and add prototype 2024-12-26 15:20:58 -05:00
Darryl L. Miles fd7eab2193 path.c: PaZOpen() constify and add prototype 2024-12-26 15:20:58 -05:00
Darryl L. Miles d077368436 path.c: PaLockOpen() constify and add prototype 2024-12-26 15:20:58 -05:00
Darryl L. Miles 875d825afb path.c: PaLockZOpen() constify and add prototype 2024-12-26 15:20:58 -05:00
Darryl L. Miles bfb411d19f path.c: nextName() constify and add prototype 2024-12-26 15:20:58 -05:00
Darryl L. Miles feef9730f3 path.c: PaExpand() constify and add prototype 2024-12-26 15:20:58 -05:00
Darryl L. Miles 6a6f85862e path.c: PaAppend() constify and add prototype 2024-12-26 15:20:58 -05:00
Darryl L. Miles fca164715e PaCheckCompressed() constify implementation 2024-12-26 15:20:58 -05:00
Darryl L. Miles e22e5d63b9 PaCheckCompressed() removed API quirkiness
When constifying there is this inconsistent quirk in this API returning
'filename' or a malloced storage.  When special handling needs to be
made by the caller to detect this to decide if it needs a free.

This appears to done to save a strdup().

Make it always return a malloc block so the API contract is
strightforward to the caller.  A non-NULL return requires
free() by the caller.
2024-12-26 15:20:58 -05:00
Darryl L. Miles 76d8c8c911 35 x warning: suggest parentheses around assignment used as truth value
PlowRules1.c:439:9: warning: suggest parentheses around assignment used as truth value
PlowTech.c:645:17: warning: suggest parentheses around assignment used as truth value
PlowTech.c:652:17: warning: suggest parentheses around assignment used as truth value
PlowTech.c:1019:17: warning: suggest parentheses around assignment used as truth value
ResReadSim.c:270:13: warning: suggest parentheses around assignment used as truth value
ResReadSim.c:871:9: warning: suggest parentheses around assignment used as truth value
ResRex.c:1840:17: warning: suggest parentheses around assignment used as truth value
getrect.c:72:9: warning: suggest parentheses around assignment used as truth value
getrect.c:79:9: warning: suggest parentheses around assignment used as truth value
getrect.c:86:9: warning: suggest parentheses around assignment used as truth value
getrect.c:93:9: warning: suggest parentheses around assignment used as truth value
hash.c:732:16: warning: suggest parentheses around assignment used as truth value
heap.c:328:17: warning: suggest parentheses around assignment used as truth value
heap.c:344:17: warning: suggest parentheses around assignment used as truth value
netlist.c:323:17: warning: suggest parentheses around assignment used as truth value
niceabort.c:121:9: warning: suggest parentheses around assignment used as truth value
path.c:1102:12: warning: suggest parentheses around assignment used as truth value
pathvisit.c:245:13: warning: suggest parentheses around assignment used as truth value
pathvisit.c:295:17: warning: suggest parentheses around assignment used as truth value
tech.c:656:17: warning: suggest parentheses around assignment used as truth value
ext2spice.c:1591:16: warning: suggest parentheses around assignment used as truth value
ext2spice.c:1622:16: warning: suggest parentheses around assignment used as truth value
ext2spice.c:1813:12: warning: suggest parentheses around assignment used as truth value
ext2spice.c:1862:12: warning: suggest parentheses around assignment used as truth value
ext2spice.c:3808:16: warning: suggest parentheses around assignment used as truth value
CalmaRdio.c:437:9: warning: suggest parentheses around assignment used as truth value
CalmaWrite.c:396:9: warning: suggest parentheses around assignment used as truth value
CalmaWrite.c:1772:29: warning: suggest parentheses around assignment used as truth value
CalmaWriteZ.c:372:9: warning: suggest parentheses around assignment used as truth value
CalmaWriteZ.c:1608:29: warning: suggest parentheses around assignment used as truth value
CIFrdtech.c:209:9: warning: suggest parentheses around assignment used as truth value
CIFrdtech.c:214:9: warning: suggest parentheses around assignment used as truth value
CIFrdtech.c:220:9: warning: suggest parentheses around assignment used as truth value
CIFrdtech.c:226:9: warning: suggest parentheses around assignment used as truth value
CIFrdutils.c:1258:12: warning: suggest parentheses around assignment used as truth value

GCC14 -Wall cleanup series [-Wparentheses]
2024-10-09 21:12:55 -04:00
Tim Edwards 0c36365db8 Revised the file opening routine with respect to the search paths.
Previously, a file path beginning with "/", "./", or "../" would be
searched for verbatim and no searching would be done over paths.
This behavior now occurs for a leading "/" only.  File paths with
"./" or "../" will search for the file with the path verbatim, then
proceed to search for the file with each search path prepended to
the filename as usual.  This solves a problem for reusable, non- PDK
IP blocks, where the IP block may have an abstract view pointing to
a GDS file which is specified as being located at "../gds/<file>".
This file would not be found if the IP block was included into
another project.  Now it can be done if the path to the IP is given
by "addpath".
2024-08-16 17:45:10 -04:00
Tim Edwards 075262b2ef Added the ability to read compressed .mag files (writing is not yet
supported).  Fixed the long-standing issue in which DRC does not
get stopped by the "drc off" command (the behavior for interrupting
the DRC was dependent on the DRC being turned on, and the "drc off"
command was turning it off before breaking, causing the interrupt
to be ignored).
2022-11-02 17:12:46 -04:00
Tim Edwards 371018ae4b Implemented native gzip compression/decompression using zlib routines.
Compression levels of the output can be controlled with the "gds
compress [<value>]" command, where <value> 0 (default) is uncompressed
output, 6 is "normal" gzip compression, and 9 is maximum compression.
2022-05-10 09:19:39 -04:00
Tim Edwards 1bb4cb92ea Played around with the file locking and discovered to my chagrin that
whenever a process writes a cell to disk, it immediately releases the
file lock it had on that cell, which is clearly not the intent of file
locking.  Fixed this issue.  On a related topic, revised the "cellname
writeable" command so that it can make a cell editable even if the cell
has an advisory lock and cannot be made writeable.  Perhaps there should
be a clearer distinction here between "writeable" and "editable".  Also:
Reconsidered the previous commit, which removed the "--disable-locking"
from the configuration options.  Because some operating systems may not
implement fnctl()-based file locking (Cygwin, for one, apparently doesn't),
it is still useful to be able to completely remove the function, in case
the operating system will fail to recognize the fnctl() values in the
code.  Now, file locking behavior can be permanently removed through the
configuration option, or temporarily disabled from the command line.
2022-01-01 16:53:46 -05:00
Tim Edwards e4d1c29112 Reworked the file locking option as a command instead of as a
compile-time option.  The behavior can now be controlled from
within the program with "locking disable" or "locking enable".
2022-01-01 14:28:59 -05:00
Tim Edwards 20eb6ce6c1 Made a few modifications to the patch from Keno Fischer (pull request
startup.  I'm not sure that it is even possible to have a Tcl variable
set at this point in the startup procedure, though.
2021-01-04 09:47:03 -05:00
Tim Edwards 1b3299ec90 Updated PaOpen() to handle a Tcl variable of the type ${X} as well as
just plain $X (i.e., ignore any brackets around the variable) when
doing variable expansion.
2020-12-04 14:46:48 -05:00
Tim Edwards 2af38a4191 Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -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