Compare commits
No commits in common. "master" and "8.3.460" have entirely different histories.
|
|
@ -0,0 +1,28 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_appimage:
|
||||||
|
name: Build AppImage
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Get the version
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
export VERSION_NUM=$(ruby -e "print '$GITHUB_REF'.split('/')[2]")
|
||||||
|
echo ::set-output name=value::${VERSION_NUM}
|
||||||
|
- name: Build project
|
||||||
|
run: |
|
||||||
|
cd appimage
|
||||||
|
make
|
||||||
|
cp Magic-x86_64.AppImage /tmp/Magic-${{ steps.get_version.outputs.value }}-x86_64.AppImage
|
||||||
|
- name: Upload Release Asset
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: /tmp/Magic-${{ steps.get_version.outputs.value }}-x86_64.AppImage
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
name: CI-appimage10
|
|
||||||
|
|
||||||
env:
|
|
||||||
APPIMAGETOOL_DOWNLOAD_URL: https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_appimage10:
|
|
||||||
name: Build AppImage EL10
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write # action-gh-release
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 149 # enough to cover between tags
|
|
||||||
#fetch-tags: true # this should work see actions/checkout~issue#1471
|
|
||||||
|
|
||||||
- name: Get the version
|
|
||||||
id: get_version
|
|
||||||
run: |
|
|
||||||
git show -s
|
|
||||||
version=$(cat VERSION) # 8.9.999
|
|
||||||
version_tstamp=$(git show -s "--format=%cs" | tr -d '-') # YYYYMMDD
|
|
||||||
version_hash=$(git show -s "--format=%h") # abcdefg
|
|
||||||
version_num=$(ruby -e "print '$GITHUB_REF'.split('/')[2]") # legacy version method: master
|
|
||||||
echo "version=${version}"
|
|
||||||
echo "version_tstamp=${version_tstamp}"
|
|
||||||
echo "version_hash=${version_hash}"
|
|
||||||
echo "version_num=${version_num}"
|
|
||||||
VERSION_NUM="${version}~${version_tstamp}~${version_hash}"
|
|
||||||
echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV
|
|
||||||
echo "MAGIC_APPIMAGE_OUTPUT_FILENAME=Magic-${VERSION_NUM}-x86_64-EL10.AppImage" >> $GITHUB_ENV
|
|
||||||
# Is this GHA being run due to a push-on-tag ? if so we make a GitHub release, otherwise we just publish artifact
|
|
||||||
github_tag=$(echo -n "$GITHUB_REF" | sed -e 's#refs/tags/##') # 8.9.999
|
|
||||||
echo "github_tag=$github_tag"
|
|
||||||
if echo -n "$GITHUB_REF" | egrep -q "^refs/tags/" # check prefix
|
|
||||||
then
|
|
||||||
if [ -n "$github_tag" ]
|
|
||||||
then
|
|
||||||
echo "MY_GITHUB_TAG=${github_tag}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build project
|
|
||||||
run: |
|
|
||||||
cd appimage/10
|
|
||||||
make
|
|
||||||
|
|
||||||
ln -v Magic-x86_64.AppImage "${MAGIC_APPIMAGE_OUTPUT_FILENAME}"
|
|
||||||
ls -l *.AppImage
|
|
||||||
sha256sum *.AppImage
|
|
||||||
pwd
|
|
||||||
|
|
||||||
- name: Create RELEASE-NOTES.txt
|
|
||||||
run: |
|
|
||||||
cd appimage/10
|
|
||||||
# Find the last tag (that does not match the current GITHUB_REF)
|
|
||||||
echo GITHUB_REF=$GITHUB_REF
|
|
||||||
echo GITHUB_SHA=$GITHUB_SHA
|
|
||||||
# GitHub CI is a shallow checkout by default (just the files needed to build)
|
|
||||||
# but we also want history back to next tag, see fetch-tags/fetch-depth actions/checkout~issue#1471
|
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
|
|
||||||
then
|
|
||||||
# remove only if ref of tag (to avoid conflict during fetch)
|
|
||||||
git update-ref -d $GITHUB_REF
|
|
||||||
echo git_update_ref_exitstatus=$?
|
|
||||||
fi
|
|
||||||
set +e
|
|
||||||
git fetch --tags --prune --no-recurse-submodules --depth=149 origin +$GITHUB_SHA # fetch-tags: true # is broken
|
|
||||||
echo git_fetch_exitstatus=$?
|
|
||||||
git_show_ref=$(git show-ref --hash $GITHUB_REF) # get tagcommit hash
|
|
||||||
git_show_ref_exitstatus=$?
|
|
||||||
echo git_show_ref_exitstatus=$git_show_ref_exitstatus
|
|
||||||
echo git_show_ref=$git_show_ref
|
|
||||||
git_rev_list=$(git rev-list -n1 $GITHUB_REF) # get commit hash
|
|
||||||
git_rev_list_exitstatus=$?
|
|
||||||
echo git_rev_list_exitstatus=$git_rev_list_exitstatus
|
|
||||||
echo git_rev_list=$git_rev_list
|
|
||||||
set -e
|
|
||||||
test "$git_show_ref" = "$GITHUB_SHA" || test "$git_rev_list" = "$GITHUB_SHA" # check we got the ref back (or fail CI)
|
|
||||||
git_describe=$(git describe --tags $GITHUB_SHA | sed -e 's#\-\([0-9]\+\-g\)#\+\1#') # /-\d+-g/
|
|
||||||
echo git_describe=$git_describe
|
|
||||||
|
|
||||||
# RELEASE-NOTES-EL10.txt
|
|
||||||
echo "### ${MAGIC_APPIMAGE_OUTPUT_FILENAME} commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-EL10.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "This release is based on EL10 (AlmaLinux10), the AppImage format is designed to run on a wide range of Linux distributions." >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/10/README.md" >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL10.txt
|
|
||||||
length_info=$(stat "--format=%s bytes" "${MAGIC_APPIMAGE_OUTPUT_FILENAME}")
|
|
||||||
sha256_info=$(sha256sum "${MAGIC_APPIMAGE_OUTPUT_FILENAME}" | cut -d ' ' -f1)
|
|
||||||
echo "| | |" >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "| :-------- | :------ |" >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "| File Name | ${MAGIC_APPIMAGE_OUTPUT_FILENAME} |" | sed -e 's#~#\\~#g' >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "| File Length | ${length_info} |" >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "| File SHA256 | ${sha256_info} |" >> RELEASE-NOTES-EL10.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL10.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-CL.txt
|
|
||||||
set +e # allow this to fail to empty string
|
|
||||||
git_previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
|
|
||||||
echo git_previous_tag=$git_previous_tag
|
|
||||||
set -e
|
|
||||||
if [ -n "${git_previous_tag}" ]
|
|
||||||
then
|
|
||||||
echo "### Change Log (since previous tag):" > RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
git log --oneline --no-color --no-decorate "refs/tags/${git_previous_tag}..${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
else
|
|
||||||
echo "### Change Log (last commit only):" > RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
git log --oneline -n1 --no-color --no-decorate "${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
fi
|
|
||||||
echo "" >> RELEASE-NOTES-CL.txt
|
|
||||||
|
|
||||||
#echo "### Build Info:" > RELEASE-NOTES-BI.txt
|
|
||||||
# FIXME extract package version info and DSO symvers into RELEASE-NOTES.txt
|
|
||||||
#echo "" >> RELEASE-NOTES-BI.txt
|
|
||||||
|
|
||||||
cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-EL10.txt
|
|
||||||
cat RELEASE-NOTES-EL10.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/7/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/8/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/9/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/10/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-GH.txt (this is shared for all AppImage for one tag)
|
|
||||||
echo "### commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-GH.txt
|
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
|
|
||||||
then
|
|
||||||
# show tag annotation with tags like before
|
|
||||||
git tag --cleanup=strip "--format=%(contents)" -n "${GITHUB_REF:10}" | sed -e 's#\([~|]\)#\\\1#g' >> RELEASE-NOTES-GH.txt
|
|
||||||
fi
|
|
||||||
echo "" >> RELEASE-NOTES-GH.txt
|
|
||||||
cat RELEASE-NOTES-DOCS.txt >> RELEASE-NOTES-GH.txt
|
|
||||||
cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-GH.txt
|
|
||||||
|
|
||||||
# Show in action/artifact output
|
|
||||||
echo "## RELEASE NOTES" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
cat RELEASE-NOTES-EL10.txt >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Upload Release Asset
|
|
||||||
if: ${{ env.MY_GITHUB_TAG != '' }} # if: ${{ github.ref_type == 'tag' }}
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
body_path: ${{ github.workspace }}/appimage/10/RELEASE-NOTES-GH.txt
|
|
||||||
files: |
|
|
||||||
${{ github.workspace }}/appimage/10/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
${{ github.workspace }}/appimage/10/RELEASE-NOTES-EL10.txt
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
#if: ${{ env.MY_GITHUB_TAG == '' }} # commented out to always upload
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
path: |
|
|
||||||
${{ github.workspace }}/appimage/10/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
name: CI-appimage7
|
|
||||||
|
|
||||||
env:
|
|
||||||
APPIMAGETOOL_DOWNLOAD_URL: https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_appimage7:
|
|
||||||
name: Build AppImage EL7
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write # action-gh-release
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 149 # enough to cover between tags
|
|
||||||
#fetch-tags: true # this should work see actions/checkout~issue#1471
|
|
||||||
|
|
||||||
- name: Get the version
|
|
||||||
id: get_version
|
|
||||||
run: |
|
|
||||||
git show -s
|
|
||||||
version=$(cat VERSION) # 8.9.999
|
|
||||||
version_tstamp=$(git show -s "--format=%cs" | tr -d '-') # YYYYMMDD
|
|
||||||
version_hash=$(git show -s "--format=%h") # abcdefg
|
|
||||||
version_num=$(ruby -e "print '$GITHUB_REF'.split('/')[2]") # legacy version method: master
|
|
||||||
echo "version=${version}"
|
|
||||||
echo "version_tstamp=${version_tstamp}"
|
|
||||||
echo "version_hash=${version_hash}"
|
|
||||||
echo "version_num=${version_num}"
|
|
||||||
VERSION_NUM="${version}~${version_tstamp}~${version_hash}"
|
|
||||||
echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV
|
|
||||||
echo "MAGIC_APPIMAGE_OUTPUT_FILENAME=Magic-${VERSION_NUM}-x86_64-EL7.AppImage" >> $GITHUB_ENV
|
|
||||||
# Is this GHA being run due to a push-on-tag ? if so we make a GitHub release, otherwise we just publish artifact
|
|
||||||
github_tag=$(echo -n "$GITHUB_REF" | sed -e 's#refs/tags/##') # 8.9.999
|
|
||||||
echo "github_tag=$github_tag"
|
|
||||||
if echo -n "$GITHUB_REF" | egrep -q "^refs/tags/" # check prefix
|
|
||||||
then
|
|
||||||
if [ -n "$github_tag" ]
|
|
||||||
then
|
|
||||||
echo "MY_GITHUB_TAG=${github_tag}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build project
|
|
||||||
run: |
|
|
||||||
cd appimage/7
|
|
||||||
make
|
|
||||||
|
|
||||||
ln -v Magic-x86_64.AppImage "${MAGIC_APPIMAGE_OUTPUT_FILENAME}"
|
|
||||||
ls -l *.AppImage
|
|
||||||
sha256sum *.AppImage
|
|
||||||
pwd
|
|
||||||
|
|
||||||
- name: Create RELEASE-NOTES.txt
|
|
||||||
run: |
|
|
||||||
cd appimage/7
|
|
||||||
# Find the last tag (that does not match the current GITHUB_REF)
|
|
||||||
echo GITHUB_REF=$GITHUB_REF
|
|
||||||
echo GITHUB_SHA=$GITHUB_SHA
|
|
||||||
# GitHub CI is a shallow checkout by default (just the files needed to build)
|
|
||||||
# but we also want history back to next tag, see fetch-tags/fetch-depth actions/checkout~issue#1471
|
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
|
|
||||||
then
|
|
||||||
# remove only if ref of tag (to avoid conflict during fetch)
|
|
||||||
git update-ref -d $GITHUB_REF
|
|
||||||
echo git_update_ref_exitstatus=$?
|
|
||||||
fi
|
|
||||||
set +e
|
|
||||||
git fetch --tags --prune --no-recurse-submodules --depth=149 origin +$GITHUB_SHA # fetch-tags: true # is broken
|
|
||||||
echo git_fetch_exitstatus=$?
|
|
||||||
git_show_ref=$(git show-ref --hash $GITHUB_REF) # get tagcommit hash
|
|
||||||
git_show_ref_exitstatus=$?
|
|
||||||
echo git_show_ref_exitstatus=$git_show_ref_exitstatus
|
|
||||||
echo git_show_ref=$git_show_ref
|
|
||||||
git_rev_list=$(git rev-list -n1 $GITHUB_REF) # get commit hash
|
|
||||||
git_rev_list_exitstatus=$?
|
|
||||||
echo git_rev_list_exitstatus=$git_rev_list_exitstatus
|
|
||||||
echo git_rev_list=$git_rev_list
|
|
||||||
set -e
|
|
||||||
test "$git_show_ref" = "$GITHUB_SHA" || test "$git_rev_list" = "$GITHUB_SHA" # check we got the ref back (or fail CI)
|
|
||||||
git_describe=$(git describe --tags $GITHUB_SHA | sed -e 's#\-\([0-9]\+\-g\)#\+\1#') # /-\d+-g/
|
|
||||||
echo git_describe=$git_describe
|
|
||||||
|
|
||||||
# RELEASE-NOTES-EL7.txt
|
|
||||||
echo "### ${MAGIC_APPIMAGE_OUTPUT_FILENAME} commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-EL7.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "This release is based on EL7 (CentOS7), the AppImage format is designed to run on a wide range of Linux distributions." >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/7/README.md" >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL7.txt
|
|
||||||
length_info=$(stat "--format=%s bytes" "${MAGIC_APPIMAGE_OUTPUT_FILENAME}")
|
|
||||||
sha256_info=$(sha256sum "${MAGIC_APPIMAGE_OUTPUT_FILENAME}" | cut -d ' ' -f1)
|
|
||||||
echo "| | |" >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "| :-------- | :------ |" >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "| File Name | ${MAGIC_APPIMAGE_OUTPUT_FILENAME} |" | sed -e 's#~#\\~#g' >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "| File Length | ${length_info} |" >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "| File SHA256 | ${sha256_info} |" >> RELEASE-NOTES-EL7.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL7.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-CL.txt
|
|
||||||
set +e # allow this to fail to empty string
|
|
||||||
git_previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
|
|
||||||
echo git_previous_tag=$git_previous_tag
|
|
||||||
set -e
|
|
||||||
if [ -n "${git_previous_tag}" ]
|
|
||||||
then
|
|
||||||
echo "### Change Log (since previous tag):" > RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
git log --oneline --no-color --no-decorate "refs/tags/${git_previous_tag}..${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
else
|
|
||||||
echo "### Change Log (last commit only):" > RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
git log --oneline -n1 --no-color --no-decorate "${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
fi
|
|
||||||
echo "" >> RELEASE-NOTES-CL.txt
|
|
||||||
|
|
||||||
#echo "### Build Info:" > RELEASE-NOTES-BI.txt
|
|
||||||
# FIXME extract package version info and DSO symvers into RELEASE-NOTES.txt
|
|
||||||
#echo "" >> RELEASE-NOTES-BI.txt
|
|
||||||
|
|
||||||
cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-EL7.txt
|
|
||||||
cat RELEASE-NOTES-EL7.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/7/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/8/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/9/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/10/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-GH.txt (this is shared for all AppImage for one tag)
|
|
||||||
echo "### commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-GH.txt
|
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
|
|
||||||
then
|
|
||||||
# show tag annotation with tags like before
|
|
||||||
git tag --cleanup=strip "--format=%(contents)" -n "${GITHUB_REF:10}" | sed -e 's#\([~|]\)#\\\1#g' >> RELEASE-NOTES-GH.txt
|
|
||||||
fi
|
|
||||||
echo "" >> RELEASE-NOTES-GH.txt
|
|
||||||
cat RELEASE-NOTES-DOCS.txt >> RELEASE-NOTES-GH.txt
|
|
||||||
cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-GH.txt
|
|
||||||
|
|
||||||
# Show in action/artifact output
|
|
||||||
echo "## RELEASE NOTES" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
cat RELEASE-NOTES-EL7.txt >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Upload Release Asset
|
|
||||||
if: ${{ env.MY_GITHUB_TAG != '' }} # if: ${{ github.ref_type == 'tag' }}
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
body_path: ${{ github.workspace }}/appimage/7/RELEASE-NOTES-GH.txt
|
|
||||||
files: |
|
|
||||||
${{ github.workspace }}/appimage/7/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
${{ github.workspace }}/appimage/7/RELEASE-NOTES-EL7.txt
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
#if: ${{ env.MY_GITHUB_TAG == '' }} # commented out to always upload
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
path: |
|
|
||||||
${{ github.workspace }}/appimage/7/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
name: CI-appimage8
|
|
||||||
|
|
||||||
env:
|
|
||||||
APPIMAGETOOL_DOWNLOAD_URL: https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_appimage8:
|
|
||||||
name: Build AppImage EL8
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write # action-gh-release
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 149 # enough to cover between tags
|
|
||||||
#fetch-tags: true # this should work see actions/checkout~issue#1471
|
|
||||||
|
|
||||||
- name: Get the version
|
|
||||||
id: get_version
|
|
||||||
run: |
|
|
||||||
git show -s
|
|
||||||
version=$(cat VERSION) # 8.9.999
|
|
||||||
version_tstamp=$(git show -s "--format=%cs" | tr -d '-') # YYYYMMDD
|
|
||||||
version_hash=$(git show -s "--format=%h") # abcdefg
|
|
||||||
version_num=$(ruby -e "print '$GITHUB_REF'.split('/')[2]") # legacy version method: master
|
|
||||||
echo "version=${version}"
|
|
||||||
echo "version_tstamp=${version_tstamp}"
|
|
||||||
echo "version_hash=${version_hash}"
|
|
||||||
echo "version_num=${version_num}"
|
|
||||||
VERSION_NUM="${version}~${version_tstamp}~${version_hash}"
|
|
||||||
echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV
|
|
||||||
echo "MAGIC_APPIMAGE_OUTPUT_FILENAME=Magic-${VERSION_NUM}-x86_64-EL8.AppImage" >> $GITHUB_ENV
|
|
||||||
# Is this GHA being run due to a push-on-tag ? if so we make a GitHub release, otherwise we just publish artifact
|
|
||||||
github_tag=$(echo -n "$GITHUB_REF" | sed -e 's#refs/tags/##') # 8.9.999
|
|
||||||
echo "github_tag=$github_tag"
|
|
||||||
if echo -n "$GITHUB_REF" | egrep -q "^refs/tags/" # check prefix
|
|
||||||
then
|
|
||||||
if [ -n "$github_tag" ]
|
|
||||||
then
|
|
||||||
echo "MY_GITHUB_TAG=${github_tag}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build project
|
|
||||||
run: |
|
|
||||||
cd appimage/8
|
|
||||||
make
|
|
||||||
|
|
||||||
ln -v Magic-x86_64.AppImage "${MAGIC_APPIMAGE_OUTPUT_FILENAME}"
|
|
||||||
ls -l *.AppImage
|
|
||||||
sha256sum *.AppImage
|
|
||||||
pwd
|
|
||||||
|
|
||||||
- name: Create RELEASE-NOTES.txt
|
|
||||||
run: |
|
|
||||||
cd appimage/8
|
|
||||||
# Find the last tag (that does not match the current GITHUB_REF)
|
|
||||||
echo GITHUB_REF=$GITHUB_REF
|
|
||||||
echo GITHUB_SHA=$GITHUB_SHA
|
|
||||||
# GitHub CI is a shallow checkout by default (just the files needed to build)
|
|
||||||
# but we also want history back to next tag, see fetch-tags/fetch-depth actions/checkout~issue#1471
|
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
|
|
||||||
then
|
|
||||||
# remove only if ref of tag (to avoid conflict during fetch)
|
|
||||||
git update-ref -d $GITHUB_REF
|
|
||||||
echo git_update_ref_exitstatus=$?
|
|
||||||
fi
|
|
||||||
set +e
|
|
||||||
git fetch --tags --prune --no-recurse-submodules --depth=149 origin +$GITHUB_SHA # fetch-tags: true # is broken
|
|
||||||
echo git_fetch_exitstatus=$?
|
|
||||||
git_show_ref=$(git show-ref --hash $GITHUB_REF) # get tagcommit hash
|
|
||||||
git_show_ref_exitstatus=$?
|
|
||||||
echo git_show_ref_exitstatus=$git_show_ref_exitstatus
|
|
||||||
echo git_show_ref=$git_show_ref
|
|
||||||
git_rev_list=$(git rev-list -n1 $GITHUB_REF) # get commit hash
|
|
||||||
git_rev_list_exitstatus=$?
|
|
||||||
echo git_rev_list_exitstatus=$git_rev_list_exitstatus
|
|
||||||
echo git_rev_list=$git_rev_list
|
|
||||||
set -e
|
|
||||||
test "$git_show_ref" = "$GITHUB_SHA" || test "$git_rev_list" = "$GITHUB_SHA" # check we got the ref back (or fail CI)
|
|
||||||
git_describe=$(git describe --tags $GITHUB_SHA | sed -e 's#\-\([0-9]\+\-g\)#\+\1#') # /-\d+-g/
|
|
||||||
echo git_describe=$git_describe
|
|
||||||
|
|
||||||
# RELEASE-NOTES-EL8.txt
|
|
||||||
echo "### ${MAGIC_APPIMAGE_OUTPUT_FILENAME} commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-EL8.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "This release is based on EL8 (AlmaLinux8), the AppImage format is designed to run on a wide range of Linux distributions." >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/8/README.md" >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL8.txt
|
|
||||||
length_info=$(stat "--format=%s bytes" "${MAGIC_APPIMAGE_OUTPUT_FILENAME}")
|
|
||||||
sha256_info=$(sha256sum "${MAGIC_APPIMAGE_OUTPUT_FILENAME}" | cut -d ' ' -f1)
|
|
||||||
echo "| | |" >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "| :-------- | :------ |" >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "| File Name | ${MAGIC_APPIMAGE_OUTPUT_FILENAME} |" | sed -e 's#~#\\~#g' >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "| File Length | ${length_info} |" >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "| File SHA256 | ${sha256_info} |" >> RELEASE-NOTES-EL8.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL8.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-CL.txt
|
|
||||||
set +e # allow this to fail to empty string
|
|
||||||
git_previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
|
|
||||||
echo git_previous_tag=$git_previous_tag
|
|
||||||
set -e
|
|
||||||
if [ -n "${git_previous_tag}" ]
|
|
||||||
then
|
|
||||||
echo "### Change Log (since previous tag):" > RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
git log --oneline --no-color --no-decorate "refs/tags/${git_previous_tag}..${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
else
|
|
||||||
echo "### Change Log (last commit only):" > RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
git log --oneline -n1 --no-color --no-decorate "${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
fi
|
|
||||||
echo "" >> RELEASE-NOTES-CL.txt
|
|
||||||
|
|
||||||
#echo "### Build Info:" > RELEASE-NOTES-BI.txt
|
|
||||||
# FIXME extract package version info and DSO symvers into RELEASE-NOTES.txt
|
|
||||||
#echo "" >> RELEASE-NOTES-BI.txt
|
|
||||||
|
|
||||||
cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-EL8.txt
|
|
||||||
cat RELEASE-NOTES-EL8.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/7/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/8/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/9/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/10/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-GH.txt (this is shared for all AppImage for one tag)
|
|
||||||
echo "### commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-GH.txt
|
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
|
|
||||||
then
|
|
||||||
# show tag annotation with tags like before
|
|
||||||
git tag --cleanup=strip "--format=%(contents)" -n "${GITHUB_REF:10}" | sed -e 's#\([~|]\)#\\\1#g' >> RELEASE-NOTES-GH.txt
|
|
||||||
fi
|
|
||||||
echo "" >> RELEASE-NOTES-GH.txt
|
|
||||||
cat RELEASE-NOTES-DOCS.txt >> RELEASE-NOTES-GH.txt
|
|
||||||
cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-GH.txt
|
|
||||||
|
|
||||||
# Show in action/artifact output
|
|
||||||
echo "## RELEASE NOTES" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
cat RELEASE-NOTES-EL8.txt >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Upload Release Asset
|
|
||||||
if: ${{ env.MY_GITHUB_TAG != '' }} # if: ${{ github.ref_type == 'tag' }}
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
body_path: ${{ github.workspace }}/appimage/8/RELEASE-NOTES-GH.txt
|
|
||||||
files: |
|
|
||||||
${{ github.workspace }}/appimage/8/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
${{ github.workspace }}/appimage/8/RELEASE-NOTES-EL8.txt
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
#if: ${{ env.MY_GITHUB_TAG == '' }} # commented out to always upload
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
path: |
|
|
||||||
${{ github.workspace }}/appimage/8/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
name: CI-appimage9
|
|
||||||
|
|
||||||
env:
|
|
||||||
APPIMAGETOOL_DOWNLOAD_URL: https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_appimage9:
|
|
||||||
name: Build AppImage EL9
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write # action-gh-release
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 149 # enough to cover between tags
|
|
||||||
#fetch-tags: true # this should work see actions/checkout~issue#1471
|
|
||||||
|
|
||||||
- name: Get the version
|
|
||||||
id: get_version
|
|
||||||
run: |
|
|
||||||
git show -s
|
|
||||||
version=$(cat VERSION) # 8.9.999
|
|
||||||
version_tstamp=$(git show -s "--format=%cs" | tr -d '-') # YYYYMMDD
|
|
||||||
version_hash=$(git show -s "--format=%h") # abcdefg
|
|
||||||
version_num=$(ruby -e "print '$GITHUB_REF'.split('/')[2]") # legacy version method: master
|
|
||||||
echo "version=${version}"
|
|
||||||
echo "version_tstamp=${version_tstamp}"
|
|
||||||
echo "version_hash=${version_hash}"
|
|
||||||
echo "version_num=${version_num}"
|
|
||||||
VERSION_NUM="${version}~${version_tstamp}~${version_hash}"
|
|
||||||
echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV
|
|
||||||
echo "MAGIC_APPIMAGE_OUTPUT_FILENAME=Magic-${VERSION_NUM}-x86_64-EL9.AppImage" >> $GITHUB_ENV
|
|
||||||
# Is this GHA being run due to a push-on-tag ? if so we make a GitHub release, otherwise we just publish artifact
|
|
||||||
github_tag=$(echo -n "$GITHUB_REF" | sed -e 's#refs/tags/##') # 8.9.999
|
|
||||||
echo "github_tag=$github_tag"
|
|
||||||
if echo -n "$GITHUB_REF" | egrep -q "^refs/tags/" # check prefix
|
|
||||||
then
|
|
||||||
if [ -n "$github_tag" ]
|
|
||||||
then
|
|
||||||
echo "MY_GITHUB_TAG=${github_tag}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build project
|
|
||||||
run: |
|
|
||||||
cd appimage/9
|
|
||||||
make
|
|
||||||
|
|
||||||
ln -v Magic-x86_64.AppImage "${MAGIC_APPIMAGE_OUTPUT_FILENAME}"
|
|
||||||
ls -l *.AppImage
|
|
||||||
sha256sum *.AppImage
|
|
||||||
pwd
|
|
||||||
|
|
||||||
- name: Create RELEASE-NOTES.txt
|
|
||||||
run: |
|
|
||||||
cd appimage/9
|
|
||||||
# Find the last tag (that does not match the current GITHUB_REF)
|
|
||||||
echo GITHUB_REF=$GITHUB_REF
|
|
||||||
echo GITHUB_SHA=$GITHUB_SHA
|
|
||||||
# GitHub CI is a shallow checkout by default (just the files needed to build)
|
|
||||||
# but we also want history back to next tag, see fetch-tags/fetch-depth actions/checkout~issue#1471
|
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
|
|
||||||
then
|
|
||||||
# remove only if ref of tag (to avoid conflict during fetch)
|
|
||||||
git update-ref -d $GITHUB_REF
|
|
||||||
echo git_update_ref_exitstatus=$?
|
|
||||||
fi
|
|
||||||
set +e
|
|
||||||
git fetch --tags --prune --no-recurse-submodules --depth=149 origin +$GITHUB_SHA # fetch-tags: true # is broken
|
|
||||||
echo git_fetch_exitstatus=$?
|
|
||||||
git_show_ref=$(git show-ref --hash $GITHUB_REF) # get tagcommit hash
|
|
||||||
git_show_ref_exitstatus=$?
|
|
||||||
echo git_show_ref_exitstatus=$git_show_ref_exitstatus
|
|
||||||
echo git_show_ref=$git_show_ref
|
|
||||||
git_rev_list=$(git rev-list -n1 $GITHUB_REF) # get commit hash
|
|
||||||
git_rev_list_exitstatus=$?
|
|
||||||
echo git_rev_list_exitstatus=$git_rev_list_exitstatus
|
|
||||||
echo git_rev_list=$git_rev_list
|
|
||||||
set -e
|
|
||||||
test "$git_show_ref" = "$GITHUB_SHA" || test "$git_rev_list" = "$GITHUB_SHA" # check we got the ref back (or fail CI)
|
|
||||||
git_describe=$(git describe --tags $GITHUB_SHA | sed -e 's#\-\([0-9]\+\-g\)#\+\1#') # /-\d+-g/
|
|
||||||
echo git_describe=$git_describe
|
|
||||||
|
|
||||||
# RELEASE-NOTES-EL9.txt
|
|
||||||
echo "### ${MAGIC_APPIMAGE_OUTPUT_FILENAME} commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-EL9.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "This release is based on EL9 (AlmaLinux9), the AppImage format is designed to run on a wide range of Linux distributions." >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/9/README.md" >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL9.txt
|
|
||||||
length_info=$(stat "--format=%s bytes" "${MAGIC_APPIMAGE_OUTPUT_FILENAME}")
|
|
||||||
sha256_info=$(sha256sum "${MAGIC_APPIMAGE_OUTPUT_FILENAME}" | cut -d ' ' -f1)
|
|
||||||
echo "| | |" >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "| :-------- | :------ |" >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "| File Name | ${MAGIC_APPIMAGE_OUTPUT_FILENAME} |" | sed -e 's#~#\\~#g' >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "| File Length | ${length_info} |" >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "| File SHA256 | ${sha256_info} |" >> RELEASE-NOTES-EL9.txt
|
|
||||||
echo "" >> RELEASE-NOTES-EL9.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-CL.txt
|
|
||||||
set +e # allow this to fail to empty string
|
|
||||||
git_previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
|
|
||||||
echo git_previous_tag=$git_previous_tag
|
|
||||||
set -e
|
|
||||||
if [ -n "${git_previous_tag}" ]
|
|
||||||
then
|
|
||||||
echo "### Change Log (since previous tag):" > RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
git log --oneline --no-color --no-decorate "refs/tags/${git_previous_tag}..${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
else
|
|
||||||
echo "### Change Log (last commit only):" > RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
git log --oneline -n1 --no-color --no-decorate "${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
|
|
||||||
echo "\`\`\`" >> RELEASE-NOTES-CL.txt
|
|
||||||
fi
|
|
||||||
echo "" >> RELEASE-NOTES-CL.txt
|
|
||||||
|
|
||||||
#echo "### Build Info:" > RELEASE-NOTES-BI.txt
|
|
||||||
# FIXME extract package version info and DSO symvers into RELEASE-NOTES.txt
|
|
||||||
#echo "" >> RELEASE-NOTES-BI.txt
|
|
||||||
|
|
||||||
cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-EL9.txt
|
|
||||||
cat RELEASE-NOTES-EL9.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/7/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/8/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/9/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/10/README.md" >> RELEASE-NOTES-DOCS.txt
|
|
||||||
|
|
||||||
# RELEASE-NOTES-GH.txt (this is shared for all AppImage for one tag)
|
|
||||||
echo "### commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-GH.txt
|
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
|
|
||||||
then
|
|
||||||
# show tag annotation with tags like before
|
|
||||||
git tag --cleanup=strip "--format=%(contents)" -n "${GITHUB_REF:10}" | sed -e 's#\([~|]\)#\\\1#g' >> RELEASE-NOTES-GH.txt
|
|
||||||
fi
|
|
||||||
echo "" >> RELEASE-NOTES-GH.txt
|
|
||||||
cat RELEASE-NOTES-DOCS.txt >> RELEASE-NOTES-GH.txt
|
|
||||||
cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-GH.txt
|
|
||||||
|
|
||||||
# Show in action/artifact output
|
|
||||||
echo "## RELEASE NOTES" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
cat RELEASE-NOTES-EL9.txt >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Upload Release Asset
|
|
||||||
if: ${{ env.MY_GITHUB_TAG != '' }} # if: ${{ github.ref_type == 'tag' }}
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
body_path: ${{ github.workspace }}/appimage/9/RELEASE-NOTES-GH.txt
|
|
||||||
files: |
|
|
||||||
${{ github.workspace }}/appimage/9/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
${{ github.workspace }}/appimage/9/RELEASE-NOTES-EL9.txt
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
#if: ${{ env.MY_GITHUB_TAG == '' }} # commented out to always upload
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
path: |
|
|
||||||
${{ github.workspace }}/appimage/9/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
||||||
|
|
@ -1,291 +0,0 @@
|
||||||
|
|
||||||
name: CI-canary-matrix
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
canary:
|
|
||||||
strategy:
|
|
||||||
max-parallel: 3
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-24.04, ubuntu-22.04]
|
|
||||||
# Configure Options
|
|
||||||
# X11 OGL CAIRO
|
|
||||||
pkgs: [all, none, no_tk_tcl_rl, no_tk_tcl_brl, no_zlib, no_gc_gl_gu, no_gc, no_gl_gu]
|
|
||||||
# Toolchain
|
|
||||||
# ubuntu-20.04 [gcc-9, clang-10]
|
|
||||||
# ubuntu-22.04 [gcc-11, clang-14]
|
|
||||||
# ubuntu-24.04 [gcc-13, clang-18]
|
|
||||||
tc: [default, gcc-10, gcc-11, gcc-12, gcc-13, gcc-14, clang-14, clang-15, clang-17, clang-18, clang-19]
|
|
||||||
exclude:
|
|
||||||
- os: ubuntu-22.04
|
|
||||||
tc: gcc-13
|
|
||||||
- os: ubuntu-22.04
|
|
||||||
tc: gcc-14
|
|
||||||
- os: ubuntu-22.04
|
|
||||||
tc: clang-17
|
|
||||||
- os: ubuntu-22.04 # some sources show this as present but not found
|
|
||||||
tc: clang-18
|
|
||||||
- os: ubuntu-22.04
|
|
||||||
tc: clang-19
|
|
||||||
|
|
||||||
- os: ubuntu-24.04
|
|
||||||
tc: gcc-10
|
|
||||||
- os: ubuntu-24.04
|
|
||||||
tc: gcc-11
|
|
||||||
- os: ubuntu-24.04
|
|
||||||
tc: clang-14
|
|
||||||
- os: ubuntu-24.04
|
|
||||||
tc: clang-15
|
|
||||||
fail-fast: false
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Matrix Check
|
|
||||||
env:
|
|
||||||
MATRIX_OS: ${{ matrix.os }}
|
|
||||||
MATRIX_PKGS: ${{ matrix.pkgs }}
|
|
||||||
MATRIX_TC: ${{ matrix.tc }}
|
|
||||||
run: |
|
|
||||||
# This takes the macros params ENV and processes into options list
|
|
||||||
|
|
||||||
if [ "${MATRIX_PKGS}" = "none" ]
|
|
||||||
then
|
|
||||||
pkgs=""
|
|
||||||
cfgs=""
|
|
||||||
else
|
|
||||||
pkgs="kcnrzCLUX"
|
|
||||||
cfgs=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# z no.*_zl zlib1g-dev
|
|
||||||
# n no.*_nc libncurses-dev
|
|
||||||
# r no.*_rl libreadline-dev
|
|
||||||
# R no.*_brl --enable-readline-bundled
|
|
||||||
# c no.*_tcl tcl-dev
|
|
||||||
# k no.*_tk tk-dev
|
|
||||||
# C no.*_gc libcairo-dev
|
|
||||||
# L no.*_gl libgl-dev
|
|
||||||
# U no.*_gu libglu1-mesa-dev # GLU requires GL
|
|
||||||
# X no.*_gx libx11-dev
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_zl"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#z##'); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_nc"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#n##'); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_brl"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#r#R#'); fi # replace
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_rl"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#r##'); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_tcl"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#c##'); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_tk"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#k##'); fi
|
|
||||||
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_gc"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#C##'); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_gl"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#L##'); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_gu"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#U##'); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_gx"; then
|
|
||||||
pkgs=$(echo -n "$pkgs" | sed -e 's#X##'); fi
|
|
||||||
|
|
||||||
_package_list=()
|
|
||||||
echo -n $pkgs | grep -q "z" && _package_list+=(zlib1g-dev)
|
|
||||||
echo -n $pkgs | grep -q "n" && _package_list+=(libncurses-dev)
|
|
||||||
echo -n $pkgs | grep -q "r" && _package_list+=(libreadline-dev)
|
|
||||||
echo -n $pkgs | grep -q "c" && _package_list+=(tcl-dev)
|
|
||||||
echo -n $pkgs | grep -q "k" && _package_list+=(tk-dev)
|
|
||||||
echo -n $pkgs | grep -q "C" && _package_list+=(libcairo-dev)
|
|
||||||
echo -n $pkgs | grep -q "L" && _package_list+=(libgl-dev)
|
|
||||||
echo -n $pkgs | grep -q "U" && _package_list+=(libglu1-mesa-dev)
|
|
||||||
echo -n $pkgs | grep -q "X" && _package_list+=(libx11-dev)
|
|
||||||
echo "PACKAGE_LIST=${_package_list[*]}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
#
|
|
||||||
_configure_args=()
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_zl"; then
|
|
||||||
_configure_args+=(--disable-compression); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_brl"; then
|
|
||||||
_configure_args+=(--enable-readline-bundled); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_rl"; then
|
|
||||||
_configure_args+=(--disable-readline); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_tcl"; then
|
|
||||||
_configure_args+=(--without-tcl); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_tk"; then
|
|
||||||
_configure_args+=(--without-tk); fi
|
|
||||||
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_gc"; then
|
|
||||||
_configure_args+=(--without-cairo); fi
|
|
||||||
if echo -n "$MATRIX_PKGS" | grep -q "^no.*_gl"; then
|
|
||||||
_configure_args+=(--without-opengl); fi
|
|
||||||
|
|
||||||
echo "CONFIGURE_ARGS=${_configure_args[*]}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Setup Toolchain
|
|
||||||
env:
|
|
||||||
MATRIX_TC: ${{ matrix.tc }}
|
|
||||||
run: |
|
|
||||||
# decode settings
|
|
||||||
BUILD_GCC_VERSION=$( echo -n "$MATRIX_TC" | grep -i "^gcc" | sed -e 's#^gcc\-\?##i')
|
|
||||||
BUILD_CLANG_VERSION=$(echo -n "$MATRIX_TC" | grep -i "^clang" | sed -e 's#^clang\-\?##i')
|
|
||||||
echo "BUILD_GCC_VERSION=$BUILD_GCC_VERSION" >> $GITHUB_ENV
|
|
||||||
echo "BUILD_CLANG_VERSION=$BUILD_CLANG_VERSION" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
|
|
||||||
if [ -n "$BUILD_GCC_VERSION" ]
|
|
||||||
then
|
|
||||||
GCCV=$BUILD_GCC_VERSION
|
|
||||||
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
|
|
||||||
sudo apt-get install gcc-${GCCV} g++-${GCCV} cpp-${GCCV}
|
|
||||||
gcc-${GCCV} -v
|
|
||||||
g++-${GCCV} -v
|
|
||||||
cpp-${GCCV} -v < /dev/null
|
|
||||||
ls -l /usr/bin/g++ /usr/bin/g++-[0-9]* /usr/bin/gcc /usr/bin/gcc-[0-9]* /usr/bin/cpp-* /usr/bin/*-gnu-cpp* || true
|
|
||||||
update-alternatives --list gcc || true
|
|
||||||
update-alternatives --list g++ || true
|
|
||||||
update-alternatives --list cpp || true
|
|
||||||
update-alternatives --query gcc || true
|
|
||||||
update-alternatives --query g++ || true
|
|
||||||
update-alternatives --query cpp || true
|
|
||||||
ls -l /usr/bin/g++ /usr/bin/g++-[0-9]* /usr/bin/gcc /usr/bin/gcc-[0-9]* /usr/bin/cpp-* /usr/bin/*-gnu-cpp* || true
|
|
||||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCCV} 50
|
|
||||||
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCCV} 50
|
|
||||||
sudo update-alternatives --install "/usr/bin/$(uname -m)-linux-gnu-cpp" cpp "/usr/bin/$(uname -m)-linux-gnu-cpp-${GCCV}" 50
|
|
||||||
ls -l /usr/bin/g++ /usr/bin/g++-[0-9]* /usr/bin/gcc /usr/bin/gcc-[0-9]* /usr/bin/cpp-* /usr/bin/*-gnu-cpp* || true
|
|
||||||
update-alternatives --list gcc || true
|
|
||||||
update-alternatives --list g++ || true
|
|
||||||
update-alternatives --list cpp || true
|
|
||||||
hash -r
|
|
||||||
gcc -v
|
|
||||||
elif [ -n "$BUILD_CLANG_VERSION" ]
|
|
||||||
then
|
|
||||||
CLANGV=$BUILD_CLANG_VERSION
|
|
||||||
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
|
|
||||||
sudo apt-get install clang-${CLANGV} clang++-${CLANGV} #clang-cpp-${CLANGV}
|
|
||||||
clang-${CLANGV} -v
|
|
||||||
clang++-${CLANGV} -v
|
|
||||||
clang-cpp-${CLANGV} -v < /dev/null
|
|
||||||
ls -l /usr/bin/clang++ /usr/bin/clang++-[0-9]* /usr/bin/clang /usr/bin/clang-[0-9]* /usr/bin/clang-cpp-* /usr/bin/clang-cpp* || true
|
|
||||||
update-alternatives --list clang || true
|
|
||||||
update-alternatives --list clang++ || true
|
|
||||||
update-alternatives --list clang-cpp || true
|
|
||||||
update-alternatives --query clang || true
|
|
||||||
update-alternatives --query clang++ || true
|
|
||||||
update-alternatives --query clang-cpp || true
|
|
||||||
ls -l /usr/bin/clang++ /usr/bin/clang++-[0-9]* /usr/bin/clang /usr/bin/clang-[0-9]* /usr/bin/clang-cpp-* /usr/bin/clang-cpp* || true
|
|
||||||
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANGV} 50
|
|
||||||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANGV} 50
|
|
||||||
sudo update-alternatives --install "/usr/bin/clang-cpp" clang-cpp "/usr/bin/clang-cpp-${CLANGV}" 50
|
|
||||||
ls -l /usr/bin/clang++ /usr/bin/clang++-[0-9]* /usr/bin/clang /usr/bin/clang-[0-9]* /usr/bin/clang-cpp-* /usr/bin/clang-cpp* || true
|
|
||||||
update-alternatives --list clang || true
|
|
||||||
update-alternatives --list clang++ || true
|
|
||||||
update-alternatives --list clang-cpp || true
|
|
||||||
hash -r
|
|
||||||
clang -v
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Get Dependencies
|
|
||||||
run: |
|
|
||||||
if [ -n "$PACKAGE_LIST" ]
|
|
||||||
then
|
|
||||||
sudo apt-get install -y ${PACKAGE_LIST}
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
if [ -n "$BUILD_CLANG_VERSION" ]
|
|
||||||
then
|
|
||||||
export CC="clang-${BUILD_CLANG_VERSION}"
|
|
||||||
export CXX="clang++-${BUILD_CLANG_VERSION}"
|
|
||||||
export CPP="clang-cpp-${BUILD_CLANG_VERSION}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -o pipefail # due to pipe inside CI
|
|
||||||
./configure $CONFIGURE_ARGS 2>&1 | tee CONFIGURE.LOG
|
|
||||||
|
|
||||||
egrep "^(CPP|CXX|CC)\s" defs.mak
|
|
||||||
|
|
||||||
# Add -Wall for CI loggings
|
|
||||||
sed -e 's# -Werror=# -Wall -Werror=#' -i defs.mak
|
|
||||||
# Non security/reliability related warnings
|
|
||||||
#sed -e 's# -Werror=# -Wno-unused-variable -Werror=#' -i defs.mak
|
|
||||||
#sed -e 's# -Werror=# -Wno-unused-local-typedefs -Werror=#' -i defs.mak
|
|
||||||
#sed -e 's# -Werror=# -Wno-unused-label -Werror=#' -i defs.mak
|
|
||||||
#sed -e 's# -Werror=# -Wno-unused-but-set-variable -Werror=#' -i defs.mak
|
|
||||||
make database/database.h
|
|
||||||
make -j$(nproc) 2>&1 | tee MAKE.LOG
|
|
||||||
|
|
||||||
- name: Summary
|
|
||||||
env:
|
|
||||||
MATRIX_OS: ${{ matrix.os }}
|
|
||||||
MATRIX_PKGS: ${{ matrix.pkgs }}
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
grep "error:" MAKE.LOG > MAKE_error.LOG
|
|
||||||
grep "warning:" MAKE.LOG > MAKE_warning.LOG
|
|
||||||
|
|
||||||
# Less important warnings relating to codesmell more than security (filter out of headline)
|
|
||||||
grep -v "Wunused-variable" MAKE_warning.LOG |
|
|
||||||
grep -v "Wunused-local-typedefs" |
|
|
||||||
grep -v "Wunused-label" |
|
|
||||||
grep -v "Wunused-but-set-variable" > MAKE_warning_filtered.LOG
|
|
||||||
|
|
||||||
ls -l
|
|
||||||
wc -l *.LOG
|
|
||||||
|
|
||||||
error_count=$( grep -c "error:" MAKE_error.LOG)
|
|
||||||
filtered_warning_count=$(grep -c "warning:" MAKE_warning_filtered.LOG)
|
|
||||||
|
|
||||||
title="### $(cat VERSION) ${MATRIX_OS} ${MATRIX_TC} ${MATRIX_PKGS} :: "
|
|
||||||
if [ "$error_count" -gt 0 ]
|
|
||||||
then
|
|
||||||
title="$title $error_count error(s)"
|
|
||||||
fi
|
|
||||||
if [ "$filtered_warning_count" -gt 0 ]
|
|
||||||
then
|
|
||||||
title="$title $filtered_warning_count warning(s)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
(
|
|
||||||
total_error_count=$( wc -l MAKE_error.LOG | cut -d' ' -f1)
|
|
||||||
total_warning_count=$(wc -l MAKE_warning.LOG | cut -d' ' -f1)
|
|
||||||
echo "$title"
|
|
||||||
echo ""
|
|
||||||
echo "PACKAGE_LIST=$PACKAGE_LIST"
|
|
||||||
echo "CONFIGURE_ARGS=$CONFIGURE_ARGS"
|
|
||||||
echo ""
|
|
||||||
if [ "$BUILD_CLANG_VERSION" ]
|
|
||||||
then
|
|
||||||
"clang-${BUILD_CLANG_VERSION}" --version | head -n1
|
|
||||||
if ! update-alternatives --list clang
|
|
||||||
then
|
|
||||||
update-alternatives --list "clang-${BUILD_CLANG_VERSION}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
gcc --version | head -n1
|
|
||||||
if ! update-alternatives --list gcc
|
|
||||||
then
|
|
||||||
update-alternatives --list "gcc-${BUILD_GCC_VERSION}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
echo "total ${total_error_count} error(s) ${total_warning_count} warning(s) :"
|
|
||||||
echo "|Count|Warning Group (-j build log inaccuracies)|"
|
|
||||||
echo "|--:|:--|"
|
|
||||||
# due to -j build the log lines might get corrupted, so missing/incorrect/bogus entries might be seen
|
|
||||||
# so we add extra: egrep "\[\-W.*\]" (to try to remove that)
|
|
||||||
sed -e 's#.*\(\[\-W\)#\1#' -e 's#\(\]\).*$#\1#' MAKE_warning.LOG | egrep "\[\-W.*\]" | sort | uniq -c | sort -n | tr -s ' ' | tr ' ' '|' | awk '{print $0"|"}'
|
|
||||||
echo ""
|
|
||||||
sed -e '0,/Configuration Summary/d' -e '/\---/,//d' CONFIGURE.LOG | egrep "^.*:"
|
|
||||||
echo ""
|
|
||||||
grep DCAD_DIR MAKE.LOG | tail -n1
|
|
||||||
) >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
# CI for native ARM64 Linux build.
|
|
||||||
|
|
||||||
name: CI-aarch64
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
simple_build_linux_arm:
|
|
||||||
runs-on: ubuntu-24.04-arm
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Get Dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y tcl-dev tk-dev libcairo-dev
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
./configure
|
|
||||||
make database/database.h
|
|
||||||
make -j$(nproc)
|
|
||||||
|
|
@ -1,475 +0,0 @@
|
||||||
# This is a basic workflow to help you get started with Actions
|
|
||||||
|
|
||||||
name: CI-macos
|
|
||||||
|
|
||||||
# Controls when the workflow will run
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
||||||
jobs:
|
|
||||||
simple_build_macos15:
|
|
||||||
runs-on: macos-15-intel # only and last supported intel MacOS
|
|
||||||
timeout-minutes: 45 # x86_64 seems non-SSD based (slower)
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Get Dependencies
|
|
||||||
shell: bash # default shell has unwanted broken pipe indication
|
|
||||||
run: |
|
|
||||||
brew install --cask xquartz
|
|
||||||
PACKAGE_LIST="xquartz"
|
|
||||||
brew install cairo tcl-tk@8 tcsh gnu-sed
|
|
||||||
_package_list="cairo tcl-tk@8 tcsh gnu-sed"
|
|
||||||
# These seem needed maybe they are being provided from somewhere else GHA runner
|
|
||||||
# or brew transitive depend either way doesn't hurt to confirm they are installed.
|
|
||||||
_package_list="$_package_list libglu freeglut"
|
|
||||||
if [ -n "$PACKAGE_LIST" ]
|
|
||||||
then
|
|
||||||
brew install $PACKAGE_LIST
|
|
||||||
fi
|
|
||||||
PACKAGE_LIST="$PACKAGE_LIST $_package_list"
|
|
||||||
echo "PACKAGE_LIST=$PACKAGE_LIST" >> $GITHUB_ENV
|
|
||||||
echo "UNAME_M=$(uname -m)" >> $GITHUB_ENV
|
|
||||||
set +e
|
|
||||||
set +o pipefail # macosx this is on by default (turn it off)
|
|
||||||
(
|
|
||||||
echo "### $(uname -s) $(uname -m) $(uname -r)"
|
|
||||||
echo ""
|
|
||||||
set +e
|
|
||||||
set +o pipefail # macosx this is on by default (turn it off)
|
|
||||||
export HOMEBREW_NO_COLOR=true
|
|
||||||
export HOMEBREW_NO_EMOKI=true
|
|
||||||
# output to $TMPFILE first, then head, instead of using pipeline directly
|
|
||||||
# this removes unwanted GHA SIGPIPE error/warning indicators from GHA logs
|
|
||||||
# brew maybe a nodejs command which has a known issue in this area on macosx
|
|
||||||
TMPFILE=/tmp/shell0$$.tmp
|
|
||||||
brew info xquartz > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info cairo > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info libglu > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info freeglut > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info tcl-tk > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info tcl-tk@8 > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info tcsh > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info gnu-sed > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
echo ""
|
|
||||||
cc -v 2>&1
|
|
||||||
echo ""
|
|
||||||
xcodebuild -version
|
|
||||||
echo ""
|
|
||||||
xcodebuild -showsdks | grep macOS
|
|
||||||
) >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Search
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
( # designed to speed up this process in a single scan
|
|
||||||
echo "#!/bin/sh"
|
|
||||||
echo "echo \$*"
|
|
||||||
echo "ls -ld -- \$*"
|
|
||||||
echo "shasum -a 1 \$* </dev/null"
|
|
||||||
echo "echo \"\""
|
|
||||||
echo "exit 0"
|
|
||||||
) > search.sh
|
|
||||||
echo "=== search.sh"
|
|
||||||
cat search.sh
|
|
||||||
chmod a+x search.sh
|
|
||||||
find /opt /usr $HOME \( -iname "libX11.*dylib" -or -iname "Xlib.h" -or -iname "libtcl*dylib" -or -iname "tcl.h" \) -exec ./search.sh {} \; 2>/dev/null
|
|
||||||
#
|
|
||||||
# Example symbols that were found missing from the tcl-tk X11 implementation
|
|
||||||
#find /opt /usr $HOME -iname "x*.h" -exec grep -Hn "XCreateGC" {} \; 2>/dev/null || true
|
|
||||||
#find /opt /usr $HOME -iname "x*.h" -exec grep -Hn "XGetVisualInfo" {} \; 2>/dev/null || true
|
|
||||||
#for i in /usr/X11/include/X11/Xlib.h /opt/X11/include/X11/Xlib.h /usr/local/include/X11/Xlib.h;
|
|
||||||
#do
|
|
||||||
# echo "====== $i"
|
|
||||||
# head -n 50 "$i"
|
|
||||||
# echo "==="
|
|
||||||
# tail -n 50 "$i"
|
|
||||||
# echo "======"
|
|
||||||
#done
|
|
||||||
|
|
||||||
# Different GHA platforms have different layouts (x86_64/arm64)
|
|
||||||
echo "=== /opt"
|
|
||||||
ls -l /opt
|
|
||||||
if [ -d /opt/homebrew ]
|
|
||||||
then
|
|
||||||
echo "=== /opt/homebrew"
|
|
||||||
ls -l /opt/homebrew
|
|
||||||
fi
|
|
||||||
echo "=== /usr/local/opt"
|
|
||||||
ls -l /usr/local/opt
|
|
||||||
echo "=== /usr/local/opt/runner"
|
|
||||||
ls -l /usr/local/opt/runner
|
|
||||||
|
|
||||||
echo "Done"
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
export PATH="/opt/X11/bin:$PATH"
|
|
||||||
./scripts/configure_mac 2>&1 | tee CONFIGURE.LOG
|
|
||||||
|
|
||||||
config_log=""
|
|
||||||
if [ -f scripts/config.log ]
|
|
||||||
then
|
|
||||||
config_log="scripts/config.log"
|
|
||||||
elif [ -f build-magic/config.log ]
|
|
||||||
then
|
|
||||||
config_log="build-magic/config.log"
|
|
||||||
fi
|
|
||||||
if [ -n "$config_log" ]
|
|
||||||
then
|
|
||||||
CONFIGURE_ARGS=$(head -n 10 $config_log | egrep "./configure" | sed -e 's#^ *\$ ##' -e 's#./configure ##')
|
|
||||||
echo "CONFIGURE_ARGS=$CONFIGURE_ARGS" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "===== defs.mak ====="
|
|
||||||
cat defs.mak
|
|
||||||
echo "===== defs.mak ====="
|
|
||||||
|
|
||||||
make database/database.h
|
|
||||||
make -j$(sysctl -n hw.ncpu) 2>&1 | tee MAKE.LOG
|
|
||||||
|
|
||||||
- name: Install
|
|
||||||
run: |
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
- name: Kick The Tyres
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
echo "=== ls -l"
|
|
||||||
ls -l
|
|
||||||
find . -type f \( -name "*.dylib" -or -name "magic" -or -name "magicexec" -or -name "magicdnull" \)
|
|
||||||
echo "=== find /usr/local/bin"
|
|
||||||
find /usr/local/bin -mtime 0
|
|
||||||
echo "=== find /usr/local/share"
|
|
||||||
find /usr/local/share -mtime 0
|
|
||||||
echo "=== find /usr/local/lib/magic"
|
|
||||||
find /usr/local/lib/magic -mtime 0
|
|
||||||
echo "=== otool -L magic/tclmagic.dylib"
|
|
||||||
otool -L magic/tclmagic.dylib
|
|
||||||
echo "=== otool -L tcltk/magicexec"
|
|
||||||
otool -L tcltk/magicexec
|
|
||||||
echo "=== otool -L tcltk/magicdnull"
|
|
||||||
otool -L tcltk/magicdnull
|
|
||||||
|
|
||||||
set +o pipefail # macosx this is on by default (turn it off)
|
|
||||||
|
|
||||||
echo "=== magic --version"
|
|
||||||
magic --version
|
|
||||||
echo "=== magic -d help -noconsole"
|
|
||||||
magic -d help -noconsole
|
|
||||||
echo "=== magic -d null -noconsole -nowindow -T scmos"
|
|
||||||
echo "version ; quit" | magic -d null -noconsole -nowindow -T scmos
|
|
||||||
echo "=== magic -d null -noconsole -T scmos"
|
|
||||||
echo "version ; quit" | magic -d null -noconsole -T scmos
|
|
||||||
|
|
||||||
- name: Summary
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
|
|
||||||
ls -l
|
|
||||||
|
|
||||||
touch MAKE.LOG # just in case it did not even build
|
|
||||||
grep "error:" MAKE.LOG > MAKE_error.LOG
|
|
||||||
grep "warning:" MAKE.LOG > MAKE_warning.LOG
|
|
||||||
|
|
||||||
# Less important warnings relating to codesmell more than security (filter out of headline)
|
|
||||||
grep -v "Wunused-variable" MAKE_warning.LOG |
|
|
||||||
grep -v "Wunused-local-typedefs" |
|
|
||||||
grep -v "Wunused-label" |
|
|
||||||
grep -v "Wunused-but-set-variable" > MAKE_warning_filtered.LOG
|
|
||||||
|
|
||||||
wc -l *.LOG
|
|
||||||
|
|
||||||
error_count=$( grep -c "error:" MAKE_error.LOG)
|
|
||||||
filtered_warning_count=$(grep -c "warning:" MAKE_warning_filtered.LOG)
|
|
||||||
|
|
||||||
title="### $(cat VERSION) ${MATRIX_OS} ${MATRIX_TC} ${MATRIX_PKGS} :: "
|
|
||||||
if [ "$error_count" -gt 0 ]
|
|
||||||
then
|
|
||||||
title="$title $error_count error(s)"
|
|
||||||
fi
|
|
||||||
if [ "$filtered_warning_count" -gt 0 ]
|
|
||||||
then
|
|
||||||
title="$title $filtered_warning_count warning(s)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
(
|
|
||||||
total_error_count=$( wc -l MAKE_error.LOG | cut -d' ' -f1)
|
|
||||||
total_warning_count=$(wc -l MAKE_warning.LOG | cut -d' ' -f1)
|
|
||||||
echo "---"
|
|
||||||
echo "$title"
|
|
||||||
echo ""
|
|
||||||
[ -f scripts/config.log ] && grep "./configure" scripts/config.log | head -n1
|
|
||||||
echo ""
|
|
||||||
echo "PACKAGE_LIST=$PACKAGE_LIST"
|
|
||||||
echo "CONFIGURE_ARGS=$CONFIGURE_ARGS"
|
|
||||||
echo ""
|
|
||||||
if [ -s MAKE.LOG ]
|
|
||||||
then
|
|
||||||
echo "total ${total_error_count} error(s) ${total_warning_count} warning(s) :"
|
|
||||||
echo "|Count|Warning Group (-j build log inaccuracies)|"
|
|
||||||
echo "|--:|:--|"
|
|
||||||
# due to -j build the log lines might get corrupted, so missing/incorrect/bogus entries might be seen
|
|
||||||
# so we add extra: egrep "\[\-W.*\]" (to try to remove that)
|
|
||||||
sed -e 's#.*\(\[\-W\)#\1#' -e 's#\(\]\).*$#\1#' MAKE_warning.LOG | egrep "\[\-W.*\]" | sort | uniq -c | sort -n | tr -s ' ' | tr ' ' '|' | awk '{print $0"|"}'
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
grep -A100 "Configuration Summary" CONFIGURE.LOG | grep -v "Configuration Summary" | egrep "^.*:" | sed -e '/\---/,//d'
|
|
||||||
echo ""
|
|
||||||
grep DCAD_DIR MAKE.LOG | tail -n1
|
|
||||||
) >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Prepare archive
|
|
||||||
run: |
|
|
||||||
mkdir -p dist
|
|
||||||
make install "DESTDIR=$(pwd)/dist"
|
|
||||||
# Diagnostic details about this build
|
|
||||||
mkdir -p dist/BUILD-INFO
|
|
||||||
set +e
|
|
||||||
cp */config.log dist/BUILD-INFO/
|
|
||||||
cp *.mak dist/BUILD-INFO/
|
|
||||||
cp *.LOG dist/BUILD-INFO/
|
|
||||||
|
|
||||||
- name: Upload archive magic-macos15
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: magic-macos15
|
|
||||||
path: |
|
|
||||||
${{ github.workspace }}/dist
|
|
||||||
|
|
||||||
simple_build_macos:
|
|
||||||
runs-on: macos-latest
|
|
||||||
timeout-minutes: 30 # arm64 seems SSD based (faster)
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Get Dependencies
|
|
||||||
shell: bash # default shell has unwanted broken pipe indication
|
|
||||||
run: |
|
|
||||||
brew install --cask xquartz
|
|
||||||
PACKAGE_LIST="xquartz"
|
|
||||||
brew install cairo tcl-tk@8 tcsh gnu-sed
|
|
||||||
_package_list="cairo tcl-tk@8 tcsh gnu-sed"
|
|
||||||
# These seem needed maybe they are being provided from somewhere else GHA runner
|
|
||||||
# or brew transitive depend either way doesn't hurt to confirm they are installed.
|
|
||||||
_package_list="$_package_list libglu freeglut"
|
|
||||||
if [ -n "$PACKAGE_LIST" ]
|
|
||||||
then
|
|
||||||
brew install $PACKAGE_LIST
|
|
||||||
fi
|
|
||||||
PACKAGE_LIST="$PACKAGE_LIST $_package_list"
|
|
||||||
echo "PACKAGE_LIST=$PACKAGE_LIST" >> $GITHUB_ENV
|
|
||||||
echo "UNAME_M=$(uname -m)" >> $GITHUB_ENV
|
|
||||||
set +e
|
|
||||||
set +o pipefail # macosx this is on by default (turn it off)
|
|
||||||
(
|
|
||||||
echo "### $(uname -s) $(uname -m) $(uname -r)"
|
|
||||||
echo ""
|
|
||||||
set +e
|
|
||||||
set +o pipefail # macosx this is on by default (turn it off)
|
|
||||||
export HOMEBREW_NO_COLOR=true
|
|
||||||
export HOMEBREW_NO_EMOKI=true
|
|
||||||
# output to $TMPFILE first, then head, instead of using pipeline directly
|
|
||||||
# this removes unwanted GHA SIGPIPE error/warning indicators from GHA logs
|
|
||||||
# brew maybe a nodejs command which has a known issue in this area on macosx
|
|
||||||
TMPFILE=/tmp/shell0$$.tmp
|
|
||||||
brew info xquartz > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info cairo > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info libglu > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info freeglut > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info tcl-tk > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info tcl-tk@8 > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info tcsh > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
brew info gnu-sed > $TMPFILE && head -n1 $TMPFILE
|
|
||||||
echo ""
|
|
||||||
cc -v 2>&1
|
|
||||||
echo ""
|
|
||||||
xcodebuild -version
|
|
||||||
echo ""
|
|
||||||
xcodebuild -showsdks | grep macOS
|
|
||||||
) >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Search
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
( # designed to speed up this process in a single scan
|
|
||||||
echo "#!/bin/sh"
|
|
||||||
echo "echo \$*"
|
|
||||||
echo "ls -ld -- \$*"
|
|
||||||
echo "shasum -a 1 \$* </dev/null"
|
|
||||||
echo "echo \"\""
|
|
||||||
echo "exit 0"
|
|
||||||
) > search.sh
|
|
||||||
echo "=== search.sh"
|
|
||||||
cat search.sh
|
|
||||||
chmod a+x search.sh
|
|
||||||
find /opt /usr $HOME \( -iname "libX11.*dylib" -or -iname "Xlib.h" -or -iname "libtcl*dylib" -or -iname "tcl.h" \) -exec ./search.sh {} \; 2>/dev/null
|
|
||||||
#
|
|
||||||
# Example symbols that were found missing from the tcl-tk X11 implementation
|
|
||||||
#find /opt /usr $HOME -iname "x*.h" -exec grep -Hn "XCreateGC" {} \; 2>/dev/null || true
|
|
||||||
#find /opt /usr $HOME -iname "x*.h" -exec grep -Hn "XGetVisualInfo" {} \; 2>/dev/null || true
|
|
||||||
#for i in /usr/X11/include/X11/Xlib.h /opt/X11/include/X11/Xlib.h /usr/local/include/X11/Xlib.h;
|
|
||||||
#do
|
|
||||||
# echo "====== $i"
|
|
||||||
# head -n 50 "$i"
|
|
||||||
# echo "==="
|
|
||||||
# tail -n 50 "$i"
|
|
||||||
# echo "======"
|
|
||||||
#done
|
|
||||||
|
|
||||||
# Different GHA platforms have different layouts (x86_64/arm64)
|
|
||||||
echo "=== /opt"
|
|
||||||
ls -l /opt
|
|
||||||
if [ -d /opt/homebrew ]
|
|
||||||
then
|
|
||||||
echo "=== /opt/homebrew"
|
|
||||||
ls -l /opt/homebrew
|
|
||||||
fi
|
|
||||||
echo "=== /usr/local/opt"
|
|
||||||
ls -l /usr/local/opt
|
|
||||||
echo "=== /usr/local/opt/runner"
|
|
||||||
ls -l /usr/local/opt/runner
|
|
||||||
|
|
||||||
echo "Done"
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
export PATH="/opt/X11/bin:$PATH"
|
|
||||||
./scripts/configure_mac 2>&1 | tee CONFIGURE.LOG
|
|
||||||
|
|
||||||
config_log=""
|
|
||||||
if [ -f scripts/config.log ]
|
|
||||||
then
|
|
||||||
config_log="scripts/config.log"
|
|
||||||
elif [ -f build-magic/config.log ]
|
|
||||||
then
|
|
||||||
config_log="build-magic/config.log"
|
|
||||||
fi
|
|
||||||
if [ -n "$config_log" ]
|
|
||||||
then
|
|
||||||
CONFIGURE_ARGS=$(head -n 10 $config_log | egrep "./configure" | sed -e 's#^ *\$ ##' -e 's#./configure ##')
|
|
||||||
echo "CONFIGURE_ARGS=$CONFIGURE_ARGS" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "===== defs.mak ====="
|
|
||||||
cat defs.mak
|
|
||||||
echo "===== defs.mak ====="
|
|
||||||
|
|
||||||
make database/database.h
|
|
||||||
make -j$(sysctl -n hw.ncpu) 2>&1 | tee MAKE.LOG
|
|
||||||
|
|
||||||
- name: Install
|
|
||||||
run: |
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
- name: Kick The Tyres
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
echo "=== ls -l"
|
|
||||||
ls -l
|
|
||||||
find . -type f \( -name "*.dylib" -or -name "magic" -or -name "magicexec" -or -name "magicdnull" \)
|
|
||||||
echo "=== find /usr/local/bin"
|
|
||||||
find /usr/local/bin -mtime 0
|
|
||||||
echo "=== find /usr/local/share"
|
|
||||||
find /usr/local/share -mtime 0
|
|
||||||
echo "=== find /usr/local/lib/magic"
|
|
||||||
find /usr/local/lib/magic -mtime 0
|
|
||||||
echo "=== otool -L magic/tclmagic.dylib"
|
|
||||||
otool -L magic/tclmagic.dylib
|
|
||||||
echo "=== otool -L tcltk/magicexec"
|
|
||||||
otool -L tcltk/magicexec
|
|
||||||
echo "=== otool -L tcltk/magicdnull"
|
|
||||||
otool -L tcltk/magicdnull
|
|
||||||
|
|
||||||
set +o pipefail # macosx this is on by default (turn it off)
|
|
||||||
|
|
||||||
echo "=== magic --version"
|
|
||||||
magic --version
|
|
||||||
echo "=== magic -d help -noconsole"
|
|
||||||
magic -d help -noconsole
|
|
||||||
echo "=== magic -d null -noconsole -nowindow -T scmos"
|
|
||||||
echo "version ; quit" | magic -d null -noconsole -nowindow -T scmos
|
|
||||||
echo "=== magic -d null -noconsole -T scmos"
|
|
||||||
echo "version ; quit" | magic -d null -noconsole -T scmos
|
|
||||||
|
|
||||||
- name: Summary
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
|
|
||||||
ls -l
|
|
||||||
|
|
||||||
touch MAKE.LOG # just in case it did not even build
|
|
||||||
grep "error:" MAKE.LOG > MAKE_error.LOG
|
|
||||||
grep "warning:" MAKE.LOG > MAKE_warning.LOG
|
|
||||||
|
|
||||||
# Less important warnings relating to codesmell more than security (filter out of headline)
|
|
||||||
grep -v "Wunused-variable" MAKE_warning.LOG |
|
|
||||||
grep -v "Wunused-local-typedefs" |
|
|
||||||
grep -v "Wunused-label" |
|
|
||||||
grep -v "Wunused-but-set-variable" > MAKE_warning_filtered.LOG
|
|
||||||
|
|
||||||
wc -l *.LOG
|
|
||||||
|
|
||||||
error_count=$( grep -c "error:" MAKE_error.LOG)
|
|
||||||
filtered_warning_count=$(grep -c "warning:" MAKE_warning_filtered.LOG)
|
|
||||||
|
|
||||||
title="### $(cat VERSION) ${MATRIX_OS} ${MATRIX_TC} ${MATRIX_PKGS} :: "
|
|
||||||
if [ "$error_count" -gt 0 ]
|
|
||||||
then
|
|
||||||
title="$title $error_count error(s)"
|
|
||||||
fi
|
|
||||||
if [ "$filtered_warning_count" -gt 0 ]
|
|
||||||
then
|
|
||||||
title="$title $filtered_warning_count warning(s)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
(
|
|
||||||
total_error_count=$( wc -l MAKE_error.LOG | cut -d' ' -f1)
|
|
||||||
total_warning_count=$(wc -l MAKE_warning.LOG | cut -d' ' -f1)
|
|
||||||
echo "---"
|
|
||||||
echo "$title"
|
|
||||||
echo ""
|
|
||||||
[ -f scripts/config.log ] && grep "./configure" scripts/config.log | head -n1
|
|
||||||
echo ""
|
|
||||||
echo "PACKAGE_LIST=$PACKAGE_LIST"
|
|
||||||
echo "CONFIGURE_ARGS=$CONFIGURE_ARGS"
|
|
||||||
echo ""
|
|
||||||
if [ -s MAKE.LOG ]
|
|
||||||
then
|
|
||||||
echo "total ${total_error_count} error(s) ${total_warning_count} warning(s) :"
|
|
||||||
echo "|Count|Warning Group (-j build log inaccuracies)|"
|
|
||||||
echo "|--:|:--|"
|
|
||||||
# due to -j build the log lines might get corrupted, so missing/incorrect/bogus entries might be seen
|
|
||||||
# so we add extra: egrep "\[\-W.*\]" (to try to remove that)
|
|
||||||
sed -e 's#.*\(\[\-W\)#\1#' -e 's#\(\]\).*$#\1#' MAKE_warning.LOG | egrep "\[\-W.*\]" | sort | uniq -c | sort -n | tr -s ' ' | tr ' ' '|' | awk '{print $0"|"}'
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
grep -A100 "Configuration Summary" CONFIGURE.LOG | grep -v "Configuration Summary" | egrep "^.*:" | sed -e '/\---/,//d'
|
|
||||||
echo ""
|
|
||||||
grep DCAD_DIR MAKE.LOG | tail -n1
|
|
||||||
) >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Prepare archive
|
|
||||||
run: |
|
|
||||||
mkdir -p dist
|
|
||||||
make install "DESTDIR=$(pwd)/dist"
|
|
||||||
# Diagnostic details about this build
|
|
||||||
mkdir -p dist/BUILD-INFO
|
|
||||||
set +e
|
|
||||||
cp */config.log dist/BUILD-INFO/
|
|
||||||
cp *.mak dist/BUILD-INFO/
|
|
||||||
cp *.LOG dist/BUILD-INFO/
|
|
||||||
|
|
||||||
- name: Upload archive magic-macos
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: magic-macos
|
|
||||||
path: |
|
|
||||||
${{ github.workspace }}/dist
|
|
||||||
|
|
@ -1,160 +0,0 @@
|
||||||
name: CI-wasm
|
|
||||||
|
|
||||||
# Builds the Magic WebAssembly target on every push and pull request.
|
|
||||||
# When the VERSION file changes on the default branch, the package is
|
|
||||||
# additionally published to GitHub Packages (npm.pkg.github.com) as
|
|
||||||
# @<owner>/magic-vlsi-wasm — no manual tag or token required.
|
|
||||||
# Tim Edwards updates VERSION to trigger a new release; the scope resolves
|
|
||||||
# automatically to the repo owner, so forks publish under their own namespace.
|
|
||||||
#
|
|
||||||
# WASM is architecture-independent — built once on x86-64, usable everywhere.
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
emsdk_version:
|
|
||||||
description: 'emsdk version to build with (default: latest; pin a version number to bisect)'
|
|
||||||
type: string
|
|
||||||
default: 'latest'
|
|
||||||
dry_run:
|
|
||||||
description: 'Dry run: pack only, do not publish even on tag pushes'
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
|
|
||||||
# actions/upload-artifact@v5 still runs on Node.js 20. Force Node 24 to
|
|
||||||
# silence the deprecation warning until upload-artifact ships a Node-24
|
|
||||||
# release. Drop this once upgraded.
|
|
||||||
env:
|
|
||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-wasm:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
registry-url: 'https://npm.pkg.github.com'
|
|
||||||
|
|
||||||
- name: Install emsdk
|
|
||||||
env:
|
|
||||||
# Defaults to latest so CI tracks emsdk HEAD and catches breakage early.
|
|
||||||
# Override via workflow_dispatch to pin a specific version when needed
|
|
||||||
# (e.g. to bisect a regression or verify a post-build.sh patch still applies).
|
|
||||||
EMSDK_VERSION: ${{ github.event.inputs.emsdk_version || 'latest' }}
|
|
||||||
run: |
|
|
||||||
git clone https://github.com/emscripten-core/emsdk.git
|
|
||||||
cd emsdk
|
|
||||||
./emsdk install "$EMSDK_VERSION"
|
|
||||||
./emsdk activate "$EMSDK_VERSION"
|
|
||||||
|
|
||||||
# Dump native + emscripten preprocessor defines. Useful for diagnosing
|
|
||||||
# WASM-build differences after an emsdk bump.
|
|
||||||
- name: Emscripten Diagnostic
|
|
||||||
run: |
|
|
||||||
source ./emsdk/emsdk_env.sh
|
|
||||||
echo "===== gcc -dM -E - ====="; echo | gcc -dM -E - | sort
|
|
||||||
echo "===== g++ -dM -E - ====="; echo | g++ -dM -E - | sort
|
|
||||||
echo "===== emcc -dM -E - ====="; echo | emcc -dM -E - | sort
|
|
||||||
echo "===== em++ -dM -E - ====="; echo | em++ -dM -E - | sort
|
|
||||||
|
|
||||||
- name: Build WASM
|
|
||||||
run: |
|
|
||||||
source ./emsdk/emsdk_env.sh
|
|
||||||
# --without/--disable flags: no WASM library available for these features
|
|
||||||
CFLAGS="--std=c17 -D_DEFAULT_SOURCE=1 -DEMSCRIPTEN=1" emconfigure ./configure \
|
|
||||||
--without-cairo --without-opengl --without-x --without-tk --without-tcl \
|
|
||||||
--disable-readline --disable-compression \
|
|
||||||
--host=asmjs-unknown-emscripten \
|
|
||||||
--target=asmjs-unknown-emscripten
|
|
||||||
# Append WASM linker flags and activate the WASM link target
|
|
||||||
cat toolchains/emscripten/defs.mak >> defs.mak
|
|
||||||
# Echo the merged defs.mak so CI logs show the exact build config
|
|
||||||
echo "===== defs.mak ====="; cat defs.mak; echo "===== defs.mak ====="
|
|
||||||
# Build in order: techs must exist before mains (--embed-file embeds them)
|
|
||||||
emmake make depend
|
|
||||||
emmake make -j$(nproc) modules libs
|
|
||||||
emmake make techs
|
|
||||||
emmake make mains
|
|
||||||
|
|
||||||
- name: Copy WASM artifacts into npm/
|
|
||||||
run: |
|
|
||||||
cp magic/magic.js npm/
|
|
||||||
cp magic/magic.wasm npm/
|
|
||||||
|
|
||||||
- name: Run example tests
|
|
||||||
run: cd npm && npm run test
|
|
||||||
|
|
||||||
# Dump generated text outputs (.ext, .spice, .cif, …) into the CI log
|
|
||||||
# so a regression in extraction / netlisting / cifoutput is visible
|
|
||||||
# without having to download artifacts. The .gds output is binary —
|
|
||||||
# skip it and just record its size.
|
|
||||||
- name: Display example outputs
|
|
||||||
run: |
|
|
||||||
shopt -s nullglob
|
|
||||||
for f in npm/examples/output/*; do
|
|
||||||
name=$(basename "$f")
|
|
||||||
case "$f" in
|
|
||||||
*.gds) echo "===== $name (binary, $(wc -c < "$f") bytes — skipped) =====" ;;
|
|
||||||
*) echo "===== $name ====="; cat "$f" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Set package version and scope
|
|
||||||
run: |
|
|
||||||
base=$(cat VERSION) # e.g. 8.3.637
|
|
||||||
date=$(git show -s --format=%cs | tr -d '-') # e.g. 20260414
|
|
||||||
hash=$(git show -s --format=%h) # e.g. d157eea
|
|
||||||
VERSION="${base}-${date}.${hash}"
|
|
||||||
# Scope the package to the repo owner so it lands in the right
|
|
||||||
# GitHub Packages namespace regardless of who hosts the repo.
|
|
||||||
# e.g. @rtimothyedwards/magic-vlsi-wasm on Tim's repo,
|
|
||||||
# @intubun/magic-vlsi-wasm on a fork.
|
|
||||||
SCOPED_NAME="@${{ github.repository_owner }}/magic-vlsi-wasm"
|
|
||||||
cd npm
|
|
||||||
npm pkg set name="$SCOPED_NAME"
|
|
||||||
npm pkg set publishConfig.registry="https://npm.pkg.github.com"
|
|
||||||
npm version "$VERSION" --no-git-tag-version
|
|
||||||
|
|
||||||
- name: Pack
|
|
||||||
run: ./npm/pack.sh
|
|
||||||
|
|
||||||
- name: Upload tarball as artifact
|
|
||||||
uses: actions/upload-artifact@v5
|
|
||||||
with:
|
|
||||||
name: magic-vlsi-wasm-npm
|
|
||||||
path: npm/*.tgz
|
|
||||||
|
|
||||||
- name: Check if VERSION changed
|
|
||||||
id: version_changed
|
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: |
|
|
||||||
if echo "${{ github.ref }}" | grep -q '^refs/tags/'; then
|
|
||||||
echo "changed=true" >> $GITHUB_OUTPUT
|
|
||||||
elif [ "${{ github.ref }}" = "refs/heads/${{ github.event.repository.default_branch }}" ]; then
|
|
||||||
if git diff --name-only HEAD~1 HEAD 2>/dev/null | grep -q '^VERSION$'; then
|
|
||||||
echo "changed=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "changed=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "changed=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Publish to GitHub Packages
|
|
||||||
if: steps.version_changed.outputs.changed == 'true' && github.event.inputs.dry_run != 'true'
|
|
||||||
run: cd npm && npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
@ -1,21 +1,72 @@
|
||||||
|
# This is a basic workflow to help you get started with Actions
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
|
# Controls when the workflow will run
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
jobs:
|
jobs:
|
||||||
simple_build_linux:
|
vezzal:
|
||||||
|
# The type of runner that the job will run on
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- name: Pulling the docker image
|
||||||
|
run: docker pull vezzal/vezzal:v1
|
||||||
|
|
||||||
|
- name: Start the container with the docker image
|
||||||
|
run: docker run -id --name test_magic vezzal/vezzal:v1 bash | exit
|
||||||
|
|
||||||
|
- name: Run the testing on the container and send the mail
|
||||||
|
run: docker exec test_magic /vezzal/test_magic.sh "lankasaicharan123@gmail.com,tim@opencircuitdesign.com" ${{secrets.MAILING_KEY}}
|
||||||
|
simple_build_linux:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
- name: Get Dependencies
|
- name: Get Dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y tcl-dev tk-dev libcairo-dev
|
sudo apt-get install -y tcl-dev tk-dev libcairo-dev
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
./configure
|
./configure
|
||||||
make database/database.h
|
make database/database.h
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
|
simple_build_wasm:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Get Dependencies
|
||||||
|
run: |
|
||||||
|
git clone https://github.com/emscripten-core/emsdk.git
|
||||||
|
cd emsdk
|
||||||
|
./emsdk install latest
|
||||||
|
./emsdk activate latest
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
source ./emsdk/emsdk_env.sh
|
||||||
|
emconfigure ./configure --without-cairo --without-opengl --without-x --disable-readline --target=asmjs-unknown-emscripten
|
||||||
|
emmake make
|
||||||
|
- name: archive wasm bundle
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: magic-wasm-bundle
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/magic/magic.wasm
|
||||||
|
# simple_build_mac:
|
||||||
|
# runs-on: macos-11
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v2
|
||||||
|
# - name: Get Dependencies
|
||||||
|
# run: |
|
||||||
|
# brew install --cask xquartz
|
||||||
|
# brew install cairo tcl-tk tcsh
|
||||||
|
# - name: Build
|
||||||
|
# run: |
|
||||||
|
# export PATH="/opt/X11/bin:$PATH"
|
||||||
|
# ./scripts/configure_mac
|
||||||
|
# make database/database.h
|
||||||
|
# make -j$(sysctl -n hw.ncpu)
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,20 @@
|
||||||
# Autoconf / configure outputs
|
|
||||||
defs.mak
|
defs.mak
|
||||||
!toolchains/emscripten/defs.mak
|
*/Depend
|
||||||
config.cache
|
config.cache
|
||||||
config.log
|
config.log
|
||||||
scripts/config.log
|
scripts/config.log
|
||||||
scripts/config.status
|
scripts/config.status
|
||||||
scripts/defs.mak
|
scripts/defs.mak
|
||||||
install.log
|
|
||||||
make.log
|
|
||||||
reconfigure.sh
|
|
||||||
|
|
||||||
# Compiled objects / libraries
|
|
||||||
*.o
|
|
||||||
*.a
|
|
||||||
*.so
|
|
||||||
*/Depend
|
|
||||||
database/database.h
|
|
||||||
|
|
||||||
# Editor / OS cruft
|
|
||||||
.*.swp
|
.*.swp
|
||||||
.*.swo
|
*.o
|
||||||
|
*.so
|
||||||
*~
|
*~
|
||||||
.DS_Store
|
|
||||||
.vscode/
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
# Magic runtime-generated files
|
|
||||||
magic/proto.magicrc
|
|
||||||
scmos/cif_template/objs/*
|
scmos/cif_template/objs/*
|
||||||
|
database/database.h
|
||||||
|
install.log
|
||||||
|
magic/proto.magicrc
|
||||||
|
make.log
|
||||||
|
readline/readline
|
||||||
scmos/gdsquery.tech
|
scmos/gdsquery.tech
|
||||||
scmos/minimum.tech
|
scmos/minimum.tech
|
||||||
scmos/scmos-sub.tech
|
scmos/scmos-sub.tech
|
||||||
|
|
@ -35,28 +22,14 @@ scmos/scmos-tm.tech
|
||||||
scmos/scmos.tech
|
scmos/scmos.tech
|
||||||
scmos/scmosWR.tech
|
scmos/scmosWR.tech
|
||||||
scmos/nmos.tech
|
scmos/nmos.tech
|
||||||
|
|
||||||
# Native build artifacts
|
|
||||||
magic/magic
|
|
||||||
magic/tclmagic.dylib
|
|
||||||
tcltk/magic.sh
|
tcltk/magic.sh
|
||||||
tcltk/magic.tcl
|
tcltk/magic.tcl
|
||||||
tcltk/magicdnull
|
tcltk/magicdnull
|
||||||
tcltk/magicexec
|
tcltk/magicexec
|
||||||
tcltk/ext2spice.sh
|
tcltk/ext2spice.sh
|
||||||
tcltk/ext2sim.sh
|
tcltk/ext2sim.sh
|
||||||
|
magic/tclmagic.dylib
|
||||||
tcltk/magicdnull.dSYM/
|
tcltk/magicdnull.dSYM/
|
||||||
tcltk/magicexec.dSYM/
|
tcltk/magicexec.dSYM/
|
||||||
pfx/
|
reconfigure.sh
|
||||||
|
pfx/
|
||||||
# WASM build artifacts
|
|
||||||
magic/magic.js
|
|
||||||
magic/magic.js.symbols
|
|
||||||
magic/magic.symbols
|
|
||||||
magic/magic.wasm
|
|
||||||
net2ir/net2ir
|
|
||||||
net2ir/net2ir.js
|
|
||||||
net2ir/net2ir.wasm
|
|
||||||
|
|
||||||
# Generated test output
|
|
||||||
npm/examples/output/
|
|
||||||
6
INSTALL
6
INSTALL
|
|
@ -47,12 +47,6 @@ Autoconf Capsule Summary:
|
||||||
Disable threaded X11 and OpenGL graphics.
|
Disable threaded X11 and OpenGL graphics.
|
||||||
Normally enabled.
|
Normally enabled.
|
||||||
|
|
||||||
--disable-compression
|
|
||||||
Disable reading and writing of compressed
|
|
||||||
(gzipped) GDS files and reading of compressed
|
|
||||||
.mag files. Normally enabled, if the zlib
|
|
||||||
development package is installed.
|
|
||||||
|
|
||||||
Notes to Magic maintainers:
|
Notes to Magic maintainers:
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,9 @@
|
||||||
Get [Homebrew](https://brew.sh).
|
Get [Homebrew](https://brew.sh).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew install cairo tcl-tk@8 python3 gnu-sed
|
brew install cairo tcl-tk python3
|
||||||
brew install --cask xquartz
|
brew install --cask xquartz
|
||||||
./scripts/configure_mac
|
./scripts/configure_mac
|
||||||
# If you have both TCL8 and TCL9 installed you may need to verify which was selected.
|
|
||||||
make database/database.h
|
make database/database.h
|
||||||
make -j$(sysctl -n hw.ncpu)
|
make -j$(sysctl -n hw.ncpu)
|
||||||
make install # may need sudo depending on your setup
|
make install # may need sudo depending on your setup
|
||||||
|
|
|
||||||
103
Makefile
103
Makefile
|
|
@ -4,33 +4,31 @@
|
||||||
|
|
||||||
MAGICDIR = .
|
MAGICDIR = .
|
||||||
PROGRAMS = magic
|
PROGRAMS = magic
|
||||||
TECHS = scmos
|
TECH = scmos
|
||||||
LIBRARIES = database utils extflat
|
LIBRARIES = database utils extflat
|
||||||
MODULES = bplane cmwind commands database dbwind debug drc extflat \
|
MODULES = bplane cmwind commands database dbwind debug drc extflat \
|
||||||
extract graphics netmenu plow resis select sim textio tiles \
|
extract graphics netmenu plow resis select sim textio tiles \
|
||||||
utils windows wiring
|
utils windows wiring
|
||||||
|
|
||||||
# This was `cat VERSION`
|
|
||||||
VERSION := $(shell cat ${MAGICDIR}/VERSION)
|
|
||||||
|
|
||||||
MAKEFLAGS =
|
MAKEFLAGS =
|
||||||
INSTALL_CAD_DIRS = windows doc ${TECHS}
|
INSTALL_CAD_DIRS = windows doc ${TECH}
|
||||||
|
|
||||||
-include defs.mak
|
-include defs.mak
|
||||||
|
|
||||||
all: $(ALL_TARGET) techs
|
all: $(ALL_TARGET)
|
||||||
|
|
||||||
standard: mains
|
standard:
|
||||||
|
@echo --- errors and warnings logged in file make.log
|
||||||
|
@${MAKE} mains
|
||||||
|
|
||||||
tcl: tcllibrary
|
tcl:
|
||||||
|
@echo --- errors and warnings logged in file make.log
|
||||||
|
@${MAKE} tcllibrary
|
||||||
|
|
||||||
force:
|
force: clean all
|
||||||
@${MAKE} clean
|
|
||||||
@${MAKE} all
|
|
||||||
|
|
||||||
defs.mak:
|
defs.mak:
|
||||||
@echo No \"defs.mak\" file found. Run "configure" to make one.
|
@echo No \"defs.mak\" file found. Run "configure" to make one.
|
||||||
@exit 1
|
|
||||||
|
|
||||||
config:
|
config:
|
||||||
${MAGICDIR}/configure
|
${MAGICDIR}/configure
|
||||||
|
|
@ -45,56 +43,24 @@ mains: database/database.h modules libs
|
||||||
for dir in ${PROGRAMS}; do \
|
for dir in ${PROGRAMS}; do \
|
||||||
(cd $$dir && ${MAKE} main) || exit 1; done
|
(cd $$dir && ${MAKE} main) || exit 1; done
|
||||||
|
|
||||||
database/database.h: ${MAGICDIR}/database/database.h.in
|
database/database.h: database/database.h.in
|
||||||
@echo --- making header file database/database.h
|
@echo --- making header file database/database.h
|
||||||
${SCRIPTS}/makedbh ${MAGICDIR}/database/database.h.in database/database.h
|
${SCRIPTS}/makedbh database/database.h.in database/database.h
|
||||||
|
|
||||||
# tiles xyz => tiles/libtiles.o xyz/libxyz.o
|
modules: database/database.h depend
|
||||||
MODULES_SUBDIR := $(shell for i in ${MODULES}; do echo "$${i}/lib$${i}.o"; done)
|
@echo --- making modules
|
||||||
# tiles xyz => tiles/libtiles.a xyz/libxyz.a
|
for dir in ${MODULES} ${PROGRAMS}; do \
|
||||||
LIBS_SUBDIR := $(shell for i in ${MODULES}; do echo "$${i}/lib$${i}.a"; done)
|
(cd $$dir && ${MAKE} module) || exit 1; done
|
||||||
|
|
||||||
.PHONY: FORCE
|
libs:
|
||||||
${MODULES_SUBDIR}: FORCE
|
@echo --- making libraries
|
||||||
@${MAKE} -C $(dir $@) module
|
for dir in ${LIBRARIES}; do \
|
||||||
|
(cd $$dir && ${MAKE} lib) || exit 1; done
|
||||||
|
|
||||||
.PHONY: modules
|
depend: database/database.h
|
||||||
modules: database/database.h depend ${MODULES_SUBDIR}
|
|
||||||
|
|
||||||
${LIBS_SUBDIR}: FORCE
|
|
||||||
@${MAKE} -C $(dir $@) lib
|
|
||||||
|
|
||||||
# Force the tiles/utils modules to exist first for libdatabase.a
|
|
||||||
.PHONY: libs
|
|
||||||
libs: database/database.h depend tiles/libtiles.o utils/libutils.o ${LIBS_SUBDIR}
|
|
||||||
|
|
||||||
#
|
|
||||||
# extcheck - utility tool
|
|
||||||
# net2ir - utility tool
|
|
||||||
# oa - disabled (needs 'clean' target renaming)
|
|
||||||
SUBDIRS = bplane cmwind commands database dbwind debug drc extflat extract graphics \
|
|
||||||
magic netmenu plow resis select sim textio tiles utils windows wiring
|
|
||||||
|
|
||||||
BUNDLED_MODULES = readline lisp
|
|
||||||
|
|
||||||
# Unique list of all subdir that might have Depend file, we have to deduplicate otherwise
|
|
||||||
# MAKE will warning loudly. This list is somewhat empty when defs.mak does not exist
|
|
||||||
SUBDIRS_FILTERED := $(shell echo ${MODULES} ${PROGRAMS} ${SUBDIRS} | tr ' ' '\n' | sort | uniq)
|
|
||||||
|
|
||||||
SUBDIRS_DEPEND = $(addsuffix /Depend, ${SUBDIRS_FILTERED})
|
|
||||||
|
|
||||||
${SUBDIRS_DEPEND}: database/database.h
|
|
||||||
@echo --- making dependencies
|
@echo --- making dependencies
|
||||||
${MAKE} -C $(dir $@) depend
|
for dir in ${MODULES} ${UNUSED_MODULES} ${PROGRAMS}; do \
|
||||||
|
(cd $$dir && ${MAKE} depend) || exit 1; done
|
||||||
.PHONY: depend
|
|
||||||
depend: defs.mak ${SUBDIRS_DEPEND}
|
|
||||||
|
|
||||||
.PHONY: techs
|
|
||||||
techs: depend
|
|
||||||
@echo --- making techs
|
|
||||||
for dir in ${TECHS}; do \
|
|
||||||
(cd $$dir && ${MAKE} all) || exit 1; done
|
|
||||||
|
|
||||||
install: $(INSTALL_TARGET)
|
install: $(INSTALL_TARGET)
|
||||||
|
|
||||||
|
|
@ -129,7 +95,7 @@ install-tcl-real: install-tcl-dirs
|
||||||
(cd $$dir && ${MAKE} install-tcl); done
|
(cd $$dir && ${MAKE} install-tcl); done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
for dir in ${SUBDIRS_FILTERED} ${TECHS} ${BUNDLED_MODULES}; do \
|
for dir in ${MODULES} ${PROGRAMS} ${TECH} ${UNUSED_MODULES}; do \
|
||||||
(cd $$dir && ${MAKE} clean); done
|
(cd $$dir && ${MAKE} clean); done
|
||||||
${RM} *.tmp */*.tmp *.sav */*.sav *.log TAGS tags
|
${RM} *.tmp */*.tmp *.sav */*.sav *.log TAGS tags
|
||||||
|
|
||||||
|
|
@ -139,19 +105,18 @@ distclean:
|
||||||
${RM} defs.mak old.defs.mak ${MAGICDIR}/scripts/defs.mak
|
${RM} defs.mak old.defs.mak ${MAGICDIR}/scripts/defs.mak
|
||||||
${RM} ${MAGICDIR}/scripts/default.conf
|
${RM} ${MAGICDIR}/scripts/default.conf
|
||||||
${RM} ${MAGICDIR}/scripts/config.log ${MAGICDIR}/scripts/config.status
|
${RM} ${MAGICDIR}/scripts/config.log ${MAGICDIR}/scripts/config.status
|
||||||
${RM} database/database.h
|
${RM} scripts/magic.spec magic-`cat VERSION` magic-`cat VERSION`.tgz
|
||||||
${RM} scripts/magic.spec magic-${VERSION} magic-${VERSION}.tgz
|
${RM} *.log */Depend
|
||||||
${RM} *.log
|
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
${RM} scripts/magic.spec magic-${VERSION} magic-${VERSION}.tgz
|
${RM} scripts/magic.spec magic-`cat VERSION` magic-`cat VERSION`.tgz
|
||||||
${SED} -e /@VERSION@/s%@VERSION@%${VERSION}% \
|
sed -e /@VERSION@/s%@VERSION@%`cat VERSION`% \
|
||||||
scripts/magic.spec.in > scripts/magic.spec
|
scripts/magic.spec.in > scripts/magic.spec
|
||||||
${LN} -nsf . magic-${VERSION}
|
ln -nsf . magic-`cat VERSION`
|
||||||
tar zchvf magic-${VERSION}.tgz --exclude CVS \
|
tar zchvf magic-`cat VERSION`.tgz --exclude CVS \
|
||||||
--exclude magic-${VERSION}/magic-${VERSION} \
|
--exclude magic-`cat VERSION`/magic-`cat VERSION` \
|
||||||
--exclude magic-${VERSION}/magic-${VERSION}.tgz \
|
--exclude magic-`cat VERSION`/magic-`cat VERSION`.tgz \
|
||||||
magic-${VERSION}
|
magic-`cat VERSION`
|
||||||
|
|
||||||
clean-mains:
|
clean-mains:
|
||||||
for dir in ${PROGRAMS}; do \
|
for dir in ${PROGRAMS}; do \
|
||||||
|
|
@ -168,6 +133,6 @@ TAGS:
|
||||||
setup-git:
|
setup-git:
|
||||||
git config --local include.path ../.gitconfig
|
git config --local include.path ../.gitconfig
|
||||||
git stash save
|
git stash save
|
||||||
${RM} .git/index
|
rm .git/index
|
||||||
git checkout HEAD -- "$$(git rev-parse --show-toplevel)"
|
git checkout HEAD -- "$$(git rev-parse --show-toplevel)"
|
||||||
git stash pop
|
git stash pop
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
FROM almalinux:10
|
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
# Build Dependencies (and dump version to logging)
|
|
||||||
RUN dnf install -y python3 zlib-devel ncurses-devel readline-devel cairo-devel freeglut-devel \
|
|
||||||
mesa-libGLU-devel mesa-libGL-devel libX11-devel libstdc++-devel gcc gcc-c++ make git tcsh \
|
|
||||||
zip \
|
|
||||||
&& echo "### rpm -qa:" \
|
|
||||||
&& rpm -qa | sort \
|
|
||||||
&& echo ""
|
|
||||||
#RUN dnf group install -y "Development Tools"
|
|
||||||
|
|
||||||
# Tcl/Tk
|
|
||||||
WORKDIR /tcl
|
|
||||||
RUN curl -L https://prdownloads.sourceforge.net/tcl/tcl9.0.1-src.tar.gz | tar --strip-components=1 -xzC . \
|
|
||||||
&& cd unix \
|
|
||||||
&& ./configure --prefix=/prefix \
|
|
||||||
&& make \
|
|
||||||
&& make install install-libraries install-msgs install-tzdata
|
|
||||||
|
|
||||||
WORKDIR /tk
|
|
||||||
RUN curl -L https://prdownloads.sourceforge.net/tcl/tk9.0.1-src.tar.gz | tar --strip-components=1 -xzC . \
|
|
||||||
&& cd unix \
|
|
||||||
&& ./configure --prefix=/prefix --with-tcl=/prefix/lib \
|
|
||||||
&& make \
|
|
||||||
&& make install install-libraries
|
|
||||||
|
|
||||||
WORKDIR /prefix/bin
|
|
||||||
RUN cp ./wish9.0 ./wish
|
|
||||||
RUN cp ./tclsh9.0 ./tclsh
|
|
||||||
|
|
||||||
# Magic
|
|
||||||
WORKDIR /magic
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN ./configure \
|
|
||||||
--prefix=/prefix \
|
|
||||||
--with-tcl=/prefix/lib \
|
|
||||||
--with-tk=/prefix/lib \
|
|
||||||
&& make clean \
|
|
||||||
&& make database/database.h \
|
|
||||||
&& make -j$(nproc) \
|
|
||||||
&& make install
|
|
||||||
|
|
||||||
# Produce summary of what was created and confirm their DSOs
|
|
||||||
RUN echo "### filesystem:" \
|
|
||||||
find /prefix -printf "%y/%M/%m %i/%n %l %u/%U %g/%G %s/%b %T+/%T@\t%p\n"; \
|
|
||||||
ls -lR /prefix; \
|
|
||||||
find /prefix -type f -perm /111 -exec bash -c "echo \#\#\# {}; ldd -v {}" \; 2>/dev/null; \
|
|
||||||
for name in libgcc_s libstdc++ libpng liblzma libxml2 libz libcairo libGL libGLU; do \
|
|
||||||
find /lib64 /usr/lib64 -maxdepth 2 -name "*.so" -name "${name}*" -exec bash -c "echo \#\#\# {}; ldd -v {}" \; 2>/dev/null; \
|
|
||||||
done; \
|
|
||||||
echo "###"
|
|
||||||
|
|
||||||
WORKDIR /
|
|
||||||
RUN tar -czf /prefix.tar.gz -C ./prefix .
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
MAGIC_SRC_ROOT = ../..
|
|
||||||
RESOURCES := $(shell find ../rsc/ -type f)
|
|
||||||
ARCH := $(shell uname -m)
|
|
||||||
APPIMAGE = Magic-$(ARCH).AppImage
|
|
||||||
VERSION_MAGIC := $(shell cat $(MAGIC_SRC_ROOT)/VERSION)
|
|
||||||
VERSION_TSTAMP := $(shell git show -s "--format=%cs" | tr -d '-')
|
|
||||||
VERSION_HASH := $(shell git show -s "--format=%h")
|
|
||||||
VERSION_NUM ?= $(VERSION_MAGIC)~$(VERSION_TSTAMP)~$(VERSION_HASH)
|
|
||||||
VERSION := $(VERSION_NUM)
|
|
||||||
|
|
||||||
# Allow CI to override
|
|
||||||
APPIMAGETOOL_DOWNLOAD_URL ?= https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
||||||
|
|
||||||
all: $(APPIMAGE)
|
|
||||||
|
|
||||||
.PHONY: prefix/bin/magic
|
|
||||||
prefix/bin/magic: Dockerfile Makefile
|
|
||||||
@echo "APPIMAGE=$(APPIMAGE)"
|
|
||||||
@echo "VERSION=$(VERSION)"
|
|
||||||
@echo "ARCH=$(ARCH)"
|
|
||||||
@echo "RESOURCES=$(RESOURCES)"
|
|
||||||
rm -rf prefix
|
|
||||||
docker build -t magic_build -f ./Dockerfile $(MAGIC_SRC_ROOT)
|
|
||||||
id=$$(docker create magic_build) ; \
|
|
||||||
docker cp $$id:/prefix ./prefix ; \
|
|
||||||
docker rm -v $$id
|
|
||||||
mkdir -p prefix/lib/tcl9.0.1
|
|
||||||
cp -r prefix/lib/tcl9.0 prefix/lib/tcl9.0.1/library
|
|
||||||
|
|
||||||
appimagetool:
|
|
||||||
curl -L "$(APPIMAGETOOL_DOWNLOAD_URL)" > ./appimagetool
|
|
||||||
chmod +x ./appimagetool
|
|
||||||
|
|
||||||
$(APPIMAGE): prefix/bin/magic appimagetool $(RESOURCES)
|
|
||||||
cp $(RESOURCES) ./prefix/
|
|
||||||
./appimagetool prefix
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
install:
|
|
||||||
install $(APPIMAGE) $(PREFIX)/bin/magic
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f *.AppImage
|
|
||||||
rm -f prefix.tar.gz
|
|
||||||
rm -rf prefix
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
This is an AppImage that runs on all GNU/Linux platforms with:
|
|
||||||
|
|
||||||
* FUSE
|
|
||||||
* This excludes non-privileged Docker containers unfortunately, unless pre-extracted.
|
|
||||||
* GLIBC 2.38+
|
|
||||||
* Cairo 1.18+
|
|
||||||
* May require runtime CPU matching Linux ABI x86-64-v3 and newer (CPUs with SSE4.2/AVX2/BMI2/FMA via `lscpu`).
|
|
||||||
|
|
||||||
This AppImage build is based on EL10 (via AlmaLinux 10).
|
|
||||||
|
|
||||||
AlmaLinux 10 was first released on 27 May 2025.
|
|
||||||
|
|
||||||
# Version Info
|
|
||||||
|
|
||||||
See the AppImage main binary file naming, release tag information and AppInfo metadata
|
|
||||||
for the exact magic version inside the archive. When starting AppImage by default the
|
|
||||||
Tcl console banner can also provide version information, also using the `version` Tcl
|
|
||||||
command.
|
|
||||||
|
|
||||||
# Build Info
|
|
||||||
|
|
||||||
* Based on AlmaLinux 10 (EL10)
|
|
||||||
* Tcl/Tk 9.0.1
|
|
||||||
* and Magic 8.x
|
|
||||||
* all default modules enabled (including all Display drivers cairo/X11/OpenGL)
|
|
||||||
|
|
||||||
# FAQ: How to use
|
|
||||||
|
|
||||||
Download the *.AppImage file relevant to your platform and run:
|
|
||||||
|
|
||||||
```
|
|
||||||
chmod +x Magic-x86_64.AppImage
|
|
||||||
./Magic-x86_64.AppImage
|
|
||||||
```
|
|
||||||
|
|
||||||
Example startup with command line options:
|
|
||||||
|
|
||||||
```
|
|
||||||
./Magic-x86_64.AppImage -d XR -T scmos
|
|
||||||
```
|
|
||||||
|
|
||||||
# FAQ: How to use (inside docker / podman)
|
|
||||||
|
|
||||||
```
|
|
||||||
chmod +x Magic-x86_64.AppImage
|
|
||||||
|
|
||||||
### Podman or Docker, use :Z when rootless with selinux enabled
|
|
||||||
podman run --rm --device /dev/fuse --privileged \
|
|
||||||
-v "$(pwd):/tmp/work:Z" -v "/tmp/.X11-unix/X0:/tmp/.X11-unix/X0:Z" \
|
|
||||||
-e DISPLAY -ti almalinux:10
|
|
||||||
|
|
||||||
### Inside Docker:
|
|
||||||
dnf update -y
|
|
||||||
|
|
||||||
dnf install -y fuse libX11 cairo libGL libGLU
|
|
||||||
|
|
||||||
cd /tmp/work
|
|
||||||
|
|
||||||
./Magic-x86_64.AppImage -d XR -T scmos
|
|
||||||
```
|
|
||||||
|
|
||||||
# Building Requirements
|
|
||||||
|
|
||||||
* A reasonably recent GNU/Linux host
|
|
||||||
* GNU make
|
|
||||||
* Docker 20+
|
|
||||||
* Git
|
|
||||||
* curl
|
|
||||||
|
|
||||||
The final build is then packaged into an AppImage using AppImageTool on the host machine.
|
|
||||||
|
|
||||||
# Build Instructions
|
|
||||||
`make`
|
|
||||||
|
|
||||||
# Installation Instructions
|
|
||||||
`make install`
|
|
||||||
|
|
||||||
# FAQ: Is my CPU supported ?
|
|
||||||
|
|
||||||
This is built with the standard x86_64 Linux ABI version for AlmaLinux 10.
|
|
||||||
|
|
||||||
Use the command `/lib64/ld-linux-x86-64.so.2 --help` to see which CPUs your
|
|
||||||
Linux distribtion supports (and your CPU) look for the word "supported".
|
|
||||||
|
|
||||||
# FAQ: The DSO versioning link dependencies?
|
|
||||||
|
|
||||||
The information here provides an outline of what versions to expect from EL10
|
|
||||||
of the major dependencies, to assist you in a compatibility check with your
|
|
||||||
Linux distribution of choice.
|
|
||||||
|
|
||||||
The actual versions in our public releases can differ slightly inline with
|
|
||||||
the EL10 support compatibility and ABI versioning policies for the support
|
|
||||||
lifecycle of the distribution.
|
|
||||||
|
|
||||||
The most important items are the Direct Dependencies and the availabilty
|
|
||||||
of a suitable graphics DSO as per your '-d' choice.
|
|
||||||
|
|
||||||
Direct Runtime Dependencies (from /prefix/**):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libc.so.6 | GLIBC_2.38 | glibc-2.39-37 |
|
|
||||||
| libz.so.1 | ZLIB_1.2.2 | zlib-ng-2.2.3-1 |
|
|
||||||
| | | zlib-ng-compat-2.2.3-1 |
|
|
||||||
|
|
||||||
Optional/Modular Runtime Dependencies (depending on graphics mode):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libcairo.so.2 | | |
|
|
||||||
| libcairo.so.2.11802.0 | | cairo-1.18.2-2 |
|
|
||||||
| libGL.so.1 | | libglvnd-glx-1:1.7.0-7 |
|
|
||||||
| | | mesa-libGL-24.2.8-2 |
|
|
||||||
| libGLU.so.1 | | mesa-libGLU-9.0.3-7 |
|
|
||||||
|
|
||||||
Transitive/Third-Party Runtime Dependencies (for information only):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libstdc++.so.6 | CXXABI_1.3.9 | gcc-c++-14.2.1-7 |
|
|
||||||
| libstdc++.so.6 | GLIBCXX_3.4 | gcc-c++-14.2.1-7 |
|
|
||||||
| libgcc_s.so.1 | GCC_4.2.0 | libgcc_s-14-20250110 |
|
|
||||||
| libxml2.so.2 | LIBXML2_2.6.0 | libxml2-2.12.5-5 |
|
|
||||||
| libpng16.so.16 | PNG16_0 | libpng-2:1.6.40-8 |
|
|
||||||
| liblzma.so.5 | XZ_5.0 | xz-devel-1:5.6.2-4 |
|
|
||||||
| libz.so.1 | ZLIB_1.2.9 | zlib-ng-2.2.3-1 |
|
|
||||||
| | | zlib-ng-compat-2.2.3-1 |
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
FROM centos/python-38-centos7:20210726-fad62e9
|
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
# CentOS7 went EOL on June 30, 2024 this builds out of vault.centos.org
|
|
||||||
RUN ls -l /etc/yum.repos.d/ \
|
|
||||||
&& cp /etc/yum.repos.d/CentOS-Base.repo /tmp/CentOS-Base.repo.old \
|
|
||||||
&& sed -e 's/mirror.centos.org/vault.centos.org/g' -i /etc/yum.repos.d/*.repo \
|
|
||||||
&& sed -e 's/^#.*baseurl=http/baseurl=http/g' -i /etc/yum.repos.d/*.repo \
|
|
||||||
&& sed -e 's/^mirrorlist=http/#mirrorlist=http/g' -i /etc/yum.repos.d/*.repo \
|
|
||||||
&& diff -u /tmp/CentOS-Base.repo.old /etc/yum.repos.d/CentOS-Base.repo; \
|
|
||||||
yum clean all \
|
|
||||||
&& yum -y update \
|
|
||||||
&& rm -f /tmp/CentOS-Base.repo.old
|
|
||||||
|
|
||||||
# Build Dependencies (and dump version to logging)
|
|
||||||
RUN yum install -y cairo-devel freeglut-devel gcc make tcsh \
|
|
||||||
&& echo "### rpm -qa:" \
|
|
||||||
&& rpm -qa | sort \
|
|
||||||
&& echo ""
|
|
||||||
|
|
||||||
# Tcl/Tk
|
|
||||||
WORKDIR /tcl
|
|
||||||
RUN curl -L https://prdownloads.sourceforge.net/tcl/tcl8.6.16-src.tar.gz | tar --strip-components=1 -xzC . \
|
|
||||||
&& cd unix \
|
|
||||||
&& ./configure --prefix=/prefix \
|
|
||||||
&& make \
|
|
||||||
&& make install
|
|
||||||
|
|
||||||
WORKDIR /tk
|
|
||||||
RUN curl -L https://prdownloads.sourceforge.net/tcl/tk8.6.16-src.tar.gz | tar --strip-components=1 -xzC . \
|
|
||||||
&& cd unix \
|
|
||||||
&& ./configure --prefix=/prefix --with-tcl=/prefix/lib \
|
|
||||||
&& make \
|
|
||||||
&& make install
|
|
||||||
|
|
||||||
WORKDIR /prefix/bin
|
|
||||||
RUN cp ./wish8.6 ./wish
|
|
||||||
RUN cp ./tclsh8.6 ./tclsh
|
|
||||||
|
|
||||||
# Magic
|
|
||||||
WORKDIR /magic
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN ./configure \
|
|
||||||
--prefix=/prefix \
|
|
||||||
--with-tcl=/prefix/lib \
|
|
||||||
--with-tk=/prefix/lib \
|
|
||||||
--without-opengl \
|
|
||||||
&& make clean \
|
|
||||||
&& make database/database.h \
|
|
||||||
&& make -j$(nproc) \
|
|
||||||
&& make install
|
|
||||||
|
|
||||||
# Produce summary of what was created and confirm their DSOs
|
|
||||||
RUN echo "### filesystem:" \
|
|
||||||
find /prefix -printf "%y/%M/%m %i/%n %l %u/%U %g/%G %s/%b %T+/%T@\t%p\n"; \
|
|
||||||
ls -lR /prefix; \
|
|
||||||
find /prefix -type f -perm /111 -exec bash -c "echo \#\#\# {}; ldd -v {}" \; 2>/dev/null; \
|
|
||||||
for name in libgcc_s libstdc++ libpng liblzma libxml2 libz libcairo libGL libGLU; do \
|
|
||||||
find /lib64 /usr/lib64 -maxdepth 2 -name "*.so" -name "${name}*" -exec bash -c "echo \#\#\# {}; ldd -v {}" \; 2>/dev/null; \
|
|
||||||
done; \
|
|
||||||
echo "###"
|
|
||||||
|
|
||||||
WORKDIR /
|
|
||||||
RUN tar -czf /prefix.tar.gz -C ./prefix .
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
MAGIC_SRC_ROOT = ../..
|
|
||||||
RESOURCES := $(shell find ../rsc/ -type f)
|
|
||||||
ARCH := $(shell uname -m)
|
|
||||||
APPIMAGE = Magic-$(ARCH).AppImage
|
|
||||||
VERSION_MAGIC := $(shell cat $(MAGIC_SRC_ROOT)/VERSION)
|
|
||||||
VERSION_TSTAMP := $(shell git show -s "--format=%cs" | tr -d '-')
|
|
||||||
VERSION_HASH := $(shell git show -s "--format=%h")
|
|
||||||
VERSION_NUM ?= $(VERSION_MAGIC)~$(VERSION_TSTAMP)~$(VERSION_HASH)
|
|
||||||
VERSION := $(VERSION_NUM)
|
|
||||||
|
|
||||||
# Allow CI to override
|
|
||||||
APPIMAGETOOL_DOWNLOAD_URL ?= https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
||||||
|
|
||||||
all: $(APPIMAGE)
|
|
||||||
|
|
||||||
.PHONY: prefix/bin/magic
|
|
||||||
prefix/bin/magic: Dockerfile Makefile
|
|
||||||
@echo "APPIMAGE=$(APPIMAGE)"
|
|
||||||
@echo "VERSION=$(VERSION)"
|
|
||||||
@echo "ARCH=$(ARCH)"
|
|
||||||
@echo "RESOURCES=$(RESOURCES)"
|
|
||||||
rm -rf prefix
|
|
||||||
docker build -t magic_build -f ./Dockerfile $(MAGIC_SRC_ROOT)
|
|
||||||
id=$$(docker create magic_build) ; \
|
|
||||||
docker cp $$id:/prefix ./prefix ; \
|
|
||||||
docker rm -v $$id
|
|
||||||
mkdir -p prefix/lib/tcl8.6.16
|
|
||||||
cp -r prefix/lib/tcl8.6 prefix/lib/tcl8.6.16/library
|
|
||||||
|
|
||||||
appimagetool:
|
|
||||||
curl -L "$(APPIMAGETOOL_DOWNLOAD_URL)" > ./appimagetool
|
|
||||||
chmod +x ./appimagetool
|
|
||||||
|
|
||||||
$(APPIMAGE): prefix/bin/magic appimagetool $(RESOURCES)
|
|
||||||
cp $(RESOURCES) ./prefix/
|
|
||||||
./appimagetool prefix
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
install:
|
|
||||||
install $(APPIMAGE) $(PREFIX)/bin/magic
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f *.AppImage
|
|
||||||
rm -f prefix.tar.gz
|
|
||||||
rm -rf prefix
|
|
||||||
|
|
@ -1,137 +0,0 @@
|
||||||
This is an AppImage that runs on all GNU/Linux platforms with:
|
|
||||||
|
|
||||||
* FUSE
|
|
||||||
* This excludes non-privileged Docker containers unfortunately, unless pre-extracted.
|
|
||||||
* GLIBC 2.17+
|
|
||||||
* Cairo 1.15+
|
|
||||||
* Supports all Linux x86_64 CPUs
|
|
||||||
|
|
||||||
This AppImage build is based on EL7 (via CentOS 7)
|
|
||||||
|
|
||||||
CentOS 7 was first released on 07 July 2014 and went end-of-life on 30 June 2024.
|
|
||||||
|
|
||||||
# Version Info
|
|
||||||
|
|
||||||
See the AppImage main binary file naming, release tag information and AppInfo metadata
|
|
||||||
for the exact magic version inside the archive. When starting AppImage by default the
|
|
||||||
Tcl console banner can also provide version information, also using the `version` Tcl
|
|
||||||
command.
|
|
||||||
|
|
||||||
# Build Info
|
|
||||||
|
|
||||||
* Based on CentOS 7 (EL7)
|
|
||||||
* Tcl/Tk 8.6.16
|
|
||||||
* and Magic 8.x
|
|
||||||
* all default modules enabled, but without OpenGL (includes Display drivers cairo/X11)
|
|
||||||
|
|
||||||
# FAQ: How to use
|
|
||||||
|
|
||||||
Download the *.AppImage file relevant to your platform and run:
|
|
||||||
|
|
||||||
```
|
|
||||||
chmod +x Magic-x86_64.AppImage
|
|
||||||
./Magic-x86_64.AppImage
|
|
||||||
```
|
|
||||||
|
|
||||||
Example startup with command line options:
|
|
||||||
|
|
||||||
```
|
|
||||||
./Magic-x86_64.AppImage -d XR -T scmos
|
|
||||||
```
|
|
||||||
|
|
||||||
# FAQ: How to use (inside docker / podman)
|
|
||||||
|
|
||||||
```
|
|
||||||
chmod +x Magic-x86_64.AppImage
|
|
||||||
|
|
||||||
### Podman or Docker, use :Z when rootless with selinux enabled
|
|
||||||
podman run --rm --device /dev/fuse --privileged \
|
|
||||||
-v "$(pwd):/tmp/work:Z" -v "/tmp/.X11-unix/X0:/tmp/.X11-unix/X0:Z" \
|
|
||||||
-e DISPLAY -ti centos:7
|
|
||||||
|
|
||||||
### Inside Docker:
|
|
||||||
echo "FIXUP yum from vault and update" \
|
|
||||||
&& ls -l /etc/yum.repos.d/ \
|
|
||||||
&& cp /etc/yum.repos.d/CentOS-Base.repo /tmp/CentOS-Base.repo.old \
|
|
||||||
&& sed -e 's/mirror.centos.org/vault.centos.org/g' -i /etc/yum.repos.d/*.repo \
|
|
||||||
&& sed -e 's/^#.*baseurl=http/baseurl=http/g' -i /etc/yum.repos.d/*.repo \
|
|
||||||
&& sed -e 's/^mirrorlist=http/#mirrorlist=http/g' -i /etc/yum.repos.d/*.repo \
|
|
||||||
&& diff -u /tmp/CentOS-Base.repo.old /etc/yum.repos.d/CentOS-Base.repo; \
|
|
||||||
yum clean all \
|
|
||||||
&& yum -y update \
|
|
||||||
&& rm -f /tmp/CentOS-Base.repo.old
|
|
||||||
|
|
||||||
yum install -y fuse libX11 cairo
|
|
||||||
|
|
||||||
cd /tmp/work
|
|
||||||
|
|
||||||
./Magic-x86_64.AppImage -d XR -T scmos
|
|
||||||
```
|
|
||||||
|
|
||||||
# Building Requirements
|
|
||||||
|
|
||||||
* A reasonably recent GNU/Linux host
|
|
||||||
* GNU make
|
|
||||||
* Docker 20+
|
|
||||||
* Git
|
|
||||||
* curl
|
|
||||||
|
|
||||||
The final build is then packaged into an AppImage using AppImageTool on the host machine.
|
|
||||||
|
|
||||||
# Build Instructions
|
|
||||||
`make`
|
|
||||||
|
|
||||||
# Installation Instructions
|
|
||||||
`make install`
|
|
||||||
|
|
||||||
# FAQ: Is my CPU supported ?
|
|
||||||
|
|
||||||
Supports all x86_64 CPUs. The Linux ABI in use is the original x86-64 ABI (v1).
|
|
||||||
|
|
||||||
Use the command `/lib64/ld-linux-x86-64.so.2 --help` to see which CPUs your
|
|
||||||
Linux distribtion supports (and your CPU) look for the word "supported".
|
|
||||||
|
|
||||||
# FAQ: The DSO versioning link dependencies?
|
|
||||||
|
|
||||||
The information here provides an outline of what versions to expect from EL7
|
|
||||||
of the major dependencies, to assist you in a compatibility check with your
|
|
||||||
Linux distribution of choice.
|
|
||||||
|
|
||||||
The actual versions in our public releases can differ slightly inline with
|
|
||||||
the EL7 support compatibility and ABI versioning policies for the support
|
|
||||||
lifecycle of the distribution.
|
|
||||||
|
|
||||||
The most important items are the Direct Dependencies and the availabilty
|
|
||||||
of a suitable graphics DSO as per your '-d' choice.
|
|
||||||
|
|
||||||
Direct Runtime Dependencies (from /prefix/**):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libc.so.6 | GLIBC_2.14 | glibc-2.17-326 |
|
|
||||||
| libz.so.1 | ZLIB_1.2.2 | zlib-1.2.7-21 |
|
|
||||||
|
|
||||||
Optional/Modular Runtime Dependencies (depending on graphics mode):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libcairo.so.2 | | |
|
|
||||||
| libcairo.so.2.11512.0 | | cairo-1.15.12-4 |
|
|
||||||
| libGL.so.1 | | |
|
|
||||||
| libglvnd-glx-1:1.0.1-0 | | mesa-libGL-18.3.4-12 |
|
|
||||||
| libGLU.so.1 | | mesa-libGLU-9.0.0-4 |
|
|
||||||
|
|
||||||
Transitive/Third-Party Runtime Dependencies (for information only):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libc.so.6 | GLIBC_2.35 | glibc-2.17-326 |
|
|
||||||
| libstdc++.so.6 | GLIBCXX_3.4 | gcc-4.8.5-44 |
|
|
||||||
| libstdc++.so.6 | CXXABI_1.3.9 | gcc-4.8.5-44 |
|
|
||||||
| libgcc_s.so.1 | | |
|
|
||||||
| libgcc_s-4.8.5-20150702.so.1 | GCC_4.2.0 | libgcc-4.8.5-44 |
|
|
||||||
| libxml2.so.2 | LIBXML2_2.6.0 | libxml2-2.9.1-6 |
|
|
||||||
| libpng15.so.15 | | |
|
|
||||||
| libpng15.so.15.13.0 | PNG16_0 | libpng-1:1.5.13-8 |
|
|
||||||
| liblzma.so.5 | XZ_5.0 | xz-libs-5.2.2-2 |
|
|
||||||
| libz.so.1 | ZLIB_1.2.9 | zlib-1.2.7-21 |
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
FROM almalinux:8
|
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
# Build Dependencies (and dump version to logging)
|
|
||||||
RUN dnf install -y python311 zlib-devel ncurses-devel readline-devel cairo-devel freeglut-devel \
|
|
||||||
mesa-libGLU-devel mesa-libGL-devel libX11-devel libstdc++-devel gcc gcc-c++ make git tcsh \
|
|
||||||
&& echo "### rpm -qa:" \
|
|
||||||
&& rpm -qa | sort \
|
|
||||||
&& echo ""
|
|
||||||
#RUN dnf group install -y "Development Tools"
|
|
||||||
|
|
||||||
# Tcl/Tk
|
|
||||||
WORKDIR /tcl
|
|
||||||
RUN curl -L https://prdownloads.sourceforge.net/tcl/tcl8.6.16-src.tar.gz | tar --strip-components=1 -xzC . \
|
|
||||||
&& cd unix \
|
|
||||||
&& ./configure --prefix=/prefix \
|
|
||||||
&& make \
|
|
||||||
&& make install
|
|
||||||
|
|
||||||
WORKDIR /tk
|
|
||||||
RUN curl -L https://prdownloads.sourceforge.net/tcl/tk8.6.16-src.tar.gz | tar --strip-components=1 -xzC . \
|
|
||||||
&& cd unix \
|
|
||||||
&& ./configure --prefix=/prefix --with-tcl=/prefix/lib \
|
|
||||||
&& make \
|
|
||||||
&& make install
|
|
||||||
|
|
||||||
WORKDIR /prefix/bin
|
|
||||||
RUN cp ./wish8.6 ./wish
|
|
||||||
RUN cp ./tclsh8.6 ./tclsh
|
|
||||||
|
|
||||||
# Magic
|
|
||||||
WORKDIR /magic
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN ./configure \
|
|
||||||
--prefix=/prefix \
|
|
||||||
--with-tcl=/prefix/lib \
|
|
||||||
--with-tk=/prefix/lib \
|
|
||||||
&& make clean \
|
|
||||||
&& make database/database.h \
|
|
||||||
&& make -j$(nproc) \
|
|
||||||
&& make install
|
|
||||||
|
|
||||||
# Produce summary of what was created and confirm their DSOs
|
|
||||||
RUN echo "### filesystem:" \
|
|
||||||
find /prefix -printf "%y/%M/%m %i/%n %l %u/%U %g/%G %s/%b %T+/%T@\t%p\n"; \
|
|
||||||
ls -lR /prefix; \
|
|
||||||
find /prefix -type f -perm /111 -exec bash -c "echo \#\#\# {}; ldd -v {}" \; 2>/dev/null; \
|
|
||||||
for name in libgcc_s libstdc++ libpng liblzma libxml2 libz libcairo libGL libGLU; do \
|
|
||||||
find /lib64 /usr/lib64 -maxdepth 2 -name "*.so" -name "${name}*" -exec bash -c "echo \#\#\# {}; ldd -v {}" \; 2>/dev/null; \
|
|
||||||
done; \
|
|
||||||
echo "###"
|
|
||||||
|
|
||||||
WORKDIR /
|
|
||||||
RUN tar -czf /prefix.tar.gz -C ./prefix .
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
MAGIC_SRC_ROOT = ../..
|
|
||||||
RESOURCES := $(shell find ../rsc/ -type f)
|
|
||||||
ARCH := $(shell uname -m)
|
|
||||||
APPIMAGE = Magic-$(ARCH).AppImage
|
|
||||||
VERSION_MAGIC := $(shell cat $(MAGIC_SRC_ROOT)/VERSION)
|
|
||||||
VERSION_TSTAMP := $(shell git show -s "--format=%cs" | tr -d '-')
|
|
||||||
VERSION_HASH := $(shell git show -s "--format=%h")
|
|
||||||
VERSION_NUM ?= $(VERSION_MAGIC)~$(VERSION_TSTAMP)~$(VERSION_HASH)
|
|
||||||
VERSION := $(VERSION_NUM)
|
|
||||||
|
|
||||||
# Allow CI to override
|
|
||||||
APPIMAGETOOL_DOWNLOAD_URL ?= https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
||||||
|
|
||||||
all: $(APPIMAGE)
|
|
||||||
|
|
||||||
.PHONY: prefix/bin/magic
|
|
||||||
prefix/bin/magic: Dockerfile Makefile
|
|
||||||
@echo "APPIMAGE=$(APPIMAGE)"
|
|
||||||
@echo "VERSION=$(VERSION)"
|
|
||||||
@echo "ARCH=$(ARCH)"
|
|
||||||
@echo "RESOURCES=$(RESOURCES)"
|
|
||||||
rm -rf prefix
|
|
||||||
docker build -t magic_build -f ./Dockerfile $(MAGIC_SRC_ROOT)
|
|
||||||
id=$$(docker create magic_build) ; \
|
|
||||||
docker cp $$id:/prefix ./prefix ; \
|
|
||||||
docker rm -v $$id
|
|
||||||
mkdir -p prefix/lib/tcl8.6.16
|
|
||||||
cp -r prefix/lib/tcl8.6 prefix/lib/tcl8.6.16/library
|
|
||||||
|
|
||||||
appimagetool:
|
|
||||||
curl -L "$(APPIMAGETOOL_DOWNLOAD_URL)" > ./appimagetool
|
|
||||||
chmod +x ./appimagetool
|
|
||||||
|
|
||||||
$(APPIMAGE): prefix/bin/magic appimagetool $(RESOURCES)
|
|
||||||
cp $(RESOURCES) ./prefix/
|
|
||||||
./appimagetool prefix
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
install:
|
|
||||||
install $(APPIMAGE) $(PREFIX)/bin/magic
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f *.AppImage
|
|
||||||
rm -f prefix.tar.gz
|
|
||||||
rm -rf prefix
|
|
||||||
|
|
@ -1,126 +0,0 @@
|
||||||
This is an AppImage that runs on all GNU/Linux platforms with:
|
|
||||||
|
|
||||||
* FUSE
|
|
||||||
* This excludes non-privileged Docker containers unfortunately, unless pre-extracted.
|
|
||||||
* GLIBC 2.28+
|
|
||||||
* Cairo 1.15+
|
|
||||||
* Supports all Linux x86_64 CPUs
|
|
||||||
|
|
||||||
This AppImage build is based on EL8 (via AlmaLinux 8)
|
|
||||||
|
|
||||||
AlmaLinux 8 was first released on 20 March 2021, active support ends 31 May 2024,
|
|
||||||
security support ends 31 May 2029 (please see AlmaLinux bulletins for
|
|
||||||
up-to-date information).
|
|
||||||
|
|
||||||
# Version Info
|
|
||||||
|
|
||||||
See the AppImage main binary file naming, release tag information and AppInfo metadata
|
|
||||||
for the exact magic version inside the archive. When starting AppImage by default the
|
|
||||||
Tcl console banner can also provide version information, also using the `version` Tcl
|
|
||||||
command.
|
|
||||||
|
|
||||||
* Based on AlmaLinux 8 (EL8)
|
|
||||||
* Tcl/Tk 8.6.16
|
|
||||||
* and Magic 8.x
|
|
||||||
* all default modules enabled (including all Display drivers cairo/X11/OpenGL)
|
|
||||||
|
|
||||||
# FAQ: How to use
|
|
||||||
|
|
||||||
Download the *.AppImage file relevant to your platform and run:
|
|
||||||
|
|
||||||
```
|
|
||||||
chmod +x Magic-x86_64.AppImage
|
|
||||||
./Magic-x86_64.AppImage
|
|
||||||
```
|
|
||||||
|
|
||||||
Example startup with command line options:
|
|
||||||
|
|
||||||
```
|
|
||||||
./Magic-x86_64.AppImage -d XR -T scmos
|
|
||||||
```
|
|
||||||
|
|
||||||
# FAQ: How to use (inside docker / podman)
|
|
||||||
|
|
||||||
```
|
|
||||||
chmod +x Magic-x86_64.AppImage
|
|
||||||
|
|
||||||
### Podman or Docker, use :Z when rootless with selinux enabled
|
|
||||||
podman run --rm --device /dev/fuse --privileged \
|
|
||||||
-v "$(pwd):/tmp/work:Z" -v "/tmp/.X11-unix/X0:/tmp/.X11-unix/X0:Z" \
|
|
||||||
-e DISPLAY -ti almalinux:8
|
|
||||||
|
|
||||||
### Inside Docker:
|
|
||||||
dnf update -y
|
|
||||||
|
|
||||||
dnf install -y fuse libX11 cairo libGL libGLU
|
|
||||||
|
|
||||||
cd /tmp/work
|
|
||||||
|
|
||||||
./Magic-x86_64.AppImage -d XR -T scmos
|
|
||||||
```
|
|
||||||
|
|
||||||
# Building Requirements
|
|
||||||
|
|
||||||
* A reasonably recent GNU/Linux host
|
|
||||||
* GNU make
|
|
||||||
* Docker
|
|
||||||
* Git
|
|
||||||
* curl
|
|
||||||
|
|
||||||
The final build is then packaged into an AppImage using AppImageTool on the host machine.
|
|
||||||
|
|
||||||
# Build Instructions
|
|
||||||
`make`
|
|
||||||
|
|
||||||
# Installation Instructions
|
|
||||||
`make install`
|
|
||||||
|
|
||||||
# FAQ: Is my CPU supported ?
|
|
||||||
|
|
||||||
Supports all x86_64 CPUs. The Linux ABI in use is the original x86-64 ABI (v1).
|
|
||||||
|
|
||||||
Use the command `/lib64/ld-linux-x86-64.so.2 --help` to see which CPUs your
|
|
||||||
Linux distribtion supports (and your CPU) look for the word "supported".
|
|
||||||
|
|
||||||
# FAQ: The DSO versioning link dependencies?
|
|
||||||
|
|
||||||
The information here provides an outline of what versions to expect from EL8
|
|
||||||
of the major dependencies, to assist you with a compatibility check with your
|
|
||||||
Linux distribution of choice.
|
|
||||||
|
|
||||||
The actual versions in our public releases can differ slightly inline with
|
|
||||||
the EL8 support compatibility and ABI versioning policies for the support
|
|
||||||
lifecycle of the distribution.
|
|
||||||
|
|
||||||
The most important items are the Direct Dependencies and the availabilty
|
|
||||||
of a suitable graphics DSO as per your '-d' choice.
|
|
||||||
|
|
||||||
Direct Runtime Dependencies (from /prefix/**):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libc.so.6 | GLIBC_2.14 | glibc-2.28-251 |
|
|
||||||
| libz.so.1 | ZLIB_1.2.2 | zlib-1.2.11-25 |
|
|
||||||
|
|
||||||
Optional/Modular Runtime Dependencies (depending on graphics mode):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libcairo.so.2 | | |
|
|
||||||
| libcairo.so.2.11512.0 | | cairo-1.15.12-6 |
|
|
||||||
| libGL.so.1 | | libglvnd-glx-1:1.3.4-2 |
|
|
||||||
| | | mesa-libGL-23.1.4-4 |
|
|
||||||
| libGLU.so.1 | | mesa-libGLU-9.0.0-15 |
|
|
||||||
|
|
||||||
Transitive/Third-Party Runtime Dependencies (for information only):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libc.so.6 | GLIBC_2.35 | glibc-2.28-251 |
|
|
||||||
| libstdc++.so.6 | GLIBCXX_3.4 | gcc-c++-8.5.0 |
|
|
||||||
| libstdc++.so.6 | CXXABI_1.3.9 | gcc-c++-8.5.0 |
|
|
||||||
| libgcc_s.so.1 | GCC_4.2.0 | libgcc-8.5.0-26 |
|
|
||||||
| libxml2.so.2 | | libxml2-2.9.7-19 |
|
|
||||||
| libpng16.so.16 | PNG16_0 | libpng-2:1.6.34-5 |
|
|
||||||
| liblzma.so.5 | | xz-libs-5.2.4-4 |
|
|
||||||
| libz.so.1 | ZLIB_1.2.9 | zlib-1.2.11-25 |
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
FROM almalinux:9
|
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
# Build Dependencies (and dump version to logging)
|
|
||||||
RUN dnf install -y python311 zlib-devel ncurses-devel readline-devel cairo-devel freeglut-devel \
|
|
||||||
mesa-libGLU-devel mesa-libGL-devel libX11-devel libstdc++-devel gcc gcc-c++ make git tcsh \
|
|
||||||
zip \
|
|
||||||
&& echo "### rpm -qa:" \
|
|
||||||
&& rpm -qa | sort \
|
|
||||||
&& echo ""
|
|
||||||
#RUN dnf group install -y "Development Tools"
|
|
||||||
|
|
||||||
# Tcl/Tk
|
|
||||||
WORKDIR /tcl
|
|
||||||
RUN curl -L https://prdownloads.sourceforge.net/tcl/tcl9.0.1-src.tar.gz | tar --strip-components=1 -xzC . \
|
|
||||||
&& cd unix \
|
|
||||||
&& ./configure --prefix=/prefix \
|
|
||||||
&& make \
|
|
||||||
&& make install install-libraries install-msgs install-tzdata
|
|
||||||
|
|
||||||
WORKDIR /tk
|
|
||||||
RUN curl -L https://prdownloads.sourceforge.net/tcl/tk9.0.1-src.tar.gz | tar --strip-components=1 -xzC . \
|
|
||||||
&& cd unix \
|
|
||||||
&& ./configure --prefix=/prefix --with-tcl=/prefix/lib \
|
|
||||||
&& make \
|
|
||||||
&& make install install-libraries
|
|
||||||
|
|
||||||
WORKDIR /prefix/bin
|
|
||||||
RUN cp ./wish9.0 ./wish
|
|
||||||
RUN cp ./tclsh9.0 ./tclsh
|
|
||||||
|
|
||||||
# Magic
|
|
||||||
WORKDIR /magic
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN ./configure \
|
|
||||||
--prefix=/prefix \
|
|
||||||
--with-tcl=/prefix/lib \
|
|
||||||
--with-tk=/prefix/lib \
|
|
||||||
&& make clean \
|
|
||||||
&& make database/database.h \
|
|
||||||
&& make -j$(nproc) \
|
|
||||||
&& make install
|
|
||||||
|
|
||||||
# Produce summary of what was created and confirm their DSOs
|
|
||||||
RUN echo "### filesystem:" \
|
|
||||||
find /prefix -printf "%y/%M/%m %i/%n %l %u/%U %g/%G %s/%b %T+/%T@\t%p\n"; \
|
|
||||||
ls -lR /prefix; \
|
|
||||||
find /prefix -type f -perm /111 -exec bash -c "echo \#\#\# {}; ldd -v {}" \; 2>/dev/null; \
|
|
||||||
for name in libgcc_s libstdc++ libpng liblzma libxml2 libz libcairo libGL libGLU; do \
|
|
||||||
find /lib64 /usr/lib64 -maxdepth 2 -name "*.so" -name "${name}*" -exec bash -c "echo \#\#\# {}; ldd -v {}" \; 2>/dev/null; \
|
|
||||||
done; \
|
|
||||||
echo "###"
|
|
||||||
|
|
||||||
WORKDIR /
|
|
||||||
RUN tar -czf /prefix.tar.gz -C ./prefix .
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
MAGIC_SRC_ROOT = ../..
|
|
||||||
RESOURCES := $(shell find ../rsc/ -type f)
|
|
||||||
ARCH := $(shell uname -m)
|
|
||||||
APPIMAGE = Magic-$(ARCH).AppImage
|
|
||||||
VERSION_MAGIC := $(shell cat $(MAGIC_SRC_ROOT)/VERSION)
|
|
||||||
VERSION_TSTAMP := $(shell git show -s "--format=%cs" | tr -d '-')
|
|
||||||
VERSION_HASH := $(shell git show -s "--format=%h")
|
|
||||||
VERSION_NUM ?= $(VERSION_MAGIC)~$(VERSION_TSTAMP)~$(VERSION_HASH)
|
|
||||||
VERSION := $(VERSION_NUM)
|
|
||||||
|
|
||||||
# Allow CI to override
|
|
||||||
APPIMAGETOOL_DOWNLOAD_URL ?= https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
||||||
|
|
||||||
all: $(APPIMAGE)
|
|
||||||
|
|
||||||
.PHONY: prefix/bin/magic
|
|
||||||
prefix/bin/magic: Dockerfile Makefile
|
|
||||||
@echo "APPIMAGE=$(APPIMAGE)"
|
|
||||||
@echo "VERSION=$(VERSION)"
|
|
||||||
@echo "ARCH=$(ARCH)"
|
|
||||||
@echo "RESOURCES=$(RESOURCES)"
|
|
||||||
rm -rf prefix
|
|
||||||
docker build -t magic_build -f ./Dockerfile $(MAGIC_SRC_ROOT)
|
|
||||||
id=$$(docker create magic_build) ; \
|
|
||||||
docker cp $$id:/prefix ./prefix ; \
|
|
||||||
docker rm -v $$id
|
|
||||||
mkdir -p prefix/lib/tcl9.0.1
|
|
||||||
cp -r prefix/lib/tcl9.0 prefix/lib/tcl9.0.1/library
|
|
||||||
|
|
||||||
appimagetool:
|
|
||||||
curl -L "$(APPIMAGETOOL_DOWNLOAD_URL)" > ./appimagetool
|
|
||||||
chmod +x ./appimagetool
|
|
||||||
|
|
||||||
$(APPIMAGE): prefix/bin/magic appimagetool $(RESOURCES)
|
|
||||||
cp $(RESOURCES) ./prefix/
|
|
||||||
./appimagetool prefix
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
install:
|
|
||||||
install $(APPIMAGE) $(PREFIX)/bin/magic
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f *.AppImage
|
|
||||||
rm -f prefix.tar.gz
|
|
||||||
rm -rf prefix
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
This is an AppImage that runs on all GNU/Linux platforms with:
|
|
||||||
|
|
||||||
* FUSE
|
|
||||||
* This excludes non-privileged Docker containers unfortunately, unless pre-extracted.
|
|
||||||
* GLIBC 2.34+
|
|
||||||
* Cairo 1.17+
|
|
||||||
* May require runtime CPU matching Linux ABI x86-64-v2 and newer (CPUs with SSE4.2/CX16 via `lscpu`).
|
|
||||||
|
|
||||||
This AppImage build is based on EL9 (via AlmaLinux 9)
|
|
||||||
|
|
||||||
AlmaLinux 9 was first released on 26 May 2022, full support ends 31 May 2027,
|
|
||||||
maintenance support ends 31 May 2032 (please see AlmaLinux bulletins for
|
|
||||||
up-to-date information).
|
|
||||||
|
|
||||||
# Version Info
|
|
||||||
|
|
||||||
See the AppImage main binary file naming, release tag information and AppInfo metadata
|
|
||||||
for the exact magic version inside the archive. When starting AppImage by default the
|
|
||||||
Tcl console banner can also provide version information, also using the `version` Tcl
|
|
||||||
command.
|
|
||||||
|
|
||||||
# Build Info
|
|
||||||
|
|
||||||
* Based on AlmaLinux 9 (EL9)
|
|
||||||
* Tcl/Tk 9.0.1
|
|
||||||
* and Magic 8.x
|
|
||||||
* all default modules enabled (including all Display drivers cairo/X11/OpenGL)
|
|
||||||
|
|
||||||
# FAQ: How to use
|
|
||||||
|
|
||||||
Download the *.AppImage file relevant to your platform and run:
|
|
||||||
|
|
||||||
```
|
|
||||||
chmod +x Magic-x86_64.AppImage
|
|
||||||
./Magic-x86_64.AppImage
|
|
||||||
```
|
|
||||||
|
|
||||||
Example startup with command line options:
|
|
||||||
|
|
||||||
```
|
|
||||||
./Magic-x86_64.AppImage -d XR -T scmos
|
|
||||||
```
|
|
||||||
|
|
||||||
# FAQ: How to use (inside docker / podman)
|
|
||||||
|
|
||||||
```
|
|
||||||
chmod +x Magic-x86_64.AppImage
|
|
||||||
|
|
||||||
### Podman or Docker, use :Z when rootless with selinux enabled
|
|
||||||
podman run --rm --device /dev/fuse --privileged \
|
|
||||||
-v "$(pwd):/tmp/work:Z" -v "/tmp/.X11-unix/X0:/tmp/.X11-unix/X0:Z" \
|
|
||||||
-e DISPLAY -ti almalinux:9
|
|
||||||
|
|
||||||
### Inside Docker:
|
|
||||||
dnf update -y
|
|
||||||
|
|
||||||
dnf install -y fuse libX11 cairo libGL libGLU
|
|
||||||
|
|
||||||
cd /tmp/work
|
|
||||||
|
|
||||||
./Magic-x86_64.AppImage -d XR -T scmos
|
|
||||||
```
|
|
||||||
|
|
||||||
# Building Requirements
|
|
||||||
|
|
||||||
* A reasonably recent GNU/Linux host
|
|
||||||
* GNU make
|
|
||||||
* Docker
|
|
||||||
* Git
|
|
||||||
* curl
|
|
||||||
|
|
||||||
The final build is then packaged into an AppImage using AppImageTool on the host machine.
|
|
||||||
|
|
||||||
# Build Instructions
|
|
||||||
`make`
|
|
||||||
|
|
||||||
# Installation Instructions
|
|
||||||
`make install`
|
|
||||||
|
|
||||||
# FAQ: Is my CPU supported ?
|
|
||||||
|
|
||||||
This is built with the standard x86_64 Linux ABI version for AlmaLinux 9.
|
|
||||||
|
|
||||||
Use the command `/lib64/ld-linux-x86-64.so.2 --help` to see which CPUs your
|
|
||||||
Linux distribtion supports (and your CPU) look for the word "supported".
|
|
||||||
|
|
||||||
# FAQ: The DSO versioning link dependencies?
|
|
||||||
|
|
||||||
The information here provides an outline of what versions to expect from EL9
|
|
||||||
of the major dependencies, to assist you in a compatibility check with your
|
|
||||||
Linux distribution of choice.
|
|
||||||
|
|
||||||
The actual versions in our public releases can differ slightly inline with
|
|
||||||
the EL9 support compatibility and ABI versioning policies for the support
|
|
||||||
lifecycle of the distribution.
|
|
||||||
|
|
||||||
The most important items are the Direct Dependencies and the availabilty
|
|
||||||
of a suitable graphics DSO as per your '-d' choice.
|
|
||||||
|
|
||||||
Direct Runtime Dependencies (from /prefix/**):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libc.so.6 | GLIBC_2.34 | glibc-2.34-168 |
|
|
||||||
| libz.so.1 | ZLIB_1.2.2 | zlib-1.2.11-40 |
|
|
||||||
|
|
||||||
Optional/Modular Runtime Dependencies (depending on graphics mode):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libcairo.so.2 | | |
|
|
||||||
| libcairo.so.2.11704.0 | | cairo-1.17.4-7 |
|
|
||||||
| libGL.so.1 | | libglvnd-glx-1:1.3.4 |
|
|
||||||
| | | mesa-libGL-24.2.8-2 |
|
|
||||||
| libGLU.so.1 | | mesa-libGLU-9.0.1 |
|
|
||||||
|
|
||||||
Transitive/Third-Party Runtime Dependencies (for information only):
|
|
||||||
|
|
||||||
| DSO Filename | DSO Symbol Version | Related Packages |
|
|
||||||
| :--------------------- | :------------------ | :------------------- |
|
|
||||||
| libc.so.6 | GLIBC_2.35 | glibc-2.34-168 |
|
|
||||||
| libstdc++.so.6 | CXXABI_1.3.9 | gcc-c++-11.5.0-5 |
|
|
||||||
| libstdc++.so.6 | GLIBCXX_3.4 | gcc-c++-11.5.0-5 |
|
|
||||||
| libgcc_s.so.1 | GCC_4.2.0 | libgcc-11.5.0-2 |
|
|
||||||
| libxml2.so.2 | LIBXML2_2.6.0 | libxml2-2.9.13-9 |
|
|
||||||
| libpng16.so.16 | PNG16_0 | ibpng-2:1.6.37-12 |
|
|
||||||
| liblzma.so.5 | XZ_5.0 | xz-libs-5.2.5-8 |
|
|
||||||
| libz.so.1 | ZLIB_1.2.9 | zlib-1.2.11-40 |
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
FROM centos/python-38-centos7:20210726-fad62e9
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# Build Dependencies
|
||||||
|
RUN yum install -y cairo-devel freeglut-devel gcc make tcsh
|
||||||
|
|
||||||
|
# Tcl/Tk
|
||||||
|
WORKDIR /tcl
|
||||||
|
RUN curl -L https://prdownloads.sourceforge.net/tcl/tcl8.6.12-src.tar.gz | tar --strip-components=1 -xzC . \
|
||||||
|
&& cd unix \
|
||||||
|
&& ./configure --prefix=/prefix \
|
||||||
|
&& make \
|
||||||
|
&& make install
|
||||||
|
|
||||||
|
WORKDIR /tk
|
||||||
|
RUN curl -L https://prdownloads.sourceforge.net/tcl/tk8.6.12-src.tar.gz | tar --strip-components=1 -xzC . \
|
||||||
|
&& cd unix \
|
||||||
|
&& ./configure --prefix=/prefix --with-tcl=/prefix/lib\
|
||||||
|
&& make \
|
||||||
|
&& make install
|
||||||
|
|
||||||
|
WORKDIR /prefix/bin
|
||||||
|
RUN cp ./wish8.6 ./wish
|
||||||
|
RUN cp ./tclsh8.6 ./tclsh
|
||||||
|
|
||||||
|
# Magic
|
||||||
|
WORKDIR /magic
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN ./configure \
|
||||||
|
--prefix=/prefix \
|
||||||
|
--with-tcl=/prefix/lib \
|
||||||
|
--with-tk=/prefix/lib \
|
||||||
|
--without-opengl \
|
||||||
|
&& make clean \
|
||||||
|
&& make database/database.h \
|
||||||
|
&& make -j$(nproc) \
|
||||||
|
&& make install
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
RUN tar -czf /prefix.tar.gz -C ./prefix .
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
RESOURCES = $(shell find rsc/ -type f)
|
||||||
|
ARCH = $(shell uname -m)
|
||||||
|
APPIMAGE = Magic-$(ARCH).AppImage
|
||||||
|
|
||||||
|
all: $(APPIMAGE)
|
||||||
|
|
||||||
|
.PHONY: prefix/bin/magic
|
||||||
|
prefix/bin/magic: Dockerfile Makefile
|
||||||
|
rm -rf prefix
|
||||||
|
docker build -t magic_build -f ./Dockerfile ..
|
||||||
|
id=$$(docker create magic_build) ; \
|
||||||
|
docker cp $$id:/prefix ./prefix ; \
|
||||||
|
docker rm -v $$id
|
||||||
|
mkdir -p prefix/lib/tcl8.6.12
|
||||||
|
cp -r prefix/lib/tcl8.6 prefix/lib/tcl8.6.12/library
|
||||||
|
|
||||||
|
appimagetool:
|
||||||
|
curl -L https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage > ./appimagetool
|
||||||
|
chmod +x ./appimagetool
|
||||||
|
|
||||||
|
$(APPIMAGE): prefix/bin/magic appimagetool $(RESOURCES)
|
||||||
|
cp $(RESOURCES) ./prefix
|
||||||
|
./appimagetool prefix
|
||||||
|
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
install:
|
||||||
|
install $(APPIMAGE) $(PREFIX)/bin/magic
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -f *.AppImage
|
||||||
|
rm -f prefix.tar.gz
|
||||||
|
rm -rf prefix
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
This is an AppImage that runs on all GNU/Linux platforms with:
|
||||||
|
|
||||||
|
* FUSE
|
||||||
|
* This excludes non-privileged Docker containers unfortunately, unless pre-extracted.
|
||||||
|
* GLIBC 2.17+
|
||||||
|
* Cairo 1.8+
|
||||||
|
|
||||||
|
That's most Linux distributions released in 2016 or later.
|
||||||
|
|
||||||
|
# Build Info
|
||||||
|
A Dockerfile on CentOS 7 (needed for older glibc) image builds Tcl, Tk and Magic.
|
||||||
|
|
||||||
|
The final build is then packaged into an AppImage using AppImageTool on the host machine.
|
||||||
|
|
||||||
|
# Building Requirements
|
||||||
|
* A reasonably recent GNU/Linux host
|
||||||
|
* Docker 20+
|
||||||
|
* curl
|
||||||
|
|
||||||
|
# Build Instructions
|
||||||
|
`make`
|
||||||
|
|
||||||
|
# Installation Instructions
|
||||||
|
`make install`
|
||||||
|
|
@ -1,39 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
export CURDIR=$(dirname $(readlink -f "${0}"))
|
export CURDIR=$(dirname $(readlink -f "${0}"))
|
||||||
|
|
||||||
export PATH="${CURDIR}/bin":$PATH
|
export PATH="${CURDIR}/bin":$PATH
|
||||||
export LD_LIBRARY_PATH=${CURDIR}/lib:$LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=${CURDIR}/lib:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
export CAD_ROOT="${CURDIR}/lib"
|
export CAD_ROOT="${CURDIR}/lib"
|
||||||
export MAGIC_WISH="${CURDIR}/bin/wish"
|
export MAGIC_WISH="${CURDIR}/bin/wish"
|
||||||
|
exec "${CURDIR}/bin/magic" $@
|
||||||
function my_echo() {
|
|
||||||
if [ "$MAGIC_VERBOSE" != "0" ]
|
|
||||||
then
|
|
||||||
echo -- $@
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Attempt to set by default a valid 'ulimit -n' based on TCL version this
|
|
||||||
# will automatically apply valid limit inside docker running processes.
|
|
||||||
if [ "X${MAGIC_ULIMIT_NOFILE:+set}" = "X" ] # not set to something
|
|
||||||
then
|
|
||||||
if $MAGIC_WISH "${CURDIR}/version_check.tcl" | grep -q "=8\." # only needed for tcl8
|
|
||||||
then
|
|
||||||
if [ $(ulimit -Sn) -gt 1024 ] # only reduce >1024 to 1024
|
|
||||||
then
|
|
||||||
MAGIC_ULIMIT_NOFILE=1024
|
|
||||||
my_echo "# ulimit -Sn reduced from $(ulimit -Sn) to $MAGIC_ULIMIT_NOFILE"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "X$MAGIC_ULIMIT_NOFILE" != "X" ] # non empty
|
|
||||||
then
|
|
||||||
# Inform user we did this and hint at how to customize
|
|
||||||
my_echo "ulimit -Sn $MAGIC_ULIMIT_NOFILE # use \$MAGIC_ULIMIT_NOFILE to customize"
|
|
||||||
ulimit -Sn $MAGIC_ULIMIT_NOFILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
my_echo "# Starting Magic"
|
|
||||||
exec "${CURDIR}/bin/magic" "$@"
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# Usage: wish version_check.tcl
|
|
||||||
puts "tcl_version=$tcl_version"
|
|
||||||
puts "tk_version=$tk_version"
|
|
||||||
exit 0
|
|
||||||
|
|
@ -93,7 +93,7 @@ static BinArray *bpBinArrayNew(int dx, /* x diameter of bins */
|
||||||
|
|
||||||
/* allocate array */
|
/* allocate array */
|
||||||
size = sizeof(BinArray) + numBins*(sizeof(void *));
|
size = sizeof(BinArray) + numBins*(sizeof(void *));
|
||||||
new = (BinArray *)callocMagic(1, size);
|
new = (BinArray *)callocMagic(size);
|
||||||
|
|
||||||
/* initial */
|
/* initial */
|
||||||
new->ba_bbox = *bbox;
|
new->ba_bbox = *bbox;
|
||||||
|
|
@ -567,9 +567,6 @@ BinArray *bpBinArrayBuild(Rect bbox,
|
||||||
int numBins;
|
int numBins;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
/* Added by Tim, 2/19/2024 */
|
|
||||||
/* This line is not supposed to be needed? */
|
|
||||||
if ((!subbin) && ((pointertype)elements & BT_ARRAY)) return NULL;
|
|
||||||
|
|
||||||
if(BPD) DumpRect("#### bpBinArrayBuild, TOP bbox= ", &bbox);
|
if(BPD) DumpRect("#### bpBinArrayBuild, TOP bbox= ", &bbox);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@ void bpDumpRect(Rect *r)
|
||||||
fprintf(stderr,"%d",
|
fprintf(stderr,"%d",
|
||||||
r->r_ytop);
|
r->r_ytop);
|
||||||
}
|
}
|
||||||
#ifdef CIF_MODULE
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float oscale;
|
float oscale;
|
||||||
|
|
@ -94,7 +93,6 @@ void bpDumpRect(Rect *r)
|
||||||
fprintf(stderr,"%f",
|
fprintf(stderr,"%f",
|
||||||
oscale * (float)r->r_ytop);
|
oscale * (float)r->r_ytop);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -172,7 +170,6 @@ static void bpBinArrayDump(BinArray *ba, int indent)
|
||||||
fprintf(stderr,"{dx %d} {dy %d} ",
|
fprintf(stderr,"{dx %d} {dy %d} ",
|
||||||
dx,dy);
|
dx,dy);
|
||||||
}
|
}
|
||||||
#ifdef CIF_MODULE
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float oscale;
|
float oscale;
|
||||||
|
|
@ -185,7 +182,6 @@ static void bpBinArrayDump(BinArray *ba, int indent)
|
||||||
fprintf(stderr,"{dy %f} ",
|
fprintf(stderr,"{dy %f} ",
|
||||||
(float)dy * oscale);
|
(float)dy * oscale);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
fprintf(stderr,"{dimX %d} {dimY %d} { bbox ",
|
fprintf(stderr,"{dimX %d} {dimY %d} { bbox ",
|
||||||
dimX,
|
dimX,
|
||||||
dimY);
|
dimY);
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@
|
||||||
*/
|
*/
|
||||||
void BPEnumInit(BPEnum *bpe, /* enum to initialize */
|
void BPEnumInit(BPEnum *bpe, /* enum to initialize */
|
||||||
BPlane *bp,
|
BPlane *bp,
|
||||||
const Rect *area, /* search area */
|
Rect *area, /* search area */
|
||||||
int match,
|
int match,
|
||||||
const char *id) /* for debugging */
|
char *id) /* for debugging */
|
||||||
{
|
{
|
||||||
bool inside = FALSE;
|
bool inside = FALSE;
|
||||||
bpe->bpe_plane = bp;
|
bpe->bpe_plane = bp;
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
//
|
//
|
||||||
// ************************************************************************
|
// ************************************************************************
|
||||||
|
|
||||||
#ifndef _MAGIC__BPLANE__BPENUM_H
|
#ifndef _BPENUM_H
|
||||||
#define _MAGIC__BPLANE__BPENUM_H
|
#define _BPENUM_H
|
||||||
|
|
||||||
/* bpEnum.h --
|
/* bpEnum.h --
|
||||||
*
|
*
|
||||||
|
|
@ -305,7 +305,7 @@ bpEnumNextBin(BPEnum *bpe, bool inside)
|
||||||
{
|
{
|
||||||
BPStack *bps = bpe->bpe_top;
|
BPStack *bps = bpe->bpe_top;
|
||||||
|
|
||||||
#ifdef BPARANOID
|
#ifdef PARANOID
|
||||||
ASSERT(bps,"bpEnumNextBin");
|
ASSERT(bps,"bpEnumNextBin");
|
||||||
ASSERT(!bpe->bpe_nextElement,"bpEnumNextBin");
|
ASSERT(!bpe->bpe_nextElement,"bpEnumNextBin");
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -506,23 +506,23 @@ static __inline__ void *BPEnumNext(BPEnum *bpe)
|
||||||
switch (bpe->bpe_top->bps_state)
|
switch (bpe->bpe_top->bps_state)
|
||||||
{
|
{
|
||||||
case BPS_BINS:
|
case BPS_BINS:
|
||||||
if((e=bpEnumNextBINS(bpe, 0))) return e;
|
if(e=bpEnumNextBINS(bpe, 0)) return e;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BPS_BINS_INSIDE:
|
case BPS_BINS_INSIDE:
|
||||||
if((e=bpEnumNextBINS(bpe, 1))) return e;
|
if(e=bpEnumNextBINS(bpe, 1)) return e;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BPS_INBOX:
|
case BPS_INBOX:
|
||||||
if((e=bpEnumNextINBOX(bpe, 0))) return e;
|
if(e=bpEnumNextINBOX(bpe, 0)) return e;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BPS_INBOX_INSIDE:
|
case BPS_INBOX_INSIDE:
|
||||||
if((e=bpEnumNextINBOX(bpe, 1))) return e;
|
if(e=bpEnumNextINBOX(bpe, 1)) return e;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BPS_HASH:
|
case BPS_HASH:
|
||||||
if((e=bpEnumNextHASH(bpe))) return e;
|
if(e=bpEnumNextHASH(bpe)) return e;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BPS_DONE:
|
case BPS_DONE:
|
||||||
|
|
@ -534,4 +534,4 @@ static __inline__ void *BPEnumNext(BPEnum *bpe)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _MAGIC__BPLANE__BPENUM_H */
|
#endif /* _BPENUM_H */
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ void BPAdd(BPlane *bp, void *element)
|
||||||
"BPAdd, attempted during active enumerations");
|
"BPAdd, attempted during active enumerations");
|
||||||
|
|
||||||
/* element rect must be canonical! */
|
/* element rect must be canonical! */
|
||||||
#ifdef BPARANOID
|
#ifdef PARANOID
|
||||||
ASSERT(GeoIsCanonicalRect(r),"BPAdd, rect must be canonical.");
|
ASSERT(GeoIsCanonicalRect(r),"BPAdd, rect must be canonical.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -262,7 +262,7 @@ Rect BPBBox(BPlane *bp)
|
||||||
e = BPEnumNext(&bpe);
|
e = BPEnumNext(&bpe);
|
||||||
bp->bp_bbox = e->e_rect;
|
bp->bp_bbox = e->e_rect;
|
||||||
|
|
||||||
while((e = BPEnumNext(&bpe)))
|
while(e = BPEnumNext(&bpe))
|
||||||
{
|
{
|
||||||
GeoIncludeRectInBBox(&e->e_rect, &bp->bp_bbox);
|
GeoIncludeRectInBBox(&e->e_rect, &bp->bp_bbox);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _MAGIC__BPLANE__BPOPAQUE_H
|
#ifndef _BPOPAQUE_H
|
||||||
#define _MAGIC__BPLANE__BPOPAQUE_H
|
#define _BPOPAQUE_H
|
||||||
|
|
||||||
#ifndef _MAGIC__UTILS__IHASH_H
|
#ifndef _IHASH_H
|
||||||
#include "utils/ihash.h"
|
#include "utils/ihash.h"
|
||||||
#endif
|
#endif /* _IHASH_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpOpaque.h --
|
* bpOpaque.h --
|
||||||
|
|
@ -106,7 +106,7 @@ static __inline__ bool bpBinType(BinArray *ba, int i)
|
||||||
|
|
||||||
static __inline__ Element *bpBinList(BinArray *ba, int i)
|
static __inline__ Element *bpBinList(BinArray *ba, int i)
|
||||||
{
|
{
|
||||||
#ifdef BPARANOID
|
#ifdef PARANOID
|
||||||
ASSERT(bpBinType(ba,i)==BT_LIST,"bpBinList");
|
ASSERT(bpBinType(ba,i)==BT_LIST,"bpBinList");
|
||||||
#endif
|
#endif
|
||||||
return (Element *) ba->ba_bins[i];
|
return (Element *) ba->ba_bins[i];
|
||||||
|
|
@ -114,7 +114,7 @@ static __inline__ Element *bpBinList(BinArray *ba, int i)
|
||||||
|
|
||||||
static __inline__ Element **bpBinListHead(BinArray *ba, int i)
|
static __inline__ Element **bpBinListHead(BinArray *ba, int i)
|
||||||
{
|
{
|
||||||
#ifdef BPARANOID
|
#ifdef PARANOID
|
||||||
ASSERT(bpBinType(ba,i)==BT_LIST,"bpBinList");
|
ASSERT(bpBinType(ba,i)==BT_LIST,"bpBinList");
|
||||||
#endif
|
#endif
|
||||||
return (Element **) &ba->ba_bins[i];
|
return (Element **) &ba->ba_bins[i];
|
||||||
|
|
@ -122,7 +122,7 @@ static __inline__ Element **bpBinListHead(BinArray *ba, int i)
|
||||||
|
|
||||||
static __inline__ BinArray *bpSubArray(BinArray *ba, int i)
|
static __inline__ BinArray *bpSubArray(BinArray *ba, int i)
|
||||||
{
|
{
|
||||||
#ifdef BPARANOID
|
#ifdef PARANOID
|
||||||
ASSERT(bpBinType(ba,i)==BT_ARRAY,"bpSubArray");
|
ASSERT(bpBinType(ba,i)==BT_ARRAY,"bpSubArray");
|
||||||
#endif
|
#endif
|
||||||
return (BinArray *) ((pointertype) ba->ba_bins[i] & ~BT_TYPE_MASK);
|
return (BinArray *) ((pointertype) ba->ba_bins[i] & ~BT_TYPE_MASK);
|
||||||
|
|
@ -182,7 +182,7 @@ typedef struct bpenum
|
||||||
BPlane *bpe_plane; /* plane being searched */
|
BPlane *bpe_plane; /* plane being searched */
|
||||||
Rect bpe_srchArea; /* area being searched */
|
Rect bpe_srchArea; /* area being searched */
|
||||||
int bpe_match; /* match criteria */
|
int bpe_match; /* match criteria */
|
||||||
const char *bpe_id; /* for debug */
|
char *bpe_id; /* for debug */
|
||||||
int bpe_subBinMinX;
|
int bpe_subBinMinX;
|
||||||
int bpe_subBinMinY; /* consider subbinning
|
int bpe_subBinMinY; /* consider subbinning
|
||||||
* for bins bigger than this.
|
* for bins bigger than this.
|
||||||
|
|
@ -192,4 +192,4 @@ typedef struct bpenum
|
||||||
BPStack bpe_stack[10000]; /* stack for tree traversal during enum */
|
BPStack bpe_stack[10000]; /* stack for tree traversal during enum */
|
||||||
} BPEnum;
|
} BPEnum;
|
||||||
|
|
||||||
#endif /* _MAGIC__BPLANE__BPOPAQUE_H */
|
#endif /* _BPOPAQUE_H */
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _MAGIC__BPLANE__BPLANE_H
|
#ifndef _BPLANE_H
|
||||||
#define _MAGIC__BPLANE__BPLANE_H
|
#define _BPLANE_H
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bplane.h --
|
* bplane.h --
|
||||||
|
|
@ -185,9 +185,9 @@ extern void BPEnumInit(BPEnum *bpe, /* this procedure initializes this
|
||||||
* enumeration.
|
* enumeration.
|
||||||
*/
|
*/
|
||||||
BPlane *bp, /* bplane to search */
|
BPlane *bp, /* bplane to search */
|
||||||
const Rect *area, /* area to search */
|
Rect *area, /* area to search */
|
||||||
int match, /* see below */
|
int match, /* see below */
|
||||||
const char *id); /* for debugging */
|
char *id); /* for debugging */
|
||||||
/* match values */
|
/* match values */
|
||||||
|
|
||||||
/* enum all elements in the bplane (area arg must be null) */
|
/* enum all elements in the bplane (area arg must be null) */
|
||||||
|
|
@ -232,4 +232,4 @@ BPStat(BPlane *bp,
|
||||||
int *totUnbinned, /* ret tot num of e's not binned */
|
int *totUnbinned, /* ret tot num of e's not binned */
|
||||||
int *maxDepth); /* ret max bin array depth */
|
int *maxDepth); /* ret max bin array depth */
|
||||||
|
|
||||||
#endif /* _MAGIC__BPLANE__BPLANE_H */
|
#endif /* _BPLANE_H */
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
* This file defines constants and datastructures used internally by the
|
* This file defines constants and datastructures used internally by the
|
||||||
* bplane module, but not exported to the rest of the world.
|
* bplane module, but not exported to the rest of the world.
|
||||||
*/
|
*/
|
||||||
#ifndef _MAGIC__BPLANE__BPLANEINT_H
|
#ifndef _BPLANEINT_H
|
||||||
#define _MAGIC__BPLANE__BPLANEINT_H
|
#define _BPLANEINT_H
|
||||||
|
|
||||||
/* Tcl linked Parameters */
|
/* Tcl linked Parameters */
|
||||||
extern int bpMinBAPop; /* don't sub(bin) when count less than this
|
extern int bpMinBAPop; /* don't sub(bin) when count less than this
|
||||||
|
|
@ -79,4 +79,4 @@ extern Plane *bpTestSnowTile(int size, bool trace);
|
||||||
|
|
||||||
extern int bpRand(int min, int max);
|
extern int bpRand(int min, int max);
|
||||||
|
|
||||||
#endif /* _MAGIC__BPLANE__BPLANEINT_H */
|
#endif /* _BPLANEINT_H */
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRdcl.c,v 1.5 2010/06/25 13:59:24 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRdcl.c,v 1.5 2010/06/25 13:59:24 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -53,16 +53,15 @@ int calmaNonManhattan;
|
||||||
int CalmaFlattenLimit = 10;
|
int CalmaFlattenLimit = 10;
|
||||||
int NameConvertErrors = 0;
|
int NameConvertErrors = 0;
|
||||||
bool CalmaRewound = FALSE;
|
bool CalmaRewound = FALSE;
|
||||||
bool CalmaRecordPaths = FALSE;
|
|
||||||
TileTypeBitMask *CalmaMaskHints = NULL;
|
TileTypeBitMask *CalmaMaskHints = NULL;
|
||||||
|
|
||||||
extern HashTable calmaDefInitHash;
|
extern HashTable calmaDefInitHash;
|
||||||
extern int CalmaPolygonCount;
|
extern int CalmaPolygonCount;
|
||||||
|
|
||||||
/* forward declarations */
|
/* forward declarations */
|
||||||
int calmaElementSref(char *filename);
|
int calmaElementSref();
|
||||||
bool calmaParseElement(char *filename, int *pnsrefs, int *pnpaths);
|
bool calmaParseElement();
|
||||||
void calmaUniqueCell(char *sname);
|
void calmaUniqueCell();
|
||||||
|
|
||||||
/* Structure used when flattening the GDS hierarchy on read-in */
|
/* Structure used when flattening the GDS hierarchy on read-in */
|
||||||
|
|
||||||
|
|
@ -97,8 +96,8 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OFFTYPE
|
OFFTYPE
|
||||||
calmaSetPosition(
|
calmaSetPosition(sname)
|
||||||
char *sname)
|
char *sname;
|
||||||
{
|
{
|
||||||
OFFTYPE originalPos = 0, currentPos = 0;
|
OFFTYPE originalPos = 0, currentPos = 0;
|
||||||
int nbytes, rtype;
|
int nbytes, rtype;
|
||||||
|
|
@ -189,7 +188,7 @@ calmaSetPosition(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaNextCell(void)
|
calmaNextCell()
|
||||||
{
|
{
|
||||||
int nbytes, rtype;
|
int nbytes, rtype;
|
||||||
|
|
||||||
|
|
@ -241,14 +240,12 @@ calmaNextCell(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Plane **
|
Plane **
|
||||||
calmaExact(void)
|
calmaExact()
|
||||||
{
|
{
|
||||||
int pNum;
|
int pNum;
|
||||||
Plane *newplane;
|
Plane *newplane;
|
||||||
Plane **parray;
|
Plane **parray;
|
||||||
|
int gdsCopyPaintFunc(); /* Forward reference */
|
||||||
/* Forward reference */
|
|
||||||
int gdsCopyPaintFunc(Tile *tile, TileType dinfo, GDSCopyRec *gdsCopyRec);
|
|
||||||
|
|
||||||
parray = (Plane **)mallocMagic(MAXCIFRLAYERS * sizeof(Plane *));
|
parray = (Plane **)mallocMagic(MAXCIFRLAYERS * sizeof(Plane *));
|
||||||
|
|
||||||
|
|
@ -301,9 +298,9 @@ calmaExact(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaFlattenPolygonFunc(
|
calmaFlattenPolygonFunc(use, parent)
|
||||||
CellUse *use,
|
CellUse *use;
|
||||||
CellDef *parent)
|
CellDef *parent;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CellUse dummy;
|
CellUse dummy;
|
||||||
|
|
@ -350,11 +347,11 @@ calmaFlattenPolygonFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaParseStructure(
|
calmaParseStructure(filename)
|
||||||
char *filename) /* Name of the GDS file read */
|
char *filename; /* Name of the GDS file read */
|
||||||
{
|
{
|
||||||
static const int structs[] = { CALMA_STRCLASS, CALMA_STRTYPE, -1 };
|
static int structs[] = { CALMA_STRCLASS, CALMA_STRTYPE, -1 };
|
||||||
int nbytes = -1, rtype = 0, nsrefs, osrefs, npaths;
|
int nbytes, rtype, nsrefs, osrefs, npaths;
|
||||||
char *strname = NULL;
|
char *strname = NULL;
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
int timestampval = 0;
|
int timestampval = 0;
|
||||||
|
|
@ -390,15 +387,6 @@ calmaParseStructure(
|
||||||
he = HashFind(&calmaDefInitHash, strname);
|
he = HashFind(&calmaDefInitHash, strname);
|
||||||
if ((def = (CellDef *)HashGetValue(he)) != NULL)
|
if ((def = (CellDef *)HashGetValue(he)) != NULL)
|
||||||
{
|
{
|
||||||
if (def->cd_flags & CDPRELOADED)
|
|
||||||
{
|
|
||||||
/* Cell definition was read ahead due to option "flatten" */
|
|
||||||
/* or "flatglob". Do not complain about seeing it again. */
|
|
||||||
def->cd_flags &= ~CDPRELOADED;
|
|
||||||
calmaNextCell();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (def->cd_flags & CDPROCESSEDGDS)
|
if (def->cd_flags & CDPROCESSEDGDS)
|
||||||
{
|
{
|
||||||
/* If cell definition was marked as processed, then skip */
|
/* If cell definition was marked as processed, then skip */
|
||||||
|
|
@ -408,7 +396,6 @@ calmaParseStructure(
|
||||||
|
|
||||||
if (!CalmaPostOrder && !CalmaRewound)
|
if (!CalmaPostOrder && !CalmaRewound)
|
||||||
{
|
{
|
||||||
cifReadCellDef = def;
|
|
||||||
CalmaReadError("Cell \"%s\" was already defined in this file.\n",
|
CalmaReadError("Cell \"%s\" was already defined in this file.\n",
|
||||||
strname);
|
strname);
|
||||||
CalmaReadError("Ignoring duplicate definition\n");
|
CalmaReadError("Ignoring duplicate definition\n");
|
||||||
|
|
@ -420,7 +407,6 @@ calmaParseStructure(
|
||||||
{
|
{
|
||||||
char *newname;
|
char *newname;
|
||||||
|
|
||||||
cifReadCellDef = def;
|
|
||||||
CalmaReadError("Cell \"%s\" was already defined in this file.\n",
|
CalmaReadError("Cell \"%s\" was already defined in this file.\n",
|
||||||
strname);
|
strname);
|
||||||
newname = (char *)mallocMagic(strlen(strname) + 20);
|
newname = (char *)mallocMagic(strlen(strname) + 20);
|
||||||
|
|
@ -506,33 +492,28 @@ calmaParseStructure(
|
||||||
|
|
||||||
if (CalmaReadOnly || predefined)
|
if (CalmaReadOnly || predefined)
|
||||||
{
|
{
|
||||||
PropertyRecord *proprec;
|
|
||||||
char cstring[1024];
|
char cstring[1024];
|
||||||
|
|
||||||
|
/* Writing the file position into a string is slow, but */
|
||||||
|
/* it prevents requiring special handling when printing */
|
||||||
|
/* out the properties. */
|
||||||
|
|
||||||
|
char *fpcopy = (char *)mallocMagic(20);
|
||||||
|
char *fncopy;
|
||||||
|
|
||||||
/* Substitute variable for PDK path or ~ for home directory */
|
/* Substitute variable for PDK path or ~ for home directory */
|
||||||
/* the same way that cell references are handled in .mag files. */
|
/* the same way that cell references are handled in .mag files. */
|
||||||
DBPathSubstitute(filename, cstring, cifReadCellDef);
|
DBPathSubstitute(filename, cstring, cifReadCellDef);
|
||||||
|
fncopy = StrDup(NULL, cstring);
|
||||||
|
sprintf(fpcopy, "%"DLONG_PREFIX"d", (dlong) filepos);
|
||||||
|
DBPropPut(cifReadCellDef, "GDS_START", (ClientData)fpcopy);
|
||||||
|
|
||||||
proprec = (PropertyRecord *)mallocMagic(sizeof(PropertyRecord));
|
fpcopy = (char *)mallocMagic(20);
|
||||||
proprec->prop_type = PROPERTY_TYPE_DOUBLE;
|
|
||||||
proprec->prop_len = 1;
|
|
||||||
proprec->prop_value.prop_double[0] = filepos;
|
|
||||||
DBPropPut(cifReadCellDef, "GDS_START", (ClientData)proprec);
|
|
||||||
|
|
||||||
filepos = FTELL(calmaInputFile);
|
filepos = FTELL(calmaInputFile);
|
||||||
|
sprintf(fpcopy, "%"DLONG_PREFIX"d", (dlong) filepos);
|
||||||
|
DBPropPut(cifReadCellDef, "GDS_END", (ClientData)fpcopy);
|
||||||
|
|
||||||
proprec = (PropertyRecord *)mallocMagic(sizeof(PropertyRecord));
|
DBPropPut(cifReadCellDef, "GDS_FILE", (ClientData)fncopy);
|
||||||
proprec->prop_type = PROPERTY_TYPE_DOUBLE;
|
|
||||||
proprec->prop_len = 1;
|
|
||||||
proprec->prop_value.prop_double[0] = filepos;
|
|
||||||
DBPropPut(cifReadCellDef, "GDS_END", (ClientData)proprec);
|
|
||||||
|
|
||||||
proprec = (PropertyRecord *)mallocMagic(sizeof(PropertyRecord) - 7 +
|
|
||||||
strlen(cstring));
|
|
||||||
proprec->prop_type = PROPERTY_TYPE_STRING;
|
|
||||||
proprec->prop_len = 1;
|
|
||||||
strcpy(proprec->prop_value.prop_string, cstring);
|
|
||||||
DBPropPut(cifReadCellDef, "GDS_FILE", (ClientData)proprec);
|
|
||||||
|
|
||||||
if (predefined)
|
if (predefined)
|
||||||
{
|
{
|
||||||
|
|
@ -694,12 +675,11 @@ syntaxerror:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaParseElement(
|
calmaParseElement(filename, pnsrefs, pnpaths)
|
||||||
char *filename,
|
char *filename;
|
||||||
int *pnsrefs,
|
int *pnsrefs, *pnpaths;
|
||||||
int *pnpaths)
|
|
||||||
{
|
{
|
||||||
static const int node[] = { CALMA_ELFLAGS, CALMA_PLEX, CALMA_LAYER,
|
static int node[] = { CALMA_ELFLAGS, CALMA_PLEX, CALMA_LAYER,
|
||||||
CALMA_NODETYPE, CALMA_XY, -1 };
|
CALMA_NODETYPE, CALMA_XY, -1 };
|
||||||
int nbytes, rtype, madeinst;
|
int nbytes, rtype, madeinst;
|
||||||
|
|
||||||
|
|
@ -757,10 +737,9 @@ calmaParseElement(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaEnumFunc(
|
calmaEnumFunc(tile, plane)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo,
|
int *plane;
|
||||||
int *plane)
|
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -785,26 +764,24 @@ calmaEnumFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaElementSref(
|
calmaElementSref(filename)
|
||||||
char *filename)
|
char *filename;
|
||||||
{
|
{
|
||||||
int nbytes, rtype, cols, rows, nref, n, i, savescale;
|
int nbytes, rtype, cols, rows, nref, n, i, savescale;
|
||||||
int xlo, ylo, xhi, yhi, xsep, ysep, angle;
|
int xlo, ylo, xhi, yhi, xsep, ysep;
|
||||||
bool madeinst = FALSE, rotated = FALSE;
|
bool madeinst = FALSE;
|
||||||
char *sname = NULL;
|
char *sname = NULL;
|
||||||
bool isArray = FALSE;
|
bool isArray = FALSE;
|
||||||
bool dolookahead = FALSE;
|
|
||||||
Transform trans, tinv;
|
Transform trans, tinv;
|
||||||
Point refarray[3], refunscaled[3], p;
|
Point refarray[3], refunscaled[3], p;
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
|
int gdsCopyPaintFunc(); /* Forward reference */
|
||||||
|
int gdsHasUses(); /* Forward reference */
|
||||||
|
/* Added by NP */
|
||||||
char *useid = NULL, *arraystr = NULL;
|
char *useid = NULL, *arraystr = NULL;
|
||||||
int propAttrType;
|
int propAttrType;
|
||||||
|
|
||||||
/* Forward reference */
|
|
||||||
int gdsCopyPaintFunc(Tile *tile, TileType dinfo, GDSCopyRec *gdsCopyRec);
|
|
||||||
int gdsHasUses(CellUse *use, ClientData clientdata);
|
|
||||||
|
|
||||||
/* Skip CALMA_ELFLAGS, CALMA_PLEX */
|
/* Skip CALMA_ELFLAGS, CALMA_PLEX */
|
||||||
calmaSkipSet(calmaElementIgnore);
|
calmaSkipSet(calmaElementIgnore);
|
||||||
|
|
||||||
|
|
@ -820,38 +797,7 @@ calmaElementSref(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
def = calmaLookCell(sname);
|
def = calmaLookCell(sname);
|
||||||
|
if (!def && (CalmaPostOrder || CalmaFlattenUses || (CalmaFlattenUsesByName != NULL)))
|
||||||
/*
|
|
||||||
* If the "flatten" option is set, then we always have to seek
|
|
||||||
* ahead and read the structure in order to determine if it
|
|
||||||
* meets the requirement of being flattened or not. If the
|
|
||||||
* "flatglob" option is set, then we need to read ahead and
|
|
||||||
* read the cell definition so that it can be flatten. This
|
|
||||||
* requires pattern-matching the cell def.
|
|
||||||
*/
|
|
||||||
|
|
||||||
dolookahead = (CalmaPostOrder || CalmaFlattenUses) ? TRUE : FALSE;
|
|
||||||
if ((!dolookahead) && (CalmaFlattenUsesByName != NULL))
|
|
||||||
{
|
|
||||||
char *pattern;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
pattern = CalmaFlattenUsesByName[i];
|
|
||||||
if (pattern == NULL) break;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
/* Check pattern against strname */
|
|
||||||
if (Match(pattern, sname))
|
|
||||||
{
|
|
||||||
dolookahead = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!def && dolookahead)
|
|
||||||
{
|
{
|
||||||
/* Force the GDS parser to read the cell definition in
|
/* Force the GDS parser to read the cell definition in
|
||||||
* post-order. If cellname "sname" is not defined before
|
* post-order. If cellname "sname" is not defined before
|
||||||
|
|
@ -885,7 +831,6 @@ calmaElementSref(
|
||||||
FSEEK(calmaInputFile, originalFilePos, SEEK_SET);
|
FSEEK(calmaInputFile, originalFilePos, SEEK_SET);
|
||||||
cifReadCellDef = calmaLookCell(currentSname);
|
cifReadCellDef = calmaLookCell(currentSname);
|
||||||
def = calmaLookCell(sname);
|
def = calmaLookCell(sname);
|
||||||
def->cd_flags |= CDPRELOADED;
|
|
||||||
cifCurReadPlanes = savePlanes;
|
cifCurReadPlanes = savePlanes;
|
||||||
calmaLayerHash = OrigCalmaLayerHash;
|
calmaLayerHash = OrigCalmaLayerHash;
|
||||||
if (crsMultiplier != cifCurReadStyle->crs_multiplier)
|
if (crsMultiplier != cifCurReadStyle->crs_multiplier)
|
||||||
|
|
@ -990,73 +935,17 @@ calmaElementSref(
|
||||||
refarray[2].p_x = refarray[2].p_y = 0;
|
refarray[2].p_x = refarray[2].p_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the array is given an angle, then the meaning of rows and
|
|
||||||
* columns needs to be swapped for the purpose of ignoring
|
|
||||||
* X or Y values in the case of a 1-row or 1-column entry.
|
|
||||||
*/
|
|
||||||
angle = GeoTransAngle(&trans, 0);
|
|
||||||
if ((angle == 90) || (angle == 270) || (angle == -90) || (angle == -270))
|
|
||||||
rotated = TRUE;
|
|
||||||
|
|
||||||
/* If this is a cell reference, then we scale to magic coordinates
|
/* If this is a cell reference, then we scale to magic coordinates
|
||||||
* and place the cell in the magic database. However, if this is
|
* and place the cell in the magic database. However, if this is
|
||||||
* a cell to be flattened a la "gds flatten", then we keep the GDS
|
* a cell to be flattened a la "gds flatten", then we keep the GDS
|
||||||
* coordinates, and don't scale to the magic database.
|
* coordinates, and don't scale to the magic database.
|
||||||
*
|
|
||||||
* NOTE: Scaling everything in the middle or reading array data
|
|
||||||
* and then retroactively adjusting the array data read earlier
|
|
||||||
* is problematic, and probably incorrect.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
for (n = 0; n < nref; n++)
|
|
||||||
{
|
|
||||||
savescale = calmaReadScale1;
|
|
||||||
|
|
||||||
/* If there is only one column, then X data in the 2nd or 3rd
|
|
||||||
* entry is irrelevant. If there is only one row, then Y data
|
|
||||||
* in the 2nd or 3rd entry is irrelevant. Prevent issues caused
|
|
||||||
* by incorrect/uninitialized data in these positions by ignoring
|
|
||||||
* them as needed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ((n > 0) && ((!rotated && (rows == 1)) || (rotated && (cols == 1))))
|
|
||||||
{
|
|
||||||
calmaReadX(&refarray[n], 1);
|
|
||||||
calmaSkipBytes(4);
|
|
||||||
refarray[n].p_y = refarray[0].p_y;
|
|
||||||
}
|
|
||||||
else if ((n > 0) && ((!rotated && (cols == 1)) || (rotated && (rows == 1))))
|
|
||||||
{
|
|
||||||
calmaSkipBytes(4);
|
|
||||||
calmaReadY(&refarray[n], 1);
|
|
||||||
refarray[n].p_x = refarray[0].p_x;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
calmaReadPoint(&refarray[n], 1);
|
|
||||||
|
|
||||||
if (savescale != calmaReadScale1)
|
|
||||||
{
|
|
||||||
/* Scale changed, so update previous points read */
|
|
||||||
int newscale = calmaReadScale1 / savescale;
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
refarray[i].p_x *= newscale;
|
|
||||||
refarray[i].p_y *= newscale;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FEOF(calmaInputFile))
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (n = 0; n < nref; n++)
|
|
||||||
refunscaled[n] = refarray[n]; // Save for CDFLATGDS cells
|
|
||||||
|
|
||||||
for (n = 0; n < nref; n++)
|
for (n = 0; n < nref; n++)
|
||||||
{
|
{
|
||||||
savescale = cifCurReadStyle->crs_scaleFactor;
|
savescale = cifCurReadStyle->crs_scaleFactor;
|
||||||
|
calmaReadPoint(&refarray[n], 1);
|
||||||
|
refunscaled[n] = refarray[n]; // Save for CDFLATGDS cells
|
||||||
refarray[n].p_x = CIFScaleCoord(refarray[n].p_x, COORD_EXACT);
|
refarray[n].p_x = CIFScaleCoord(refarray[n].p_x, COORD_EXACT);
|
||||||
if (savescale != cifCurReadStyle->crs_scaleFactor)
|
if (savescale != cifCurReadStyle->crs_scaleFactor)
|
||||||
{
|
{
|
||||||
|
|
@ -1077,6 +966,9 @@ calmaElementSref(
|
||||||
}
|
}
|
||||||
refarray[n].p_x *= (savescale / cifCurReadStyle->crs_scaleFactor);
|
refarray[n].p_x *= (savescale / cifCurReadStyle->crs_scaleFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FEOF(calmaInputFile))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip remainder */
|
/* Skip remainder */
|
||||||
|
|
@ -1340,9 +1232,9 @@ calmaElementSref(
|
||||||
/* Callback function for determining if a cell has at least one subcell */
|
/* Callback function for determining if a cell has at least one subcell */
|
||||||
|
|
||||||
int
|
int
|
||||||
gdsHasUses(
|
gdsHasUses(use, clientdata)
|
||||||
CellUse *use,
|
CellUse *use;
|
||||||
ClientData clientdata)
|
ClientData clientdata;
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1350,30 +1242,29 @@ gdsHasUses(
|
||||||
/* Callback function for copying paint from one CIF cell into another */
|
/* Callback function for copying paint from one CIF cell into another */
|
||||||
|
|
||||||
int
|
int
|
||||||
gdsCopyPaintFunc(
|
gdsCopyPaintFunc(tile, gdsCopyRec)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo,
|
GDSCopyRec *gdsCopyRec;
|
||||||
GDSCopyRec *gdsCopyRec)
|
|
||||||
{
|
{
|
||||||
int pNum;
|
int pNum;
|
||||||
TileType newdinfo;
|
TileType dinfo;
|
||||||
Rect sourceRect, targetRect;
|
Rect sourceRect, targetRect;
|
||||||
Transform *trans = gdsCopyRec->trans;
|
Transform *trans = gdsCopyRec->trans;
|
||||||
Plane *plane = gdsCopyRec->plane;
|
Plane *plane = gdsCopyRec->plane;
|
||||||
|
|
||||||
newdinfo = TiGetTypeExact(tile) | dinfo;
|
dinfo = TiGetTypeExact(tile);
|
||||||
|
|
||||||
if (trans)
|
if (trans)
|
||||||
{
|
{
|
||||||
TiToRect(tile, &sourceRect);
|
TiToRect(tile, &sourceRect);
|
||||||
GeoTransRect(trans, &sourceRect, &targetRect);
|
GeoTransRect(trans, &sourceRect, &targetRect);
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, trans);
|
dinfo = DBTransformDiagonal(TiGetTypeExact(tile), trans);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
TiToRect(tile, &targetRect);
|
TiToRect(tile, &targetRect);
|
||||||
|
|
||||||
DBNMPaintPlane(plane, newdinfo, &targetRect, CIFPaintTable,
|
DBNMPaintPlane(plane, dinfo, &targetRect, CIFPaintTable,
|
||||||
(PaintUndoInfo *)NULL);
|
(PaintUndoInfo *)NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1398,8 +1289,8 @@ gdsCopyPaintFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaUniqueCell(
|
calmaUniqueCell(sname)
|
||||||
char *sname)
|
char *sname;
|
||||||
{
|
{
|
||||||
HashEntry *h;
|
HashEntry *h;
|
||||||
CellDef *def, *testdef;
|
CellDef *def, *testdef;
|
||||||
|
|
@ -1458,14 +1349,14 @@ calmaUniqueCell(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CellDef *
|
CellDef *
|
||||||
calmaFindCell(
|
calmaFindCell(name, was_called, predefined)
|
||||||
const char *name, /* Name of desired cell */
|
char *name; /* Name of desired cell */
|
||||||
bool *was_called, /* If this cell is in the hash table, then it
|
bool *was_called; /* If this cell is in the hash table, then it
|
||||||
* was instanced before it was defined. We
|
* was instanced before it was defined. We
|
||||||
* need to know this so as to avoid flattening
|
* need to know this so as to avoid flattening
|
||||||
* the cell if requested.
|
* the cell if requested.
|
||||||
*/
|
*/
|
||||||
bool *predefined) /* If this cell was in memory before the GDS
|
bool *predefined; /* If this cell was in memory before the GDS
|
||||||
* file was read, then this flag gets set.
|
* file was read, then this flag gets set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -1492,18 +1383,13 @@ calmaFindCell(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
TxPrintf("Warning: cell %s already existed before reading GDS!\n",
|
||||||
|
name);
|
||||||
if (CalmaNoDuplicates)
|
if (CalmaNoDuplicates)
|
||||||
{
|
{
|
||||||
TxPrintf("Note: cell %s already existed before reading GDS.\n",
|
|
||||||
name);
|
|
||||||
if (predefined) *predefined = TRUE;
|
if (predefined) *predefined = TRUE;
|
||||||
TxPrintf("Using pre-existing cell definition\n");
|
TxPrintf("Using pre-existing cell definition\n");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
TxPrintf("Warning: cell %s already existed before reading GDS!\n",
|
|
||||||
name);
|
|
||||||
}
|
|
||||||
if (was_called) *was_called = TRUE;
|
if (was_called) *was_called = TRUE;
|
||||||
}
|
}
|
||||||
HashSetValue(h, def);
|
HashSetValue(h, def);
|
||||||
|
|
@ -1545,8 +1431,8 @@ calmaFindCell(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CellDef *
|
CellDef *
|
||||||
calmaLookCell(
|
calmaLookCell(name)
|
||||||
char *name) /* Name of desired cell */
|
char *name; /* Name of desired cell */
|
||||||
{
|
{
|
||||||
HashEntry *h;
|
HashEntry *h;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRdio.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRdio.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -50,8 +50,8 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
#include "calma/calma.h"
|
#include "calma/calma.h"
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
bool calmaReadR8(double *pd);
|
bool calmaReadR8();
|
||||||
bool calmaSkipBytes(int nbytes);
|
bool calmaSkipBytes();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -73,9 +73,9 @@ bool calmaSkipBytes(int nbytes);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaReadTransform(
|
calmaReadTransform(ptrans, name)
|
||||||
Transform *ptrans, /* Fill in this transform */
|
Transform *ptrans; /* Fill in this transform */
|
||||||
char *name) /* Name of subcell (for errors) */
|
char *name; /* Name of subcell (for errors) */
|
||||||
{
|
{
|
||||||
int nbytes, rtype, flags, angle;
|
int nbytes, rtype, flags, angle;
|
||||||
double dangle;
|
double dangle;
|
||||||
|
|
@ -205,9 +205,9 @@ calmaReadTransform(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaReadI2Record(
|
calmaReadI2Record(type, pvalue)
|
||||||
int type, /* Type of record expected */
|
int type; /* Type of record expected */
|
||||||
int *pvalue) /* Store value here */
|
int *pvalue; /* Store value here */
|
||||||
{
|
{
|
||||||
int nbytes, rtype, n;
|
int nbytes, rtype, n;
|
||||||
|
|
||||||
|
|
@ -250,9 +250,9 @@ eof:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaReadI4Record(
|
calmaReadI4Record(type, pvalue)
|
||||||
int type, /* Type of record expected */
|
int type; /* Type of record expected */
|
||||||
int *pvalue) /* Store value here */
|
int *pvalue; /* Store value here */
|
||||||
{
|
{
|
||||||
int nbytes, rtype, n;
|
int nbytes, rtype, n;
|
||||||
|
|
||||||
|
|
@ -298,9 +298,9 @@ eof:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaReadStampRecord(
|
calmaReadStampRecord(type, stampptr)
|
||||||
int type,
|
int type;
|
||||||
int *stampptr)
|
int *stampptr;
|
||||||
{
|
{
|
||||||
int nbytes, rtype;
|
int nbytes, rtype;
|
||||||
struct tm gds_timestamp;
|
struct tm gds_timestamp;
|
||||||
|
|
@ -371,9 +371,9 @@ eof:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaReadStringRecord(
|
calmaReadStringRecord(type, str)
|
||||||
int type,
|
int type;
|
||||||
char **str)
|
char **str;
|
||||||
{
|
{
|
||||||
int nbytes, rtype;
|
int nbytes, rtype;
|
||||||
|
|
||||||
|
|
@ -389,7 +389,7 @@ calmaReadStringRecord(
|
||||||
|
|
||||||
nbytes -= CALMAHEADERLENGTH;
|
nbytes -= CALMAHEADERLENGTH;
|
||||||
*str = (char *) mallocMagic(nbytes + 1);
|
*str = (char *) mallocMagic(nbytes + 1);
|
||||||
if (magicFREAD(*str, sizeof (char), nbytes, calmaInputFile) != nbytes)
|
if (FREAD(*str, sizeof (char), nbytes, calmaInputFile) != nbytes)
|
||||||
goto eof;
|
goto eof;
|
||||||
|
|
||||||
*(*str + nbytes) = '\0';
|
*(*str + nbytes) = '\0';
|
||||||
|
|
@ -420,21 +420,21 @@ eof:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaReadR8(
|
calmaReadR8(pd)
|
||||||
double *pd) /* Store result in *pd */
|
double *pd; /* Store result in *pd */
|
||||||
{
|
{
|
||||||
int i, exponent;
|
int i, exponent;
|
||||||
unsigned char dchars[8];
|
unsigned char dchars[8];
|
||||||
double mantissa, d;
|
double mantissa, d;
|
||||||
bool isneg;
|
bool isneg;
|
||||||
|
|
||||||
if (magicFREAD((char *) dchars, sizeof (char), sizeof dchars,
|
if (FREAD((char *) dchars, sizeof (char), sizeof dchars,
|
||||||
calmaInputFile) != sizeof dchars)
|
calmaInputFile) != sizeof dchars)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
|
||||||
/* Extract the sign and exponent */
|
/* Extract the sign and exponent */
|
||||||
exponent = dchars[0];
|
exponent = dchars[0];
|
||||||
if ((isneg = (exponent & 0x80)))
|
if (isneg = (exponent & 0x80))
|
||||||
exponent &= ~0x80;
|
exponent &= ~0x80;
|
||||||
exponent -= 64;
|
exponent -= 64;
|
||||||
|
|
||||||
|
|
@ -489,10 +489,10 @@ calmaReadR8(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaSkipSet(
|
calmaSkipSet(skipwhat)
|
||||||
const int *skipwhat)
|
int *skipwhat;
|
||||||
{
|
{
|
||||||
const int *skipp;
|
int *skipp;
|
||||||
int nbytes, rtype;
|
int nbytes, rtype;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
|
|
@ -533,8 +533,8 @@ skipit:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaSkipExact(
|
calmaSkipExact(type)
|
||||||
int type)
|
int type;
|
||||||
{
|
{
|
||||||
int nbytes, rtype;
|
int nbytes, rtype;
|
||||||
|
|
||||||
|
|
@ -579,8 +579,8 @@ eof:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaSkipTo(
|
calmaSkipTo(what)
|
||||||
int what)
|
int what;
|
||||||
{
|
{
|
||||||
int nbytes, rtype;
|
int nbytes, rtype;
|
||||||
|
|
||||||
|
|
@ -615,8 +615,8 @@ calmaSkipTo(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaSkipBytes(
|
calmaSkipBytes(nbytes)
|
||||||
int nbytes) /* Skip this many bytes */
|
int nbytes; /* Skip this many bytes */
|
||||||
{
|
{
|
||||||
while (nbytes-- > 0)
|
while (nbytes-- > 0)
|
||||||
if (FGETC(calmaInputFile) < 0)
|
if (FGETC(calmaInputFile) < 0)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRdpt.c,v 1.7 2010/08/25 17:33:54 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRdpt.c,v 1.7 2010/08/25 17:33:54 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -57,8 +57,8 @@ extern int CalmaPolygonCount;
|
||||||
extern int CalmaPathCount;
|
extern int CalmaPathCount;
|
||||||
extern HashTable calmaDefInitHash;
|
extern HashTable calmaDefInitHash;
|
||||||
|
|
||||||
extern void calmaLayerError(char *mesg, int layer, int dt);
|
extern void calmaLayerError();
|
||||||
CIFPath *calmaReadPath(int iscale);
|
bool calmaReadPath();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
|
|
@ -82,9 +82,8 @@ CIFPath *calmaReadPath(int iscale);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaInputRescale(
|
calmaInputRescale(n, d)
|
||||||
int n,
|
int n, d;
|
||||||
int d)
|
|
||||||
{
|
{
|
||||||
HashEntry *h;
|
HashEntry *h;
|
||||||
HashSearch hs;
|
HashSearch hs;
|
||||||
|
|
@ -114,8 +113,6 @@ calmaInputRescale(
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* calmaReadX ---
|
|
||||||
* calmaReadY ---
|
|
||||||
* calmaReadPoint ---
|
* calmaReadPoint ---
|
||||||
*
|
*
|
||||||
* Read a point from the input.
|
* Read a point from the input.
|
||||||
|
|
@ -134,19 +131,13 @@ calmaInputRescale(
|
||||||
* encountered, then everything in the GDS planes is rescaled
|
* encountered, then everything in the GDS planes is rescaled
|
||||||
* to match.
|
* to match.
|
||||||
*
|
*
|
||||||
* Notes:
|
|
||||||
* This routine has been split into individual X and Y reads so that
|
|
||||||
* array data can be read while ignoring offset information when there
|
|
||||||
* is only one row or column; otherwise, bad or uninitialized data
|
|
||||||
* in the record can cause unnecessary and incorrect scaling.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaReadX(
|
calmaReadPoint(p, iscale)
|
||||||
Point *p,
|
Point *p;
|
||||||
int iscale)
|
int iscale;
|
||||||
{
|
{
|
||||||
int rescale;
|
int rescale;
|
||||||
|
|
||||||
|
|
@ -171,15 +162,6 @@ calmaReadX(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p->p_x /= calmaReadScale2;
|
p->p_x /= calmaReadScale2;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
calmaReadY(
|
|
||||||
Point *p,
|
|
||||||
int iscale)
|
|
||||||
{
|
|
||||||
int rescale;
|
|
||||||
|
|
||||||
READI4((p)->p_y);
|
READI4((p)->p_y);
|
||||||
p->p_y *= (calmaReadScale1 * iscale);
|
p->p_y *= (calmaReadScale1 * iscale);
|
||||||
|
|
@ -205,15 +187,6 @@ calmaReadY(
|
||||||
p->p_y /= calmaReadScale2;
|
p->p_y /= calmaReadScale2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
calmaReadPoint(
|
|
||||||
Point *p,
|
|
||||||
int iscale)
|
|
||||||
{
|
|
||||||
calmaReadX(p, iscale);
|
|
||||||
calmaReadY(p, iscale);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
|
|
@ -232,14 +205,14 @@ calmaReadPoint(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaElementBoundary(void)
|
calmaElementBoundary()
|
||||||
{
|
{
|
||||||
int dt, layer, ciftype;
|
int dt, layer, ciftype;
|
||||||
CIFPath *pathheadp;
|
CIFPath *pathheadp;
|
||||||
LinkedRect *rp;
|
LinkedRect *rp;
|
||||||
Plane *plane;
|
Plane *plane;
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
CellDef *savedef = NULL, *newdef = NULL;
|
CellDef *savedef, *newdef = NULL;
|
||||||
|
|
||||||
/* Skip CALMA_ELFLAGS, CALMA_PLEX */
|
/* Skip CALMA_ELFLAGS, CALMA_PLEX */
|
||||||
calmaSkipSet(calmaElementIgnore);
|
calmaSkipSet(calmaElementIgnore);
|
||||||
|
|
@ -263,8 +236,7 @@ calmaElementBoundary(void)
|
||||||
plane = cifCurReadPlanes[ciftype];
|
plane = cifCurReadPlanes[ciftype];
|
||||||
|
|
||||||
/* Read the path itself, building up a path structure */
|
/* Read the path itself, building up a path structure */
|
||||||
pathheadp = calmaReadPath((plane == NULL) ? 0 : 1);
|
if (!calmaReadPath(&pathheadp, (plane == NULL) ? 0 : 1))
|
||||||
if (pathheadp == NULL)
|
|
||||||
{
|
{
|
||||||
if (plane != NULL)
|
if (plane != NULL)
|
||||||
CalmaReadError("Error while reading path for boundary/box; ignored.\n");
|
CalmaReadError("Error while reading path for boundary/box; ignored.\n");
|
||||||
|
|
@ -284,18 +256,18 @@ calmaElementBoundary(void)
|
||||||
if ((CalmaSubcellPolygons != CALMA_POLYGON_NONE) && (calmaNonManhattan > 0))
|
if ((CalmaSubcellPolygons != CALMA_POLYGON_NONE) && (calmaNonManhattan > 0))
|
||||||
{
|
{
|
||||||
/* Place the polygon in its own subcell */
|
/* Place the polygon in its own subcell */
|
||||||
char newname[20];
|
char newname[] = "polygonXXXXX";
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
|
|
||||||
savedef = cifReadCellDef;
|
savedef = cifReadCellDef;
|
||||||
|
|
||||||
/* Make up name for cell */
|
/* Make up name for cell */
|
||||||
snprintf(newname, sizeof(newname), "polygon%05d", ++CalmaPolygonCount);
|
sprintf(newname + 7, "%05d", ++CalmaPolygonCount);
|
||||||
|
|
||||||
he = HashFind(&calmaDefInitHash, newname);
|
he = HashFind(&calmaDefInitHash, newname);
|
||||||
if (!HashGetValue(he))
|
if (!HashGetValue(he))
|
||||||
{
|
{
|
||||||
newdef = calmaFindCell(newname, NULL, NULL);
|
newdef = calmaFindCell(newname, NULL);
|
||||||
cifReadCellDef = newdef;
|
cifReadCellDef = newdef;
|
||||||
DBCellClearDef(cifReadCellDef);
|
DBCellClearDef(cifReadCellDef);
|
||||||
DBCellSetAvail(cifReadCellDef);
|
DBCellSetAvail(cifReadCellDef);
|
||||||
|
|
@ -386,14 +358,12 @@ calmaElementBoundary(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Paint the rectangles (if any) */
|
/* Paint the rectangles (if any) */
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (; rp != NULL ; rp = rp->r_next)
|
for (; rp != NULL ; rp = rp->r_next)
|
||||||
{
|
{
|
||||||
if (plane)
|
if (plane)
|
||||||
DBPaintPlane(plane, &rp->r_r, CIFPaintTable, (PaintUndoInfo *)NULL);
|
DBPaintPlane(plane, &rp->r_r, CIFPaintTable, (PaintUndoInfo *)NULL);
|
||||||
freeMagic1(&mm1, (char *) rp);
|
freeMagic((char *) rp);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
|
|
||||||
if (cifCurReadPlanes == cifEditCellPlanes)
|
if (cifCurReadPlanes == cifEditCellPlanes)
|
||||||
{
|
{
|
||||||
|
|
@ -436,7 +406,7 @@ calmaElementBoundary(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaElementBox(void)
|
calmaElementBox()
|
||||||
{
|
{
|
||||||
int nbytes, rtype, npoints, savescale;
|
int nbytes, rtype, npoints, savescale;
|
||||||
int dt, layer, ciftype;
|
int dt, layer, ciftype;
|
||||||
|
|
@ -531,16 +501,17 @@ calmaElementBox(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaElementPath(void)
|
calmaElementPath()
|
||||||
{
|
{
|
||||||
int nbytes = -1, rtype = 0, extend1, extend2;
|
int nbytes, rtype, extend1, extend2;
|
||||||
int layer, dt, width, pathtype, ciftype, savescale;
|
int layer, dt, width, pathtype, ciftype, savescale;
|
||||||
int xmin, ymin, xmax, ymax, temp;
|
int xmin, ymin, xmax, ymax, temp;
|
||||||
CIFPath *pathheadp, *pathp, *previousp;
|
CIFPath *pathheadp, *pathp, *previousp;
|
||||||
|
Rect segment;
|
||||||
Plane *plane;
|
Plane *plane;
|
||||||
int first,last;
|
int first,last;
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
CellDef *savedef = NULL, *newdef = NULL;
|
CellDef *savedef, *newdef = NULL;
|
||||||
|
|
||||||
/* Skip CALMA_ELFLAGS, CALMA_PLEX */
|
/* Skip CALMA_ELFLAGS, CALMA_PLEX */
|
||||||
calmaSkipSet(calmaElementIgnore);
|
calmaSkipSet(calmaElementIgnore);
|
||||||
|
|
@ -623,8 +594,7 @@ calmaElementPath(void)
|
||||||
|
|
||||||
/* Read the points in the path */
|
/* Read the points in the path */
|
||||||
savescale = calmaReadScale1;
|
savescale = calmaReadScale1;
|
||||||
pathheadp = calmaReadPath(2);
|
if (!calmaReadPath(&pathheadp, 2))
|
||||||
if (pathheadp == NULL)
|
|
||||||
{
|
{
|
||||||
CalmaReadError("Improper path; ignored.\n");
|
CalmaReadError("Improper path; ignored.\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -692,18 +662,18 @@ calmaElementPath(void)
|
||||||
if (CalmaSubcellPaths)
|
if (CalmaSubcellPaths)
|
||||||
{
|
{
|
||||||
/* Place the path in its own subcell */
|
/* Place the path in its own subcell */
|
||||||
char newname[16];
|
char newname[] = "pathXXXXX";
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
|
|
||||||
savedef = cifReadCellDef;
|
savedef = cifReadCellDef;
|
||||||
|
|
||||||
/* Make up name for cell */
|
/* Make up name for cell */
|
||||||
snprintf(newname, sizeof(newname), "path%05d", ++CalmaPathCount);
|
sprintf(newname + 4, "%05d", ++CalmaPathCount);
|
||||||
|
|
||||||
he = HashFind(&calmaDefInitHash, newname);
|
he = HashFind(&calmaDefInitHash, newname);
|
||||||
if (!HashGetValue(he))
|
if (!HashGetValue(he))
|
||||||
{
|
{
|
||||||
newdef = calmaFindCell(newname, NULL, NULL);
|
newdef = calmaFindCell(newname, NULL);
|
||||||
cifReadCellDef = newdef;
|
cifReadCellDef = newdef;
|
||||||
DBCellClearDef(cifReadCellDef);
|
DBCellClearDef(cifReadCellDef);
|
||||||
DBCellSetAvail(cifReadCellDef);
|
DBCellSetAvail(cifReadCellDef);
|
||||||
|
|
@ -717,12 +687,7 @@ calmaElementPath(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If requested by command option, record the path centerline as a
|
CIFPropRecordPath(cifReadCellDef, pathheadp, TRUE, "path");
|
||||||
* property of the cell def.
|
|
||||||
*/
|
|
||||||
if (CalmaRecordPaths)
|
|
||||||
CIFPropRecordPath(cifReadCellDef, pathheadp, TRUE, "path");
|
|
||||||
|
|
||||||
CIFPaintWirePath(pathheadp, width,
|
CIFPaintWirePath(pathheadp, width,
|
||||||
(pathtype == CALMAPATH_SQUAREFLUSH || pathtype == CALMAPATH_CUSTOM) ?
|
(pathtype == CALMAPATH_SQUAREFLUSH || pathtype == CALMAPATH_CUSTOM) ?
|
||||||
FALSE : TRUE, plane, CIFPaintTable, (PaintUndoInfo *)NULL);
|
FALSE : TRUE, plane, CIFPaintTable, (PaintUndoInfo *)NULL);
|
||||||
|
|
@ -764,11 +729,11 @@ calmaElementPath(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaElementText(void)
|
calmaElementText()
|
||||||
{
|
{
|
||||||
static const int ignore[] = { CALMA_PATHTYPE, CALMA_WIDTH, -1 };
|
static int ignore[] = { CALMA_PATHTYPE, CALMA_WIDTH, -1 };
|
||||||
char *textbody = NULL;
|
char *textbody = NULL;
|
||||||
int nbytes = -1, rtype = 0;
|
int nbytes, rtype;
|
||||||
int layer, textt, cifnum, textpres;
|
int layer, textt, cifnum, textpres;
|
||||||
TileType type;
|
TileType type;
|
||||||
Rect r;
|
Rect r;
|
||||||
|
|
@ -1132,24 +1097,26 @@ calmaElementText(void)
|
||||||
* centerline, to avoid roundoff errors.
|
* centerline, to avoid roundoff errors.
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* non-NULL CIFPath* the caller takes ownership of
|
* TRUE is returned if the path was parsed successfully,
|
||||||
* if the path was parsed successfully, otherwise NULL.
|
* FALSE otherwise.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* None
|
* Modifies the parameter pathheadpp to point to the path
|
||||||
|
* that is constructed.
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CIFPath *
|
bool
|
||||||
calmaReadPath(
|
calmaReadPath(pathheadpp, iscale)
|
||||||
int iscale)
|
CIFPath **pathheadpp;
|
||||||
|
int iscale;
|
||||||
{
|
{
|
||||||
CIFPath path, *pathheadp, *pathtailp, *newpathp;
|
CIFPath path, *pathtailp, *newpathp;
|
||||||
int nbytes, rtype, npoints, savescale;
|
int nbytes, rtype, npoints, savescale;
|
||||||
bool nonManhattan = FALSE;
|
bool nonManhattan = FALSE;
|
||||||
|
|
||||||
pathheadp = (CIFPath *) NULL;
|
*pathheadpp = (CIFPath *) NULL;
|
||||||
pathtailp = (CIFPath *) NULL;
|
pathtailp = (CIFPath *) NULL;
|
||||||
path.cifp_next = (CIFPath *) NULL;
|
path.cifp_next = (CIFPath *) NULL;
|
||||||
|
|
||||||
|
|
@ -1158,12 +1125,12 @@ calmaReadPath(
|
||||||
if (nbytes < 0)
|
if (nbytes < 0)
|
||||||
{
|
{
|
||||||
CalmaReadError("EOF when reading path.\n");
|
CalmaReadError("EOF when reading path.\n");
|
||||||
return (NULL);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
if (rtype != CALMA_XY)
|
if (rtype != CALMA_XY)
|
||||||
{
|
{
|
||||||
calmaUnexpected(CALMA_XY, rtype);
|
calmaUnexpected(CALMA_XY, rtype);
|
||||||
return (NULL);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read this many points (pairs of four-byte integers) */
|
/* Read this many points (pairs of four-byte integers) */
|
||||||
|
|
@ -1174,7 +1141,7 @@ calmaReadPath(
|
||||||
calmaReadPoint(&path.cifp_point, iscale);
|
calmaReadPoint(&path.cifp_point, iscale);
|
||||||
if (savescale != calmaReadScale1)
|
if (savescale != calmaReadScale1)
|
||||||
{
|
{
|
||||||
CIFPath *phead = pathheadp;
|
CIFPath *phead = *pathheadpp;
|
||||||
int newscale = calmaReadScale1 / savescale;
|
int newscale = calmaReadScale1 / savescale;
|
||||||
while (phead != NULL)
|
while (phead != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -1189,8 +1156,8 @@ calmaReadPath(
|
||||||
}
|
}
|
||||||
if (FEOF(calmaInputFile))
|
if (FEOF(calmaInputFile))
|
||||||
{
|
{
|
||||||
CIFFreePath(pathheadp);
|
CIFFreePath(*pathheadpp);
|
||||||
return (NULL);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iscale != 0)
|
if (iscale != 0)
|
||||||
|
|
@ -1198,7 +1165,7 @@ calmaReadPath(
|
||||||
newpathp = (CIFPath *) mallocMagic((unsigned) (sizeof (CIFPath)));
|
newpathp = (CIFPath *) mallocMagic((unsigned) (sizeof (CIFPath)));
|
||||||
*newpathp = path;
|
*newpathp = path;
|
||||||
|
|
||||||
if (pathheadp)
|
if (*pathheadpp)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Check that this segment is Manhattan. If not, remember the
|
* Check that this segment is Manhattan. If not, remember the
|
||||||
|
|
@ -1219,11 +1186,11 @@ calmaReadPath(
|
||||||
}
|
}
|
||||||
pathtailp->cifp_next = newpathp;
|
pathtailp->cifp_next = newpathp;
|
||||||
}
|
}
|
||||||
else pathheadp = newpathp;
|
else *pathheadpp = newpathp;
|
||||||
pathtailp = newpathp;
|
pathtailp = newpathp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (pathheadp);
|
return (*pathheadpp != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1248,10 +1215,10 @@ calmaReadPath(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaLayerError(
|
calmaLayerError(mesg, layer, dt)
|
||||||
char *mesg,
|
char *mesg;
|
||||||
int layer,
|
int layer;
|
||||||
int dt)
|
int dt;
|
||||||
{
|
{
|
||||||
CalmaLayerType clt;
|
CalmaLayerType clt;
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRead.c,v 1.3 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/calma/CalmaRead.c,v 1.3 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
@ -111,8 +111,8 @@ bool CalmaUnique = FALSE; /* If TRUE, then if a cell exists in
|
||||||
*/
|
*/
|
||||||
extern bool CalmaDoLibrary; /* Also used by GDS write */
|
extern bool CalmaDoLibrary; /* Also used by GDS write */
|
||||||
|
|
||||||
extern void calmaUnexpected(int wanted, int got);
|
extern void calmaUnexpected();
|
||||||
extern int calmaWriteInitFunc(CellDef *def, ClientData cdata); /* UNUSED */
|
extern int calmaWriteInitFunc();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scaling.
|
* Scaling.
|
||||||
|
|
@ -147,7 +147,7 @@ HashTable calmaLayerHash;
|
||||||
HashTable calmaDefInitHash;
|
HashTable calmaDefInitHash;
|
||||||
|
|
||||||
/* Common stuff to ignore */
|
/* Common stuff to ignore */
|
||||||
const int calmaElementIgnore[] = { CALMA_ELFLAGS, CALMA_PLEX, -1 };
|
int calmaElementIgnore[] = { CALMA_ELFLAGS, CALMA_PLEX, -1 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
|
|
@ -167,18 +167,18 @@ const int calmaElementIgnore[] = { CALMA_ELFLAGS, CALMA_PLEX, -1 };
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CalmaReadFile(
|
CalmaReadFile(file, filename)
|
||||||
FILETYPE file, /* File from which to read Calma */
|
FILETYPE file; /* File from which to read Calma */
|
||||||
char *filename) /* The real name of the file read */
|
char *filename; /* The real name of the file read */
|
||||||
{
|
{
|
||||||
int k, version;
|
int k, version;
|
||||||
char *libname = NULL, *libnameptr = NULL;
|
char *libname = NULL, *libnameptr;
|
||||||
MagWindow *mw;
|
MagWindow *mw;
|
||||||
static const int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS,
|
static int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS,
|
||||||
CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE,
|
CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE,
|
||||||
CALMA_STYPTABLE, CALMA_GENERATIONS, -1 };
|
CALMA_STYPTABLE, CALMA_GENERATIONS, -1 };
|
||||||
static const int skipBeforeLib[] = { CALMA_LIBDIRSIZE, CALMA_SRFNAME,
|
static int skipBeforeLib[] = { CALMA_LIBDIRSIZE, CALMA_SRFNAME,
|
||||||
CALMA_LIBSECUR, -1 };
|
CALMA_LIBSECUR, -1 };
|
||||||
|
|
||||||
if (EditCellUse == (CellUse *)NULL)
|
if (EditCellUse == (CellUse *)NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -299,7 +299,7 @@ done:
|
||||||
windCheckOnlyWindow(&mw, DBWclientID);
|
windCheckOnlyWindow(&mw, DBWclientID);
|
||||||
if (mw != NULL)
|
if (mw != NULL)
|
||||||
{
|
{
|
||||||
if (calmaLookCell(libnameptr) != (CellDef *)NULL)
|
if (calmaLookCell(libnameptr, NULL) != (CellDef *)NULL)
|
||||||
DBWloadWindow(mw, libnameptr, 0);
|
DBWloadWindow(mw, libnameptr, 0);
|
||||||
}
|
}
|
||||||
freeMagic(libname);
|
freeMagic(libname);
|
||||||
|
|
@ -309,11 +309,7 @@ done:
|
||||||
HashKill(&calmaDefInitHash);
|
HashKill(&calmaDefInitHash);
|
||||||
UndoEnable();
|
UndoEnable();
|
||||||
|
|
||||||
if (calmaErrorFile != NULL)
|
if (calmaErrorFile != NULL) fclose(calmaErrorFile);
|
||||||
{
|
|
||||||
fclose(calmaErrorFile);
|
|
||||||
calmaErrorFile = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -347,9 +343,9 @@ done:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaParseUnits(void)
|
calmaParseUnits()
|
||||||
{
|
{
|
||||||
int nbytes, rtype = 0;
|
int nbytes, rtype;
|
||||||
double metersPerDBUnit;
|
double metersPerDBUnit;
|
||||||
double userUnitsPerDBUnit;
|
double userUnitsPerDBUnit;
|
||||||
double cuPerDBUnit;
|
double cuPerDBUnit;
|
||||||
|
|
@ -458,8 +454,7 @@ calmaParseUnits(void)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void CalmaReadError(char *format, ...)
|
||||||
CalmaReadError(const char *format, ...)
|
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
OFFTYPE filepos;
|
OFFTYPE filepos;
|
||||||
|
|
@ -516,9 +511,9 @@ CalmaReadError(const char *format, ...)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaUnexpected(
|
calmaUnexpected(wanted, got)
|
||||||
int wanted, /* Type of record we wanted */
|
int wanted; /* Type of record we wanted */
|
||||||
int got) /* Type of record we got */
|
int got; /* Type of record we got */
|
||||||
{
|
{
|
||||||
CalmaReadError("Unexpected record type in input: \n");
|
CalmaReadError("Unexpected record type in input: \n");
|
||||||
|
|
||||||
|
|
@ -558,12 +553,12 @@ calmaUnexpected(
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char *
|
char *
|
||||||
calmaRecordName(
|
calmaRecordName(rtype)
|
||||||
int rtype)
|
int rtype;
|
||||||
{
|
{
|
||||||
static char numeric[10];
|
static char numeric[10];
|
||||||
static const char * const calmaRecordNames[] =
|
static char *calmaRecordNames[] =
|
||||||
{
|
{
|
||||||
"HEADER", "BGNLIB", "LIBNAME", "UNITS",
|
"HEADER", "BGNLIB", "LIBNAME", "UNITS",
|
||||||
"ENDLIB", "BGNSTR", "STRNAME", "ENDSTR",
|
"ENDLIB", "BGNSTR", "STRNAME", "ENDSTR",
|
||||||
|
|
@ -608,28 +603,25 @@ calmaRecordName(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CalmaTechInit(void)
|
CalmaTechInit()
|
||||||
{
|
{
|
||||||
ASSERT(sizeof(FourByteInt)==4, "definition in calmaInt.h");
|
ASSERT(sizeof(FourByteInt)==4, "definition in calmaInt.h");
|
||||||
ASSERT(sizeof(TwoByteInt)==2, "definition in calmaInt.h");
|
ASSERT(sizeof(TwoByteInt)==2, "definition in calmaInt.h");
|
||||||
|
|
||||||
/* NOTE: Add "$$*$$" to the default "flatglob" value */
|
/* NOTE: Enable the code below when CalmaContactArrays */
|
||||||
/* when CalmaContactArrays behaves like the non-arrayed */
|
/* behaves like the non-arrayed function and can be enabled */
|
||||||
/* function and can be enabled by default. */
|
/* by default. */
|
||||||
|
#if 0
|
||||||
/* Initialize CalmaFlattenByName to have one entry for */
|
/* Initialize CalmaFlattenByName to have one entry for */
|
||||||
/* "*_CDNS_*" to match the name style used by many foundry */
|
/* "$$*$$" to match the name style used by the contact */
|
||||||
/* cells and which corresponds to pcells that often split */
|
/* array cell generation. This can be overridden by the */
|
||||||
/* layers between cells in ways that magic can't cope with; */
|
/* "gds flatglob none" command option. */
|
||||||
/* and whose original parameterized functions cannot be */
|
|
||||||
/* recovered by magic anyway. When necessary, this default */
|
|
||||||
/* can be overridden by the "gds flatglob none" command */
|
|
||||||
/* option. */
|
|
||||||
|
|
||||||
if (CalmaFlattenUsesByName == (char **)NULL)
|
if (CalmaFlattenUsesByName == (char **)NULL)
|
||||||
{
|
{
|
||||||
CalmaFlattenUsesByName = (char **)mallocMagic(2 * sizeof(char *));
|
CalmaFlattenUsesByName = (char **)mallocMagic(2 * sizeof(char *));
|
||||||
*CalmaFlattenUsesByName = StrDup((char **)NULL, "*_CDNS_*");
|
*CalmaFlattenUsesByName = StrDup((char **)NULL, "$$*$$");
|
||||||
*(CalmaFlattenUsesByName + 1) = NULL;
|
*(CalmaFlattenUsesByName + 1) = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,26 +17,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/calma/CalmaWrite.c,v 1.8 2010/12/22 16:29:06 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/calma/CalmaWrite.c,v 1.8 2010/12/22 16:29:06 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h> /* for random() */
|
#include <stdlib.h> /* for random() */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <arpa/inet.h> /* for htons() */
|
#include <arpa/inet.h> /* for htons() */
|
||||||
#ifdef TIME_WITH_SYS_TIME
|
#if defined(SYSV) || defined(EMSCRIPTEN)
|
||||||
# include <sys/time.h>
|
#include <time.h>
|
||||||
# include <time.h>
|
|
||||||
#else
|
#else
|
||||||
# ifdef HAVE_SYS_TIME_H
|
#include <sys/time.h>
|
||||||
# include <sys/time.h>
|
|
||||||
# else
|
|
||||||
# include <time.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utils/magic.h"
|
#include "utils/magic.h"
|
||||||
|
|
@ -44,7 +38,6 @@ static const char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic
|
||||||
#include "utils/geometry.h"
|
#include "utils/geometry.h"
|
||||||
#include "tiles/tile.h"
|
#include "tiles/tile.h"
|
||||||
#include "utils/utils.h"
|
#include "utils/utils.h"
|
||||||
#include "utils/magic_zlib.h"
|
|
||||||
#include "utils/hash.h"
|
#include "utils/hash.h"
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
#include "database/databaseInt.h"
|
#include "database/databaseInt.h"
|
||||||
|
|
@ -87,34 +80,36 @@ bool CalmaMergeTiles = FALSE; /* If TRUE, merge tiles into polygons in output.
|
||||||
int CalmaCompression = 0; /* Output file compression level (0 = uncompressed) */
|
int CalmaCompression = 0; /* Output file compression level (0 = uncompressed) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Forward declarations */
|
||||||
|
extern int calmaWriteInitFunc();
|
||||||
|
extern int calmaWriteMarkFunc();
|
||||||
|
extern int calmaWritePaintFunc();
|
||||||
|
extern int calmaMergePaintFunc();
|
||||||
|
extern int calmaWriteUseFunc();
|
||||||
|
extern int calmaPaintLabelFunc();
|
||||||
|
extern void calmaWriteContacts();
|
||||||
|
extern void calmaDelContacts();
|
||||||
|
extern void calmaOutFunc();
|
||||||
|
extern void calmaOutStructName();
|
||||||
|
extern void calmaWriteLabelFunc();
|
||||||
|
extern void calmaOutHeader();
|
||||||
|
extern void calmaOutDate();
|
||||||
|
extern void calmaOutStringRecord();
|
||||||
|
extern void calmaOut8();
|
||||||
|
extern void calmaOutR8();
|
||||||
|
extern void calmaProcessBoundary();
|
||||||
|
extern void calmaMergeBoundaries();
|
||||||
|
extern void calmaRemoveColinear();
|
||||||
|
extern void calmaRemoveDegenerate();
|
||||||
|
|
||||||
/* Structure used by calmaWritePaintFunc() */
|
/* Structure used by calmaWritePaintFunc() */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FILE *f; /* File stream for output */
|
FILE *f; /* File stream for output */
|
||||||
const Rect *area; /* Clipping area, in GDS coordinates */
|
Rect *area; /* Clipping area, in GDS coordinates */
|
||||||
int type; /* Layer index */
|
int type; /* Layer index */
|
||||||
} calmaOutputStruct;
|
} calmaOutputStruct;
|
||||||
|
|
||||||
/* Forward declarations */
|
|
||||||
extern int calmaWriteInitFunc(CellDef *def, ClientData cdata); /* UNUSED */
|
|
||||||
extern int calmaWritePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos);
|
|
||||||
extern int calmaMergePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos);
|
|
||||||
extern int calmaWriteUseFunc(CellUse *use, FILE *f);
|
|
||||||
extern int calmaPaintLabelFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos);
|
|
||||||
extern void calmaWriteContacts(FILE *f);
|
|
||||||
extern void calmaDelContacts(void);
|
|
||||||
extern void calmaOutFunc(CellDef *def, FILE *f, const Rect *cliprect);
|
|
||||||
extern void calmaOutStructName(int type, CellDef *def, FILE *f);
|
|
||||||
extern void calmaWriteLabelFunc(Label *lab, int ltype, int type, FILE *f);
|
|
||||||
extern void calmaOutHeader(CellDef *rootDef, FILE *f);
|
|
||||||
extern void calmaOutDate(time_t t, FILE *f);
|
|
||||||
extern void calmaOutStringRecord(int type, char *str, FILE *f);
|
|
||||||
extern void calmaOut8(const char *str, FILE *f);
|
|
||||||
extern void calmaOutR8(double d, FILE *f);
|
|
||||||
extern void calmaProcessBoundary(BoundaryTop *blist, calmaOutputStruct *cos);
|
|
||||||
extern void calmaRemoveColinear(BoundaryTop *blist);
|
|
||||||
extern void calmaRemoveDegenerate(BoundaryTop *blist);
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
/* Structures used by the tile merging algorithm */
|
/* Structures used by the tile merging algorithm */
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
|
|
@ -124,11 +119,27 @@ extern void calmaRemoveDegenerate(BoundaryTop *blist);
|
||||||
#define GDS_PROCESSED 1
|
#define GDS_PROCESSED 1
|
||||||
|
|
||||||
#define PUSHTILEC(tp) \
|
#define PUSHTILEC(tp) \
|
||||||
if (TiGetClient(tp) == GDS_UNPROCESSED) { \
|
if ((tp)->ti_client == (ClientData) GDS_UNPROCESSED) { \
|
||||||
TiSetClientINT(tp, GDS_PENDING); \
|
(tp)->ti_client = (ClientData) GDS_PENDING; \
|
||||||
STACKPUSH((ClientData) (tp), SegStack); \
|
STACKPUSH((ClientData) (tp), SegStack); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define LB_EXTERNAL 0 /* Polygon external edge */
|
||||||
|
#define LB_INTERNAL 1 /* Polygon internal edge */
|
||||||
|
#define LB_INIT 2 /* Data not yet valid */
|
||||||
|
|
||||||
|
typedef struct LB1 {
|
||||||
|
char lb_type; /* Boundary Type (external or internal) */
|
||||||
|
Point lb_start; /* Start point */
|
||||||
|
struct LB1 *lb_next; /* Next point record */
|
||||||
|
} LinkedBoundary;
|
||||||
|
|
||||||
|
typedef struct BT1 {
|
||||||
|
LinkedBoundary *bt_first; /* Polygon list */
|
||||||
|
int bt_points; /* Number of points in this list */
|
||||||
|
struct BT1 *bt_next; /* Next polygon record */
|
||||||
|
} BoundaryTop;
|
||||||
|
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Number assigned to each cell */
|
/* Number assigned to each cell */
|
||||||
|
|
@ -154,6 +165,9 @@ HashTable calmaLibHash;
|
||||||
HashTable calmaPrefixHash;
|
HashTable calmaPrefixHash;
|
||||||
HashTable calmaUndefHash;
|
HashTable calmaUndefHash;
|
||||||
|
|
||||||
|
/* Imports */
|
||||||
|
extern time_t time();
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -206,7 +220,7 @@ HashTable calmaUndefHash;
|
||||||
(void) putc(u.u_c[3], f); \
|
(void) putc(u.u_c[3], f); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char calmaMapTableStrict[] =
|
static char calmaMapTableStrict[] =
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* NUL - BEL */
|
0, 0, 0, 0, 0, 0, 0, 0, /* NUL - BEL */
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* BS - SI */
|
0, 0, 0, 0, 0, 0, 0, 0, /* BS - SI */
|
||||||
|
|
@ -226,7 +240,7 @@ static const char calmaMapTableStrict[] =
|
||||||
'x', 'y', 'z', '_', '_', '_', '_', 0, /* x - DEL */
|
'x', 'y', 'z', '_', '_', '_', '_', 0, /* x - DEL */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char calmaMapTablePermissive[] =
|
static char calmaMapTablePermissive[] =
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* NUL - BEL */
|
0, 0, 0, 0, 0, 0, 0, 0, /* NUL - BEL */
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* BS - SI */
|
0, 0, 0, 0, 0, 0, 0, 0, /* BS - SI */
|
||||||
|
|
@ -282,13 +296,12 @@ static const char calmaMapTablePermissive[] =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CalmaWrite(
|
CalmaWrite(rootDef, f)
|
||||||
CellDef *rootDef, /* Pointer to CellDef to be written */
|
CellDef *rootDef; /* Pointer to CellDef to be written */
|
||||||
FILE *f) /* Open output file */
|
FILE *f; /* Open output file */
|
||||||
{
|
{
|
||||||
int oldCount = DBWFeedbackCount, problems, nerr;
|
int oldCount = DBWFeedbackCount, problems, nerr;
|
||||||
bool good;
|
bool good;
|
||||||
CellDef *err_def;
|
|
||||||
CellUse dummy;
|
CellUse dummy;
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
HashSearch hs;
|
HashSearch hs;
|
||||||
|
|
@ -314,11 +327,9 @@ CalmaWrite(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dummy.cu_def = rootDef;
|
dummy.cu_def = rootDef;
|
||||||
err_def = DBCellReadArea(&dummy, &rootDef->cd_bbox, !CalmaAllowUndefined);
|
if (DBCellReadArea(&dummy, &rootDef->cd_bbox, !CalmaAllowUndefined))
|
||||||
if (err_def != NULL)
|
|
||||||
{
|
{
|
||||||
TxError("Failure to read entire subtree of the cell.\n");
|
TxError("Failure to read entire subtree of the cell.\n");
|
||||||
TxError("Failed on cell %s.\n", err_def->cd_name);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -379,7 +390,7 @@ CalmaWrite(
|
||||||
good = !ferror(f);
|
good = !ferror(f);
|
||||||
|
|
||||||
/* See if any problems occurred */
|
/* See if any problems occurred */
|
||||||
if ((problems = (DBWFeedbackCount - oldCount)))
|
if (problems = (DBWFeedbackCount - oldCount))
|
||||||
TxPrintf("%d problems occurred. See feedback entries.\n", problems);
|
TxPrintf("%d problems occurred. See feedback entries.\n", problems);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -409,13 +420,13 @@ CalmaWrite(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaDumpStructure(
|
calmaDumpStructure(def, outf, calmaDefHash, filename)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
FILE *outf,
|
FILE *outf;
|
||||||
HashTable *calmaDefHash,
|
HashTable *calmaDefHash;
|
||||||
char *filename)
|
char *filename;
|
||||||
{
|
{
|
||||||
int nbytes = -1, rtype = 0;
|
int nbytes, rtype;
|
||||||
char *strname = NULL, *newnameptr;
|
char *strname = NULL, *newnameptr;
|
||||||
HashEntry *he, *he2;
|
HashEntry *he, *he2;
|
||||||
CellDef *edef;
|
CellDef *edef;
|
||||||
|
|
@ -528,7 +539,7 @@ calmaDumpStructure(
|
||||||
|
|
||||||
/* Is view abstract? */
|
/* Is view abstract? */
|
||||||
DBPropGet(edef, "LEFview", &isAbstract);
|
DBPropGet(edef, "LEFview", &isAbstract);
|
||||||
chklibname = DBPropGetString(edef, "GDS_FILE", &isReadOnly);
|
chklibname = (char *)DBPropGet(edef, "GDS_FILE", &isReadOnly);
|
||||||
|
|
||||||
if (isAbstract && isReadOnly)
|
if (isAbstract && isReadOnly)
|
||||||
{
|
{
|
||||||
|
|
@ -679,11 +690,11 @@ syntaxerror:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaFullDump(
|
calmaFullDump(def, fi, outf, filename)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
FILETYPE fi,
|
FILETYPE fi;
|
||||||
FILE *outf,
|
FILE *outf;
|
||||||
char *filename)
|
char *filename;
|
||||||
{
|
{
|
||||||
int version, rval;
|
int version, rval;
|
||||||
char *libname = NULL, *testlib, uniqlibname[4];
|
char *libname = NULL, *testlib, uniqlibname[4];
|
||||||
|
|
@ -693,10 +704,10 @@ calmaFullDump(
|
||||||
HashSearch hs;
|
HashSearch hs;
|
||||||
HashEntry *he, *he2;
|
HashEntry *he, *he2;
|
||||||
|
|
||||||
static const int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS,
|
static int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS,
|
||||||
CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE,
|
CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE,
|
||||||
CALMA_STYPTABLE, CALMA_GENERATIONS, -1 };
|
CALMA_STYPTABLE, CALMA_GENERATIONS, -1 };
|
||||||
static const int skipBeforeLib[] = { CALMA_LIBDIRSIZE, CALMA_SRFNAME,
|
static int skipBeforeLib[] = { CALMA_LIBDIRSIZE, CALMA_SRFNAME,
|
||||||
CALMA_LIBSECUR, -1 };
|
CALMA_LIBSECUR, -1 };
|
||||||
|
|
||||||
HashInit(&calmaDefHash, 32, 0);
|
HashInit(&calmaDefHash, 32, 0);
|
||||||
|
|
@ -738,7 +749,7 @@ calmaFullDump(
|
||||||
* names in the GDS file do not shadow any names in the database.
|
* names in the GDS file do not shadow any names in the database.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
viewopts = DBPropGetString(def, "LEFview", &isAbstract);
|
viewopts = (char *)DBPropGet(def, "LEFview", &isAbstract);
|
||||||
if ((!isAbstract) || (strcasecmp(viewopts, "no_prefix")))
|
if ((!isAbstract) || (strcasecmp(viewopts, "no_prefix")))
|
||||||
{
|
{
|
||||||
/* Generate a SHORT name for this cell (else it is easy to run into the
|
/* Generate a SHORT name for this cell (else it is easy to run into the
|
||||||
|
|
@ -822,11 +833,9 @@ done:
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
int
|
int
|
||||||
calmaWriteInitFunc(
|
calmaWriteInitFunc(def)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
ClientData cdata) /* UNUSED */
|
|
||||||
{
|
{
|
||||||
def->cd_client = (ClientData) 0;
|
def->cd_client = (ClientData) 0;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
@ -856,18 +865,18 @@ calmaWriteInitFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaProcessUse(
|
calmaProcessUse(use, outf)
|
||||||
CellUse *use, /* Process use->cu_def */
|
CellUse *use; /* Process use->cu_def */
|
||||||
FILE *outf) /* Stream file */
|
FILE *outf; /* Stream file */
|
||||||
{
|
{
|
||||||
return (calmaProcessDef(use->cu_def, outf, FALSE));
|
return (calmaProcessDef(use->cu_def, outf, FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaProcessDef(
|
calmaProcessDef(def, outf, do_library)
|
||||||
CellDef *def, /* Output this def's children, then the def itself */
|
CellDef *def; /* Output this def's children, then the def itself */
|
||||||
FILE *outf, /* Stream file */
|
FILE *outf; /* Stream file */
|
||||||
bool do_library) /* If TRUE, output only children of def, but not def */
|
bool do_library; /* If TRUE, output only children of def, but not def */
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
int polyidx;
|
int polyidx;
|
||||||
|
|
@ -876,15 +885,15 @@ calmaProcessDef(
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
|
|
||||||
/* Skip if already output */
|
/* Skip if already output */
|
||||||
if ((int) CD2INT(def->cd_client) > 0)
|
if ((int) def->cd_client > 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
/* Assign it a (negative) number if it doesn't have one yet */
|
/* Assign it a (negative) number if it doesn't have one yet */
|
||||||
if ((int) CD2INT(def->cd_client) == 0)
|
if ((int) def->cd_client == 0)
|
||||||
def->cd_client = INT2CD(calmaCellNum--);
|
def->cd_client = (ClientData) calmaCellNum--;
|
||||||
|
|
||||||
/* Mark this cell */
|
/* Mark this cell */
|
||||||
def->cd_client = INT2CD(- (int) CD2INT(def->cd_client));
|
def->cd_client = (ClientData) (- (int) def->cd_client);
|
||||||
|
|
||||||
/* Read the cell in if it is not already available. */
|
/* Read the cell in if it is not already available. */
|
||||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||||
|
|
@ -920,7 +929,7 @@ calmaProcessDef(
|
||||||
DBPropGet(def, "GDS_END", &hasGDSEnd);
|
DBPropGet(def, "GDS_END", &hasGDSEnd);
|
||||||
DBPropGet(def, "CIFhier", &needHier);
|
DBPropGet(def, "CIFhier", &needHier);
|
||||||
|
|
||||||
filename = DBPropGetString(def, "GDS_FILE", &isReadOnly);
|
filename = (char *)DBPropGet(def, "GDS_FILE", &isReadOnly);
|
||||||
|
|
||||||
/* When used with "calma addendum true", don't output the read-only */
|
/* When used with "calma addendum true", don't output the read-only */
|
||||||
/* cells. This makes the library incomplete and dependent on the */
|
/* cells. This makes the library incomplete and dependent on the */
|
||||||
|
|
@ -980,20 +989,45 @@ calmaProcessDef(
|
||||||
off_t cellstart, cellend, structstart;
|
off_t cellstart, cellend, structstart;
|
||||||
dlong cval;
|
dlong cval;
|
||||||
int namelen;
|
int namelen;
|
||||||
|
char *modName;
|
||||||
FILETYPE fi;
|
FILETYPE fi;
|
||||||
|
|
||||||
/* Give some feedback to the user */
|
/* Give some feedback to the user */
|
||||||
TxPrintf(" Copying output for cell %s from %s\n", def->cd_name, filename);
|
TxPrintf(" Copying output for cell %s from %s\n", def->cd_name, filename);
|
||||||
|
|
||||||
|
/* Handle compressed files */
|
||||||
|
|
||||||
|
modName = filename;
|
||||||
|
namelen = strlen(filename);
|
||||||
|
if ((namelen > 4) && !strcmp(filename + namelen - 3, ".gz"))
|
||||||
|
{
|
||||||
|
char *sysCmd, *sptr;
|
||||||
|
|
||||||
|
sptr = strrchr(filename, '/');
|
||||||
|
if (sptr == NULL)
|
||||||
|
sptr = filename;
|
||||||
|
else
|
||||||
|
sptr++;
|
||||||
|
|
||||||
|
modName = StrDup((char **)NULL, sptr);
|
||||||
|
*(modName + strlen(modName) - 3) = '\0';
|
||||||
|
|
||||||
|
sysCmd = mallocMagic(18 + namelen + strlen(modName));
|
||||||
|
sprintf(sysCmd, "gunzip -c %s > %s", filename, modName);
|
||||||
|
if (system(sysCmd) != 0)
|
||||||
|
{
|
||||||
|
/* File didn't uncompress. Go back to original name,
|
||||||
|
* although that will probably fail and raise an error.
|
||||||
|
*/
|
||||||
|
freeMagic(modName);
|
||||||
|
modName = filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Use PaZOpen() so the paths searched are the same as were */
|
/* Use PaZOpen() so the paths searched are the same as were */
|
||||||
/* searched to find the .mag file that indicated this GDS file. */
|
/* searched to find the .mag file that indicated this GDS file. */
|
||||||
|
|
||||||
fi = PaZOpen(filename, "r", "", Path, CellLibPath, &retfilename);
|
fi = PaZOpen(modName, "r", "", Path, CellLibPath, &retfilename);
|
||||||
|
|
||||||
/* Check if file may have been compressed */
|
|
||||||
if (fi == NULL)
|
|
||||||
fi = PaZOpen(filename, "r", ".gz", Path, CellLibPath, &retfilename);
|
|
||||||
|
|
||||||
if (fi == NULL)
|
if (fi == NULL)
|
||||||
{
|
{
|
||||||
/* This is a rare error, but if the subcell is inside */
|
/* This is a rare error, but if the subcell is inside */
|
||||||
|
|
@ -1009,7 +1043,9 @@ calmaProcessDef(
|
||||||
|
|
||||||
TxError("Calma output error: Can't find GDS file \"%s\" "
|
TxError("Calma output error: Can't find GDS file \"%s\" "
|
||||||
"for vendor cell \"%s\". It will not be output.\n",
|
"for vendor cell \"%s\". It will not be output.\n",
|
||||||
filename, def->cd_name);
|
modName, def->cd_name);
|
||||||
|
|
||||||
|
if (modName != filename) freeMagic(modName);
|
||||||
|
|
||||||
if (CalmaAllowUndefined)
|
if (CalmaAllowUndefined)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1035,12 +1071,13 @@ calmaProcessDef(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cval = DBPropGetDouble(def, "GDS_END", NULL);
|
offptr = (char *)DBPropGet(def, "GDS_END", NULL);
|
||||||
|
sscanf(offptr, "%"DLONG_PREFIX"d", &cval);
|
||||||
cellend = (off_t)cval;
|
cellend = (off_t)cval;
|
||||||
cval = DBPropGetDouble(def, "GDS_BEGIN", &oldStyle);
|
offptr = (char *)DBPropGet(def, "GDS_BEGIN", &oldStyle);
|
||||||
if (!oldStyle)
|
if (!oldStyle)
|
||||||
{
|
{
|
||||||
cval = DBPropGetDouble(def, "GDS_START", NULL);
|
offptr = (char *)DBPropGet(def, "GDS_START", NULL);
|
||||||
|
|
||||||
/* Write our own header and string name, to ensure */
|
/* Write our own header and string name, to ensure */
|
||||||
/* that the magic cell name and GDS name match. */
|
/* that the magic cell name and GDS name match. */
|
||||||
|
|
@ -1057,6 +1094,7 @@ calmaProcessDef(
|
||||||
calmaOutStructName(CALMA_STRNAME, def, outf);
|
calmaOutStructName(CALMA_STRNAME, def, outf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sscanf(offptr, "%"DLONG_PREFIX"d", &cval);
|
||||||
cellstart = (off_t)cval;
|
cellstart = (off_t)cval;
|
||||||
|
|
||||||
/* GDS_START has been defined as the start of data after the cell */
|
/* GDS_START has been defined as the start of data after the cell */
|
||||||
|
|
@ -1071,7 +1109,7 @@ calmaProcessDef(
|
||||||
/* Read the structure name and check against the CellDef name */
|
/* Read the structure name and check against the CellDef name */
|
||||||
defsize = (size_t)(cellstart - structstart);
|
defsize = (size_t)(cellstart - structstart);
|
||||||
buffer = (char *)mallocMagic(defsize + 1);
|
buffer = (char *)mallocMagic(defsize + 1);
|
||||||
numbytes = magicFREAD(buffer, sizeof(char), (size_t)defsize, fi);
|
numbytes = FREAD(buffer, sizeof(char), (size_t)defsize, fi);
|
||||||
if (numbytes == defsize)
|
if (numbytes == defsize)
|
||||||
{
|
{
|
||||||
buffer[defsize] = '\0';
|
buffer[defsize] = '\0';
|
||||||
|
|
@ -1097,7 +1135,6 @@ calmaProcessDef(
|
||||||
" Using magic's internal definition\n");
|
" Using magic's internal definition\n");
|
||||||
isReadOnly = FALSE;
|
isReadOnly = FALSE;
|
||||||
}
|
}
|
||||||
freeMagic(buffer);
|
|
||||||
|
|
||||||
if (cellend < cellstart) /* Sanity check */
|
if (cellend < cellstart) /* Sanity check */
|
||||||
{
|
{
|
||||||
|
|
@ -1112,7 +1149,7 @@ calmaProcessDef(
|
||||||
defsize = (size_t)(cellend - cellstart);
|
defsize = (size_t)(cellend - cellstart);
|
||||||
buffer = (char *)mallocMagic(defsize);
|
buffer = (char *)mallocMagic(defsize);
|
||||||
|
|
||||||
numbytes = magicFREAD(buffer, sizeof(char), (size_t)defsize, fi);
|
numbytes = FREAD(buffer, sizeof(char), (size_t)defsize, fi);
|
||||||
|
|
||||||
if (numbytes == defsize)
|
if (numbytes == defsize)
|
||||||
{
|
{
|
||||||
|
|
@ -1156,6 +1193,17 @@ calmaProcessDef(
|
||||||
}
|
}
|
||||||
FCLOSE(fi);
|
FCLOSE(fi);
|
||||||
|
|
||||||
|
if (modName != filename)
|
||||||
|
{
|
||||||
|
/* Remove the uncompressed file */
|
||||||
|
if (unlink(modName) != 0)
|
||||||
|
{
|
||||||
|
TxError("Error attempting to delete uncompressed file \"%s\"\n",
|
||||||
|
modName);
|
||||||
|
}
|
||||||
|
freeMagic(modName);
|
||||||
|
}
|
||||||
|
|
||||||
/* Mark the definition as vendor GDS so that magic doesn't */
|
/* Mark the definition as vendor GDS so that magic doesn't */
|
||||||
/* try to generate subcell interaction or array interaction */
|
/* try to generate subcell interaction or array interaction */
|
||||||
/* paint for it. */
|
/* paint for it. */
|
||||||
|
|
@ -1249,10 +1297,10 @@ compport(const void *one, const void *two)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutFunc(
|
calmaOutFunc(def, f, cliprect)
|
||||||
CellDef *def, /* Pointer to cell def to be written */
|
CellDef *def; /* Pointer to cell def to be written */
|
||||||
FILE *f, /* Open output file */
|
FILE *f; /* Open output file */
|
||||||
const Rect *cliprect)/* Area to clip to (used for contact cells),
|
Rect *cliprect; /* Area to clip to (used for contact cells),
|
||||||
* in CIF/GDS coordinates.
|
* in CIF/GDS coordinates.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -1263,7 +1311,7 @@ calmaOutFunc(
|
||||||
int dbunits;
|
int dbunits;
|
||||||
calmaOutputStruct cos;
|
calmaOutputStruct cos;
|
||||||
bool propfound;
|
bool propfound;
|
||||||
PropertyRecord *proprec;
|
char *propvalue;
|
||||||
|
|
||||||
cos.f = f;
|
cos.f = f;
|
||||||
cos.area = (cliprect == &TiPlaneRect) ? NULL : cliprect;
|
cos.area = (cliprect == &TiPlaneRect) ? NULL : cliprect;
|
||||||
|
|
@ -1323,20 +1371,14 @@ calmaOutFunc(
|
||||||
|
|
||||||
/* Include any fixed bounding box as part of the area to process, */
|
/* Include any fixed bounding box as part of the area to process, */
|
||||||
/* in case the fixed bounding box is larger than the geometry. */
|
/* in case the fixed bounding box is larger than the geometry. */
|
||||||
proprec = DBPropGet(def, "FIXED_BBOX", &propfound);
|
propvalue = (char *)DBPropGet(def, "FIXED_BBOX", &propfound);
|
||||||
if (propfound)
|
if (propfound)
|
||||||
{
|
{
|
||||||
Rect bbox;
|
Rect bbox;
|
||||||
|
|
||||||
if ((proprec->prop_type == PROPERTY_TYPE_DIMENSION) &&
|
if (sscanf(propvalue, "%d %d %d %d", &bbox.r_xbot, &bbox.r_ybot,
|
||||||
(proprec->prop_len == 4))
|
&bbox.r_xtop, &bbox.r_ytop) == 4)
|
||||||
{
|
|
||||||
bbox.r_xbot = proprec->prop_value.prop_integer[0];
|
|
||||||
bbox.r_ybot = proprec->prop_value.prop_integer[1];
|
|
||||||
bbox.r_xtop = proprec->prop_value.prop_integer[2];
|
|
||||||
bbox.r_ytop = proprec->prop_value.prop_integer[3];
|
|
||||||
GeoInclude(&bbox, &bigArea);
|
GeoInclude(&bbox, &bigArea);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CIFErrorDef = def;
|
CIFErrorDef = def;
|
||||||
|
|
@ -1395,7 +1437,7 @@ calmaOutFunc(
|
||||||
numports++;
|
numports++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ll != NULL)
|
if (newll != NULL)
|
||||||
{
|
{
|
||||||
/* Turn linked list into an array, then run qsort on it */
|
/* Turn linked list into an array, then run qsort on it */
|
||||||
/* to sort by port number. */
|
/* to sort by port number. */
|
||||||
|
|
@ -1406,10 +1448,8 @@ calmaOutFunc(
|
||||||
{
|
{
|
||||||
pllist[i].pl_label = ll->ll_label;
|
pllist[i].pl_label = ll->ll_label;
|
||||||
pllist[i].pl_port = (unsigned int)ll->ll_attr;
|
pllist[i].pl_port = (unsigned int)ll->ll_attr;
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic(ll);
|
||||||
freeMagic1(&mm1, ll);
|
|
||||||
ll = ll->ll_next;
|
ll = ll->ll_next;
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1452,9 +1492,9 @@ calmaOutFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaIsUseNameDefault(
|
calmaIsUseNameDefault(defName, useName)
|
||||||
char *defName,
|
char *defName;
|
||||||
char *useName)
|
char *useName;
|
||||||
{
|
{
|
||||||
int idx, slen;
|
int idx, slen;
|
||||||
char *sptr;
|
char *sptr;
|
||||||
|
|
@ -1492,9 +1532,9 @@ calmaIsUseNameDefault(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaWriteUseFunc(
|
calmaWriteUseFunc(use, f)
|
||||||
CellUse *use,
|
CellUse *use;
|
||||||
FILE *f)
|
FILE *f;
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* r90, r180, and r270 are Calma 8-byte real representations
|
* r90, r180, and r270 are Calma 8-byte real representations
|
||||||
|
|
@ -1502,10 +1542,10 @@ calmaWriteUseFunc(
|
||||||
* only 4 possible values, it is faster to have them pre-computed
|
* only 4 possible values, it is faster to have them pre-computed
|
||||||
* than to format with calmaOutR8().
|
* than to format with calmaOutR8().
|
||||||
*/
|
*/
|
||||||
static const unsigned char r90[] = { 0x42, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
static unsigned char r90[] = { 0x42, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
static const unsigned char r180[] = { 0x42, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
static unsigned char r180[] = { 0x42, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
static const unsigned char r270[] = { 0x43, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
static unsigned char r270[] = { 0x43, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
const unsigned char *whichangle;
|
unsigned char *whichangle;
|
||||||
int x, y, topx, topy, rows, cols, xxlate, yxlate, hdrsize;
|
int x, y, topx, topy, rows, cols, xxlate, yxlate, hdrsize;
|
||||||
int rectype, stransflags;
|
int rectype, stransflags;
|
||||||
Transform *t;
|
Transform *t;
|
||||||
|
|
@ -1579,7 +1619,7 @@ calmaWriteUseFunc(
|
||||||
if (whichangle)
|
if (whichangle)
|
||||||
{
|
{
|
||||||
calmaOutRH(12, CALMA_ANGLE, CALMA_R8, f);
|
calmaOutRH(12, CALMA_ANGLE, CALMA_R8, f);
|
||||||
calmaOut8((char *)whichangle, f);
|
calmaOut8(whichangle, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translation */
|
/* Translation */
|
||||||
|
|
@ -1616,7 +1656,7 @@ calmaWriteUseFunc(
|
||||||
if (whichangle)
|
if (whichangle)
|
||||||
{
|
{
|
||||||
calmaOutRH(12, CALMA_ANGLE, CALMA_R8, f);
|
calmaOutRH(12, CALMA_ANGLE, CALMA_R8, f);
|
||||||
calmaOut8((char *)whichangle, f);
|
calmaOut8(whichangle, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If array, number of columns and rows in the array */
|
/* If array, number of columns and rows in the array */
|
||||||
|
|
@ -1707,16 +1747,16 @@ calmaWriteUseFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutStructName(
|
calmaOutStructName(type, def, f)
|
||||||
int type,
|
int type;
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
FILE *f)
|
FILE *f;
|
||||||
{
|
{
|
||||||
char *defname;
|
char *defname;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
char *cp;
|
char *cp;
|
||||||
int calmanum;
|
int calmanum;
|
||||||
const char *table;
|
char *table;
|
||||||
|
|
||||||
if (CIFCurStyle->cs_flags & CWF_PERMISSIVE_LABELS)
|
if (CIFCurStyle->cs_flags & CWF_PERMISSIVE_LABELS)
|
||||||
{
|
{
|
||||||
|
|
@ -1726,7 +1766,7 @@ calmaOutStructName(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the def name a legal Calma name? */
|
/* Is the def name a legal Calma name? */
|
||||||
for (cp = def->cd_name; (c = (unsigned char) *cp); cp++)
|
for (cp = def->cd_name; c = (unsigned char) *cp; cp++)
|
||||||
{
|
{
|
||||||
if ((c > 127) || (table[c] == 0))
|
if ((c > 127) || (table[c] == 0))
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
@ -1747,7 +1787,7 @@ calmaOutStructName(
|
||||||
{
|
{
|
||||||
/* Bad name: use XXXXXcalmaNum */
|
/* Bad name: use XXXXXcalmaNum */
|
||||||
bad:
|
bad:
|
||||||
calmanum = (int) CD2INT(def->cd_client);
|
calmanum = (int) def->cd_client;
|
||||||
if (calmanum < 0) calmanum = -calmanum;
|
if (calmanum < 0) calmanum = -calmanum;
|
||||||
defname = (char *)mallocMagic(32);
|
defname = (char *)mallocMagic(32);
|
||||||
(void) sprintf(defname, "XXXXX%d", calmanum);
|
(void) sprintf(defname, "XXXXX%d", calmanum);
|
||||||
|
|
@ -1780,9 +1820,9 @@ bad:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CellDef *
|
CellDef *
|
||||||
calmaGetContactCell(
|
calmaGetContactCell(type, lookOnly)
|
||||||
TileType type, /* magic contact tile type */
|
TileType type; /* magic contact tile type */
|
||||||
bool lookOnly) /* if true, don't generate any new cells */
|
bool lookOnly; /* if true, don't generate any new cells */
|
||||||
{
|
{
|
||||||
TileType j;
|
TileType j;
|
||||||
char contactCellName[100];
|
char contactCellName[100];
|
||||||
|
|
@ -1833,16 +1873,14 @@ calmaGetContactCell(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CalmaGenerateArray(
|
CalmaGenerateArray(f, type, llx, lly, pitch, cols, rows)
|
||||||
FILE *f, /* GDS output file */
|
FILE *f; /* GDS output file */
|
||||||
TileType type, /* Magic tile type of contact */
|
TileType type; /* Magic tile type of contact */
|
||||||
int llx,
|
int llx, lly; /* Lower-left hand coordinate of the array
|
||||||
int lly, /* Lower-left hand coordinate of the array
|
|
||||||
* (centered on contact cut)
|
* (centered on contact cut)
|
||||||
*/
|
*/
|
||||||
int pitch, /* Pitch of the array elements */
|
int pitch; /* Pitch of the array elements */
|
||||||
int cols,
|
int cols, rows; /* Number of array elements in X and Y */
|
||||||
int rows) /* Number of array elements in X and Y */
|
|
||||||
{
|
{
|
||||||
CellDef *child; /* Cell definition of the contact cell */
|
CellDef *child; /* Cell definition of the contact cell */
|
||||||
int xxlate, yxlate;
|
int xxlate, yxlate;
|
||||||
|
|
@ -1904,8 +1942,8 @@ CalmaGenerateArray(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaWriteContacts(
|
calmaWriteContacts(f)
|
||||||
FILE *f)
|
FILE *f;
|
||||||
{
|
{
|
||||||
TileType type;
|
TileType type;
|
||||||
TileTypeBitMask tMask, *rMask;
|
TileTypeBitMask tMask, *rMask;
|
||||||
|
|
@ -1990,7 +2028,7 @@ calmaWriteContacts(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaDelContacts(void)
|
calmaDelContacts()
|
||||||
{
|
{
|
||||||
TileType type;
|
TileType type;
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
|
|
@ -2028,13 +2066,10 @@ calmaDelContacts(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaAddSegment(
|
calmaAddSegment(lbptr, poly_edge, p1x, p1y, p2x, p2y)
|
||||||
LinkedBoundary **lbptr,
|
LinkedBoundary **lbptr;
|
||||||
bool poly_edge,
|
bool poly_edge;
|
||||||
int p1x,
|
int p1x, p1y, p2x, p2y;
|
||||||
int p1y,
|
|
||||||
int p2x,
|
|
||||||
int p2y)
|
|
||||||
{
|
{
|
||||||
LinkedBoundary *newseg, *curseg, *stopseg;
|
LinkedBoundary *newseg, *curseg, *stopseg;
|
||||||
bool startmatch = FALSE;
|
bool startmatch = FALSE;
|
||||||
|
|
@ -2106,8 +2141,8 @@ calmaAddSegment(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaRemoveDegenerate(
|
calmaRemoveDegenerate(blist)
|
||||||
BoundaryTop *blist)
|
BoundaryTop *blist;
|
||||||
{
|
{
|
||||||
bool segfound;
|
bool segfound;
|
||||||
LinkedBoundary *stopseg, *curseg, *lastseg;
|
LinkedBoundary *stopseg, *curseg, *lastseg;
|
||||||
|
|
@ -2163,8 +2198,8 @@ calmaRemoveDegenerate(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaRemoveColinear(
|
calmaRemoveColinear(blist)
|
||||||
BoundaryTop *blist)
|
BoundaryTop *blist;
|
||||||
{
|
{
|
||||||
LinkedBoundary *stopseg, *curseg, *lastseg;
|
LinkedBoundary *stopseg, *curseg, *lastseg;
|
||||||
BoundaryTop *bounds;
|
BoundaryTop *bounds;
|
||||||
|
|
@ -2261,10 +2296,10 @@ calmaRemoveColinear(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaMergeSegments(
|
calmaMergeSegments(edge, blist, num_points)
|
||||||
LinkedBoundary *edge,
|
LinkedBoundary *edge;
|
||||||
BoundaryTop **blist,
|
BoundaryTop **blist;
|
||||||
int num_points)
|
int num_points;
|
||||||
{
|
{
|
||||||
LinkedBoundary *stopseg, *curseg, *lastseg;
|
LinkedBoundary *stopseg, *curseg, *lastseg;
|
||||||
LinkedBoundary *compstop, *compseg, *complast;
|
LinkedBoundary *compstop, *compseg, *complast;
|
||||||
|
|
@ -2347,9 +2382,9 @@ make_new_bound:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaProcessBoundary(
|
calmaProcessBoundary(blist, cos)
|
||||||
BoundaryTop *blist,
|
BoundaryTop *blist;
|
||||||
calmaOutputStruct *cos)
|
calmaOutputStruct *cos;
|
||||||
{
|
{
|
||||||
FILE *f = cos->f;
|
FILE *f = cos->f;
|
||||||
LinkedBoundary *listtop, *lbref, *lbstop, *lbfree;
|
LinkedBoundary *listtop, *lbref, *lbstop, *lbfree;
|
||||||
|
|
@ -2385,11 +2420,8 @@ calmaProcessBoundary(
|
||||||
calmaOutI4(lbref->lb_start.p_y * calmaPaintScale, f);
|
calmaOutI4(lbref->lb_start.p_y * calmaPaintScale, f);
|
||||||
chkcount++;
|
chkcount++;
|
||||||
}
|
}
|
||||||
if (listtop != NULL)
|
calmaOutI4(listtop->lb_start.p_x * calmaPaintScale, f);
|
||||||
{
|
calmaOutI4(listtop->lb_start.p_y * calmaPaintScale, f);
|
||||||
calmaOutI4(listtop->lb_start.p_x * calmaPaintScale, f);
|
|
||||||
calmaOutI4(listtop->lb_start.p_y * calmaPaintScale, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chkcount != bounds->bt_points)
|
if (chkcount != bounds->bt_points)
|
||||||
TxError("Points recorded=%d; Points written=%d\n",
|
TxError("Points recorded=%d; Points written=%d\n",
|
||||||
|
|
@ -2430,27 +2462,19 @@ calmaProcessBoundary(
|
||||||
|
|
||||||
/* Free the LinkedBoundary list */
|
/* Free the LinkedBoundary list */
|
||||||
|
|
||||||
|
lbref = listtop;
|
||||||
|
while (lbref->lb_next != listtop)
|
||||||
{
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic(lbref);
|
||||||
lbref = listtop;
|
lbref = lbref->lb_next;
|
||||||
while (lbref->lb_next != listtop)
|
|
||||||
{
|
|
||||||
freeMagic1(&mm1, lbref);
|
|
||||||
lbref = lbref->lb_next;
|
|
||||||
}
|
|
||||||
freeMagic1(&mm1, lbref);
|
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
|
freeMagic(lbref);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the BoundaryTop list */
|
/* Free the BoundaryTop list */
|
||||||
|
|
||||||
{
|
for (bounds = blist; bounds != NULL; bounds = bounds->bt_next)
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic(bounds);
|
||||||
for (bounds = blist; bounds != NULL; bounds = bounds->bt_next)
|
|
||||||
freeMagic1(&mm1, bounds);
|
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -2468,13 +2492,12 @@ calmaProcessBoundary(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaMergePaintFunc(
|
calmaMergePaintFunc(tile, cos)
|
||||||
Tile *tile, /* Tile to be written out. */
|
Tile *tile; /* Tile to be written out. */
|
||||||
TileType dinfo, /* Split tile information (unused) */
|
calmaOutputStruct *cos; /* Information needed by algorithm */
|
||||||
calmaOutputStruct *cos) /* Information needed by algorithm */
|
|
||||||
{
|
{
|
||||||
FILE *f = cos->f;
|
FILE *f = cos->f;
|
||||||
const Rect *clipArea = cos->area;
|
Rect *clipArea = cos->area;
|
||||||
Tile *t, *tp;
|
Tile *t, *tp;
|
||||||
TileType ttype;
|
TileType ttype;
|
||||||
int i, llx, lly, urx, ury, intedges, num_points, split_type;
|
int i, llx, lly, urx, ury, intedges, num_points, split_type;
|
||||||
|
|
@ -2486,7 +2509,7 @@ calmaMergePaintFunc(
|
||||||
BoundaryTop *bounds = NULL;
|
BoundaryTop *bounds = NULL;
|
||||||
|
|
||||||
/* Quick check for tiles that have already been processed */
|
/* Quick check for tiles that have already been processed */
|
||||||
if (TiGetClientINT(tile) == GDS_PROCESSED) return 0;
|
if (tile->ti_client == (ClientData)GDS_PROCESSED) return 0;
|
||||||
|
|
||||||
if (SegStack == (Stack *)NULL)
|
if (SegStack == (Stack *)NULL)
|
||||||
SegStack = StackNew(64);
|
SegStack = StackNew(64);
|
||||||
|
|
@ -2495,16 +2518,17 @@ calmaMergePaintFunc(
|
||||||
while (!StackEmpty(SegStack))
|
while (!StackEmpty(SegStack))
|
||||||
{
|
{
|
||||||
t = (Tile *) STACKPOP(SegStack);
|
t = (Tile *) STACKPOP(SegStack);
|
||||||
if (TiGetClientINT(t) != GDS_PENDING) continue;
|
if (t->ti_client != (ClientData)GDS_PENDING) continue;
|
||||||
TiSetClientINT(t, GDS_PROCESSED);
|
t->ti_client = (ClientData)GDS_PROCESSED;
|
||||||
|
|
||||||
split_type = -1;
|
split_type = -1;
|
||||||
if (IsSplit(t))
|
if (IsSplit(t))
|
||||||
{
|
{
|
||||||
/* If we use TT_SIDE, then we need to set it when the */
|
/* If we use SplitSide, then we need to set it when the */
|
||||||
/* tile is pushed. Since these are one-or-zero mask layers */
|
/* tile is pushed. Since these are one-or-zero mask layers */
|
||||||
/* I assume it is okay to just check which side is TT_SPACE */
|
/* I assume it is okay to just check which side is TT_SPACE */
|
||||||
|
|
||||||
|
/* split_type = (SplitSide(t) << 1) | SplitDirection(t); */
|
||||||
split_type = SplitDirection(t);
|
split_type = SplitDirection(t);
|
||||||
if (TiGetLeftType(t) == TT_SPACE) split_type |= 2;
|
if (TiGetLeftType(t) == TT_SPACE) split_type |= 2;
|
||||||
num_points = 2;
|
num_points = 2;
|
||||||
|
|
@ -2516,10 +2540,8 @@ calmaMergePaintFunc(
|
||||||
lb = edge;
|
lb = edge;
|
||||||
while (lb->lb_next != edge) lb = lb->lb_next;
|
while (lb->lb_next != edge) lb = lb->lb_next;
|
||||||
lb->lb_next = edge->lb_next;
|
lb->lb_next = edge->lb_next;
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic(edge);
|
||||||
freeMagic1(&mm1, edge);
|
|
||||||
edge = edge->lb_next;
|
edge = edge->lb_next;
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -2727,9 +2749,7 @@ right_search:
|
||||||
done_searches:
|
done_searches:
|
||||||
if (intedges == 0)
|
if (intedges == 0)
|
||||||
{
|
{
|
||||||
calmaWritePaintFunc(t,
|
calmaWritePaintFunc(t, cos);
|
||||||
(split_type & 2) ? (TileType)TT_SIDE : (TileType)0,
|
|
||||||
cos);
|
|
||||||
|
|
||||||
/* Although calmaWritePaintFunc is called only on isolated */
|
/* Although calmaWritePaintFunc is called only on isolated */
|
||||||
/* tiles, we may have expanded it. This could use a LOT of */
|
/* tiles, we may have expanded it. This could use a LOT of */
|
||||||
|
|
@ -2740,13 +2760,11 @@ done_searches:
|
||||||
|
|
||||||
if (num_points != 4)
|
if (num_points != 4)
|
||||||
{
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (i = 0; i < num_points; i++)
|
for (i = 0; i < num_points; i++)
|
||||||
{
|
{
|
||||||
freeMagic1(&mm1, edge);
|
freeMagic(edge);
|
||||||
edge = edge->lb_next;
|
edge = edge->lb_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
edge = NULL;
|
edge = NULL;
|
||||||
}
|
}
|
||||||
if (!StackEmpty(SegStack))
|
if (!StackEmpty(SegStack))
|
||||||
|
|
@ -2797,13 +2815,12 @@ done_searches:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaWritePaintFunc(
|
calmaWritePaintFunc(tile, cos)
|
||||||
Tile *tile, /* Tile to be written out. */
|
Tile *tile; /* Tile to be written out. */
|
||||||
TileType dinfo, /* Split tile information */
|
calmaOutputStruct *cos; /* File for output and clipping area */
|
||||||
calmaOutputStruct *cos) /* File for output and clipping area */
|
|
||||||
{
|
{
|
||||||
FILE *f = cos->f;
|
FILE *f = cos->f;
|
||||||
const Rect *clipArea = cos->area;
|
Rect *clipArea = cos->area;
|
||||||
Rect r, r2;
|
Rect r, r2;
|
||||||
|
|
||||||
TiToRect(tile, &r);
|
TiToRect(tile, &r);
|
||||||
|
|
@ -2835,7 +2852,7 @@ calmaWritePaintFunc(
|
||||||
/* Coordinates */
|
/* Coordinates */
|
||||||
calmaOutRH(36, CALMA_XY, CALMA_I4, f);
|
calmaOutRH(36, CALMA_XY, CALMA_I4, f);
|
||||||
|
|
||||||
switch (((dinfo & TT_SIDE) ? 2 : 0) | SplitDirection(tile))
|
switch ((SplitSide(tile) << 1) | SplitDirection(tile))
|
||||||
{
|
{
|
||||||
case 0x0:
|
case 0x0:
|
||||||
calmaOutI4(r.r_xbot, f); calmaOutI4(r.r_ybot, f);
|
calmaOutI4(r.r_xbot, f); calmaOutI4(r.r_ybot, f);
|
||||||
|
|
@ -2903,13 +2920,13 @@ calmaWritePaintFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaWriteLabelFunc(
|
calmaWriteLabelFunc(lab, ltype, type, f)
|
||||||
Label *lab, /* Label to output */
|
Label *lab; /* Label to output */
|
||||||
int ltype, /* CIF layer number to use for TEXT record */
|
int ltype; /* CIF layer number to use for TEXT record */
|
||||||
int type, /* CIF layer number to use for BOUNDARY record,
|
int type; /* CIF layer number to use for BOUNDARY record,
|
||||||
* or -1 if not attached to a layer
|
* or -1 if not attached to a layer
|
||||||
*/
|
*/
|
||||||
FILE *f) /* Stream file */
|
FILE *f; /* Stream file */
|
||||||
{
|
{
|
||||||
Point p;
|
Point p;
|
||||||
int calmanum, calmatype;
|
int calmanum, calmatype;
|
||||||
|
|
@ -3074,13 +3091,12 @@ calmaWriteLabelFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaPaintLabelFunc(
|
calmaPaintLabelFunc(tile, cos)
|
||||||
Tile *tile, /* Tile contains area for label. */
|
Tile *tile; /* Tile contains area for label. */
|
||||||
TileType dinfo, /* Split tile information (unused) */
|
calmaOutputStruct *cos; /* File for output and clipping area */
|
||||||
calmaOutputStruct *cos) /* File for output and clipping area */
|
|
||||||
{
|
{
|
||||||
FILE *f = cos->f;
|
FILE *f = cos->f;
|
||||||
const Rect *clipArea = cos->area;
|
Rect *clipArea = cos->area;
|
||||||
Rect r, r2;
|
Rect r, r2;
|
||||||
Point p;
|
Point p;
|
||||||
int len;
|
int len;
|
||||||
|
|
@ -3136,9 +3152,9 @@ calmaPaintLabelFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutHeader(
|
calmaOutHeader(rootDef, f)
|
||||||
CellDef *rootDef,
|
CellDef *rootDef;
|
||||||
FILE *f)
|
FILE *f;
|
||||||
{
|
{
|
||||||
static double useru = 0.001;
|
static double useru = 0.001;
|
||||||
static double mum = 1.0e-9;
|
static double mum = 1.0e-9;
|
||||||
|
|
@ -3197,9 +3213,9 @@ calmaOutHeader(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutDate(
|
calmaOutDate(t, f)
|
||||||
time_t t, /* Time (UNIX format) to be output */
|
time_t t; /* Time (UNIX format) to be output */
|
||||||
FILE *f) /* Stream file */
|
FILE *f; /* Stream file */
|
||||||
{
|
{
|
||||||
struct tm *datep = localtime(&t);
|
struct tm *datep = localtime(&t);
|
||||||
|
|
||||||
|
|
@ -3232,15 +3248,14 @@ calmaOutDate(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutStringRecord(
|
calmaOutStringRecord(type, str, f)
|
||||||
int type, /* Type of this record (data type is ASCII string) */
|
int type; /* Type of this record (data type is ASCII string) */
|
||||||
char *str, /* String to be output */
|
char *str; /* String to be output */
|
||||||
FILE *f) /* Stream file */
|
FILE *f; /* Stream file */
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
const char *table;
|
char *table, *locstr, *origstr = NULL;
|
||||||
char *locstr, *origstr = NULL;
|
|
||||||
char *locstrprv; /* Added by BSI */
|
char *locstrprv; /* Added by BSI */
|
||||||
|
|
||||||
if(CIFCurStyle->cs_flags & CWF_PERMISSIVE_LABELS)
|
if(CIFCurStyle->cs_flags & CWF_PERMISSIVE_LABELS)
|
||||||
|
|
@ -3334,9 +3349,9 @@ calmaOutStringRecord(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutR8(
|
calmaOutR8(d, f)
|
||||||
double d, /* Double value to write to output */
|
double d; /* Double value to write to output */
|
||||||
FILE *f) /* Stream file */
|
FILE *f; /* Stream file */
|
||||||
{
|
{
|
||||||
int c, i, sign, expon;
|
int c, i, sign, expon;
|
||||||
|
|
||||||
|
|
@ -3409,9 +3424,9 @@ calmaOutR8(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOut8(
|
calmaOut8(str, f)
|
||||||
const char *str, /* 8-byte string to be output */
|
char *str; /* 8-byte string to be output */
|
||||||
FILE *f) /* Stream file */
|
FILE *f; /* Stream file */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/calma/CalmaWrite.c,v 1.8 2010/12/22 16:29:06 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/calma/CalmaWrite.c,v 1.8 2010/12/22 16:29:06 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
|
|
@ -34,19 +34,13 @@ static const char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h> /* for random() */
|
#include <stdlib.h> /* for random() */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <arpa/inet.h> /* for htons() */
|
#include <arpa/inet.h> /* for htons() */
|
||||||
#ifdef TIME_WITH_SYS_TIME
|
#if defined(SYSV) || defined(EMSCRIPTEN)
|
||||||
# include <sys/time.h>
|
#include <time.h>
|
||||||
# include <time.h>
|
|
||||||
#else
|
#else
|
||||||
# ifdef HAVE_SYS_TIME_H
|
#include <sys/time.h>
|
||||||
# include <sys/time.h>
|
|
||||||
# else
|
|
||||||
# include <time.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utils/magic.h"
|
#include "utils/magic.h"
|
||||||
|
|
@ -54,7 +48,6 @@ static const char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic
|
||||||
#include "utils/geometry.h"
|
#include "utils/geometry.h"
|
||||||
#include "tiles/tile.h"
|
#include "tiles/tile.h"
|
||||||
#include "utils/utils.h"
|
#include "utils/utils.h"
|
||||||
#include "utils/magic_zlib.h"
|
|
||||||
#include "utils/hash.h"
|
#include "utils/hash.h"
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
#include "database/databaseInt.h"
|
#include "database/databaseInt.h"
|
||||||
|
|
@ -96,31 +89,32 @@ extern int calmaPaintLayerNumber;
|
||||||
extern int calmaPaintLayerType;
|
extern int calmaPaintLayerType;
|
||||||
|
|
||||||
/* External functions from CalmaWrite.c */
|
/* External functions from CalmaWrite.c */
|
||||||
extern int calmaWriteInitFunc(CellDef *def, ClientData cdata); /* UNUSED */
|
extern int calmaWriteInitFunc();
|
||||||
|
extern int calmaWriteMarkFunc();
|
||||||
|
|
||||||
|
/* Forward declarations */
|
||||||
|
extern int calmaWritePaintFuncZ();
|
||||||
|
extern int calmaMergePaintFuncZ();
|
||||||
|
extern int calmaWriteUseFuncZ();
|
||||||
|
extern int calmaPaintLabelFuncZ();
|
||||||
|
extern void calmaWriteContactsZ();
|
||||||
|
extern void calmaOutFuncZ();
|
||||||
|
extern void calmaOutStructNameZ();
|
||||||
|
extern void calmaWriteLabelFuncZ();
|
||||||
|
extern void calmaOutHeaderZ();
|
||||||
|
extern void calmaOutDateZ();
|
||||||
|
extern void calmaOutStringRecordZ();
|
||||||
|
extern void calmaOut8Z();
|
||||||
|
extern void calmaOutR8Z();
|
||||||
|
|
||||||
/* Structure used by calmaWritePaintFuncZ() and others */
|
/* Structure used by calmaWritePaintFuncZ() and others */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gzFile f; /* Compressed file stream for output */
|
gzFile f; /* Compressed file stream for output */
|
||||||
const Rect *area; /* Clipping area, in GDS coordinates */
|
Rect *area; /* Clipping area, in GDS coordinates */
|
||||||
int type; /* Layer index */
|
int type; /* Layer index */
|
||||||
} calmaOutputStructZ;
|
} calmaOutputStructZ;
|
||||||
|
|
||||||
/* Forward declarations */
|
|
||||||
extern int calmaWritePaintFuncZ(Tile *tile, TileType dinfo, calmaOutputStructZ *cos);
|
|
||||||
extern int calmaMergePaintFuncZ(Tile *tile, TileType dinfo, calmaOutputStructZ *cos);
|
|
||||||
extern int calmaWriteUseFuncZ(CellUse *use, gzFile f);
|
|
||||||
extern int calmaPaintLabelFuncZ(Tile *tile, TileType dinfo, calmaOutputStructZ *cos);
|
|
||||||
extern void calmaWriteContactsZ(gzFile f);
|
|
||||||
extern void calmaOutFuncZ(CellDef *def, gzFile f, const Rect *cliprect);
|
|
||||||
extern void calmaOutStructNameZ(int type, CellDef *def, gzFile f);
|
|
||||||
extern void calmaWriteLabelFuncZ(Label *lab, int ltype, int type, gzFile f);
|
|
||||||
extern void calmaOutHeaderZ(CellDef *rootDef, gzFile f);
|
|
||||||
extern void calmaOutDateZ(time_t t, gzFile f);
|
|
||||||
extern void calmaOutStringRecordZ(int type, char *str, gzFile f);
|
|
||||||
extern void calmaOut8Z(const char *str, gzFile f);
|
|
||||||
extern void calmaOutR8Z(double d, gzFile f);
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
/* Structures used by the tile merging algorithm */
|
/* Structures used by the tile merging algorithm */
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
|
|
@ -130,11 +124,27 @@ extern void calmaOutR8Z(double d, gzFile f);
|
||||||
#define GDS_PROCESSED 1
|
#define GDS_PROCESSED 1
|
||||||
|
|
||||||
#define PUSHTILEZ(tp) \
|
#define PUSHTILEZ(tp) \
|
||||||
if (TiGetClient(tp) == GDS_UNPROCESSED) { \
|
if ((tp)->ti_client == (ClientData) GDS_UNPROCESSED) { \
|
||||||
TiSetClientINT(tp, GDS_PENDING); \
|
(tp)->ti_client = (ClientData) GDS_PENDING; \
|
||||||
STACKPUSH((ClientData) (tp), SegStack); \
|
STACKPUSH((ClientData) (tp), SegStack); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define LB_EXTERNAL 0 /* Polygon external edge */
|
||||||
|
#define LB_INTERNAL 1 /* Polygon internal edge */
|
||||||
|
#define LB_INIT 2 /* Data not yet valid */
|
||||||
|
|
||||||
|
typedef struct LB1 {
|
||||||
|
char lb_type; /* Boundary Type (external or internal) */
|
||||||
|
Point lb_start; /* Start point */
|
||||||
|
struct LB1 *lb_next; /* Next point record */
|
||||||
|
} LinkedBoundary;
|
||||||
|
|
||||||
|
typedef struct BT1 {
|
||||||
|
LinkedBoundary *bt_first; /* Polygon list */
|
||||||
|
int bt_points; /* Number of points in this list */
|
||||||
|
struct BT1 *bt_next; /* Next polygon record */
|
||||||
|
} BoundaryTop;
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -186,7 +196,7 @@ extern void calmaOutR8Z(double d, gzFile f);
|
||||||
(void) gzputc(f, u.u_c[3]); \
|
(void) gzputc(f, u.u_c[3]); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char calmaMapTableStrict[] =
|
static char calmaMapTableStrict[] =
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* NUL - BEL */
|
0, 0, 0, 0, 0, 0, 0, 0, /* NUL - BEL */
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* BS - SI */
|
0, 0, 0, 0, 0, 0, 0, 0, /* BS - SI */
|
||||||
|
|
@ -206,7 +216,7 @@ static const char calmaMapTableStrict[] =
|
||||||
'x', 'y', 'z', '_', '_', '_', '_', 0, /* x - DEL */
|
'x', 'y', 'z', '_', '_', '_', '_', 0, /* x - DEL */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char calmaMapTablePermissive[] =
|
static char calmaMapTablePermissive[] =
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* NUL - BEL */
|
0, 0, 0, 0, 0, 0, 0, 0, /* NUL - BEL */
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, /* BS - SI */
|
0, 0, 0, 0, 0, 0, 0, 0, /* BS - SI */
|
||||||
|
|
@ -261,13 +271,12 @@ static const char calmaMapTablePermissive[] =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CalmaWriteZ(
|
CalmaWriteZ(rootDef, f)
|
||||||
CellDef *rootDef, /* Pointer to CellDef to be written */
|
CellDef *rootDef; /* Pointer to CellDef to be written */
|
||||||
gzFile f) /* Open compressed output file */
|
gzFile f; /* Open compressed output file */
|
||||||
{
|
{
|
||||||
int oldCount = DBWFeedbackCount, problems, nerr;
|
int oldCount = DBWFeedbackCount, problems, nerr;
|
||||||
bool good;
|
bool good;
|
||||||
CellDef *err_def;
|
|
||||||
CellUse dummy;
|
CellUse dummy;
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
HashSearch hs;
|
HashSearch hs;
|
||||||
|
|
@ -293,11 +302,9 @@ CalmaWriteZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dummy.cu_def = rootDef;
|
dummy.cu_def = rootDef;
|
||||||
err_def = DBCellReadArea(&dummy, &rootDef->cd_bbox, !CalmaAllowUndefined);
|
if (DBCellReadArea(&dummy, &rootDef->cd_bbox, !CalmaAllowUndefined))
|
||||||
if (err_def != NULL)
|
|
||||||
{
|
{
|
||||||
TxError("Failure to read entire subtree of the cell.\n");
|
TxError("Failure to read entire subtree of the cell.\n");
|
||||||
TxError("Failed on cell %s.\n", err_def->cd_name);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -359,7 +366,7 @@ CalmaWriteZ(
|
||||||
good = (nerr == 0) ? TRUE : FALSE;
|
good = (nerr == 0) ? TRUE : FALSE;
|
||||||
|
|
||||||
/* See if any problems occurred */
|
/* See if any problems occurred */
|
||||||
if ((problems = (DBWFeedbackCount - oldCount)))
|
if (problems = (DBWFeedbackCount - oldCount))
|
||||||
TxPrintf("%d problems occurred. See feedback entries.\n", problems);
|
TxPrintf("%d problems occurred. See feedback entries.\n", problems);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -389,13 +396,13 @@ CalmaWriteZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calmaDumpStructureZ(
|
calmaDumpStructureZ(def, outf, calmaDefHash, filename)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
gzFile outf,
|
gzFile outf;
|
||||||
HashTable *calmaDefHash,
|
HashTable *calmaDefHash;
|
||||||
char *filename)
|
char *filename;
|
||||||
{
|
{
|
||||||
int nbytes = -1, rtype = 0;
|
int nbytes, rtype;
|
||||||
char *strname = NULL, *newnameptr;
|
char *strname = NULL, *newnameptr;
|
||||||
HashEntry *he, *he2;
|
HashEntry *he, *he2;
|
||||||
CellDef *edef;
|
CellDef *edef;
|
||||||
|
|
@ -508,7 +515,7 @@ calmaDumpStructureZ(
|
||||||
|
|
||||||
/* Is view abstract? */
|
/* Is view abstract? */
|
||||||
DBPropGet(edef, "LEFview", &isAbstract);
|
DBPropGet(edef, "LEFview", &isAbstract);
|
||||||
chklibname = DBPropGetString(edef, "GDS_FILE", &isReadOnly);
|
chklibname = (char *)DBPropGet(edef, "GDS_FILE", &isReadOnly);
|
||||||
|
|
||||||
if (isAbstract && isReadOnly)
|
if (isAbstract && isReadOnly)
|
||||||
{
|
{
|
||||||
|
|
@ -659,11 +666,11 @@ syntaxerror:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaFullDumpZ(
|
calmaFullDumpZ(def, fi, outf, filename)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
gzFile fi,
|
gzFile fi;
|
||||||
gzFile outf,
|
gzFile outf;
|
||||||
char *filename)
|
char *filename;
|
||||||
{
|
{
|
||||||
int version, rval;
|
int version, rval;
|
||||||
char *libname = NULL, *testlib, uniqlibname[4];
|
char *libname = NULL, *testlib, uniqlibname[4];
|
||||||
|
|
@ -673,10 +680,10 @@ calmaFullDumpZ(
|
||||||
HashSearch hs;
|
HashSearch hs;
|
||||||
HashEntry *he, *he2;
|
HashEntry *he, *he2;
|
||||||
|
|
||||||
static const int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS,
|
static int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS,
|
||||||
CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE,
|
CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE,
|
||||||
CALMA_STYPTABLE, CALMA_GENERATIONS, -1 };
|
CALMA_STYPTABLE, CALMA_GENERATIONS, -1 };
|
||||||
static const int skipBeforeLib[] = { CALMA_LIBDIRSIZE, CALMA_SRFNAME,
|
static int skipBeforeLib[] = { CALMA_LIBDIRSIZE, CALMA_SRFNAME,
|
||||||
CALMA_LIBSECUR, -1 };
|
CALMA_LIBSECUR, -1 };
|
||||||
|
|
||||||
HashInit(&calmaDefHash, 32, 0);
|
HashInit(&calmaDefHash, 32, 0);
|
||||||
|
|
@ -716,7 +723,7 @@ calmaFullDumpZ(
|
||||||
* names in the GDS file do not shadow any names in the database.
|
* names in the GDS file do not shadow any names in the database.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
viewopts = DBPropGetString(def, "LEFview", &isAbstract);
|
viewopts = (char *)DBPropGet(def, "LEFview", &isAbstract);
|
||||||
if ((!isAbstract) || (strcasecmp(viewopts, "no_prefix")))
|
if ((!isAbstract) || (strcasecmp(viewopts, "no_prefix")))
|
||||||
{
|
{
|
||||||
/* Generate a SHORT name for this cell (else it is easy to run into the
|
/* Generate a SHORT name for this cell (else it is easy to run into the
|
||||||
|
|
@ -807,18 +814,18 @@ done:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaProcessUseZ(
|
calmaProcessUseZ(use, outf)
|
||||||
CellUse *use, /* Process use->cu_def */
|
CellUse *use; /* Process use->cu_def */
|
||||||
gzFile outf) /* Stream file */
|
gzFile outf; /* Stream file */
|
||||||
{
|
{
|
||||||
return (calmaProcessDefZ(use->cu_def, outf, FALSE));
|
return (calmaProcessDefZ(use->cu_def, outf, FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaProcessDefZ(
|
calmaProcessDefZ(def, outf, do_library)
|
||||||
CellDef *def, /* Output this def's children, then the def itself */
|
CellDef *def; /* Output this def's children, then the def itself */
|
||||||
gzFile outf, /* Stream file */
|
gzFile outf; /* Stream file */
|
||||||
bool do_library) /* If TRUE, output only children of def, but not def */
|
bool do_library; /* If TRUE, output only children of def, but not def */
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
int polyidx;
|
int polyidx;
|
||||||
|
|
@ -827,15 +834,15 @@ calmaProcessDefZ(
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
|
|
||||||
/* Skip if already output */
|
/* Skip if already output */
|
||||||
if ((int) CD2INT(def->cd_client) > 0)
|
if ((int) def->cd_client > 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
/* Assign it a (negative) number if it doesn't have one yet */
|
/* Assign it a (negative) number if it doesn't have one yet */
|
||||||
if ((int) CD2INT(def->cd_client) == 0)
|
if ((int) def->cd_client == 0)
|
||||||
def->cd_client = INT2CD(calmaCellNum--);
|
def->cd_client = (ClientData) calmaCellNum--;
|
||||||
|
|
||||||
/* Mark this cell */
|
/* Mark this cell */
|
||||||
def->cd_client = INT2CD(- (int) CD2INT(def->cd_client));
|
def->cd_client = (ClientData) (- (int) def->cd_client);
|
||||||
|
|
||||||
/* Read the cell in if it is not already available. */
|
/* Read the cell in if it is not already available. */
|
||||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||||
|
|
@ -870,7 +877,7 @@ calmaProcessDefZ(
|
||||||
DBPropGet(def, "GDS_START", &hasContent);
|
DBPropGet(def, "GDS_START", &hasContent);
|
||||||
DBPropGet(def, "GDS_END", &hasGDSEnd);
|
DBPropGet(def, "GDS_END", &hasGDSEnd);
|
||||||
DBPropGet(def, "CIFhier", &needHier);
|
DBPropGet(def, "CIFhier", &needHier);
|
||||||
filename = DBPropGetString(def, "GDS_FILE", &isReadOnly);
|
filename = (char *)DBPropGet(def, "GDS_FILE", &isReadOnly);
|
||||||
|
|
||||||
/* When used with "calma addendum true", don't output the read-only */
|
/* When used with "calma addendum true", don't output the read-only */
|
||||||
/* cells. This makes the library incomplete and dependent on the */
|
/* cells. This makes the library incomplete and dependent on the */
|
||||||
|
|
@ -939,11 +946,6 @@ calmaProcessDefZ(
|
||||||
/* searched to find the .mag file that indicated this GDS file. */
|
/* searched to find the .mag file that indicated this GDS file. */
|
||||||
|
|
||||||
fi = PaZOpen(filename, "r", "", Path, CellLibPath, &retfilename);
|
fi = PaZOpen(filename, "r", "", Path, CellLibPath, &retfilename);
|
||||||
|
|
||||||
/* Check if file may have been compressed */
|
|
||||||
if (fi == NULL)
|
|
||||||
fi = PaZOpen(filename, "r", ".gz", Path, CellLibPath, &retfilename);
|
|
||||||
|
|
||||||
if (fi == NULL)
|
if (fi == NULL)
|
||||||
{
|
{
|
||||||
/* This is a rare error, but if the subcell is inside */
|
/* This is a rare error, but if the subcell is inside */
|
||||||
|
|
@ -985,12 +987,13 @@ calmaProcessDefZ(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cval = DBPropGetDouble(def, "GDS_END", NULL);
|
offptr = (char *)DBPropGet(def, "GDS_END", NULL);
|
||||||
|
sscanf(offptr, "%"DLONG_PREFIX"d", &cval);
|
||||||
cellend = (z_off_t)cval;
|
cellend = (z_off_t)cval;
|
||||||
cval = DBPropGetDouble(def, "GDS_BEGIN", &oldStyle);
|
offptr = (char *)DBPropGet(def, "GDS_BEGIN", &oldStyle);
|
||||||
if (!oldStyle)
|
if (!oldStyle)
|
||||||
{
|
{
|
||||||
cval = DBPropGetDouble(def, "GDS_START", NULL);
|
offptr = (char *)DBPropGet(def, "GDS_START", NULL);
|
||||||
|
|
||||||
/* Write our own header and string name, to ensure */
|
/* Write our own header and string name, to ensure */
|
||||||
/* that the magic cell name and GDS name match. */
|
/* that the magic cell name and GDS name match. */
|
||||||
|
|
@ -1007,6 +1010,7 @@ calmaProcessDefZ(
|
||||||
calmaOutStructNameZ(CALMA_STRNAME, def, outf);
|
calmaOutStructNameZ(CALMA_STRNAME, def, outf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sscanf(offptr, "%"DLONG_PREFIX"d", &cval);
|
||||||
cellstart = (z_off_t)cval;
|
cellstart = (z_off_t)cval;
|
||||||
|
|
||||||
/* GDS_START has been defined as the start of data after the cell */
|
/* GDS_START has been defined as the start of data after the cell */
|
||||||
|
|
@ -1047,7 +1051,6 @@ calmaProcessDefZ(
|
||||||
" Using magic's internal definition\n");
|
" Using magic's internal definition\n");
|
||||||
isReadOnly = FALSE;
|
isReadOnly = FALSE;
|
||||||
}
|
}
|
||||||
freeMagic(buffer);
|
|
||||||
|
|
||||||
if (cellend < cellstart) /* Sanity check */
|
if (cellend < cellstart) /* Sanity check */
|
||||||
{
|
{
|
||||||
|
|
@ -1170,10 +1173,10 @@ calmaProcessDefZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutFuncZ(
|
calmaOutFuncZ(def, f, cliprect)
|
||||||
CellDef *def, /* Pointer to cell def to be written */
|
CellDef *def; /* Pointer to cell def to be written */
|
||||||
gzFile f, /* Open output file */
|
gzFile f; /* Open output file */
|
||||||
const Rect *cliprect)/* Area to clip to (used for contact cells),
|
Rect *cliprect; /* Area to clip to (used for contact cells),
|
||||||
* in CIF/GDS coordinates.
|
* in CIF/GDS coordinates.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -1184,9 +1187,8 @@ calmaOutFuncZ(
|
||||||
int dbunits;
|
int dbunits;
|
||||||
calmaOutputStructZ cos;
|
calmaOutputStructZ cos;
|
||||||
bool propfound;
|
bool propfound;
|
||||||
PropertyRecord *proprec;
|
|
||||||
char *propvalue;
|
char *propvalue;
|
||||||
extern int compport(const void *one, const void *two); /* Forward declaration */
|
extern int compport(); /* Forward declaration */
|
||||||
|
|
||||||
cos.f = f;
|
cos.f = f;
|
||||||
cos.area = (cliprect == &TiPlaneRect) ? NULL : cliprect;
|
cos.area = (cliprect == &TiPlaneRect) ? NULL : cliprect;
|
||||||
|
|
@ -1246,20 +1248,14 @@ calmaOutFuncZ(
|
||||||
|
|
||||||
/* Include any fixed bounding box as part of the area to process, */
|
/* Include any fixed bounding box as part of the area to process, */
|
||||||
/* in case the fixed bounding box is larger than the geometry. */
|
/* in case the fixed bounding box is larger than the geometry. */
|
||||||
proprec = DBPropGet(def, "FIXED_BBOX", &propfound);
|
propvalue = (char *)DBPropGet(def, "FIXED_BBOX", &propfound);
|
||||||
if (propfound)
|
if (propfound)
|
||||||
{
|
{
|
||||||
Rect bbox;
|
Rect bbox;
|
||||||
|
|
||||||
if ((proprec->prop_type == PROPERTY_TYPE_DIMENSION) &&
|
if (sscanf(propvalue, "%d %d %d %d", &bbox.r_xbot, &bbox.r_ybot,
|
||||||
(proprec->prop_len == 4))
|
&bbox.r_xtop, &bbox.r_ytop) == 4)
|
||||||
{
|
|
||||||
bbox.r_xbot = proprec->prop_value.prop_integer[0];
|
|
||||||
bbox.r_ybot = proprec->prop_value.prop_integer[1];
|
|
||||||
bbox.r_xtop = proprec->prop_value.prop_integer[2];
|
|
||||||
bbox.r_ytop = proprec->prop_value.prop_integer[3];
|
|
||||||
GeoInclude(&bbox, &bigArea);
|
GeoInclude(&bbox, &bigArea);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CIFErrorDef = def;
|
CIFErrorDef = def;
|
||||||
|
|
@ -1329,10 +1325,8 @@ calmaOutFuncZ(
|
||||||
{
|
{
|
||||||
pllist[i].pl_label = ll->ll_label;
|
pllist[i].pl_label = ll->ll_label;
|
||||||
pllist[i].pl_port = (unsigned int)ll->ll_attr;
|
pllist[i].pl_port = (unsigned int)ll->ll_attr;
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic(ll);
|
||||||
freeMagic1(&mm1, ll);
|
|
||||||
ll = ll->ll_next;
|
ll = ll->ll_next;
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1374,9 +1368,9 @@ calmaOutFuncZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaWriteUseFuncZ(
|
calmaWriteUseFuncZ(use, f)
|
||||||
CellUse *use,
|
CellUse *use;
|
||||||
gzFile f)
|
gzFile f;
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* r90, r180, and r270 are Calma 8-byte real representations
|
* r90, r180, and r270 are Calma 8-byte real representations
|
||||||
|
|
@ -1384,10 +1378,10 @@ calmaWriteUseFuncZ(
|
||||||
* only 4 possible values, it is faster to have them pre-computed
|
* only 4 possible values, it is faster to have them pre-computed
|
||||||
* than to format with calmaOutR8Z().
|
* than to format with calmaOutR8Z().
|
||||||
*/
|
*/
|
||||||
static const unsigned char r90[] = { 0x42, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
static unsigned char r90[] = { 0x42, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
static const unsigned char r180[] = { 0x42, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
static unsigned char r180[] = { 0x42, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
static const unsigned char r270[] = { 0x43, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
static unsigned char r270[] = { 0x43, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
const unsigned char *whichangle;
|
unsigned char *whichangle;
|
||||||
int x, y, topx, topy, rows, cols, xxlate, yxlate, hdrsize;
|
int x, y, topx, topy, rows, cols, xxlate, yxlate, hdrsize;
|
||||||
int rectype, stransflags;
|
int rectype, stransflags;
|
||||||
Transform *t;
|
Transform *t;
|
||||||
|
|
@ -1461,7 +1455,7 @@ calmaWriteUseFuncZ(
|
||||||
if (whichangle)
|
if (whichangle)
|
||||||
{
|
{
|
||||||
calmaOutRHZ(12, CALMA_ANGLE, CALMA_R8, f);
|
calmaOutRHZ(12, CALMA_ANGLE, CALMA_R8, f);
|
||||||
calmaOut8Z((char *)whichangle, f);
|
calmaOut8Z(whichangle, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translation */
|
/* Translation */
|
||||||
|
|
@ -1498,7 +1492,7 @@ calmaWriteUseFuncZ(
|
||||||
if (whichangle)
|
if (whichangle)
|
||||||
{
|
{
|
||||||
calmaOutRHZ(12, CALMA_ANGLE, CALMA_R8, f);
|
calmaOutRHZ(12, CALMA_ANGLE, CALMA_R8, f);
|
||||||
calmaOut8Z((char *)whichangle, f);
|
calmaOut8Z(whichangle, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If array, number of columns and rows in the array */
|
/* If array, number of columns and rows in the array */
|
||||||
|
|
@ -1589,16 +1583,16 @@ calmaWriteUseFuncZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutStructNameZ(
|
calmaOutStructNameZ(type, def, f)
|
||||||
int type,
|
int type;
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
gzFile f)
|
gzFile f;
|
||||||
{
|
{
|
||||||
char *defname;
|
char *defname;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
char *cp;
|
char *cp;
|
||||||
int calmanum;
|
int calmanum;
|
||||||
const char *table;
|
char *table;
|
||||||
|
|
||||||
if (CIFCurStyle->cs_flags & CWF_PERMISSIVE_LABELS)
|
if (CIFCurStyle->cs_flags & CWF_PERMISSIVE_LABELS)
|
||||||
{
|
{
|
||||||
|
|
@ -1608,7 +1602,7 @@ calmaOutStructNameZ(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the def name a legal Calma name? */
|
/* Is the def name a legal Calma name? */
|
||||||
for (cp = def->cd_name; (c = (unsigned char) *cp); cp++)
|
for (cp = def->cd_name; c = (unsigned char) *cp; cp++)
|
||||||
{
|
{
|
||||||
if ((c > 127) || (table[c] == 0))
|
if ((c > 127) || (table[c] == 0))
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
@ -1629,7 +1623,7 @@ calmaOutStructNameZ(
|
||||||
{
|
{
|
||||||
/* Bad name: use XXXXXcalmaNum */
|
/* Bad name: use XXXXXcalmaNum */
|
||||||
bad:
|
bad:
|
||||||
calmanum = (int) CD2INT(def->cd_client);
|
calmanum = (int) def->cd_client;
|
||||||
if (calmanum < 0) calmanum = -calmanum;
|
if (calmanum < 0) calmanum = -calmanum;
|
||||||
defname = (char *)mallocMagic(32);
|
defname = (char *)mallocMagic(32);
|
||||||
(void) sprintf(defname, "XXXXX%d", calmanum);
|
(void) sprintf(defname, "XXXXX%d", calmanum);
|
||||||
|
|
@ -1658,16 +1652,14 @@ bad:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CalmaGenerateArrayZ(
|
CalmaGenerateArrayZ(f, type, llx, lly, pitch, cols, rows)
|
||||||
gzFile f, /* GDS output file */
|
gzFile f; /* GDS output file */
|
||||||
TileType type, /* Magic tile type of contact */
|
TileType type; /* Magic tile type of contact */
|
||||||
int llx,
|
int llx, lly; /* Lower-left hand coordinate of the array
|
||||||
int lly, /* Lower-left hand coordinate of the array
|
|
||||||
* (centered on contact cut)
|
* (centered on contact cut)
|
||||||
*/
|
*/
|
||||||
int pitch, /* Pitch of the array elements */
|
int pitch; /* Pitch of the array elements */
|
||||||
int cols,
|
int cols, rows; /* Number of array elements in X and Y */
|
||||||
int rows) /* Number of array elements in X and Y */
|
|
||||||
{
|
{
|
||||||
CellDef *child; /* Cell definition of the contact cell */
|
CellDef *child; /* Cell definition of the contact cell */
|
||||||
int xxlate, yxlate;
|
int xxlate, yxlate;
|
||||||
|
|
@ -1728,8 +1720,8 @@ CalmaGenerateArrayZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaWriteContactsZ(
|
calmaWriteContactsZ(f)
|
||||||
gzFile f)
|
gzFile f;
|
||||||
{
|
{
|
||||||
TileType type;
|
TileType type;
|
||||||
TileTypeBitMask tMask, *rMask;
|
TileTypeBitMask tMask, *rMask;
|
||||||
|
|
@ -1811,9 +1803,9 @@ calmaWriteContactsZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaProcessBoundaryZ(
|
calmaProcessBoundaryZ(blist, cos)
|
||||||
BoundaryTop *blist,
|
BoundaryTop *blist;
|
||||||
calmaOutputStructZ *cos)
|
calmaOutputStructZ *cos;
|
||||||
{
|
{
|
||||||
gzFile f = cos->f;
|
gzFile f = cos->f;
|
||||||
LinkedBoundary *listtop, *lbref, *lbstop, *lbfree;
|
LinkedBoundary *listtop, *lbref, *lbstop, *lbfree;
|
||||||
|
|
@ -1849,11 +1841,8 @@ calmaProcessBoundaryZ(
|
||||||
calmaOutI4Z(lbref->lb_start.p_y * calmaPaintScale, f);
|
calmaOutI4Z(lbref->lb_start.p_y * calmaPaintScale, f);
|
||||||
chkcount++;
|
chkcount++;
|
||||||
}
|
}
|
||||||
if (listtop != NULL)
|
calmaOutI4Z(listtop->lb_start.p_x * calmaPaintScale, f);
|
||||||
{
|
calmaOutI4Z(listtop->lb_start.p_y * calmaPaintScale, f);
|
||||||
calmaOutI4Z(listtop->lb_start.p_x * calmaPaintScale, f);
|
|
||||||
calmaOutI4Z(listtop->lb_start.p_y * calmaPaintScale, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chkcount != bounds->bt_points)
|
if (chkcount != bounds->bt_points)
|
||||||
TxError("Points recorded=%d; Points written=%d\n",
|
TxError("Points recorded=%d; Points written=%d\n",
|
||||||
|
|
@ -1864,27 +1853,19 @@ calmaProcessBoundaryZ(
|
||||||
|
|
||||||
/* Free the LinkedBoundary list */
|
/* Free the LinkedBoundary list */
|
||||||
|
|
||||||
|
lbref = listtop;
|
||||||
|
while (lbref->lb_next != listtop)
|
||||||
{
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic(lbref);
|
||||||
lbref = listtop;
|
lbref = lbref->lb_next;
|
||||||
while (lbref->lb_next != listtop)
|
|
||||||
{
|
|
||||||
freeMagic1(&mm1, lbref);
|
|
||||||
lbref = lbref->lb_next;
|
|
||||||
}
|
|
||||||
freeMagic1(&mm1, lbref);
|
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
|
freeMagic(lbref);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the BoundaryTop list */
|
/* Free the BoundaryTop list */
|
||||||
|
|
||||||
{
|
for (bounds = blist; bounds != NULL; bounds = bounds->bt_next)
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic(bounds);
|
||||||
for (bounds = blist; bounds != NULL; bounds = bounds->bt_next)
|
|
||||||
freeMagic1(&mm1, bounds);
|
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1902,13 +1883,12 @@ calmaProcessBoundaryZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaMergePaintFuncZ(
|
calmaMergePaintFuncZ(tile, cos)
|
||||||
Tile *tile, /* Tile to be written out. */
|
Tile *tile; /* Tile to be written out. */
|
||||||
TileType dinfo, /* Split tile information (unused) */
|
calmaOutputStructZ *cos; /* Information needed by algorithm */
|
||||||
calmaOutputStructZ *cos) /* Information needed by algorithm */
|
|
||||||
{
|
{
|
||||||
gzFile f = cos->f;
|
gzFile f = cos->f;
|
||||||
const Rect *clipArea = cos->area;
|
Rect *clipArea = cos->area;
|
||||||
Tile *t, *tp;
|
Tile *t, *tp;
|
||||||
TileType ttype;
|
TileType ttype;
|
||||||
int i, llx, lly, urx, ury, intedges, num_points, split_type;
|
int i, llx, lly, urx, ury, intedges, num_points, split_type;
|
||||||
|
|
@ -1920,7 +1900,7 @@ calmaMergePaintFuncZ(
|
||||||
BoundaryTop *bounds = NULL;
|
BoundaryTop *bounds = NULL;
|
||||||
|
|
||||||
/* Quick check for tiles that have already been processed */
|
/* Quick check for tiles that have already been processed */
|
||||||
if (TiGetClientINT(tile) == GDS_PROCESSED) return 0;
|
if (tile->ti_client == (ClientData)GDS_PROCESSED) return 0;
|
||||||
|
|
||||||
if (SegStack == (Stack *)NULL)
|
if (SegStack == (Stack *)NULL)
|
||||||
SegStack = StackNew(64);
|
SegStack = StackNew(64);
|
||||||
|
|
@ -1929,16 +1909,17 @@ calmaMergePaintFuncZ(
|
||||||
while (!StackEmpty(SegStack))
|
while (!StackEmpty(SegStack))
|
||||||
{
|
{
|
||||||
t = (Tile *) STACKPOP(SegStack);
|
t = (Tile *) STACKPOP(SegStack);
|
||||||
if (TiGetClientINT(t) != GDS_PENDING) continue;
|
if (t->ti_client != (ClientData)GDS_PENDING) continue;
|
||||||
TiSetClientINT(t, GDS_PROCESSED);
|
t->ti_client = (ClientData)GDS_PROCESSED;
|
||||||
|
|
||||||
split_type = -1;
|
split_type = -1;
|
||||||
if (IsSplit(t))
|
if (IsSplit(t))
|
||||||
{
|
{
|
||||||
/* If we use TT_SIDE, then we need to set it when the */
|
/* If we use SplitSide, then we need to set it when the */
|
||||||
/* tile is pushed. Since these are one-or-zero mask layers */
|
/* tile is pushed. Since these are one-or-zero mask layers */
|
||||||
/* I assume it is okay to just check which side is TT_SPACE */
|
/* I assume it is okay to just check which side is TT_SPACE */
|
||||||
|
|
||||||
|
/* split_type = (SplitSide(t) << 1) | SplitDirection(t); */
|
||||||
split_type = SplitDirection(t);
|
split_type = SplitDirection(t);
|
||||||
if (TiGetLeftType(t) == TT_SPACE) split_type |= 2;
|
if (TiGetLeftType(t) == TT_SPACE) split_type |= 2;
|
||||||
num_points = 2;
|
num_points = 2;
|
||||||
|
|
@ -1950,10 +1931,8 @@ calmaMergePaintFuncZ(
|
||||||
lb = edge;
|
lb = edge;
|
||||||
while (lb->lb_next != edge) lb = lb->lb_next;
|
while (lb->lb_next != edge) lb = lb->lb_next;
|
||||||
lb->lb_next = edge->lb_next;
|
lb->lb_next = edge->lb_next;
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic(edge);
|
||||||
freeMagic1(&mm1, edge);
|
|
||||||
edge = edge->lb_next;
|
edge = edge->lb_next;
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -2161,9 +2140,7 @@ right_search:
|
||||||
done_searches:
|
done_searches:
|
||||||
if (intedges == 0)
|
if (intedges == 0)
|
||||||
{
|
{
|
||||||
calmaWritePaintFuncZ(t,
|
calmaWritePaintFuncZ(t, cos);
|
||||||
(split_type & 2) ? (TileType)TT_SIDE : (TileType)0,
|
|
||||||
cos);
|
|
||||||
|
|
||||||
/* Although calmaWritePaintFunc is called only on isolated */
|
/* Although calmaWritePaintFunc is called only on isolated */
|
||||||
/* tiles, we may have expanded it. This could use a LOT of */
|
/* tiles, we may have expanded it. This could use a LOT of */
|
||||||
|
|
@ -2174,13 +2151,11 @@ done_searches:
|
||||||
|
|
||||||
if (num_points != 4)
|
if (num_points != 4)
|
||||||
{
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (i = 0; i < num_points; i++)
|
for (i = 0; i < num_points; i++)
|
||||||
{
|
{
|
||||||
freeMagic1(&mm1, edge);
|
freeMagic(edge);
|
||||||
edge = edge->lb_next;
|
edge = edge->lb_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
edge = NULL;
|
edge = NULL;
|
||||||
}
|
}
|
||||||
if (!StackEmpty(SegStack))
|
if (!StackEmpty(SegStack))
|
||||||
|
|
@ -2231,13 +2206,12 @@ done_searches:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaWritePaintFuncZ(
|
calmaWritePaintFuncZ(tile, cos)
|
||||||
Tile *tile, /* Tile to be written out. */
|
Tile *tile; /* Tile to be written out. */
|
||||||
TileType dinfo, /* Split tile information */
|
calmaOutputStructZ *cos; /* File for output and clipping area */
|
||||||
calmaOutputStructZ *cos) /* File for output and clipping area */
|
|
||||||
{
|
{
|
||||||
gzFile f = cos->f;
|
gzFile f = cos->f;
|
||||||
const Rect *clipArea = cos->area;
|
Rect *clipArea = cos->area;
|
||||||
Rect r, r2;
|
Rect r, r2;
|
||||||
|
|
||||||
TiToRect(tile, &r);
|
TiToRect(tile, &r);
|
||||||
|
|
@ -2269,7 +2243,7 @@ calmaWritePaintFuncZ(
|
||||||
/* Coordinates */
|
/* Coordinates */
|
||||||
calmaOutRHZ(36, CALMA_XY, CALMA_I4, f);
|
calmaOutRHZ(36, CALMA_XY, CALMA_I4, f);
|
||||||
|
|
||||||
switch (((dinfo & TT_SIDE) ? 2 : 0) | SplitDirection(tile))
|
switch ((SplitSide(tile) << 1) | SplitDirection(tile))
|
||||||
{
|
{
|
||||||
case 0x0:
|
case 0x0:
|
||||||
calmaOutI4Z(r.r_xbot, f); calmaOutI4Z(r.r_ybot, f);
|
calmaOutI4Z(r.r_xbot, f); calmaOutI4Z(r.r_ybot, f);
|
||||||
|
|
@ -2337,13 +2311,13 @@ calmaWritePaintFuncZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaWriteLabelFuncZ(
|
calmaWriteLabelFuncZ(lab, ltype, type, f)
|
||||||
Label *lab, /* Label to output */
|
Label *lab; /* Label to output */
|
||||||
int ltype, /* CIF layer number to use for TEXT record */
|
int ltype; /* CIF layer number to use for TEXT record */
|
||||||
int type, /* CIF layer number to use for BOUNDARY record,
|
int type; /* CIF layer number to use for BOUNDARY record,
|
||||||
* or -1 if not attached to a layer
|
* or -1 if not attached to a layer
|
||||||
*/
|
*/
|
||||||
gzFile f) /* Stream file */
|
gzFile f; /* Stream file */
|
||||||
{
|
{
|
||||||
Point p;
|
Point p;
|
||||||
int calmanum, calmatype;
|
int calmanum, calmatype;
|
||||||
|
|
@ -2508,13 +2482,12 @@ calmaWriteLabelFuncZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaPaintLabelFuncZ(
|
calmaPaintLabelFuncZ(tile, cos)
|
||||||
Tile *tile, /* Tile contains area for label. */
|
Tile *tile; /* Tile contains area for label. */
|
||||||
TileType dinfo, /* Split tile information (unused) */
|
calmaOutputStructZ *cos; /* File for output and clipping area */
|
||||||
calmaOutputStructZ *cos) /* File for output and clipping area */
|
|
||||||
{
|
{
|
||||||
gzFile f = cos->f;
|
gzFile f = cos->f;
|
||||||
const Rect *clipArea = cos->area;
|
Rect *clipArea = cos->area;
|
||||||
Rect r, r2;
|
Rect r, r2;
|
||||||
Point p;
|
Point p;
|
||||||
int len;
|
int len;
|
||||||
|
|
@ -2570,9 +2543,9 @@ calmaPaintLabelFuncZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutHeaderZ(
|
calmaOutHeaderZ(rootDef, f)
|
||||||
CellDef *rootDef,
|
CellDef *rootDef;
|
||||||
gzFile f)
|
gzFile f;
|
||||||
{
|
{
|
||||||
static double useru = 0.001;
|
static double useru = 0.001;
|
||||||
static double mum = 1.0e-9;
|
static double mum = 1.0e-9;
|
||||||
|
|
@ -2631,9 +2604,9 @@ calmaOutHeaderZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutDateZ(
|
calmaOutDateZ(t, f)
|
||||||
time_t t, /* Time (UNIX format) to be output */
|
time_t t; /* Time (UNIX format) to be output */
|
||||||
gzFile f) /* Stream file */
|
gzFile f; /* Stream file */
|
||||||
{
|
{
|
||||||
struct tm *datep = localtime(&t);
|
struct tm *datep = localtime(&t);
|
||||||
|
|
||||||
|
|
@ -2666,15 +2639,14 @@ calmaOutDateZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutStringRecordZ(
|
calmaOutStringRecordZ(type, str, f)
|
||||||
int type, /* Type of this record (data type is ASCII string) */
|
int type; /* Type of this record (data type is ASCII string) */
|
||||||
char *str, /* String to be output */
|
char *str; /* String to be output */
|
||||||
gzFile f) /* Compressed stream file */
|
gzFile f; /* Compressed stream file */
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
const char *table;
|
char *table, *locstr, *origstr = NULL;
|
||||||
char *locstr, *origstr = NULL;
|
|
||||||
char *locstrprv;
|
char *locstrprv;
|
||||||
|
|
||||||
if(CIFCurStyle->cs_flags & CWF_PERMISSIVE_LABELS)
|
if(CIFCurStyle->cs_flags & CWF_PERMISSIVE_LABELS)
|
||||||
|
|
@ -2768,9 +2740,9 @@ calmaOutStringRecordZ(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOutR8Z(
|
calmaOutR8Z(d, f)
|
||||||
double d, /* Double value to write to output */
|
double d; /* Double value to write to output */
|
||||||
gzFile f) /* Stream file */
|
gzFile f; /* Stream file */
|
||||||
{
|
{
|
||||||
int c, i, sign, expon;
|
int c, i, sign, expon;
|
||||||
|
|
||||||
|
|
@ -2843,9 +2815,9 @@ calmaOutR8Z(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
calmaOut8Z(
|
calmaOut8Z(str, f)
|
||||||
const char *str, /* 8-byte string to be output */
|
char *str; /* 8-byte string to be output */
|
||||||
gzFile f) /* Compressed stream file */
|
gzFile f; /* Compressed stream file */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
* rcsid $Header: /usr/cvsroot/magic-8.0/calma/calma.h,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $
|
* rcsid $Header: /usr/cvsroot/magic-8.0/calma/calma.h,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAGIC__CALMA__CALMA_H
|
#ifndef _CALMA_H
|
||||||
#define _MAGIC__CALMA__CALMA_H
|
#define _CALMA_H
|
||||||
|
|
||||||
#include "utils/magic.h"
|
#include "utils/magic.h"
|
||||||
|
|
||||||
|
|
@ -38,7 +38,6 @@ extern TileTypeBitMask *CalmaMaskHints;
|
||||||
extern bool CalmaMergeTiles;
|
extern bool CalmaMergeTiles;
|
||||||
extern bool CalmaFlattenArrays;
|
extern bool CalmaFlattenArrays;
|
||||||
extern bool CalmaNoDRCCheck;
|
extern bool CalmaNoDRCCheck;
|
||||||
extern bool CalmaRecordPaths;
|
|
||||||
extern bool CalmaFlattenUses;
|
extern bool CalmaFlattenUses;
|
||||||
extern int CalmaFlattenLimit;
|
extern int CalmaFlattenLimit;
|
||||||
extern float CalmaMagScale;
|
extern float CalmaMagScale;
|
||||||
|
|
@ -62,42 +61,42 @@ extern bool CalmaAllowAbstract;
|
||||||
#define CALMA_POLYGON_KEEP 2
|
#define CALMA_POLYGON_KEEP 2
|
||||||
|
|
||||||
/* Externally-visible procedures: */
|
/* Externally-visible procedures: */
|
||||||
extern bool CalmaWrite(CellDef *rootDef, FILE *f);
|
extern bool CalmaWrite();
|
||||||
extern void CalmaReadFile(FILETYPE file, char *filename);
|
extern void CalmaReadFile();
|
||||||
extern void CalmaTechInit(void);
|
extern void CalmaTechInit();
|
||||||
extern bool CalmaGenerateArray(FILE *f, TileType type, int llx, int lly, int pitch, int cols, int rows);
|
extern bool CalmaGenerateArray();
|
||||||
extern void CalmaReadError(const char *format, ...) ATTR_FORMAT_PRINTF_1;
|
extern void CalmaReadError(char *format, ...);
|
||||||
|
|
||||||
/* C99 compat */
|
/* C99 compat */
|
||||||
extern void calmaDelContacts(void);
|
extern int calmaAddSegment();
|
||||||
extern void calmaElementBoundary(void);
|
extern void calmaDelContacts();
|
||||||
extern void calmaElementBox(void);
|
extern void calmaElementBoundary();
|
||||||
extern void calmaElementPath(void);
|
extern void calmaElementBox();
|
||||||
extern void calmaElementText(void);
|
extern void calmaElementPath();
|
||||||
extern bool calmaIsUseNameDefault(char *defName, char *useName);
|
extern void calmaElementText();
|
||||||
extern bool calmaParseStructure(char *filename);
|
extern bool calmaIsUseNameDefault();
|
||||||
extern int calmaProcessDef(CellDef *def, FILE *outf, bool do_library);
|
extern bool calmaParseStructure();
|
||||||
#ifdef HAVE_ZLIB
|
extern int calmaProcessDef();
|
||||||
extern int calmaProcessDefZ(CellDef *def, gzFile outf, bool do_library);
|
extern int calmaProcessDefZ();
|
||||||
#endif
|
extern bool calmaReadI2Record();
|
||||||
extern bool calmaReadI2Record(int type, int *pvalue);
|
extern bool calmaReadI4Record();
|
||||||
extern bool calmaReadI4Record(int type, int *pvalue);
|
extern void calmaReadPoint();
|
||||||
extern void calmaReadX(Point *p, int iscale);
|
extern bool calmaReadR8();
|
||||||
extern void calmaReadY(Point *p, int iscale);
|
extern bool calmaReadStampRecord();
|
||||||
extern void calmaReadPoint(Point *p, int iscale);
|
extern bool calmaReadStringRecord();
|
||||||
extern bool calmaReadR8(double *pd);
|
extern bool calmaReadStringRecord();
|
||||||
extern bool calmaReadStampRecord(int type, int *stampptr);
|
extern bool calmaReadTransform();
|
||||||
extern bool calmaReadStringRecord(int type, char **str);
|
extern bool calmaSkipBytes();
|
||||||
extern bool calmaReadStringRecord(int type, char **str);
|
extern bool calmaSkipExact();
|
||||||
extern bool calmaReadTransform(Transform *ptrans, char *name);
|
extern bool calmaSkipTo();
|
||||||
extern bool calmaSkipBytes(int nbytes);
|
extern void calmaUnexpected();
|
||||||
extern bool calmaSkipExact(int type);
|
extern void calmaMergeSegments();
|
||||||
extern bool calmaSkipTo(int what);
|
extern void calmaRemoveDegenerate();
|
||||||
extern void calmaUnexpected(int wanted, int got);
|
extern void calmaRemoveColinear();
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
extern bool CalmaWriteZ(CellDef *rootDef, gzFile f);
|
extern bool CalmaWriteZ();
|
||||||
extern bool CalmaGenerateArrayZ(gzFile f, TileType type, int llx, int lly, int pitch, int cols, int rows);
|
extern bool CalmaGenerateArrayZ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _MAGIC__CALMA__CALMA_H */
|
#endif /* _CALMA_H */
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
* rcsid $Header: /usr/cvsroot/magic-8.0/calma/calmaInt.h,v 1.2 2010/06/24 12:37:15 tim Exp $
|
* rcsid $Header: /usr/cvsroot/magic-8.0/calma/calmaInt.h,v 1.2 2010/06/24 12:37:15 tim Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAGIC__CALMA__CALMAINT_H
|
#ifndef _CALMAINT_H
|
||||||
#define _MAGIC__CALMA__CALMAINT_H
|
#define _CALMAINT_H
|
||||||
|
|
||||||
#include "utils/magic.h"
|
#include "utils/magic.h"
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
|
|
@ -131,11 +131,8 @@ typedef struct
|
||||||
/* Length of record header */
|
/* Length of record header */
|
||||||
#define CALMAHEADERLENGTH 4
|
#define CALMAHEADERLENGTH 4
|
||||||
|
|
||||||
/* Label types
|
/* Label types */
|
||||||
* The intention is all the values can be stored/converted with unsigned char type,
|
typedef enum { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT, LABEL_TYPE_CELLID } labelType;
|
||||||
* C23 allows us to be explicit with the type but C99 does not, so a comment for now.
|
|
||||||
*/
|
|
||||||
typedef enum /* : unsigned char */ { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT, LABEL_TYPE_CELLID } labelType;
|
|
||||||
|
|
||||||
/* ------------------------- Input macros ----------------------------- */
|
/* ------------------------- Input macros ----------------------------- */
|
||||||
|
|
||||||
|
|
@ -229,42 +226,20 @@ typedef struct portlabel
|
||||||
|
|
||||||
/* Other commonly used globals */
|
/* Other commonly used globals */
|
||||||
extern HashTable calmaLayerHash;
|
extern HashTable calmaLayerHash;
|
||||||
extern const int calmaElementIgnore[];
|
extern int calmaElementIgnore[];
|
||||||
extern CellDef *calmaFindCell(const char *name, bool *was_called, bool *predefined);
|
extern CellDef *calmaFindCell();
|
||||||
|
|
||||||
/* (Added by Nishit, 8/18/2004--8/24/2004) */
|
/* (Added by Nishit, 8/18/2004--8/24/2004) */
|
||||||
extern CellDef *calmaLookCell(char *name);
|
extern CellDef *calmaLookCell();
|
||||||
extern void calmaWriteContacts(FILE *f);
|
extern void calmaWriteContact();
|
||||||
extern CellDef *calmaGetContactCell(TileType type, bool lookOnly);
|
extern CellDef *calmaGetContactCell();
|
||||||
extern bool calmaIsContactCell;
|
extern bool calmaIsContactCell;
|
||||||
|
|
||||||
extern const char *calmaRecordName(int rtype);
|
extern char *calmaRecordName();
|
||||||
extern void calmaSkipSet(const int *skipwhat);
|
extern void calmaSkipSet();
|
||||||
extern bool calmaParseUnits(void);
|
extern bool calmaParseUnits();
|
||||||
|
|
||||||
extern int compport(const void *one, const void *two);
|
extern int compport();
|
||||||
|
|
||||||
|
|
||||||
#define LB_EXTERNAL 0 /* Polygon external edge */
|
|
||||||
#define LB_INTERNAL 1 /* Polygon internal edge */
|
|
||||||
#define LB_INIT 2 /* Data not yet valid */
|
|
||||||
|
|
||||||
typedef struct LB1 {
|
|
||||||
char lb_type; /* Boundary Type (external or internal) */
|
|
||||||
Point lb_start; /* Start point */
|
|
||||||
struct LB1 *lb_next; /* Next point record */
|
|
||||||
} LinkedBoundary;
|
|
||||||
|
|
||||||
typedef struct BT1 {
|
|
||||||
LinkedBoundary *bt_first; /* Polygon list */
|
|
||||||
int bt_points; /* Number of points in this list */
|
|
||||||
struct BT1 *bt_next; /* Next polygon record */
|
|
||||||
} BoundaryTop;
|
|
||||||
|
|
||||||
extern int calmaAddSegment(LinkedBoundary **lbptr, bool poly_edge, int p1x, int p1y, int p2x, int p2y);
|
|
||||||
extern void calmaMergeSegments(LinkedBoundary *edge, BoundaryTop **blist, int num_points);
|
|
||||||
extern void calmaRemoveDegenerate(BoundaryTop *blist);
|
|
||||||
extern void calmaRemoveColinear(BoundaryTop *blist);
|
|
||||||
|
|
||||||
/* ------------------- Imports from CIF reading ----------------------- */
|
/* ------------------- Imports from CIF reading ----------------------- */
|
||||||
|
|
||||||
|
|
@ -274,4 +249,4 @@ extern Plane **cifCurReadPlanes;
|
||||||
extern HashTable CifCellTable;
|
extern HashTable CifCellTable;
|
||||||
extern Plane *cifEditCellPlanes[];
|
extern Plane *cifEditCellPlanes[];
|
||||||
|
|
||||||
#endif /* _MAGIC__CALMA__CALMAINT_H */
|
#endif /* _CALMAINT_H */
|
||||||
|
|
|
||||||
1632
cif/CIFgen.c
1632
cif/CIFgen.c
File diff suppressed because it is too large
Load Diff
331
cif/CIFhier.c
331
cif/CIFhier.c
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFhier.c,v 1.3 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFhier.c,v 1.3 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -107,7 +107,7 @@ static CIFLayer *CurCifLayer;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFInitCells(void)
|
CIFInitCells()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ CIFInitCells(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifHierCleanup(void)
|
cifHierCleanup()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -209,41 +209,52 @@ typedef struct _maskHintsData
|
||||||
{
|
{
|
||||||
Transform *mh_trans;
|
Transform *mh_trans;
|
||||||
CellDef *mh_def;
|
CellDef *mh_def;
|
||||||
Plane *mh_plane;
|
|
||||||
} MaskHintsData;
|
} MaskHintsData;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* cifCopyMaskHintFunc --
|
* cifMaskHints --
|
||||||
*
|
*
|
||||||
* Callback function used by cifFlatMaskHints. Transforms a tile
|
* Copy a mask hint into a target cell by adding it to the
|
||||||
* from the original plane and paints it into the target plane,
|
* property list of the target cell. If the target cell already
|
||||||
* both of which are properties.
|
* has the same mask hint key, then the mask hint value is
|
||||||
|
* appended to the property in the target cell def.
|
||||||
*
|
*
|
||||||
* Results:
|
* Returns:
|
||||||
* Zero to keep the search going.
|
* 0 to keep the search going.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* Paints geometry into the target plane.
|
* Modifies properties of the target cell def.
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* DEPRECATED */
|
||||||
int
|
int
|
||||||
cifCopyMaskHintFunc(Tile *tile,
|
cifMaskHints(name, value, targetDef)
|
||||||
TileType dinfo,
|
char *name;
|
||||||
ClientData cdata)
|
char *value;
|
||||||
|
CellDef *targetDef;
|
||||||
{
|
{
|
||||||
MaskHintsData *mhd = (MaskHintsData *)cdata;
|
char *propvalue, *newval;
|
||||||
Rect r, newr;
|
bool propfound;
|
||||||
|
|
||||||
TiToRect(tile, &r);
|
if (!strncmp(name, "MASKHINTS_", 10))
|
||||||
|
{
|
||||||
/* Transform tile area to coordinates of mhd->mh_plane and paint */
|
/* Check if name exists already in the flattened cell */
|
||||||
GeoTransRect(mhd->mh_trans, &r, &newr);
|
propvalue = (char *)DBPropGet(targetDef, name, &propfound);
|
||||||
DBPaintPlane(mhd->mh_plane, &newr, CIFPaintTable, (PaintUndoInfo *)NULL);
|
if (propfound)
|
||||||
|
{
|
||||||
|
/* Append value to the property */
|
||||||
|
newval = mallocMagic(strlen(value) + strlen(propvalue) + 2);
|
||||||
|
sprintf(newval, "%s %s", propvalue, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newval = StrDup((char **)NULL, value);
|
||||||
|
|
||||||
|
DBPropPut(targetDef, name, newval);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -253,8 +264,8 @@ cifCopyMaskHintFunc(Tile *tile,
|
||||||
* cifFlatMaskHints --
|
* cifFlatMaskHints --
|
||||||
*
|
*
|
||||||
* Copy a mask hint into a flattened cell by transforming it into the
|
* Copy a mask hint into a flattened cell by transforming it into the
|
||||||
* coordinate system of the flattened cell, and painting it into the
|
* coordinate system of the flattened cell, and adding it to the
|
||||||
* property plane of the flattened cell.
|
* property list of the flattened cell.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 to keep the search going.
|
* 0 to keep the search going.
|
||||||
|
|
@ -266,42 +277,62 @@ cifCopyMaskHintFunc(Tile *tile,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifFlatMaskHints(
|
cifFlatMaskHints(name, value, mhd)
|
||||||
char *name,
|
char *name;
|
||||||
PropertyRecord *proprec,
|
char *value;
|
||||||
MaskHintsData *mhd)
|
MaskHintsData *mhd;
|
||||||
{
|
{
|
||||||
Rect r, newr;
|
Rect r, newr;
|
||||||
char *vptr, *newval, *lastval, *propvalue;
|
char *vptr, *newval, *lastval, *propvalue;
|
||||||
bool propfound;
|
bool propfound;
|
||||||
int i, lastlen, numvals;
|
int lastlen;
|
||||||
PropertyRecord *newproprec, *oldproprec;
|
|
||||||
Plane *plane;
|
|
||||||
|
|
||||||
if (!strncmp(name, "MASKHINTS_", 10))
|
if (!strncmp(name, "MASKHINTS_", 10))
|
||||||
{
|
{
|
||||||
/* Check if name exists already in the flattened cell */
|
newval = (char *)NULL;
|
||||||
oldproprec = (PropertyRecord *)DBPropGet(mhd->mh_def, name, &propfound);
|
vptr = value;
|
||||||
if (propfound)
|
while (*vptr != '\0')
|
||||||
{
|
{
|
||||||
ASSERT(oldproprec->prop_type == PROPERTY_TYPE_PLANE,
|
if (sscanf(vptr, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||||
"cifFlatMaskHints");
|
&r.r_xtop, &r.r_ytop) == 4)
|
||||||
plane = oldproprec->prop_value.prop_plane;
|
{
|
||||||
}
|
/* Transform rectangle to top level coordinates */
|
||||||
else
|
GeoTransRect(mhd->mh_trans, &r, &newr);
|
||||||
{
|
lastval = newval;
|
||||||
newproprec = (PropertyRecord *)mallocMagic(sizeof(PropertyRecord));
|
lastlen = (lastval) ? strlen(lastval) : 0;
|
||||||
newproprec->prop_len = 0; /* (unused) */
|
newval = mallocMagic(40 + lastlen);
|
||||||
newproprec->prop_type = PROPERTY_TYPE_PLANE;
|
if (lastval)
|
||||||
plane = DBNewPlane((ClientData)TT_SPACE);
|
strcpy(newval, lastval);
|
||||||
newproprec->prop_value.prop_plane = plane;
|
else
|
||||||
DBPropPut(mhd->mh_def, name, newproprec);
|
*newval = '\0';
|
||||||
|
sprintf(newval + lastlen, "%s%d %d %d %d", (lastval) ? " " : "",
|
||||||
|
newr.r_xbot, newr.r_ybot, newr.r_xtop, newr.r_ytop);
|
||||||
|
if (lastval) freeMagic(lastval);
|
||||||
|
|
||||||
|
/* Parse through the four values and check if there's more */
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mhd->mh_plane = plane;
|
/* Check if name exists already in the flattened cell */
|
||||||
DBSrPaintArea((Tile *)NULL, proprec->prop_value.prop_plane,
|
propvalue = (char *)DBPropGet(mhd->mh_def, name, &propfound);
|
||||||
&TiPlaneRect, &CIFSolidBits,
|
if (propfound)
|
||||||
cifCopyMaskHintFunc, (ClientData)mhd);
|
{
|
||||||
|
/* Append newval to the property */
|
||||||
|
lastval = newval;
|
||||||
|
newval = mallocMagic(strlen(lastval) + strlen(propvalue) + 2);
|
||||||
|
sprintf(newval, "%s %s", propvalue, lastval);
|
||||||
|
freeMagic(lastval);
|
||||||
|
}
|
||||||
|
DBPropPut(mhd->mh_def, name, newval);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -312,10 +343,9 @@ cifFlatMaskHints(
|
||||||
* CIFCopyMaskHints --
|
* CIFCopyMaskHints --
|
||||||
*
|
*
|
||||||
* Callback function to copy mask hints from one cell into another.
|
* Callback function to copy mask hints from one cell into another.
|
||||||
* (Occasionally called as a standalone function, not as a callback.)
|
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* Return 0 to keep the search going.
|
* None.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* May modify properties in the target cell.
|
* May modify properties in the target cell.
|
||||||
|
|
@ -323,19 +353,48 @@ cifFlatMaskHints(
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
void
|
||||||
CIFCopyMaskHints(
|
CIFCopyMaskHints(scx, targetDef)
|
||||||
SearchContext *scx,
|
SearchContext *scx;
|
||||||
CellDef *targetDef)
|
CellDef *targetDef;
|
||||||
{
|
{
|
||||||
MaskHintsData mhd;
|
MaskHintsData mhd;
|
||||||
|
|
||||||
CellDef *sourceDef = scx->scx_use->cu_def;
|
CellDef *sourceDef = scx->scx_use->cu_def;
|
||||||
mhd.mh_trans = &scx->scx_trans;
|
mhd.mh_trans = &scx->scx_trans;
|
||||||
mhd.mh_def = targetDef;
|
mhd.mh_def = targetDef;
|
||||||
mhd.mh_plane = (Plane *)NULL;
|
|
||||||
|
|
||||||
DBPropEnum(sourceDef, cifFlatMaskHints, &mhd);
|
DBPropEnum(sourceDef, cifFlatMaskHints, &mhd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* cifHierCopyMaskHints --
|
||||||
|
*
|
||||||
|
* Callback function to copy mask hints from a subcell into a flattened
|
||||||
|
* cell, which is passed in the clientData record.
|
||||||
|
*
|
||||||
|
* Results:
|
||||||
|
* Always returns 0 to keep the search alive.
|
||||||
|
*
|
||||||
|
* Side effects:
|
||||||
|
* May modify properties in the flattened cell.
|
||||||
|
*
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
cifHierCopyMaskHints(scx, clientData)
|
||||||
|
SearchContext *scx;
|
||||||
|
ClientData clientData;
|
||||||
|
{
|
||||||
|
MaskHintsData mhd;
|
||||||
|
|
||||||
|
mhd.mh_trans = &scx->scx_trans;
|
||||||
|
mhd.mh_def = (CellDef *)clientData;
|
||||||
|
|
||||||
|
DBPropEnum(scx->scx_use->cu_def, cifFlatMaskHints, &mhd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -365,18 +424,17 @@ CIFCopyMaskHints(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierCopyFunc(
|
cifHierCopyFunc(tile, cxp)
|
||||||
Tile *tile, /* Pointer to tile to copy. */
|
Tile *tile; /* Pointer to tile to copy. */
|
||||||
TileType dinfo, /* Split tile information */
|
TreeContext *cxp; /* Describes context of search, including
|
||||||
TreeContext *cxp) /* Describes context of search, including
|
|
||||||
* transform and client data.
|
* transform and client data.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TileType type = TiGetTypeExact(tile) | dinfo;
|
TileType type = TiGetTypeExact(tile);
|
||||||
Rect sourceRect, targetRect;
|
Rect sourceRect, targetRect;
|
||||||
int pNum;
|
int pNum;
|
||||||
CellDef *def = (CellDef *) cxp->tc_filter->tf_arg;
|
CellDef *def = (CellDef *) cxp->tc_filter->tf_arg;
|
||||||
TileType newdinfo = 0;
|
int dinfo = 0;
|
||||||
|
|
||||||
/* Ignore tiles in vendor GDS, unless this is specifically */
|
/* Ignore tiles in vendor GDS, unless this is specifically */
|
||||||
/* overridden by the "see-vendor" option. */
|
/* overridden by the "see-vendor" option. */
|
||||||
|
|
@ -392,8 +450,8 @@ cifHierCopyFunc(
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
newdinfo = DBTransformDiagonal(type, &cxp->tc_scx->scx_trans);
|
dinfo = DBTransformDiagonal(type, &cxp->tc_scx->scx_trans);
|
||||||
type = (dinfo & TT_SIDE) ? SplitRightType(tile) :
|
type = (SplitSide(tile)) ? SplitRightType(tile) :
|
||||||
SplitLeftType(tile);
|
SplitLeftType(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -408,7 +466,7 @@ cifHierCopyFunc(
|
||||||
{
|
{
|
||||||
if (DBPaintOnPlane(type, pNum))
|
if (DBPaintOnPlane(type, pNum))
|
||||||
{
|
{
|
||||||
DBNMPaintPlane(def->cd_planes[pNum], newdinfo, &targetRect,
|
DBNMPaintPlane(def->cd_planes[pNum], dinfo, &targetRect,
|
||||||
DBStdPaintTbl(type, pNum), (PaintUndoInfo *) NULL);
|
DBStdPaintTbl(type, pNum), (PaintUndoInfo *) NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -435,8 +493,8 @@ cifHierCopyFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierCellFunc(
|
cifHierCellFunc(scx)
|
||||||
SearchContext *scx) /* Describes cell and area in cell. */
|
SearchContext *scx; /* Describes cell and area in cell. */
|
||||||
{
|
{
|
||||||
SearchContext newscx;
|
SearchContext newscx;
|
||||||
Rect rootArea;
|
Rect rootArea;
|
||||||
|
|
@ -460,7 +518,7 @@ cifHierCellFunc(
|
||||||
|
|
||||||
/* Flatten mask hints in the area of interest */
|
/* Flatten mask hints in the area of interest */
|
||||||
CIFCopyMaskHints(scx, CIFComponentDef);
|
CIFCopyMaskHints(scx, CIFComponentDef);
|
||||||
DBTreeSrCells(&newscx, 0, CIFCopyMaskHints,
|
DBTreeSrCells(&newscx, 0, cifHierCopyMaskHints,
|
||||||
(ClientData)CIFComponentDef);
|
(ClientData)CIFComponentDef);
|
||||||
|
|
||||||
/* Set CIFErrorDef to NULL to ignore errors here... these will
|
/* Set CIFErrorDef to NULL to ignore errors here... these will
|
||||||
|
|
@ -495,13 +553,11 @@ cifHierCellFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierErrorFunc(
|
cifHierErrorFunc(tile, checkArea)
|
||||||
Tile *tile, /* Tile that covers area it shouldn't. */
|
Tile *tile; /* Tile that covers area it shouldn't. */
|
||||||
TileType dinfo, /* Split tile information */
|
Rect *checkArea; /* Intersection of this and tile is error. */
|
||||||
Rect *checkArea) /* Intersection of this and tile is error. */
|
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
bool side = (dinfo & TT_SIDE) ? TRUE : FALSE;
|
|
||||||
|
|
||||||
TiToRect(tile, &area);
|
TiToRect(tile, &area);
|
||||||
|
|
||||||
|
|
@ -509,8 +565,8 @@ cifHierErrorFunc(
|
||||||
* space bounds the checkArea.
|
* space bounds the checkArea.
|
||||||
*/
|
*/
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
if (((area.r_xbot == checkArea->r_xbot) && !side) ||
|
if (((area.r_xbot == checkArea->r_xbot) && !SplitSide(tile)) ||
|
||||||
((area.r_xtop == checkArea->r_xtop) && side))
|
((area.r_xtop == checkArea->r_xtop) && SplitSide(tile)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
GeoClip(&area, checkArea);
|
GeoClip(&area, checkArea);
|
||||||
|
|
@ -539,10 +595,9 @@ cifHierErrorFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierCheckFunc(
|
cifHierCheckFunc(tile, plane)
|
||||||
Tile *tile, /* Tile containing CIF. */
|
Tile *tile; /* Tile containing CIF. */
|
||||||
TileType dinfo, /* Split tile information */
|
Plane *plane; /* Plane to check against and modify. */
|
||||||
Plane *plane) /* Plane to check against and modify. */
|
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
|
|
||||||
|
|
@ -550,10 +605,10 @@ cifHierCheckFunc(
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
DBSrPaintNMArea((Tile *)NULL, plane, TiGetTypeExact(tile) | dinfo,
|
DBSrPaintNMArea((Tile *)NULL, plane, TiGetTypeExact(tile),
|
||||||
&area, &DBSpaceBits, cifHierErrorFunc, (ClientData) &area);
|
&area, &DBSpaceBits, cifHierErrorFunc, (ClientData) &area);
|
||||||
|
|
||||||
DBNMPaintPlane(plane, TiGetTypeExact(tile) | dinfo, &area, CIFEraseTable,
|
DBNMPaintPlane(plane, TiGetTypeExact(tile), &area, CIFEraseTable,
|
||||||
(PaintUndoInfo *) NULL);
|
(PaintUndoInfo *) NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -587,17 +642,16 @@ cifHierCheckFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierTempCheckFunc(
|
cifHierTempCheckFunc(tile, plane)
|
||||||
Tile *tile, /* Tile containing CIF. */
|
Tile *tile; /* Tile containing CIF. */
|
||||||
TileType dinfo, /* Information about split tiles */
|
Plane *plane; /* Plane to check against and modify. */
|
||||||
Plane *plane) /* Plane to check against and modify. */
|
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
|
|
||||||
TiToRect(tile, &area);
|
TiToRect(tile, &area);
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
DBNMPaintPlane(plane, TiGetTypeExact(tile) | dinfo, &area, CIFEraseTable,
|
DBNMPaintPlane(plane, TiGetTypeExact(tile), &area, CIFEraseTable,
|
||||||
(PaintUndoInfo *) NULL);
|
(PaintUndoInfo *) NULL);
|
||||||
else
|
else
|
||||||
DBPaintPlane(plane, &area, CIFEraseTable, (PaintUndoInfo *) NULL);
|
DBPaintPlane(plane, &area, CIFEraseTable, (PaintUndoInfo *) NULL);
|
||||||
|
|
@ -623,19 +677,18 @@ cifHierTempCheckFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierPaintFunc(
|
cifHierPaintFunc(tile, plane)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo, /* Information about split tiles */
|
Plane *plane; /* Plane in which to paint CIF over tile's
|
||||||
Plane *plane) /* Plane in which to paint CIF over tile's
|
|
||||||
* area.
|
* area.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
|
|
||||||
TiToRect(tile, &area);
|
TiToRect(tile, &area);
|
||||||
if (CIFCurStyle->cs_flags & CWF_GROW_SLIVERS) cifGrowSliver(tile, dinfo, &area);
|
if (CIFCurStyle->cs_flags & CWF_GROW_SLIVERS) cifGrowSliver(tile, &area);
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
DBNMPaintPlane(plane, TiGetTypeExact(tile) | dinfo, &area, CIFPaintTable,
|
DBNMPaintPlane(plane, TiGetTypeExact(tile), &area, CIFPaintTable,
|
||||||
(PaintUndoInfo *) NULL);
|
(PaintUndoInfo *) NULL);
|
||||||
else
|
else
|
||||||
DBPaintPlane(plane, &area, CIFPaintTable, (PaintUndoInfo *) NULL);
|
DBPaintPlane(plane, &area, CIFPaintTable, (PaintUndoInfo *) NULL);
|
||||||
|
|
@ -665,8 +718,8 @@ cifHierPaintFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifCheckAndErase(
|
cifCheckAndErase(style)
|
||||||
CIFStyle *style) /* Describes how to make CIF. */
|
CIFStyle *style; /* Describes how to make CIF. */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -706,10 +759,10 @@ cifCheckAndErase(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFGenSubcells(
|
CIFGenSubcells(def, area, output)
|
||||||
CellDef *def, /* Parent cell for which CIF is computed. */
|
CellDef *def; /* Parent cell for which CIF is computed. */
|
||||||
Rect *area, /* All CIF in this area is interesting. */
|
Rect *area; /* All CIF in this area is interesting. */
|
||||||
Plane **output) /* Array of pointers to planes into which
|
Plane **output; /* Array of pointers to planes into which
|
||||||
* the CIF output will be OR'ed (real CIF
|
* the CIF output will be OR'ed (real CIF
|
||||||
* only).
|
* only).
|
||||||
*/
|
*/
|
||||||
|
|
@ -735,10 +788,8 @@ CIFGenSubcells(
|
||||||
|
|
||||||
/* This routine can take a long time, so use the display
|
/* This routine can take a long time, so use the display
|
||||||
* timer to force a 5-second progress check (like is done
|
* timer to force a 5-second progress check (like is done
|
||||||
* with extract). Save and restore GrDisplayStatus so that
|
* with extract)
|
||||||
* a headless (DISPLAY_SUSPEND) build isn't left in DISPLAY_IDLE.
|
|
||||||
*/
|
*/
|
||||||
unsigned char savedDisplayStatus = GrDisplayStatus;
|
|
||||||
GrDisplayStatus = DISPLAY_IN_PROGRESS;
|
GrDisplayStatus = DISPLAY_IN_PROGRESS;
|
||||||
SigSetTimer(5); /* Print at 5-second intervals */
|
SigSetTimer(5); /* Print at 5-second intervals */
|
||||||
cuts = 0;
|
cuts = 0;
|
||||||
|
|
@ -790,7 +841,7 @@ CIFGenSubcells(
|
||||||
cifHierCopyFunc, (ClientData) CIFTotalDef);
|
cifHierCopyFunc, (ClientData) CIFTotalDef);
|
||||||
/* Flatten mask hints in the area of interest */
|
/* Flatten mask hints in the area of interest */
|
||||||
CIFCopyMaskHints(&scx, CIFTotalDef);
|
CIFCopyMaskHints(&scx, CIFTotalDef);
|
||||||
DBTreeSrCells(&scx, 0, CIFCopyMaskHints,
|
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||||
(ClientData)CIFTotalDef);
|
(ClientData)CIFTotalDef);
|
||||||
|
|
||||||
CIFErrorDef = def;
|
CIFErrorDef = def;
|
||||||
|
|
@ -863,7 +914,7 @@ CIFGenSubcells(
|
||||||
|
|
||||||
CIFHierTileOps += CIFTileOps - oldTileOps;
|
CIFHierTileOps += CIFTileOps - oldTileOps;
|
||||||
|
|
||||||
GrDisplayStatus = savedDisplayStatus;
|
GrDisplayStatus = DISPLAY_IDLE;
|
||||||
SigRemoveTimer();
|
SigRemoveTimer();
|
||||||
|
|
||||||
UndoEnable();
|
UndoEnable();
|
||||||
|
|
@ -876,14 +927,13 @@ CIFGenSubcells(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierElementFuncLow(
|
cifHierElementFuncLow(use, transform, x, y, checkArea)
|
||||||
CellUse *use, /* CellUse being array-checked. */
|
CellUse *use; /* CellUse being array-checked. */
|
||||||
Transform *transform, /* Transform from this instance to
|
Transform *transform; /* Transform from this instance to
|
||||||
* the parent.
|
* the parent.
|
||||||
*/
|
*/
|
||||||
int x,
|
int x, y; /* Indices of this instance. */
|
||||||
int y, /* Indices of this instance. */
|
Rect *checkArea; /* Area (in parent coords) to be
|
||||||
Rect *checkArea) /* Area (in parent coords) to be
|
|
||||||
* CIF-generated.
|
* CIF-generated.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -900,14 +950,13 @@ cifHierElementFuncLow(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierElementFuncHigh(
|
cifHierElementFuncHigh(use, transform, x, y, checkArea)
|
||||||
CellUse *use, /* CellUse being array-checked. */
|
CellUse *use; /* CellUse being array-checked. */
|
||||||
Transform *transform, /* Transform from this instance to
|
Transform *transform; /* Transform from this instance to
|
||||||
* the parent.
|
* the parent.
|
||||||
*/
|
*/
|
||||||
int x,
|
int x, y; /* Indices of this instance. */
|
||||||
int y, /* Indices of this instance. */
|
Rect *checkArea; /* Area (in parent coords) to be
|
||||||
Rect *checkArea) /* Area (in parent coords) to be
|
|
||||||
* CIF-generated.
|
* CIF-generated.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -942,14 +991,13 @@ cifHierElementFuncHigh(
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
cifHierElementFunc(
|
cifHierElementFunc(use, transform, x, y, checkArea)
|
||||||
CellUse *use, /* CellUse being array-checked. */
|
CellUse *use; /* CellUse being array-checked. */
|
||||||
Transform *transform, /* Transform from this instance to
|
Transform *transform; /* Transform from this instance to
|
||||||
* the parent.
|
* the parent.
|
||||||
*/
|
*/
|
||||||
int x,
|
int x, y; /* Indices of this instance. */
|
||||||
int y, /* Indices of this instance. */
|
Rect *checkArea; /* Area (in parent coords) to be
|
||||||
Rect *checkArea) /* Area (in parent coords) to be
|
|
||||||
* CIF-generated.
|
* CIF-generated.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -968,14 +1016,14 @@ cifHierElementFunc(
|
||||||
(void) DBTreeSrTiles(&scx, &CIFCurStyle->cs_yankLayers, 0,
|
(void) DBTreeSrTiles(&scx, &CIFCurStyle->cs_yankLayers, 0,
|
||||||
cifHierCopyFunc, (ClientData) CIFTotalDef);
|
cifHierCopyFunc, (ClientData) CIFTotalDef);
|
||||||
CIFCopyMaskHints(&scx, CIFTotalDef);
|
CIFCopyMaskHints(&scx, CIFTotalDef);
|
||||||
DBTreeSrCells(&scx, 0, CIFCopyMaskHints,
|
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||||
(ClientData)CIFTotalDef);
|
(ClientData)CIFTotalDef);
|
||||||
|
|
||||||
DBCellClearDef(CIFComponentDef);
|
DBCellClearDef(CIFComponentDef);
|
||||||
(void) DBTreeSrTiles(&scx, &CIFCurStyle->cs_yankLayers, 0,
|
(void) DBTreeSrTiles(&scx, &CIFCurStyle->cs_yankLayers, 0,
|
||||||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||||
CIFCopyMaskHints(&scx, CIFComponentDef);
|
CIFCopyMaskHints(&scx, CIFComponentDef);
|
||||||
DBTreeSrCells(&scx, 0, CIFCopyMaskHints,
|
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||||
(ClientData)CIFComponentDef);
|
(ClientData)CIFComponentDef);
|
||||||
|
|
||||||
CIFErrorDef = (CellDef *) NULL;
|
CIFErrorDef = (CellDef *) NULL;
|
||||||
|
|
@ -1007,10 +1055,9 @@ cifHierElementFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifGrowSliver(
|
cifGrowSliver(tile, area)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo, /* Split tile information, needs to be handled */
|
Rect *area;
|
||||||
Rect *area)
|
|
||||||
{
|
{
|
||||||
int height, width, expand_up, expand_side;
|
int height, width, expand_up, expand_side;
|
||||||
|
|
||||||
|
|
@ -1069,25 +1116,23 @@ cifGrowSliver(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierPaintArrayFunc(
|
cifHierPaintArrayFunc(tile)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo,
|
|
||||||
ClientData clientdata) /* (unused) */
|
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
int i, j, xbot, xtop;
|
int i, j, xbot, xtop;
|
||||||
|
|
||||||
TiToRect(tile, &area);
|
TiToRect(tile, &area);
|
||||||
if (CIFCurStyle->cs_flags & CWF_GROW_SLIVERS) cifGrowSliver(tile, dinfo, &area);
|
if (CIFCurStyle->cs_flags & CWF_GROW_SLIVERS) cifGrowSliver(tile, &area);
|
||||||
xbot = area.r_xbot;
|
xbot = area.r_xbot;
|
||||||
xtop = area.r_xtop;
|
xtop = area.r_xtop;
|
||||||
for (i=0; i<cifHierYCount; i++)
|
for (i=0; i<cifHierYCount; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < cifHierXCount; j++)
|
for (j=0; j<cifHierXCount; j++)
|
||||||
{
|
{
|
||||||
DBNMPaintPlane(cifHierCurPlane, TiGetTypeExact(tile) | dinfo,
|
DBPaintPlane(cifHierCurPlane, &area, CIFPaintTable,
|
||||||
&area, CIFPaintTable, (PaintUndoInfo *) NULL);
|
(PaintUndoInfo *) NULL);
|
||||||
CIFTileOps++;
|
CIFTileOps += 1;
|
||||||
area.r_xbot += cifHierXSpacing;
|
area.r_xbot += cifHierXSpacing;
|
||||||
area.r_xtop += cifHierXSpacing;
|
area.r_xtop += cifHierXSpacing;
|
||||||
}
|
}
|
||||||
|
|
@ -1142,9 +1187,9 @@ cifHierPaintArrayFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifHierArrayFunc(
|
cifHierArrayFunc(scx, output)
|
||||||
SearchContext *scx, /* Information about the search. */
|
SearchContext *scx; /* Information about the search. */
|
||||||
Plane **output) /* Array of planes to hold results. */
|
Plane **output; /* Array of planes to hold results. */
|
||||||
{
|
{
|
||||||
Rect childArea, parentArea, A, B, C, D, expandedArea;
|
Rect childArea, parentArea, A, B, C, D, expandedArea;
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
|
|
@ -1488,10 +1533,10 @@ cifHierArrayFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFGenArrays(
|
CIFGenArrays(def, area, output)
|
||||||
CellDef *def, /* Parent cell for which CIF is computed. */
|
CellDef *def; /* Parent cell for which CIF is computed. */
|
||||||
Rect *area, /* All CIF in this area is interesting. */
|
Rect *area; /* All CIF in this area is interesting. */
|
||||||
Plane **output) /* Array of pointers to planes into which
|
Plane **output; /* Array of pointers to planes into which
|
||||||
* the CIF output will be OR'ed (real CIF
|
* the CIF output will be OR'ed (real CIF
|
||||||
* only, temp layers won't appear). If
|
* only, temp layers won't appear). If
|
||||||
* output is NULL, then CIF is stored in
|
* output is NULL, then CIF is stored in
|
||||||
|
|
|
||||||
90
cif/CIFint.h
90
cif/CIFint.h
|
|
@ -19,8 +19,8 @@
|
||||||
* rcsid "$Header: /usr/cvsroot/magic-8.0/cif/CIFint.h,v 1.3 2008/12/04 17:10:29 tim Exp $"
|
* rcsid "$Header: /usr/cvsroot/magic-8.0/cif/CIFint.h,v 1.3 2008/12/04 17:10:29 tim Exp $"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAGIC__CIF__CIFINT_H
|
#ifndef _CIFINT_H
|
||||||
#define _MAGIC__CIF__CIFINT_H
|
#define _CIFINT_H
|
||||||
|
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
|
|
||||||
|
|
@ -134,19 +134,15 @@ typedef struct cifop
|
||||||
* box coordinates into CIF layer geometry.
|
* box coordinates into CIF layer geometry.
|
||||||
* CIFOP_NET - Added 11/3/08---pull an entire electrical net into
|
* CIFOP_NET - Added 11/3/08---pull an entire electrical net into
|
||||||
* the CIF layer, selectively picking layers.
|
* the CIF layer, selectively picking layers.
|
||||||
* CIFOP_MAXRECT - Reduce all disjoint regions to the largest internal fitting
|
* CIFOP_MAXRECT - Reduce all areas to the largest internal fitting
|
||||||
* rectangle.
|
* rectangle.
|
||||||
* CIFOP_INTERACT - Select all disjoint regions which overlap a given set of types
|
|
||||||
* CIFOP_COPYUP - Added 5/5/16---make and keep a copy the resulting layer,
|
* CIFOP_COPYUP - Added 5/5/16---make and keep a copy the resulting layer,
|
||||||
* which will be painted into parent cells instead of the
|
* which will be painted into parent cells instead of the
|
||||||
* current cell. This replaces the "fault" method.
|
* current cell. This replaces the "fault" method.
|
||||||
* CIFOP_CLOSE - Added 11/25/19---close up areas smaller than indicated
|
* CIFOP_CLOSE - Added 11/25/19---close up areas smaller than indicated
|
||||||
* CIFOP_MANHATTAN - Added 3/27/25---remove or fill nonmanhattan areas
|
|
||||||
* CIFOP_BRIDGE - Added 6/11/20---Bridge across catecorner gaps
|
* CIFOP_BRIDGE - Added 6/11/20---Bridge across catecorner gaps
|
||||||
* CIFOP_BRIDGELIM - Added 27/07/20---Bridge across catecorner gaps, but with limiting layers
|
* CIFOP_BRIDGELIM - Added 27/07/20---Bridge across catecorner gaps, but with limiting layers
|
||||||
* CIFOP_MASKHINTS - Added 12/14/20---Add geometry from cell properties, if any.
|
* CIFOP_MASKHINTS - Added 12/14/20---Add geometry from cell properties, if any.
|
||||||
* CIFOP_NOTSQUARE - Added 2/26/26---Keep only geometry which is not square.
|
|
||||||
* CIFOP_TAGGED - Added 3/11/26---Find geometry attached to the given text label
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CIFOP_AND 1
|
#define CIFOP_AND 1
|
||||||
|
|
@ -167,19 +163,12 @@ typedef struct cifop
|
||||||
#define CIFOP_BOUNDARY 16
|
#define CIFOP_BOUNDARY 16
|
||||||
#define CIFOP_NET 17
|
#define CIFOP_NET 17
|
||||||
#define CIFOP_MAXRECT 18
|
#define CIFOP_MAXRECT 18
|
||||||
#define CIFOP_INTERACT 19
|
#define CIFOP_COPYUP 19
|
||||||
#define CIFOP_COPYUP 20
|
#define CIFOP_CLOSE 20
|
||||||
#define CIFOP_CLOSE 21
|
#define CIFOP_BRIDGE 21
|
||||||
#define CIFOP_MANHATTAN 22
|
#define CIFOP_BRIDGELIM 22
|
||||||
#define CIFOP_BRIDGE 23
|
#define CIFOP_MASKHINTS 23
|
||||||
#define CIFOP_BRIDGELIM 24
|
|
||||||
#define CIFOP_MASKHINTS 25
|
|
||||||
#define CIFOP_NOTSQUARE 26
|
|
||||||
#define CIFOP_TAGGED 27
|
|
||||||
|
|
||||||
/* Definitions of bit fields used in the value of co_client for CIFOP_INTERACT */
|
|
||||||
#define CIFOP_INT_NOT 0x1 /* Inverted sense (not interacting) */
|
|
||||||
#define CIFOP_INT_TOUCHING 0x2 /* Include both touching and overlapping */
|
|
||||||
|
|
||||||
/* Added by Tim 10/21/2004 */
|
/* Added by Tim 10/21/2004 */
|
||||||
/* The following structure is used to pass information on how to draw
|
/* The following structure is used to pass information on how to draw
|
||||||
|
|
@ -330,33 +319,37 @@ typedef struct cifstyle
|
||||||
|
|
||||||
/* procedures */
|
/* procedures */
|
||||||
|
|
||||||
extern bool CIFNameToMask(char *name, TileTypeBitMask *result, TileTypeBitMask *depend);
|
extern bool CIFNameToMask();
|
||||||
extern void CIFGenSubcells(CellDef *def, Rect *area, Plane **output);
|
extern void CIFGenSubcells();
|
||||||
extern void CIFGenArrays(CellDef *def, Rect *area, Plane **output);
|
extern void CIFGenArrays();
|
||||||
extern void CIFGen(CellDef *cellDef, CellDef *origDef, const Rect *area, Plane **planes, TileTypeBitMask *layers,
|
extern void CIFGen();
|
||||||
bool replace, bool genAllPlanes, bool hier, ClientData clientdata);
|
extern void CIFClearPlanes();
|
||||||
extern void CIFClearPlanes(Plane **planes);
|
extern Plane *CIFGenLayer();
|
||||||
extern Plane *CIFGenLayer(CIFOp *op, const Rect *area, CellDef *cellDef, CellDef *origDef, Plane *temps[],
|
extern void CIFInitCells();
|
||||||
bool hier, ClientData clientdata);
|
extern int cifHierCopyFunc();
|
||||||
extern void CIFInitCells(void);
|
extern int cifHierCopyMaskHints();
|
||||||
extern int cifHierCopyFunc(Tile *tile, TileType dinfo, TreeContext *cxp);
|
extern void CIFLoadStyle();
|
||||||
extern void CIFLoadStyle(char *stylename);
|
extern void CIFCopyMaskHints();
|
||||||
extern int CIFCopyMaskHints(SearchContext *scx, CellDef *targetDef);
|
|
||||||
|
|
||||||
/* C99 compat */
|
/* C99 compat */
|
||||||
extern void CIFCoverageLayer(CellDef *rootDef, Rect *area, char *layer, bool dolist);
|
extern void CIFCoverageLayer();
|
||||||
extern bool CIFWriteFlat(CellDef *rootDef, FILE *f);
|
extern bool CIFWriteFlat();
|
||||||
extern void CIFScalePlanes(int scalen, int scaled, Plane **planearray);
|
extern void CIFScalePlanes();
|
||||||
extern void CIFInputRescale(int n, int d);
|
extern void CIFInputRescale();
|
||||||
extern int CIFScaleCoord(int cifCoord, int snap_type);
|
extern int CIFCalmaLayerToCifLayer();
|
||||||
extern int cifGrowSliver(Tile *tile, TileType dinfo, Rect *area);
|
extern int CIFScaleCoord();
|
||||||
extern int cifHierElementFunc(CellUse *use, Transform *transform, int x, int y, Rect *checkArea);
|
extern void CIFPropRecordPath();
|
||||||
extern int cifSquareFunc(Rect *area, CIFOp *op, int *rows, int *columns, Rect *cut);
|
extern void CIFPaintWirePath();
|
||||||
extern int cifSquareGridFunc(Rect *area, CIFOp *op, int *rows, int *columns, Rect *cut);
|
extern void CIFMakeManhattanPath();
|
||||||
extern int cifSlotFunc(Rect *area, CIFOp *op, int *numY, int *numX, Rect *cut, bool vertical);
|
extern int cifGrowSliver();
|
||||||
extern int CIFParseScale(char *true_scale, int *expander);
|
extern int cifHierElementFunc();
|
||||||
extern int cifParseCalmaNums(char *str, int *numArray, int numNums);
|
extern int cifSquareFunc();
|
||||||
extern bool CIFReadTechLimitScale(int ns, int ds);
|
extern int cifSquareGridFunc();
|
||||||
|
extern int cifSlotFunc();
|
||||||
|
extern int CIFParseScale();
|
||||||
|
extern int cifParseCalmaNums();
|
||||||
|
extern int CIFEdgeDirection();
|
||||||
|
extern bool CIFReadTechLimitScale();
|
||||||
|
|
||||||
/* Shared variables and structures: */
|
/* Shared variables and structures: */
|
||||||
|
|
||||||
|
|
@ -370,9 +363,6 @@ extern CellUse *CIFDummyUse; /* Used to dummy up a CellUse for a
|
||||||
* def.
|
* def.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern Plane *CIFTotalPlanes[]; /* Exported for diagnostics */
|
|
||||||
extern Plane *CIFComponentPlanes[]; /* Exported for diagnostics */
|
|
||||||
|
|
||||||
/* Valid values of CIFWarningLevel (see cif.h) */
|
/* Valid values of CIFWarningLevel (see cif.h) */
|
||||||
|
|
||||||
typedef enum {CIF_WARN_DEFAULT, CIF_WARN_NONE, CIF_WARN_ALIGN,
|
typedef enum {CIF_WARN_DEFAULT, CIF_WARN_NONE, CIF_WARN_ALIGN,
|
||||||
|
|
@ -387,13 +377,13 @@ extern int CIFHierRects;
|
||||||
|
|
||||||
/* Tables used for painting and erasing CIF. */
|
/* Tables used for painting and erasing CIF. */
|
||||||
|
|
||||||
extern const PaintResultType CIFPaintTable[], CIFEraseTable[];
|
extern PaintResultType CIFPaintTable[], CIFEraseTable[];
|
||||||
|
|
||||||
/* Procedures and variables for reporting errors. */
|
/* Procedures and variables for reporting errors. */
|
||||||
|
|
||||||
extern int CIFErrorLayer;
|
extern int CIFErrorLayer;
|
||||||
extern CellDef *CIFErrorDef;
|
extern CellDef *CIFErrorDef;
|
||||||
extern void CIFError(Rect *area, char *message);
|
extern void CIFError();
|
||||||
|
|
||||||
/* The following determines the tile type used to hold the CIF
|
/* The following determines the tile type used to hold the CIF
|
||||||
* information on its paint plane.
|
* information on its paint plane.
|
||||||
|
|
@ -402,4 +392,4 @@ extern void CIFError(Rect *area, char *message);
|
||||||
#define CIF_SOLIDTYPE 1
|
#define CIF_SOLIDTYPE 1
|
||||||
extern TileTypeBitMask CIFSolidBits;
|
extern TileTypeBitMask CIFSolidBits;
|
||||||
|
|
||||||
#endif /* _MAGIC__CIF__CIFINT_H */
|
#endif /* _CIFINT_H */
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFmain.c,v 1.3 2009/01/15 15:44:34 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFmain.c,v 1.3 2009/01/15 15:44:34 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -95,7 +95,7 @@ global int CIFErrorLayer; /* Index of CIF layer associated with errors.*/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFPrintStats(void)
|
CIFPrintStats()
|
||||||
{
|
{
|
||||||
TxPrintf("CIF statistics (recent/total):\n");
|
TxPrintf("CIF statistics (recent/total):\n");
|
||||||
cifTotalTileOps += CIFTileOps;
|
cifTotalTileOps += CIFTileOps;
|
||||||
|
|
@ -136,8 +136,8 @@ CIFPrintStats(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
float
|
float
|
||||||
CIFGetOutputScale(
|
CIFGetOutputScale(convert)
|
||||||
int convert)
|
int convert;
|
||||||
{
|
{
|
||||||
if (CIFCurStyle == NULL) return 1.0;
|
if (CIFCurStyle == NULL) return 1.0;
|
||||||
|
|
||||||
|
|
@ -159,8 +159,8 @@ CIFGetOutputScale(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
float
|
float
|
||||||
CIFGetScale(
|
CIFGetScale(convert)
|
||||||
int convert)
|
int convert;
|
||||||
{
|
{
|
||||||
if (CIFCurStyle == NULL) return 1.0;
|
if (CIFCurStyle == NULL) return 1.0;
|
||||||
|
|
||||||
|
|
@ -185,10 +185,10 @@ CIFGetScale(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFPrintStyle(
|
CIFPrintStyle(dolist, doforall, docurrent)
|
||||||
bool dolist, /* Return as a list if true */
|
bool dolist; /* Return as a list if true */
|
||||||
bool doforall, /* Print all known styles if true */
|
bool doforall; /* Print all known styles if true */
|
||||||
bool docurrent) /* Print current style if true */
|
bool docurrent; /* Print current style if true */
|
||||||
{
|
{
|
||||||
CIFKeep *style;
|
CIFKeep *style;
|
||||||
|
|
||||||
|
|
@ -254,8 +254,8 @@ CIFPrintStyle(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFSetStyle(
|
CIFSetStyle(name)
|
||||||
char *name) /* Name of the new style. If NULL, just
|
char *name; /* Name of the new style. If NULL, just
|
||||||
* print out the valid styles.
|
* print out the valid styles.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -320,10 +320,10 @@ CIFSetStyle(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFNameToMask(
|
CIFNameToMask(name, result, depend)
|
||||||
char *name,
|
char *name;
|
||||||
TileTypeBitMask *result,
|
TileTypeBitMask *result;
|
||||||
TileTypeBitMask *depend)
|
TileTypeBitMask *depend;
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
CIFOp *op;
|
CIFOp *op;
|
||||||
|
|
@ -414,11 +414,11 @@ CIFNameToMask(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFError(
|
CIFError(area, message)
|
||||||
Rect *area, /* Place in CIFErrorDef where there was a
|
Rect *area; /* Place in CIFErrorDef where there was a
|
||||||
* problem in generating CIFErrorLayer.
|
* problem in generating CIFErrorLayer.
|
||||||
*/
|
*/
|
||||||
char *message) /* Short note about what went wrong. */
|
char *message; /* Short note about what went wrong. */
|
||||||
{
|
{
|
||||||
char msg[200];
|
char msg[200];
|
||||||
|
|
||||||
|
|
@ -452,7 +452,7 @@ CIFError(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFOutputScaleFactor(void)
|
CIFOutputScaleFactor()
|
||||||
{
|
{
|
||||||
if (CIFCurStyle == NULL) return 1;
|
if (CIFCurStyle == NULL) return 1;
|
||||||
return CIFCurStyle->cs_scaleFactor;
|
return CIFCurStyle->cs_scaleFactor;
|
||||||
|
|
|
||||||
316
cif/CIFrdcl.c
316
cif/CIFrdcl.c
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdcl.c,v 1.5 2010/08/25 17:33:55 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdcl.c,v 1.5 2010/08/25 17:33:55 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -126,8 +126,8 @@ char *cifSubcellId = NULL;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFReadCellInit(
|
CIFReadCellInit(ptrkeys)
|
||||||
int ptrkeys)
|
int ptrkeys;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -162,8 +162,8 @@ CIFReadCellInit(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifForgetCell(
|
cifForgetCell(cifNum)
|
||||||
int cifNum)
|
int cifNum;
|
||||||
{
|
{
|
||||||
HashEntry *h;
|
HashEntry *h;
|
||||||
|
|
||||||
|
|
@ -196,8 +196,8 @@ cifForgetCell(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifUniqueCell(
|
cifUniqueCell(cifNum)
|
||||||
int cifNum)
|
int cifNum;
|
||||||
{
|
{
|
||||||
HashEntry *h;
|
HashEntry *h;
|
||||||
CellDef *def, *testdef;
|
CellDef *def, *testdef;
|
||||||
|
|
@ -256,8 +256,8 @@ cifUniqueCell(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CellDef *
|
CellDef *
|
||||||
cifFindCell(
|
cifFindCell(cifNum)
|
||||||
int cifNum) /* The CIF number of the desired cell. */
|
int cifNum; /* The CIF number of the desired cell. */
|
||||||
{
|
{
|
||||||
HashEntry *h;
|
HashEntry *h;
|
||||||
CellDef *def, *testdef;
|
CellDef *def, *testdef;
|
||||||
|
|
@ -299,10 +299,10 @@ cifFindCell(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFScalePlanes(
|
CIFScalePlanes(scalen, scaled, planearray)
|
||||||
int scalen,
|
int scalen;
|
||||||
int scaled,
|
int scaled;
|
||||||
Plane **planearray)
|
Plane **planearray;
|
||||||
{
|
{
|
||||||
int pNum;
|
int pNum;
|
||||||
Plane *newplane;
|
Plane *newplane;
|
||||||
|
|
@ -348,9 +348,8 @@ CIFScalePlanes(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFInputRescale(
|
CIFInputRescale(n, d)
|
||||||
int n,
|
int n, d;
|
||||||
int d)
|
|
||||||
{
|
{
|
||||||
CIFReadStyle *istyle = cifCurReadStyle;
|
CIFReadStyle *istyle = cifCurReadStyle;
|
||||||
CIFReadLayer *cl;
|
CIFReadLayer *cl;
|
||||||
|
|
@ -390,7 +389,7 @@ CIFInputRescale(
|
||||||
CIFScalePlanes(n, d, cifCurReadPlanes);
|
CIFScalePlanes(n, d, cifCurReadPlanes);
|
||||||
if (cifCurReadPlanes != cifEditCellPlanes)
|
if (cifCurReadPlanes != cifEditCellPlanes)
|
||||||
CIFScalePlanes(n, d, cifEditCellPlanes);
|
CIFScalePlanes(n, d, cifEditCellPlanes);
|
||||||
if ((const Plane*)cifEditCellPlanes != (const Plane*)cifSubcellPlanes && cifCurReadPlanes != cifSubcellPlanes)
|
if (cifEditCellPlanes != cifSubcellPlanes && cifCurReadPlanes != cifSubcellPlanes)
|
||||||
CIFScalePlanes(n, d, cifSubcellPlanes);
|
CIFScalePlanes(n, d, cifSubcellPlanes);
|
||||||
|
|
||||||
CIFReadWarning("CIF style %s: units rescaled by factor of %d / %d\n",
|
CIFReadWarning("CIF style %s: units rescaled by factor of %d / %d\n",
|
||||||
|
|
@ -418,7 +417,7 @@ CIFInputRescale(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseStart(void)
|
CIFParseStart()
|
||||||
{
|
{
|
||||||
int number;
|
int number;
|
||||||
|
|
||||||
|
|
@ -503,10 +502,9 @@ CIFParseStart(void)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int cifCheckPaintFunc(
|
int cifCheckPaintFunc(tile, clientData)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo,
|
ClientData clientData;
|
||||||
ClientData clientData)
|
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -514,30 +512,29 @@ int cifCheckPaintFunc(
|
||||||
/* Callback function for copying paint from one CIF cell into another */
|
/* Callback function for copying paint from one CIF cell into another */
|
||||||
|
|
||||||
int
|
int
|
||||||
cifCopyPaintFunc(
|
cifCopyPaintFunc(tile, cifCopyRec)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo,
|
CIFCopyRec *cifCopyRec;
|
||||||
CIFCopyRec *cifCopyRec)
|
|
||||||
{
|
{
|
||||||
int pNum;
|
int pNum;
|
||||||
TileType newdinfo;
|
TileType dinfo;
|
||||||
Rect sourceRect, targetRect;
|
Rect sourceRect, targetRect;
|
||||||
Transform *trans = cifCopyRec->trans;
|
Transform *trans = cifCopyRec->trans;
|
||||||
Plane *plane = cifCopyRec->plane;
|
Plane *plane = cifCopyRec->plane;
|
||||||
|
|
||||||
newdinfo = TiGetTypeExact(tile) | dinfo;
|
dinfo = TiGetTypeExact(tile);
|
||||||
|
|
||||||
if (trans)
|
if (trans)
|
||||||
{
|
{
|
||||||
TiToRect(tile, &sourceRect);
|
TiToRect(tile, &sourceRect);
|
||||||
GeoTransRect(trans, &sourceRect, &targetRect);
|
GeoTransRect(trans, &sourceRect, &targetRect);
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, trans);
|
dinfo = DBTransformDiagonal(TiGetTypeExact(tile), trans);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
TiToRect(tile, &targetRect);
|
TiToRect(tile, &targetRect);
|
||||||
|
|
||||||
DBNMPaintPlane(plane, newdinfo, &targetRect, CIFPaintTable,
|
DBNMPaintPlane(plane, dinfo, &targetRect, CIFPaintTable,
|
||||||
(PaintUndoInfo *)NULL);
|
(PaintUndoInfo *)NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -561,10 +558,9 @@ cifCopyPaintFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifMaskHintFunc(
|
cifMaskHintFunc(tile, lrecp)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo, /* Unused, do not support non-manhattan hints */
|
LinkedRect **lrecp;
|
||||||
LinkedRect **lrecp)
|
|
||||||
{
|
{
|
||||||
Rect r;
|
Rect r;
|
||||||
LinkedRect *newlr;
|
LinkedRect *newlr;
|
||||||
|
|
@ -597,12 +593,11 @@ cifMaskHintFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFPaintCurrent(
|
CIFPaintCurrent(filetype)
|
||||||
int filetype)
|
bool filetype;
|
||||||
{
|
{
|
||||||
/* Forward declarations. */
|
extern int cifMakeBoundaryFunc(); /* Forward declaration. */
|
||||||
extern int cifMakeBoundaryFunc(Tile *tile, TileType dinfo, ClientData clientdata);
|
extern int cifPaintCurrentFunc(); /* Forward declaration. */
|
||||||
extern int cifPaintCurrentFunc(Tile *tile, TileType dinfo, TileType type);
|
|
||||||
|
|
||||||
Plane *plane, *swapplane;
|
Plane *plane, *swapplane;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -613,7 +608,7 @@ CIFPaintCurrent(
|
||||||
CIFOp *op;
|
CIFOp *op;
|
||||||
|
|
||||||
plane = CIFGenLayer(cifCurReadStyle->crs_layers[i]->crl_ops,
|
plane = CIFGenLayer(cifCurReadStyle->crs_layers[i]->crl_ops,
|
||||||
&TiPlaneRect, cifReadCellDef, cifReadCellDef,
|
&TiPlaneRect, (CellDef *)NULL, (CellDef *)NULL,
|
||||||
cifCurReadPlanes, FALSE, (ClientData)NULL);
|
cifCurReadPlanes, FALSE, (ClientData)NULL);
|
||||||
|
|
||||||
/* Generate a paint/erase table, then paint from the CIF
|
/* Generate a paint/erase table, then paint from the CIF
|
||||||
|
|
@ -688,8 +683,6 @@ CIFPaintCurrent(
|
||||||
}
|
}
|
||||||
else if (op == NULL)
|
else if (op == NULL)
|
||||||
{
|
{
|
||||||
LinkedRect *lrec = NULL, *lsrch;
|
|
||||||
|
|
||||||
/* Handle boundary layer */
|
/* Handle boundary layer */
|
||||||
|
|
||||||
op = cifCurReadStyle->crs_layers[i]->crl_ops;
|
op = cifCurReadStyle->crs_layers[i]->crl_ops;
|
||||||
|
|
@ -703,103 +696,7 @@ CIFPaintCurrent(
|
||||||
&DBAllButSpaceBits, cifCheckPaintFunc,
|
&DBAllButSpaceBits, cifCheckPaintFunc,
|
||||||
(ClientData)NULL) == 1))
|
(ClientData)NULL) == 1))
|
||||||
DBSrPaintArea((Tile *) NULL, plane, &TiPlaneRect,
|
DBSrPaintArea((Tile *) NULL, plane, &TiPlaneRect,
|
||||||
&CIFSolidBits, cifMakeBoundaryFunc, INT2CD(filetype));
|
&CIFSolidBits, cifMakeBoundaryFunc, (ClientData)filetype);
|
||||||
|
|
||||||
/* Handle mask-hints input operator */
|
|
||||||
|
|
||||||
op = cifCurReadStyle->crs_layers[i]->crl_ops;
|
|
||||||
while (op)
|
|
||||||
{
|
|
||||||
if (op->co_opcode == CIFOP_MASKHINTS) break;
|
|
||||||
op = op->co_next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (op && (DBSrPaintArea((Tile *)NULL, plane, &TiPlaneRect,
|
|
||||||
&DBAllButSpaceBits, cifCheckPaintFunc,
|
|
||||||
(ClientData)NULL) == 1))
|
|
||||||
{
|
|
||||||
/* (To do: remove the linked Rects and paint directly
|
|
||||||
* into the plane in cifMaskHintFunc())
|
|
||||||
*/
|
|
||||||
DBSrPaintArea((Tile *) NULL, plane, &TiPlaneRect,
|
|
||||||
&CIFSolidBits, cifMaskHintFunc,
|
|
||||||
(ClientData)&lrec);
|
|
||||||
|
|
||||||
if (lrec != NULL)
|
|
||||||
{
|
|
||||||
PropertyRecord *proprec, *proporig;
|
|
||||||
char *propname, *layername;
|
|
||||||
int proplen, i, savescale;
|
|
||||||
bool origfound = FALSE;
|
|
||||||
Plane *plane;
|
|
||||||
|
|
||||||
layername = (char *)op->co_client;
|
|
||||||
propname = (char *)mallocMagic(11 + strlen(layername));
|
|
||||||
sprintf(propname, "MASKHINTS_%s", layername);
|
|
||||||
|
|
||||||
/* If there is already a mask hint plane for this layer,
|
|
||||||
* then add to it; otherwise, create a new plane.
|
|
||||||
*/
|
|
||||||
proprec = DBPropGet(cifReadCellDef, layername, &origfound);
|
|
||||||
if (origfound)
|
|
||||||
plane = proprec->prop_value.prop_plane;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
proprec = (PropertyRecord *)mallocMagic(
|
|
||||||
sizeof(PropertyRecord));
|
|
||||||
proprec->prop_type = PROPERTY_TYPE_PLANE;
|
|
||||||
proprec->prop_len = 0; /* (unused) */
|
|
||||||
plane = DBNewPlane((ClientData)TT_SPACE);
|
|
||||||
proprec->prop_value.prop_plane = plane;
|
|
||||||
DBPropPut(cifReadCellDef, propname, proprec);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (lrec != NULL)
|
|
||||||
{
|
|
||||||
lrec->r_r.r_xtop =
|
|
||||||
CIFScaleCoord(lrec->r_r.r_xtop, COORD_EXACT);
|
|
||||||
savescale = cifCurReadStyle->crs_scaleFactor;
|
|
||||||
lrec->r_r.r_ytop =
|
|
||||||
CIFScaleCoord(lrec->r_r.r_ytop, COORD_EXACT);
|
|
||||||
if (savescale != cifCurReadStyle->crs_scaleFactor)
|
|
||||||
{
|
|
||||||
lrec->r_r.r_xtop *=
|
|
||||||
(savescale / cifCurReadStyle->crs_scaleFactor);
|
|
||||||
savescale = cifCurReadStyle->crs_scaleFactor;
|
|
||||||
}
|
|
||||||
lrec->r_r.r_xbot =
|
|
||||||
CIFScaleCoord(lrec->r_r.r_xbot, COORD_EXACT);
|
|
||||||
if (savescale != cifCurReadStyle->crs_scaleFactor)
|
|
||||||
{
|
|
||||||
lrec->r_r.r_xtop *=
|
|
||||||
(savescale / cifCurReadStyle->crs_scaleFactor);
|
|
||||||
lrec->r_r.r_ytop *=
|
|
||||||
(savescale / cifCurReadStyle->crs_scaleFactor);
|
|
||||||
savescale = cifCurReadStyle->crs_scaleFactor;
|
|
||||||
}
|
|
||||||
lrec->r_r.r_ybot =
|
|
||||||
CIFScaleCoord(lrec->r_r.r_ybot, COORD_EXACT);
|
|
||||||
if (savescale != cifCurReadStyle->crs_scaleFactor)
|
|
||||||
{
|
|
||||||
lrec->r_r.r_xtop *=
|
|
||||||
(savescale / cifCurReadStyle->crs_scaleFactor);
|
|
||||||
lrec->r_r.r_ytop *=
|
|
||||||
(savescale / cifCurReadStyle->crs_scaleFactor);
|
|
||||||
lrec->r_r.r_xbot *=
|
|
||||||
(savescale / cifCurReadStyle->crs_scaleFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
DBPaintPlane(plane, &lrec->r_r, CIFPaintTable,
|
|
||||||
(PaintUndoInfo *)NULL);
|
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
freeMagic1(&mm1, lrec);
|
|
||||||
lrec = lrec->r_next;
|
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
|
||||||
freeMagic(propname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Swap planes */
|
/* Swap planes */
|
||||||
|
|
@ -811,7 +708,7 @@ CIFPaintCurrent(
|
||||||
{
|
{
|
||||||
DBSrPaintArea((Tile *) NULL, plane, &TiPlaneRect,
|
DBSrPaintArea((Tile *) NULL, plane, &TiPlaneRect,
|
||||||
&CIFSolidBits, cifPaintCurrentFunc,
|
&CIFSolidBits, cifPaintCurrentFunc,
|
||||||
INT2CD(type));
|
(ClientData)type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recycle the plane, which was dynamically allocated. */
|
/* Recycle the plane, which was dynamically allocated. */
|
||||||
|
|
@ -888,7 +785,9 @@ CIFPaintCurrent(
|
||||||
|
|
||||||
for (i = 0; i < cifNReadLayers; i++)
|
for (i = 0; i < cifNReadLayers; i++)
|
||||||
{
|
{
|
||||||
LinkedRect *lrec = NULL, *lsrch;
|
LinkedRect *lrec = NULL;
|
||||||
|
char *propstr = NULL;
|
||||||
|
char locstr[512];
|
||||||
Plane *tempp;
|
Plane *tempp;
|
||||||
|
|
||||||
if (!TTMaskHasType(CalmaMaskHints, i)) continue;
|
if (!TTMaskHasType(CalmaMaskHints, i)) continue;
|
||||||
|
|
@ -913,55 +812,51 @@ CIFPaintCurrent(
|
||||||
(CellDef *)NULL, CIFPlanes, FALSE, (ClientData)NULL);
|
(CellDef *)NULL, CIFPlanes, FALSE, (ClientData)NULL);
|
||||||
|
|
||||||
/* Scan the resulting plane and generate linked Rect structures for
|
/* Scan the resulting plane and generate linked Rect structures for
|
||||||
* each shape found. (To do: Remove the linked Rects and paint
|
* each shape found.
|
||||||
* directly into the plane in cifMaskHintFunc(), which is more
|
|
||||||
* efficient but not hugely so.)
|
|
||||||
*/
|
*/
|
||||||
DBSrPaintArea((Tile *)NULL, presult, &TiPlaneRect, &CIFSolidBits,
|
DBSrPaintArea((Tile *)NULL, presult, &TiPlaneRect, &CIFSolidBits,
|
||||||
cifMaskHintFunc, (ClientData)&lrec);
|
cifMaskHintFunc, (ClientData)&lrec);
|
||||||
|
|
||||||
if (lrec != NULL)
|
if (lrec != NULL)
|
||||||
{
|
{
|
||||||
PropertyRecord *proprec;
|
|
||||||
bool propfound;
|
|
||||||
char *propname;
|
char *propname;
|
||||||
Plane *plane;
|
|
||||||
|
|
||||||
propname = (char *)mallocMagic(11 + strlen(cifReadLayers[i]));
|
propname = (char *)mallocMagic(11 + strlen(cifReadLayers[i]));
|
||||||
sprintf(propname, "MASKHINTS_%s", cifReadLayers[i]);
|
sprintf(propname, "MASKHINTS_%s", cifReadLayers[i]);
|
||||||
|
|
||||||
/* Paint all linked Rects into a mask-hints property plane
|
propstr = (char *)NULL;
|
||||||
* in the target cell.
|
|
||||||
|
/* Turn all linked Rects into a mask-hints property in the
|
||||||
|
* target cell.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
proprec = DBPropGet(cifReadCellDef, propname, &propfound);
|
|
||||||
if (!propfound)
|
|
||||||
{
|
|
||||||
proprec = (PropertyRecord *)mallocMagic(sizeof(PropertyRecord));
|
|
||||||
proprec->prop_type = PROPERTY_TYPE_PLANE;
|
|
||||||
proprec->prop_len = 0; /* (unused) */
|
|
||||||
plane = DBNewPlane((ClientData)TT_SPACE);
|
|
||||||
proprec->prop_value.prop_plane = plane;
|
|
||||||
DBPropPut(cifReadCellDef, propname, proprec);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
plane = proprec->prop_value.prop_plane;
|
|
||||||
|
|
||||||
while (lrec != NULL)
|
while (lrec != NULL)
|
||||||
{
|
{
|
||||||
lrec->r_r.r_xbot /= CIFCurStyle->cs_scaleFactor;
|
char *newstr;
|
||||||
lrec->r_r.r_ybot /= CIFCurStyle->cs_scaleFactor;
|
sprintf(locstr, "%d %d %d %d",
|
||||||
lrec->r_r.r_xtop /= CIFCurStyle->cs_scaleFactor;
|
lrec->r_r.r_xbot / CIFCurStyle->cs_scaleFactor,
|
||||||
lrec->r_r.r_ytop /= CIFCurStyle->cs_scaleFactor;
|
lrec->r_r.r_ybot / CIFCurStyle->cs_scaleFactor,
|
||||||
|
lrec->r_r.r_xtop / CIFCurStyle->cs_scaleFactor,
|
||||||
DBPaintPlane(plane, &lrec->r_r, CIFPaintTable,
|
lrec->r_r.r_ytop / CIFCurStyle->cs_scaleFactor);
|
||||||
(PaintUndoInfo *)NULL);
|
if (propstr == NULL)
|
||||||
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
newstr = (char *)mallocMagic(strlen(locstr) + 1);
|
||||||
freeMagic1(&mm1, lrec);
|
sprintf(newstr, "%s", locstr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newstr = (char *)mallocMagic(strlen(locstr)
|
||||||
|
+ strlen(propstr) + 2);
|
||||||
|
sprintf(newstr, "%s %s", propstr, locstr);
|
||||||
|
freeMagic(propstr);
|
||||||
|
}
|
||||||
|
propstr = newstr;
|
||||||
|
freeMagic(lrec);
|
||||||
lrec = lrec->r_next;
|
lrec = lrec->r_next;
|
||||||
freeMagic1_end(&mm1);
|
}
|
||||||
}
|
/* NOTE: propstr is transferred to the CellDef and should
|
||||||
|
* not be free'd here.
|
||||||
|
*/
|
||||||
|
DBPropPut(cifReadCellDef, propname, propstr);
|
||||||
freeMagic(propname);
|
freeMagic(propname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -991,20 +886,18 @@ CIFPaintCurrent(
|
||||||
/* Use CIF layer geometry to define a fixed bounding box for the current cell */
|
/* Use CIF layer geometry to define a fixed bounding box for the current cell */
|
||||||
|
|
||||||
int
|
int
|
||||||
cifMakeBoundaryFunc(
|
cifMakeBoundaryFunc(tile, clientdata)
|
||||||
Tile *tile, /* Tile of CIF information. */
|
Tile *tile; /* Tile of CIF information. */
|
||||||
TileType dinfo, /* Split tile information (unused) */
|
ClientData clientdata; /* Pass the file type (CIF or CALMA) */
|
||||||
ClientData clientdata) /* Pass the file type (CIF or CALMA) */
|
|
||||||
{
|
{
|
||||||
/* It is assumed that there is one rectangle for the boundary. */
|
/* It is assumed that there is one rectangle for the boundary. */
|
||||||
/* If there are multiple rectangles defined with the boundary */
|
/* If there are multiple rectangles defined with the boundary */
|
||||||
/* layer, then the last one defines the FIXED_BBOX property. */
|
/* layer, then the last one defines the FIXED_BBOX property. */
|
||||||
|
|
||||||
PropertyRecord *proprec;
|
|
||||||
Rect area;
|
Rect area;
|
||||||
char propertyvalue[128], *storedvalue;
|
char propertyvalue[128], *storedvalue;
|
||||||
int savescale;
|
int savescale;
|
||||||
int filetype = (int)CD2INT(clientdata);
|
bool filetype = (bool)clientdata;
|
||||||
|
|
||||||
TiToRect(tile, &area);
|
TiToRect(tile, &area);
|
||||||
area.r_xtop = CIFScaleCoord(area.r_xtop, COORD_EXACT);
|
area.r_xtop = CIFScaleCoord(area.r_xtop, COORD_EXACT);
|
||||||
|
|
@ -1032,24 +925,19 @@ cifMakeBoundaryFunc(
|
||||||
|
|
||||||
if (cifReadCellDef->cd_flags & CDFIXEDBBOX)
|
if (cifReadCellDef->cd_flags & CDFIXEDBBOX)
|
||||||
{
|
{
|
||||||
PropertyRecord *proprec;
|
char *propvalue;
|
||||||
bool found;
|
bool found;
|
||||||
|
|
||||||
/* Only flag a warning if the redefined boundary was */
|
/* Only flag a warning if the redefined boundary was */
|
||||||
/* different from the original. */
|
/* different from the original. */
|
||||||
|
|
||||||
proprec = DBPropGet(cifReadCellDef, "FIXED_BBOX", &found);
|
propvalue = (char *)DBPropGet(cifReadCellDef, "FIXED_BBOX", &found);
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
Rect bbox;
|
Rect bbox;
|
||||||
if ((proprec->prop_type == PROPERTY_TYPE_DIMENSION) &&
|
if (sscanf(propvalue, "%d %d %d %d", &bbox.r_xbot, &bbox.r_ybot,
|
||||||
(proprec->prop_len == 4))
|
&bbox.r_xtop, &bbox.r_ytop) == 4)
|
||||||
{
|
{
|
||||||
bbox.r_xbot = proprec->prop_value.prop_integer[0];
|
|
||||||
bbox.r_ybot = proprec->prop_value.prop_integer[1];
|
|
||||||
bbox.r_xtop = proprec->prop_value.prop_integer[2];
|
|
||||||
bbox.r_ytop = proprec->prop_value.prop_integer[3];
|
|
||||||
|
|
||||||
if ((bbox.r_xbot != area.r_xbot) ||
|
if ((bbox.r_xbot != area.r_xbot) ||
|
||||||
(bbox.r_ybot != area.r_ybot) ||
|
(bbox.r_ybot != area.r_ybot) ||
|
||||||
(bbox.r_xtop != area.r_xtop) ||
|
(bbox.r_xtop != area.r_xtop) ||
|
||||||
|
|
@ -1066,15 +954,10 @@ cifMakeBoundaryFunc(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proprec = (PropertyRecord *)mallocMagic(sizeof(PropertyRecord) + 2 * sizeof(int));
|
sprintf(propertyvalue, "%d %d %d %d",
|
||||||
proprec->prop_type = PROPERTY_TYPE_DIMENSION;
|
area.r_xbot, area.r_ybot, area.r_xtop, area.r_ytop);
|
||||||
proprec->prop_len = 4;
|
storedvalue = StrDup((char **)NULL, propertyvalue);
|
||||||
proprec->prop_value.prop_integer[0] = area.r_xbot;
|
DBPropPut(cifReadCellDef, "FIXED_BBOX", storedvalue);
|
||||||
proprec->prop_value.prop_integer[1] = area.r_ybot;
|
|
||||||
proprec->prop_value.prop_integer[2] = area.r_xtop;
|
|
||||||
proprec->prop_value.prop_integer[3] = area.r_ytop;
|
|
||||||
|
|
||||||
DBPropPut(cifReadCellDef, "FIXED_BBOX", proprec);
|
|
||||||
cifReadCellDef->cd_flags |= CDFIXEDBBOX;
|
cifReadCellDef->cd_flags |= CDFIXEDBBOX;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1082,10 +965,9 @@ cifMakeBoundaryFunc(
|
||||||
/* Paint CIF layer geometry into the current cell def as magic layer "type" */
|
/* Paint CIF layer geometry into the current cell def as magic layer "type" */
|
||||||
|
|
||||||
int
|
int
|
||||||
cifPaintCurrentFunc(
|
cifPaintCurrentFunc(tile, type)
|
||||||
Tile *tile, /* Tile of CIF information. */
|
Tile *tile; /* Tile of CIF information. */
|
||||||
TileType dinfo, /* Split tile information */
|
TileType type; /* Magic type to be painted. */
|
||||||
TileType type) /* Magic type to be painted. */
|
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
|
@ -1134,7 +1016,7 @@ cifPaintCurrentFunc(
|
||||||
for (pNum = PL_PAINTBASE; pNum < DBNumPlanes; pNum++)
|
for (pNum = PL_PAINTBASE; pNum < DBNumPlanes; pNum++)
|
||||||
if (DBPaintOnPlane(type, pNum))
|
if (DBPaintOnPlane(type, pNum))
|
||||||
{
|
{
|
||||||
DBNMPaintPlane(cifReadCellDef->cd_planes[pNum], TiGetTypeExact(tile) | dinfo,
|
DBNMPaintPlane(cifReadCellDef->cd_planes[pNum], TiGetTypeExact(tile),
|
||||||
&area, DBStdPaintTbl(type, pNum), (PaintUndoInfo *) NULL);
|
&area, DBStdPaintTbl(type, pNum), (PaintUndoInfo *) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1160,7 +1042,7 @@ cifPaintCurrentFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseFinish(void)
|
CIFParseFinish()
|
||||||
{
|
{
|
||||||
if (!cifSubcellBeingRead)
|
if (!cifSubcellBeingRead)
|
||||||
{
|
{
|
||||||
|
|
@ -1215,7 +1097,7 @@ CIFParseFinish(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseDelete(void)
|
CIFParseDelete()
|
||||||
{
|
{
|
||||||
int number;
|
int number;
|
||||||
|
|
||||||
|
|
@ -1257,7 +1139,7 @@ CIFParseDelete(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
cifParseName(void)
|
cifParseName()
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
char *bufferp;
|
char *bufferp;
|
||||||
|
|
@ -1299,7 +1181,7 @@ cifParseName(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifParseUser9(void)
|
cifParseUser9()
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
|
|
@ -1331,7 +1213,7 @@ cifParseUser9(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseCall(void)
|
CIFParseCall()
|
||||||
{
|
{
|
||||||
int called;
|
int called;
|
||||||
Transform transform;
|
Transform transform;
|
||||||
|
|
@ -1398,7 +1280,7 @@ CIFParseCall(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifParseUser91(void)
|
cifParseUser91()
|
||||||
{
|
{
|
||||||
if (cifSubcellId != NULL)
|
if (cifSubcellId != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -1429,7 +1311,7 @@ cifParseUser91(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifParseUser94(void)
|
cifParseUser94()
|
||||||
{
|
{
|
||||||
Rect rectangle;
|
Rect rectangle;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
|
@ -1519,7 +1401,7 @@ cifParseUser94(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifParseUser95(void)
|
cifParseUser95()
|
||||||
{
|
{
|
||||||
/* Modified by BIM 1/8/2018 */
|
/* Modified by BIM 1/8/2018 */
|
||||||
Rect rectangle;
|
Rect rectangle;
|
||||||
|
|
@ -1679,7 +1561,7 @@ cifParseUser95(void)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
CIFParseUser(void)
|
CIFParseUser()
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
|
|
@ -1731,8 +1613,8 @@ CIFParseUser(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFReadCellCleanup(
|
CIFReadCellCleanup(filetype)
|
||||||
int filetype)
|
bool filetype;
|
||||||
{
|
{
|
||||||
HashEntry *h;
|
HashEntry *h;
|
||||||
HashSearch hs;
|
HashSearch hs;
|
||||||
|
|
@ -1775,7 +1657,7 @@ CIFReadCellCleanup(
|
||||||
def->cd_flags &= ~CDPROCESSEDGDS;
|
def->cd_flags &= ~CDPROCESSEDGDS;
|
||||||
|
|
||||||
if ((filetype == FILE_CIF && CIFNoDRCCheck == FALSE) ||
|
if ((filetype == FILE_CIF && CIFNoDRCCheck == FALSE) ||
|
||||||
(filetype == FILE_CALMA && CalmaNoDRCCheck == FALSE))
|
(filetype == 1 && CalmaNoDRCCheck == FALSE))
|
||||||
DRCCheckThis(def, TT_CHECKPAINT, &def->cd_bbox);
|
DRCCheckThis(def, TT_CHECKPAINT, &def->cd_bbox);
|
||||||
DBWAreaChanged(def, &def->cd_bbox, DBW_ALLWINDOWS, &DBAllButSpaceBits);
|
DBWAreaChanged(def, &def->cd_bbox, DBW_ALLWINDOWS, &DBAllButSpaceBits);
|
||||||
DBCellSetModified(def, TRUE);
|
DBCellSetModified(def, TRUE);
|
||||||
|
|
@ -1786,8 +1668,8 @@ CIFReadCellCleanup(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do geometrical processing on the top-level cell. */
|
/* Do geometrical processing on the top-level cell. */
|
||||||
if (filetype == FILE_CIF) CIFPaintCurrent(filetype);
|
|
||||||
|
|
||||||
|
CIFPaintCurrent(FILE_CIF);
|
||||||
DBAdjustLabels(EditCellUse->cu_def, &TiPlaneRect);
|
DBAdjustLabels(EditCellUse->cu_def, &TiPlaneRect);
|
||||||
DBReComputeBbox(EditCellUse->cu_def);
|
DBReComputeBbox(EditCellUse->cu_def);
|
||||||
DBWAreaChanged(EditCellUse->cu_def, &EditCellUse->cu_def->cd_bbox,
|
DBWAreaChanged(EditCellUse->cu_def, &EditCellUse->cu_def->cd_bbox,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdpoly.c,v 1.3 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdpoly.c,v 1.3 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -55,14 +55,10 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifLowX(
|
cifLowX(a, b)
|
||||||
const void *aa,
|
CIFPath **a, **b;
|
||||||
const void *bb)
|
|
||||||
{
|
{
|
||||||
const CIFPath **a = (const CIFPath **)aa;
|
Point *p, *q;
|
||||||
const CIFPath **b = (const CIFPath **)bb;
|
|
||||||
|
|
||||||
const Point *p, *q;
|
|
||||||
|
|
||||||
p = &(*a)->cifp_point;
|
p = &(*a)->cifp_point;
|
||||||
q = &(*b)->cifp_point;
|
q = &(*b)->cifp_point;
|
||||||
|
|
@ -92,12 +88,9 @@ cifLowX(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifLowY(
|
cifLowY(a, b)
|
||||||
const void *aa,
|
Point **a, **b;
|
||||||
const void *bb)
|
|
||||||
{
|
{
|
||||||
const Point **a = (const Point **)aa;
|
|
||||||
const Point **b = (const Point **)bb;
|
|
||||||
if ((*a)->p_y < (*b)->p_y)
|
if ((*a)->p_y < (*b)->p_y)
|
||||||
return (-1);
|
return (-1);
|
||||||
if ((*a)->p_y > (*b)->p_y)
|
if ((*a)->p_y > (*b)->p_y)
|
||||||
|
|
@ -126,10 +119,10 @@ cifLowY(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifOrient(
|
cifOrient(edges, nedges, dir)
|
||||||
CIFPath *edges[], /* Array of edges to be categorized. */
|
CIFPath *edges[]; /* Array of edges to be categorized. */
|
||||||
int nedges, /* Size of arrays. */
|
int dir[]; /* Array to hold directions. */
|
||||||
int dir[]) /* Array to hold directions. */
|
int nedges; /* Size of arrays. */
|
||||||
{
|
{
|
||||||
Point *p, *q;
|
Point *p, *q;
|
||||||
int n;
|
int n;
|
||||||
|
|
@ -186,11 +179,10 @@ cifOrient(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifCross(
|
cifCross(edge, dir, ybot, ytop)
|
||||||
CIFPath *edge, /* Pointer to first of 2 path points in edge */
|
CIFPath *edge; /* Pointer to first of 2 path points in edge */
|
||||||
int dir, /* Direction of edge */
|
int dir; /* Direction of edge */
|
||||||
int ybot,
|
int ybot, ytop; /* Range of interest */
|
||||||
int ytop) /* Range of interest */
|
|
||||||
{
|
{
|
||||||
int ebot, etop;
|
int ebot, etop;
|
||||||
|
|
||||||
|
|
@ -231,12 +223,12 @@ cifCross(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LinkedRect *
|
LinkedRect *
|
||||||
CIFPolyToRects(
|
CIFPolyToRects(path, plane, resultTbl, ui, isCalma)
|
||||||
CIFPath *path, /* Path describing a polygon. */
|
CIFPath *path; /* Path describing a polygon. */
|
||||||
Plane *plane, /* Plane to draw on */
|
Plane *plane; /* Plane to draw on */
|
||||||
const PaintResultType *resultTbl,
|
PaintResultType *resultTbl;
|
||||||
PaintUndoInfo *ui,
|
PaintUndoInfo *ui;
|
||||||
bool isCalma) /* TRUE for Calma, FALSE for CIF */
|
bool isCalma; /* TRUE for Calma, FALSE for CIF */
|
||||||
{
|
{
|
||||||
int npts = 0, n, *dir, curr, wrapno;
|
int npts = 0, n, *dir, curr, wrapno;
|
||||||
int xbot, xtop, ybot, ytop;
|
int xbot, xtop, ybot, ytop;
|
||||||
|
|
|
||||||
170
cif/CIFrdpt.c
170
cif/CIFrdpt.c
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdpt.c,v 1.2 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdpt.c,v 1.2 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -65,7 +65,7 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseBox(void)
|
CIFParseBox()
|
||||||
{
|
{
|
||||||
Point center;
|
Point center;
|
||||||
Point direction;
|
Point direction;
|
||||||
|
|
@ -176,7 +176,7 @@ CIFParseBox(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseFlash(void)
|
CIFParseFlash()
|
||||||
{
|
{
|
||||||
int diameter;
|
int diameter;
|
||||||
int savescale;
|
int savescale;
|
||||||
|
|
@ -236,69 +236,48 @@ CIFParseFlash(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFPropRecordPath(
|
CIFPropRecordPath(def, pathheadp, iswire, propname)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
CIFPath *pathheadp,
|
CIFPath *pathheadp;
|
||||||
bool iswire,
|
bool iswire;
|
||||||
char *propname)
|
char *propname;
|
||||||
{
|
{
|
||||||
extern float CIFGetOutputScale(int convert);
|
extern float CIFGetOutputScale();
|
||||||
CIFPath *pathp;
|
CIFPath *pathp;
|
||||||
char *namestr = NULL;
|
char *pathstr, *sptr;
|
||||||
int components, i, x, y, mult, pathnum;
|
int components;
|
||||||
PropertyRecord *proprec;
|
float x, y, oscale, mult;
|
||||||
bool propfound;
|
|
||||||
|
|
||||||
/* If "name" is a property, then append a suffix to it to ensure uniqueness */
|
oscale = CIFGetOutputScale(1000); /* 1000 for conversion to um */
|
||||||
DBPropGet(def, propname, &propfound);
|
if (oscale == 0.0) oscale = 1.0;
|
||||||
if (propfound)
|
mult = (iswire == TRUE) ? 0.5 : 1.0;
|
||||||
{
|
|
||||||
pathnum = 0;
|
|
||||||
namestr = mallocMagic(strlen(propname) + 10);
|
|
||||||
while (propfound)
|
|
||||||
{
|
|
||||||
sprintf(namestr, "%s_%d", propname, pathnum);
|
|
||||||
DBPropGet(def, namestr, &propfound);
|
|
||||||
pathnum++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mult = (iswire == TRUE) ? 1 : 0;
|
|
||||||
|
|
||||||
/* Count the number of components in the path */
|
|
||||||
pathp = pathheadp;
|
pathp = pathheadp;
|
||||||
components = 0;
|
components = 0;
|
||||||
|
|
||||||
|
/* Count the number of components in the path */
|
||||||
while (pathp != NULL)
|
while (pathp != NULL)
|
||||||
{
|
{
|
||||||
components++;
|
|
||||||
pathp = pathp->cifp_next;
|
pathp = pathp->cifp_next;
|
||||||
|
components++;
|
||||||
}
|
}
|
||||||
/* Allocate enough space to hold 2 * N points. */
|
/* Allocate enough space to hold 2 * N points at "infinity" */
|
||||||
proprec = (PropertyRecord *)mallocMagic(sizeof(PropertyRecord) +
|
pathstr = (char *)mallocMagic(components * 40);
|
||||||
((components - 1) * 2) * sizeof(int));
|
|
||||||
proprec->prop_type = PROPERTY_TYPE_DIMENSION;
|
|
||||||
proprec->prop_len = components * 2;
|
|
||||||
|
|
||||||
pathp = pathheadp;
|
pathp = pathheadp;
|
||||||
i = 0;
|
sptr = pathstr;
|
||||||
while (pathp != NULL)
|
while (pathp != NULL)
|
||||||
{
|
{
|
||||||
x = pathp->cifp_x >> mult;
|
x = (float)pathp->cifp_x * oscale * mult;
|
||||||
y = pathp->cifp_y >> mult;
|
y = (float)pathp->cifp_y * oscale * mult;
|
||||||
|
sprintf(sptr, "%.3f %.3f ", x, y);
|
||||||
proprec->prop_value.prop_integer[i] = x;
|
sptr = sptr + strlen(sptr);
|
||||||
proprec->prop_value.prop_integer[i + 1] = y;
|
|
||||||
|
|
||||||
i += 2;
|
|
||||||
pathp = pathp->cifp_next;
|
pathp = pathp->cifp_next;
|
||||||
}
|
}
|
||||||
if (namestr)
|
|
||||||
{
|
/* Reallocate pathstr to be no larger than needed to hold the path contents */
|
||||||
DBPropPut(def, namestr, proprec);
|
StrDup(&pathstr, pathstr);
|
||||||
freeMagic(namestr);
|
DBPropPut(def, propname, (ClientData)pathstr);
|
||||||
}
|
|
||||||
else
|
|
||||||
DBPropPut(def, propname, proprec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -337,13 +316,13 @@ CIFPropRecordPath(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFPaintWirePath(
|
CIFPaintWirePath(pathheadp, width, endcap, plane, ptable, ui)
|
||||||
CIFPath *pathheadp,
|
CIFPath *pathheadp;
|
||||||
int width,
|
int width;
|
||||||
bool endcap,
|
bool endcap;
|
||||||
Plane *plane,
|
Plane *plane;
|
||||||
const PaintResultType *ptable,
|
PaintResultType *ptable;
|
||||||
PaintUndoInfo *ui)
|
PaintUndoInfo *ui;
|
||||||
{
|
{
|
||||||
CIFPath *pathp, *previousp, *nextp, *polypath;
|
CIFPath *pathp, *previousp, *nextp, *polypath;
|
||||||
CIFPath *returnpath, *newpath, *savepath;
|
CIFPath *returnpath, *newpath, *savepath;
|
||||||
|
|
@ -359,20 +338,18 @@ CIFPaintWirePath(
|
||||||
pathp = pathheadp->cifp_next;
|
pathp = pathheadp->cifp_next;
|
||||||
if (pathp != NULL)
|
if (pathp != NULL)
|
||||||
{
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
while (pathp->cifp_next != NULL)
|
while (pathp->cifp_next != NULL)
|
||||||
{
|
{
|
||||||
if (pathp->cifp_next->cifp_x == pathp->cifp_x &&
|
if (pathp->cifp_next->cifp_x == pathp->cifp_x &&
|
||||||
pathp->cifp_next->cifp_y == pathp->cifp_y)
|
pathp->cifp_next->cifp_y == pathp->cifp_y)
|
||||||
{
|
{
|
||||||
previousp->cifp_next = pathp->cifp_next;
|
previousp->cifp_next = pathp->cifp_next;
|
||||||
freeMagic1(&mm1, pathp);
|
freeMagic(pathp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
previousp = pathp;
|
previousp = pathp;
|
||||||
pathp = pathp->cifp_next;
|
pathp = pathp->cifp_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
previousp = pathheadp;
|
previousp = pathheadp;
|
||||||
|
|
@ -462,22 +439,8 @@ CIFPaintWirePath(
|
||||||
/* Wire reverses direction. Break wire here, */
|
/* Wire reverses direction. Break wire here, */
|
||||||
/* draw, and start new polygon. */
|
/* draw, and start new polygon. */
|
||||||
|
|
||||||
/* Check first if last point and current point */
|
TxError("Warning: direction reversal in path.\n");
|
||||||
/* are the same, in which case a different */
|
|
||||||
/* message should be issued (and possibly */
|
|
||||||
/* should be handled differently?) */
|
|
||||||
|
|
||||||
if (previousp && previousp->cifp_x == pathp->cifp_x
|
|
||||||
&& previousp->cifp_y == pathp->cifp_y)
|
|
||||||
{
|
|
||||||
TxError("Warning: duplicate point in path at (%d, %d).\n",
|
|
||||||
pathp->cifp_x / 2, pathp->cifp_y / 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TxError("Warning: direction reversal in path at (%d, %d).\n",
|
|
||||||
pathp->cifp_x / 2, pathp->cifp_y / 2);
|
|
||||||
}
|
|
||||||
phi = theta;
|
phi = theta;
|
||||||
if (endcap)
|
if (endcap)
|
||||||
{
|
{
|
||||||
|
|
@ -488,8 +451,7 @@ CIFPaintWirePath(
|
||||||
firstpoint = TRUE;
|
firstpoint = TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TxError("Error: mitre limit exceeded at wire junction at (%d, %d).\n",
|
TxError("Error: mitre limit exceeded at wire junction.\n");
|
||||||
pathp->cifp_x, pathp->cifp_y);
|
|
||||||
TxError("Route has been truncated.\n");
|
TxError("Route has been truncated.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -522,13 +484,11 @@ CIFPaintWirePath(
|
||||||
rectp = CIFPolyToRects(polypath, plane, ptable, ui, FALSE);
|
rectp = CIFPolyToRects(polypath, plane, ptable, ui, FALSE);
|
||||||
CIFFreePath(polypath);
|
CIFFreePath(polypath);
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (; rectp != NULL ; rectp = rectp->r_next)
|
for (; rectp != NULL ; rectp = rectp->r_next)
|
||||||
{
|
{
|
||||||
DBPaintPlane(plane, &rectp->r_r, ptable, ui);
|
DBPaintPlane(plane, &rectp->r_r, ptable, ui);
|
||||||
freeMagic1(&mm1, (char *) rectp);
|
freeMagic((char *) rectp);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
polypath = NULL;
|
polypath = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -602,13 +562,13 @@ CIFPaintWirePath(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LinkedRect *
|
LinkedRect *
|
||||||
PaintPolygon(
|
PaintPolygon(pointlist, number, plane, ptable, ui, keep)
|
||||||
Point *pointlist, /* Array of Point structures */
|
Point *pointlist; /* Array of Point structures */
|
||||||
int number, /* total number of points */
|
int number; /* total number of points */
|
||||||
Plane *plane, /* Plane structure to paint into */
|
Plane *plane; /* Plane structure to paint into */
|
||||||
PaintResultType *ptable, /* Paint result table */
|
PaintResultType *ptable; /* Paint result table */
|
||||||
PaintUndoInfo *ui, /* Undo record */
|
PaintUndoInfo *ui; /* Undo record */
|
||||||
bool keep) /* Return list of rects if true */
|
bool keep; /* Return list of rects if true */
|
||||||
{
|
{
|
||||||
LinkedRect *rectp, *rectlist;
|
LinkedRect *rectp, *rectlist;
|
||||||
CIFPath *newpath, *cifpath = (CIFPath *)NULL;
|
CIFPath *newpath, *cifpath = (CIFPath *)NULL;
|
||||||
|
|
@ -626,13 +586,11 @@ PaintPolygon(
|
||||||
rectlist = CIFPolyToRects(cifpath, plane, ptable, ui, FALSE);
|
rectlist = CIFPolyToRects(cifpath, plane, ptable, ui, FALSE);
|
||||||
CIFFreePath(cifpath);
|
CIFFreePath(cifpath);
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (rectp = rectlist; rectp != NULL ; rectp = rectp->r_next)
|
for (rectp = rectlist; rectp != NULL ; rectp = rectp->r_next)
|
||||||
{
|
{
|
||||||
DBPaintPlane(plane, &rectp->r_r, ptable, ui);
|
DBPaintPlane(plane, &rectp->r_r, ptable, ui);
|
||||||
if (!keep) freeMagic1(&mm1, (char *) rectp);
|
if (!keep) freeMagic((char *) rectp);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
return (keep) ? rectlist : (LinkedRect *)NULL;
|
return (keep) ? rectlist : (LinkedRect *)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -659,14 +617,14 @@ PaintPolygon(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
PaintWireList(
|
PaintWireList(pointlist, number, width, endcap, plane, ptable, ui)
|
||||||
Point *pointlist, /* Array of Point structures */
|
Point *pointlist; /* Array of Point structures */
|
||||||
int number, /* total number of points */
|
int number; /* total number of points */
|
||||||
int width, /* Route width of path */
|
int width; /* Route width of path */
|
||||||
bool endcap, /* Whether or not to add 1/2 width endcaps */
|
bool endcap; /* Whether or not to add 1/2 width endcaps */
|
||||||
Plane *plane, /* Plane structure to paint into */
|
Plane *plane; /* Plane structure to paint into */
|
||||||
PaintResultType *ptable, /* Paint result table */
|
PaintResultType *ptable; /* Paint result table */
|
||||||
PaintUndoInfo *ui) /* Undo record */
|
PaintUndoInfo *ui; /* Undo record */
|
||||||
{
|
{
|
||||||
CIFPath *newpath, *cifpath = (CIFPath *)NULL;
|
CIFPath *newpath, *cifpath = (CIFPath *)NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -703,7 +661,7 @@ PaintWireList(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseWire(void)
|
CIFParseWire()
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
CIFPath *pathheadp, *polypath;
|
CIFPath *pathheadp, *polypath;
|
||||||
|
|
@ -729,8 +687,7 @@ CIFParseWire(void)
|
||||||
|
|
||||||
width /= cifReadScale2;
|
width /= cifReadScale2;
|
||||||
savescale = cifReadScale1;
|
savescale = cifReadScale1;
|
||||||
pathheadp = CIFParsePath(2);
|
if (!CIFParsePath(&pathheadp, 2))
|
||||||
if (pathheadp == NULL)
|
|
||||||
{
|
{
|
||||||
CIFReadError("wire, but improper path; ignored.\n");
|
CIFReadError("wire, but improper path; ignored.\n");
|
||||||
CIFSkipToSemi();
|
CIFSkipToSemi();
|
||||||
|
|
@ -764,7 +721,7 @@ CIFParseWire(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseLayer(void)
|
CIFParseLayer()
|
||||||
{
|
{
|
||||||
#define MAXCHARS 4
|
#define MAXCHARS 4
|
||||||
char name[MAXCHARS+1];
|
char name[MAXCHARS+1];
|
||||||
|
|
@ -827,7 +784,7 @@ CIFParseLayer(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParsePoly(void)
|
CIFParsePoly()
|
||||||
{
|
{
|
||||||
CIFPath *pathheadp;
|
CIFPath *pathheadp;
|
||||||
LinkedRect *rectp;
|
LinkedRect *rectp;
|
||||||
|
|
@ -840,8 +797,7 @@ CIFParsePoly(void)
|
||||||
CIFSkipToSemi();
|
CIFSkipToSemi();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
pathheadp = CIFParsePath(1);
|
if (!CIFParsePath(&pathheadp, 1))
|
||||||
if (pathheadp == NULL)
|
|
||||||
{
|
{
|
||||||
CIFReadError("polygon, but improper path; ignored.\n");
|
CIFReadError("polygon, but improper path; ignored.\n");
|
||||||
CIFSkipToSemi();
|
CIFSkipToSemi();
|
||||||
|
|
@ -861,13 +817,11 @@ CIFParsePoly(void)
|
||||||
CIFSkipToSemi();
|
CIFSkipToSemi();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (; rectp != NULL ; rectp = rectp->r_next)
|
for (; rectp != NULL ; rectp = rectp->r_next)
|
||||||
{
|
{
|
||||||
DBPaintPlane(cifReadPlane, &rectp->r_r, CIFPaintTable,
|
DBPaintPlane(cifReadPlane, &rectp->r_r, CIFPaintTable,
|
||||||
(PaintUndoInfo *) NULL);
|
(PaintUndoInfo *) NULL);
|
||||||
freeMagic1(&mm1, (char *) rectp);
|
freeMagic((char *) rectp);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
130
cif/CIFrdtech.c
130
cif/CIFrdtech.c
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdtech.c,v 1.4 2010/09/15 15:45:30 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdtech.c,v 1.4 2010/09/15 15:45:30 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -62,8 +62,8 @@ CIFReadLayer *cifCurReadLayer; /* Current layer being processed. */
|
||||||
CIFOp *cifCurReadOp; /* Last geometric operation seen. */
|
CIFOp *cifCurReadOp; /* Last geometric operation seen. */
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
void cifReadStyleInit(void);
|
void cifReadStyleInit();
|
||||||
void CIFReadLoadStyle(char *stylename);
|
void CIFReadLoadStyle();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
|
|
@ -90,9 +90,8 @@ void CIFReadLoadStyle(char *stylename);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFReadTechLimitScale(
|
CIFReadTechLimitScale(ns, ds)
|
||||||
int ns,
|
int ns, ds;
|
||||||
int ds)
|
|
||||||
{
|
{
|
||||||
int gridup, scaledown;
|
int gridup, scaledown;
|
||||||
int scale, limit, mult;
|
int scale, limit, mult;
|
||||||
|
|
@ -132,9 +131,9 @@ CIFReadTechLimitScale(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFReadNameToType(
|
CIFReadNameToType(name, newOK)
|
||||||
char *name, /* Name of a CIF layer. */
|
char *name; /* Name of a CIF layer. */
|
||||||
bool newOK) /* TRUE means OK to create a new layer if this
|
bool newOK; /* TRUE means OK to create a new layer if this
|
||||||
* name is one we haven't seen before.
|
* name is one we haven't seen before.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -197,34 +196,34 @@ CIFReadNameToType(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFCalmaLayerToCifLayer(
|
CIFCalmaLayerToCifLayer(layer, datatype, calmaStyle)
|
||||||
int layer, /* Calma layer number */
|
int layer; /* Calma layer number */
|
||||||
int datatype, /* Calma datatype */
|
int datatype; /* Calma datatype */
|
||||||
CIFReadStyle *calmaStyle)
|
CIFReadStyle *calmaStyle;
|
||||||
{
|
{
|
||||||
CalmaLayerType clt;
|
CalmaLayerType clt;
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
|
|
||||||
clt.clt_layer = layer;
|
clt.clt_layer = layer;
|
||||||
clt.clt_type = datatype;
|
clt.clt_type = datatype;
|
||||||
if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)))
|
if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))
|
||||||
return ((spointertype) HashGetValue(he));
|
return ((spointertype) HashGetValue(he));
|
||||||
|
|
||||||
/* Try wildcarding the datatype */
|
/* Try wildcarding the datatype */
|
||||||
clt.clt_type = -1;
|
clt.clt_type = -1;
|
||||||
if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)))
|
if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))
|
||||||
return ((spointertype) HashGetValue(he));
|
return ((spointertype) HashGetValue(he));
|
||||||
|
|
||||||
/* Try wildcarding the layer */
|
/* Try wildcarding the layer */
|
||||||
clt.clt_layer = -1;
|
clt.clt_layer = -1;
|
||||||
clt.clt_type = datatype;
|
clt.clt_type = datatype;
|
||||||
if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)))
|
if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))
|
||||||
return ((spointertype) HashGetValue(he));
|
return ((spointertype) HashGetValue(he));
|
||||||
|
|
||||||
/* Try wildcarding them both, for a default value */
|
/* Try wildcarding them both, for a default value */
|
||||||
clt.clt_layer = -1;
|
clt.clt_layer = -1;
|
||||||
clt.clt_type = -1;
|
clt.clt_type = -1;
|
||||||
if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)))
|
if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))
|
||||||
return ((spointertype) HashGetValue(he));
|
return ((spointertype) HashGetValue(he));
|
||||||
|
|
||||||
/* No luck */
|
/* No luck */
|
||||||
|
|
@ -252,10 +251,10 @@ CIFCalmaLayerToCifLayer(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFParseReadLayers(
|
CIFParseReadLayers(string, mask, newok)
|
||||||
char *string, /* Comma-separated list of CIF layers. */
|
char *string; /* Comma-separated list of CIF layers. */
|
||||||
TileTypeBitMask *mask, /* Where to store bit mask. */
|
TileTypeBitMask *mask; /* Where to store bit mask. */
|
||||||
bool newok) /* If TRUE, create new layers if they don't exist */
|
bool newok; /* If TRUE, create new layers if they don't exist */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
@ -314,7 +313,7 @@ CIFParseReadLayers(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifNewReadStyle(void)
|
cifNewReadStyle()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CIFOp *op;
|
CIFOp *op;
|
||||||
|
|
@ -324,20 +323,13 @@ cifNewReadStyle(void)
|
||||||
{
|
{
|
||||||
/* Destroy old style and free all memory allocated to it */
|
/* Destroy old style and free all memory allocated to it */
|
||||||
|
|
||||||
for (i = 0; i < MAXCIFRLAYERS; i++)
|
for (i=0; i<MAXCIFRLAYERS; i+=1)
|
||||||
{
|
{
|
||||||
layer = cifCurReadStyle->crs_layers[i];
|
layer = cifCurReadStyle->crs_layers[i];
|
||||||
if (layer != NULL)
|
if (layer != NULL)
|
||||||
{
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (op = layer->crl_ops; op != NULL; op = op->co_next)
|
for (op = layer->crl_ops; op != NULL; op = op->co_next)
|
||||||
{
|
freeMagic((char *)op);
|
||||||
if (op->co_opcode == CIFOP_MASKHINTS ||
|
|
||||||
op->co_opcode == CIFOP_TAGGED)
|
|
||||||
freeMagic((char *)op->co_client);
|
|
||||||
freeMagic1(&mm1, (char *)op);
|
|
||||||
}
|
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
freeMagic((char *)layer);
|
freeMagic((char *)layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -361,7 +353,7 @@ cifNewReadStyle(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifReadStyleInit(void)
|
cifReadStyleInit()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -403,7 +395,7 @@ cifReadStyleInit(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFReadTechInit(void)
|
CIFReadTechInit()
|
||||||
{
|
{
|
||||||
CIFReadKeep *style;
|
CIFReadKeep *style;
|
||||||
|
|
||||||
|
|
@ -415,13 +407,11 @@ CIFReadTechInit(void)
|
||||||
|
|
||||||
/* forget the list of styles */
|
/* forget the list of styles */
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (style = cifReadStyleList; style != NULL; style = style->crs_next)
|
for (style = cifReadStyleList; style != NULL; style = style->crs_next)
|
||||||
{
|
{
|
||||||
freeMagic(style->crs_name);
|
freeMagic(style->crs_name);
|
||||||
freeMagic1(&mm1, style);
|
freeMagic(style);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
cifReadStyleList = NULL;
|
cifReadStyleList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -443,7 +433,7 @@ CIFReadTechInit(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFReadTechStyleInit(void)
|
CIFReadTechStyleInit()
|
||||||
{
|
{
|
||||||
cifNReadLayers = 0;
|
cifNReadLayers = 0;
|
||||||
cifCurReadLayer = NULL;
|
cifCurReadLayer = NULL;
|
||||||
|
|
@ -470,10 +460,10 @@ CIFReadTechStyleInit(void)
|
||||||
*/
|
*/
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
bool
|
bool
|
||||||
CIFReadTechLine(
|
CIFReadTechLine(sectionName, argc, argv)
|
||||||
char *sectionName, /* Name of this section ("cifinput"). */
|
char *sectionName; /* Name of this section ("cifinput"). */
|
||||||
int argc, /* Number of fields on line. */
|
int argc; /* Number of fields on line. */
|
||||||
char *argv[]) /* Values of fields. */
|
char *argv[]; /* Values of fields. */
|
||||||
{
|
{
|
||||||
CIFOp *newOp = NULL;
|
CIFOp *newOp = NULL;
|
||||||
CIFReadKeep *newStyle, *p;
|
CIFReadKeep *newStyle, *p;
|
||||||
|
|
@ -995,12 +985,6 @@ CIFReadTechLine(
|
||||||
newOp->co_opcode = CIFOP_COPYUP;
|
newOp->co_opcode = CIFOP_COPYUP;
|
||||||
else if (strcmp(argv[0], "boundary") == 0)
|
else if (strcmp(argv[0], "boundary") == 0)
|
||||||
newOp->co_opcode = CIFOP_BOUNDARY;
|
newOp->co_opcode = CIFOP_BOUNDARY;
|
||||||
else if (strcmp(argv[0], "not-square") == 0)
|
|
||||||
newOp->co_opcode = CIFOP_NOTSQUARE;
|
|
||||||
else if (strcmp(argv[0], "mask-hints") == 0)
|
|
||||||
newOp->co_opcode = CIFOP_MASKHINTS;
|
|
||||||
else if (strcmp(argv[0], "tagged") == 0)
|
|
||||||
newOp->co_opcode = CIFOP_TAGGED;
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TechError("Unknown statement \"%s\".\n", argv[0]);
|
TechError("Unknown statement \"%s\".\n", argv[0]);
|
||||||
|
|
@ -1027,16 +1011,6 @@ CIFReadTechLine(
|
||||||
goto errorReturn;
|
goto errorReturn;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CIFOP_MASKHINTS:
|
|
||||||
if (argc != 2) goto wrongNumArgs;
|
|
||||||
newOp->co_client = (ClientData)StrDup((char **)NULL, argv[1]);
|
|
||||||
break;
|
|
||||||
case CIFOP_TAGGED:
|
|
||||||
if ((argc != 2) && (argc != 3)) goto wrongNumArgs;
|
|
||||||
newOp->co_client = (ClientData)StrDup((char **)NULL, argv[1]);
|
|
||||||
if (argc == 3)
|
|
||||||
CIFParseReadLayers(argv[2], &newOp->co_cifMask, TRUE);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Link the new CIFOp onto the list. */
|
/* Link the new CIFOp onto the list. */
|
||||||
|
|
@ -1077,7 +1051,7 @@ CIFReadTechLine(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFReadTechFinal(void)
|
CIFReadTechFinal()
|
||||||
{
|
{
|
||||||
/* Reduce the scale by the multiplier, as much as possible while */
|
/* Reduce the scale by the multiplier, as much as possible while */
|
||||||
/* keeping all CIF input ops in integer units. */
|
/* keeping all CIF input ops in integer units. */
|
||||||
|
|
@ -1120,10 +1094,9 @@ CIFReadTechFinal(void)
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFReadLoadStyle(
|
CIFReadLoadStyle(stylename)
|
||||||
char *stylename)
|
char *stylename;
|
||||||
{
|
{
|
||||||
SectionID invcifr;
|
SectionID invcifr;
|
||||||
|
|
||||||
|
|
@ -1165,8 +1138,8 @@ CIFReadLoadStyle(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFReadGetGrowSize(
|
CIFReadGetGrowSize(type)
|
||||||
TileType type)
|
TileType type;
|
||||||
{
|
{
|
||||||
CIFReadStyle *istyle = cifCurReadStyle;
|
CIFReadStyle *istyle = cifCurReadStyle;
|
||||||
CIFOp *op;
|
CIFOp *op;
|
||||||
|
|
@ -1220,8 +1193,8 @@ CIFReadGetGrowSize(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
float
|
float
|
||||||
CIFGetInputScale(
|
CIFGetInputScale(convert)
|
||||||
int convert)
|
int convert;
|
||||||
{
|
{
|
||||||
/* Avoid divide-by-0 error if there is no cif input style */
|
/* Avoid divide-by-0 error if there is no cif input style */
|
||||||
/* in the tech file. */
|
/* in the tech file. */
|
||||||
|
|
@ -1253,10 +1226,10 @@ CIFGetInputScale(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFPrintReadStyle(
|
CIFPrintReadStyle(dolist, doforall, docurrent)
|
||||||
bool dolist, /* Return as a list if true */
|
bool dolist; /* Return as a list if true */
|
||||||
bool doforall, /* Return list of all styles if true */
|
bool doforall; /* Return list of all styles if true */
|
||||||
bool docurrent) /* Return current style if true */
|
bool docurrent; /* Return current style if true */
|
||||||
{
|
{
|
||||||
CIFReadKeep *style;
|
CIFReadKeep *style;
|
||||||
|
|
||||||
|
|
@ -1324,8 +1297,8 @@ CIFPrintReadStyle(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFSetReadStyle(
|
CIFSetReadStyle(name)
|
||||||
char *name) /* Name of the new style. If NULL,
|
char *name; /* Name of the new style. If NULL,
|
||||||
* just print the name of the current
|
* just print the name of the current
|
||||||
* style.
|
* style.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1385,10 +1358,10 @@ CIFSetReadStyle(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifParseCalmaNums(
|
cifParseCalmaNums(str, numArray, numNums)
|
||||||
char *str, /* String to parse */
|
char *str; /* String to parse */
|
||||||
int *numArray, /* Array to fill in */
|
int *numArray; /* Array to fill in */
|
||||||
int numNums) /* Maximum number of entries in numArray */
|
int numNums; /* Maximum number of entries in numArray */
|
||||||
{
|
{
|
||||||
int numFilled, num;
|
int numFilled, num;
|
||||||
|
|
||||||
|
|
@ -1448,10 +1421,9 @@ cifParseCalmaNums(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFTechInputScale(
|
CIFTechInputScale(n, d, opt)
|
||||||
int n,
|
int n, d;
|
||||||
int d,
|
bool opt;
|
||||||
bool opt)
|
|
||||||
{
|
{
|
||||||
CIFReadStyle *istyle = cifCurReadStyle;
|
CIFReadStyle *istyle = cifCurReadStyle;
|
||||||
CIFReadLayer *cl;
|
CIFReadLayer *cl;
|
||||||
|
|
|
||||||
147
cif/CIFrdutils.c
147
cif/CIFrdutils.c
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdutils.c,v 1.4 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFrdutils.c,v 1.4 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -129,7 +129,7 @@ Plane *cifReadPlane; /* Plane into which to paint material
|
||||||
|
|
||||||
/* VARARGS1 */
|
/* VARARGS1 */
|
||||||
void
|
void
|
||||||
CIFReadError(const char *format, ...)
|
CIFReadError(char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
|
|
@ -140,7 +140,7 @@ CIFReadError(const char *format, ...)
|
||||||
if (cifLineNumber > 0)
|
if (cifLineNumber > 0)
|
||||||
TxError("Error at line %d of CIF file: ", cifLineNumber);
|
TxError("Error at line %d of CIF file: ", cifLineNumber);
|
||||||
else
|
else
|
||||||
TxError("CIF file read error: ");
|
TxError("CIF file read error: ", cifLineNumber);
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
Vfprintf(stderr, format, args);
|
Vfprintf(stderr, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
@ -153,7 +153,7 @@ CIFReadError(const char *format, ...)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFReadWarning(const char *format, ...)
|
CIFReadWarning(char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
|
|
@ -205,9 +205,9 @@ CIFReadWarning(const char *format, ...)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFScaleCoord(
|
CIFScaleCoord(cifCoord, snap_type)
|
||||||
int cifCoord, /* A coordinate in CIF units. */
|
int cifCoord; /* A coordinate in CIF units. */
|
||||||
int snap_type) /* How to deal with fractional results */
|
int snap_type; /* How to deal with fractional results */
|
||||||
{
|
{
|
||||||
int result, scale, remain, denom;
|
int result, scale, remain, denom;
|
||||||
int mult, mfactor;
|
int mult, mfactor;
|
||||||
|
|
@ -276,10 +276,8 @@ CIFScaleCoord(
|
||||||
PlowAfterTech();
|
PlowAfterTech();
|
||||||
ExtTechScale(1, denom);
|
ExtTechScale(1, denom);
|
||||||
WireTechScale(1, denom);
|
WireTechScale(1, denom);
|
||||||
#ifdef ROUTE_MODULE
|
|
||||||
MZAfterTech();
|
MZAfterTech();
|
||||||
IRAfterTech();
|
IRAfterTech();
|
||||||
#endif
|
|
||||||
#ifdef LEF_MODULE
|
#ifdef LEF_MODULE
|
||||||
LefTechScale(1, denom);
|
LefTechScale(1, denom);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -345,8 +343,8 @@ CIFScaleCoord(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifIsBlank(
|
cifIsBlank(ch)
|
||||||
int ch)
|
int ch;
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( isdigit(ch) || isupper(ch)
|
if ( isdigit(ch) || isupper(ch)
|
||||||
|
|
@ -378,7 +376,7 @@ cifIsBlank(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFSkipBlanks(void)
|
CIFSkipBlanks()
|
||||||
{
|
{
|
||||||
|
|
||||||
while (cifIsBlank(PEEK())) {
|
while (cifIsBlank(PEEK())) {
|
||||||
|
|
@ -407,7 +405,7 @@ CIFSkipBlanks(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFSkipSep(void)
|
CIFSkipSep()
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
|
|
@ -437,7 +435,7 @@ CIFSkipSep(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFSkipToSemi(void)
|
CIFSkipToSemi()
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
|
|
@ -466,7 +464,7 @@ CIFSkipToSemi(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFSkipSemi(void)
|
CIFSkipSemi()
|
||||||
{
|
{
|
||||||
|
|
||||||
CIFSkipBlanks();
|
CIFSkipBlanks();
|
||||||
|
|
@ -497,8 +495,8 @@ CIFSkipSemi(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseSInteger(
|
CIFParseSInteger(valuep)
|
||||||
int *valuep)
|
int *valuep;
|
||||||
{
|
{
|
||||||
bool is_signed;
|
bool is_signed;
|
||||||
char buffer[ BUFSIZ ];
|
char buffer[ BUFSIZ ];
|
||||||
|
|
@ -542,8 +540,8 @@ CIFParseSInteger(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseInteger(
|
CIFParseInteger(valuep)
|
||||||
int *valuep)
|
int *valuep;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!CIFParseSInteger(valuep))
|
if (!CIFParseSInteger(valuep))
|
||||||
|
|
@ -583,9 +581,9 @@ CIFParseInteger(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParsePoint(
|
CIFParsePoint(pointp, iscale)
|
||||||
Point *pointp,
|
Point *pointp;
|
||||||
int iscale)
|
int iscale;
|
||||||
{
|
{
|
||||||
int rescale;
|
int rescale;
|
||||||
|
|
||||||
|
|
@ -651,11 +649,12 @@ CIFParsePoint(
|
||||||
* one or more points.
|
* one or more points.
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* non-NULL CIFPath* the caller takes ownership of
|
* TRUE is returned if the path was parsed successfully,
|
||||||
* if the path was parsed successfully, otherwise NULL.
|
* FALSE otherwise.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* None
|
* Modifies the parameter pathheadpp to point to the path
|
||||||
|
* that is constructed.
|
||||||
*
|
*
|
||||||
* Corrections:
|
* Corrections:
|
||||||
* CIF coordinates are multiplied by 2 to cover the case where
|
* CIF coordinates are multiplied by 2 to cover the case where
|
||||||
|
|
@ -667,16 +666,17 @@ CIFParsePoint(
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CIFPath *
|
bool
|
||||||
CIFParsePath(
|
CIFParsePath(pathheadpp, iscale)
|
||||||
int iscale)
|
CIFPath **pathheadpp;
|
||||||
|
int iscale;
|
||||||
{
|
{
|
||||||
CIFPath *pathheadp, *pathtailp, *newpathp;
|
CIFPath *pathtailp, *newpathp;
|
||||||
bool nonManhattan = FALSE; /* diagnostic only */
|
bool nonManhattan = FALSE; /* diagnostic only */
|
||||||
CIFPath path;
|
CIFPath path;
|
||||||
int savescale;
|
int savescale;
|
||||||
|
|
||||||
pathheadp = NULL;
|
*pathheadpp = NULL;
|
||||||
pathtailp = NULL;
|
pathtailp = NULL;
|
||||||
path.cifp_next = NULL;
|
path.cifp_next = NULL;
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
|
|
@ -688,12 +688,12 @@ CIFParsePath(
|
||||||
savescale = cifReadScale1;
|
savescale = cifReadScale1;
|
||||||
if (!CIFParsePoint(&path.cifp_point, iscale))
|
if (!CIFParsePoint(&path.cifp_point, iscale))
|
||||||
{
|
{
|
||||||
CIFFreePath(pathheadp);
|
CIFFreePath(*pathheadpp);
|
||||||
return NULL;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (savescale != cifReadScale1)
|
if (savescale != cifReadScale1)
|
||||||
{
|
{
|
||||||
CIFPath *phead = pathheadp;
|
CIFPath *phead = *pathheadpp;
|
||||||
int newscale = cifReadScale1 / savescale;
|
int newscale = cifReadScale1 / savescale;
|
||||||
while (phead != NULL)
|
while (phead != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -704,7 +704,7 @@ CIFParsePath(
|
||||||
}
|
}
|
||||||
newpathp = (CIFPath *) mallocMagic((unsigned) (sizeof (CIFPath)));
|
newpathp = (CIFPath *) mallocMagic((unsigned) (sizeof (CIFPath)));
|
||||||
*newpathp = path;
|
*newpathp = path;
|
||||||
if (pathheadp)
|
if (*pathheadpp)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Check that this segment is Manhattan. If not, remember the
|
* Check that this segment is Manhattan. If not, remember the
|
||||||
|
|
@ -721,10 +721,10 @@ CIFParsePath(
|
||||||
}
|
}
|
||||||
pathtailp->cifp_next = newpathp;
|
pathtailp->cifp_next = newpathp;
|
||||||
}
|
}
|
||||||
else pathheadp = newpathp;
|
else *pathheadpp = newpathp;
|
||||||
pathtailp = newpathp;
|
pathtailp = newpathp;
|
||||||
}
|
}
|
||||||
return pathheadp;
|
return (*pathheadpp != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -744,9 +744,9 @@ CIFParsePath(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
test_insideness(
|
test_insideness(start, tpoint)
|
||||||
CIFPath *start,
|
CIFPath *start;
|
||||||
Point *tpoint)
|
Point *tpoint;
|
||||||
{
|
{
|
||||||
Rect tmprect, irect;
|
Rect tmprect, irect;
|
||||||
|
|
||||||
|
|
@ -782,11 +782,10 @@ test_insideness(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
seg_intersect(
|
seg_intersect(tstart, bf, bs, respt)
|
||||||
CIFPath *tstart,
|
CIFPath *tstart;
|
||||||
Point *bf,
|
Point *bf, *bs;
|
||||||
Point *bs,
|
Point *respt;
|
||||||
Point *respt)
|
|
||||||
{
|
{
|
||||||
int afx = tstart->cifp_x;
|
int afx = tstart->cifp_x;
|
||||||
int afy = tstart->cifp_y;
|
int afy = tstart->cifp_y;
|
||||||
|
|
@ -849,10 +848,9 @@ seg_intersect(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
path_intersect(
|
path_intersect(pathHead, start, respt)
|
||||||
CIFPath *pathHead,
|
CIFPath *pathHead, *start;
|
||||||
CIFPath *start,
|
Point *respt;
|
||||||
Point *respt)
|
|
||||||
{
|
{
|
||||||
CIFPath *path, *segcrossed, *new;
|
CIFPath *path, *segcrossed, *new;
|
||||||
Point tmppt;
|
Point tmppt;
|
||||||
|
|
@ -955,8 +953,8 @@ path_intersect(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
is_clockwise(
|
is_clockwise(pathHead)
|
||||||
CIFPath *pathHead)
|
CIFPath *pathHead;
|
||||||
{
|
{
|
||||||
CIFPath *path, *midx = NULL, *last;
|
CIFPath *path, *midx = NULL, *last;
|
||||||
Point *p1, *p2, *p3;
|
Point *p1, *p2, *p3;
|
||||||
|
|
@ -1049,11 +1047,11 @@ is_clockwise(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFMakeManhattanPath(
|
CIFMakeManhattanPath(pathHead, plane, resultTbl, ui)
|
||||||
CIFPath *pathHead,
|
CIFPath *pathHead;
|
||||||
Plane *plane,
|
Plane *plane;
|
||||||
const PaintResultType *resultTbl,
|
PaintResultType *resultTbl;
|
||||||
PaintUndoInfo *ui)
|
PaintUndoInfo *ui;
|
||||||
{
|
{
|
||||||
CIFPath *new, *new2, *next, *path;
|
CIFPath *new, *new2, *next, *path;
|
||||||
int xinit, xdiff, xincr, xlast, x;
|
int xinit, xdiff, xincr, xlast, x;
|
||||||
|
|
@ -1187,9 +1185,8 @@ CIFMakeManhattanPath(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFEdgeDirection(
|
CIFEdgeDirection(first, last)
|
||||||
CIFPath *first,
|
CIFPath *first, *last; /* Edge to be categorized. */
|
||||||
CIFPath *last) /* Edge to be categorized. */
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (first->cifp_x < last->cifp_x)
|
if (first->cifp_x < last->cifp_x)
|
||||||
|
|
@ -1236,8 +1233,8 @@ CIFEdgeDirection(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFCleanPath(
|
CIFCleanPath(pathHead)
|
||||||
CIFPath *pathHead)
|
CIFPath *pathHead;
|
||||||
{
|
{
|
||||||
CIFPath *next, *path, *prev, *last;
|
CIFPath *next, *path, *prev, *last;
|
||||||
int dir1, dir2;
|
int dir1, dir2;
|
||||||
|
|
@ -1256,7 +1253,7 @@ CIFCleanPath(
|
||||||
if (!path) return;
|
if (!path) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((next = path->cifp_next))
|
while (next = path->cifp_next)
|
||||||
{
|
{
|
||||||
if ((dir2 = CIFEdgeDirection(path, next)) == CIF_ZERO)
|
if ((dir2 = CIFEdgeDirection(path, next)) == CIF_ZERO)
|
||||||
{
|
{
|
||||||
|
|
@ -1335,16 +1332,14 @@ path_inc:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFFreePath(
|
CIFFreePath(path)
|
||||||
CIFPath *path) /* Path to be freed. */
|
CIFPath *path; /* Path to be freed. */
|
||||||
{
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
while (path != NULL)
|
while (path != NULL)
|
||||||
{
|
{
|
||||||
freeMagic1(&mm1, (char *) path);
|
freeMagic((char *) path);
|
||||||
path = path->cifp_next;
|
path = path->cifp_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1366,7 +1361,7 @@ CIFFreePath(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifCommandError(void)
|
cifCommandError()
|
||||||
{
|
{
|
||||||
CIFReadError("unknown command `%c'; ignored.\n" , PEEK());
|
CIFReadError("unknown command `%c'; ignored.\n" , PEEK());
|
||||||
CIFSkipToSemi();
|
CIFSkipToSemi();
|
||||||
|
|
@ -1391,7 +1386,7 @@ cifCommandError(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifParseEnd(void)
|
cifParseEnd()
|
||||||
{
|
{
|
||||||
TAKE();
|
TAKE();
|
||||||
CIFSkipBlanks();
|
CIFSkipBlanks();
|
||||||
|
|
@ -1420,7 +1415,7 @@ cifParseEnd(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifParseComment(void)
|
cifParseComment()
|
||||||
{
|
{
|
||||||
int opens;
|
int opens;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
@ -1471,9 +1466,9 @@ cifParseComment(void)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Transform *
|
Transform *
|
||||||
CIFDirectionToTrans(
|
CIFDirectionToTrans(point)
|
||||||
const Point *point) /* Direction vector from origin. */
|
Point *point; /* Direction vector from origin. */
|
||||||
{
|
{
|
||||||
if ((point->p_x != 0) && (point->p_y == 0))
|
if ((point->p_x != 0) && (point->p_y == 0))
|
||||||
{
|
{
|
||||||
|
|
@ -1512,8 +1507,8 @@ CIFDirectionToTrans(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFParseTransform(
|
CIFParseTransform(transformp)
|
||||||
Transform *transformp)
|
Transform *transformp;
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
Point point;
|
Point point;
|
||||||
|
|
@ -1606,8 +1601,8 @@ CIFParseTransform(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFReadFile(
|
CIFReadFile(file)
|
||||||
FILE *file) /* File from which to read CIF. */
|
FILE *file; /* File from which to read CIF. */
|
||||||
{
|
{
|
||||||
/* We will use 1-word CIF numbers as keys in this hash table */
|
/* We will use 1-word CIF numbers as keys in this hash table */
|
||||||
CIFReadCellInit(1);
|
CIFReadCellInit(1);
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* rcsid "$Header: /usr/cvsroot/magic-8.0/cif/CIFread.h,v 1.3 2010/08/25 17:33:55 tim Exp $
|
* rcsid "$Header: /usr/cvsroot/magic-8.0/cif/CIFread.h,v 1.3 2010/08/25 17:33:55 tim Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAGIC__CIF__CIFREAD_H
|
#ifndef _CIFREAD_H
|
||||||
#define _MAGIC__CIF__CIFREAD_H
|
#define _CIFREAD_H
|
||||||
|
|
||||||
#include "cif/CIFint.h"
|
#include "cif/CIFint.h"
|
||||||
|
|
||||||
|
|
@ -104,10 +104,8 @@ typedef struct cifrstyle
|
||||||
/* Gives the Magic layer to use for labels
|
/* Gives the Magic layer to use for labels
|
||||||
* on each possible CIF layer.
|
* on each possible CIF layer.
|
||||||
*/
|
*/
|
||||||
/* enum labelType */ unsigned char crs_labelSticky[MAXCIFRLAYERS];
|
bool crs_labelSticky[MAXCIFRLAYERS];
|
||||||
/* Marker if label layer makes sticky labels
|
/* Marker if label layer makes sticky labels */
|
||||||
* enum labelType LABEL_TYPE_xxxxxx
|
|
||||||
*/
|
|
||||||
CIFReadLayer *crs_layers[MAXCIFRLAYERS];
|
CIFReadLayer *crs_layers[MAXCIFRLAYERS];
|
||||||
HashTable cifCalmaToCif; /* Table mapping from Calma layer numbers to
|
HashTable cifCalmaToCif; /* Table mapping from Calma layer numbers to
|
||||||
* CIF layers
|
* CIF layers
|
||||||
|
|
@ -154,45 +152,22 @@ typedef struct cifpath
|
||||||
|
|
||||||
/* Procedures */
|
/* Procedures */
|
||||||
|
|
||||||
extern bool CIFParseBox(void);
|
extern bool CIFParseBox(), CIFParseWire(), CIFParsePoly();
|
||||||
extern bool CIFParseWire(void);
|
extern bool CIFParseFlash(), CIFParseLayer(), CIFParseStart();
|
||||||
extern bool CIFParsePoly(void);
|
extern bool CIFParseFinish(), CIFParseDelete(), CIFParseUser();
|
||||||
extern bool CIFParseFlash(void);
|
extern bool CIFParseCall(), CIFParseTransform(), CIFParseInteger();
|
||||||
extern bool CIFParseLayer(void);
|
extern bool CIFParsePath(), CIFParsePoint(), CIFParseSInteger();
|
||||||
extern bool CIFParseStart(void);
|
extern void CIFSkipToSemi(), CIFSkipSep(), CIFSkipBlanks();
|
||||||
extern bool CIFParseFinish(void);
|
extern void CIFFreePath(), CIFCleanPath();
|
||||||
extern bool CIFParseDelete(void);
|
extern void CIFReadCellInit(), CIFReadCellCleanup();
|
||||||
extern bool CIFParseUser(void);
|
extern LinkedRect *CIFPolyToRects();
|
||||||
extern bool CIFParseCall(void);
|
extern Transform *CIFDirectionToTrans();
|
||||||
extern bool CIFParseTransform(Transform *transformp);
|
extern int CIFReadNameToType();
|
||||||
extern bool CIFParseInteger(int *valuep);
|
|
||||||
extern CIFPath *CIFParsePath(int iscale);
|
|
||||||
extern bool CIFParsePoint(Point *pointp, int iscale);
|
|
||||||
extern bool CIFParseSInteger(int *valuep);
|
|
||||||
extern void CIFSkipToSemi(void);
|
|
||||||
extern void CIFSkipSep(void);
|
|
||||||
extern void CIFSkipBlanks(void);
|
|
||||||
extern void CIFFreePath(CIFPath *path);
|
|
||||||
extern void CIFCleanPath(CIFPath *pathHead);
|
|
||||||
extern void CIFReadCellInit(int ptrkeys);
|
|
||||||
extern void CIFReadCellCleanup(int filetype);
|
|
||||||
extern LinkedRect *CIFPolyToRects(CIFPath *path, Plane *plane, const PaintResultType *resultTbl,
|
|
||||||
PaintUndoInfo *ui, bool isCalma);
|
|
||||||
extern const Transform *CIFDirectionToTrans(const Point *point);
|
|
||||||
extern int CIFReadNameToType(char *name, bool newOK);
|
|
||||||
|
|
||||||
extern int CIFCalmaLayerToCifLayer(int layer, int datatype, CIFReadStyle *calmaStyle);
|
|
||||||
extern void CIFPropRecordPath(CellDef *def, CIFPath *pathheadp, bool iswire, char *propname);
|
|
||||||
extern void CIFPaintWirePath(CIFPath *pathheadp, int width, bool endcap, Plane *plane,
|
|
||||||
const PaintResultType *ptable, PaintUndoInfo *ui);
|
|
||||||
extern void CIFMakeManhattanPath(CIFPath *pathHead, Plane *plane, const PaintResultType *resultTbl, PaintUndoInfo *ui);
|
|
||||||
|
|
||||||
extern int CIFEdgeDirection(CIFPath *first, CIFPath *last);
|
|
||||||
|
|
||||||
/* Variable argument procedures require complete prototype */
|
/* Variable argument procedures require complete prototype */
|
||||||
|
|
||||||
extern void CIFReadError(const char *format, ...) ATTR_FORMAT_PRINTF_1;
|
extern void CIFReadError(char *format, ...);
|
||||||
extern void CIFReadWarning(const char *format, ...) ATTR_FORMAT_PRINTF_1;
|
extern void CIFReadWarning(char *format, ...);
|
||||||
|
|
||||||
/* Variables shared by the CIF-reading modules, see CIFreadutils.c
|
/* Variables shared by the CIF-reading modules, see CIFreadutils.c
|
||||||
* for more details:
|
* for more details:
|
||||||
|
|
@ -221,4 +196,4 @@ extern int cifParseLaChar;
|
||||||
? (cifParseLaAvail = FALSE, cifParseLaChar) \
|
? (cifParseLaAvail = FALSE, cifParseLaChar) \
|
||||||
: (cifParseLaChar = getc(cifInputFile)))
|
: (cifParseLaChar = getc(cifInputFile)))
|
||||||
|
|
||||||
#endif /* _MAGIC__CIF__CIFREAD_H */
|
#endif /* _CIFREAD_H */
|
||||||
|
|
|
||||||
95
cif/CIFsee.c
95
cif/CIFsee.c
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFsee.c,v 1.5 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFsee.c,v 1.5 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -76,10 +76,9 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifPaintDBFunc(
|
cifPaintDBFunc(tile, pld)
|
||||||
Tile *tile, /* Tile of CIF information. */
|
Tile *tile; /* Tile of CIF information. */
|
||||||
TileType dinfo,
|
PaintLayerData *pld;
|
||||||
PaintLayerData *pld)
|
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
|
@ -107,7 +106,7 @@ cifPaintDBFunc(
|
||||||
if (DBPaintOnPlane(type, pNum))
|
if (DBPaintOnPlane(type, pNum))
|
||||||
{
|
{
|
||||||
ui.pu_pNum = pNum;
|
ui.pu_pNum = pNum;
|
||||||
DBNMPaintPlane(paintDef->cd_planes[pNum], TiGetTypeExact(tile) | dinfo,
|
DBNMPaintPlane(paintDef->cd_planes[pNum], TiGetTypeExact(tile),
|
||||||
&area, DBStdPaintTbl(type, pNum), (PaintUndoInfo *) &ui);
|
&area, DBStdPaintTbl(type, pNum), (PaintUndoInfo *) &ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,14 +132,14 @@ cifPaintDBFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFPaintLayer(
|
CIFPaintLayer(rootDef, area, cifLayer, magicLayer, paintDef)
|
||||||
CellDef *rootDef, /* Cell for which to generate CIF. Must be
|
CellDef *rootDef; /* Cell for which to generate CIF. Must be
|
||||||
* the rootDef of a window.
|
* the rootDef of a window.
|
||||||
*/
|
*/
|
||||||
Rect *area, /* Area in which to generate CIF. */
|
Rect *area; /* Area in which to generate CIF. */
|
||||||
char *cifLayer, /* CIF layer to highlight on the screen. */
|
char *cifLayer; /* CIF layer to highlight on the screen. */
|
||||||
int magicLayer, /* Magic layer to paint with the result */
|
int magicLayer; /* Magic layer to paint with the result */
|
||||||
CellDef *paintDef) /* CellDef to paint into (may be NULL) */
|
CellDef *paintDef; /* CellDef to paint into (may be NULL) */
|
||||||
{
|
{
|
||||||
int oldCount, i;
|
int oldCount, i;
|
||||||
char msg[100];
|
char msg[100];
|
||||||
|
|
@ -166,9 +165,9 @@ CIFPaintLayer(
|
||||||
scx.scx_use = CIFDummyUse;
|
scx.scx_use = CIFDummyUse;
|
||||||
scx.scx_trans = GeoIdentityTransform;
|
scx.scx_trans = GeoIdentityTransform;
|
||||||
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
||||||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||||
CIFCopyMaskHints(&scx, CIFComponentDef);
|
CIFCopyMaskHints(&scx, CIFComponentDef);
|
||||||
DBTreeSrCells(&scx, 0, CIFCopyMaskHints,
|
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||||
(ClientData)CIFComponentDef);
|
(ClientData)CIFComponentDef);
|
||||||
|
|
||||||
oldCount = DBWFeedbackCount;
|
oldCount = DBWFeedbackCount;
|
||||||
|
|
@ -218,10 +217,9 @@ CIFPaintLayer(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifSeeFunc(
|
cifSeeFunc(tile, sld)
|
||||||
Tile *tile, /* Tile to be entered as feedback. */
|
Tile *tile; /* Tile to be entered as feedback. */
|
||||||
TileType dinfo, /* Split tile information */
|
SeeLayerData *sld; /* Layer and explanation for the feedback. */
|
||||||
SeeLayerData *sld) /* Layer and explanation for the feedback. */
|
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
|
|
||||||
|
|
@ -235,10 +233,10 @@ cifSeeFunc(
|
||||||
(float)area.r_ybot / (float)CIFCurStyle->cs_scaleFactor);
|
(float)area.r_ybot / (float)CIFCurStyle->cs_scaleFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (NOTE: Preserve information about the geometry of a diagonal tile) */
|
|
||||||
DBWFeedbackAdd(&area, sld->text, cifSeeDef, CIFCurStyle->cs_scaleFactor,
|
DBWFeedbackAdd(&area, sld->text, cifSeeDef, CIFCurStyle->cs_scaleFactor,
|
||||||
sld->style | ((TiGetTypeExact(tile) | dinfo) &
|
sld->style |
|
||||||
(TT_DIAGONAL | TT_DIRECTION | TT_SIDE)));
|
(TiGetTypeExact(tile) & (TT_DIAGONAL | TT_DIRECTION | TT_SIDE)));
|
||||||
|
/* (preserve information about the geometry of a diagonal tile) */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,12 +258,12 @@ cifSeeFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFSeeLayer(
|
CIFSeeLayer(rootDef, area, layer)
|
||||||
CellDef *rootDef, /* Cell for which to generate CIF. Must be
|
CellDef *rootDef; /* Cell for which to generate CIF. Must be
|
||||||
* the rootDef of a window.
|
* the rootDef of a window.
|
||||||
*/
|
*/
|
||||||
Rect *area, /* Area in which to generate CIF. */
|
Rect *area; /* Area in which to generate CIF. */
|
||||||
char *layer) /* CIF layer to highlight on the screen. */
|
char *layer; /* CIF layer to highlight on the screen. */
|
||||||
{
|
{
|
||||||
int oldCount, i;
|
int oldCount, i;
|
||||||
char msg[100];
|
char msg[100];
|
||||||
|
|
@ -287,9 +285,9 @@ CIFSeeLayer(
|
||||||
scx.scx_use = CIFDummyUse;
|
scx.scx_use = CIFDummyUse;
|
||||||
scx.scx_trans = GeoIdentityTransform;
|
scx.scx_trans = GeoIdentityTransform;
|
||||||
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
||||||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||||
CIFCopyMaskHints(&scx, CIFComponentDef);
|
CIFCopyMaskHints(&scx, CIFComponentDef);
|
||||||
DBTreeSrCells(&scx, 0, CIFCopyMaskHints,
|
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||||
(ClientData)CIFComponentDef);
|
(ClientData)CIFComponentDef);
|
||||||
|
|
||||||
oldCount = DBWFeedbackCount;
|
oldCount = DBWFeedbackCount;
|
||||||
|
|
@ -350,14 +348,14 @@ CIFSeeLayer(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFSeeHierLayer(
|
CIFSeeHierLayer(rootDef, area, layer, arrays, subcells)
|
||||||
CellDef *rootDef, /* Def in which to compute CIF. Must be
|
CellDef *rootDef; /* Def in which to compute CIF. Must be
|
||||||
* the root definition of a window.
|
* the root definition of a window.
|
||||||
*/
|
*/
|
||||||
Rect *area, /* Area in which to generate CIF. */
|
Rect *area; /* Area in which to generate CIF. */
|
||||||
char *layer, /* CIF layer to be highlighted. */
|
char *layer; /* CIF layer to be highlighted. */
|
||||||
bool arrays, /* TRUE means show array interactions. */
|
bool arrays; /* TRUE means show array interactions. */
|
||||||
bool subcells) /* TRUE means show subcell interactions. */
|
bool subcells; /* TRUE means show subcell interactions. */
|
||||||
{
|
{
|
||||||
int i, oldCount;
|
int i, oldCount;
|
||||||
SeeLayerData sld;
|
SeeLayerData sld;
|
||||||
|
|
@ -428,11 +426,11 @@ typedef struct {
|
||||||
} coverstats;
|
} coverstats;
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFCoverageLayer(
|
CIFCoverageLayer(rootDef, area, layer, dolist)
|
||||||
CellDef *rootDef, /* Def in which to compute CIF coverage */
|
CellDef *rootDef; /* Def in which to compute CIF coverage */
|
||||||
Rect *area, /* Area in which to compute coverage */
|
Rect *area; /* Area in which to compute coverage */
|
||||||
char *layer, /* CIF layer for coverage computation. */
|
char *layer; /* CIF layer for coverage computation. */
|
||||||
bool dolist) /* If TRUE, report only the value, in decimal */
|
bool dolist; /* If TRUE, report only the value, in decimal */
|
||||||
{
|
{
|
||||||
coverstats cstats;
|
coverstats cstats;
|
||||||
int i, scale;
|
int i, scale;
|
||||||
|
|
@ -440,11 +438,9 @@ CIFCoverageLayer(
|
||||||
SearchContext scx;
|
SearchContext scx;
|
||||||
TileTypeBitMask mask, depend;
|
TileTypeBitMask mask, depend;
|
||||||
float fcover;
|
float fcover;
|
||||||
|
int cifCoverageFunc();
|
||||||
bool doBox = (area != &rootDef->cd_bbox) ? TRUE : FALSE;
|
bool doBox = (area != &rootDef->cd_bbox) ? TRUE : FALSE;
|
||||||
|
|
||||||
/* Forward declaration */
|
|
||||||
int cifCoverageFunc(Tile *tile, TileType dinfo, ClientData *arg);
|
|
||||||
|
|
||||||
/* Check out the CIF layer name. */
|
/* Check out the CIF layer name. */
|
||||||
|
|
||||||
if (!CIFNameToMask(layer, &mask, &depend)) return;
|
if (!CIFNameToMask(layer, &mask, &depend)) return;
|
||||||
|
|
@ -459,9 +455,9 @@ CIFCoverageLayer(
|
||||||
scx.scx_use = CIFDummyUse;
|
scx.scx_use = CIFDummyUse;
|
||||||
scx.scx_trans = GeoIdentityTransform;
|
scx.scx_trans = GeoIdentityTransform;
|
||||||
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
||||||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||||
CIFCopyMaskHints(&scx, CIFComponentDef);
|
CIFCopyMaskHints(&scx, CIFComponentDef);
|
||||||
DBTreeSrCells(&scx, 0, CIFCopyMaskHints,
|
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||||
(ClientData)CIFComponentDef);
|
(ClientData)CIFComponentDef);
|
||||||
|
|
||||||
CIFGen(CIFComponentDef, rootDef, area, CIFPlanes, &depend, TRUE, TRUE,
|
CIFGen(CIFComponentDef, rootDef, area, CIFPlanes, &depend, TRUE, TRUE,
|
||||||
|
|
@ -504,20 +500,19 @@ CIFCoverageLayer(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TxPrintf("%s Area = %"DLONG_PREFIX"d CIF units^2\n", doBox ? "Cursor Box" :
|
TxPrintf("%s Area = %lld CIF units^2\n", doBox ? "Cursor Box" :
|
||||||
"Cell", btotal);
|
"Cell", btotal);
|
||||||
TxPrintf("Layer Bounding Area = %"DLONG_PREFIX"d CIF units^2\n", atotal);
|
TxPrintf("Layer Bounding Area = %lld CIF units^2\n", atotal);
|
||||||
TxPrintf("Layer Total Area = %"DLONG_PREFIX"d CIF units^2\n", cstats.coverage);
|
TxPrintf("Layer Total Area = %lld CIF units^2\n", cstats.coverage);
|
||||||
TxPrintf("Coverage in %s = %1.1f%%\n", doBox ? "box" :
|
TxPrintf("Coverage in %s = %1.1f%%\n", doBox ? "box" :
|
||||||
"cell", 100.0 * fcover);
|
"cell", 100.0 * fcover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cifCoverageFunc(
|
cifCoverageFunc(tile, arg)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo, /* (unused) */
|
ClientData *arg;
|
||||||
ClientData *arg)
|
|
||||||
{
|
{
|
||||||
coverstats *cstats = (coverstats *)arg;
|
coverstats *cstats = (coverstats *)arg;
|
||||||
Rect r;
|
Rect r;
|
||||||
|
|
|
||||||
228
cif/CIFtech.c
228
cif/CIFtech.c
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFtech.c,v 1.7 2010/10/20 20:34:19 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFtech.c,v 1.7 2010/10/20 20:34:19 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -64,8 +64,8 @@ TileTypeBitMask CIFSolidBits;
|
||||||
|
|
||||||
/* Forward Declarations */
|
/* Forward Declarations */
|
||||||
|
|
||||||
void cifTechStyleInit(void);
|
void cifTechStyleInit();
|
||||||
bool cifCheckCalmaNum(char *str);
|
bool cifCheckCalmaNum();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
|
|
@ -85,7 +85,7 @@ bool cifCheckCalmaNum(char *str);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifTechFreeStyle(void)
|
cifTechFreeStyle()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CIFOp *op;
|
CIFOp *op;
|
||||||
|
|
@ -100,7 +100,6 @@ cifTechFreeStyle(void)
|
||||||
layer = CIFCurStyle->cs_layers[i];
|
layer = CIFCurStyle->cs_layers[i];
|
||||||
if (layer != NULL)
|
if (layer != NULL)
|
||||||
{
|
{
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (op = layer->cl_ops; op != NULL; op = op->co_next)
|
for (op = layer->cl_ops; op != NULL; op = op->co_next)
|
||||||
{
|
{
|
||||||
if (op->co_client != (ClientData)NULL)
|
if (op->co_client != (ClientData)NULL)
|
||||||
|
|
@ -111,8 +110,6 @@ cifTechFreeStyle(void)
|
||||||
case CIFOP_BBOX:
|
case CIFOP_BBOX:
|
||||||
case CIFOP_MAXRECT:
|
case CIFOP_MAXRECT:
|
||||||
case CIFOP_BOUNDARY:
|
case CIFOP_BOUNDARY:
|
||||||
case CIFOP_INTERACT:
|
|
||||||
case CIFOP_MANHATTAN:
|
|
||||||
/* These options use co_client to hold a single */
|
/* These options use co_client to hold a single */
|
||||||
/* integer value, so it is not allocated. */
|
/* integer value, so it is not allocated. */
|
||||||
break;
|
break;
|
||||||
|
|
@ -121,9 +118,8 @@ cifTechFreeStyle(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freeMagic1(&mm1, (char *)op);
|
freeMagic((char *)op);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
freeMagic((char *)layer);
|
freeMagic((char *)layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +148,7 @@ cifTechFreeStyle(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifTechNewStyle(void)
|
cifTechNewStyle()
|
||||||
{
|
{
|
||||||
cifTechFreeStyle();
|
cifTechFreeStyle();
|
||||||
cifTechStyleInit();
|
cifTechStyleInit();
|
||||||
|
|
@ -169,7 +165,7 @@ cifTechNewStyle(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifTechStyleInit(void)
|
cifTechStyleInit()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -220,23 +216,23 @@ cifTechStyleInit(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifParseLayers(
|
cifParseLayers(string, style, paintMask, cifMask, spaceOK)
|
||||||
char *string, /* List of layers. */
|
char *string; /* List of layers. */
|
||||||
CIFStyle *style, /* Gives CIF style for parsing string.*/
|
CIFStyle *style; /* Gives CIF style for parsing string.*/
|
||||||
TileTypeBitMask *paintMask, /* Place to store mask of paint layers. If
|
TileTypeBitMask *paintMask; /* Place to store mask of paint layers. If
|
||||||
* NULL, then only CIF layer names are
|
* NULL, then only CIF layer names are
|
||||||
* considered.
|
* considered.
|
||||||
*/
|
*/
|
||||||
TileTypeBitMask *cifMask, /* Place to store mask of CIF layers. If
|
TileTypeBitMask *cifMask; /* Place to store mask of CIF layers. If
|
||||||
* NULL, then only paint layer names are
|
* NULL, then only paint layer names are
|
||||||
* considered.
|
* considered.
|
||||||
*/
|
*/
|
||||||
int spaceOK) /* are space layers permissible in this cif
|
int spaceOK; /* are space layers permissible in this cif
|
||||||
layer?
|
layer?
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TileTypeBitMask curCifMask, curPaintMask;
|
TileTypeBitMask curCifMask, curPaintMask;
|
||||||
char curLayer[512], *p, *cp;
|
char curLayer[40], *p, *cp;
|
||||||
TileType paintType;
|
TileType paintType;
|
||||||
int i;
|
int i;
|
||||||
bool allResidues;
|
bool allResidues;
|
||||||
|
|
@ -248,10 +244,6 @@ cifParseLayers(
|
||||||
{
|
{
|
||||||
p = curLayer;
|
p = curLayer;
|
||||||
|
|
||||||
if (*string == '(')
|
|
||||||
while ((*string != ')') && (*string != 0))
|
|
||||||
*p++ = *string++;
|
|
||||||
|
|
||||||
if (*string == '*')
|
if (*string == '*')
|
||||||
{
|
{
|
||||||
allResidues = TRUE;
|
allResidues = TRUE;
|
||||||
|
|
@ -269,22 +261,7 @@ cifParseLayers(
|
||||||
|
|
||||||
if (paintMask != NULL)
|
if (paintMask != NULL)
|
||||||
{
|
{
|
||||||
if (*curLayer == '(')
|
paintType = DBTechNameTypes(curLayer, &curPaintMask);
|
||||||
{
|
|
||||||
TileType t;
|
|
||||||
|
|
||||||
/* Layer groups with parentheses can only be paint types,
|
|
||||||
* and will be parsed accordingly. Residues will be
|
|
||||||
* handled within the group. Set paintType to -3, which
|
|
||||||
* is flagged and handled below.
|
|
||||||
*/
|
|
||||||
DBTechNoisyNameMask(curLayer, &curPaintMask);
|
|
||||||
paintType = -3;
|
|
||||||
allResidues = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
paintType = DBTechNameTypes(curLayer, &curPaintMask);
|
|
||||||
|
|
||||||
if (paintType >= 0) goto okpaint;
|
if (paintType >= 0) goto okpaint;
|
||||||
}
|
}
|
||||||
else paintType = -2;
|
else paintType = -2;
|
||||||
|
|
@ -320,7 +297,7 @@ okpaint:
|
||||||
TechError("Ambiguous layer (type) \"%s\".\n", curLayer);
|
TechError("Ambiguous layer (type) \"%s\".\n", curLayer);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((paintType >= 0) || (paintType == -3))
|
if (paintType >= 0)
|
||||||
{
|
{
|
||||||
if (paintType == TT_SPACE && spaceOK ==0)
|
if (paintType == TT_SPACE && spaceOK ==0)
|
||||||
TechError("\"Space\" layer not permitted in CIF rules.\n");
|
TechError("\"Space\" layer not permitted in CIF rules.\n");
|
||||||
|
|
@ -380,7 +357,7 @@ okpaint:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFTechInit(void)
|
CIFTechInit()
|
||||||
{
|
{
|
||||||
CIFKeep *style;
|
CIFKeep *style;
|
||||||
|
|
||||||
|
|
@ -390,13 +367,11 @@ CIFTechInit(void)
|
||||||
|
|
||||||
/* forget the list of styles */
|
/* forget the list of styles */
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (style = CIFStyleList; style != NULL; style = style->cs_next)
|
for (style = CIFStyleList; style != NULL; style = style->cs_next)
|
||||||
{
|
{
|
||||||
freeMagic(style->cs_name);
|
freeMagic(style->cs_name);
|
||||||
freeMagic1(&mm1, style);
|
freeMagic(style);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
CIFStyleList = NULL;
|
CIFStyleList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -418,7 +393,7 @@ CIFTechInit(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFTechStyleInit(void)
|
CIFTechStyleInit()
|
||||||
{
|
{
|
||||||
CalmaTechInit();
|
CalmaTechInit();
|
||||||
|
|
||||||
|
|
@ -459,9 +434,8 @@ CIFTechStyleInit(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFTechLimitScale(
|
CIFTechLimitScale(ns, ds)
|
||||||
int ns,
|
int ns, ds;
|
||||||
int ds)
|
|
||||||
{
|
{
|
||||||
int gridup, scaledown;
|
int gridup, scaledown;
|
||||||
int scale, limit, expand;
|
int scale, limit, expand;
|
||||||
|
|
@ -500,9 +474,9 @@ CIFTechLimitScale(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFParseScale(
|
CIFParseScale(true_scale, expander)
|
||||||
char *true_scale,
|
char *true_scale;
|
||||||
int *expander)
|
int *expander;
|
||||||
{
|
{
|
||||||
char *decimal;
|
char *decimal;
|
||||||
short places;
|
short places;
|
||||||
|
|
@ -551,10 +525,10 @@ CIFParseScale(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFTechLine(
|
CIFTechLine(sectionName, argc, argv)
|
||||||
char *sectionName, /* The name of this section. */
|
char *sectionName; /* The name of this section. */
|
||||||
int argc, /* Number of fields on line. */
|
int argc; /* Number of fields on line. */
|
||||||
char *argv[]) /* Values of fields. */
|
char *argv[]; /* Values of fields. */
|
||||||
{
|
{
|
||||||
TileTypeBitMask mask, tempMask, cifMask, bloatLayers;
|
TileTypeBitMask mask, tempMask, cifMask, bloatLayers;
|
||||||
int i, j, l, distance;
|
int i, j, l, distance;
|
||||||
|
|
@ -817,7 +791,7 @@ CIFTechLine(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
l = strlen(CIFCurStyle->cs_name) - strlen(tptr);
|
l = strlen(CIFCurStyle->cs_name) - strlen(tptr);
|
||||||
if ((l > 0) && !strcmp(tptr, CIFCurStyle->cs_name + l))
|
if (!strcmp(tptr, CIFCurStyle->cs_name + l))
|
||||||
{
|
{
|
||||||
CIFCurStyle->cs_status = TECH_PENDING;
|
CIFCurStyle->cs_status = TECH_PENDING;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -1107,8 +1081,6 @@ CIFTechLine(
|
||||||
newOp->co_opcode = CIFOP_BBOX;
|
newOp->co_opcode = CIFOP_BBOX;
|
||||||
else if (strcmp(argv[0], "net") == 0)
|
else if (strcmp(argv[0], "net") == 0)
|
||||||
newOp->co_opcode = CIFOP_NET;
|
newOp->co_opcode = CIFOP_NET;
|
||||||
else if (strcmp(argv[0], "tagged") == 0)
|
|
||||||
newOp->co_opcode = CIFOP_TAGGED;
|
|
||||||
else if (strcmp(argv[0], "maxrect") == 0)
|
else if (strcmp(argv[0], "maxrect") == 0)
|
||||||
newOp->co_opcode = CIFOP_MAXRECT;
|
newOp->co_opcode = CIFOP_MAXRECT;
|
||||||
else if (strcmp(argv[0], "boundary") == 0)
|
else if (strcmp(argv[0], "boundary") == 0)
|
||||||
|
|
@ -1117,31 +1089,10 @@ CIFTechLine(
|
||||||
newOp->co_opcode = CIFOP_MASKHINTS;
|
newOp->co_opcode = CIFOP_MASKHINTS;
|
||||||
else if (strcmp(argv[0], "close") == 0)
|
else if (strcmp(argv[0], "close") == 0)
|
||||||
newOp->co_opcode = CIFOP_CLOSE;
|
newOp->co_opcode = CIFOP_CLOSE;
|
||||||
else if (strcmp(argv[0], "orthogonal") == 0)
|
|
||||||
newOp->co_opcode = CIFOP_MANHATTAN;
|
|
||||||
else if (strcmp(argv[0], "not-square") == 0)
|
|
||||||
newOp->co_opcode = CIFOP_NOTSQUARE;
|
|
||||||
else if (strcmp(argv[0], "bridge") == 0)
|
else if (strcmp(argv[0], "bridge") == 0)
|
||||||
newOp->co_opcode = CIFOP_BRIDGE;
|
newOp->co_opcode = CIFOP_BRIDGE;
|
||||||
else if (strcmp(argv[0], "bridge-lim") == 0)
|
else if (strcmp(argv[0], "bridge-lim") == 0)
|
||||||
newOp->co_opcode = CIFOP_BRIDGELIM;
|
newOp->co_opcode = CIFOP_BRIDGELIM;
|
||||||
else if (strcmp(argv[0], "overlapping") == 0)
|
|
||||||
newOp->co_opcode = CIFOP_INTERACT;
|
|
||||||
else if (strcmp(argv[0], "nonoverlapping") == 0)
|
|
||||||
{
|
|
||||||
newOp->co_opcode = CIFOP_INTERACT;
|
|
||||||
newOp->co_client = (ClientData)CIFOP_INT_NOT;
|
|
||||||
}
|
|
||||||
else if (strcmp(argv[0], "interacting") == 0)
|
|
||||||
{
|
|
||||||
newOp->co_opcode = CIFOP_INTERACT;
|
|
||||||
newOp->co_client = (ClientData)CIFOP_INT_TOUCHING;
|
|
||||||
}
|
|
||||||
else if (strcmp(argv[0], "noninteracting") == 0)
|
|
||||||
{
|
|
||||||
newOp->co_opcode = CIFOP_INTERACT;
|
|
||||||
newOp->co_client = (ClientData)(CIFOP_INT_TOUCHING | CIFOP_INT_NOT);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TechError("Unknown statement \"%s\".\n", argv[0]);
|
TechError("Unknown statement \"%s\".\n", argv[0]);
|
||||||
|
|
@ -1153,7 +1104,6 @@ CIFTechLine(
|
||||||
case CIFOP_AND:
|
case CIFOP_AND:
|
||||||
case CIFOP_ANDNOT:
|
case CIFOP_ANDNOT:
|
||||||
case CIFOP_OR:
|
case CIFOP_OR:
|
||||||
case CIFOP_INTERACT:
|
|
||||||
if (argc != 2) goto wrongNumArgs;
|
if (argc != 2) goto wrongNumArgs;
|
||||||
cifParseLayers(argv[1], CIFCurStyle, &newOp->co_paintMask,
|
cifParseLayers(argv[1], CIFCurStyle, &newOp->co_paintMask,
|
||||||
&newOp->co_cifMask,FALSE);
|
&newOp->co_cifMask,FALSE);
|
||||||
|
|
@ -1163,6 +1113,7 @@ CIFTechLine(
|
||||||
case CIFOP_GROWMIN:
|
case CIFOP_GROWMIN:
|
||||||
case CIFOP_GROW_G:
|
case CIFOP_GROW_G:
|
||||||
case CIFOP_SHRINK:
|
case CIFOP_SHRINK:
|
||||||
|
case CIFOP_CLOSE:
|
||||||
if (argc != 2) goto wrongNumArgs;
|
if (argc != 2) goto wrongNumArgs;
|
||||||
newOp->co_distance = atoi(argv[1]);
|
newOp->co_distance = atoi(argv[1]);
|
||||||
if (newOp->co_distance <= 0)
|
if (newOp->co_distance <= 0)
|
||||||
|
|
@ -1172,26 +1123,6 @@ CIFTechLine(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CIFOP_CLOSE:
|
|
||||||
/* "close" is like "grow" and "shrink" except that it can have
|
|
||||||
* no argument, in which case any closed shape of any size
|
|
||||||
* will be closed (useful for finding enclosed areas).
|
|
||||||
*/
|
|
||||||
if (argc == 1)
|
|
||||||
newOp->co_distance = 0;
|
|
||||||
else if (argc != 2)
|
|
||||||
goto wrongNumArgs;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newOp->co_distance = atoi(argv[1]);
|
|
||||||
if (newOp->co_distance <= 0)
|
|
||||||
{
|
|
||||||
TechError("Grow/shrink distance must be greater than zero.\n");
|
|
||||||
goto errorReturn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CIFOP_BRIDGE:
|
case CIFOP_BRIDGE:
|
||||||
if (argc != 3) goto wrongNumArgs;
|
if (argc != 3) goto wrongNumArgs;
|
||||||
newOp->co_distance = atoi(argv[1]);
|
newOp->co_distance = atoi(argv[1]);
|
||||||
|
|
@ -1232,7 +1163,7 @@ CIFTechLine(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CIFOP_BLOATALL:
|
case CIFOP_BLOATALL:
|
||||||
if (argc != 3 && argc != 4) goto wrongNumArgs;
|
if (argc != 3) goto wrongNumArgs;
|
||||||
cifParseLayers(argv[1], CIFCurStyle, &newOp->co_paintMask,
|
cifParseLayers(argv[1], CIFCurStyle, &newOp->co_paintMask,
|
||||||
&newOp->co_cifMask, FALSE);
|
&newOp->co_cifMask, FALSE);
|
||||||
bloats = (BloatData *)mallocMagic(sizeof(BloatData));
|
bloats = (BloatData *)mallocMagic(sizeof(BloatData));
|
||||||
|
|
@ -1248,21 +1179,6 @@ CIFTechLine(
|
||||||
if (!TTMaskIsZero(&mask) && !TTMaskIsZero(&cifMask))
|
if (!TTMaskIsZero(&mask) && !TTMaskIsZero(&cifMask))
|
||||||
TechError("Can't mix CIF and magic layers in bloat statement.\n");
|
TechError("Can't mix CIF and magic layers in bloat statement.\n");
|
||||||
|
|
||||||
if (argc == 4)
|
|
||||||
{
|
|
||||||
/* 12/23/2024: Allow an additional argument, which is a
|
|
||||||
* maximum halo distance to bloat (i.e., clip mask)
|
|
||||||
*/
|
|
||||||
newOp->co_distance = atoi(argv[3]);
|
|
||||||
if (newOp->co_distance <= 0)
|
|
||||||
{
|
|
||||||
TechError("Bloat distance must be greater than zero.\n");
|
|
||||||
goto errorReturn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
newOp->co_distance = 0;
|
|
||||||
|
|
||||||
/* 10/15/2019: Lifting restriction that the types that */
|
/* 10/15/2019: Lifting restriction that the types that */
|
||||||
/* trigger the bloating must be in the same plane as the */
|
/* trigger the bloating must be in the same plane as the */
|
||||||
/* types that are bloated into. */
|
/* types that are bloated into. */
|
||||||
|
|
@ -1359,12 +1275,10 @@ bloatCheck:
|
||||||
bloatDone: break;
|
bloatDone: break;
|
||||||
|
|
||||||
case CIFOP_NET:
|
case CIFOP_NET:
|
||||||
case CIFOP_TAGGED:
|
if (argc != 3) goto wrongNumArgs;
|
||||||
if ((argc != 2) && (argc != 3)) goto wrongNumArgs;
|
|
||||||
newOp->co_client = (ClientData)StrDup((char **)NULL, argv[1]);
|
newOp->co_client = (ClientData)StrDup((char **)NULL, argv[1]);
|
||||||
if (argc == 3)
|
cifParseLayers(argv[2], CIFCurStyle, &newOp->co_paintMask,
|
||||||
cifParseLayers(argv[2], CIFCurStyle, &newOp->co_paintMask,
|
&newOp->co_cifMask, FALSE);
|
||||||
&newOp->co_cifMask, FALSE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CIFOP_MASKHINTS:
|
case CIFOP_MASKHINTS:
|
||||||
|
|
@ -1385,19 +1299,6 @@ bloatCheck:
|
||||||
goto wrongNumArgs;
|
goto wrongNumArgs;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CIFOP_MANHATTAN:
|
|
||||||
if (argc == 2)
|
|
||||||
{
|
|
||||||
if (!strcmp(argv[1], "fill"))
|
|
||||||
newOp->co_client = (ClientData)1;
|
|
||||||
else if (strcmp(argv[1], "remove"))
|
|
||||||
TechError("Orthogonal takes only one optional argument "
|
|
||||||
"\"fill\" or \"remove\" (default).\n");
|
|
||||||
}
|
|
||||||
else if (argc != 1)
|
|
||||||
goto wrongNumArgs;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CIFOP_BBOX:
|
case CIFOP_BBOX:
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
|
|
@ -1624,8 +1525,8 @@ bloatCheck:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cifCheckCalmaNum(
|
cifCheckCalmaNum(str)
|
||||||
char *str)
|
char *str;
|
||||||
{
|
{
|
||||||
int n = atoi(str);
|
int n = atoi(str);
|
||||||
|
|
||||||
|
|
@ -1661,9 +1562,9 @@ cifCheckCalmaNum(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifComputeRadii(
|
cifComputeRadii(layer, des)
|
||||||
CIFLayer *layer, /* Layer for which to compute distances. */
|
CIFLayer *layer; /* Layer for which to compute distances. */
|
||||||
CIFStyle *des) /* CIF style (used to find temp layer
|
CIFStyle *des; /* CIF style (used to find temp layer
|
||||||
* distances.
|
* distances.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -1675,12 +1576,12 @@ cifComputeRadii(
|
||||||
|
|
||||||
for (op = layer->cl_ops; op != NULL; op = op->co_next)
|
for (op = layer->cl_ops; op != NULL; op = op->co_next)
|
||||||
{
|
{
|
||||||
/* BBOX, NET, TAGGED, and MASKHINTS operators should never be */
|
/* BBOX, NET, and MASKHINTS operators should never be used */
|
||||||
/* used hierarchically so ignore any grow/shrink operators that */
|
/* hierarchically so ignore any grow/shrink operators that */
|
||||||
/* come after them. */
|
/* come after them. */
|
||||||
|
|
||||||
if (op->co_opcode == CIFOP_BBOX || op->co_opcode == CIFOP_NET ||
|
if (op->co_opcode == CIFOP_BBOX || op->co_opcode == CIFOP_NET ||
|
||||||
op->co_opcode == CIFOP_TAGGED || op->co_opcode == CIFOP_MASKHINTS)
|
op->co_opcode == CIFOP_MASKHINTS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* If CIF layers are used, switch to the max of current
|
/* If CIF layers are used, switch to the max of current
|
||||||
|
|
@ -1708,7 +1609,6 @@ cifComputeRadii(
|
||||||
case CIFOP_AND:
|
case CIFOP_AND:
|
||||||
case CIFOP_ANDNOT:
|
case CIFOP_ANDNOT:
|
||||||
case CIFOP_OR:
|
case CIFOP_OR:
|
||||||
case CIFOP_INTERACT:
|
|
||||||
case CIFOP_MASKHINTS:
|
case CIFOP_MASKHINTS:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1770,8 +1670,8 @@ cifComputeRadii(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifComputeHalo(
|
cifComputeHalo(style)
|
||||||
CIFStyle *style)
|
CIFStyle *style;
|
||||||
{
|
{
|
||||||
int maxGrow, maxShrink, i;
|
int maxGrow, maxShrink, i;
|
||||||
|
|
||||||
|
|
@ -1787,8 +1687,7 @@ cifComputeHalo(
|
||||||
if (maxGrow > maxShrink)
|
if (maxGrow > maxShrink)
|
||||||
style->cs_radius = 2*maxGrow;
|
style->cs_radius = 2*maxGrow;
|
||||||
else style->cs_radius = 2*maxShrink;
|
else style->cs_radius = 2*maxShrink;
|
||||||
if (style->cs_scaleFactor > 0)
|
style->cs_radius /= style->cs_scaleFactor;
|
||||||
style->cs_radius /= style->cs_scaleFactor;
|
|
||||||
style->cs_radius++;
|
style->cs_radius++;
|
||||||
|
|
||||||
/* TxPrintf("Radius for %s CIF is %d.\n",
|
/* TxPrintf("Radius for %s CIF is %d.\n",
|
||||||
|
|
@ -1841,7 +1740,7 @@ cifComputeHalo(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFTechFinal(void)
|
CIFTechFinal()
|
||||||
{
|
{
|
||||||
CIFStyle *style = CIFCurStyle;
|
CIFStyle *style = CIFCurStyle;
|
||||||
CIFOp *op;
|
CIFOp *op;
|
||||||
|
|
@ -1990,10 +1889,10 @@ CIFTechFinal(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Presence of op->co_opcode in CIFOP_OR indicates a copy */
|
/* Presence of op->co_opcode in CIFOP_OR indicates a copy */
|
||||||
/* of the SquaresData pointer from a following operator. */
|
/* of the SquaresData pointer from a following operator */
|
||||||
/* CIFOP_BBOX and CIFOP_MAXRECT uses the co_client field */
|
/* CIFOP_BBOX and CIFOP_MAXRECT uses the co_client field */
|
||||||
/* as a flag field, while CIFOP_NET, CIFOP_MASKHINTS, and */
|
/* as a flag field, while CIFOP_NET and CIFOP_MASKHINTS */
|
||||||
/* CIFOP_TAGGED use it for a string. */
|
/* uses it for a string. */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (op->co_opcode)
|
switch (op->co_opcode)
|
||||||
|
|
@ -2003,9 +1902,7 @@ CIFTechFinal(void)
|
||||||
case CIFOP_MASKHINTS:
|
case CIFOP_MASKHINTS:
|
||||||
case CIFOP_BOUNDARY:
|
case CIFOP_BOUNDARY:
|
||||||
case CIFOP_MAXRECT:
|
case CIFOP_MAXRECT:
|
||||||
case CIFOP_MANHATTAN:
|
|
||||||
case CIFOP_NET:
|
case CIFOP_NET:
|
||||||
case CIFOP_TAGGED:
|
|
||||||
break;
|
break;
|
||||||
case CIFOP_BRIDGELIM:
|
case CIFOP_BRIDGELIM:
|
||||||
case CIFOP_BRIDGE:
|
case CIFOP_BRIDGE:
|
||||||
|
|
@ -2103,7 +2000,6 @@ CIFTechFinal(void)
|
||||||
|
|
||||||
case CIFOP_AND:
|
case CIFOP_AND:
|
||||||
case CIFOP_ANDNOT:
|
case CIFOP_ANDNOT:
|
||||||
case CIFOP_INTERACT:
|
|
||||||
case CIFOP_SHRINK:
|
case CIFOP_SHRINK:
|
||||||
case CIFOP_CLOSE:
|
case CIFOP_CLOSE:
|
||||||
case CIFOP_BRIDGELIM:
|
case CIFOP_BRIDGELIM:
|
||||||
|
|
@ -2228,8 +2124,8 @@ CIFTechFinal(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFLoadStyle(
|
CIFLoadStyle(stylename)
|
||||||
char *stylename)
|
char *stylename;
|
||||||
{
|
{
|
||||||
SectionID invcif;
|
SectionID invcif;
|
||||||
|
|
||||||
|
|
@ -2277,11 +2173,11 @@ CIFLoadStyle(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
CIFGetContactSize(
|
CIFGetContactSize(type, edge, spacing, border)
|
||||||
TileType type,
|
TileType type;
|
||||||
int *edge,
|
int *edge;
|
||||||
int *spacing,
|
int *border;
|
||||||
int *border)
|
int *spacing;
|
||||||
{
|
{
|
||||||
CIFStyle *style = CIFCurStyle;
|
CIFStyle *style = CIFCurStyle;
|
||||||
CIFOp *op, *sop;
|
CIFOp *op, *sop;
|
||||||
|
|
@ -2374,9 +2270,8 @@ CIFGetContactSize(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CIFTechOutputScale(
|
CIFTechOutputScale(n, d)
|
||||||
int n,
|
int n, d;
|
||||||
int d)
|
|
||||||
{
|
{
|
||||||
int i, j, lgcf, lexpand;
|
int i, j, lgcf, lexpand;
|
||||||
CIFStyle *ostyle = CIFCurStyle;
|
CIFStyle *ostyle = CIFCurStyle;
|
||||||
|
|
@ -2539,10 +2434,7 @@ CIFTechOutputScale(
|
||||||
case CIFOP_BOUNDARY:
|
case CIFOP_BOUNDARY:
|
||||||
case CIFOP_MASKHINTS:
|
case CIFOP_MASKHINTS:
|
||||||
case CIFOP_MAXRECT:
|
case CIFOP_MAXRECT:
|
||||||
case CIFOP_MANHATTAN:
|
|
||||||
case CIFOP_NET:
|
case CIFOP_NET:
|
||||||
case CIFOP_TAGGED:
|
|
||||||
case CIFOP_INTERACT:
|
|
||||||
break;
|
break;
|
||||||
case CIFOP_BRIDGELIM:
|
case CIFOP_BRIDGELIM:
|
||||||
case CIFOP_BRIDGE:
|
case CIFOP_BRIDGE:
|
||||||
|
|
@ -2657,8 +2549,8 @@ CIFTechOutputScale(
|
||||||
default:
|
default:
|
||||||
/* op->co_opcode in CIFOP_OR is a pointer copy, */
|
/* op->co_opcode in CIFOP_OR is a pointer copy, */
|
||||||
/* in CIFOP_BBOX and CIFOP_MAXRECT is a flag, */
|
/* in CIFOP_BBOX and CIFOP_MAXRECT is a flag, */
|
||||||
/* and in CIFOP_NET, CIFOP_MASKHINTS, and */
|
/* and in CIFOP_NET and CIFOP_MASKHINTS is a */
|
||||||
/* CIFOP_TAGGED is a string. */
|
/* string. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
103
cif/CIFwrite.c
103
cif/CIFwrite.c
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFwrite.c,v 1.2 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cif/CIFwrite.c,v 1.2 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -44,15 +44,15 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
#include "textio/textio.h"
|
#include "textio/textio.h"
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
extern int cifWriteInitFunc(CellDef *def, ClientData cdata); /* UNUSED */
|
extern int cifWriteInitFunc();
|
||||||
extern int cifWriteMarkFunc(CellUse *use);
|
extern int cifWriteMarkFunc();
|
||||||
extern int cifWritePaintFunc(Tile *tile, TileType dinfo, FILE *f);
|
extern int cifWritePaintFunc();
|
||||||
extern int cifWriteLabelFunc(Tile *tile, TileType dinfo, FILE *f);
|
extern int cifWriteLabelFunc();
|
||||||
extern int cifWriteUseFunc(CellUse *use, FILE *f);
|
extern int cifWriteUseFunc();
|
||||||
extern void cifOutPreamble(FILE *outf, CellDef *cell);
|
extern void cifOutPreamble();
|
||||||
extern void cifOut(FILE *outf);
|
extern void cifOut();
|
||||||
extern void cifOutFunc(CellDef *def, FILE *f);
|
extern void cifOutFunc();
|
||||||
extern void GrClipTriangle(Rect *r, Rect *c, int clipped, TileType dinfo, Point *points, int *np);
|
extern int GrClipTriangle();
|
||||||
|
|
||||||
/* Current cell number in CIF numbering scheme */
|
/* Current cell number in CIF numbering scheme */
|
||||||
|
|
||||||
|
|
@ -118,13 +118,12 @@ bool CIFArrayWriteDisable = FALSE;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFWrite(
|
CIFWrite(rootDef, f)
|
||||||
CellDef *rootDef, /* Pointer to CellDef to be written */
|
CellDef *rootDef; /* Pointer to CellDef to be written */
|
||||||
FILE *f) /* Open output file */
|
FILE *f; /* Open output file */
|
||||||
{
|
{
|
||||||
bool good;
|
bool good;
|
||||||
int oldCount = DBWFeedbackCount;
|
int oldCount = DBWFeedbackCount;
|
||||||
CellDef *err_def;
|
|
||||||
CellUse dummy;
|
CellUse dummy;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -134,11 +133,9 @@ CIFWrite(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dummy.cu_def = rootDef;
|
dummy.cu_def = rootDef;
|
||||||
err_def = DBCellReadArea(&dummy, &rootDef->cd_bbox, TRUE);
|
if (DBCellReadArea(&dummy, &rootDef->cd_bbox, TRUE))
|
||||||
if (err_def != NULL)
|
|
||||||
{
|
{
|
||||||
TxError("Failure to read in entire subtree of the cell.\n");
|
TxError("Failure to read in entire subtree of the cell.\n");
|
||||||
TxError("Failed on cell %s.\n", err_def->cd_name);
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
DBFixMismatch();
|
DBFixMismatch();
|
||||||
|
|
@ -167,8 +164,8 @@ CIFWrite(
|
||||||
cifOutPreamble(f, rootDef);
|
cifOutPreamble(f, rootDef);
|
||||||
cifOut(f);
|
cifOut(f);
|
||||||
StackFree(cifStack);
|
StackFree(cifStack);
|
||||||
if ((int) CD2INT(rootDef->cd_client) < 0)
|
if ((int) rootDef->cd_client < 0)
|
||||||
rootDef->cd_client = INT2CD(- (int) CD2INT(rootDef->cd_client));
|
rootDef->cd_client = (ClientData) (- (int) rootDef->cd_client);
|
||||||
|
|
||||||
/* See if any problems occurred. */
|
/* See if any problems occurred. */
|
||||||
|
|
||||||
|
|
@ -182,7 +179,7 @@ CIFWrite(
|
||||||
* Now we are almost done.
|
* Now we are almost done.
|
||||||
* Just output a call on the root cell
|
* Just output a call on the root cell
|
||||||
*/
|
*/
|
||||||
fprintf(f, "C %d;\nEnd\n", (int) CD2INT(rootDef->cd_client));
|
fprintf(f, "C %d;\nEnd\n", (int) rootDef->cd_client);
|
||||||
good = !ferror(f);
|
good = !ferror(f);
|
||||||
return (good);
|
return (good);
|
||||||
}
|
}
|
||||||
|
|
@ -204,11 +201,9 @@ CIFWrite(
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
int
|
int
|
||||||
cifWriteInitFunc(
|
cifWriteInitFunc(def)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
ClientData cdata) /* UNUSED */
|
|
||||||
{
|
{
|
||||||
def->cd_client = (ClientData) 0;
|
def->cd_client = (ClientData) 0;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
@ -231,11 +226,11 @@ cifWriteInitFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifWriteMarkFunc(
|
cifWriteMarkFunc(use)
|
||||||
CellUse *use)
|
CellUse *use;
|
||||||
{
|
{
|
||||||
if (use->cu_def->cd_client != (ClientData) 0) return 0;
|
if (use->cu_def->cd_client != (ClientData) 0) return 0;
|
||||||
use->cu_def->cd_client = INT2CD(cifCellNum);
|
use->cu_def->cd_client = (ClientData) cifCellNum;
|
||||||
cifCellNum -= 1;
|
cifCellNum -= 1;
|
||||||
StackPush((ClientData) use->cu_def, cifStack);
|
StackPush((ClientData) use->cu_def, cifStack);
|
||||||
return (0);
|
return (0);
|
||||||
|
|
@ -257,9 +252,9 @@ cifWriteMarkFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifOutPreamble(
|
cifOutPreamble(outf, cell)
|
||||||
FILE *outf,
|
FILE *outf;
|
||||||
CellDef *cell)
|
CellDef *cell;
|
||||||
{
|
{
|
||||||
extern char *MagicVersion;
|
extern char *MagicVersion;
|
||||||
extern char *MagicCompileTime;
|
extern char *MagicCompileTime;
|
||||||
|
|
@ -306,8 +301,8 @@ cifOutPreamble(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifOut(
|
cifOut(outf)
|
||||||
FILE *outf)
|
FILE *outf;
|
||||||
{
|
{
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
bool needHier;
|
bool needHier;
|
||||||
|
|
@ -315,10 +310,10 @@ cifOut(
|
||||||
while (!StackEmpty(cifStack))
|
while (!StackEmpty(cifStack))
|
||||||
{
|
{
|
||||||
def = (CellDef *) StackPop(cifStack);
|
def = (CellDef *) StackPop(cifStack);
|
||||||
if ((int) CD2INT(def->cd_client) >= 0) continue; /* Already output */
|
if ((int) def->cd_client >= 0) continue; /* Already output */
|
||||||
if (SigInterruptPending) continue;
|
if (SigInterruptPending) continue;
|
||||||
|
|
||||||
def->cd_client = INT2CD(- (int) CD2INT(def->cd_client));
|
def->cd_client = (ClientData) (- (int) def->cd_client);
|
||||||
|
|
||||||
/* Read the cell in if it is not already available. */
|
/* Read the cell in if it is not already available. */
|
||||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||||
|
|
@ -355,16 +350,16 @@ cifOut(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cifOutFunc(
|
cifOutFunc(def, f)
|
||||||
CellDef *def, /* Pointer to cell def to be written */
|
CellDef *def; /* Pointer to cell def to be written */
|
||||||
FILE *f) /* Open output file */
|
FILE *f; /* Open output file */
|
||||||
{
|
{
|
||||||
Rect bigArea;
|
Rect bigArea;
|
||||||
Label *lab;
|
Label *lab;
|
||||||
int type;
|
int type;
|
||||||
CIFLayer *layer;
|
CIFLayer *layer;
|
||||||
|
|
||||||
fprintf(f, "DS %d %d %d;\n", (int) CD2INT(def->cd_client),
|
fprintf(f, "DS %d %d %d;\n", (int) def->cd_client,
|
||||||
CIFCurStyle->cs_reducer, 2 * CIFCurStyle->cs_expander);
|
CIFCurStyle->cs_reducer, 2 * CIFCurStyle->cs_expander);
|
||||||
|
|
||||||
if (def->cd_name != (char *) NULL)
|
if (def->cd_name != (char *) NULL)
|
||||||
|
|
@ -486,16 +481,16 @@ cifOutFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifWriteUseFunc(
|
cifWriteUseFunc(use, f)
|
||||||
CellUse *use,
|
CellUse *use;
|
||||||
FILE *f)
|
FILE *f;
|
||||||
{
|
{
|
||||||
int x, y, topx, topy;
|
int x, y, topx, topy;
|
||||||
int realx, realy;
|
int realx, realy;
|
||||||
Transform *t;
|
Transform *t;
|
||||||
int cifnum;
|
int cifnum;
|
||||||
|
|
||||||
cifnum = (int) CD2INT(use->cu_def->cd_client);
|
cifnum = (int) use->cu_def->cd_client;
|
||||||
if (cifnum < 0) cifnum = (-cifnum);
|
if (cifnum < 0) cifnum = (-cifnum);
|
||||||
topx = use->cu_xhi - use->cu_xlo;
|
topx = use->cu_xhi - use->cu_xlo;
|
||||||
if (topx < 0) topx = -topx;
|
if (topx < 0) topx = -topx;
|
||||||
|
|
@ -584,10 +579,9 @@ cifWriteUseFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifWriteLabelFunc(
|
cifWriteLabelFunc(tile, f)
|
||||||
Tile *tile, /* Tile to be written out. */
|
Tile *tile; /* Tile to be written out. */
|
||||||
TileType dinfo, /* Split tile information (unused) */
|
FILE *f; /* File in which to write. */
|
||||||
FILE *f) /* File in which to write. */
|
|
||||||
{
|
{
|
||||||
Rect r;
|
Rect r;
|
||||||
int type;
|
int type;
|
||||||
|
|
@ -644,10 +638,9 @@ cifWriteLabelFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cifWritePaintFunc(
|
cifWritePaintFunc(tile, f)
|
||||||
Tile *tile, /* Tile to be written out. */
|
Tile *tile; /* Tile to be written out. */
|
||||||
TileType dinfo, /* Split tile information */
|
FILE *f; /* File in which to write. */
|
||||||
FILE *f) /* File in which to write. */
|
|
||||||
{
|
{
|
||||||
Rect r;
|
Rect r;
|
||||||
|
|
||||||
|
|
@ -666,7 +659,7 @@ cifWritePaintFunc(
|
||||||
Point points[5];
|
Point points[5];
|
||||||
int i, np;
|
int i, np;
|
||||||
|
|
||||||
GrClipTriangle(&r, NULL, FALSE, TiGetTypeExact(tile) | dinfo, points, &np);
|
GrClipTriangle(&r, NULL, FALSE, TiGetTypeExact(tile), points, &np);
|
||||||
|
|
||||||
/* Write triangle as a CIF polygon */
|
/* Write triangle as a CIF polygon */
|
||||||
|
|
||||||
|
|
@ -726,9 +719,9 @@ cifWritePaintFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CIFWriteFlat(
|
CIFWriteFlat(rootDef, f)
|
||||||
CellDef *rootDef, /* Pointer to CellDef to be written */
|
CellDef *rootDef; /* Pointer to CellDef to be written */
|
||||||
FILE *f) /* Open output file */
|
FILE *f; /* Open output file */
|
||||||
{
|
{
|
||||||
bool good;
|
bool good;
|
||||||
int oldCount = DBWFeedbackCount;
|
int oldCount = DBWFeedbackCount;
|
||||||
|
|
@ -777,7 +770,7 @@ CIFWriteFlat(
|
||||||
* Just output a call on the root cell
|
* Just output a call on the root cell
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fprintf(f, "C %d;\nEnd\n", (int) CD2INT(CIFComponentDef->cd_client));
|
fprintf(f, "C %d;\nEnd\n", (int) CIFComponentDef->cd_client);
|
||||||
DBCellClearDef(CIFComponentDef);
|
DBCellClearDef(CIFComponentDef);
|
||||||
good = !ferror(f);
|
good = !ferror(f);
|
||||||
|
|
||||||
|
|
|
||||||
69
cif/cif.h
69
cif/cif.h
|
|
@ -20,8 +20,8 @@
|
||||||
* rcsid "$Header: /usr/cvsroot/magic-8.0/cif/cif.h,v 1.4 2010/06/24 12:37:15 tim Exp $
|
* rcsid "$Header: /usr/cvsroot/magic-8.0/cif/cif.h,v 1.4 2010/06/24 12:37:15 tim Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAGIC__CIF__CIF_H
|
#ifndef _CIF_H
|
||||||
#define _MAGIC__CIF__CIF_H
|
#define _CIF_H
|
||||||
|
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
|
|
||||||
|
|
@ -51,48 +51,47 @@ extern bool CIFUnfracture;
|
||||||
|
|
||||||
/* Procedures that parse the cif sections of a technology file. */
|
/* Procedures that parse the cif sections of a technology file. */
|
||||||
|
|
||||||
extern void CIFTechStyleInit(void);
|
extern void CIFTechStyleInit();
|
||||||
extern void CIFTechInit(void);
|
extern void CIFTechInit();
|
||||||
extern bool CIFTechLine(char *sectionName, int argc, char *argv[]);
|
extern bool CIFTechLine();
|
||||||
extern void CIFTechFinal(void);
|
extern void CIFTechFinal();
|
||||||
extern void CIFTechOutputScale(int n, int d);
|
extern void CIFTechOutputScale();
|
||||||
extern int CIFTechInputScale(int n, int d, bool opt);
|
extern int CIFTechInputScale();
|
||||||
extern bool CIFTechLimitScale(int ns, int ds);
|
extern bool CIFTechLimitScale();
|
||||||
extern void CIFReadTechStyleInit(void);
|
extern void CIFReadTechStyleInit();
|
||||||
extern void CIFReadTechInit(void);
|
extern void CIFReadTechInit();
|
||||||
extern bool CIFReadTechLine(char *sectionName, int argc, char *argv[]);
|
extern bool CIFReadTechLine();
|
||||||
extern void CIFReadTechFinal(void);
|
extern void CIFReadTechFinal();
|
||||||
extern void CIFParseReadLayers(char *string, TileTypeBitMask *mask, bool newok);
|
extern void CIFParseReadLayers();
|
||||||
|
|
||||||
/* Externally-visible procedures: */
|
/* Externally-visible procedures: */
|
||||||
|
|
||||||
extern float CIFGetOutputScale(int convert);
|
extern float CIFGetOutputScale();
|
||||||
extern float CIFGetScale(int convert);
|
extern float CIFGetScale();
|
||||||
extern float CIFGetInputScale(int convert);
|
extern float CIFGetInputScale();
|
||||||
|
extern int CIFGetDefaultContactSize();
|
||||||
|
|
||||||
extern int CIFPaintCurrent(int filetype);
|
extern int CIFPaintCurrent();
|
||||||
extern void CIFSeeLayer(CellDef *rootDef, Rect *area, char *layer);
|
extern void CIFSeeLayer();
|
||||||
extern void CIFPaintLayer(CellDef *rootDef, Rect *area, char *cifLayer, int magicLayer, CellDef *paintDef);
|
extern void CIFPaintLayer();
|
||||||
extern void CIFSeeHierLayer(CellDef *rootDef, Rect *area, char *layer, int arrays, int subcells);
|
extern void CIFSeeHierLayer();
|
||||||
extern void CIFPrintStats(void);
|
extern void CIFPrintStats();
|
||||||
|
|
||||||
extern bool CIFWrite(CellDef *rootDef, FILE *f);
|
extern bool CIFWrite();
|
||||||
extern void CIFReadFile(FILE *file);
|
extern void CIFReadFile();
|
||||||
|
|
||||||
extern void CIFSetStyle(char *name);
|
extern void CIFSetStyle();
|
||||||
extern void CIFSetReadStyle(char *name);
|
extern void CIFSetReadStyle();
|
||||||
|
|
||||||
extern void CIFPrintStyle(bool dolist, bool doforall, bool docurrent);
|
extern void CIFPrintStyle();
|
||||||
extern void CIFPrintReadStyle(bool dolist, bool doforall, bool docurrent);
|
extern void CIFPrintReadStyle();
|
||||||
|
|
||||||
extern int CIFOutputScaleFactor(void);
|
extern int CIFOutputScaleFactor();
|
||||||
|
|
||||||
extern void PaintWireList(Point *pointlist, int number, int width, int endcap, Plane *plane,
|
extern void PaintWireList();
|
||||||
PaintResultType *ptable, PaintUndoInfo *ui);
|
extern LinkedRect *PaintPolygon();
|
||||||
extern LinkedRect *PaintPolygon(Point *pointlist, int number, Plane *plane, PaintResultType *ptable,
|
|
||||||
PaintUndoInfo *ui, int keep);
|
|
||||||
|
|
||||||
/* C99 compat */
|
/* C99 compat */
|
||||||
extern int CIFGetContactSize(TileType type, int *edge, int *spacing, int *border);
|
extern int CIFGetContactSize();
|
||||||
|
|
||||||
#endif /* _MAGIC__CIF__CIF_H */
|
#endif /* _CIF_H */
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cmwind/CMWcmmnds.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cmwind/CMWcmmnds.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -43,11 +43,10 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
|
|
||||||
/* Forward declarations: */
|
/* Forward declarations: */
|
||||||
|
|
||||||
extern void cmwButtonUp(MagWindow *w, Point *p, int button);
|
extern void cmwButtonUp(), cmwButtonDown();
|
||||||
extern void cmwButtonDown(MagWindow *w, Point *p, int button);
|
extern void cbUpdate();
|
||||||
extern void cbUpdate(MagWindow *w, int code, double x, int replace);
|
extern void RGBxHSV();
|
||||||
extern bool RGBxHSV(double r, double g, double b, double *h, double *s, double *v);
|
extern void HSVxRGB();
|
||||||
extern void HSVxRGB(double h, double s, double v, double *r, double *g, double *b);
|
|
||||||
|
|
||||||
/* If a button is pressed over the top box in the window, which
|
/* If a button is pressed over the top box in the window, which
|
||||||
* displays the current color, we must save the window in which
|
* displays the current color, we must save the window in which
|
||||||
|
|
@ -85,9 +84,9 @@ bool cmwModified = FALSE;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CMWcommand(
|
CMWcommand(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
switch (cmd->tx_button)
|
switch (cmd->tx_button)
|
||||||
{
|
{
|
||||||
|
|
@ -138,13 +137,13 @@ CMWcommand(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwButtonDown(
|
cmwButtonDown(w, p, button)
|
||||||
MagWindow *w, /* Window where the button was pressed. */
|
MagWindow *w; /* Window where the button was pressed. */
|
||||||
Point *p,
|
Point *p;
|
||||||
int button)
|
int button;
|
||||||
{
|
{
|
||||||
const ColorBar *cb;
|
ColorBar *cb;
|
||||||
const ColorPump *cp;
|
ColorPump *cp;
|
||||||
Point surfacePoint;
|
Point surfacePoint;
|
||||||
int x;
|
int x;
|
||||||
double dx;
|
double dx;
|
||||||
|
|
@ -225,14 +224,14 @@ cmwButtonDown(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwButtonUp(
|
cmwButtonUp(w, p, button)
|
||||||
MagWindow *w, /* Window where the button was released */
|
MagWindow *w; /* Window where the button was released */
|
||||||
Point *p, /* Point where button was released, in window coords.*/
|
Point *p; /* Point where button was released, in window coords.*/
|
||||||
int button) /* Button that was released. */
|
int button; /* Button that was released. */
|
||||||
{
|
{
|
||||||
CMWclientRec *crec;
|
CMWclientRec *crec;
|
||||||
int r, g, b, color, oldR, oldG, oldB;
|
int r, g, b, color, oldR, oldG, oldB;
|
||||||
extern int cmwRedisplayFunc(MagWindow *w, int color);
|
extern int cmwRedisplayFunc();
|
||||||
|
|
||||||
/* If the button wasn't depressed over the top box in the window
|
/* If the button wasn't depressed over the top box in the window
|
||||||
* (the one displaying the current color), then we ignore the
|
* (the one displaying the current color), then we ignore the
|
||||||
|
|
@ -297,12 +296,12 @@ cmwButtonUp(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwPushbutton(
|
cmwPushbutton(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
static const char * const cmwButton[] = {"left", "middle", "right", NULL};
|
static char *cmwButton[] = {"left", "middle", "right", NULL};
|
||||||
|
|
||||||
if (cmd->tx_argc != 2)
|
if (cmd->tx_argc != 2)
|
||||||
{
|
{
|
||||||
|
|
@ -356,9 +355,9 @@ cmwPushbutton(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwColor(
|
cmwColor(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int color, r, g, b;
|
int color, r, g, b;
|
||||||
CMWclientRec *crec;
|
CMWclientRec *crec;
|
||||||
|
|
@ -373,7 +372,7 @@ cmwColor(
|
||||||
}
|
}
|
||||||
else if (cmd->tx_argc == 2)
|
else if (cmd->tx_argc == 2)
|
||||||
{
|
{
|
||||||
if (sscanf(cmd->tx_argv[1], "%i", &color) != 1)
|
if (sscanf(cmd->tx_argv[1], "%i", &color) == 0)
|
||||||
{
|
{
|
||||||
/* Invalid color---allow keywords "next" and "last" */
|
/* Invalid color---allow keywords "next" and "last" */
|
||||||
crec = (CMWclientRec *) w->w_clientData;
|
crec = (CMWclientRec *) w->w_clientData;
|
||||||
|
|
@ -451,9 +450,9 @@ cmwColor(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwSave(
|
cmwSave(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
if ((cmd->tx_argc != 1) && (cmd->tx_argc != 4))
|
if ((cmd->tx_argc != 1) && (cmd->tx_argc != 4))
|
||||||
|
|
@ -496,9 +495,9 @@ cmwSave(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwLoad(
|
cmwLoad(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
if ((cmd->tx_argc != 1) && (cmd->tx_argc != 4))
|
if ((cmd->tx_argc != 1) && (cmd->tx_argc != 4))
|
||||||
{
|
{
|
||||||
|
|
@ -538,18 +537,18 @@ cmwLoad(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cbUpdate(
|
cbUpdate(w, code, x, replace)
|
||||||
MagWindow *w, /* Window whose color is to be changed. */
|
MagWindow *w; /* Window whose color is to be changed. */
|
||||||
int code, /* Indicates which color component to change. */
|
int code; /* Indicates which color component to change. */
|
||||||
double x, /* Gives increment or new value for color. */
|
double x; /* Gives increment or new value for color. */
|
||||||
int replace) /* TRUE means replace component with x, FALSE
|
int replace; /* TRUE means replace component with x, FALSE
|
||||||
* means increment component by x.
|
* means increment component by x.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
CMWclientRec *cr = (CMWclientRec *) w->w_clientData;
|
CMWclientRec *cr = (CMWclientRec *) w->w_clientData;
|
||||||
double values[6];
|
double values[6];
|
||||||
int r, g, b, nr, ng, nb;
|
int r, g, b, nr, ng, nb;
|
||||||
extern int cmwRedisplayFunc(MagWindow *w, int color);
|
extern int cmwRedisplayFunc();
|
||||||
|
|
||||||
/* Get current color map values */
|
/* Get current color map values */
|
||||||
(void) GrGetColor(cr->cmw_color, &r, &g, &b);
|
(void) GrGetColor(cr->cmw_color, &r, &g, &b);
|
||||||
|
|
@ -592,14 +591,14 @@ cbUpdate(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cmwRedisplayFunc(
|
cmwRedisplayFunc(w, color)
|
||||||
MagWindow *w, /* Window that may have to be redisplayed. */
|
MagWindow *w; /* Window that may have to be redisplayed. */
|
||||||
int color) /* If this color is in window, redisplay the
|
int color; /* If this color is in window, redisplay the
|
||||||
* color bars in the window.
|
* color bars in the window.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const ColorBar *cb;
|
ColorBar *cb;
|
||||||
const ColorPump *cp;
|
ColorPump *cp;
|
||||||
Rect screenR;
|
Rect screenR;
|
||||||
CMWclientRec *cr = (CMWclientRec *) w->w_clientData;
|
CMWclientRec *cr = (CMWclientRec *) w->w_clientData;
|
||||||
|
|
||||||
|
|
@ -645,11 +644,11 @@ cmwRedisplayFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMWCheckWritten(void)
|
CMWCheckWritten()
|
||||||
{
|
{
|
||||||
bool indx;
|
bool indx;
|
||||||
char *prompt;
|
char *prompt;
|
||||||
static const char * const yesno[] = {"no", "yes", NULL};
|
static char *(yesno[]) = {"no", "yes", NULL};
|
||||||
|
|
||||||
if (!cmwModified) return TRUE;
|
if (!cmwModified) return TRUE;
|
||||||
prompt = TxPrintString("The color map has been modified.\n"
|
prompt = TxPrintString("The color map has been modified.\n"
|
||||||
|
|
|
||||||
121
cmwind/CMWmain.c
121
cmwind/CMWmain.c
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cmwind/CMWmain.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cmwind/CMWmain.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -44,12 +44,12 @@ global WindClient CMWclientID;
|
||||||
|
|
||||||
/* Forward and external declarations */
|
/* Forward and external declarations */
|
||||||
|
|
||||||
extern void cmwColor(MagWindow *w, TxCommand *cmd);
|
extern void cmwColor();
|
||||||
extern void cmwSave(MagWindow *w, TxCommand *cmd);
|
extern void cmwSave();
|
||||||
extern void cmwLoad(MagWindow *w, TxCommand *cmd);
|
extern void cmwLoad();
|
||||||
extern void cmwPushbutton(MagWindow *w, TxCommand *cmd);
|
extern void cmwPushbutton();
|
||||||
extern bool RGBxHSV(double r, double g, double b, double *h, double *s, double *v);
|
extern void RGBxHSV();
|
||||||
extern void CMWundoInit(void);
|
extern void CMWundoInit();
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -89,47 +89,47 @@ extern void CMWundoInit(void);
|
||||||
* which pump is hit and which mouse button is used to hit it.
|
* which pump is hit and which mouse button is used to hit it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const ColorBar colorBars[] =
|
ColorBar colorBars[] =
|
||||||
{
|
{
|
||||||
{"Red", CB_RED, STYLE_RED, {{ 2000, 8000}, {10000, 9000}},
|
"Red", CB_RED, STYLE_RED, {2000, 8000, 10000, 9000},
|
||||||
{{ 2000, 9500}, {10000, 10500}}},
|
{2000, 9500, 10000, 10500},
|
||||||
{"Green", CB_GREEN, STYLE_GREEN, {{ 2000, 5000}, {10000, 6000}},
|
"Green", CB_GREEN, STYLE_GREEN, {2000, 5000, 10000, 6000},
|
||||||
{{ 2000, 6500}, {10000, 7500}}},
|
{2000, 6500, 10000, 7500},
|
||||||
{"Blue", CB_BLUE, STYLE_BLUE, {{ 2000, 2000}, {10000, 3000}},
|
"Blue", CB_BLUE, STYLE_BLUE, {2000, 2000, 10000, 3000},
|
||||||
{{ 2000, 3500}, {10000, 4500}}},
|
{2000, 3500, 10000, 4500},
|
||||||
{"Hue", CB_HUE, STYLE_YELLOW, {{14000, 8000}, {22000, 9000}},
|
"Hue", CB_HUE, STYLE_YELLOW, {14000, 8000, 22000, 9000},
|
||||||
{{14000, 9500}, {22000, 10500}}},
|
{14000, 9500, 22000, 10500},
|
||||||
{"Saturation", CB_SAT, STYLE_GRAY, {{14000, 5000}, {22000, 6000}},
|
"Saturation", CB_SAT, STYLE_GRAY, {14000, 5000, 22000, 6000},
|
||||||
{{14000, 6500}, {22000, 7500}}},
|
{14000, 6500, 22000, 7500},
|
||||||
{"Value", CB_VALUE, STYLE_BROWN1, {{14000, 2000}, {22000, 3000}},
|
"Value", CB_VALUE, STYLE_BROWN1, {14000, 2000, 22000, 3000},
|
||||||
{{14000, 3500}, {22000, 4500}}},
|
{14000, 3500, 22000, 4500},
|
||||||
{0}
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorPump colorPumps[] =
|
ColorPump colorPumps[] =
|
||||||
{
|
{
|
||||||
{CB_RED, -.0078, {{ 500, 8000}, { 1500, 9000}}},
|
CB_RED, -.0078, {500, 8000, 1500, 9000},
|
||||||
{CB_RED, .0078, {{10500, 8000}, {11500, 9000}}},
|
CB_RED, .0078, {10500, 8000, 11500, 9000},
|
||||||
{CB_GREEN, -.0078, {{ 500, 5000}, { 1500, 6000}}},
|
CB_GREEN, -.0078, {500, 5000, 1500, 6000},
|
||||||
{CB_GREEN, .0078, {{10500, 5000}, {11500, 6000}}},
|
CB_GREEN, .0078, {10500, 5000, 11500, 6000},
|
||||||
{CB_BLUE, -.0078, {{ 500, 2000}, { 1500, 3000}}},
|
CB_BLUE, -.0078, {500, 2000, 1500, 3000},
|
||||||
{CB_BLUE, .0078, {{10500, 2000}, {11500, 3000}}},
|
CB_BLUE, .0078, {10500, 2000, 11500, 3000},
|
||||||
{CB_HUE, -.01, {{12500, 8000}, {13500, 9000}}},
|
CB_HUE, -.01, {12500, 8000, 13500, 9000},
|
||||||
{CB_HUE, .01, {{22500, 8000}, {23500, 9000}}},
|
CB_HUE, .01, {22500, 8000, 23500, 9000},
|
||||||
{CB_SAT, -.01, {{12500, 5000}, {13500, 6000}}},
|
CB_SAT, -.01, {12500, 5000, 13500, 6000},
|
||||||
{CB_SAT, .01, {{22500, 5000}, {23500, 6000}}},
|
CB_SAT, .01, {22500, 5000, 23500, 6000},
|
||||||
{CB_VALUE, -.01, {{12500, 2000}, {13500, 3000}}},
|
CB_VALUE, -.01, {12500, 2000, 13500, 3000},
|
||||||
{CB_VALUE, .01, {{22500, 2000}, {23500, 3000}}},
|
CB_VALUE, .01, {22500, 2000, 23500, 3000},
|
||||||
{-1}
|
-1
|
||||||
};
|
};
|
||||||
|
|
||||||
const Rect cmwCurrentColorArea = {{6000, 12000}, {18000, 15000}};
|
Rect cmwCurrentColorArea = {{6000, 12000}, {18000, 15000}};
|
||||||
const Rect cmwCurrentColorTextBox = {{6000, 15500}, {18000, 16500}};
|
Rect cmwCurrentColorTextBox = {{6000, 15500}, {18000, 16500}};
|
||||||
const char * const cmwCurrentColorText = "Color Being Edited";
|
char *cmwCurrentColorText = "Color Being Edited";
|
||||||
|
|
||||||
/* Bounding rectangle for entire window */
|
/* Bounding rectangle for entire window */
|
||||||
|
|
||||||
const Rect colorWindowRect = {{0, 1500}, {24000, 17000}};
|
Rect colorWindowRect = {{0, 1500}, {24000, 17000}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
|
|
@ -149,13 +149,13 @@ const Rect colorWindowRect = {{0, 1500}, {24000, 17000}};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMWcreate(
|
CMWcreate(window, argc, argv)
|
||||||
MagWindow *window,
|
MagWindow *window;
|
||||||
int argc,
|
int argc;
|
||||||
char *argv[])
|
char *argv[];
|
||||||
{
|
{
|
||||||
CMWclientRec *crec;
|
CMWclientRec *crec;
|
||||||
unsigned int color;
|
int color;
|
||||||
|
|
||||||
crec = (CMWclientRec *) mallocMagic(sizeof(CMWclientRec));
|
crec = (CMWclientRec *) mallocMagic(sizeof(CMWclientRec));
|
||||||
window->w_clientData = (ClientData) crec;
|
window->w_clientData = (ClientData) crec;
|
||||||
|
|
@ -189,8 +189,8 @@ CMWcreate(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMWdelete(
|
CMWdelete(window)
|
||||||
MagWindow *window)
|
MagWindow *window;
|
||||||
{
|
{
|
||||||
CMWclientRec *cr;
|
CMWclientRec *cr;
|
||||||
|
|
||||||
|
|
@ -217,12 +217,11 @@ CMWdelete(
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
void
|
void
|
||||||
CMWreposition(
|
CMWreposition(window, newScreenArea, final)
|
||||||
MagWindow *window,
|
MagWindow *window;
|
||||||
Rect *newScreenArea, /* UNUSED */
|
Rect *newScreenArea;
|
||||||
bool final)
|
bool final;
|
||||||
{
|
{
|
||||||
if (final)
|
if (final)
|
||||||
WindMove(window, &colorWindowRect);
|
WindMove(window, &colorWindowRect);
|
||||||
|
|
@ -245,14 +244,14 @@ CMWreposition(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CMWredisplay(
|
CMWredisplay(w, rootArea, clipArea)
|
||||||
MagWindow *w, /* The window containing the area. */
|
MagWindow *w; /* The window containing the area. */
|
||||||
Rect *rootArea, /* Redisplay area in surface coordinates. */
|
Rect *rootArea; /* Redisplay area in surface coordinates. */
|
||||||
Rect *clipArea) /* An area on the screen to clip to. */
|
Rect *clipArea; /* An area on the screen to clip to. */
|
||||||
{
|
{
|
||||||
CMWclientRec *cr;
|
CMWclientRec *cr;
|
||||||
const ColorBar *cb;
|
ColorBar *cb;
|
||||||
const ColorPump *cp;
|
ColorPump *cp;
|
||||||
Rect rect, screenR;
|
Rect rect, screenR;
|
||||||
Point screenP;
|
Point screenP;
|
||||||
double values[6], x;
|
double values[6], x;
|
||||||
|
|
@ -373,9 +372,9 @@ CMWredisplay(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CMWloadWindow(
|
CMWloadWindow(w, color)
|
||||||
MagWindow *w, /* Identifies window to which color is to be bound */
|
MagWindow *w; /* Identifies window to which color is to be bound */
|
||||||
int color) /* New color to be bound to this window. */
|
int color; /* New color to be bound to this window. */
|
||||||
{
|
{
|
||||||
CMWclientRec *cr = (CMWclientRec *) w->w_clientData;
|
CMWclientRec *cr = (CMWclientRec *) w->w_clientData;
|
||||||
char caption[40];
|
char caption[40];
|
||||||
|
|
@ -408,7 +407,7 @@ CMWloadWindow(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CMWinit(void)
|
CMWinit()
|
||||||
{
|
{
|
||||||
CMWclientID = WindAddClient("color", CMWcreate, CMWdelete,
|
CMWclientID = WindAddClient("color", CMWcreate, CMWdelete,
|
||||||
CMWredisplay, CMWcommand,
|
CMWredisplay, CMWcommand,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cmwind/CMWrgbhsv.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cmwind/CMWrgbhsv.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -45,13 +45,9 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RGBxHSV(
|
RGBxHSV( r, g, b, h, s, v)
|
||||||
double r,
|
double r, g, b;
|
||||||
double g,
|
double *h, *s, *v;
|
||||||
double b,
|
|
||||||
double *h,
|
|
||||||
double *s,
|
|
||||||
double *v)
|
|
||||||
{
|
{
|
||||||
double max, delta;
|
double max, delta;
|
||||||
double mr,mg,mb;
|
double mr,mg,mb;
|
||||||
|
|
@ -94,14 +90,10 @@ RGBxHSV(
|
||||||
#define SETRGB(rr,gg,bb) *r=rr;*g=gg;*b=bb
|
#define SETRGB(rr,gg,bb) *r=rr;*g=gg;*b=bb
|
||||||
|
|
||||||
void
|
void
|
||||||
HSVxRGB(
|
HSVxRGB( h,s,v,r,g,b)
|
||||||
double h,
|
double h,s,v;
|
||||||
double s,
|
double *r,*g,*b;
|
||||||
double v,
|
{
|
||||||
double *r,
|
|
||||||
double *g,
|
|
||||||
double *b)
|
|
||||||
{
|
|
||||||
double f,m,n,k;
|
double f,m,n,k;
|
||||||
int i;
|
int i;
|
||||||
double vs,vsf;
|
double vs,vsf;
|
||||||
|
|
@ -133,13 +125,9 @@ HSVxRGB(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RGBxHSL(
|
RGBxHSL( r, g, b, h, s, l )
|
||||||
double r,
|
double r, g, b;
|
||||||
double g,
|
double *h, *s, *l;
|
||||||
double b,
|
|
||||||
double *h,
|
|
||||||
double *s,
|
|
||||||
double *l)
|
|
||||||
{
|
{
|
||||||
double min, max;
|
double min, max;
|
||||||
double delta, mr, mg, mb;
|
double delta, mr, mg, mb;
|
||||||
|
|
@ -196,13 +184,9 @@ RGBxHSL(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
HSLxRGB(
|
HSLxRGB( h, s, l, r, g, b )
|
||||||
double h,
|
double h, s, l;
|
||||||
double s,
|
double *r, *g, *b;
|
||||||
double l,
|
|
||||||
double *r,
|
|
||||||
double *g,
|
|
||||||
double *b)
|
|
||||||
{
|
{
|
||||||
double min;
|
double min;
|
||||||
double v;
|
double v;
|
||||||
|
|
@ -251,11 +235,9 @@ HSLxRGB(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
Correct_chromaticity(
|
Correct_chromaticity(x, y, wx, wy)
|
||||||
double *x,
|
double *x,*y;
|
||||||
double *y,
|
double wx,wy;
|
||||||
double wx,
|
|
||||||
double wy)
|
|
||||||
{
|
{
|
||||||
double oldx,oldy;
|
double oldx,oldy;
|
||||||
double slope;
|
double slope;
|
||||||
|
|
@ -279,13 +261,9 @@ Correct_chromaticity(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
xyz_to_mrgb(
|
xyz_to_mrgb(x, y, z, mr, mg, mb)
|
||||||
double x,
|
double x, y, z;
|
||||||
double y,
|
double *mr, *mg, *mb;
|
||||||
double z,
|
|
||||||
double *mr,
|
|
||||||
double *mg,
|
|
||||||
double *mb)
|
|
||||||
{
|
{
|
||||||
*mr = 2.4513*x - 1.2249*y - 0.3237*z;
|
*mr = 2.4513*x - 1.2249*y - 0.3237*z;
|
||||||
*mg = -1.4746*x + 2.5052*y + 0.0596*z;
|
*mg = -1.4746*x + 2.5052*y + 0.0596*z;
|
||||||
|
|
@ -303,10 +281,8 @@ xyz_to_mrgb(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
Make_mRGB_Nice(
|
Make_mRGB_Nice(mR,mG,mB)
|
||||||
double *mR,
|
double *mR,*mG,*mB;
|
||||||
double *mG,
|
|
||||||
double *mB)
|
|
||||||
{
|
{
|
||||||
double min,max;
|
double min,max;
|
||||||
double mr, mg, mb;
|
double mr, mg, mb;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cmwind/CMWundo.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/cmwind/CMWundo.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -35,6 +35,12 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
*/
|
*/
|
||||||
UndoType cmwUndoClientID;
|
UndoType cmwUndoClientID;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions to play events forward/backward.
|
||||||
|
*/
|
||||||
|
void cmwUndoForw(), cmwUndoBack();
|
||||||
|
void cmwUndoStart(), cmwUndoDone();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A single undo event for the
|
* A single undo event for the
|
||||||
* color map module.
|
* color map module.
|
||||||
|
|
@ -52,14 +58,6 @@ UndoType cmwUndoClientID;
|
||||||
*/
|
*/
|
||||||
bool cmwColorsChanged[256];
|
bool cmwColorsChanged[256];
|
||||||
|
|
||||||
/*
|
|
||||||
* Functions to play events forward/backward.
|
|
||||||
*/
|
|
||||||
void cmwUndoForw(colorUE *up);
|
|
||||||
void cmwUndoBack(colorUE *up);
|
|
||||||
void cmwUndoStart(void);
|
|
||||||
void cmwUndoDone(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
@ -79,7 +77,7 @@ void cmwUndoDone(void);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CMWundoInit(void)
|
CMWundoInit()
|
||||||
{
|
{
|
||||||
cmwUndoClientID = UndoAddClient(cmwUndoStart, cmwUndoDone, NULL, NULL,
|
cmwUndoClientID = UndoAddClient(cmwUndoStart, cmwUndoDone, NULL, NULL,
|
||||||
cmwUndoForw, cmwUndoBack, "color map");
|
cmwUndoForw, cmwUndoBack, "color map");
|
||||||
|
|
@ -104,16 +102,16 @@ CMWundoInit(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwUndoForw(
|
cmwUndoForw(up)
|
||||||
colorUE *up)
|
colorUE *up;
|
||||||
{
|
{
|
||||||
(void) GrPutColor(up->cue_color, up->new_r, up->new_g, up->new_b);
|
(void) GrPutColor(up->cue_color, up->new_r, up->new_g, up->new_b);
|
||||||
cmwColorsChanged[up->cue_color] = TRUE;
|
cmwColorsChanged[up->cue_color] = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwUndoBack(
|
cmwUndoBack(up)
|
||||||
colorUE *up)
|
colorUE *up;
|
||||||
{
|
{
|
||||||
(void) GrPutColor(up->cue_color, up->old_r, up->old_g, up->old_b);
|
(void) GrPutColor(up->cue_color, up->old_r, up->old_g, up->old_b);
|
||||||
cmwColorsChanged[up->cue_color] = TRUE;
|
cmwColorsChanged[up->cue_color] = TRUE;
|
||||||
|
|
@ -136,14 +134,10 @@ cmwUndoBack(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwUndoColor(
|
cmwUndoColor(color, oldr, oldg, oldb, newr, newg, newb)
|
||||||
int color,
|
int color;
|
||||||
int oldr,
|
int oldr, oldg, oldb;
|
||||||
int oldg,
|
int newr, newg, newb;
|
||||||
int oldb,
|
|
||||||
int newr,
|
|
||||||
int newg,
|
|
||||||
int newb)
|
|
||||||
{
|
{
|
||||||
colorUE *up;
|
colorUE *up;
|
||||||
|
|
||||||
|
|
@ -177,7 +171,7 @@ cmwUndoColor(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwUndoStart(void)
|
cmwUndoStart()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -204,13 +198,13 @@ cmwUndoStart(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmwUndoDone(void)
|
cmwUndoDone()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
extern int cmwRedisplayFunc(MagWindow *w, int color);
|
extern int cmwRedisplayFunc();
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
if (cmwColorsChanged[i])
|
if (cmwColorsChanged[i])
|
||||||
(void) WindSearch(CMWclientID, (ClientData) NULL, (Rect *) NULL,
|
(void) WindSearch(CMWclientID, (ClientData) NULL, (Rect *) NULL,
|
||||||
cmwRedisplayFunc, INT2CD(i));
|
cmwRedisplayFunc, (ClientData) i);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
* rcsid $Header: /usr/cvsroot/magic-8.0/cmwind/cmwind.h,v 1.2 2009/09/10 20:32:51 tim Exp $
|
* rcsid $Header: /usr/cvsroot/magic-8.0/cmwind/cmwind.h,v 1.2 2009/09/10 20:32:51 tim Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAGIC__CMWIND__CMWIND_H
|
#ifndef _CMWIND_H
|
||||||
#define _MAGIC__CMWIND__CMWIND_H
|
#define _CMWIND_H
|
||||||
|
|
||||||
#include "windows/windows.h"
|
#include "windows/windows.h"
|
||||||
#include "textio/txcommands.h"
|
#include "textio/txcommands.h"
|
||||||
|
|
@ -69,16 +69,16 @@ typedef struct
|
||||||
extern void CMWloadWindow(MagWindow *, int);
|
extern void CMWloadWindow(MagWindow *, int);
|
||||||
extern void CMWcommand(MagWindow *, TxCommand *);
|
extern void CMWcommand(MagWindow *, TxCommand *);
|
||||||
|
|
||||||
extern const Rect colorWindowRect;
|
extern Rect colorWindowRect;
|
||||||
extern WindClient CMWclientID;
|
extern WindClient CMWclientID;
|
||||||
extern const ColorBar colorBars[];
|
extern ColorBar colorBars[];
|
||||||
extern const ColorPump colorPumps[];
|
extern ColorPump colorPumps[];
|
||||||
extern const Rect cmwCurrentColorArea;
|
extern Rect cmwCurrentColorArea;
|
||||||
extern void cmwUndoColor(int, int, int, int, int, int, int);
|
extern void cmwUndoColor(int, int, int, int, int, int, int);
|
||||||
extern bool CMWCheckWritten(void);
|
extern bool CMWCheckWritten(void);
|
||||||
|
|
||||||
/* C99 compat */
|
/* C99 compat */
|
||||||
extern void CMWinit(void);
|
extern void CMWinit();
|
||||||
|
|
||||||
|
|
||||||
#endif /* _MAGIC__CMWIND__CMWIND_H */
|
#endif /* _CMWIND_H */
|
||||||
|
|
|
||||||
268
commands/CmdAB.c
268
commands/CmdAB.c
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdAB.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdAB.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -70,9 +70,9 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdAddPath(
|
CmdAddPath( w, cmd )
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
if (cmd->tx_argc != 2) {
|
if (cmd->tx_argc != 2) {
|
||||||
TxError("Usage: %s appended_search_path\n", cmd->tx_argv[0]);
|
TxError("Usage: %s appended_search_path\n", cmd->tx_argv[0]);
|
||||||
|
|
@ -81,70 +81,6 @@ CmdAddPath(
|
||||||
PaAppend(&Path, cmd->tx_argv[1]);
|
PaAppend(&Path, cmd->tx_argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* CmdArchive --
|
|
||||||
*
|
|
||||||
* Save an entire database to a "crash recovery"-type archive file, or
|
|
||||||
* load a database from a "crash recovery"-type archive file. Option
|
|
||||||
* "writeall" writes everything, including read-only PDK cells, while
|
|
||||||
* "readref" does not dereference and will prefer files found in the
|
|
||||||
* search path over content in the archive.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* archive write|writeall|read|readref file
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Side effects:
|
|
||||||
* Writes a single file with the contents of the entire database,
|
|
||||||
* or loads the database with multiple cells from the file.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
CmdArchive(
|
|
||||||
MagWindow *w,
|
|
||||||
TxCommand *cmd)
|
|
||||||
{
|
|
||||||
int option = -1;
|
|
||||||
char *filename = NULL;
|
|
||||||
static const char * const cmdArchiveOpt[] = {"write", "writeall",
|
|
||||||
"read", "readref", 0};
|
|
||||||
|
|
||||||
if (cmd->tx_argc != 3)
|
|
||||||
TxError("Usage: %s write|writeall|read|readref filename\n", cmd->tx_argv[0]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
option = Lookup(cmd->tx_argv[1], cmdArchiveOpt);
|
|
||||||
if (option < 0)
|
|
||||||
{
|
|
||||||
TxError("Usage: %s write|writeall|read|readref filename\n", cmd->tx_argv[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filename = cmd->tx_argv[2];
|
|
||||||
|
|
||||||
switch(option) {
|
|
||||||
case 0: /* write */
|
|
||||||
DBWriteBackup(filename, TRUE, FALSE);
|
|
||||||
break;
|
|
||||||
case 1: /* writeall */
|
|
||||||
DBWriteBackup(filename, TRUE, TRUE);
|
|
||||||
break;
|
|
||||||
case 2: /* read */
|
|
||||||
DBReadBackup(filename, TRUE, TRUE);
|
|
||||||
break;
|
|
||||||
case 3: /* readref */
|
|
||||||
DBReadBackup(filename, TRUE, FALSE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Linked-list structure for returning information about arrayed cells */
|
/* Linked-list structure for returning information about arrayed cells */
|
||||||
|
|
||||||
|
|
@ -194,11 +130,11 @@ typedef struct LA1
|
||||||
#define ARRAY_DEFAULT 6
|
#define ARRAY_DEFAULT 6
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdArray(
|
CmdArray(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
static const char * const cmdArrayOption[] = {
|
static char *cmdArrayOption[] = {
|
||||||
"count [[xlo] xhi [ylo] yhi] array subcells",
|
"count [[xlo] xhi [ylo] yhi] array subcells",
|
||||||
"width [value] set or return array x-spacing",
|
"width [value] set or return array x-spacing",
|
||||||
"height [value] set or return array y-spacing",
|
"height [value] set or return array y-spacing",
|
||||||
|
|
@ -208,7 +144,7 @@ CmdArray(
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
const char * const *msg;
|
char **msg;
|
||||||
int option, locargc, argstart;
|
int option, locargc, argstart;
|
||||||
bool doList = FALSE;
|
bool doList = FALSE;
|
||||||
ArrayInfo a;
|
ArrayInfo a;
|
||||||
|
|
@ -220,7 +156,7 @@ CmdArray(
|
||||||
Tcl_Obj *tobj;
|
Tcl_Obj *tobj;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int selGetArrayFunc(CellUse *selUse, CellUse *use, Transform *trans, LinkedArray **arg);
|
extern int selGetArrayFunc();
|
||||||
|
|
||||||
locargc = cmd->tx_argc;
|
locargc = cmd->tx_argc;
|
||||||
argstart = 1;
|
argstart = 1;
|
||||||
|
|
@ -338,17 +274,14 @@ CmdArray(
|
||||||
case ARRAY_WIDTH:
|
case ARRAY_WIDTH:
|
||||||
if (locargc == 2)
|
if (locargc == 2)
|
||||||
{
|
{
|
||||||
char *xsepvalue;
|
|
||||||
for (la = lahead; la != NULL; la = la->ar_next)
|
for (la = lahead; la != NULL; la = la->ar_next)
|
||||||
{
|
{
|
||||||
xsepvalue = DBWPrintValue(la->arrayInfo.ar_xsep,
|
|
||||||
w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (doList)
|
if (doList)
|
||||||
{
|
{
|
||||||
tobj = Tcl_NewListObj(0, NULL);
|
tobj = Tcl_NewListObj(0, NULL);
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
Tcl_ListObjAppendElement(magicinterp, tobj,
|
||||||
Tcl_NewStringObj(xsepvalue, -1));
|
Tcl_NewIntObj(la->arrayInfo.ar_xsep));
|
||||||
Tcl_SetObjResult(magicinterp, tobj);
|
Tcl_SetObjResult(magicinterp, tobj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -358,7 +291,7 @@ CmdArray(
|
||||||
TxPrintf("Cell use \"%s\":", la->cellUse->cu_id);
|
TxPrintf("Cell use \"%s\":", la->cellUse->cu_id);
|
||||||
else
|
else
|
||||||
TxPrintf("Cell \"%s\":", la->cellUse->cu_def->cd_name);
|
TxPrintf("Cell \"%s\":", la->cellUse->cu_def->cd_name);
|
||||||
TxPrintf("x separation %s\n", xsepvalue);
|
TxPrintf("x separation %d\n", la->arrayInfo.ar_xsep);
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -377,17 +310,14 @@ CmdArray(
|
||||||
case ARRAY_HEIGHT:
|
case ARRAY_HEIGHT:
|
||||||
if (locargc == 2)
|
if (locargc == 2)
|
||||||
{
|
{
|
||||||
char *ysepvalue;
|
|
||||||
for (la = lahead; la != NULL; la = la->ar_next)
|
for (la = lahead; la != NULL; la = la->ar_next)
|
||||||
{
|
{
|
||||||
ysepvalue = DBWPrintValue(la->arrayInfo.ar_ysep,
|
|
||||||
w, FALSE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (doList)
|
if (doList)
|
||||||
{
|
{
|
||||||
tobj = Tcl_NewListObj(0, NULL);
|
tobj = Tcl_NewListObj(0, NULL);
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
Tcl_ListObjAppendElement(magicinterp, tobj,
|
||||||
Tcl_NewStringObj(ysepvalue, -1));
|
Tcl_NewIntObj(la->arrayInfo.ar_ysep));
|
||||||
Tcl_SetObjResult(magicinterp, tobj);
|
Tcl_SetObjResult(magicinterp, tobj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -397,7 +327,7 @@ CmdArray(
|
||||||
TxPrintf("Cell use \"%s\":", la->cellUse->cu_id);
|
TxPrintf("Cell use \"%s\":", la->cellUse->cu_id);
|
||||||
else
|
else
|
||||||
TxPrintf("Cell \"%s\":", la->cellUse->cu_def->cd_name);
|
TxPrintf("Cell \"%s\":", la->cellUse->cu_def->cd_name);
|
||||||
TxPrintf("y separation %s\n", ysepvalue);
|
TxPrintf("y separation %d\n", la->arrayInfo.ar_ysep);
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -416,21 +346,16 @@ CmdArray(
|
||||||
case ARRAY_PITCH:
|
case ARRAY_PITCH:
|
||||||
if (locargc == 2)
|
if (locargc == 2)
|
||||||
{
|
{
|
||||||
char *xpitch, *ypitch;
|
|
||||||
for (la = lahead; la != NULL; la = la->ar_next)
|
for (la = lahead; la != NULL; la = la->ar_next)
|
||||||
{
|
{
|
||||||
xpitch = DBWPrintValue(la->arrayInfo.ar_xsep,
|
|
||||||
w, TRUE);
|
|
||||||
ypitch = DBWPrintValue(la->arrayInfo.ar_ysep,
|
|
||||||
w, FALSE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (doList)
|
if (doList)
|
||||||
{
|
{
|
||||||
tobj = Tcl_NewListObj(0, NULL);
|
tobj = Tcl_NewListObj(0, NULL);
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
Tcl_ListObjAppendElement(magicinterp, tobj,
|
||||||
Tcl_NewStringObj(xpitch, -1));
|
Tcl_NewIntObj(la->arrayInfo.ar_xsep));
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
Tcl_ListObjAppendElement(magicinterp, tobj,
|
||||||
Tcl_NewStringObj(ypitch, -1));
|
Tcl_NewIntObj(la->arrayInfo.ar_ysep));
|
||||||
Tcl_SetObjResult(magicinterp, tobj);
|
Tcl_SetObjResult(magicinterp, tobj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -440,8 +365,8 @@ CmdArray(
|
||||||
TxPrintf("Cell use \"%s\":", la->cellUse->cu_id);
|
TxPrintf("Cell use \"%s\":", la->cellUse->cu_id);
|
||||||
else
|
else
|
||||||
TxPrintf("Cell \"%s\":", la->cellUse->cu_def->cd_name);
|
TxPrintf("Cell \"%s\":", la->cellUse->cu_def->cd_name);
|
||||||
TxPrintf("x separation %s ", xpitch);
|
TxPrintf("x separation %d ", la->arrayInfo.ar_xsep);
|
||||||
TxPrintf("y separation %s\n", ypitch);
|
TxPrintf("y separation %d\n", la->arrayInfo.ar_ysep);
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -461,21 +386,16 @@ CmdArray(
|
||||||
case ARRAY_POSITION:
|
case ARRAY_POSITION:
|
||||||
if (locargc == 2)
|
if (locargc == 2)
|
||||||
{
|
{
|
||||||
char *xpos, *ypos;
|
|
||||||
for (la = lahead; la != NULL; la = la->ar_next)
|
for (la = lahead; la != NULL; la = la->ar_next)
|
||||||
{
|
{
|
||||||
xpos = DBWPrintValue(la->cellUse->cu_bbox.r_xbot,
|
|
||||||
w, TRUE);
|
|
||||||
ypos = DBWPrintValue(la->cellUse->cu_bbox.r_ybot,
|
|
||||||
w, FALSE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (doList)
|
if (doList)
|
||||||
{
|
{
|
||||||
tobj = Tcl_NewListObj(0, NULL);
|
tobj = Tcl_NewListObj(0, NULL);
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
Tcl_ListObjAppendElement(magicinterp, tobj,
|
||||||
Tcl_NewStringObj(xpos, -1));
|
Tcl_NewIntObj(la->cellUse->cu_bbox.r_xbot));
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
Tcl_ListObjAppendElement(magicinterp, tobj,
|
||||||
Tcl_NewStringObj(ypos, -1));
|
Tcl_NewIntObj(la->cellUse->cu_bbox.r_ybot));
|
||||||
Tcl_SetObjResult(magicinterp, tobj);
|
Tcl_SetObjResult(magicinterp, tobj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -485,8 +405,8 @@ CmdArray(
|
||||||
TxPrintf("Cell use \"%s\":", la->cellUse->cu_id);
|
TxPrintf("Cell use \"%s\":", la->cellUse->cu_id);
|
||||||
else
|
else
|
||||||
TxPrintf("Cell \"%s\":", la->cellUse->cu_def->cd_name);
|
TxPrintf("Cell \"%s\":", la->cellUse->cu_def->cd_name);
|
||||||
TxPrintf("x=%s ", xpos);
|
TxPrintf("x=%d ", la->cellUse->cu_bbox.r_xbot);
|
||||||
TxPrintf("y=%s\n", ypos);
|
TxPrintf("y=%d\n", la->cellUse->cu_bbox.r_ybot);
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -546,15 +466,11 @@ badusage:
|
||||||
}
|
}
|
||||||
|
|
||||||
freelist:
|
freelist:
|
||||||
|
la = lahead;
|
||||||
|
while (la != NULL)
|
||||||
{
|
{
|
||||||
la = lahead;
|
freeMagic((char *)la);
|
||||||
while (la != NULL)
|
la = la->ar_next;
|
||||||
{
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
freeMagic1(&mm1, (char *)la);
|
|
||||||
la = la->ar_next;
|
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -564,11 +480,11 @@ freelist:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
selGetArrayFunc(
|
selGetArrayFunc(selUse, use, trans, arg)
|
||||||
CellUse *selUse,
|
CellUse *selUse;
|
||||||
CellUse *use,
|
CellUse *use;
|
||||||
Transform *trans,
|
Transform *trans;
|
||||||
LinkedArray **arg)
|
LinkedArray **arg;
|
||||||
{
|
{
|
||||||
/* Check "use" for array information and pass this to arrayInfo */
|
/* Check "use" for array information and pass this to arrayInfo */
|
||||||
|
|
||||||
|
|
@ -677,11 +593,11 @@ selGetArrayFunc(
|
||||||
#define BOX_DEFAULT 13
|
#define BOX_DEFAULT 13
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdBox(
|
CmdBox(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
static const char * const cmdBoxOption[] = {
|
static char *cmdBoxOption[] = {
|
||||||
"width [value] set or return box width",
|
"width [value] set or return box width",
|
||||||
"height [value] set or return box height",
|
"height [value] set or return box height",
|
||||||
"size [width height] set or return box size",
|
"size [width height] set or return box size",
|
||||||
|
|
@ -710,7 +626,7 @@ CmdBox(
|
||||||
bool needBox = TRUE; /* require that box be defined */
|
bool needBox = TRUE; /* require that box be defined */
|
||||||
bool refEdit = FALSE; /* referenced to edit cell coordinates */
|
bool refEdit = FALSE; /* referenced to edit cell coordinates */
|
||||||
bool cursorRef = FALSE; /* reference position is the cursor */
|
bool cursorRef = FALSE; /* reference position is the cursor */
|
||||||
const char * const *msg;
|
char **msg;
|
||||||
|
|
||||||
argc = cmd->tx_argc;
|
argc = cmd->tx_argc;
|
||||||
if (argc > 7) goto badusage;
|
if (argc > 7) goto badusage;
|
||||||
|
|
@ -779,8 +695,8 @@ CmdBox(
|
||||||
break;
|
break;
|
||||||
case BOX_EXISTS:
|
case BOX_EXISTS:
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp,
|
Tcl_SetResult(magicinterp, ToolGetBox(NULL, NULL) ? "1" : "0",
|
||||||
Tcl_NewBooleanObj(ToolGetBox(NULL, NULL) ? TRUE : FALSE));
|
NULL);
|
||||||
#else
|
#else
|
||||||
TxPrintf("%s\n", ToolGetBox(NULL, NULL) ? "True" : "False");
|
TxPrintf("%s\n", ToolGetBox(NULL, NULL) ? "True" : "False");
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -890,16 +806,13 @@ CmdBox(
|
||||||
TxRebuildCommand(cmd);
|
TxRebuildCommand(cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (DBWUnits != DBW_UNITS_USER)
|
else if (DBWSnapToGrid != DBW_SNAP_USER)
|
||||||
{
|
{
|
||||||
distancex = cmdParseCoord(w, cmd->tx_argv[3], TRUE, FALSE);
|
distancex = cmdParseCoord(w, cmd->tx_argv[3], TRUE, FALSE);
|
||||||
distancey = distancex;
|
distancey = distancex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* For user units, the distance may be different in the X and Y
|
|
||||||
* directions for a given value.
|
|
||||||
*/
|
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case GEO_EAST: case GEO_WEST:
|
case GEO_EAST: case GEO_WEST:
|
||||||
|
|
@ -927,14 +840,15 @@ CmdBox(
|
||||||
case BOX_WIDTH:
|
case BOX_WIDTH:
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
char *boxvalues;
|
|
||||||
boxvalues = DBWPrintValue(boxptr->r_xtop - boxptr->r_xbot,
|
|
||||||
w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(boxvalues, -1));
|
char *boxvalues = (char *)Tcl_Alloc(50);
|
||||||
|
sprintf(boxvalues, "%d",
|
||||||
|
boxptr->r_xtop - boxptr->r_xbot);
|
||||||
|
Tcl_SetResult(magicinterp, boxvalues, TCL_DYNAMIC);
|
||||||
#else
|
#else
|
||||||
TxPrintf("%s box width is %s\n", (refEdit) ? "Edit" : "Root",
|
TxPrintf("%s box width is %d\n",
|
||||||
boxvalues);
|
(refEdit) ? "Edit" : "Root",
|
||||||
|
boxptr->r_xtop - boxptr->r_xbot);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -946,14 +860,15 @@ CmdBox(
|
||||||
case BOX_HEIGHT:
|
case BOX_HEIGHT:
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
char *boxvalues;
|
|
||||||
boxvalues = DBWPrintValue(boxptr->r_ytop - boxptr->r_ybot,
|
|
||||||
w, FALSE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(boxvalues, -1));
|
char *boxvalues = (char *)Tcl_Alloc(50);
|
||||||
|
sprintf(boxvalues, "%d",
|
||||||
|
boxptr->r_ytop - boxptr->r_ybot);
|
||||||
|
Tcl_SetResult(magicinterp, boxvalues, TCL_DYNAMIC);
|
||||||
#else
|
#else
|
||||||
TxPrintf("%s box height is %s\n", (refEdit) ? "Edit" : "Root",
|
TxPrintf("%s box height is %d\n",
|
||||||
boxvalues);
|
(refEdit) ? "Edit" : "Root",
|
||||||
|
boxptr->r_ytop - boxptr->r_ybot);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -966,24 +881,16 @@ CmdBox(
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_Obj *tobj;
|
char *boxvalues = (char *)Tcl_Alloc(50);
|
||||||
#endif
|
sprintf(boxvalues, "%d %d",
|
||||||
char *boxvaluex, *boxvaluey;
|
boxptr->r_xtop - boxptr->r_xbot,
|
||||||
boxvaluex = DBWPrintValue(boxptr->r_xtop - boxptr->r_xbot,
|
boxptr->r_ytop - boxptr->r_ybot);
|
||||||
w, TRUE);
|
Tcl_SetResult(magicinterp, boxvalues, TCL_DYNAMIC);
|
||||||
boxvaluey = DBWPrintValue(boxptr->r_ytop - boxptr->r_ybot,
|
|
||||||
w, FALSE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
|
||||||
tobj = Tcl_NewListObj(0, NULL);
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj(boxvaluex, -1));
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj(boxvaluey, -1));
|
|
||||||
Tcl_SetObjResult(magicinterp, tobj);
|
|
||||||
#else
|
#else
|
||||||
TxPrintf("%s box size is %s x %s\n",
|
TxPrintf("%s box size is %d x %d\n",
|
||||||
(refEdit) ? "Edit" : "Root",
|
(refEdit) ? "Edit" : "Root",
|
||||||
boxvaluex, boxvaluey);
|
boxptr->r_xtop - boxptr->r_xbot,
|
||||||
|
boxptr->r_ytop - boxptr->r_ybot);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -998,22 +905,14 @@ CmdBox(
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_Obj *tobj;
|
char *boxvalues = (char *)Tcl_Alloc(50);
|
||||||
#endif
|
sprintf(boxvalues, "%d %d",
|
||||||
char *boxvaluex, *boxvaluey;
|
boxptr->r_xbot, boxptr->r_ybot);
|
||||||
boxvaluex = DBWPrintValue(boxptr->r_xbot, w, TRUE);
|
Tcl_SetResult(magicinterp, boxvalues, TCL_DYNAMIC);
|
||||||
boxvaluey = DBWPrintValue(boxptr->r_ybot, w, FALSE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
|
||||||
tobj = Tcl_NewListObj(0, NULL);
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj(boxvaluex, -1));
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj(boxvaluey, -1));
|
|
||||||
Tcl_SetObjResult(magicinterp, tobj);
|
|
||||||
#else
|
#else
|
||||||
TxPrintf("%s box lower-left corner at (%s, %s)\n",
|
TxPrintf("%s box lower-left corner at (%d, %d)\n",
|
||||||
(refEdit) ? "Edit" : "Root",
|
(refEdit) ? "Edit" : "Root",
|
||||||
boxvaluex, boxvaluey);
|
boxptr->r_xbot, boxptr->r_ybot);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1045,31 +944,16 @@ CmdBox(
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_Obj *tobj;
|
char *boxvalues = (char *)Tcl_Alloc(50);
|
||||||
#endif
|
sprintf(boxvalues, "%d %d %d %d",
|
||||||
char *boxvaluellx, *boxvaluelly;
|
boxptr->r_xbot, boxptr->r_ybot,
|
||||||
char *boxvalueurx, *boxvalueury;
|
boxptr->r_xtop, boxptr->r_ytop);
|
||||||
|
Tcl_SetResult(magicinterp, boxvalues, TCL_DYNAMIC);
|
||||||
boxvaluellx = DBWPrintValue(boxptr->r_xbot, w, TRUE);
|
|
||||||
boxvaluelly = DBWPrintValue(boxptr->r_ybot, w, FALSE);
|
|
||||||
boxvalueurx = DBWPrintValue(boxptr->r_xtop, w, TRUE);
|
|
||||||
boxvalueury = DBWPrintValue(boxptr->r_ytop, w, FALSE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
|
||||||
|
|
||||||
tobj = Tcl_NewListObj(0, NULL);
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj(boxvaluellx, -1));
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj(boxvaluelly, -1));
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj(boxvalueurx, -1));
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj(boxvalueury, -1));
|
|
||||||
Tcl_SetObjResult(magicinterp, tobj);
|
|
||||||
#else
|
#else
|
||||||
TxPrintf("%s box coordinates (%s, %s) to (%s, %s)\n",
|
TxPrintf("%s box coordinates (%d, %d) to (%d, %d)\n",
|
||||||
(refEdit) ? "Edit" : "Root",
|
(refEdit) ? "Edit" : "Root",
|
||||||
boxvaluellx, boxvaluelly, boxvalueurx, boxvalueury);
|
boxptr->r_xbot, boxptr->r_ybot,
|
||||||
|
boxptr->r_xtop, boxptr->r_ytop);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1271,7 +1155,7 @@ CmdBox(
|
||||||
boxptr->r_xbot, boxptr->r_ybot,
|
boxptr->r_xbot, boxptr->r_ybot,
|
||||||
boxptr->r_xtop, boxptr->r_ytop);
|
boxptr->r_xtop, boxptr->r_ytop);
|
||||||
if (area > 0)
|
if (area > 0)
|
||||||
TxPrintf(" %-10"DLONG_PREFIX"d", area);
|
TxPrintf(" %-10lld", area);
|
||||||
TxPrintf("\n");
|
TxPrintf("\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdAutoExtToSim(
|
CmdAutoExtToSim(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
@ -83,9 +83,9 @@ CmdAutoExtToSim(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdAutoExtToSpice(
|
CmdAutoExtToSpice(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
@ -119,9 +119,9 @@ CmdAutoExtToSpice(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdAutoRoute(
|
CmdAutoRoute(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
@ -154,9 +154,9 @@ CmdAutoRoute(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdAutoPlot(
|
CmdAutoPlot(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
@ -189,9 +189,9 @@ CmdAutoPlot(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdAutoLef(
|
CmdAutoLef(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
|
||||||
676
commands/CmdCD.c
676
commands/CmdCD.c
File diff suppressed because it is too large
Load Diff
293
commands/CmdE.c
293
commands/CmdE.c
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdE.c,v 1.4 2010/06/17 14:38:33 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdE.c,v 1.4 2010/06/17 14:38:33 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -79,15 +79,15 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
static bool cmdFoundNewEdit;
|
static bool cmdFoundNewEdit;
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdEdit(
|
CmdEdit(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
Rect area, pointArea;
|
Rect area, pointArea;
|
||||||
CellUse *usave, *use = NULL;
|
CellUse *usave, *use = NULL;
|
||||||
CellDef *csave;
|
CellDef *csave;
|
||||||
int cmdEditRedisplayFunc(MagWindow *w, Rect *area); /* Forward declaration. */
|
int cmdEditRedisplayFunc(); /* Forward declaration. */
|
||||||
int cmdEditEnumFunc(CellUse *selUse, CellUse *use, Transform *transform, Rect *area); /* Forward declaration. */
|
int cmdEditEnumFunc(); /* Forward declaration. */
|
||||||
bool noCurrentUse = FALSE;
|
bool noCurrentUse = FALSE;
|
||||||
|
|
||||||
if ((w != NULL) && (cmd->tx_argc == 2))
|
if ((w != NULL) && (cmd->tx_argc == 2))
|
||||||
|
|
@ -197,11 +197,11 @@ CmdEdit(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdEditRedisplayFunc(
|
cmdEditRedisplayFunc(w, area)
|
||||||
MagWindow *w, /* Window containing edit cell. */
|
MagWindow *w; /* Window containing edit cell. */
|
||||||
Rect *area) /* Area to be redisplayed. */
|
Rect *area; /* Area to be redisplayed. */
|
||||||
{
|
{
|
||||||
static const Rect origin = {{-1, -1}, {1, 1}};
|
static Rect origin = {-1, -1, 1, 1};
|
||||||
Rect tmp;
|
Rect tmp;
|
||||||
DBWclientRec *crec = (DBWclientRec *) w->w_clientData;
|
DBWclientRec *crec = (DBWclientRec *) w->w_clientData;
|
||||||
|
|
||||||
|
|
@ -226,13 +226,13 @@ cmdEditRedisplayFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdEditEnumFunc(
|
cmdEditEnumFunc(selUse, use, transform, area)
|
||||||
CellUse *selUse, /* Use from selection (not used). */
|
CellUse *selUse; /* Use from selection (not used). */
|
||||||
CellUse *use, /* Use from layout that corresponds to
|
CellUse *use; /* Use from layout that corresponds to
|
||||||
* selUse (could be an array!).
|
* selUse (could be an array!).
|
||||||
*/
|
*/
|
||||||
Transform *transform, /* Transform from use->cu_def to root coords. */
|
Transform *transform; /* Transform from use->cu_def to root coords. */
|
||||||
Rect *area) /* We're looking for a use containing this
|
Rect *area; /* We're looking for a use containing this
|
||||||
* area, in root coords.
|
* area, in root coords.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -305,20 +305,20 @@ cmdEditEnumFunc(
|
||||||
#define OPTION_FLAGS 3
|
#define OPTION_FLAGS 3
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdElement(
|
CmdElement(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
|
|
||||||
int option, type;
|
int option, type;
|
||||||
const char * const *msg;
|
char **msg;
|
||||||
Rect area;
|
Rect area;
|
||||||
int style;
|
int style;
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
bool getopt;
|
bool getopt;
|
||||||
|
|
||||||
static const char * const cmdElementOption[] = {
|
static char *cmdElementOption[] = {
|
||||||
"add create a new element",
|
"add create a new element",
|
||||||
"delete delete an existing element",
|
"delete delete an existing element",
|
||||||
"configure configure or query an existing element",
|
"configure configure or query an existing element",
|
||||||
|
|
@ -328,14 +328,14 @@ CmdElement(
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const cmdElementType[] = {
|
static char *cmdElementType[] = {
|
||||||
"line name style x1 y1 x2 y2",
|
"line name style x1 y1 x2 y2",
|
||||||
"rectangle name style llx lly urx ury",
|
"rectangle name style llx lly urx ury",
|
||||||
"text name style cx cy label",
|
"text name style cx cy label",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const cmdConfigureType[] = {
|
static char *cmdConfigureType[] = {
|
||||||
"text get (or) replace <string>",
|
"text get (or) replace <string>",
|
||||||
"style get (or) add <style> (or) remove <style>",
|
"style get (or) add <style> (or) remove <style>",
|
||||||
"position get (or) <point> (or) <rect>",
|
"position get (or) <point> (or) <rect>",
|
||||||
|
|
@ -627,13 +627,13 @@ static CellUse *cmdEraseCells[MAXCELLS];
|
||||||
static int cmdEraseCount;
|
static int cmdEraseCount;
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdErase(
|
CmdErase(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
Rect editRect, areaReturn;
|
Rect editRect, areaReturn;
|
||||||
TileTypeBitMask mask, errorLayersForErasure, activeLayersForErasure;
|
TileTypeBitMask mask, errorLayersForErasure, activeLayersForErasure;
|
||||||
extern int cmdEraseCellsFunc(SearchContext *scx, ClientData cdarg);
|
extern int cmdEraseCellsFunc();
|
||||||
|
|
||||||
windCheckOnlyWindow(&w, DBWclientID);
|
windCheckOnlyWindow(&w, DBWclientID);
|
||||||
if (w == (MagWindow *) NULL) return;
|
if (w == (MagWindow *) NULL) return;
|
||||||
|
|
@ -759,9 +759,9 @@ CmdErase(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdEraseCellsFunc(
|
cmdEraseCellsFunc(scx, cdarg)
|
||||||
SearchContext *scx, /* Indicates cell found. */
|
SearchContext *scx; /* Indicates cell found. */
|
||||||
ClientData cdarg) /* Not used. */
|
ClientData cdarg; /* Not used. */
|
||||||
{
|
{
|
||||||
/* All this procedure does is to remember cells that are
|
/* All this procedure does is to remember cells that are
|
||||||
* found, up to MAXCELLS of them.
|
* found, up to MAXCELLS of them.
|
||||||
|
|
@ -781,82 +781,39 @@ cmdEraseCellsFunc(
|
||||||
* Implement the "expand" command.
|
* Implement the "expand" command.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* expand [selection|surround|overlap|all] [toggle]
|
* expand
|
||||||
*
|
* expand toggle
|
||||||
* "selection" expands cells in the selection. All other options
|
|
||||||
* expand cells in the layout. "all" expands all cells in the
|
|
||||||
* layout. "surround" expands cells which the cursor box
|
|
||||||
* surrounds completely, and "overlap" expands cells which the
|
|
||||||
* cursor box overlaps.
|
|
||||||
*
|
|
||||||
* If "toggle" is specified, flips the expanded/unexpanded status.
|
|
||||||
* Cells which were expanded are unexpanded, and cells which were
|
|
||||||
* unexpanded are expanded.
|
|
||||||
*
|
|
||||||
* For backwards compatibility:
|
|
||||||
* "expand" alone implements "expand overlap".
|
|
||||||
* "expand toggle" implements "expand selection toggle".
|
|
||||||
*
|
|
||||||
* Also see: CmdUnexpand
|
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* None.
|
* None.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* Expansion state of cells is changed. May read cells in from
|
* If "toggle" is specified, flips the expanded/unexpanded status
|
||||||
* disk, and update bounding boxes that have changed.
|
* of all selected cells. Otherwise, aren't any unexpanded cells
|
||||||
|
* left under the box. May read cells in from disk, and updates
|
||||||
|
* bounding boxes that have changed.
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define EXPAND_SELECTION 0
|
|
||||||
#define EXPAND_SURROUND 1
|
|
||||||
#define EXPAND_OVERLAP 2
|
|
||||||
#define EXPAND_ALL 3
|
|
||||||
#define EXPAND_HELP 4
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdExpand(
|
CmdExpand(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int windowMask, boxMask, d, option;
|
int windowMask, boxMask, d;
|
||||||
bool doToggle = FALSE;
|
|
||||||
const char * const *msg;
|
|
||||||
Rect rootRect;
|
Rect rootRect;
|
||||||
CellUse *rootBoxUse;
|
CellUse *rootBoxUse;
|
||||||
CellDef *rootBoxDef;
|
CellDef *rootBoxDef;
|
||||||
|
int cmdExpandFunc(); /* Forward reference. */
|
||||||
|
|
||||||
int cmdExpandFunc(CellUse *use, int windowMask); /* Forward reference. */
|
if (cmd->tx_argc > 2 || (cmd->tx_argc == 2
|
||||||
|
&& (strncmp(cmd->tx_argv[1], "toggle", strlen(cmd->tx_argv[1])) != 0)))
|
||||||
static const char * const cmdExpandOption[] = {
|
|
||||||
"selection expand cell instances in the selection",
|
|
||||||
"surround expand cell instances which the cursor box surrounds",
|
|
||||||
"overlap expand cell instances which the cursor box overlaps",
|
|
||||||
"all expand all cell instances",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
if (cmd->tx_argc > 1)
|
|
||||||
{
|
{
|
||||||
if (!strncmp(cmd->tx_argv[cmd->tx_argc - 1], "toggle",
|
TxError("Usage: %s or %s toggle\n", cmd->tx_argv[0], cmd->tx_argv[0]);
|
||||||
strlen(cmd->tx_argv[cmd->tx_argc - 1])))
|
return;
|
||||||
{
|
|
||||||
doToggle = TRUE;
|
|
||||||
cmd->tx_argc--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd->tx_argc > 1)
|
|
||||||
{
|
|
||||||
option = Lookup(cmd->tx_argv[1], cmdExpandOption);
|
|
||||||
if (option < 0) option = EXPAND_HELP;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
option = EXPAND_OVERLAP;
|
|
||||||
|
|
||||||
if (option == EXPAND_HELP) goto badusage;
|
|
||||||
|
|
||||||
windCheckOnlyWindow(&w, DBWclientID);
|
windCheckOnlyWindow(&w, DBWclientID);
|
||||||
if (w == (MagWindow *) NULL)
|
if (w == (MagWindow *) NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -887,95 +844,23 @@ CmdExpand(
|
||||||
WindScale(d, 1);
|
WindScale(d, 1);
|
||||||
TxPrintf("expand: rescaled by %d\n", d);
|
TxPrintf("expand: rescaled by %d\n", d);
|
||||||
d = DBLambda[1];
|
d = DBLambda[1];
|
||||||
if (doToggle) break; /* Don't toggle twice */
|
if (cmd->tx_argc == 2) break; /* Don't toggle twice */
|
||||||
}
|
}
|
||||||
(void) ToolGetBoxWindow(&rootRect, &boxMask);
|
(void) ToolGetBoxWindow(&rootRect, &boxMask);
|
||||||
|
|
||||||
if (option != EXPAND_SELECTION)
|
if (cmd->tx_argc == 2)
|
||||||
|
SelectExpand(windowMask);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if ((boxMask & windowMask) != windowMask)
|
if ((boxMask & windowMask) != windowMask)
|
||||||
{
|
{
|
||||||
TxError("The box isn't in the same window as the cursor.\n");
|
TxError("The box isn't in the same window as the cursor.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||||
|
TRUE, cmdExpandFunc, (ClientData)(pointertype) windowMask);
|
||||||
switch (option)
|
|
||||||
{
|
|
||||||
case EXPAND_SELECTION:
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
(doToggle) ? DB_EXPAND_TOGGLE : DB_EXPAND,
|
|
||||||
(Rect *)NULL);
|
|
||||||
break;
|
|
||||||
case EXPAND_OVERLAP:
|
|
||||||
if (doToggle)
|
|
||||||
{
|
|
||||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
|
||||||
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
|
||||||
&rootRect);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
&rootRect);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EXPAND_SURROUND:
|
|
||||||
if (doToggle)
|
|
||||||
{
|
|
||||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
|
||||||
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
|
||||||
&rootRect);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
|
||||||
DB_EXPAND | DB_EXPAND_SURROUND,
|
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_EXPAND | DB_EXPAND_SURROUND,
|
|
||||||
&rootRect);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EXPAND_ALL:
|
|
||||||
if (doToggle)
|
|
||||||
{
|
|
||||||
DBExpandAll(rootBoxUse, &TiPlaneRect, windowMask,
|
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
(Rect *)NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBExpandAll(rootBoxUse, &TiPlaneRect, windowMask,
|
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
(Rect *)NULL);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} while (d != DBLambda[1]);
|
} while (d != DBLambda[1]);
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
badusage:
|
|
||||||
for (msg = &(cmdExpandOption[0]); *msg != NULL; msg++)
|
|
||||||
TxPrintf(" %s\n", *msg);
|
|
||||||
TxPrintf(" toggle Toggle the visibility of cell instances.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called for each cell whose expansion status changed.
|
/* This function is called for each cell whose expansion status changed.
|
||||||
|
|
@ -984,9 +869,9 @@ badusage:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdExpandFunc(
|
cmdExpandFunc(use, windowMask)
|
||||||
CellUse *use, /* Use that was just expanded. */
|
CellUse *use; /* Use that was just expanded. */
|
||||||
int windowMask) /* Window where it was expanded. */
|
int windowMask; /* Window where it was expanded. */
|
||||||
{
|
{
|
||||||
if (use->cu_parent == NULL) return 0;
|
if (use->cu_parent == NULL) return 0;
|
||||||
DBWAreaChanged(use->cu_parent, &use->cu_bbox, windowMask,
|
DBWAreaChanged(use->cu_parent, &use->cu_bbox, windowMask,
|
||||||
|
|
@ -1040,14 +925,11 @@ cmdExpandFunc(
|
||||||
#define DOALL 1
|
#define DOALL 1
|
||||||
#define DOCAPACITANCE 2
|
#define DOCAPACITANCE 2
|
||||||
#define DOCOUPLING 3
|
#define DOCOUPLING 3
|
||||||
#define DOEXTRESIST 4
|
#define DOLENGTH 4
|
||||||
#define DOLENGTH 5
|
#define DOLOCAL 5
|
||||||
#define DOLOCAL 6
|
#define DORESISTANCE 6
|
||||||
#define DORESISTANCE 7
|
#define DOLABELCHECK 7
|
||||||
#define DOLABELCHECK 8
|
#define DOALIASES 8
|
||||||
#define DOALIASES 9
|
|
||||||
#define DOUNIQUE 10
|
|
||||||
#define DOEXTRESIST2 11
|
|
||||||
|
|
||||||
#define LENCLEAR 0
|
#define LENCLEAR 0
|
||||||
#define LENDRIVER 1
|
#define LENDRIVER 1
|
||||||
|
|
@ -1059,12 +941,11 @@ cmdExpandFunc(
|
||||||
#define UNIQNOTOPPORTS 3
|
#define UNIQNOTOPPORTS 3
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdExtract(
|
CmdExtract(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
const char * const *msg;
|
char **msg, *namep, *arg;
|
||||||
char *namep, *arg;
|
|
||||||
int option, warn, len, n, all;
|
int option, warn, len, n, all;
|
||||||
int dist;
|
int dist;
|
||||||
bool no;
|
bool no;
|
||||||
|
|
@ -1076,7 +957,7 @@ CmdExtract(
|
||||||
int argc = cmd->tx_argc;
|
int argc = cmd->tx_argc;
|
||||||
char **argv = cmd->tx_argv;
|
char **argv = cmd->tx_argv;
|
||||||
|
|
||||||
static const char * const cmdExtWarn[] =
|
static char *cmdExtWarn[] =
|
||||||
{
|
{
|
||||||
"all enable all warnings",
|
"all enable all warnings",
|
||||||
"dup warn when different nodes have the same name",
|
"dup warn when different nodes have the same name",
|
||||||
|
|
@ -1084,23 +965,20 @@ CmdExtract(
|
||||||
"labels warn when subcell nodes are unlabelled",
|
"labels warn when subcell nodes are unlabelled",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const char * const cmdExtOption[] =
|
static char *cmdExtOption[] =
|
||||||
{
|
{
|
||||||
"adjust compensate R and C hierarchically",
|
"adjust compensate R and C hierarchically",
|
||||||
"all all options",
|
"all all options",
|
||||||
"capacitance extract substrate capacitance",
|
"capacitance extract substrate capacitance",
|
||||||
"coupling extract coupling capacitance",
|
"coupling extract coupling capacitance",
|
||||||
"extresist extract resistance",
|
|
||||||
"length compute driver-receiver pathlengths",
|
"length compute driver-receiver pathlengths",
|
||||||
"local put all generated files in the current directory",
|
"local put all generated files in the current directory",
|
||||||
"lumped estimate lumped resistance",
|
"resistance estimate resistance",
|
||||||
"labelcheck check for connections through sticky labels",
|
"labelcheck check for connections through sticky labels",
|
||||||
"aliases output all net name aliases",
|
"aliases output all net name aliases",
|
||||||
"unique [notopports] ensure unique node names during extraction",
|
|
||||||
"resistance extract resistance (same as \"do extresist\")",
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const char * const cmdExtLength[] =
|
static char *cmdExtLength[] =
|
||||||
{
|
{
|
||||||
"clear clear the driver and receiver tables",
|
"clear clear the driver and receiver tables",
|
||||||
"driver termName(s) identify a driving (output) terminal",
|
"driver termName(s) identify a driving (output) terminal",
|
||||||
|
|
@ -1110,7 +988,7 @@ CmdExtract(
|
||||||
|
|
||||||
/* These must match definitions EXT_UNIQ_* in extract/extract.h: */
|
/* These must match definitions EXT_UNIQ_* in extract/extract.h: */
|
||||||
|
|
||||||
static const char * const cmdExtUniq[] =
|
static char *cmdExtUniq[] =
|
||||||
{
|
{
|
||||||
"all extract matching labels as unique nodes",
|
"all extract matching labels as unique nodes",
|
||||||
"# extract tagged labels as unique nodes",
|
"# extract tagged labels as unique nodes",
|
||||||
|
|
@ -1118,7 +996,7 @@ CmdExtract(
|
||||||
"notopports ignore top-level ports when making labels unique",
|
"notopports ignore top-level ports when making labels unique",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const char * const cmdExtCmd[] =
|
static char *cmdExtCmd[] =
|
||||||
{
|
{
|
||||||
"all extract root cell and all its children",
|
"all extract root cell and all its children",
|
||||||
"cell name extract selected cell into file \"name\"",
|
"cell name extract selected cell into file \"name\"",
|
||||||
|
|
@ -1241,13 +1119,12 @@ CmdExtract(
|
||||||
}
|
}
|
||||||
else if (argc == 2)
|
else if (argc == 2)
|
||||||
{
|
{
|
||||||
char *halodisp;
|
|
||||||
halodisp = DBWPrintValue(ExtCurStyle->exts_sideCoupleHalo,
|
|
||||||
w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(halodisp, -1));
|
Tcl_Obj *tobj;
|
||||||
|
tobj = Tcl_NewIntObj(ExtCurStyle->exts_sideCoupleHalo);
|
||||||
|
Tcl_SetObjResult(magicinterp, tobj);
|
||||||
#else
|
#else
|
||||||
TxPrintf("Side overlap halo is %s\n", halodisp);
|
TxPrintf("Side overlap halo is %d\n", ExtCurStyle->exts_sideCoupleHalo);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1272,12 +1149,12 @@ CmdExtract(
|
||||||
}
|
}
|
||||||
else if (argc == 2)
|
else if (argc == 2)
|
||||||
{
|
{
|
||||||
char *stepdisp;
|
|
||||||
stepdisp = DBWPrintValue(ExtCurStyle->exts_stepSize, w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(stepdisp, -1));
|
Tcl_Obj *tobj;
|
||||||
|
tobj = Tcl_NewIntObj(ExtCurStyle->exts_stepSize);
|
||||||
|
Tcl_SetObjResult(magicinterp, tobj);
|
||||||
#else
|
#else
|
||||||
TxPrintf("Extraction step size is %s\n", stepdisp);
|
TxPrintf("Extraction step size is %d\n", ExtCurStyle->exts_stepSize);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1399,12 +1276,9 @@ CmdExtract(
|
||||||
TxPrintf("%s capacitance\n", OPTSET(EXT_DOCAPACITANCE));
|
TxPrintf("%s capacitance\n", OPTSET(EXT_DOCAPACITANCE));
|
||||||
TxPrintf("%s coupling\n", OPTSET(EXT_DOCOUPLING));
|
TxPrintf("%s coupling\n", OPTSET(EXT_DOCOUPLING));
|
||||||
TxPrintf("%s length\n", OPTSET(EXT_DOLENGTH));
|
TxPrintf("%s length\n", OPTSET(EXT_DOLENGTH));
|
||||||
TxPrintf("%s lumped R\n", OPTSET(EXT_DORESISTANCE));
|
TxPrintf("%s resistance\n", OPTSET(EXT_DORESISTANCE));
|
||||||
TxPrintf("%s label check\n", OPTSET(EXT_DOLABELCHECK));
|
TxPrintf("%s label check\n", OPTSET(EXT_DOLABELCHECK));
|
||||||
TxPrintf("%s aliases\n", OPTSET(EXT_DOALIASES));
|
TxPrintf("%s aliases\n", OPTSET(EXT_DOALIASES));
|
||||||
TxPrintf("%s unique\n", OPTSET(EXT_DOUNIQUE));
|
|
||||||
TxPrintf("%s unique notopports\n", OPTSET(EXT_DOUNIQNOTOPPORTS));
|
|
||||||
TxPrintf("%s resistance (extresist)\n", OPTSET(EXT_DOEXTRESIST));
|
|
||||||
return;
|
return;
|
||||||
#undef OPTSET
|
#undef OPTSET
|
||||||
}
|
}
|
||||||
|
|
@ -1434,19 +1308,6 @@ CmdExtract(
|
||||||
case DORESISTANCE: option = EXT_DORESISTANCE; break;
|
case DORESISTANCE: option = EXT_DORESISTANCE; break;
|
||||||
case DOLABELCHECK: option = EXT_DOLABELCHECK; break;
|
case DOLABELCHECK: option = EXT_DOLABELCHECK; break;
|
||||||
case DOALIASES: option = EXT_DOALIASES; break;
|
case DOALIASES: option = EXT_DOALIASES; break;
|
||||||
case DOEXTRESIST:
|
|
||||||
case DOEXTRESIST2: option = EXT_DOEXTRESIST; break;
|
|
||||||
case DOUNIQUE:
|
|
||||||
if (argc == 4)
|
|
||||||
{
|
|
||||||
if (!strncmp(argv[3], "notop", 5))
|
|
||||||
option = EXT_DOUNIQNOTOPPORTS | EXT_DOUNIQUE;
|
|
||||||
else
|
|
||||||
TxError("Usage: extract do unique [notopports]\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
option = EXT_DOUNIQUE;
|
|
||||||
break;
|
|
||||||
case DOLOCAL:
|
case DOLOCAL:
|
||||||
/* "extract do local" and "extract no local" are kept for
|
/* "extract do local" and "extract no local" are kept for
|
||||||
* backwards compatibility, but now effectively implement
|
* backwards compatibility, but now effectively implement
|
||||||
|
|
|
||||||
268
commands/CmdFI.c
268
commands/CmdFI.c
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdFI.c,v 1.4 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdFI.c,v 1.4 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -100,19 +100,17 @@ struct cmdFPArg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
feedPolyFunc(
|
feedPolyFunc(tile, arg)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo,
|
struct cmdFPArg *arg;
|
||||||
struct cmdFPArg *arg)
|
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
TiToRect(tile, &area);
|
TiToRect(tile, &area);
|
||||||
|
|
||||||
/* (NOTE: Preserve information about the geometry of a diagonal tile) */
|
|
||||||
DBWFeedbackAdd(&area, arg->text, arg->def, FEEDMAGNIFY,
|
DBWFeedbackAdd(&area, arg->text, arg->def, FEEDMAGNIFY,
|
||||||
arg->style |
|
arg->style |
|
||||||
((TiGetTypeExact(tile) | dinfo) &
|
(TiGetTypeExact(tile) & (TT_DIAGONAL | TT_DIRECTION | TT_SIDE)));
|
||||||
(TT_DIAGONAL | TT_DIRECTION | TT_SIDE)));
|
/* (preserve information about the geometry of a diagonal tile) */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,11 +146,11 @@ feedPolyFunc(
|
||||||
#define WHY 6
|
#define WHY 6
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdFeedback(
|
CmdFeedback(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
static const char * const cmdFeedbackOptions[] =
|
static char *cmdFeedbackOptions[] =
|
||||||
{
|
{
|
||||||
"add text [style] [points...] create new feedback area over box",
|
"add text [style] [points...] create new feedback area over box",
|
||||||
"clear [substring] clear all or selected feedback info",
|
"clear [substring] clear all or selected feedback info",
|
||||||
|
|
@ -163,11 +161,11 @@ CmdFeedback(
|
||||||
"why print all feedback messages under box",
|
"why print all feedback messages under box",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const char * const cmdFeedbackStyleNames[] =
|
static char *cmdFeedbackStyleNames[] =
|
||||||
{
|
{
|
||||||
"dotted", "medium", "outline", "pale", "solid", NULL
|
"dotted", "medium", "outline", "pale", "solid", NULL
|
||||||
};
|
};
|
||||||
static const int cmdFeedbackStyles[] =
|
static int cmdFeedbackStyles[] =
|
||||||
{
|
{
|
||||||
STYLE_DOTTEDHIGHLIGHTS, STYLE_MEDIUMHIGHLIGHTS,
|
STYLE_DOTTEDHIGHLIGHTS, STYLE_MEDIUMHIGHLIGHTS,
|
||||||
STYLE_OUTLINEHIGHLIGHTS, STYLE_PALEHIGHLIGHTS,
|
STYLE_OUTLINEHIGHLIGHTS, STYLE_PALEHIGHLIGHTS,
|
||||||
|
|
@ -178,8 +176,7 @@ CmdFeedback(
|
||||||
*/
|
*/
|
||||||
int option, i, style, pstart;
|
int option, i, style, pstart;
|
||||||
Rect box, r;
|
Rect box, r;
|
||||||
char *text;
|
char *text, **msg;
|
||||||
const char * const *msg;
|
|
||||||
CellDef *rootDef;
|
CellDef *rootDef;
|
||||||
HashTable table;
|
HashTable table;
|
||||||
HashEntry *h;
|
HashEntry *h;
|
||||||
|
|
@ -508,16 +505,14 @@ Rect cmdFillRootBox; /* Root coords of box. */
|
||||||
struct cmdFillArea *cmdFillList; /* List of areas to fill. */
|
struct cmdFillArea *cmdFillList; /* List of areas to fill. */
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdFill(
|
CmdFill(w, cmd)
|
||||||
MagWindow *w, /* Window in which command was invoked. */
|
MagWindow *w; /* Window in which command was invoked. */
|
||||||
TxCommand *cmd) /* Describes the command that was invoked. */
|
TxCommand *cmd; /* Describes the command that was invoked. */
|
||||||
{
|
{
|
||||||
TileTypeBitMask maskBits;
|
TileTypeBitMask maskBits;
|
||||||
Rect editBox;
|
Rect editBox;
|
||||||
SearchContext scx;
|
SearchContext scx;
|
||||||
|
extern int cmdFillFunc();
|
||||||
/* Forward declaration */
|
|
||||||
extern int cmdFillFunc(Tile *tile, TileType dinfo, TreeContext *cxp);
|
|
||||||
|
|
||||||
if (cmd->tx_argc < 2 || cmd->tx_argc > 3)
|
if (cmd->tx_argc < 2 || cmd->tx_argc > 3)
|
||||||
{
|
{
|
||||||
|
|
@ -585,15 +580,13 @@ CmdFill(
|
||||||
/* Now that we've got all the material, scan over the list
|
/* Now that we've got all the material, scan over the list
|
||||||
* painting the material and freeing up the entries on the list.
|
* painting the material and freeing up the entries on the list.
|
||||||
*/
|
*/
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
while (cmdFillList != NULL)
|
while (cmdFillList != NULL)
|
||||||
{
|
{
|
||||||
DBPaint(EditCellUse->cu_def, &cmdFillList->cfa_area,
|
DBPaint(EditCellUse->cu_def, &cmdFillList->cfa_area,
|
||||||
cmdFillList->cfa_type);
|
cmdFillList->cfa_type);
|
||||||
freeMagic1(&mm1, (char *) cmdFillList);
|
freeMagic((char *) cmdFillList);
|
||||||
cmdFillList = cmdFillList->cfa_next;
|
cmdFillList = cmdFillList->cfa_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
|
|
||||||
SelectClear();
|
SelectClear();
|
||||||
DBAdjustLabels(EditCellUse->cu_def, &editBox);
|
DBAdjustLabels(EditCellUse->cu_def, &editBox);
|
||||||
|
|
@ -607,17 +600,12 @@ CmdFill(
|
||||||
* paint here it may mess up the search. Instead, the procedures
|
* paint here it may mess up the search. Instead, the procedures
|
||||||
* save areas on a list. The list is post-processed to paint the
|
* save areas on a list. The list is post-processed to paint the
|
||||||
* areas once the search is finished.
|
* areas once the search is finished.
|
||||||
*
|
|
||||||
* Split tile information is unused because there is no obvious
|
|
||||||
* meaning to "filling" from a split tile, although probably reasonable
|
|
||||||
* methods could be worked out.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdFillFunc(
|
cmdFillFunc(tile, cxp)
|
||||||
Tile *tile, /* Tile to fill with. */
|
Tile *tile; /* Tile to fill with. */
|
||||||
TileType dinfo, /* Split tile information (unused) */
|
TreeContext *cxp; /* Describes state of search. */
|
||||||
TreeContext *cxp) /* Describes state of search. */
|
|
||||||
{
|
{
|
||||||
Rect r1, r2;
|
Rect r1, r2;
|
||||||
struct cmdFillArea *cfa;
|
struct cmdFillArea *cfa;
|
||||||
|
|
@ -670,9 +658,9 @@ cmdFillFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdFindBox(
|
CmdFindBox(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
CellDef *boxDef;
|
CellDef *boxDef;
|
||||||
Rect box;
|
Rect box;
|
||||||
|
|
@ -763,12 +751,11 @@ typedef struct _labsearchrec
|
||||||
} LabSearchRec;
|
} LabSearchRec;
|
||||||
|
|
||||||
|
|
||||||
int
|
int cmdFindLabelFunc(rect, name, label, cdarg)
|
||||||
cmdFindLabelFunc(
|
Rect *rect;
|
||||||
Rect *rect,
|
char *name;
|
||||||
char *name,
|
Label *label;
|
||||||
Label *label,
|
LabSearchRec *cdarg;
|
||||||
LabSearchRec *cdarg)
|
|
||||||
{
|
{
|
||||||
if (cdarg->lsr_occur == 0)
|
if (cdarg->lsr_occur == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -803,9 +790,9 @@ cmdFindLabelFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdFindLabel(
|
CmdFindLabel(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
CellDef *boxDef;
|
CellDef *boxDef;
|
||||||
CellUse *labUse;
|
CellUse *labUse;
|
||||||
|
|
@ -814,7 +801,7 @@ CmdFindLabel(
|
||||||
int found, occur, plainargs;
|
int found, occur, plainargs;
|
||||||
bool doglob = FALSE; /* csh-style glob matching (see utils/match.c) */
|
bool doglob = FALSE; /* csh-style glob matching (see utils/match.c) */
|
||||||
LabSearchRec lsr;
|
LabSearchRec lsr;
|
||||||
int dbListLabels(SearchContext *scx, Label *label, TerminalPath *tpath, ClientData cdarg); /* forward declaration */
|
int dbListLabels(); /* forward declaration */
|
||||||
|
|
||||||
plainargs = cmd->tx_argc;
|
plainargs = cmd->tx_argc;
|
||||||
if ((plainargs > 2) && !strncmp(cmd->tx_argv[1], "-glob", 5))
|
if ((plainargs > 2) && !strncmp(cmd->tx_argv[1], "-glob", 5))
|
||||||
|
|
@ -852,7 +839,7 @@ CmdFindLabel(
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
labname = cmd->tx_argv[1 + ((doglob) ? 1 : 0)];
|
labname = cmd->tx_argv[1 + (doglob) ? 1 : 0];
|
||||||
labUse = EditCellUse;
|
labUse = EditCellUse;
|
||||||
if (labUse == NULL) labUse = (CellUse *)w->w_surfaceID;
|
if (labUse == NULL) labUse = (CellUse *)w->w_surfaceID;
|
||||||
|
|
||||||
|
|
@ -902,11 +889,11 @@ usage:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbListLabels(
|
dbListLabels(scx, label, tpath, cdarg)
|
||||||
SearchContext *scx,
|
SearchContext *scx;
|
||||||
Label *label, /* Pointer to label structure */
|
Label *label; /* Pointer to label structure */
|
||||||
TerminalPath *tpath, /* Full pathname of terminal */
|
TerminalPath *tpath; /* Full pathname of terminal */
|
||||||
ClientData cdarg) /* (unused) */
|
ClientData cdarg; /* (unused) */
|
||||||
{
|
{
|
||||||
char *n = tpath->tp_next;
|
char *n = tpath->tp_next;
|
||||||
char c = *n;
|
char c = *n;
|
||||||
|
|
@ -947,16 +934,15 @@ dbListLabels(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdFlush(
|
CmdFlush(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
int action;
|
int action;
|
||||||
static const char * const actionNames[] = { "no", "yes", 0 };
|
static char *actionNames[] = { "no", "yes", 0 };
|
||||||
char *prompt;
|
char *prompt;
|
||||||
bool dereference = FALSE;
|
bool dereference = FALSE;
|
||||||
bool noprompt = FALSE; /* no interactive confirm when changed */
|
|
||||||
|
|
||||||
if (!strncmp(cmd->tx_argv[cmd->tx_argc - 1], "-deref", 6))
|
if (!strncmp(cmd->tx_argv[cmd->tx_argc - 1], "-deref", 6))
|
||||||
{
|
{
|
||||||
|
|
@ -964,15 +950,9 @@ CmdFlush(
|
||||||
cmd->tx_argc--;
|
cmd->tx_argc--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(cmd->tx_argv[cmd->tx_argc - 1], "-noprompt"))
|
|
||||||
{
|
|
||||||
noprompt = TRUE;
|
|
||||||
cmd->tx_argc--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd->tx_argc > 2)
|
if (cmd->tx_argc > 2)
|
||||||
{
|
{
|
||||||
TxError("Usage: flush [cellname] [-noprompt] [-dereference]\n");
|
TxError("Usage: flush [cellname] [dereference]\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -993,9 +973,7 @@ CmdFlush(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_changes = (def->cd_flags & (CDMODIFIED|CDSTAMPSCHANGED|CDBOXESCHANGED)) != 0;
|
if (def->cd_flags & (CDMODIFIED|CDSTAMPSCHANGED|CDBOXESCHANGED))
|
||||||
|
|
||||||
if (!noprompt && has_changes)
|
|
||||||
{
|
{
|
||||||
prompt = TxPrintString("Really throw away all changes made"
|
prompt = TxPrintString("Really throw away all changes made"
|
||||||
" to cell %s? ", def->cd_name);
|
" to cell %s? ", def->cd_name);
|
||||||
|
|
@ -1006,7 +984,7 @@ CmdFlush(
|
||||||
|
|
||||||
cmdFlushCell(def, dereference);
|
cmdFlushCell(def, dereference);
|
||||||
SelectClear();
|
SelectClear();
|
||||||
TxPrintf("[Flushed%s]\n", has_changes ? " Modifications were Discarded" : "");
|
TxPrintf("[Flushed]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1037,9 +1015,9 @@ CmdFlush(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdGetcell(
|
CmdGetcell(w, cmd)
|
||||||
MagWindow *w, /* Window in which command was invoked. */
|
MagWindow *w; /* Window in which command was invoked. */
|
||||||
TxCommand *cmd) /* Describes command arguments. */
|
TxCommand *cmd; /* Describes command arguments. */
|
||||||
{
|
{
|
||||||
CellUse dummy, *newUse;
|
CellUse dummy, *newUse;
|
||||||
Transform editTrans;
|
Transform editTrans;
|
||||||
|
|
@ -1122,9 +1100,9 @@ CmdGetcell(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdGetnode(
|
CmdGetnode(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
#define TBLSIZE 50
|
#define TBLSIZE 50
|
||||||
#define STRINGS 0
|
#define STRINGS 0
|
||||||
|
|
@ -1219,7 +1197,7 @@ CmdGetnode(
|
||||||
TxError("Put the cursor in a layout window\n");
|
TxError("Put the cursor in a layout window\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_fast == TRUE)
|
if( is_fast == TRUE )
|
||||||
{
|
{
|
||||||
SimRecomputeSel = TRUE;
|
SimRecomputeSel = TRUE;
|
||||||
SimGetsnode();
|
SimGetsnode();
|
||||||
|
|
@ -1227,8 +1205,7 @@ CmdGetnode(
|
||||||
else
|
else
|
||||||
SimGetnode();
|
SimGetnode();
|
||||||
|
|
||||||
if (SimGetnodeAlias) /* "erase" the hash table */
|
if (SimGetnodeAlias) { /* "erase" the hash table */
|
||||||
{
|
|
||||||
HashKill(&SimGNAliasTbl);
|
HashKill(&SimGNAliasTbl);
|
||||||
HashInit(&SimGNAliasTbl, 120, STRINGS);
|
HashInit(&SimGNAliasTbl, 120, STRINGS);
|
||||||
}
|
}
|
||||||
|
|
@ -1274,15 +1251,15 @@ badusage:
|
||||||
#define GRID_WHAT 7
|
#define GRID_WHAT 7
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdGrid(
|
CmdGrid(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int option, locargc;
|
int option, locargc;
|
||||||
int xSpacing, ySpacing, xOrig, yOrig, multiple;
|
int xSpacing, ySpacing, xOrig, yOrig, multiple;
|
||||||
DBWclientRec *crec;
|
DBWclientRec *crec;
|
||||||
char *boxvalues;
|
char *boxvalues;
|
||||||
static const char * const cmdGridOptions[] =
|
static char *cmdGridOptions[] =
|
||||||
{
|
{
|
||||||
"box [values] report the box representing the user grid",
|
"box [values] report the box representing the user grid",
|
||||||
"help print this message",
|
"help print this message",
|
||||||
|
|
@ -1442,9 +1419,9 @@ CmdGrid(
|
||||||
|
|
||||||
#ifdef USE_READLINE
|
#ifdef USE_READLINE
|
||||||
void
|
void
|
||||||
CmdHistory(
|
CmdHistory(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
HIST_ENTRY *he;
|
HIST_ENTRY *he;
|
||||||
|
|
@ -1523,11 +1500,11 @@ CmdHistory(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdIdentify(
|
CmdIdentify(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
extern int cmdIdFunc(CellUse *selUse, CellUse *use, Transform *transform, char *newId); /* Forward reference. */
|
extern int cmdIdFunc(); /* Forward reference. */
|
||||||
|
|
||||||
if (cmd->tx_argc != 2)
|
if (cmd->tx_argc != 2)
|
||||||
{
|
{
|
||||||
|
|
@ -1552,13 +1529,13 @@ CmdIdentify(
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
cmdIdFunc(
|
cmdIdFunc(selUse, use, transform, newId)
|
||||||
CellUse *selUse, /* Use from selection cell. */
|
CellUse *selUse; /* Use from selection cell. */
|
||||||
CellUse *use, /* Use from layout that corresponds to
|
CellUse *use; /* Use from layout that corresponds to
|
||||||
* selUse.
|
* selUse.
|
||||||
*/
|
*/
|
||||||
Transform *transform, /* Not used. */
|
Transform *transform; /* Not used. */
|
||||||
char *newId) /* New id for cell use. */
|
char *newId; /* New id for cell use. */
|
||||||
{
|
{
|
||||||
if (EditCellUse == NULL)
|
if (EditCellUse == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -1599,12 +1576,12 @@ cmdIdFunc(
|
||||||
}
|
}
|
||||||
|
|
||||||
TileType
|
TileType
|
||||||
CmdFindNetProc(
|
CmdFindNetProc(nodename, use, rect, warn_not_found, isvalid)
|
||||||
char *nodename,
|
char *nodename;
|
||||||
CellUse *use,
|
CellUse *use;
|
||||||
Rect *rect,
|
Rect *rect;
|
||||||
bool warn_not_found,
|
bool warn_not_found;
|
||||||
bool *isvalid)
|
bool *isvalid;
|
||||||
{
|
{
|
||||||
char *s,*s2;
|
char *s,*s2;
|
||||||
SearchContext scx, scx2;
|
SearchContext scx, scx2;
|
||||||
|
|
@ -1614,13 +1591,13 @@ CmdFindNetProc(
|
||||||
int pnum, xpos, ypos;
|
int pnum, xpos, ypos;
|
||||||
char *xstr, *ystr;
|
char *xstr, *ystr;
|
||||||
bool locvalid = FALSE, usefound = TRUE;
|
bool locvalid = FALSE, usefound = TRUE;
|
||||||
TileType ttype, dinfo = (TileType)0;
|
TileType ttype;
|
||||||
|
|
||||||
scx.scx_use = use;
|
scx.scx_use = use;
|
||||||
scx.scx_trans = GeoIdentityTransform;
|
scx.scx_trans = GeoIdentityTransform;
|
||||||
s = nodename;
|
s = nodename;
|
||||||
trans = GeoIdentityTransform;
|
trans = GeoIdentityTransform;
|
||||||
while ((s2 = strchr(s, '/')))
|
while (s2 = strchr(s, '/'))
|
||||||
{
|
{
|
||||||
*s2 = '\0';
|
*s2 = '\0';
|
||||||
DBTreeFindUse(s, scx.scx_use, &scx2);
|
DBTreeFindUse(s, scx.scx_use, &scx2);
|
||||||
|
|
@ -1652,7 +1629,6 @@ CmdFindNetProc(
|
||||||
|
|
||||||
if ((xstr = strchr(s, '_')) != NULL)
|
if ((xstr = strchr(s, '_')) != NULL)
|
||||||
{
|
{
|
||||||
char *hashpos;
|
|
||||||
bool isNeg = FALSE;
|
bool isNeg = FALSE;
|
||||||
|
|
||||||
/* The characters up to the leading '_' should match one of the */
|
/* The characters up to the leading '_' should match one of the */
|
||||||
|
|
@ -1696,17 +1672,6 @@ CmdFindNetProc(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Format variant used for node regions where a split tile
|
|
||||||
* occupies the root position of the node but the tile type
|
|
||||||
* belonging to the node is on the right side of the tile,
|
|
||||||
* not at the location encoded into the name. An 'x' is
|
|
||||||
* added before the final hash sign.
|
|
||||||
*/
|
|
||||||
hashpos = strrchr(s, '#');
|
|
||||||
if (hashpos != NULL)
|
|
||||||
if (*(hashpos - 1) == 'r')
|
|
||||||
dinfo = TT_DIAGONAL | TT_SIDE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1729,23 +1694,17 @@ checklocal:
|
||||||
|
|
||||||
if (locvalid == TRUE)
|
if (locvalid == TRUE)
|
||||||
{
|
{
|
||||||
int findTile(Tile *tile, TileType dinfo, TileAndDinfo *tad);
|
int findTile();
|
||||||
CellDef *targetdef = use->cu_def;
|
CellDef *targetdef = use->cu_def;
|
||||||
Plane *plane = targetdef->cd_planes[pnum];
|
Plane *plane = targetdef->cd_planes[pnum];
|
||||||
TileAndDinfo tad;
|
|
||||||
|
ttype = TT_SPACE; /* revert to space in case of failure */
|
||||||
|
|
||||||
/* Find the tile type of the tile at the specified point which */
|
/* Find the tile type of the tile at the specified point which */
|
||||||
/* exists on the plane pnum. Note that in the case of a split */
|
/* exists on the plane pnum. */
|
||||||
/* tile region marked with "x" in the name, it does not work to */
|
|
||||||
/* call DBSrPainNMArea() because the diagonal position is not */
|
|
||||||
/* known. findTile() determines the proper type and leaves it */
|
|
||||||
/* in the tad.tad_dinfo record. */
|
|
||||||
|
|
||||||
tad.tad_tile = (Tile *)NULL;
|
|
||||||
tad.tad_dinfo = dinfo;
|
|
||||||
DBSrPaintArea(NULL, plane, &localrect, &DBAllTypeBits, findTile,
|
DBSrPaintArea(NULL, plane, &localrect, &DBAllTypeBits, findTile,
|
||||||
(ClientData) &tad);
|
(ClientData) &ttype);
|
||||||
ttype = tad.tad_dinfo & TT_LEFTMASK;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1809,11 +1768,11 @@ checklocal:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdGoto(
|
CmdGoto(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
char *nodename = cmd->tx_argv[1];
|
char *s, *nodename = cmd->tx_argv[1];
|
||||||
Rect rect;
|
Rect rect;
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
int locargc;
|
int locargc;
|
||||||
|
|
@ -1854,9 +1813,9 @@ CmdGoto(
|
||||||
/* are multiple layers drawn at the indicated point. */
|
/* are multiple layers drawn at the indicated point. */
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetResult(magicinterp, (char*)DBTypeLongName(ttype), NULL); /* Tcl treats as const */
|
Tcl_SetResult(magicinterp, DBTypeLongName(ttype), NULL);
|
||||||
#else
|
#else
|
||||||
TxPrintf("node %s is type %s\n", nodename, DBTypeLongName(ttype));
|
TxPrintf("node %s is type %s\n", s, DBTypeLongName(ttype));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1867,33 +1826,22 @@ CmdGoto(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
findTile(
|
findTile(tile, rtype)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo, /* (unused) */
|
TileType *rtype;
|
||||||
TileAndDinfo *tad)
|
|
||||||
{
|
{
|
||||||
TileType ttype;
|
TileType ttype;
|
||||||
|
|
||||||
/* Note that since all types are being searched, a split
|
|
||||||
* tile would cause the callback to be called twice. But
|
|
||||||
* this routine will pick the indicated side from the
|
|
||||||
* "tad" structure and return 1 so it does not get called
|
|
||||||
* a second time. The "dinfo" value passed is irrelevant.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
if (tad->tad_dinfo & TT_SIDE)
|
if (SplitSide(tile))
|
||||||
ttype = SplitRightType(tile);
|
ttype = SplitRightType(tile);
|
||||||
else
|
else
|
||||||
ttype = SplitLeftType(tile);
|
ttype = SplitLeftType(tile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ttype = TiGetTypeExact(tile);
|
ttype = TiGetTypeExact(tile);
|
||||||
|
*rtype = ttype;
|
||||||
/* Leave the tile type in tad_dinfo before returning */
|
|
||||||
tad->tad_dinfo = ttype;
|
|
||||||
|
|
||||||
return 1; /* stop search */
|
return 1; /* stop search */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1903,13 +1851,13 @@ findTile(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
FlatCopyAllLabels(
|
FlatCopyAllLabels(scx, mask, xMask, targetUse)
|
||||||
SearchContext *scx,
|
SearchContext *scx;
|
||||||
TileTypeBitMask *mask,
|
TileTypeBitMask *mask;
|
||||||
int xMask,
|
int xMask;
|
||||||
CellUse *targetUse)
|
CellUse *targetUse;
|
||||||
{
|
{
|
||||||
int flatCopyAllLabels(SearchContext *scx, Label *lab, TerminalPath *tpath, CellUse *targetUse);
|
int flatCopyAllLabels();
|
||||||
char pathstring[FLATTERMSIZE];
|
char pathstring[FLATTERMSIZE];
|
||||||
TerminalPath tpath;
|
TerminalPath tpath;
|
||||||
|
|
||||||
|
|
@ -1922,11 +1870,11 @@ FlatCopyAllLabels(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
flatCopyAllLabels(
|
flatCopyAllLabels(scx, lab, tpath, targetUse)
|
||||||
SearchContext *scx,
|
SearchContext *scx;
|
||||||
Label *lab,
|
Label *lab;
|
||||||
TerminalPath *tpath,
|
TerminalPath *tpath;
|
||||||
CellUse *targetUse)
|
CellUse *targetUse;
|
||||||
{
|
{
|
||||||
Rect labTargetRect;
|
Rect labTargetRect;
|
||||||
int targetPos;
|
int targetPos;
|
||||||
|
|
@ -2005,9 +1953,9 @@ flatCopyAllLabels(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdFlatten(
|
CmdFlatten(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int i, xMask, optargs;
|
int i, xMask, optargs;
|
||||||
bool dolabels, dobox, toplabels, invert, doports, doinplace;
|
bool dolabels, dobox, toplabels, invert, doports, doinplace;
|
||||||
|
|
|
||||||
797
commands/CmdLQ.c
797
commands/CmdLQ.c
File diff suppressed because it is too large
Load Diff
583
commands/CmdRS.c
583
commands/CmdRS.c
File diff suppressed because it is too large
Load Diff
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdSubrs.c,v 1.2 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdSubrs.c,v 1.2 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -52,9 +52,9 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
|
|
||||||
extern char *cmdCheckNewName(CellDef *def, char *newName, bool tryRename, bool noninteractive);
|
extern char *cmdCheckNewName();
|
||||||
extern int cmdSaveWindSet(MagWindow *window, CellDef *def);
|
extern int cmdSaveWindSet();
|
||||||
extern void CmdSetWindCaption(CellUse *newEditUse, CellDef *rootDef);
|
extern void CmdSetWindCaption();
|
||||||
|
|
||||||
TileTypeBitMask CmdYMLabel;
|
TileTypeBitMask CmdYMLabel;
|
||||||
TileTypeBitMask CmdYMCell;
|
TileTypeBitMask CmdYMCell;
|
||||||
|
|
@ -73,22 +73,9 @@ TileTypeBitMask CmdYMAllButSpace;
|
||||||
* lambda, a suffix of "g" indicates the user grid, and a suffix in metric
|
* lambda, a suffix of "g" indicates the user grid, and a suffix in metric
|
||||||
* notation ("nm", "um", "mm", "cm") indicates natural units. Other valid
|
* notation ("nm", "um", "mm", "cm") indicates natural units. Other valid
|
||||||
* units are "cu" or "centimicrons" for centimicrons, or "microns" for um.
|
* units are "cu" or "centimicrons" for centimicrons, or "microns" for um.
|
||||||
* Traditional (backwards-compatible) behavior: Units without any suffix
|
* Units without any suffix are assumed to be in lambda if "snap"
|
||||||
* are assumed to be in lambda if "snap" (DBWSnapToGrid) is set to lambda,
|
* (DBWSnapToGrid) is set to lambda, grid units if "snap" is set to the
|
||||||
* grid units if "snap" is set to the user grid, and internal units otherwise.
|
* user grid, and internal units otherwise.
|
||||||
* Current behavior: Use of the "units" command to set the units to
|
|
||||||
* any value other than "default" causes cmdScaleCoord() to parse any
|
|
||||||
* units provided without an identifying suffix as the units indicted by
|
|
||||||
* the "units" command. Once the "units" command has been issued, the
|
|
||||||
* values are dependent on DBWUnits and not on DBWSnapToGrid.
|
|
||||||
*
|
|
||||||
* Additional behavior from magic version 8.3.596: A single command
|
|
||||||
* option can use simple expressions using '+', '-', '*', and '/'. These
|
|
||||||
* can be passed as a single token, without spaces, or within a string
|
|
||||||
* token deliniated by quotes or braces, per usual Tcl syntax. Unlike
|
|
||||||
* the Tcl "expr" command, this can solve arithmetic expressions of
|
|
||||||
* suffixed values, evaluated independently such that different suffixes
|
|
||||||
* may be used (e.g., "1g + 3um" meaning 1 grid pitch plus 3 microns).
|
|
||||||
*
|
*
|
||||||
* MagWindow argument w is used only with grid-based snapping, to find
|
* MagWindow argument w is used only with grid-based snapping, to find
|
||||||
* the value of the grid for the given window. In this case, because the
|
* the value of the grid for the given window. In this case, because the
|
||||||
|
|
@ -112,212 +99,116 @@ TileTypeBitMask CmdYMAllButSpace;
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PARSEOP_NONE 0
|
|
||||||
#define PARSEOP_ADD 1
|
|
||||||
#define PARSEOP_SUB 2
|
|
||||||
#define PARSEOP_MUL 3
|
|
||||||
#define PARSEOP_DIV 4
|
|
||||||
#define PARSEOP_END 5
|
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdScaleCoord(
|
cmdScaleCoord(w, arg, is_relative, is_x, scale)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
char *arg,
|
char *arg;
|
||||||
bool is_relative,
|
bool is_relative, is_x;
|
||||||
bool is_x,
|
int scale;
|
||||||
int scale)
|
|
||||||
{
|
{
|
||||||
char *endptr;
|
char *endptr;
|
||||||
double dval = 0;
|
double dval = 0;
|
||||||
int mscale = 1, curunits;
|
int mscale = 1;
|
||||||
int retval, curval, parseop;
|
|
||||||
DBWclientRec *crec;
|
DBWclientRec *crec;
|
||||||
|
|
||||||
if (*arg == '{' || *arg == '"') arg++;
|
if (*arg == '{') arg++;
|
||||||
while (isspace(*arg) && (*arg != '\0')) arg++;
|
while (isspace(*arg)) arg++;
|
||||||
|
|
||||||
parseop = PARSEOP_NONE;
|
dval = strtod(arg, &endptr);
|
||||||
retval = 0;
|
dval *= (double)scale;
|
||||||
while (*arg != '\0')
|
|
||||||
|
if (endptr == arg)
|
||||||
{
|
{
|
||||||
dval = strtod(arg, &endptr);
|
/* strtod() error condition */
|
||||||
dval *= (double)scale;
|
TxError("Coordinate value cannot be parsed: assuming 0\n");
|
||||||
mscale = -1;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (endptr == arg)
|
else if ((*endptr == 'l')
|
||||||
|
|| ((*endptr == '\0') && (DBWSnapToGrid == DBW_SNAP_LAMBDA)))
|
||||||
|
{
|
||||||
|
/* lambda or default units */
|
||||||
|
dval *= (double)DBLambda[1];
|
||||||
|
dval /= (double)DBLambda[0];
|
||||||
|
return round(dval);
|
||||||
|
}
|
||||||
|
else if ((*endptr == 'i')
|
||||||
|
|| ((*endptr == '\0') && (DBWSnapToGrid == DBW_SNAP_INTERNAL)))
|
||||||
|
{
|
||||||
|
/* internal units */
|
||||||
|
return round(dval);
|
||||||
|
}
|
||||||
|
else if ((*endptr == 'g')
|
||||||
|
|| ((*endptr == '\0') && (DBWSnapToGrid == DBW_SNAP_USER)))
|
||||||
|
{
|
||||||
|
/* grid units */
|
||||||
|
if (w == (MagWindow *)NULL)
|
||||||
{
|
{
|
||||||
/* strtod() error condition */
|
windCheckOnlyWindow(&w, DBWclientID);
|
||||||
TxError("Coordinate value cannot be parsed: assuming 0\n");
|
|
||||||
curval = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Original behavior was to accept un-suffixed values according to the
|
|
||||||
* "snap" setting. This behavior remains in effect until the "units"
|
|
||||||
* command is used, in which case units follow the selected units
|
|
||||||
* value indepedendently of the snap setting.
|
|
||||||
*
|
|
||||||
* Updated 12/24/2026 to handle space-separated values (in which
|
|
||||||
* *endptr may be a space as well as NULL).
|
|
||||||
*/
|
|
||||||
if (DBWUnits == DBW_UNITS_DEFAULT)
|
|
||||||
curunits = DBWSnapToGrid;
|
|
||||||
else
|
|
||||||
curunits = DBWUnits & DBW_UNITS_TYPE_MASK;
|
|
||||||
|
|
||||||
if ((*endptr == 'l')
|
|
||||||
|| (((*endptr == '\0') || isspace(*endptr))
|
|
||||||
&& (curunits == DBW_UNITS_LAMBDA)))
|
|
||||||
{
|
|
||||||
/* lambda or default units */
|
|
||||||
dval *= (double)DBLambda[1];
|
|
||||||
dval /= (double)DBLambda[0];
|
|
||||||
}
|
|
||||||
else if ((*endptr == 'i')
|
|
||||||
|| (((*endptr == '\0') || isspace(*endptr))
|
|
||||||
&& (curunits == DBW_UNITS_INTERNAL)))
|
|
||||||
{
|
|
||||||
/* internal units */
|
|
||||||
}
|
|
||||||
else if ((*endptr == 'g')
|
|
||||||
|| (((*endptr == '\0') || isspace(*endptr))
|
|
||||||
&& (curunits == DBW_UNITS_USER)))
|
|
||||||
{
|
|
||||||
/* grid units */
|
|
||||||
if (w == (MagWindow *)NULL)
|
if (w == (MagWindow *)NULL)
|
||||||
{
|
return round(dval); /* Default, if window is unknown */
|
||||||
windCheckOnlyWindow(&w, DBWclientID);
|
}
|
||||||
if (w == (MagWindow *)NULL)
|
crec = (DBWclientRec *) w->w_clientData;
|
||||||
{
|
if (is_x)
|
||||||
curval = round(dval); /* Default, if window is unknown */
|
{
|
||||||
break;
|
dval *= (double)(crec->dbw_gridRect.r_xtop
|
||||||
}
|
|
||||||
}
|
|
||||||
crec = (DBWclientRec *) w->w_clientData;
|
|
||||||
if (is_x)
|
|
||||||
{
|
|
||||||
dval *= (double)(crec->dbw_gridRect.r_xtop
|
|
||||||
- crec->dbw_gridRect.r_xbot);
|
- crec->dbw_gridRect.r_xbot);
|
||||||
if (!is_relative)
|
if (!is_relative)
|
||||||
dval += (double)crec->dbw_gridRect.r_xbot;
|
dval += (double)crec->dbw_gridRect.r_xbot;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dval *= (double)(crec->dbw_gridRect.r_ytop
|
dval *= (double)(crec->dbw_gridRect.r_ytop
|
||||||
- crec->dbw_gridRect.r_ybot);
|
- crec->dbw_gridRect.r_ybot);
|
||||||
if (!is_relative)
|
if (!is_relative)
|
||||||
dval += (double)crec->dbw_gridRect.r_ybot;
|
dval += (double)crec->dbw_gridRect.r_ybot;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (((*endptr == '\0') || isspace(*endptr))
|
return round(dval);
|
||||||
&& (curunits == DBW_UNITS_MICRONS))
|
}
|
||||||
{
|
else
|
||||||
mscale = 1000;
|
{
|
||||||
}
|
/* natural units referred to the current cifoutput style */
|
||||||
else if (*endptr != '\0')
|
if (*(endptr + 1) == 'm')
|
||||||
{
|
|
||||||
/* natural units referred to the current cifoutput style */
|
|
||||||
if (*(endptr + 1) == 'm')
|
|
||||||
{
|
|
||||||
switch (*endptr)
|
|
||||||
{
|
|
||||||
case 'n':
|
|
||||||
mscale = 1;
|
|
||||||
break;
|
|
||||||
case 'u':
|
|
||||||
mscale = 1000;
|
|
||||||
break;
|
|
||||||
case 'm':
|
|
||||||
mscale = 1000000;
|
|
||||||
break;
|
|
||||||
case 'c':
|
|
||||||
mscale = 10000000;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
TxError("Unknown metric prefix \"%cm\"; assuming "
|
|
||||||
"internal units\n", *endptr);
|
|
||||||
mscale = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((*endptr == 'u') && !isalnum(*(endptr + 1)))
|
|
||||||
/* Maybe "u" is too ambiguous but it is very commonly used as
|
|
||||||
* an abbreviation for "micron".
|
|
||||||
*/
|
|
||||||
mscale = 1000;
|
|
||||||
else if (!strncmp(endptr, "micron", 6))
|
|
||||||
mscale = 1000;
|
|
||||||
else if (!strncmp(endptr, "centimicron", 11) || !strcmp(endptr, "cu"))
|
|
||||||
mscale = 10;
|
|
||||||
else if (!isspace(*endptr) && (*endptr != '+') && (*endptr != '-') &&
|
|
||||||
(*endptr != '*') && (*endptr != '/'))
|
|
||||||
{
|
|
||||||
TxError("Unknown coordinate type at \"%s\"; assuming internal units\n",
|
|
||||||
endptr);
|
|
||||||
mscale = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mscale != -1)
|
|
||||||
dval /= CIFGetOutputScale(mscale);
|
|
||||||
curval = round(dval);
|
|
||||||
|
|
||||||
switch (parseop)
|
|
||||||
{
|
|
||||||
case PARSEOP_NONE:
|
|
||||||
retval = curval;
|
|
||||||
break;
|
|
||||||
case PARSEOP_ADD:
|
|
||||||
retval += curval;
|
|
||||||
break;
|
|
||||||
case PARSEOP_SUB:
|
|
||||||
retval -= curval;
|
|
||||||
break;
|
|
||||||
case PARSEOP_MUL:
|
|
||||||
retval *= curval;
|
|
||||||
break;
|
|
||||||
case PARSEOP_DIV:
|
|
||||||
retval /= curval;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
parseop = PARSEOP_NONE;
|
|
||||||
while (*endptr != '\0')
|
|
||||||
{
|
{
|
||||||
switch (*endptr)
|
switch (*endptr)
|
||||||
{
|
{
|
||||||
case '}':
|
case 'n':
|
||||||
case '"':
|
mscale = 1;
|
||||||
parseop = PARSEOP_END;
|
|
||||||
break;
|
break;
|
||||||
case '+':
|
case 'u':
|
||||||
parseop = PARSEOP_ADD;
|
mscale = 1000;
|
||||||
endptr++;
|
|
||||||
break;
|
break;
|
||||||
case '-':
|
case 'm':
|
||||||
parseop = PARSEOP_SUB;
|
mscale = 1000000;
|
||||||
endptr++;
|
|
||||||
break;
|
break;
|
||||||
case '*':
|
case 'c':
|
||||||
parseop = PARSEOP_MUL;
|
mscale = 10000000;
|
||||||
endptr++;
|
|
||||||
break;
|
|
||||||
case '/':
|
|
||||||
parseop = PARSEOP_DIV;
|
|
||||||
endptr++;
|
|
||||||
break;
|
|
||||||
case ' ':
|
|
||||||
case '\t':
|
|
||||||
endptr++;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Should this flag an error? */
|
TxError("Unknown metric prefix \"%cm\"; assuming internal units\n",
|
||||||
return retval;
|
*endptr);
|
||||||
|
return round(dval);
|
||||||
}
|
}
|
||||||
if (parseop != PARSEOP_NONE) break;
|
|
||||||
}
|
}
|
||||||
arg = endptr;
|
else if (!strcmp(endptr, "u"))
|
||||||
while (isspace(*arg) && (*arg != '\0')) arg++;
|
/* Maybe "u" is too ambiguous but it is very commonly used as
|
||||||
|
* an abbreviation for "micron".
|
||||||
|
*/
|
||||||
|
mscale = 1000;
|
||||||
|
else if (!strncmp(endptr, "micron", 6))
|
||||||
|
mscale = 1000;
|
||||||
|
else if (!strncmp(endptr, "centimicron", 11) || !strcmp(endptr, "cu"))
|
||||||
|
mscale = 10;
|
||||||
|
else if (!isspace(*endptr))
|
||||||
|
{
|
||||||
|
TxError("Unknown coordinate type \"%s\"; assuming internal units\n",
|
||||||
|
endptr);
|
||||||
|
return round(dval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
if (!isspace(*endptr))
|
||||||
|
dval /= CIFGetOutputScale(mscale);
|
||||||
|
return round(dval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -339,11 +230,10 @@ cmdScaleCoord(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdParseCoord(
|
cmdParseCoord(w, arg, is_relative, is_x)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
char *arg,
|
char *arg;
|
||||||
bool is_relative,
|
bool is_relative, is_x;
|
||||||
bool is_x)
|
|
||||||
{
|
{
|
||||||
return cmdScaleCoord(w, arg, is_relative, is_x, 1);
|
return cmdScaleCoord(w, arg, is_relative, is_x, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -367,7 +257,7 @@ cmdParseCoord(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdInit(void)
|
CmdInit()
|
||||||
{
|
{
|
||||||
TTMaskZero(&CmdYMLabel);
|
TTMaskZero(&CmdYMLabel);
|
||||||
TTMaskSetType(&CmdYMLabel, L_LABEL);
|
TTMaskSetType(&CmdYMLabel, L_LABEL);
|
||||||
|
|
@ -401,9 +291,9 @@ CmdInit(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmdFlushCell(
|
cmdFlushCell(def, force_deref)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
bool force_deref)
|
bool force_deref;
|
||||||
{
|
{
|
||||||
CellUse *parentUse;
|
CellUse *parentUse;
|
||||||
|
|
||||||
|
|
@ -483,9 +373,9 @@ cmdFlushCell(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CmdParseLayers(
|
CmdParseLayers(s, mask)
|
||||||
char *s,
|
char *s;
|
||||||
TileTypeBitMask *mask)
|
TileTypeBitMask *mask;
|
||||||
{
|
{
|
||||||
TileTypeBitMask newmask, tempmask;
|
TileTypeBitMask newmask, tempmask;
|
||||||
char *dp, c;
|
char *dp, c;
|
||||||
|
|
@ -504,23 +394,23 @@ CmdParseLayers(
|
||||||
#define LN_CONNECT 5
|
#define LN_CONNECT 5
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
const char *layer_name;
|
char *layer_name;
|
||||||
int layer_value;
|
int layer_value;
|
||||||
}
|
}
|
||||||
const special[] =
|
special[] =
|
||||||
{
|
{
|
||||||
{"$", LN_DOLLAR},
|
"$", LN_DOLLAR,
|
||||||
{"*", LN_ALL},
|
"*", LN_ALL,
|
||||||
{"errors", LN_ERRORS},
|
"errors", LN_ERRORS,
|
||||||
{"labels", LN_LABELS},
|
"labels", LN_LABELS,
|
||||||
{"subcell", LN_CELL},
|
"subcell", LN_CELL,
|
||||||
{"connect", LN_CONNECT},
|
"connect", LN_CONNECT,
|
||||||
{0},
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
TTMaskZero(mask);
|
TTMaskZero(mask);
|
||||||
while ((c = *s++))
|
while (c = *s++)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
|
@ -547,7 +437,7 @@ CmdParseLayers(
|
||||||
type = DBTechNameTypes(name, &newmask);
|
type = DBTechNameTypes(name, &newmask);
|
||||||
if (type == -2)
|
if (type == -2)
|
||||||
{
|
{
|
||||||
which = LookupStruct(name, (const LookupTable *) special, sizeof special[0]);
|
which = LookupStruct(name, (LookupTable *) special, sizeof special[0]);
|
||||||
if (which >= 0)
|
if (which >= 0)
|
||||||
{
|
{
|
||||||
switch (special[which].layer_value)
|
switch (special[which].layer_value)
|
||||||
|
|
@ -657,8 +547,8 @@ printTypes:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TileType
|
TileType
|
||||||
cmdMaskToType(
|
cmdMaskToType(mask)
|
||||||
TileTypeBitMask *mask)
|
TileTypeBitMask *mask;
|
||||||
{
|
{
|
||||||
TileType type, t;
|
TileType type, t;
|
||||||
|
|
||||||
|
|
@ -703,16 +593,16 @@ cmdMaskToType(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmdSaveCell(
|
cmdSaveCell(cellDef, newName, noninteractive, tryRename)
|
||||||
CellDef *cellDef, /* Pointer to def of cell to be saved */
|
CellDef *cellDef; /* Pointer to def of cell to be saved */
|
||||||
char *newName, /* Pointer to name of file in which cell is to be
|
char *newName; /* Pointer to name of file in which cell is to be
|
||||||
* saved. May be NULL, in which case the name from
|
* saved. May be NULL, in which case the name from
|
||||||
* the CellDef is taken.
|
* the CellDef is taken.
|
||||||
*/
|
*/
|
||||||
bool noninteractive,/* If true, try hard but don't ask the user
|
bool noninteractive;/* If true, try hard but don't ask the user
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
bool tryRename) /* We should rename the cell to the name of the
|
bool tryRename; /* We should rename the cell to the name of the
|
||||||
* place where it was saved.
|
* place where it was saved.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -761,16 +651,13 @@ cmdSaveCell(
|
||||||
if (!tryRename || (fileName == NULL) || (strcmp(cellDef->cd_name, fileName) == 0))
|
if (!tryRename || (fileName == NULL) || (strcmp(cellDef->cd_name, fileName) == 0))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Rename the cell, unless fileName is a .tcl file (scripted output) */
|
/* Rename the cell */
|
||||||
if ((strlen(fileName) <= 4) || strcmp(fileName + strlen(fileName) - 4, ".tcl"))
|
if (!DBCellRenameDef(cellDef, fileName))
|
||||||
{
|
{
|
||||||
if (!DBCellRenameDef(cellDef, fileName))
|
/* This should never happen */
|
||||||
{
|
TxError("Magic error: there is already a cell named \"%s\"\n",
|
||||||
/* This should never happen */
|
|
||||||
TxError("Magic error: there is already a cell named \"%s\"\n",
|
|
||||||
fileName);
|
fileName);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EditCellUse && (cellDef == EditCellUse->cu_def))
|
if (EditCellUse && (cellDef == EditCellUse->cu_def))
|
||||||
|
|
@ -825,13 +712,13 @@ cleanup:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
cmdCheckNewName(
|
cmdCheckNewName(def, newName, tryRename, noninteractive)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
char *newName,
|
char *newName;
|
||||||
bool tryRename,
|
bool tryRename;
|
||||||
bool noninteractive)
|
bool noninteractive;
|
||||||
{
|
{
|
||||||
static const char * const yesno[] = { "no", "yes", 0 };
|
static char *yesno[] = { "no", "yes", 0 };
|
||||||
char *filename;
|
char *filename;
|
||||||
char *prompt;
|
char *prompt;
|
||||||
char *returnname;
|
char *returnname;
|
||||||
|
|
@ -869,7 +756,7 @@ again:
|
||||||
|
|
||||||
if (strcmp(returnname, def->cd_name) != 0)
|
if (strcmp(returnname, def->cd_name) != 0)
|
||||||
{
|
{
|
||||||
if ((f = PaOpen(returnname, "r", DBSuffix, ".", (char *) NULL, &filename)))
|
if (f = PaOpen(returnname, "r", DBSuffix, ".", (char *) NULL, &filename))
|
||||||
{
|
{
|
||||||
(void) fclose(f);
|
(void) fclose(f);
|
||||||
if (noninteractive) {
|
if (noninteractive) {
|
||||||
|
|
@ -916,10 +803,10 @@ again:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
nameEllipsis(
|
nameEllipsis(name, maxlen, prefix)
|
||||||
char *name,
|
char *name;
|
||||||
int maxlen,
|
int maxlen;
|
||||||
char **prefix)
|
char **prefix;
|
||||||
{
|
{
|
||||||
int l = strlen(name);
|
int l = strlen(name);
|
||||||
|
|
||||||
|
|
@ -959,9 +846,9 @@ nameEllipsis(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdSaveWindSet(
|
cmdSaveWindSet(window, def)
|
||||||
MagWindow *window,
|
MagWindow *window;
|
||||||
CellDef *def)
|
CellDef *def;
|
||||||
{
|
{
|
||||||
char caption[200];
|
char caption[200];
|
||||||
CellDef *rootDef;
|
CellDef *rootDef;
|
||||||
|
|
@ -1013,13 +900,13 @@ static CellDef *newRootDef; /* Pointer to root def of window in which
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdSetWindCaption(
|
CmdSetWindCaption(newEditUse, rootDef)
|
||||||
CellUse *newEditUse, /* Pointer to new edit cell use */
|
CellUse *newEditUse; /* Pointer to new edit cell use */
|
||||||
CellDef *rootDef) /* Root cell def of the window in which the
|
CellDef *rootDef; /* Root cell def of the window in which the
|
||||||
* edit cell was selected.
|
* edit cell was selected.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int cmdWindSet(MagWindow *window, ClientData clientData); /* UNUSED */
|
int cmdWindSet();
|
||||||
|
|
||||||
newEditDef = (newEditUse) ? newEditUse->cu_def : NULL;
|
newEditDef = (newEditUse) ? newEditUse->cu_def : NULL;
|
||||||
newRootDef = rootDef;
|
newRootDef = rootDef;
|
||||||
|
|
@ -1053,11 +940,9 @@ CmdSetWindCaption(
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
int
|
int
|
||||||
cmdWindSet(
|
cmdWindSet(window)
|
||||||
MagWindow *window,
|
MagWindow *window;
|
||||||
ClientData clientData) /* UNUSED */
|
|
||||||
{
|
{
|
||||||
char caption[200];
|
char caption[200];
|
||||||
CellDef *wDef;
|
CellDef *wDef;
|
||||||
|
|
@ -1113,9 +998,9 @@ cmdWindSet(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MagWindow *
|
MagWindow *
|
||||||
CmdGetRootPoint(
|
CmdGetRootPoint(point, rect)
|
||||||
Point *point,
|
Point *point;
|
||||||
Rect *rect)
|
Rect *rect;
|
||||||
{
|
{
|
||||||
MagWindow *window;
|
MagWindow *window;
|
||||||
|
|
||||||
|
|
@ -1148,9 +1033,9 @@ CmdGetRootPoint(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MagWindow *
|
MagWindow *
|
||||||
CmdGetEditPoint(
|
CmdGetEditPoint(point, rect)
|
||||||
Point *point,
|
Point *point;
|
||||||
Rect *rect)
|
Rect *rect;
|
||||||
{
|
{
|
||||||
MagWindow *window;
|
MagWindow *window;
|
||||||
Rect rootRect;
|
Rect rootRect;
|
||||||
|
|
@ -1185,11 +1070,11 @@ CmdGetEditPoint(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CmdWarnWrite(void)
|
CmdWarnWrite()
|
||||||
{
|
{
|
||||||
int count, code;
|
int count, code;
|
||||||
int cmdWarnWriteFunc(CellDef *cellDef, int *pcount);
|
int cmdWarnWriteFunc();
|
||||||
static const char * const yesno[] = { "no", "yes", 0 };
|
static char *yesno[] = { "no", "yes", 0 };
|
||||||
char *prompt;
|
char *prompt;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
@ -1207,9 +1092,9 @@ CmdWarnWrite(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdWarnWriteFunc(
|
cmdWarnWriteFunc(cellDef, pcount)
|
||||||
CellDef *cellDef,
|
CellDef *cellDef;
|
||||||
int *pcount)
|
int *pcount;
|
||||||
{
|
{
|
||||||
if ((cellDef->cd_flags & CDINTERNAL) == 0)
|
if ((cellDef->cd_flags & CDINTERNAL) == 0)
|
||||||
(*pcount)++;
|
(*pcount)++;
|
||||||
|
|
@ -1233,27 +1118,27 @@ cmdWarnWriteFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmdExpandOneLevel(
|
cmdExpandOneLevel(cu, bitmask, expand)
|
||||||
CellUse *cu,
|
CellUse *cu;
|
||||||
int bitmask,
|
int bitmask;
|
||||||
bool expand)
|
bool expand;
|
||||||
{
|
{
|
||||||
extern int cmdExpand1func(CellUse *cu, ClientData bitmask);
|
extern int cmdExpand1func();
|
||||||
|
|
||||||
/* first, expand this cell use */
|
/* first, expand this cell use */
|
||||||
DBExpand(cu, bitmask, expand ? DB_EXPAND : DB_UNEXPAND);
|
DBExpand(cu, bitmask, expand);
|
||||||
|
|
||||||
/* now, unexpand its direct children (ONE LEVEL ONLY) */
|
/* now, unexpand its direct children (ONE LEVEL ONLY) */
|
||||||
if (expand)
|
if (expand)
|
||||||
(void) DBCellEnum(cu->cu_def, cmdExpand1func, INT2CD(bitmask));
|
(void) DBCellEnum(cu->cu_def, cmdExpand1func, (ClientData) bitmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdExpand1func(
|
cmdExpand1func(cu, bitmask)
|
||||||
CellUse *cu,
|
CellUse *cu;
|
||||||
ClientData bitmask)
|
ClientData bitmask;
|
||||||
{
|
{
|
||||||
DBExpand(cu, (int)CD2INT(bitmask), DB_UNEXPAND);
|
DBExpand(cu, (int) bitmask, FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1281,13 +1166,13 @@ Transform *cmdSelTrans; /* Shared between CmdGetSelectedCell and
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CellUse *
|
CellUse *
|
||||||
CmdGetSelectedCell(
|
CmdGetSelectedCell(pTrans)
|
||||||
Transform *pTrans) /* If non-NULL, transform from selected
|
Transform *pTrans; /* If non-NULL, transform from selected
|
||||||
* cell to root coords is stored here.
|
* cell to root coords is stored here.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
CellUse *result = NULL;
|
CellUse *result = NULL;
|
||||||
int cmdGetSelFunc(CellUse *selUse, CellUse *realUse, Transform *transform, CellUse **pResult); /* Forward declaration. */
|
int cmdGetSelFunc(); /* Forward declaration. */
|
||||||
|
|
||||||
cmdSelTrans = pTrans;
|
cmdSelTrans = pTrans;
|
||||||
(void) SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL,
|
(void) SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL,
|
||||||
|
|
@ -1297,11 +1182,11 @@ CmdGetSelectedCell(
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
cmdGetSelFunc(
|
cmdGetSelFunc(selUse, realUse, transform, pResult)
|
||||||
CellUse *selUse, /* Not used. */
|
CellUse *selUse; /* Not used. */
|
||||||
CellUse *realUse, /* The first selected use. */
|
CellUse *realUse; /* The first selected use. */
|
||||||
Transform *transform, /* Transform from coords of realUse to root. */
|
Transform *transform; /* Transform from coords of realUse to root. */
|
||||||
CellUse **pResult) /* Store realUse here. */
|
CellUse **pResult; /* Store realUse here. */
|
||||||
{
|
{
|
||||||
*pResult = realUse;
|
*pResult = realUse;
|
||||||
if (cmdSelTrans != NULL)
|
if (cmdSelTrans != NULL)
|
||||||
|
|
@ -1309,17 +1194,6 @@ cmdGetSelFunc(
|
||||||
return 1; /* Skip any other selected cells. */
|
return 1; /* Skip any other selected cells. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* The Open Group, Sep 2006, Austin/317 deprecated isascii(),
|
|
||||||
* Apparently it cannot be used portably in a localized application.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
magic_isascii(int c)
|
|
||||||
{
|
|
||||||
return (c & ~0x7f) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
@ -1340,10 +1214,10 @@ magic_isascii(int c)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CmdIllegalChars(
|
CmdIllegalChars(string, illegal, msg)
|
||||||
char *string, /* String to check for illegal chars. */
|
char *string; /* String to check for illegal chars. */
|
||||||
char *illegal, /* String containing illegal chars. */
|
char *illegal; /* String containing illegal chars. */
|
||||||
char *msg) /* String identifying what string is
|
char *msg; /* String identifying what string is
|
||||||
* supposed to represent, for ease in
|
* supposed to represent, for ease in
|
||||||
* printing error messages.
|
* printing error messages.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1352,7 +1226,7 @@ CmdIllegalChars(
|
||||||
|
|
||||||
for (p = string; *p != 0; p++)
|
for (p = string; *p != 0; p++)
|
||||||
{
|
{
|
||||||
if (!magic_isascii(*p)) goto error;
|
if (!isascii(*p)) goto error;
|
||||||
if (iscntrl(*p)) goto error;
|
if (iscntrl(*p)) goto error;
|
||||||
for (bad = illegal; *bad != 0; bad++)
|
for (bad = illegal; *bad != 0; bad++)
|
||||||
{
|
{
|
||||||
|
|
@ -1361,7 +1235,7 @@ CmdIllegalChars(
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (!magic_isascii(*p) || iscntrl(*p))
|
if (!isascii(*p) || iscntrl(*p))
|
||||||
{
|
{
|
||||||
TxError("%s contains illegal control character 0x%x\n",
|
TxError("%s contains illegal control character 0x%x\n",
|
||||||
msg, *p);
|
msg, *p);
|
||||||
|
|
|
||||||
607
commands/CmdTZ.c
607
commands/CmdTZ.c
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdTZ.c,v 1.8 2010/06/24 12:37:15 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdTZ.c,v 1.8 2010/06/24 12:37:15 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -57,13 +57,13 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
#include "yacr.h"
|
#include "yacr.h"
|
||||||
#endif /* LLNL */
|
#endif /* LLNL */
|
||||||
|
|
||||||
|
extern void DisplayWindow();
|
||||||
|
|
||||||
/* Trivial function that returns 1 if called */
|
/* Trivial function that returns 1 if called */
|
||||||
|
|
||||||
int
|
int
|
||||||
existFunc(
|
existFunc(tile)
|
||||||
Tile *tile, /* (unused) */
|
Tile *tile;
|
||||||
TileType dinfo, /* (unused) */
|
|
||||||
ClientData clientdata) /* (unused) */
|
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -82,9 +82,9 @@ existFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
checkForPaintFunc(
|
checkForPaintFunc(cellDef, arg)
|
||||||
CellDef *cellDef,
|
CellDef *cellDef;
|
||||||
ClientData arg)
|
ClientData arg;
|
||||||
{
|
{
|
||||||
int numPlanes = *((int *)arg);
|
int numPlanes = *((int *)arg);
|
||||||
int pNum, result;
|
int pNum, result;
|
||||||
|
|
@ -121,7 +121,7 @@ checkForPaintFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CmdCheckForPaintFunc(void)
|
CmdCheckForPaintFunc()
|
||||||
{
|
{
|
||||||
if (DBCellSrDefs(0, checkForPaintFunc, (ClientData)&DBNumPlanes))
|
if (DBCellSrDefs(0, checkForPaintFunc, (ClientData)&DBNumPlanes))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -165,21 +165,21 @@ CmdCheckForPaintFunc(void)
|
||||||
#define TECH_REVERT 11
|
#define TECH_REVERT 11
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdTech(
|
CmdTech(w, cmd)
|
||||||
MagWindow *w, /* Window in which command was invoked. */
|
MagWindow *w; /* Window in which command was invoked. */
|
||||||
TxCommand *cmd) /* Info about command options. */
|
TxCommand *cmd; /* Info about command options. */
|
||||||
{
|
{
|
||||||
int option, action, i, locargc;
|
int option, action, i, locargc;
|
||||||
const char * const *msg;
|
char **msg;
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_Obj *lobj;
|
Tcl_Obj *lobj;
|
||||||
#endif
|
#endif
|
||||||
bool noprompt = FALSE;
|
bool noprompt = FALSE;
|
||||||
|
|
||||||
static const char * const actionNames[] =
|
static char *actionNames[] =
|
||||||
{ "no", "yes", 0 };
|
{ "no", "yes", 0 };
|
||||||
|
|
||||||
static const char * const cmdTechOption[] =
|
static char *cmdTechOption[] =
|
||||||
{
|
{
|
||||||
"load filename [-noprompt][-[no]override]\n\
|
"load filename [-noprompt][-[no]override]\n\
|
||||||
Load a new technology",
|
Load a new technology",
|
||||||
|
|
@ -218,7 +218,7 @@ CmdTech(
|
||||||
Tcl_SetResult(magicinterp, DBTechName, NULL);
|
Tcl_SetResult(magicinterp, DBTechName, NULL);
|
||||||
break;
|
break;
|
||||||
case TECH_FILE:
|
case TECH_FILE:
|
||||||
Tcl_SetResult(magicinterp, (char *)TechFileName, NULL);
|
Tcl_SetResult(magicinterp, TechFileName, NULL);
|
||||||
break;
|
break;
|
||||||
case TECH_VERSION:
|
case TECH_VERSION:
|
||||||
Tcl_SetResult(magicinterp, DBTechVersion, NULL);
|
Tcl_SetResult(magicinterp, DBTechVersion, NULL);
|
||||||
|
|
@ -415,12 +415,10 @@ CmdTech(
|
||||||
|
|
||||||
for (ctype = TT_TECHDEPBASE; ctype < DBNumUserLayers; ctype++)
|
for (ctype = TT_TECHDEPBASE; ctype < DBNumUserLayers; ctype++)
|
||||||
if (DBIsContact(ctype))
|
if (DBIsContact(ctype))
|
||||||
{
|
|
||||||
if (TTMaskHasType(&DBActiveLayerBits, ctype))
|
if (TTMaskHasType(&DBActiveLayerBits, ctype))
|
||||||
DBUnlockContact(ctype);
|
DBUnlockContact(ctype);
|
||||||
else
|
else
|
||||||
DBLockContact(ctype);
|
DBLockContact(ctype);
|
||||||
}
|
|
||||||
|
|
||||||
for (ctype = DBNumUserLayers; ctype < DBNumTypes; ctype++)
|
for (ctype = DBNumUserLayers; ctype < DBNumTypes; ctype++)
|
||||||
{
|
{
|
||||||
|
|
@ -455,18 +453,15 @@ CmdTech(
|
||||||
}
|
}
|
||||||
if (!strncmp(cmd->tx_argv[2], "width", 5))
|
if (!strncmp(cmd->tx_argv[2], "width", 5))
|
||||||
{
|
{
|
||||||
char *techwidth;
|
|
||||||
tresult = DRCGetDefaultLayerWidth(t1);
|
tresult = DRCGetDefaultLayerWidth(t1);
|
||||||
techwidth = DBWPrintValue(tresult, w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(techwidth, -1));
|
Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(tresult));
|
||||||
#else
|
#else
|
||||||
TxPrintf("Minimum width is %s\n", techwidth);
|
TxPrintf("Minimum width is %d\n", tresult);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (!strncmp(cmd->tx_argv[2], "spac", 4))
|
else if (!strncmp(cmd->tx_argv[2], "spac", 4))
|
||||||
{
|
{
|
||||||
char *techspace;
|
|
||||||
if (cmd->tx_argc >= 5)
|
if (cmd->tx_argc >= 5)
|
||||||
{
|
{
|
||||||
t2 = DBTechNoisyNameType(cmd->tx_argv[4]);
|
t2 = DBTechNoisyNameType(cmd->tx_argv[4]);
|
||||||
|
|
@ -478,16 +473,14 @@ CmdTech(
|
||||||
else
|
else
|
||||||
t2 = t1;
|
t2 = t1;
|
||||||
tresult = DRCGetDefaultLayerSpacing(t1, t2);
|
tresult = DRCGetDefaultLayerSpacing(t1, t2);
|
||||||
techspace = DBWPrintValue(tresult, w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(techspace, -1));
|
Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(tresult));
|
||||||
#else
|
#else
|
||||||
TxPrintf("Minimum spacing is %s\n", techspace);
|
TxPrintf("Minimum spacing is %d\n", tresult);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (!strncmp(cmd->tx_argv[2], "surr", 4))
|
else if (!strncmp(cmd->tx_argv[2], "surr", 4))
|
||||||
{
|
{
|
||||||
char *techsurround;
|
|
||||||
if (cmd->tx_argc >= 5)
|
if (cmd->tx_argc >= 5)
|
||||||
{
|
{
|
||||||
t2 = DBTechNoisyNameType(cmd->tx_argv[4]);
|
t2 = DBTechNoisyNameType(cmd->tx_argv[4]);
|
||||||
|
|
@ -503,17 +496,14 @@ CmdTech(
|
||||||
}
|
}
|
||||||
|
|
||||||
tresult = DRCGetDefaultLayerSurround(t1, t2);
|
tresult = DRCGetDefaultLayerSurround(t1, t2);
|
||||||
techsurround = DBWPrintValue(tresult, w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(techsurround, -1));
|
Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(tresult));
|
||||||
#else
|
#else
|
||||||
TxPrintf("Minimum surround is %s\n", techsurround);
|
TxPrintf("Minimum surround is %d\n", tresult);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (!strncmp(cmd->tx_argv[2], "direc", 5))
|
else if (!strncmp(cmd->tx_argv[2], "direc", 5))
|
||||||
{
|
{
|
||||||
char *techdirec;
|
|
||||||
|
|
||||||
if (cmd->tx_argc >= 5)
|
if (cmd->tx_argc >= 5)
|
||||||
{
|
{
|
||||||
t2 = DBTechNoisyNameType(cmd->tx_argv[4]);
|
t2 = DBTechNoisyNameType(cmd->tx_argv[4]);
|
||||||
|
|
@ -529,11 +519,10 @@ CmdTech(
|
||||||
}
|
}
|
||||||
|
|
||||||
tresult = DRCGetDirectionalLayerSurround(t1, t2);
|
tresult = DRCGetDirectionalLayerSurround(t1, t2);
|
||||||
techdirec = DBWPrintValue(tresult, w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(techdirec, -1));
|
Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(tresult));
|
||||||
#else
|
#else
|
||||||
TxPrintf("Minimum surround (in one orientation) is %s\n", techdirec);
|
TxPrintf("Minimum surround (in one orientation) is %d\n", tresult);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -664,9 +653,9 @@ usage2:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdTool(
|
CmdTool(w, cmd)
|
||||||
MagWindow *w, /* Window in which command was invoked. */
|
MagWindow *w; /* Window in which command was invoked. */
|
||||||
TxCommand *cmd) /* Info about command options. */
|
TxCommand *cmd; /* Info about command options. */
|
||||||
{
|
{
|
||||||
if (cmd->tx_argc == 1)
|
if (cmd->tx_argc == 1)
|
||||||
{
|
{
|
||||||
|
|
@ -682,15 +671,6 @@ CmdTool(
|
||||||
|
|
||||||
if (strcmp(cmd->tx_argv[1], "info") == 0)
|
if (strcmp(cmd->tx_argv[1], "info") == 0)
|
||||||
DBWPrintButtonDoc();
|
DBWPrintButtonDoc();
|
||||||
else if (strcmp(cmd->tx_argv[1], "type") == 0)
|
|
||||||
{
|
|
||||||
char *toolType = DBWGetButtonHandler();
|
|
||||||
#ifdef MAGIC_WRAPPER
|
|
||||||
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj(toolType, -1));
|
|
||||||
#else
|
|
||||||
TxPrintf("Current tool is \"%s\".\n", toolType);
|
|
||||||
#endif /* MAGIC_WRAPPER */
|
|
||||||
}
|
|
||||||
else (void) DBWChangeButtonHandler(cmd->tx_argv[1]);
|
else (void) DBWChangeButtonHandler(cmd->tx_argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -702,62 +682,32 @@ CmdTool(
|
||||||
* Implement the "unexpand" command.
|
* Implement the "unexpand" command.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* unexpand [selection|surround|overlap|all]
|
* unexpand
|
||||||
*
|
|
||||||
* "selection" unexpands (hides) cells in the selection. All
|
|
||||||
* other options unexpand cells in the layout. "all" unexpands
|
|
||||||
* all cells in the layout. "surround" unexpannds cells which
|
|
||||||
* the cursor box surrounds completely, and "overlap" unexpands
|
|
||||||
* cells which the cursor box overlaps.
|
|
||||||
*
|
|
||||||
* For backwards compatibility:
|
|
||||||
* "unexpand" alone implements "unexpand surround".
|
|
||||||
*
|
|
||||||
* Also see: CmdExpand
|
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* None.
|
* None.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* Changes the expansion state of cells.
|
* Unexpands all cells under the box that don't completely
|
||||||
|
* contain the box.
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UNEXPAND_SELECTION 0
|
|
||||||
#define UNEXPAND_SURROUND 1
|
|
||||||
#define UNEXPAND_OVERLAP 2
|
|
||||||
#define UNEXPAND_ALL 3
|
|
||||||
#define UNEXPAND_HELP 4
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdUnexpand(
|
CmdUnexpand(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int windowMask, boxMask, option;
|
int windowMask, boxMask;
|
||||||
const char * const *msg;
|
|
||||||
Rect rootRect;
|
Rect rootRect;
|
||||||
|
int cmdUnexpandFunc(); /* Forward reference. */
|
||||||
|
|
||||||
int cmdUnexpandFunc(CellUse *use, int windowMask); /* Forward reference. */
|
if (cmd->tx_argc != 1)
|
||||||
|
|
||||||
static const char * const cmdUnexpandOption[] = {
|
|
||||||
"selection expand cell instances in the selection",
|
|
||||||
"surround expand cell instances which the cursor box surrounds",
|
|
||||||
"overlap expand cell instances which the cursor box overlaps",
|
|
||||||
"all expand all cell instances",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
if (cmd->tx_argc > 1)
|
|
||||||
{
|
{
|
||||||
option = Lookup(cmd->tx_argv[1], cmdUnexpandOption);
|
TxError("Usage: %s\n", cmd->tx_argv[0]);
|
||||||
if (option < 0) option = UNEXPAND_HELP;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
option = UNEXPAND_SURROUND;
|
|
||||||
|
|
||||||
if (option == UNEXPAND_HELP) goto badusage;
|
|
||||||
|
|
||||||
windCheckOnlyWindow(&w, DBWclientID);
|
windCheckOnlyWindow(&w, DBWclientID);
|
||||||
if (w == (MagWindow *) NULL)
|
if (w == (MagWindow *) NULL)
|
||||||
|
|
@ -773,42 +723,8 @@ CmdUnexpand(
|
||||||
TxError("The box isn't in the same window as the cursor.\n");
|
TxError("The box isn't in the same window as the cursor.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
DBExpandAll(((CellUse *) w->w_surfaceID), &rootRect, windowMask,
|
||||||
switch (option)
|
FALSE, cmdUnexpandFunc, (ClientData)(pointertype) windowMask);
|
||||||
{
|
|
||||||
case UNEXPAND_SELECTION:
|
|
||||||
SelectExpand(windowMask, DB_UNEXPAND, (Rect *)NULL);
|
|
||||||
break;
|
|
||||||
case UNEXPAND_OVERLAP:
|
|
||||||
DBExpandAll(((CellUse *)w->w_surfaceID), &rootRect, windowMask,
|
|
||||||
DB_UNEXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_UNEXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
&rootRect);
|
|
||||||
break;
|
|
||||||
case UNEXPAND_SURROUND:
|
|
||||||
DBExpandAll(((CellUse *)w->w_surfaceID), &rootRect, windowMask,
|
|
||||||
DB_UNEXPAND | DB_EXPAND_SURROUND,
|
|
||||||
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_UNEXPAND | DB_EXPAND_SURROUND,
|
|
||||||
&rootRect);
|
|
||||||
break;
|
|
||||||
case UNEXPAND_ALL:
|
|
||||||
DBExpandAll(((CellUse *)w->w_surfaceID), &TiPlaneRect, windowMask,
|
|
||||||
DB_UNEXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
|
||||||
SelectExpand(windowMask,
|
|
||||||
DB_UNEXPAND | DB_EXPAND_OVERLAP,
|
|
||||||
(Rect *)NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
|
|
||||||
badusage:
|
|
||||||
for (msg = &(cmdUnexpandOption[0]); *msg != NULL; msg++)
|
|
||||||
TxPrintf(" %s\n", *msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called for each cell whose expansion status changed.
|
/* This function is called for each cell whose expansion status changed.
|
||||||
|
|
@ -817,9 +733,9 @@ badusage:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdUnexpandFunc(
|
cmdUnexpandFunc(use, windowMask)
|
||||||
CellUse *use, /* Use that was just unexpanded. */
|
CellUse *use; /* Use that was just unexpanded. */
|
||||||
int windowMask) /* Window where it was unexpanded. */
|
int windowMask; /* Window where it was unexpanded. */
|
||||||
{
|
{
|
||||||
if (use->cu_parent == NULL) return 0;
|
if (use->cu_parent == NULL) return 0;
|
||||||
DBWAreaChanged(use->cu_parent, &use->cu_bbox, windowMask,
|
DBWAreaChanged(use->cu_parent, &use->cu_bbox, windowMask,
|
||||||
|
|
@ -827,182 +743,6 @@ cmdUnexpandFunc(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* CmdUnits --
|
|
||||||
*
|
|
||||||
* Implement the "units" command.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* units [value] [print|noprint]
|
|
||||||
*
|
|
||||||
* where "value" may be one of "default", "internal", "lambda",
|
|
||||||
* "user" (equivalently "grid"), or "microns".
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Side effects:
|
|
||||||
* The global variable DBWUnits may be changed, which changes the
|
|
||||||
* behavior of magic when interpreting un-suffixed values or
|
|
||||||
* displaying values.
|
|
||||||
*
|
|
||||||
* Notes:
|
|
||||||
* The units behavior was previously dependent on what command was
|
|
||||||
* issued, with results usually being given in internal units, and
|
|
||||||
* with un-suffixed values following the snap behavior. Backwards-
|
|
||||||
* compatible behavior is used on startup or at any time by setting
|
|
||||||
* the units to "default". Otherwise, unit display follows the
|
|
||||||
* given "units" setting.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define UNITS_DEFAULT 0
|
|
||||||
#define UNITS_INTERNAL 1
|
|
||||||
#define UNITS_LAMBDA 2
|
|
||||||
#define UNITS_GRID 3
|
|
||||||
#define UNITS_USER 4
|
|
||||||
#define UNITS_MICRONS 5
|
|
||||||
#define UNITS_LIST 6
|
|
||||||
#define UNITS_PRINT 7
|
|
||||||
#define UNITS_NOPRINT 8
|
|
||||||
|
|
||||||
void
|
|
||||||
CmdUnits(
|
|
||||||
MagWindow *w,
|
|
||||||
TxCommand *cmd)
|
|
||||||
{
|
|
||||||
static const char * const names[] = { "default", "internal", "lambda",
|
|
||||||
"grid", "user", "microns", "list", "print", "noprint", 0 };
|
|
||||||
int idx, n = UNITS_LIST, n2, saveflag;
|
|
||||||
DBWclientRec *crec;
|
|
||||||
|
|
||||||
if (cmd->tx_argc >= 2)
|
|
||||||
{
|
|
||||||
n = Lookup(cmd->tx_argv[1], names);
|
|
||||||
if (n < 0)
|
|
||||||
{
|
|
||||||
TxPrintf("Usage: units [default | internal | lambda | microns"
|
|
||||||
" | user] [print]\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (DBWUnits != DBW_UNITS_DEFAULT)
|
|
||||||
saveflag = DBWUnits & DBW_UNITS_PRINT_FLAG;
|
|
||||||
else
|
|
||||||
saveflag = -1;
|
|
||||||
|
|
||||||
switch (n)
|
|
||||||
{
|
|
||||||
case UNITS_DEFAULT:
|
|
||||||
DBWUnits = DBW_UNITS_DEFAULT;
|
|
||||||
break;
|
|
||||||
case UNITS_INTERNAL:
|
|
||||||
DBWUnits = DBW_UNITS_INTERNAL;
|
|
||||||
break;
|
|
||||||
case UNITS_LAMBDA:
|
|
||||||
DBWUnits = DBW_UNITS_LAMBDA;
|
|
||||||
break;
|
|
||||||
case UNITS_USER:
|
|
||||||
case UNITS_GRID:
|
|
||||||
DBWUnits = DBW_UNITS_USER;
|
|
||||||
break;
|
|
||||||
case UNITS_MICRONS:
|
|
||||||
DBWUnits = DBW_UNITS_MICRONS;
|
|
||||||
break;
|
|
||||||
case UNITS_PRINT:
|
|
||||||
saveflag = DBW_UNITS_PRINT_FLAG;
|
|
||||||
break;
|
|
||||||
case UNITS_NOPRINT:
|
|
||||||
saveflag = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (n < 0)
|
|
||||||
{
|
|
||||||
TxError("Unrecognized units option %s\n.", cmd->tx_argv[1]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (n != UNITS_LIST)
|
|
||||||
{
|
|
||||||
if ((cmd->tx_argc == 3) && (n != UNITS_DEFAULT))
|
|
||||||
{
|
|
||||||
n2 = Lookup(cmd->tx_argv[2], names);
|
|
||||||
switch (n2)
|
|
||||||
{
|
|
||||||
case UNITS_PRINT:
|
|
||||||
DBWUnits |= DBW_UNITS_PRINT_FLAG;
|
|
||||||
break;
|
|
||||||
case UNITS_NOPRINT:
|
|
||||||
DBWUnits &= DBW_UNITS_TYPE_MASK;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
TxError("Unrecognized units option %s\n.", cmd->tx_argv[2]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((n != UNITS_DEFAULT) && (saveflag != -1))
|
|
||||||
{
|
|
||||||
/* Preserve the previous value of the print/noprint flag */
|
|
||||||
DBWUnits &= DBW_UNITS_TYPE_MASK;
|
|
||||||
DBWUnits |= saveflag;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DBWUnits == DBW_UNITS_DEFAULT)
|
|
||||||
idx = UNITS_DEFAULT;
|
|
||||||
else
|
|
||||||
switch (DBWUnits & DBW_UNITS_TYPE_MASK)
|
|
||||||
{
|
|
||||||
case DBW_UNITS_INTERNAL:
|
|
||||||
idx = UNITS_INTERNAL;
|
|
||||||
break;
|
|
||||||
case DBW_UNITS_LAMBDA:
|
|
||||||
idx = UNITS_LAMBDA;
|
|
||||||
break;
|
|
||||||
case DBW_UNITS_USER:
|
|
||||||
idx = UNITS_USER;
|
|
||||||
break;
|
|
||||||
case DBW_UNITS_MICRONS:
|
|
||||||
idx = UNITS_MICRONS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n == UNITS_LIST) /* list */
|
|
||||||
{
|
|
||||||
#ifdef MAGIC_WRAPPER
|
|
||||||
Tcl_Obj *tobj;
|
|
||||||
tobj = Tcl_NewListObj(0, NULL);
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj((char *)names[idx], -1));
|
|
||||||
if (idx != UNITS_DEFAULT)
|
|
||||||
{
|
|
||||||
if (DBWUnits & DBW_UNITS_PRINT_FLAG)
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj("print", 5));
|
|
||||||
else
|
|
||||||
Tcl_ListObjAppendElement(magicinterp, tobj,
|
|
||||||
Tcl_NewStringObj("noprint", 7));
|
|
||||||
}
|
|
||||||
Tcl_SetObjResult(magicinterp, tobj);
|
|
||||||
#else
|
|
||||||
TxPrintf("%s", names[idx]);
|
|
||||||
if (idx != UNITS_DEFAULT)
|
|
||||||
if (DBWUnits & DBW_UNITS_PRINT_FLAG)
|
|
||||||
TxPrintf(" print");
|
|
||||||
TxPrintf("\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (idx == UNITS_DEFAULT)
|
|
||||||
TxPrintf("Reported units follow the snap setting.\n");
|
|
||||||
else if (DBWUnits & DBW_UNITS_PRINT_FLAG)
|
|
||||||
TxPrintf("Values are reported as %s, along with the units.\n", names[idx]);
|
|
||||||
else
|
|
||||||
TxPrintf("Values are reported as %s\n", names[idx]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
@ -1024,9 +764,9 @@ CmdUnits(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdUpsidedown(
|
CmdUpsidedown(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
Transform trans;
|
Transform trans;
|
||||||
Rect rootBox, bbox;
|
Rect rootBox, bbox;
|
||||||
|
|
@ -1088,11 +828,9 @@ struct linked_id {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int
|
int cmdWhatPrintCell(tile, cxp)
|
||||||
cmdWhatPrintCell(
|
Tile *tile;
|
||||||
Tile *tile, /* (unused) */
|
TreeContext *cxp;
|
||||||
TileType dinfo, /* (unused) */
|
|
||||||
TreeContext *cxp)
|
|
||||||
{
|
{
|
||||||
struct linked_id **lid = (struct linked_id **)cxp->tc_filter->tf_arg;
|
struct linked_id **lid = (struct linked_id **)cxp->tc_filter->tf_arg;
|
||||||
struct linked_id *curlid = *lid;
|
struct linked_id *curlid = *lid;
|
||||||
|
|
@ -1144,10 +882,7 @@ static LabelStore *labelBlockTop, *labelEntry;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdFindWhatTileFunc(
|
cmdFindWhatTileFunc(Tile *tile, ClientData clientData)
|
||||||
Tile *tile,
|
|
||||||
TileType dinfo,
|
|
||||||
ClientData clientData)
|
|
||||||
{
|
{
|
||||||
struct linked_id **lid = (struct linked_id **)clientData;
|
struct linked_id **lid = (struct linked_id **)clientData;
|
||||||
SearchContext scx;
|
SearchContext scx;
|
||||||
|
|
@ -1158,7 +893,7 @@ cmdFindWhatTileFunc(
|
||||||
scx.scx_use = EditCellUse;
|
scx.scx_use = EditCellUse;
|
||||||
scx.scx_trans = GeoIdentityTransform;
|
scx.scx_trans = GeoIdentityTransform;
|
||||||
|
|
||||||
if (dinfo & TT_SIDE)
|
if (SplitSide(tile))
|
||||||
type = SplitRightType(tile);
|
type = SplitRightType(tile);
|
||||||
else
|
else
|
||||||
type = SplitLeftType(tile);
|
type = SplitLeftType(tile);
|
||||||
|
|
@ -1193,9 +928,9 @@ cmdFindWhatTileFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdWhat(
|
CmdWhat(w, cmd)
|
||||||
MagWindow *w, /* Window in which command was invoked. */
|
MagWindow *w; /* Window in which command was invoked. */
|
||||||
TxCommand *cmd) /* Information about the command. */
|
TxCommand *cmd; /* Information about the command. */
|
||||||
{
|
{
|
||||||
int i, locargc;
|
int i, locargc;
|
||||||
bool foundAny, editNull = FALSE;
|
bool foundAny, editNull = FALSE;
|
||||||
|
|
@ -1205,14 +940,11 @@ CmdWhat(
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_Obj *lobj, *paintobj, *paintcellobj, *celllistobj, *labelobj, *cellobj;
|
Tcl_Obj *lobj, *paintobj, *paintcellobj, *celllistobj, *labelobj, *cellobj;
|
||||||
extern int cmdWhatCellListFunc(CellUse *selUse, CellUse *realUse, Transform *transform, Tcl_Obj *newobj);
|
extern int cmdWhatCellListFunc();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int cmdWhatPaintFunc(Rect *rect, TileType type, TileTypeBitMask *mask);
|
extern int cmdWhatPaintFunc(), cmdWhatLabelFunc(), cmdWhatCellFunc();
|
||||||
extern int cmdWhatLabelFunc(LabelStore *entry, bool *foundAny);
|
extern int cmdWhatLabelPreFunc(), orderLabelFunc();
|
||||||
extern int cmdWhatCellFunc(CellUse *selUse, CellUse *realUse, Transform *transform, bool *foundAny);
|
|
||||||
extern int cmdWhatLabelPreFunc(Label *label, CellUse *cellUse, Transform *transform, bool *foundAny);
|
|
||||||
extern int orderLabelFunc(const void *, const void *); /* (LabelStore *one, LabelStore *two) */
|
|
||||||
|
|
||||||
locargc = cmd->tx_argc;
|
locargc = cmd->tx_argc;
|
||||||
|
|
||||||
|
|
@ -1249,7 +981,7 @@ CmdWhat(
|
||||||
if (EditCellUse == NULL)
|
if (EditCellUse == NULL)
|
||||||
{
|
{
|
||||||
editNull = TRUE;
|
editNull = TRUE;
|
||||||
EditCellUse = (CellUse *)w->w_surfaceID;
|
EditCellUse = w->w_surfaceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find all the selected paint and print out the layer names. */
|
/* Find all the selected paint and print out the layer names. */
|
||||||
|
|
@ -1356,13 +1088,11 @@ CmdWhat(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
while (lid != NULL)
|
||||||
while (lid != NULL)
|
{
|
||||||
{
|
freeMagic(lid);
|
||||||
freeMagic1(&mm1, lid);
|
|
||||||
lid = lid->lid_next;
|
lid = lid->lid_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (doListAll)
|
if (doListAll)
|
||||||
Tcl_ListObjAppendElement(magicinterp, paintobj,
|
Tcl_ListObjAppendElement(magicinterp, paintobj,
|
||||||
|
|
@ -1467,10 +1197,10 @@ CmdWhat(
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
int
|
int
|
||||||
cmdWhatPaintFunc(
|
cmdWhatPaintFunc(rect, type, mask)
|
||||||
Rect *rect, /* Not used. */
|
Rect *rect; /* Not used. */
|
||||||
TileType type, /* Type of this piece of paint. */
|
TileType type; /* Type of this piece of paint. */
|
||||||
TileTypeBitMask *mask) /* Place to OR in type's bit. */
|
TileTypeBitMask *mask; /* Place to OR in type's bit. */
|
||||||
{
|
{
|
||||||
if (type & TT_DIAGONAL)
|
if (type & TT_DIAGONAL)
|
||||||
type = (type & TT_SIDE) ? (type & TT_RIGHTMASK) >> 14 :
|
type = (type & TT_SIDE) ? (type & TT_RIGHTMASK) >> 14 :
|
||||||
|
|
@ -1485,11 +1215,11 @@ cmdWhatPaintFunc(
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
int
|
int
|
||||||
cmdWhatLabelPreFunc(
|
cmdWhatLabelPreFunc(label, cellUse, transform, foundAny)
|
||||||
Label *label, /* Label that's selected. */
|
Label *label; /* Label that's selected. */
|
||||||
CellUse *cellUse, /* Cell use containing label. */
|
CellUse *cellUse; /* Cell use containing label. */
|
||||||
Transform *transform, /* Not used. */
|
Transform *transform; /* Not used. */
|
||||||
bool *foundAny) /* Use to print extra stuff for the first
|
bool *foundAny; /* Use to print extra stuff for the first
|
||||||
* label found.
|
* label found.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -1529,9 +1259,9 @@ cmdWhatLabelPreFunc(
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdWhatLabelFunc(
|
cmdWhatLabelFunc(entry, foundAny)
|
||||||
LabelStore *entry, /* stored pointers to label info*/
|
LabelStore *entry; /* stored pointers to label info*/
|
||||||
bool *foundAny) /* Use to print extra stuff for the first
|
bool *foundAny; /* Use to print extra stuff for the first
|
||||||
* label found.
|
* label found.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
@ -1581,12 +1311,10 @@ cmdWhatLabelFunc(
|
||||||
/* they are sorted by label name, then cell name, then attached material */
|
/* they are sorted by label name, then cell name, then attached material */
|
||||||
/* that way all of identical names are grouped together */
|
/* that way all of identical names are grouped together */
|
||||||
int
|
int
|
||||||
orderLabelFunc(
|
orderLabelFunc(one, two)
|
||||||
const void *a, /* one of the labels being compared */
|
LabelStore *one; /* one of the labels being compared */
|
||||||
const void *b) /* the other label to compare with */
|
LabelStore *two; /* the other label to compare with */
|
||||||
{
|
{
|
||||||
LabelStore *one = (LabelStore *)a; /* qsort compar 1st */
|
|
||||||
LabelStore *two = (LabelStore *)b; /* qsort compar 2nd */
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((i = strcmp(one->lab_text, two->lab_text)) != 0)
|
if ((i = strcmp(one->lab_text, two->lab_text)) != 0)
|
||||||
|
|
@ -1605,16 +1333,16 @@ orderLabelFunc(
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
int
|
int
|
||||||
cmdWhatCellFunc(
|
cmdWhatCellFunc(selUse, realUse, transform, foundAny)
|
||||||
CellUse *selUse, /* Not used. */
|
CellUse *selUse; /* Not used. */
|
||||||
CellUse *realUse, /* Selected cell use. */
|
CellUse *realUse; /* Selected cell use. */
|
||||||
Transform *transform, /* Not used. */
|
Transform *transform; /* Not used. */
|
||||||
bool *foundAny) /* Used to print extra stuff for the first
|
bool *foundAny; /* Used to print extra stuff for the first
|
||||||
* use found.
|
* use found.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
/* Forward reference */
|
/* Forward reference */
|
||||||
char *dbGetUseName(CellUse *celluse);
|
char *dbGetUseName();
|
||||||
|
|
||||||
if (!*foundAny)
|
if (!*foundAny)
|
||||||
{
|
{
|
||||||
|
|
@ -1631,15 +1359,15 @@ cmdWhatCellFunc(
|
||||||
/* Same search function as above, but appends use names to a Tcl list */
|
/* Same search function as above, but appends use names to a Tcl list */
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdWhatCellListFunc(
|
cmdWhatCellListFunc(selUse, realUse, transform, newobj)
|
||||||
CellUse *selUse, /* Not used. */
|
CellUse *selUse; /* Not used. */
|
||||||
CellUse *realUse, /* Selected cell use. */
|
CellUse *realUse; /* Selected cell use. */
|
||||||
Transform *transform, /* Not used. */
|
Transform *transform; /* Not used. */
|
||||||
Tcl_Obj *newobj) /* Tcl list object holding use names */
|
Tcl_Obj *newobj; /* Tcl list object holding use names */
|
||||||
{
|
{
|
||||||
Tcl_Obj *tuple;
|
Tcl_Obj *tuple;
|
||||||
/* Forward reference */
|
/* Forward reference */
|
||||||
char *dbGetUseName(CellUse *celluse);
|
char *dbGetUseName();
|
||||||
|
|
||||||
tuple = Tcl_NewListObj(0, NULL);
|
tuple = Tcl_NewListObj(0, NULL);
|
||||||
Tcl_ListObjAppendElement(magicinterp, tuple,
|
Tcl_ListObjAppendElement(magicinterp, tuple,
|
||||||
|
|
@ -1686,23 +1414,20 @@ cmdWhatCellListFunc(
|
||||||
#define SEGMENT 11
|
#define SEGMENT 11
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdWire(
|
CmdWire(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int option, locargc;
|
int option, locargc;
|
||||||
const char * const *msg;
|
char **msg, *lastargv;
|
||||||
char *lastargv;
|
|
||||||
TileType type;
|
TileType type;
|
||||||
int width;
|
int width;
|
||||||
Point point, rootPoint;
|
|
||||||
bool needCoord = FALSE;
|
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_Obj *lobj;
|
Tcl_Obj *lobj;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char * const cmdWireOption[] =
|
static char *cmdWireOption[] =
|
||||||
{
|
{
|
||||||
"decrement layer|width decrement the wire layer or width",
|
"decrement layer|width decrement the wire layer or width",
|
||||||
"help print this help information",
|
"help print this help information",
|
||||||
|
|
@ -1774,11 +1499,11 @@ CmdWire(
|
||||||
int value = 1;
|
int value = 1;
|
||||||
if (cmd->tx_argc == 4)
|
if (cmd->tx_argc == 4)
|
||||||
value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
||||||
WirePickType(WireType, (Point *)NULL, WireWidth - value);
|
WirePickType(WireType, WireWidth - value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto badargs;
|
goto badargs;
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case INCREMENT:
|
case INCREMENT:
|
||||||
if (cmd->tx_argc != 3 && cmd->tx_argc != 4)
|
if (cmd->tx_argc != 3 && cmd->tx_argc != 4)
|
||||||
|
|
@ -1814,11 +1539,11 @@ CmdWire(
|
||||||
int value = 1;
|
int value = 1;
|
||||||
if (cmd->tx_argc == 4)
|
if (cmd->tx_argc == 4)
|
||||||
value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
value = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
||||||
WirePickType(WireType, (Point *)NULL, WireWidth + value);
|
WirePickType(WireType, WireWidth + value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto badargs;
|
goto badargs;
|
||||||
break;
|
return;
|
||||||
|
|
||||||
|
|
||||||
case HELP:
|
case HELP:
|
||||||
|
|
@ -1828,41 +1553,15 @@ CmdWire(
|
||||||
{
|
{
|
||||||
TxPrintf(" %s\n", *msg);
|
TxPrintf(" %s\n", *msg);
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case HORIZONTAL:
|
case HORIZONTAL:
|
||||||
if ((cmd->tx_argc > 2) && strcmp(cmd->tx_argv[2], "to") == 0)
|
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_HORIZONTAL);
|
||||||
{
|
return;
|
||||||
if (cmd->tx_argc != 5)
|
|
||||||
goto badargs;
|
|
||||||
point.p_x = cmdParseCoord(w, cmd->tx_argv[3], FALSE, TRUE);
|
|
||||||
point.p_y = cmdParseCoord(w, cmd->tx_argv[4], FALSE, FALSE);
|
|
||||||
GeoTransPoint(&EditToRootTransform, &point, &rootPoint);
|
|
||||||
WireAddLeg((Rect *)NULL, &rootPoint, WIRE_HORIZONTAL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_HORIZONTAL);
|
|
||||||
needCoord = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LEG:
|
case LEG:
|
||||||
if ((cmd->tx_argc > 2) && strcmp(cmd->tx_argv[2], "to") == 0)
|
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_CHOOSE);
|
||||||
{
|
return;
|
||||||
if (cmd->tx_argc != 5)
|
|
||||||
goto badargs;
|
|
||||||
point.p_x = cmdParseCoord(w, cmd->tx_argv[3], FALSE, TRUE);
|
|
||||||
point.p_y = cmdParseCoord(w, cmd->tx_argv[4], FALSE, FALSE);
|
|
||||||
GeoTransPoint(&EditToRootTransform, &point, &rootPoint);
|
|
||||||
WireAddLeg((Rect *)NULL, &rootPoint, WIRE_CHOOSE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WireAddLeg((Rect *)NULL, (Point *)NULL, WIRE_CHOOSE);
|
|
||||||
needCoord = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHOW:
|
case SHOW:
|
||||||
WireShowLeg();
|
WireShowLeg();
|
||||||
|
|
@ -1896,17 +1595,7 @@ CmdWire(
|
||||||
|
|
||||||
case TYPE:
|
case TYPE:
|
||||||
if (locargc == 2)
|
if (locargc == 2)
|
||||||
{
|
WirePickType(-1, 0);
|
||||||
WirePickType(-1, (Point *)NULL, 0);
|
|
||||||
needCoord = TRUE;
|
|
||||||
}
|
|
||||||
else if ((locargc == 5) && !strcmp(cmd->tx_argv[2], "at"))
|
|
||||||
{
|
|
||||||
point.p_x = cmdParseCoord(w, cmd->tx_argv[3], FALSE, TRUE);
|
|
||||||
point.p_y = cmdParseCoord(w, cmd->tx_argv[4], FALSE, FALSE);
|
|
||||||
GeoTransPoint(&EditToRootTransform, &point, &rootPoint);
|
|
||||||
WirePickType(-1, &rootPoint, 0);
|
|
||||||
}
|
|
||||||
else if (locargc != 3 && locargc != 4)
|
else if (locargc != 3 && locargc != 4)
|
||||||
{
|
{
|
||||||
badargs:
|
badargs:
|
||||||
|
|
@ -1937,7 +1626,7 @@ CmdWire(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
width = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
width = cmdParseCoord(w, cmd->tx_argv[3], TRUE, TRUE);
|
||||||
WirePickType(type, (Point *)NULL, width);
|
WirePickType(type, width);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1945,52 +1634,35 @@ CmdWire(
|
||||||
case VALUES:
|
case VALUES:
|
||||||
if (locargc == 2)
|
if (locargc == 2)
|
||||||
{
|
{
|
||||||
char *wdisp;
|
|
||||||
width = WireGetWidth();
|
width = WireGetWidth();
|
||||||
type = WireGetType();
|
type = WireGetType();
|
||||||
wdisp = DBWPrintValue(width, w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
lobj = Tcl_NewListObj(0, NULL);
|
lobj = Tcl_NewListObj(0, NULL);
|
||||||
Tcl_ListObjAppendElement(magicinterp, lobj,
|
Tcl_ListObjAppendElement(magicinterp, lobj,
|
||||||
Tcl_NewStringObj(DBTypeLongNameTbl[type], -1));
|
Tcl_NewIntObj(width));
|
||||||
Tcl_ListObjAppendElement(magicinterp, lobj,
|
Tcl_ListObjAppendElement(magicinterp, lobj,
|
||||||
Tcl_NewStringObj(wdisp, -1));
|
Tcl_NewStringObj(DBTypeLongNameTbl[type], -1));
|
||||||
Tcl_SetObjResult(magicinterp, lobj);
|
Tcl_SetObjResult(magicinterp, lobj);
|
||||||
#else
|
#else
|
||||||
TxPrintf("Wire layer %s, width %s\n",
|
TxPrintf("Wire layer %s, width %d\n",
|
||||||
DBTypeLongNameTbl[type], wdisp);
|
DBTypeLongNameTbl[type], width);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case VERTICAL:
|
case VERTICAL:
|
||||||
if ((cmd->tx_argc > 2) && strcmp(cmd->tx_argv[2], "to") == 0)
|
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_VERTICAL);
|
||||||
{
|
return;
|
||||||
if (cmd->tx_argc != 5)
|
|
||||||
goto badargs;
|
|
||||||
point.p_x = cmdParseCoord(w, cmd->tx_argv[3], FALSE, TRUE);
|
|
||||||
point.p_y = cmdParseCoord(w, cmd->tx_argv[4], FALSE, FALSE);
|
|
||||||
GeoTransPoint(&EditToRootTransform, &point, &rootPoint);
|
|
||||||
WireAddLeg((Rect *)NULL, &rootPoint, WIRE_VERTICAL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WireAddLeg((Rect *) NULL, (Point *) NULL, WIRE_VERTICAL);
|
|
||||||
needCoord = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WIDTH:
|
case WIDTH:
|
||||||
if (locargc == 2)
|
if (locargc == 2)
|
||||||
{
|
{
|
||||||
char *wdisp;
|
|
||||||
width = WireGetWidth();
|
width = WireGetWidth();
|
||||||
wdisp = DBWPrintValue(width, w, TRUE);
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
lobj = Tcl_NewStringObj(wdisp, -1);
|
lobj = Tcl_NewIntObj(width);
|
||||||
Tcl_SetObjResult(magicinterp, lobj);
|
Tcl_SetObjResult(magicinterp, lobj);
|
||||||
#else
|
#else
|
||||||
TxPrintf("Wire width is %s\n", wdisp);
|
TxPrintf("Wire width is %d\n", width);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (locargc != 3)
|
else if (locargc != 3)
|
||||||
|
|
@ -1999,7 +1671,7 @@ CmdWire(
|
||||||
{
|
{
|
||||||
width = cmdParseCoord(w, cmd->tx_argv[2], TRUE, TRUE);
|
width = cmdParseCoord(w, cmd->tx_argv[2], TRUE, TRUE);
|
||||||
type = WireGetType();
|
type = WireGetType();
|
||||||
WirePickType(type, (Point *)NULL, width);
|
WirePickType(type, width);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2089,7 +1761,6 @@ CmdWire(
|
||||||
TxError("Bad coordinate pair at %s line %d\n",
|
TxError("Bad coordinate pair at %s line %d\n",
|
||||||
cmd->tx_argv[4], i + 1);
|
cmd->tx_argv[4], i + 1);
|
||||||
freeMagic(plist);
|
freeMagic(plist);
|
||||||
fclose(pfile);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2149,22 +1820,6 @@ CmdWire(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recast the command as "wire <option> to <x> <y>" so that it no longer
|
|
||||||
* depends on the pointer position, for command logging.
|
|
||||||
*/
|
|
||||||
if (needCoord)
|
|
||||||
{
|
|
||||||
if (ToolGetPoint(&rootPoint, (Rect *)NULL) != NULL)
|
|
||||||
{
|
|
||||||
GeoTransPoint(&RootToEditTransform, &rootPoint, &point);
|
|
||||||
sprintf(cmd->tx_argstring, "wire %s %s %di %di",
|
|
||||||
cmd->tx_argv[1],
|
|
||||||
(option == TYPE) ? "at" : "to",
|
|
||||||
point.p_x, point.p_y);
|
|
||||||
TxRebuildCommand(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -2197,13 +1852,13 @@ CmdWire(
|
||||||
#define OPT_WRITEALL_MODIFIED 1
|
#define OPT_WRITEALL_MODIFIED 1
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdWriteall(
|
CmdWriteall(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int cmdWriteallFunc(CellDef *def, TxCommand *cmd);
|
int cmdWriteallFunc();
|
||||||
int option = -1;
|
int option = -1;
|
||||||
static const char * const writeallOpts[] = { "force", "modified", 0 };
|
static char *writeallOpts[] = { "force", "modified", 0 };
|
||||||
int argc;
|
int argc;
|
||||||
int flags = CDMODIFIED | CDBOXESCHANGED | CDSTAMPSCHANGED;
|
int flags = CDMODIFIED | CDBOXESCHANGED | CDSTAMPSCHANGED;
|
||||||
|
|
||||||
|
|
@ -2213,7 +1868,7 @@ CmdWriteall(
|
||||||
option = Lookup(cmd->tx_argv[1], writeallOpts);
|
option = Lookup(cmd->tx_argv[1], writeallOpts);
|
||||||
if (option < 0)
|
if (option < 0)
|
||||||
{
|
{
|
||||||
TxError("Usage: %s [force|modified [cellname ...]]\n",
|
TxError("Usage: %s [force|modified|noupdate [cellname ...]]\n",
|
||||||
cmd->tx_argv[0]);
|
cmd->tx_argv[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2254,11 +1909,11 @@ CmdWriteall(
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
int
|
int
|
||||||
cmdWriteallFunc(
|
cmdWriteallFunc(def, cmd)
|
||||||
CellDef *def, /* Pointer to CellDef to be saved. This def might
|
CellDef *def; /* Pointer to CellDef to be saved. This def might
|
||||||
* be an internal buffer; if so, we ignore it.
|
* be an internal buffer; if so, we ignore it.
|
||||||
*/
|
*/
|
||||||
TxCommand *cmd) /* Client data passed to DBCellSrDefs, a pointer
|
TxCommand *cmd; /* Client data passed to DBCellSrDefs, a pointer
|
||||||
* to the command structure. If cmd->tx_argc == 1,
|
* to the command structure. If cmd->tx_argc == 1,
|
||||||
* then prompt for each action. If cmd->tx_argc
|
* then prompt for each action. If cmd->tx_argc
|
||||||
* == 2, then write all cells without asking. If
|
* == 2, then write all cells without asking. If
|
||||||
|
|
@ -2268,9 +1923,9 @@ cmdWriteallFunc(
|
||||||
{
|
{
|
||||||
char *prompt, *argv;
|
char *prompt, *argv;
|
||||||
int i, action, cidx = 0;
|
int i, action, cidx = 0;
|
||||||
static const char * const actionNames[] =
|
static char *actionNames[] =
|
||||||
{ "write", "flush", "skip", "abort", "autowrite", 0 };
|
{ "write", "flush", "skip", "abort", "autowrite", 0 };
|
||||||
static const char * const explain[] =
|
static char *explain[] =
|
||||||
{ "", "(bboxes)", "(timestamps)", "(bboxes/timestamps)", 0 };
|
{ "", "(bboxes)", "(timestamps)", "(bboxes/timestamps)", 0 };
|
||||||
|
|
||||||
if (def->cd_flags & CDINTERNAL) return 0;
|
if (def->cd_flags & CDINTERNAL) return 0;
|
||||||
|
|
@ -2357,9 +2012,9 @@ cmdWriteallFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdXload(
|
CmdXload(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
windCheckOnlyWindow(&w, DBWclientID);
|
windCheckOnlyWindow(&w, DBWclientID);
|
||||||
if (w == (MagWindow *) NULL)
|
if (w == (MagWindow *) NULL)
|
||||||
|
|
@ -2405,9 +2060,9 @@ CmdXload(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdXor(
|
CmdXor(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
int rval, xMask;
|
int rval, xMask;
|
||||||
bool dolabels;
|
bool dolabels;
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdWizard.c,v 1.2 2008/02/10 19:30:19 tim Exp $";
|
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/commands/CmdWizard.c,v 1.2 2008/02/10 19:30:19 tim Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -47,16 +46,12 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
#include "utils/utils.h"
|
#include "utils/utils.h"
|
||||||
#include "textio/txcommands.h"
|
#include "textio/txcommands.h"
|
||||||
|
|
||||||
/* For diagnostics */
|
|
||||||
#include "cif/CIFint.h"
|
|
||||||
#include "database/databaseInt.h"
|
|
||||||
|
|
||||||
/* C99 compat */
|
/* C99 compat */
|
||||||
#include "extract/extract.h"
|
#include "extract/extract.h"
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
|
|
||||||
extern void cmdPsearchStats(char *str, struct tms *tl, struct tms *td, int count);
|
extern void cmdPsearchStats();
|
||||||
|
|
||||||
void cmdStatsHier(CellDef *, int, CellDef *);
|
void cmdStatsHier(CellDef *, int, CellDef *);
|
||||||
|
|
||||||
|
|
@ -83,9 +78,9 @@ void cmdStatsHier(CellDef *, int, CellDef *);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdCoord(
|
CmdCoord(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
MagWindow *pointW = (MagWindow *) NULL;
|
MagWindow *pointW = (MagWindow *) NULL;
|
||||||
Rect editRect, rootRect;
|
Rect editRect, rootRect;
|
||||||
|
|
@ -185,242 +180,14 @@ CmdCoord(
|
||||||
|
|
||||||
#ifndef NO_EXT
|
#ifndef NO_EXT
|
||||||
void
|
void
|
||||||
CmdExtractTest(
|
CmdExtractTest(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
ExtractTest(w, cmd);
|
ExtractTest(w, cmd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* tileCountProc --
|
|
||||||
*
|
|
||||||
* Routine to count tiles.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
* 0 to keep the search going
|
|
||||||
*
|
|
||||||
* Side effects:
|
|
||||||
* Keeps count in clientData
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
tileCountProc(
|
|
||||||
Tile *tile, /* (unused) */
|
|
||||||
TileType dinfo, /* (unused) */
|
|
||||||
int *tcount)
|
|
||||||
{
|
|
||||||
(*tcount)++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* showMem --
|
|
||||||
* CmdShowmem --
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
*
|
|
||||||
* showmem [outfile]
|
|
||||||
*
|
|
||||||
* Display all the (principle) internal memory usage for tiles, including
|
|
||||||
* all cell defs, and all CIF generated planes.
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Side effects:
|
|
||||||
* May write to a disk file.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
showMem(
|
|
||||||
FILE *outf, /* File to which information is to be output */
|
|
||||||
bool verbose) /* If TRUE, output detailed erase table */
|
|
||||||
{
|
|
||||||
int ttotal, ttotal1, ttotal2;
|
|
||||||
int i;
|
|
||||||
Plane *plane;
|
|
||||||
CellDef *def;
|
|
||||||
int pNum;
|
|
||||||
HashSearch hs;
|
|
||||||
HashEntry *entry;
|
|
||||||
|
|
||||||
fprintf(outf, "Tile memory usage summary\n");
|
|
||||||
fprintf(outf, "Technology %s\n", DBTechName);
|
|
||||||
|
|
||||||
/* Search every cell def (including internal ones), count tiles,
|
|
||||||
* and add up the tile memory usage on every plane.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Search the CIFPlanes and count tiles. */
|
|
||||||
/* CIFPlanes, CIFTotalPlanes, CIFComponentPlanes */
|
|
||||||
|
|
||||||
ttotal2 = 0;
|
|
||||||
if (CIFCurStyle != NULL)
|
|
||||||
{
|
|
||||||
fprintf(outf, "\nCIFPlanes:\n");
|
|
||||||
ttotal1 = 0;
|
|
||||||
for (i = 0; i < MAXCIFLAYERS; i++)
|
|
||||||
{
|
|
||||||
plane = CIFPlanes[i];
|
|
||||||
if (plane != NULL)
|
|
||||||
{
|
|
||||||
ttotal = 0;
|
|
||||||
DBSrPaintArea((Tile *)NULL, plane, &TiPlaneRect,
|
|
||||||
&DBAllTypeBits, tileCountProc, &ttotal);
|
|
||||||
ttotal1 += ttotal;
|
|
||||||
|
|
||||||
if (CIFCurStyle->cs_layers[i])
|
|
||||||
fprintf(outf, " layer %s: %ld\n",
|
|
||||||
CIFCurStyle->cs_layers[i]->cl_name,
|
|
||||||
(long)ttotal * (long)sizeof(Tile));
|
|
||||||
else
|
|
||||||
fprintf(outf, " layer %d: %d\n", i,
|
|
||||||
(long)ttotal * (long)sizeof(Tile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(outf, " Subtotal: %ld bytes\n",
|
|
||||||
(long)ttotal1 * (long)sizeof(Tile));
|
|
||||||
ttotal2 += ttotal1;
|
|
||||||
|
|
||||||
fprintf(outf, "\nCIFTotalPlanes\n");
|
|
||||||
ttotal1 = 0;
|
|
||||||
for (i = 0; i < MAXCIFLAYERS; i++)
|
|
||||||
{
|
|
||||||
plane = CIFTotalPlanes[i];
|
|
||||||
if (plane != NULL)
|
|
||||||
{
|
|
||||||
ttotal = 0;
|
|
||||||
DBSrPaintArea((Tile *)NULL, plane, &TiPlaneRect,
|
|
||||||
&DBAllTypeBits, tileCountProc, &ttotal);
|
|
||||||
ttotal1 += ttotal;
|
|
||||||
|
|
||||||
if (CIFCurStyle->cs_layers[i])
|
|
||||||
fprintf(outf, " layer %s: %ld\n",
|
|
||||||
CIFCurStyle->cs_layers[i]->cl_name,
|
|
||||||
(long)ttotal * (long)sizeof(Tile));
|
|
||||||
else
|
|
||||||
fprintf(outf, " layer %d: %d\n", i,
|
|
||||||
(long)ttotal * (long)sizeof(Tile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(outf, " Subtotal: %ld bytes\n",
|
|
||||||
(long)ttotal1 * (long)sizeof(Tile));
|
|
||||||
ttotal2 += ttotal1;
|
|
||||||
|
|
||||||
fprintf(outf, "\nCIFComponentPlanes\n");
|
|
||||||
ttotal1 = 0;
|
|
||||||
for (i = 0; i < MAXCIFLAYERS; i++)
|
|
||||||
{
|
|
||||||
plane = CIFComponentPlanes[i];
|
|
||||||
if (plane != NULL)
|
|
||||||
{
|
|
||||||
ttotal = 0;
|
|
||||||
DBSrPaintArea((Tile *)NULL, plane, &TiPlaneRect,
|
|
||||||
&DBAllTypeBits, tileCountProc, &ttotal);
|
|
||||||
ttotal1 += ttotal;
|
|
||||||
|
|
||||||
if (CIFCurStyle->cs_layers[i])
|
|
||||||
fprintf(outf, " layer %s: %ld bytes\n",
|
|
||||||
CIFCurStyle->cs_layers[i]->cl_name,
|
|
||||||
(long)ttotal * (long)sizeof(Tile));
|
|
||||||
else
|
|
||||||
fprintf(outf, " layer %d: %ld bytes\n", i,
|
|
||||||
(long)ttotal * (long)sizeof(Tile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(outf, " Subtotal: %ld bytes\n",
|
|
||||||
(long)ttotal1 * (long)sizeof(Tile));
|
|
||||||
ttotal2 += ttotal1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(outf, "CIF planes: No memory usage\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
HashStartSearch(&hs);
|
|
||||||
while ((entry = HashNext(&dbCellDefTable, &hs)) != NULL)
|
|
||||||
{
|
|
||||||
def = (CellDef *)HashGetValue(entry);
|
|
||||||
if (def != (CellDef *)NULL)
|
|
||||||
{
|
|
||||||
fprintf(outf, "\nCell def %s\n", def->cd_name);
|
|
||||||
ttotal1 = 0;
|
|
||||||
for (pNum = 0; pNum < DBNumPlanes; pNum++)
|
|
||||||
{
|
|
||||||
plane = def->cd_planes[pNum];
|
|
||||||
if (plane != NULL)
|
|
||||||
{
|
|
||||||
ttotal = 0;
|
|
||||||
DBSrPaintArea((Tile *)NULL, plane, &TiPlaneRect,
|
|
||||||
&DBAllTypeBits, tileCountProc, &ttotal);
|
|
||||||
|
|
||||||
fprintf(outf, " plane %s: %ld bytes\n",
|
|
||||||
DBPlaneLongNameTbl[pNum],
|
|
||||||
(long)ttotal * (long)sizeof(Tile));
|
|
||||||
ttotal1 += ttotal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(outf, " Subtotal: %ld bytes\n",
|
|
||||||
(long)ttotal1 * (long)sizeof(Tile));
|
|
||||||
ttotal2 += ttotal1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(outf, " Grand total: %ld bytes\n",
|
|
||||||
(long)ttotal2 * (long)sizeof(Tile));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CmdShowmem(
|
|
||||||
MagWindow *w,
|
|
||||||
TxCommand *cmd)
|
|
||||||
{
|
|
||||||
FILE *outf;
|
|
||||||
bool verbose;
|
|
||||||
char **av;
|
|
||||||
int ac;
|
|
||||||
|
|
||||||
if (cmd->tx_argc > 3)
|
|
||||||
{
|
|
||||||
TxError("Usage: showmem [-v] [file]\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
verbose = FALSE;
|
|
||||||
av = &cmd->tx_argv[1];
|
|
||||||
ac = cmd->tx_argc - 1;
|
|
||||||
|
|
||||||
outf = stdout;
|
|
||||||
if (ac > 0 && strcmp(av[0], "-v") == 0)
|
|
||||||
{
|
|
||||||
verbose = TRUE;
|
|
||||||
av++, ac--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ac > 0)
|
|
||||||
{
|
|
||||||
outf = fopen(av[0], "w");
|
|
||||||
if (outf == (FILE *) NULL)
|
|
||||||
{
|
|
||||||
perror(av[0]);
|
|
||||||
TxError("Nothing written\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
showMem(outf, verbose);
|
|
||||||
if (outf != stdout)
|
|
||||||
(void) fclose(outf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
|
|
@ -444,9 +211,9 @@ CmdShowmem(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
showTech(
|
showTech(outf, verbose)
|
||||||
FILE *outf, /* File to which information is to be output */
|
FILE *outf; /* File to which information is to be output */
|
||||||
bool verbose) /* If TRUE, output detailed erase table */
|
bool verbose; /* If TRUE, output detailed erase table */
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
|
@ -464,7 +231,7 @@ showTech(
|
||||||
fprintf(outf, "\n");
|
fprintf(outf, "\n");
|
||||||
fprintf(outf, "Types:\n");
|
fprintf(outf, "Types:\n");
|
||||||
for (i = 0; i < DBNumTypes; i++) {
|
for (i = 0; i < DBNumTypes; i++) {
|
||||||
int pl ; const char *spl ;
|
int pl ; char *spl ;
|
||||||
|
|
||||||
pl = DBPlane(i);
|
pl = DBPlane(i);
|
||||||
spl = ( pl <= 0 || pl > DBNumPlanes ) ? "??" : DBPlaneLongName(pl);
|
spl = ( pl <= 0 || pl > DBNumPlanes ) ? "??" : DBPlaneLongName(pl);
|
||||||
|
|
@ -591,9 +358,9 @@ showTech(
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdShowtech(
|
CmdShowtech(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
FILE *outf;
|
FILE *outf;
|
||||||
bool verbose;
|
bool verbose;
|
||||||
|
|
@ -659,16 +426,16 @@ CmdShowtech(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdTilestats(
|
CmdTilestats(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
CellUse *selectedUse;
|
CellUse *selectedUse;
|
||||||
FILE *outf = stdout;
|
FILE *outf = stdout;
|
||||||
bool allDefs = FALSE;
|
bool allDefs = FALSE;
|
||||||
char **av = cmd->tx_argv + 1;
|
char **av = cmd->tx_argv + 1;
|
||||||
int ac = cmd->tx_argc - 1;
|
int ac = cmd->tx_argc - 1;
|
||||||
int cmdStatsFunc(CellDef *def, FILE *outf);
|
int cmdStatsFunc();
|
||||||
|
|
||||||
if (ac > 2)
|
if (ac > 2)
|
||||||
{
|
{
|
||||||
|
|
@ -743,12 +510,11 @@ int totalTiles[TT_MAXTYPES];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdStatsFunc(
|
cmdStatsFunc(def, outf)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
FILE *outf)
|
FILE *outf;
|
||||||
{
|
{
|
||||||
int cmdStatsCount(CellDef *def, struct countClient *cc);
|
int cmdStatsCount(), cmdStatsOutput();
|
||||||
int cmdStatsOutput(CellDef *def, struct countClient *cc);
|
|
||||||
struct countClient cc;
|
struct countClient cc;
|
||||||
int total;
|
int total;
|
||||||
TileType t;
|
TileType t;
|
||||||
|
|
@ -797,17 +563,15 @@ cmdStatsFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdStatsCount(
|
cmdStatsCount(def, cc)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
struct countClient *cc)
|
struct countClient *cc;
|
||||||
{
|
{
|
||||||
|
int cmdStatsCountTile();
|
||||||
int pNum;
|
int pNum;
|
||||||
struct cellInfo *ci;
|
struct cellInfo *ci;
|
||||||
TileType t;
|
TileType t;
|
||||||
|
|
||||||
/* Forward declaration */
|
|
||||||
int cmdStatsCountTile(Tile *tile, TileType dinfo, struct cellInfo *ci);
|
|
||||||
|
|
||||||
if (def->cd_client)
|
if (def->cd_client)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
|
|
@ -830,10 +594,9 @@ cmdStatsCount(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdStatsCountTile(
|
cmdStatsCountTile(tile, ci)
|
||||||
Tile *tile,
|
Tile *tile;
|
||||||
TileType dinfo, /* (unused) */
|
struct cellInfo *ci;
|
||||||
struct cellInfo *ci)
|
|
||||||
{
|
{
|
||||||
TileType type = TiGetType(tile);
|
TileType type = TiGetType(tile);
|
||||||
|
|
||||||
|
|
@ -874,10 +637,9 @@ cmdStatsCountTile(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cmdStatsHier(
|
cmdStatsHier(parent, nuses, child)
|
||||||
CellDef *parent,
|
CellDef *parent, *child;
|
||||||
int nuses,
|
int nuses;
|
||||||
CellDef *child)
|
|
||||||
{
|
{
|
||||||
struct cellInfo *pi, *ci;
|
struct cellInfo *pi, *ci;
|
||||||
TileType t;
|
TileType t;
|
||||||
|
|
@ -922,9 +684,9 @@ cmdStatsHier(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdStatsOutput(
|
cmdStatsOutput(def, cc)
|
||||||
CellDef *def,
|
CellDef *def;
|
||||||
struct countClient *cc)
|
struct countClient *cc;
|
||||||
{
|
{
|
||||||
TileType t;
|
TileType t;
|
||||||
struct cellInfo *ci;
|
struct cellInfo *ci;
|
||||||
|
|
@ -987,11 +749,11 @@ cmdStatsOutput(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdPsearch(
|
CmdPsearch(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
char *RunStats(int flags, struct tms *lastt, struct tms *deltat);
|
char *RunStats();
|
||||||
static struct tms tlast, tdelta;
|
static struct tms tlast, tdelta;
|
||||||
Point p;
|
Point p;
|
||||||
Plane *plane;
|
Plane *plane;
|
||||||
|
|
@ -1053,13 +815,12 @@ CmdPsearch(
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmdPsearchStats(
|
cmdPsearchStats(str, tl, td, count)
|
||||||
char *str,
|
char *str;
|
||||||
struct tms *tl,
|
struct tms *tl, *td;
|
||||||
struct tms *td,
|
int count;
|
||||||
int count)
|
|
||||||
{
|
{
|
||||||
char *RunStats(int flags, struct tms *lastt, struct tms *deltat);
|
char *RunStats();
|
||||||
char *rstatp;
|
char *rstatp;
|
||||||
int us, ups;
|
int us, ups;
|
||||||
|
|
||||||
|
|
@ -1099,22 +860,20 @@ int numTilesFound;
|
||||||
bool cmdTsearchDebug = FALSE;
|
bool cmdTsearchDebug = FALSE;
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdTsearch(
|
CmdTsearch(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
char *rstatp;
|
int cmdTsrFunc();
|
||||||
|
char *RunStats(), *rstatp;
|
||||||
static TileTypeBitMask mask;
|
static TileTypeBitMask mask;
|
||||||
static struct tms tlast, tdelta;
|
static struct tms tlast, tdelta;
|
||||||
Rect rtool, rsearch;
|
Rect rtool, rsearch;
|
||||||
|
/**** Rect *ebox; ****/
|
||||||
Plane *plane;
|
Plane *plane;
|
||||||
int i, pNum, count;
|
int i, pNum, count;
|
||||||
int usPerSearch, usPerTile, usPerL2, us, boxarea;
|
int usPerSearch, usPerTile, usPerL2, us, boxarea;
|
||||||
|
|
||||||
/* Forward declarations */
|
|
||||||
int cmdTsrFunc(Tile *tp, TileType dinfo, ClientData clientdata);
|
|
||||||
char *RunStats(int flags, struct tms *lastt, struct tms *deltat);
|
|
||||||
|
|
||||||
if (cmd->tx_argc < 3 || cmd->tx_argc > 5)
|
if (cmd->tx_argc < 3 || cmd->tx_argc > 5)
|
||||||
{
|
{
|
||||||
TxError("Usage: tsearch plane count [mask [new|mayo]]\n");
|
TxError("Usage: tsearch plane count [mask [new|mayo]]\n");
|
||||||
|
|
@ -1213,13 +972,11 @@ CmdTsearch(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdTsrFunc(
|
cmdTsrFunc(tp)
|
||||||
Tile *tp,
|
Tile *tp;
|
||||||
TileType dinfo, /* (unused) */
|
|
||||||
ClientData clientdata) /* (unused) */
|
|
||||||
{
|
{
|
||||||
if (cmdTsearchDebug)
|
if (cmdTsearchDebug)
|
||||||
TxPrintf("%lx\n", (intptr_t) tp);
|
TxPrintf("%x\n", tp);
|
||||||
numTilesFound++;
|
numTilesFound++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1242,9 +999,9 @@ cmdTsrFunc(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
CmdWatch(
|
CmdWatch(w, cmd)
|
||||||
MagWindow *w,
|
MagWindow *w;
|
||||||
TxCommand *cmd)
|
TxCommand *cmd;
|
||||||
{
|
{
|
||||||
DBWclientRec *crec;
|
DBWclientRec *crec;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
|
@ -1285,7 +1042,7 @@ CmdWatch(
|
||||||
pNum = DBTechNamePlane(cmd->tx_argv[1]);
|
pNum = DBTechNamePlane(cmd->tx_argv[1]);
|
||||||
if (pNum < 0)
|
if (pNum < 0)
|
||||||
{
|
{
|
||||||
const char *cp;
|
char *cp;
|
||||||
TxError("Unrecognized plane: %s. Legal names are:\n",
|
TxError("Unrecognized plane: %s. Legal names are:\n",
|
||||||
cmd->tx_argv[1]);
|
cmd->tx_argv[1]);
|
||||||
for(pNum=0; pNum < PL_MAXTYPES; pNum++) {
|
for(pNum=0; pNum < PL_MAXTYPES; pNum++) {
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,10 @@ SRCS = CmdSubrs.c CmdAB.c CmdCD.c CmdE.c CmdFI.c \
|
||||||
|
|
||||||
module: ${MAGICDIR}/readline/readline lib${MODULE}.o
|
module: ${MAGICDIR}/readline/readline lib${MODULE}.o
|
||||||
|
|
||||||
# Delegate this task to the readline/Makefile
|
|
||||||
${MAGICDIR}/readline/readline:
|
${MAGICDIR}/readline/readline:
|
||||||
${MAKE} -C ${MAGICDIR}/readline readline-create-symlinks
|
@if ( ! test -f ${MAGICDIR}/readline/readline ) ; then \
|
||||||
|
(cd ${MAGICDIR}/readline; ln -s `ls | grep readline` readline) ; \
|
||||||
|
fi
|
||||||
|
|
||||||
include ${MAGICDIR}/defs.mak
|
include ${MAGICDIR}/defs.mak
|
||||||
include ${MAGICDIR}/rules.mak
|
include ${MAGICDIR}/rules.mak
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,11 @@
|
||||||
* rcsid $Header: /usr/cvsroot/magic-8.0/commands/commands.h,v 1.3 2009/01/19 15:43:03 tim Exp $
|
* rcsid $Header: /usr/cvsroot/magic-8.0/commands/commands.h,v 1.3 2009/01/19 15:43:03 tim Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAGIC__COMMANDS__COMMANDS_H
|
#ifndef _COMMANDS_H
|
||||||
#define _MAGIC__COMMANDS__COMMANDS_H
|
#define _COMMANDS_H
|
||||||
|
|
||||||
#include "windows/windows.h"
|
#include "windows/windows.h"
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
#include "textio/txcommands.h" /* TxCommand */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Name of default yank buffer
|
* Name of default yank buffer
|
||||||
|
|
@ -51,28 +50,30 @@ extern TileTypeBitMask CmdYMAllButSpace;
|
||||||
|
|
||||||
/* --------------------- Global procedure headers --------------------- */
|
/* --------------------- Global procedure headers --------------------- */
|
||||||
|
|
||||||
extern MagWindow *CmdGetEditPoint(Point *point, Rect *rect);
|
extern MagWindow *CmdGetRootBox();
|
||||||
extern MagWindow *CmdGetRootPoint(Point *point, Rect *rect);
|
extern MagWindow *CmdGetEditPoint();
|
||||||
extern bool CmdWarnWrite(void);
|
extern MagWindow *CmdGetRootPoint();
|
||||||
extern bool CmdParseLayers(char *s, TileTypeBitMask *mask);
|
extern bool CmdWarnWrite();
|
||||||
extern void CmdLabelProc(char *text, int font, int size, int rotate, int offx, int offy,
|
extern bool CmdParseLayers();
|
||||||
int pos, bool sticky, TileType type);
|
extern void CmdAddSlop();
|
||||||
extern void CmdSetWindCaption(CellUse *newEditUse, CellDef *rootDef);
|
extern void CmdLabelProc();
|
||||||
extern CellUse *CmdGetSelectedCell(Transform *pTrans);
|
extern void CmdSetWindCaption();
|
||||||
extern bool CmdIllegalChars(char *string, char *illegal, char *msg);
|
extern CellUse *CmdGetSelectedCell();
|
||||||
extern TileType CmdFindNetProc(char *nodename, CellUse *use, Rect *rect, bool warn_not_found, bool *isvalid);
|
extern bool CmdIllegalChars();
|
||||||
extern bool CmdCheckForPaintFunc(void);
|
extern void CmdDoMacro();
|
||||||
|
extern TileType CmdFindNetProc();
|
||||||
|
extern bool CmdCheckForPaintFunc();
|
||||||
|
|
||||||
/* C99 compat */
|
/* C99 compat */
|
||||||
extern int cmdScaleCoord(MagWindow *w, char *arg, bool is_relative, bool is_x, int scale);
|
extern int cmdScaleCoord();
|
||||||
extern void FlatCopyAllLabels(SearchContext *scx, TileTypeBitMask *mask, int xMask, CellUse *targetUse);
|
extern void FlatCopyAllLabels();
|
||||||
extern bool cmdDumpParseArgs(char *cmdName, MagWindow *w, TxCommand *cmd, CellUse *dummy, SearchContext *scx);
|
extern bool cmdDumpParseArgs();
|
||||||
extern void cmdFlushCell(CellDef *def, bool force_deref);
|
extern void cmdFlushCell();
|
||||||
extern int cmdParseCoord(MagWindow *w, char *arg, bool is_relative, bool is_x);
|
extern int cmdParseCoord();
|
||||||
extern void cmdSaveCell(CellDef *cellDef, char *newName, bool noninteractive, bool tryRename);
|
extern void cmdSaveCell();
|
||||||
extern void CmdInit(void);
|
extern void CmdInit();
|
||||||
|
|
||||||
extern void CmdDoProperty(CellDef *def, MagWindow *w, TxCommand *cmd, int argstart);
|
extern void CmdDoProperty();
|
||||||
extern void CmdPaintEraseButton(MagWindow *w, Point *refPoint, bool isPaint, bool isScreen);
|
extern void CmdPaintEraseButton();
|
||||||
|
|
||||||
#endif /* _MAGIC__COMMANDS__COMMANDS_H */
|
#endif /* _COMMANDS_H */
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@
|
||||||
# script itself. It also sets up CFLAGS without the default optimizer
|
# script itself. It also sets up CFLAGS without the default optimizer
|
||||||
# flag (-O2).
|
# flag (-O2).
|
||||||
|
|
||||||
( CFLAGS=${CFLAGS:-"-g"}; export CFLAGS; cd scripts ; ./configure "$@" )
|
( CFLAGS="-g"; export CFLAGS; cd scripts ; ./configure "$@" )
|
||||||
|
|
|
||||||
|
|
@ -30,32 +30,19 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
typedef struct dbcellboundstruct
|
typedef struct dbcellboundstruct
|
||||||
{
|
{
|
||||||
Rect *area;
|
Rect *area;
|
||||||
Rect *extended;
|
bool extended;
|
||||||
bool found;
|
bool found;
|
||||||
} DBCellBoundStruct;
|
} DBCellBoundStruct;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
* DBBoundCellPlane ---
|
|
||||||
*
|
|
||||||
* Find the extents of all subcells of the cell "def", both the
|
|
||||||
* extent of geometry (rect) and the extent of geometry plus any
|
|
||||||
* labels extending outside the extent of geometry (extended).
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* TRUE if subcells were found and measured; FALSE if no subcells
|
|
||||||
* were found (in which case "extended" and "rect" may not be
|
|
||||||
* valid).
|
|
||||||
*
|
|
||||||
* Side effects:
|
|
||||||
* Values may be recorded in "extended" and "rect".
|
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
DBBoundCellPlane(def, extended, rect)
|
DBBoundCellPlane(def, extended, rect)
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
Rect *extended;
|
bool extended;
|
||||||
Rect *rect;
|
Rect *rect;
|
||||||
{
|
{
|
||||||
TreeFilter filter;
|
TreeFilter filter;
|
||||||
|
|
@ -83,19 +70,25 @@ dbCellBoundFunc(use, fp)
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
TreeFilter *fp;
|
TreeFilter *fp;
|
||||||
{
|
{
|
||||||
|
Rect *bbox;
|
||||||
DBCellBoundStruct *cbs;
|
DBCellBoundStruct *cbs;
|
||||||
|
|
||||||
cbs = (DBCellBoundStruct *)fp->tf_arg;
|
cbs = (DBCellBoundStruct *)fp->tf_arg;
|
||||||
|
|
||||||
|
bbox = &use->cu_bbox;
|
||||||
if (cbs->found)
|
if (cbs->found)
|
||||||
{
|
{
|
||||||
GeoInclude(&use->cu_extended, cbs->extended);
|
if (cbs->extended)
|
||||||
GeoInclude(&use->cu_bbox, cbs->area);
|
GeoInclude(&use->cu_extended, cbs->area);
|
||||||
|
else
|
||||||
|
GeoInclude(&use->cu_bbox, cbs->area);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*cbs->extended = use->cu_extended;
|
if (cbs->extended)
|
||||||
*cbs->area = use->cu_bbox;
|
*cbs->area = use->cu_extended;
|
||||||
|
else
|
||||||
|
*cbs->area = use->cu_bbox;
|
||||||
cbs->found = TRUE;
|
cbs->found = TRUE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -106,57 +106,18 @@ DBCellFindDup(use, parent)
|
||||||
|
|
||||||
BPEnumInit(&bpe, parent->cd_cellPlane, &use->cu_bbox, BPE_EQUAL,
|
BPEnumInit(&bpe, parent->cd_cellPlane, &use->cu_bbox, BPE_EQUAL,
|
||||||
"DBCellFindDup");
|
"DBCellFindDup");
|
||||||
while ((dupUse = BPEnumNext(&bpe)))
|
while (dupUse = BPEnumNext(&bpe))
|
||||||
if (dupUse->cu_def == use->cu_def)
|
if (dupUse->cu_def == use->cu_def)
|
||||||
{
|
|
||||||
bool transMatch, arrayMatch, notXarray, notYarray;
|
|
||||||
|
|
||||||
/* Transforms must be equal---Aligned bounding boxes are
|
/* Transforms must be equal---Aligned bounding boxes are
|
||||||
* an insufficient measure of exact overlap. Also, array
|
* an insufficient measure of exact overlap.
|
||||||
* counts and separation must match for arrayed devices
|
|
||||||
*/
|
*/
|
||||||
transMatch = ((dupUse->cu_transform.t_a == use->cu_transform.t_a) &&
|
if ((dupUse->cu_transform.t_a == use->cu_transform.t_a) &&
|
||||||
(dupUse->cu_transform.t_b == use->cu_transform.t_b) &&
|
(dupUse->cu_transform.t_b == use->cu_transform.t_b) &&
|
||||||
(dupUse->cu_transform.t_c == use->cu_transform.t_c) &&
|
(dupUse->cu_transform.t_c == use->cu_transform.t_c) &&
|
||||||
(dupUse->cu_transform.t_d == use->cu_transform.t_d) &&
|
(dupUse->cu_transform.t_d == use->cu_transform.t_d) &&
|
||||||
(dupUse->cu_transform.t_e == use->cu_transform.t_e) &&
|
(dupUse->cu_transform.t_e == use->cu_transform.t_e) &&
|
||||||
(dupUse->cu_transform.t_f == use->cu_transform.t_f));
|
(dupUse->cu_transform.t_f == use->cu_transform.t_f))
|
||||||
|
|
||||||
/* First check if both use and dupUse are not arrays. */
|
|
||||||
notXarray = (dupUse->cu_xhi == dupUse->cu_xlo) &&
|
|
||||||
(use->cu_xhi == use->cu_xlo);
|
|
||||||
|
|
||||||
notYarray = (dupUse->cu_yhi == dupUse->cu_ylo) &&
|
|
||||||
(use->cu_yhi == use->cu_ylo);
|
|
||||||
|
|
||||||
arrayMatch = (notXarray && notYarray);
|
|
||||||
|
|
||||||
/* If they are arrays, then the array parameters must match. */
|
|
||||||
|
|
||||||
if (!notXarray && notYarray)
|
|
||||||
{
|
|
||||||
arrayMatch = ((dupUse->cu_xhi - dupUse->cu_xlo) ==
|
|
||||||
(use->cu_xhi - use->cu_xlo)) &&
|
|
||||||
(dupUse->cu_xsep == use->cu_xsep);
|
|
||||||
}
|
|
||||||
else if (!notYarray && notXarray)
|
|
||||||
{
|
|
||||||
arrayMatch = ((dupUse->cu_yhi - dupUse->cu_ylo) ==
|
|
||||||
(use->cu_yhi - use->cu_ylo)) &&
|
|
||||||
(dupUse->cu_ysep == use->cu_ysep);
|
|
||||||
}
|
|
||||||
else if (!notYarray && !notXarray)
|
|
||||||
{
|
|
||||||
arrayMatch = (((dupUse->cu_xhi - dupUse->cu_xlo) ==
|
|
||||||
(use->cu_xhi - use->cu_xlo)) &&
|
|
||||||
(dupUse->cu_xsep == use->cu_xsep)) &&
|
|
||||||
(((dupUse->cu_yhi - dupUse->cu_ylo) ==
|
|
||||||
(use->cu_yhi - use->cu_ylo)) &&
|
|
||||||
(dupUse->cu_ysep == use->cu_ysep));
|
|
||||||
}
|
|
||||||
if (transMatch && arrayMatch)
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
BPEnumTerm(&bpe);
|
BPEnumTerm(&bpe);
|
||||||
return dupUse;
|
return dupUse;
|
||||||
|
|
|
||||||
|
|
@ -59,15 +59,15 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
DBPrintUseId(
|
DBPrintUseId(scx, name, size, display_only)
|
||||||
SearchContext *scx, /* Pointer to current search context, specifying a
|
SearchContext *scx; /* Pointer to current search context, specifying a
|
||||||
* cell use and X,Y array indices.
|
* cell use and X,Y array indices.
|
||||||
*/
|
*/
|
||||||
char *name, /* Pointer to string into which we will copy the
|
char *name; /* Pointer to string into which we will copy the
|
||||||
* print name of this instance.
|
* print name of this instance.
|
||||||
*/
|
*/
|
||||||
int size, /* Maximum number of characters to copy into string. */
|
int size; /* Maximum number of characters to copy into string. */
|
||||||
bool display_only) /* TRUE if called for displaying only */
|
bool display_only; /* TRUE if called for displaying only */
|
||||||
{
|
{
|
||||||
CellUse *use = scx->scx_use;
|
CellUse *use = scx->scx_use;
|
||||||
char *sp, *id, *ep;
|
char *sp, *id, *ep;
|
||||||
|
|
@ -619,9 +619,8 @@ dbReComputeBboxFunc(cellDef, boundProc, recurseProc)
|
||||||
/*
|
/*
|
||||||
* Include area of subcells separately
|
* Include area of subcells separately
|
||||||
*/
|
*/
|
||||||
if (!((foundAny = DBBoundCellPlane(cellDef, &extended, &rect)) > 0))
|
if ((foundAny = DBBoundCellPlane(cellDef, TRUE, &rect)) > 0)
|
||||||
extended = GeoNullRect;
|
area = rect;
|
||||||
area = rect;
|
|
||||||
|
|
||||||
for (pNum = PL_PAINTBASE; pNum < DBNumPlanes; pNum++)
|
for (pNum = PL_PAINTBASE; pNum < DBNumPlanes; pNum++)
|
||||||
if (pNum != PL_DRC_CHECK)
|
if (pNum != PL_DRC_CHECK)
|
||||||
|
|
@ -635,7 +634,7 @@ dbReComputeBboxFunc(cellDef, boundProc, recurseProc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Include the area of label anchors, too.
|
* Include the area of labels, too.
|
||||||
*/
|
*/
|
||||||
for (label = cellDef->cd_labels; label != NULL; label = label->lab_next)
|
for (label = cellDef->cd_labels; label != NULL; label = label->lab_next)
|
||||||
{
|
{
|
||||||
|
|
@ -657,11 +656,7 @@ dbReComputeBboxFunc(cellDef, boundProc, recurseProc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the extended bounding box includes the area of all
|
extended = area;
|
||||||
* paint material just found, then include the area of all text
|
|
||||||
* in the current cell.
|
|
||||||
*/
|
|
||||||
GeoInclude(&area, &extended);
|
|
||||||
if (foundAny)
|
if (foundAny)
|
||||||
{
|
{
|
||||||
for (label = cellDef->cd_labels; label != NULL; label = label->lab_next)
|
for (label = cellDef->cd_labels; label != NULL; label = label->lab_next)
|
||||||
|
|
@ -678,7 +673,6 @@ dbReComputeBboxFunc(cellDef, boundProc, recurseProc)
|
||||||
degenerate = TRUE;
|
degenerate = TRUE;
|
||||||
area.r_xbot = area.r_ybot = 0;
|
area.r_xbot = area.r_ybot = 0;
|
||||||
area.r_xtop = area.r_ytop = 1;
|
area.r_xtop = area.r_ytop = 1;
|
||||||
extended = area;
|
|
||||||
}
|
}
|
||||||
else degenerate = FALSE;
|
else degenerate = FALSE;
|
||||||
|
|
||||||
|
|
@ -693,11 +687,7 @@ dbReComputeBboxFunc(cellDef, boundProc, recurseProc)
|
||||||
if (area.r_ybot == area.r_ytop)
|
if (area.r_ybot == area.r_ytop)
|
||||||
area.r_ytop = area.r_ybot + 1;
|
area.r_ytop = area.r_ybot + 1;
|
||||||
|
|
||||||
if (extended.r_xbot == extended.r_xtop)
|
if (degenerate) extended = area;
|
||||||
extended.r_xtop = extended.r_xbot + 1;
|
|
||||||
|
|
||||||
if (extended.r_ybot == extended.r_ytop)
|
|
||||||
extended.r_ytop = extended.r_ybot + 1;
|
|
||||||
|
|
||||||
/* Did the bounding box change? If not then there's no need to
|
/* Did the bounding box change? If not then there's no need to
|
||||||
* recompute the parents. If the cell has no material, then
|
* recompute the parents. If the cell has no material, then
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,9 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
#include "windows/windows.h"
|
#include "windows/windows.h"
|
||||||
#include "dbwind/dbwind.h"
|
#include "dbwind/dbwind.h"
|
||||||
#include "commands/commands.h"
|
#include "commands/commands.h"
|
||||||
|
|
||||||
|
/* C99 compat */
|
||||||
#include "graphics/graphics.h"
|
#include "graphics/graphics.h"
|
||||||
#include "cif/CIFint.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following variable points to the tables currently used for
|
* The following variable points to the tables currently used for
|
||||||
|
|
@ -356,43 +357,9 @@ DBCellCheckCopyAllPaint(scx, mask, xMask, targetUse, func)
|
||||||
struct propUseDefStruct {
|
struct propUseDefStruct {
|
||||||
CellDef *puds_source;
|
CellDef *puds_source;
|
||||||
CellDef *puds_dest;
|
CellDef *puds_dest;
|
||||||
Plane *puds_plane; /* Mask hint plane in dest */
|
|
||||||
Transform *puds_trans; /* Transform from source use to dest */
|
Transform *puds_trans; /* Transform from source use to dest */
|
||||||
Rect *puds_area; /* Clip area in source coordinates */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
*-----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* dbCopyMaskHintPlaneFunc --
|
|
||||||
*
|
|
||||||
* Translate tiles from a child mask-hint property plane into the
|
|
||||||
* coordinate system of the parent, and paint the mask-hint area
|
|
||||||
* into the mask-hint property plane of the parent.
|
|
||||||
*
|
|
||||||
*-----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
dbCopyMaskHintPlaneFunc(Tile *tile,
|
|
||||||
TileType dinfo,
|
|
||||||
struct propUseDefStruct *puds)
|
|
||||||
{
|
|
||||||
Transform *trans = puds->puds_trans;
|
|
||||||
Rect *clip = puds->puds_area;
|
|
||||||
Rect r, rnew;
|
|
||||||
Plane *plane = puds->puds_plane;
|
|
||||||
|
|
||||||
TiToRect(tile, &r);
|
|
||||||
GeoClip(&r, clip);
|
|
||||||
if (!GEO_RECTNULL(&r))
|
|
||||||
{
|
|
||||||
GeoTransRect(trans, &r, &rnew);
|
|
||||||
DBPaintPlane(plane, &rnew, CIFPaintTable, (PaintUndoInfo *)NULL);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*-----------------------------------------------------------------------------
|
*-----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
@ -413,52 +380,63 @@ dbCopyMaskHintPlaneFunc(Tile *tile,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbCopyMaskHintsFunc(key, proprec, puds)
|
dbCopyMaskHintsFunc(key, value, puds)
|
||||||
char *key;
|
char *key;
|
||||||
PropertyRecord *proprec;
|
ClientData value;
|
||||||
struct propUseDefStruct *puds;
|
struct propUseDefStruct *puds;
|
||||||
{
|
{
|
||||||
CellDef *dest = puds->puds_dest;
|
CellDef *dest = puds->puds_dest;
|
||||||
Transform *trans = puds->puds_trans;
|
Transform *trans = puds->puds_trans;
|
||||||
Rect *clip = puds->puds_area;
|
char *propstr = (char *)value;
|
||||||
PropertyRecord *parentproprec, *newproprec;
|
|
||||||
char *parentprop, *newvalue, *vptr;
|
char *parentprop, *newvalue, *vptr;
|
||||||
Rect r, rnew;
|
Rect r, rnew;
|
||||||
bool propfound;
|
bool propfound;
|
||||||
int i, j;
|
|
||||||
|
|
||||||
if (!strncmp(key, "MASKHINTS_", 10))
|
if (!strncmp(key, "MASKHINTS_", 10))
|
||||||
{
|
{
|
||||||
char *vptr, *lastval;
|
char *vptr, *lastval;
|
||||||
int lastlen;
|
int lastlen;
|
||||||
Plane *plane;
|
|
||||||
|
|
||||||
ASSERT(proprec->prop_type == PROPERTY_TYPE_PLANE, "dbCopyMaskHintsFunc");
|
/* Append to existing mask hint (if any) */
|
||||||
|
parentprop = (char *)DBPropGet(dest, key, &propfound);
|
||||||
|
newvalue = (propfound) ? StrDup((char **)NULL, parentprop) : (char *)NULL;
|
||||||
|
|
||||||
/* Get the existing mask hint plane in the parent cell, and
|
vptr = propstr;
|
||||||
* create it if it does not already exist.
|
while (*vptr != '\0')
|
||||||
*/
|
|
||||||
parentproprec = (PropertyRecord *)DBPropGet(dest, key, &propfound);
|
|
||||||
|
|
||||||
if (propfound)
|
|
||||||
plane = parentproprec->prop_value.prop_plane;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
newproprec = (PropertyRecord *)mallocMagic(sizeof(PropertyRecord));
|
if (sscanf(vptr, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||||
newproprec->prop_type = PROPERTY_TYPE_PLANE;
|
&r.r_xtop, &r.r_ytop) == 4)
|
||||||
newproprec->prop_len = 0;
|
{
|
||||||
plane = DBNewPlane((ClientData)TT_SPACE);
|
GeoTransRect(trans, &r, &rnew);
|
||||||
newproprec->prop_value.prop_plane = plane;
|
|
||||||
DBPropPut(dest, key, newproprec);
|
|
||||||
}
|
|
||||||
puds->puds_plane = plane;
|
|
||||||
|
|
||||||
/* Copy the properties from child to parent */
|
lastval = newvalue;
|
||||||
DBSrPaintArea(PlaneGetHint(proprec->prop_value.prop_plane),
|
lastlen = (lastval) ? strlen(lastval) : 0;
|
||||||
proprec->prop_value.prop_plane,
|
newvalue = mallocMagic(40 + lastlen);
|
||||||
clip, &CIFSolidBits, dbCopyMaskHintPlaneFunc,
|
|
||||||
(ClientData)puds);
|
if (lastval)
|
||||||
|
strcpy(newvalue, lastval);
|
||||||
|
else
|
||||||
|
*newvalue = '\0';
|
||||||
|
|
||||||
|
sprintf(newvalue + lastlen, "%s%d %d %d %d", (lastval) ? " " : "",
|
||||||
|
rnew.r_xbot, rnew.r_ybot, rnew.r_xtop, rnew.r_ytop);
|
||||||
|
if (lastval) freeMagic(lastval);
|
||||||
|
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
if (newvalue)
|
||||||
|
DBPropPut(dest, key, newvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -490,7 +468,6 @@ DBCellCopyMaskHints(child, parent, transform)
|
||||||
puds.puds_source = child->cu_def;
|
puds.puds_source = child->cu_def;
|
||||||
puds.puds_dest = parent;
|
puds.puds_dest = parent;
|
||||||
puds.puds_trans = transform;
|
puds.puds_trans = transform;
|
||||||
puds.puds_area = (Rect *)&TiPlaneRect;
|
|
||||||
DBPropEnum(child->cu_def, dbCopyMaskHintsFunc, (ClientData)&puds);
|
DBPropEnum(child->cu_def, dbCopyMaskHintsFunc, (ClientData)&puds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -524,7 +501,6 @@ dbFlatCopyMaskHintsFunc(scx, def)
|
||||||
puds.puds_source = scx->scx_use->cu_def;
|
puds.puds_source = scx->scx_use->cu_def;
|
||||||
puds.puds_dest = def;
|
puds.puds_dest = def;
|
||||||
puds.puds_trans = &scx->scx_trans;
|
puds.puds_trans = &scx->scx_trans;
|
||||||
puds.puds_area = &scx->scx_area;
|
|
||||||
|
|
||||||
DBPropEnum(use->cu_def, dbCopyMaskHintsFunc, (ClientData)&puds);
|
DBPropEnum(use->cu_def, dbCopyMaskHintsFunc, (ClientData)&puds);
|
||||||
|
|
||||||
|
|
@ -627,7 +603,7 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels, doclear)
|
||||||
{
|
{
|
||||||
int savemask = scx.scx_use->cu_expandMask;
|
int savemask = scx.scx_use->cu_expandMask;
|
||||||
scx.scx_use->cu_expandMask = CU_DESCEND_SPECIAL;
|
scx.scx_use->cu_expandMask = CU_DESCEND_SPECIAL;
|
||||||
DBCellCopyAllLabels(&scx, &DBAllTypeBits, CU_DESCEND_SPECIAL, dest, NULL);
|
DBCellCopyAllLabels(&scx, &DBAllTypeBits, CU_DESCEND_SPECIAL, dest);
|
||||||
scx.scx_use->cu_expandMask = savemask;
|
scx.scx_use->cu_expandMask = savemask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -690,7 +666,7 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels, doclear)
|
||||||
scx.scx_y++;
|
scx.scx_y++;
|
||||||
scx.scx_x = use->cu_xlo;
|
scx.scx_x = use->cu_xlo;
|
||||||
}
|
}
|
||||||
else if (use->cu_ylo > use->cu_yhi)
|
else if (use->cu_yhi > use->cu_yhi)
|
||||||
{
|
{
|
||||||
scx.scx_y--;
|
scx.scx_y--;
|
||||||
scx.scx_x = use->cu_xlo;
|
scx.scx_x = use->cu_xlo;
|
||||||
|
|
@ -991,15 +967,14 @@ DBCellGenerateSimpleSubstrate(scx, subType, notSubMask, targetDef)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbEraseSubFunc(tile, dinfo, cxp)
|
dbEraseSubFunc(tile, cxp)
|
||||||
Tile *tile; /* Pointer to source tile with shield type */
|
Tile *tile; /* Pointer to source tile with shield type */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
||||||
{
|
{
|
||||||
SearchContext *scx;
|
SearchContext *scx;
|
||||||
Rect sourceRect, targetRect;
|
Rect sourceRect, targetRect;
|
||||||
int pNum;
|
int pNum;
|
||||||
TileType newdinfo, loctype, subType;
|
TileType type, loctype, subType;
|
||||||
Plane *plane;
|
Plane *plane;
|
||||||
struct dbCopySubData *csd; /* Client data */
|
struct dbCopySubData *csd; /* Client data */
|
||||||
|
|
||||||
|
|
@ -1008,14 +983,12 @@ dbEraseSubFunc(tile, dinfo, cxp)
|
||||||
plane = csd->csd_plane;
|
plane = csd->csd_plane;
|
||||||
pNum = csd->csd_pNum;
|
pNum = csd->csd_pNum;
|
||||||
subType = csd->csd_subtype;
|
subType = csd->csd_subtype;
|
||||||
|
type = TiGetTypeExact(tile);
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile);
|
loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
if (loctype == TT_SPACE) return 0;
|
if (loctype == TT_SPACE) return 0;
|
||||||
newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, &scx->scx_trans);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
newdinfo = (TileType)0;
|
|
||||||
|
|
||||||
/* Construct the rect for the tile */
|
/* Construct the rect for the tile */
|
||||||
TITORECT(tile, &sourceRect);
|
TITORECT(tile, &sourceRect);
|
||||||
|
|
@ -1025,7 +998,7 @@ dbEraseSubFunc(tile, dinfo, cxp)
|
||||||
|
|
||||||
csd->csd_modified = TRUE;
|
csd->csd_modified = TRUE;
|
||||||
|
|
||||||
return DBNMPaintPlane(plane, newdinfo, &targetRect, DBStdEraseTbl(subType, pNum),
|
return DBNMPaintPlane(plane, type, &targetRect, DBStdEraseTbl(subType, pNum),
|
||||||
(PaintUndoInfo *)NULL);
|
(PaintUndoInfo *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1037,15 +1010,14 @@ dbEraseSubFunc(tile, dinfo, cxp)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbPaintSubFunc(tile, dinfo, cxp)
|
dbPaintSubFunc(tile, cxp)
|
||||||
Tile *tile; /* Pointer to source tile with shield type */
|
Tile *tile; /* Pointer to source tile with shield type */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
||||||
{
|
{
|
||||||
SearchContext *scx;
|
SearchContext *scx;
|
||||||
Rect sourceRect, targetRect;
|
Rect sourceRect, targetRect;
|
||||||
int pNum;
|
int pNum;
|
||||||
TileType newdinfo, loctype, subType;
|
TileType type, loctype, subType;
|
||||||
Plane *plane;
|
Plane *plane;
|
||||||
struct dbCopySubData *csd; /* Client data */
|
struct dbCopySubData *csd; /* Client data */
|
||||||
|
|
||||||
|
|
@ -1054,14 +1026,12 @@ dbPaintSubFunc(tile, dinfo, cxp)
|
||||||
plane = csd->csd_plane;
|
plane = csd->csd_plane;
|
||||||
pNum = csd->csd_pNum;
|
pNum = csd->csd_pNum;
|
||||||
subType = csd->csd_subtype;
|
subType = csd->csd_subtype;
|
||||||
|
type = TiGetTypeExact(tile);
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile);
|
loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
if (loctype == TT_SPACE) return 0;
|
if (loctype == TT_SPACE) return 0;
|
||||||
newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, &scx->scx_trans);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
newdinfo = (TileType)0;
|
|
||||||
|
|
||||||
/* Construct the rect for the tile */
|
/* Construct the rect for the tile */
|
||||||
TITORECT(tile, &sourceRect);
|
TITORECT(tile, &sourceRect);
|
||||||
|
|
@ -1071,7 +1041,7 @@ dbPaintSubFunc(tile, dinfo, cxp)
|
||||||
|
|
||||||
csd->csd_modified = TRUE;
|
csd->csd_modified = TRUE;
|
||||||
|
|
||||||
return DBNMPaintPlane(plane, newdinfo, &targetRect, DBStdPaintTbl(subType, pNum),
|
return DBNMPaintPlane(plane, type, &targetRect, DBStdPaintTbl(subType, pNum),
|
||||||
(PaintUndoInfo *)NULL);
|
(PaintUndoInfo *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1084,15 +1054,14 @@ dbPaintSubFunc(tile, dinfo, cxp)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbEraseNonSub(tile, dinfo, cxp)
|
dbEraseNonSub(tile, cxp)
|
||||||
Tile *tile; /* Pointer to tile to erase from target */
|
Tile *tile; /* Pointer to tile to erase from target */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
||||||
{
|
{
|
||||||
SearchContext *scx;
|
SearchContext *scx;
|
||||||
Rect sourceRect, targetRect;
|
Rect sourceRect, targetRect;
|
||||||
Plane *plane; /* Plane of target data */
|
Plane *plane; /* Plane of target data */
|
||||||
TileType newdinfo, loctype, subType;
|
TileType type, loctype, subType;
|
||||||
struct dbCopySubData *csd;
|
struct dbCopySubData *csd;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
|
||||||
|
|
@ -1103,14 +1072,12 @@ dbEraseNonSub(tile, dinfo, cxp)
|
||||||
|
|
||||||
scx = cxp->tc_scx;
|
scx = cxp->tc_scx;
|
||||||
|
|
||||||
|
type = TiGetTypeExact(tile);
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile);
|
loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
if (loctype == TT_SPACE) return 0;
|
if (loctype == TT_SPACE) return 0;
|
||||||
newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, &scx->scx_trans);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
newdinfo = (TileType)0;
|
|
||||||
|
|
||||||
/* Construct the rect for the tile */
|
/* Construct the rect for the tile */
|
||||||
TITORECT(tile, &sourceRect);
|
TITORECT(tile, &sourceRect);
|
||||||
|
|
@ -1119,7 +1086,7 @@ dbEraseNonSub(tile, dinfo, cxp)
|
||||||
GEOTRANSRECT(&scx->scx_trans, &sourceRect, &targetRect);
|
GEOTRANSRECT(&scx->scx_trans, &sourceRect, &targetRect);
|
||||||
|
|
||||||
/* Erase the substrate type from the area of this tile in the target plane. */
|
/* Erase the substrate type from the area of this tile in the target plane. */
|
||||||
return DBNMPaintPlane(plane, newdinfo, &targetRect, DBStdEraseTbl(subType, pNum),
|
return DBNMPaintPlane(plane, type, &targetRect, DBStdEraseTbl(subType, pNum),
|
||||||
(PaintUndoInfo *)NULL);
|
(PaintUndoInfo *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1131,9 +1098,8 @@ dbEraseNonSub(tile, dinfo, cxp)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbCopySubFunc(tile, dinfo, csd)
|
dbCopySubFunc(tile, csd)
|
||||||
Tile *tile; /* Pointer to tile to erase from target */
|
Tile *tile; /* Pointer to tile to erase from target */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
struct dbCopySubData *csd; /* Client data */
|
struct dbCopySubData *csd; /* Client data */
|
||||||
{
|
{
|
||||||
Rect rect;
|
Rect rect;
|
||||||
|
|
@ -1143,10 +1109,10 @@ dbCopySubFunc(tile, dinfo, csd)
|
||||||
|
|
||||||
plane = csd->csd_plane;
|
plane = csd->csd_plane;
|
||||||
pNum = csd->csd_pNum;
|
pNum = csd->csd_pNum;
|
||||||
type = TiGetTypeExact(tile) | dinfo;
|
type = TiGetTypeExact(tile);
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile);
|
loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
if (loctype == TT_SPACE) return 0;
|
if (loctype == TT_SPACE) return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1467,9 +1433,8 @@ DBCellCopyLabels(scx, mask, xMask, targetUse, pArea)
|
||||||
***/
|
***/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbCopyManhattanPaint(tile, dinfo, cxp)
|
dbCopyManhattanPaint(tile, cxp)
|
||||||
Tile *tile; /* Pointer to tile to copy */
|
Tile *tile; /* Pointer to tile to copy */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
||||||
{
|
{
|
||||||
SearchContext *scx = cxp->tc_scx;
|
SearchContext *scx = cxp->tc_scx;
|
||||||
|
|
@ -1515,9 +1480,8 @@ dbCopyManhattanPaint(tile, dinfo, cxp)
|
||||||
***/
|
***/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbCopyAllPaint(tile, dinfo, cxp)
|
dbCopyAllPaint(tile, cxp)
|
||||||
Tile *tile; /* Pointer to tile to copy */
|
Tile *tile; /* Pointer to tile to copy */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
TreeContext *cxp; /* Context from DBTreeSrTiles */
|
||||||
{
|
{
|
||||||
SearchContext *scx = cxp->tc_scx;
|
SearchContext *scx = cxp->tc_scx;
|
||||||
|
|
@ -1525,7 +1489,7 @@ dbCopyAllPaint(tile, dinfo, cxp)
|
||||||
Rect sourceRect, targetRect;
|
Rect sourceRect, targetRect;
|
||||||
PaintUndoInfo ui;
|
PaintUndoInfo ui;
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
TileType type = TiGetTypeExact(tile) | dinfo;
|
TileType type = TiGetTypeExact(tile);
|
||||||
int pNum = cxp->tc_plane;
|
int pNum = cxp->tc_plane;
|
||||||
int result;
|
int result;
|
||||||
TileTypeBitMask *typeMask;
|
TileTypeBitMask *typeMask;
|
||||||
|
|
@ -1538,13 +1502,13 @@ dbCopyAllPaint(tile, dinfo, cxp)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool splittile = FALSE;
|
bool splittile = FALSE;
|
||||||
TileType newdinfo = 0;
|
TileType dinfo = 0;
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
splittile = TRUE;
|
splittile = TRUE;
|
||||||
newdinfo = DBTransformDiagonal(type, &scx->scx_trans);
|
dinfo = DBTransformDiagonal(type, &scx->scx_trans);
|
||||||
type = (dinfo & TT_SIDE) ? SplitRightType(tile) :
|
type = (SplitSide(tile)) ? SplitRightType(tile) :
|
||||||
SplitLeftType(tile);
|
SplitLeftType(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1604,7 +1568,7 @@ dbCopyAllPaint(tile, dinfo, cxp)
|
||||||
Rect rrect, orect;
|
Rect rrect, orect;
|
||||||
int np, i, j;
|
int np, i, j;
|
||||||
|
|
||||||
GrClipTriangle(&targetRect, &arg->caa_rect, TRUE, newdinfo, points, &np);
|
GrClipTriangle(&targetRect, &arg->caa_rect, TRUE, dinfo, points, &np);
|
||||||
|
|
||||||
if (np == 0)
|
if (np == 0)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
@ -1633,7 +1597,7 @@ dbCopyAllPaint(tile, dinfo, cxp)
|
||||||
rrect.r_ybot = points[0].p_y;
|
rrect.r_ybot = points[0].p_y;
|
||||||
rrect.r_ytop = points[2].p_y;
|
rrect.r_ytop = points[2].p_y;
|
||||||
GeoCanonicalRect(&rrect, &targetRect);
|
GeoCanonicalRect(&rrect, &targetRect);
|
||||||
newdinfo = 0;
|
dinfo = 0;
|
||||||
}
|
}
|
||||||
else if (np >= 4) /* Process extra rectangles in the area */
|
else if (np >= 4) /* Process extra rectangles in the area */
|
||||||
{
|
{
|
||||||
|
|
@ -1690,7 +1654,7 @@ topbottom:
|
||||||
|
|
||||||
splitdone:
|
splitdone:
|
||||||
|
|
||||||
result = (*dbCurPaintPlane)(def, pNum, newdinfo | type, &targetRect, &ui);
|
result = (*dbCurPaintPlane)(def, pNum, dinfo | type, &targetRect, &ui);
|
||||||
if ((result != 0) && (arg->caa_func != NULL))
|
if ((result != 0) && (arg->caa_func != NULL))
|
||||||
{
|
{
|
||||||
/* result == 1 used exclusively for DRC off-grid error flagging */
|
/* result == 1 used exclusively for DRC off-grid error flagging */
|
||||||
|
|
@ -1761,8 +1725,7 @@ DBCellCopyAllCells(scx, xMask, targetUse, pArea)
|
||||||
|
|
||||||
/* dbCellCopyCellsFunc() allows cells to be left with duplicate IDs */
|
/* dbCellCopyCellsFunc() allows cells to be left with duplicate IDs */
|
||||||
/* so generate unique IDs as needed now. */
|
/* so generate unique IDs as needed now. */
|
||||||
|
DBGenerateUniqueIds(targetUse->cu_def, FALSE);
|
||||||
if (targetUse != NULL) DBGenerateUniqueIds(targetUse->cu_def, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -117,14 +117,6 @@ DBCellRename(cellname, newname, doforce)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cannot rename a cell with the name of an existing cell */
|
|
||||||
entry = HashLookOnly(&dbCellDefTable, newname);
|
|
||||||
if (entry != NULL)
|
|
||||||
{
|
|
||||||
TxError("Cannot rename; cell \"%s\" already exists!\n", newname);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Disallow renaming if the cell has the READONLY flag set, */
|
/* Disallow renaming if the cell has the READONLY flag set, */
|
||||||
/* because the cellname must match the name in the GDS */
|
/* because the cellname must match the name in the GDS */
|
||||||
/* file referenced. */
|
/* file referenced. */
|
||||||
|
|
@ -152,9 +144,10 @@ DBCellRename(cellname, newname, doforce)
|
||||||
|
|
||||||
if (doforce && ((celldef->cd_flags & CDVENDORGDS) == CDVENDORGDS))
|
if (doforce && ((celldef->cd_flags & CDVENDORGDS) == CDVENDORGDS))
|
||||||
{
|
{
|
||||||
|
char *chkgdsfile;
|
||||||
bool isReadOnly;
|
bool isReadOnly;
|
||||||
|
|
||||||
DBPropGet(celldef, "GDS_FILE", &isReadOnly);
|
chkgdsfile = (char *)DBPropGet(celldef, "GDS_FILE", &isReadOnly);
|
||||||
/* Note that clearing GDS_FILE will also clear CDVENDORGDS flag */
|
/* Note that clearing GDS_FILE will also clear CDVENDORGDS flag */
|
||||||
if (isReadOnly) DBPropPut(celldef, "GDS_FILE", NULL);
|
if (isReadOnly) DBPropPut(celldef, "GDS_FILE", NULL);
|
||||||
|
|
||||||
|
|
@ -231,7 +224,7 @@ DBCellDelete(cellname, force)
|
||||||
{
|
{
|
||||||
HashEntry *entry;
|
HashEntry *entry;
|
||||||
CellDef *celldef;
|
CellDef *celldef;
|
||||||
CellUse *celluse, *lastuse;
|
CellUse *celluse;
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
entry = HashLookOnly(&dbCellDefTable, cellname);
|
entry = HashLookOnly(&dbCellDefTable, cellname);
|
||||||
|
|
@ -266,36 +259,13 @@ DBCellDelete(cellname, force)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2nd pass: If there are instances of the cell in */
|
|
||||||
/* internal cells like SelectDef, etc., then remove the use */
|
|
||||||
/* from the definition. */
|
|
||||||
|
|
||||||
lastuse = NULL;
|
|
||||||
celluse = celldef->cd_parents;
|
|
||||||
while (celluse != (CellUse *) NULL)
|
|
||||||
{
|
|
||||||
if (celluse->cu_parent != (CellDef *)NULL)
|
|
||||||
{
|
|
||||||
if ((celluse->cu_parent->cd_flags & CDINTERNAL) == CDINTERNAL)
|
|
||||||
{
|
|
||||||
DBDeleteCell(celluse);
|
|
||||||
celluse = lastuse;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastuse = celluse;
|
|
||||||
if (lastuse == NULL)
|
|
||||||
celluse = celldef->cd_parents;
|
|
||||||
else
|
|
||||||
celluse = celluse->cu_nextuse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cleared to delete. . . now prompt user if the cell has changes. */
|
/* Cleared to delete. . . now prompt user if the cell has changes. */
|
||||||
/* Last chance to save! */
|
/* Last chance to save! */
|
||||||
|
|
||||||
if ((force == FALSE) &&
|
if ((force == FALSE) &&
|
||||||
(celldef->cd_flags & (CDMODIFIED|CDBOXESCHANGED|CDSTAMPSCHANGED)))
|
(celldef->cd_flags & (CDMODIFIED|CDBOXESCHANGED|CDSTAMPSCHANGED)))
|
||||||
{
|
{
|
||||||
static const char *yesno[] = { "no", "yes", 0 };
|
static char *yesno[] = { "no", "yes", 0 };
|
||||||
int code;
|
int code;
|
||||||
char *prompt = TxPrintString("Cell %s has been modified.\n Do you"
|
char *prompt = TxPrintString("Cell %s has been modified.\n Do you"
|
||||||
" want to delete it and lose all changes? ",
|
" want to delete it and lose all changes? ",
|
||||||
|
|
@ -313,13 +283,12 @@ DBCellDelete(cellname, force)
|
||||||
/* so that WindUnload() will create a new one. */
|
/* so that WindUnload() will create a new one. */
|
||||||
|
|
||||||
if (!strcmp(cellname, UNNAMED))
|
if (!strcmp(cellname, UNNAMED))
|
||||||
DBCellRename(cellname, "__UNNAMED__", FALSE);
|
DBCellRename(cellname, "__UNNAMED__");
|
||||||
|
|
||||||
/* For all top-level cell uses, check if any windows have this */
|
/* For all top-level cell uses, check if any windows have this */
|
||||||
/* use. If so, load the window with (UNNAMED). */
|
/* use. If so, load the window with (UNNAMED). */
|
||||||
|
|
||||||
UndoDisable();
|
UndoDisable();
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (celluse = celldef->cd_parents; celluse != (CellUse *) NULL;
|
for (celluse = celldef->cd_parents; celluse != (CellUse *) NULL;
|
||||||
celluse = celluse->cu_nextuse)
|
celluse = celluse->cu_nextuse)
|
||||||
{
|
{
|
||||||
|
|
@ -328,9 +297,8 @@ DBCellDelete(cellname, force)
|
||||||
WindUnload(celluse);
|
WindUnload(celluse);
|
||||||
freeMagic(celluse->cu_id);
|
freeMagic(celluse->cu_id);
|
||||||
}
|
}
|
||||||
freeMagic1(&mm1, (char *)celluse);
|
freeMagic((char *)celluse);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
celldef->cd_parents = (CellUse *)NULL;
|
celldef->cd_parents = (CellUse *)NULL;
|
||||||
|
|
||||||
DBWResetBox(celldef);
|
DBWResetBox(celldef);
|
||||||
|
|
@ -400,12 +368,6 @@ dbGetUseName(celluse)
|
||||||
ybuf[0] = '\0';
|
ybuf[0] = '\0';
|
||||||
|
|
||||||
useID = celluse->cu_id;
|
useID = celluse->cu_id;
|
||||||
if (useID == NULL)
|
|
||||||
{
|
|
||||||
newID = (char *)mallocMagic(7);
|
|
||||||
sprintf(newID, "(null)");
|
|
||||||
return (newID);
|
|
||||||
}
|
|
||||||
newsize = strlen(useID) + 1;
|
newsize = strlen(useID) + 1;
|
||||||
if (isx || isy)
|
if (isx || isy)
|
||||||
{
|
{
|
||||||
|
|
@ -1159,13 +1121,11 @@ DBUsePrint(CellName, who, dolist)
|
||||||
celldef = DBCellLookDef(CellName);
|
celldef = DBCellLookDef(CellName);
|
||||||
*lasthier = '/';
|
*lasthier = '/';
|
||||||
}
|
}
|
||||||
else if (EditCellUse != NULL)
|
else
|
||||||
{
|
{
|
||||||
/* Referenced cellDef is the current edit def */
|
/* Referenced cellDef is the current edit def */
|
||||||
celldef = EditCellUse->cu_def;
|
celldef = EditCellUse->cu_def;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (who)
|
switch (who)
|
||||||
{
|
{
|
||||||
|
|
@ -1619,9 +1579,7 @@ dbAbutmentUseFunc(selUse, use, transform, data)
|
||||||
{
|
{
|
||||||
Rect bbox, refbox;
|
Rect bbox, refbox;
|
||||||
Transform *trans;
|
Transform *trans;
|
||||||
PropertyRecord *proprec;
|
|
||||||
char *propvalue;
|
char *propvalue;
|
||||||
char *refllx, *reflly, *refurx, *refury;
|
|
||||||
bool found;
|
bool found;
|
||||||
bool *dolist = (bool *)data;
|
bool *dolist = (bool *)data;
|
||||||
|
|
||||||
|
|
@ -1643,47 +1601,32 @@ dbAbutmentUseFunc(selUse, use, transform, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
trans = &use->cu_transform;
|
trans = &use->cu_transform;
|
||||||
proprec = DBPropGet(use->cu_def, "FIXED_BBOX", &found);
|
propvalue = DBPropGet(use->cu_def, "FIXED_BBOX", &found);
|
||||||
if (!found)
|
if (!found)
|
||||||
bbox = use->cu_def->cd_bbox;
|
bbox = use->cu_def->cd_bbox;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((proprec->prop_type == PROPERTY_TYPE_DIMENSION) &&
|
if (sscanf(propvalue, "%d %d %d %d", &bbox.r_xbot, &bbox.r_ybot,
|
||||||
(proprec->prop_len == 4))
|
&bbox.r_xtop, &bbox.r_ytop) != 4)
|
||||||
{
|
|
||||||
bbox.r_xbot = proprec->prop_value.prop_integer[0];
|
|
||||||
bbox.r_ybot = proprec->prop_value.prop_integer[1];
|
|
||||||
bbox.r_xtop = proprec->prop_value.prop_integer[2];
|
|
||||||
bbox.r_ytop = proprec->prop_value.prop_integer[3];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TxError("Unable to parse the cell's FIXED_BBOX property; using "
|
|
||||||
"the instance bounding box instead.\n");
|
|
||||||
bbox = use->cu_def->cd_bbox;
|
bbox = use->cu_def->cd_bbox;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
GeoTransRect(trans, &bbox, &refbox);
|
GeoTransRect(trans, &bbox, &refbox);
|
||||||
|
|
||||||
/* NOTE: Ideally, the MagWindow pointer should get passed to this routine */
|
|
||||||
refllx = DBWPrintValue(refbox.r_xbot, (MagWindow *)NULL, TRUE);
|
|
||||||
reflly = DBWPrintValue(refbox.r_ybot, (MagWindow *)NULL, FALSE);
|
|
||||||
refurx = DBWPrintValue(refbox.r_xtop, (MagWindow *)NULL, TRUE);
|
|
||||||
refury = DBWPrintValue(refbox.r_ytop, (MagWindow *)NULL, FALSE);
|
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (*dolist)
|
if (*dolist)
|
||||||
{
|
{
|
||||||
pobj = Tcl_NewListObj(0, NULL);
|
pobj = Tcl_NewListObj(0, NULL);
|
||||||
Tcl_ListObjAppendElement(magicinterp, pobj, Tcl_NewStringObj(refllx, -1));
|
Tcl_ListObjAppendElement(magicinterp, pobj, Tcl_NewIntObj(refbox.r_xbot));
|
||||||
Tcl_ListObjAppendElement(magicinterp, pobj, Tcl_NewStringObj(reflly, -1));
|
Tcl_ListObjAppendElement(magicinterp, pobj, Tcl_NewIntObj(refbox.r_ybot));
|
||||||
Tcl_ListObjAppendElement(magicinterp, pobj, Tcl_NewStringObj(refurx, -1));
|
Tcl_ListObjAppendElement(magicinterp, pobj, Tcl_NewIntObj(refbox.r_xtop));
|
||||||
Tcl_ListObjAppendElement(magicinterp, pobj, Tcl_NewStringObj(refury, -1));
|
Tcl_ListObjAppendElement(magicinterp, pobj, Tcl_NewIntObj(refbox.r_ytop));
|
||||||
Tcl_SetObjResult(magicinterp, pobj);
|
Tcl_SetObjResult(magicinterp, pobj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
TxPrintf("Abutment box: %s %s %s %s\n", refllx, reflly, refurx, refury);
|
TxPrintf("Abutment box: %d %d %d %d\n", refbox.r_xbot, refbox.r_ybot,
|
||||||
|
refbox.r_xtop, refbox.r_ytop);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1755,7 +1698,7 @@ DBCellNewDef(cellName)
|
||||||
cellName = UNNAMED;
|
cellName = UNNAMED;
|
||||||
|
|
||||||
entry = HashFind(&dbCellDefTable, cellName);
|
entry = HashFind(&dbCellDefTable, cellName);
|
||||||
if (HashGetValue(entry) != NULL)
|
if (HashGetValue(entry) != (ClientData) NULL)
|
||||||
return ((CellDef *) NULL);
|
return ((CellDef *) NULL);
|
||||||
|
|
||||||
cellDef = DBCellDefAlloc();
|
cellDef = DBCellDefAlloc();
|
||||||
|
|
@ -1916,7 +1859,7 @@ DBCellRenameDef(cellDef, newName)
|
||||||
ASSERT(HashGetValue(oldEntry) == (ClientData) cellDef, "DBCellRenameDef");
|
ASSERT(HashGetValue(oldEntry) == (ClientData) cellDef, "DBCellRenameDef");
|
||||||
|
|
||||||
newEntry = HashFind(&dbCellDefTable, newName);
|
newEntry = HashFind(&dbCellDefTable, newName);
|
||||||
if (HashGetValue(newEntry) != NULL)
|
if (HashGetValue(newEntry) != (ClientData) NULL)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
|
||||||
HashSetValue(oldEntry, (ClientData) NULL);
|
HashSetValue(oldEntry, (ClientData) NULL);
|
||||||
|
|
@ -1962,7 +1905,6 @@ DBCellDeleteDef(cellDef)
|
||||||
entry = HashFind(&dbCellDefTable, cellDef->cd_name);
|
entry = HashFind(&dbCellDefTable, cellDef->cd_name);
|
||||||
ASSERT(HashGetValue(entry) == (ClientData) cellDef, "DBCellDeleteDef");
|
ASSERT(HashGetValue(entry) == (ClientData) cellDef, "DBCellDeleteDef");
|
||||||
HashSetValue(entry, (ClientData) NULL);
|
HashSetValue(entry, (ClientData) NULL);
|
||||||
HashRemove(&dbCellDefTable, cellDef->cd_name);
|
|
||||||
if (cellDef->cd_props)
|
if (cellDef->cd_props)
|
||||||
DBPropClearAll(cellDef);
|
DBPropClearAll(cellDef);
|
||||||
|
|
||||||
|
|
@ -2024,10 +1966,8 @@ DBCellDefFree(cellDef)
|
||||||
cellDef->cd_planes[pNum] = (Plane *) NULL;
|
cellDef->cd_planes[pNum] = (Plane *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (lab = cellDef->cd_labels; lab; lab = lab->lab_next)
|
for (lab = cellDef->cd_labels; lab; lab = lab->lab_next)
|
||||||
freeMagic1(&mm1, (char *) lab);
|
freeMagic((char *) lab);
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
SigEnableInterrupts();
|
SigEnableInterrupts();
|
||||||
HashKill(&cellDef->cd_idHash);
|
HashKill(&cellDef->cd_idHash);
|
||||||
|
|
||||||
|
|
@ -2354,14 +2294,8 @@ DBFindUse(id, parentDef)
|
||||||
he = HashLookOnly(&parentDef->cd_idHash, id);
|
he = HashLookOnly(&parentDef->cd_idHash, id);
|
||||||
if (delimit != NULL) *delimit = '[';
|
if (delimit != NULL) *delimit = '[';
|
||||||
if (he == NULL)
|
if (he == NULL)
|
||||||
{
|
return (CellUse *) NULL;
|
||||||
/* Try again without ignoring the delimiter */
|
|
||||||
if (delimit != NULL)
|
|
||||||
he = HashLookOnly(&parentDef->cd_idHash, id);
|
|
||||||
|
|
||||||
if (he == NULL)
|
|
||||||
return (CellUse *) NULL;
|
|
||||||
}
|
|
||||||
return (CellUse *) HashGetValue(he);
|
return (CellUse *) HashGetValue(he);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2409,50 +2343,6 @@ DBGenerateUniqueIds(def, warn)
|
||||||
HashKill(&dbUniqueNameTable);
|
HashKill(&dbUniqueNameTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* DBSelectionUniqueIds --
|
|
||||||
*
|
|
||||||
* This is similar to DBGenerateUniqueIds(), but the purpose is to make
|
|
||||||
* sure that cell IDs in the selection do not collide with IDs in the
|
|
||||||
* definition. This is done before copying from Select2Def back to the
|
|
||||||
* root edit CellDef. Otherwise, any copied cell takes the name of the
|
|
||||||
* original, and the original gets renamed, which is unexpected behavior.
|
|
||||||
* Called only from SelectCopy().
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Side effects:
|
|
||||||
* May modify the use-id's of the cells in the cell plane of 'selDef'.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
DBSelectionUniqueIds(selDef, rootDef)
|
|
||||||
CellDef *selDef; /* Should be Select2Def */
|
|
||||||
CellDef *rootDef; /* Should be EditRootDef */
|
|
||||||
{
|
|
||||||
int dbFindNamesFunc();
|
|
||||||
int dbGenerateUniqueIdsFunc();
|
|
||||||
|
|
||||||
dbWarnUniqueIds = FALSE;
|
|
||||||
HashInit(&dbUniqueDefTable, 32, 1); /* Indexed by (CellDef *) */
|
|
||||||
HashInit(&dbUniqueNameTable, 32, 0); /* Indexed by use-id */
|
|
||||||
|
|
||||||
/* Build up tables of names */
|
|
||||||
DBCellEnum(rootDef, dbFindNamesFunc, (ClientData) rootDef);
|
|
||||||
DBCellEnum(selDef, dbFindNamesFunc, (ClientData) selDef);
|
|
||||||
|
|
||||||
/* Assign unique use-ids to all cells in the selection */
|
|
||||||
DBCellEnum(selDef, dbGenerateUniqueIdsFunc, (ClientData) selDef);
|
|
||||||
|
|
||||||
HashKill(&dbUniqueDefTable);
|
|
||||||
HashKill(&dbUniqueNameTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
@ -2611,7 +2501,7 @@ DBUnLinkCell(use, parentDef)
|
||||||
{
|
{
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
|
|
||||||
if ((he = HashLookOnly(&parentDef->cd_idHash, use->cu_id)))
|
if (he = HashLookOnly(&parentDef->cd_idHash, use->cu_id))
|
||||||
HashSetValue(he, (ClientData) NULL);
|
HashSetValue(he, (ClientData) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,18 +83,16 @@ struct seeTypesArg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
DBSrCellPlaneArea(BPlane *plane, const Rect *rect, int (*func)(), ClientData arg)
|
DBSrCellPlaneArea(BPlane *plane, Rect *rect, int (*func)(), ClientData arg)
|
||||||
{
|
{
|
||||||
BPEnum sbpe;
|
|
||||||
BPEnum *bpe;
|
BPEnum *bpe;
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
int rval = 0;
|
int rval = 0;
|
||||||
|
|
||||||
/* bpe = (BPEnum *)mallocMagic(sizeof(BPEnum)); */
|
bpe = (BPEnum *)mallocMagic(sizeof(BPEnum));
|
||||||
bpe = &sbpe;
|
|
||||||
BPEnumInit(bpe, plane, rect, BPE_OVERLAP, "DBSrCellPlaneArea");
|
BPEnumInit(bpe, plane, rect, BPE_OVERLAP, "DBSrCellPlaneArea");
|
||||||
|
|
||||||
while ((use = BPEnumNext(bpe)))
|
while (use = BPEnumNext(bpe))
|
||||||
{
|
{
|
||||||
if ((*func)(use, arg))
|
if ((*func)(use, arg))
|
||||||
{
|
{
|
||||||
|
|
@ -104,7 +102,7 @@ DBSrCellPlaneArea(BPlane *plane, const Rect *rect, int (*func)(), ClientData arg
|
||||||
}
|
}
|
||||||
|
|
||||||
BPEnumTerm(bpe);
|
BPEnumTerm(bpe);
|
||||||
/* freeMagic(bpe); */
|
freeMagic(bpe);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +118,6 @@ DBSrCellPlaneArea(BPlane *plane, const Rect *rect, int (*func)(), ClientData arg
|
||||||
* int
|
* int
|
||||||
* func(tile, cxp)
|
* func(tile, cxp)
|
||||||
* Tile *tile;
|
* Tile *tile;
|
||||||
* TileType dinfo;
|
|
||||||
* TreeContext *cxp;
|
* TreeContext *cxp;
|
||||||
* {
|
* {
|
||||||
* }
|
* }
|
||||||
|
|
@ -417,7 +414,6 @@ dbCellUniqueTileSrFunc(scx, fp)
|
||||||
* int
|
* int
|
||||||
* func(tile, cxp)
|
* func(tile, cxp)
|
||||||
* Tile *tile;
|
* Tile *tile;
|
||||||
* TileType dinfo;
|
|
||||||
* TreeContext *cxp;
|
* TreeContext *cxp;
|
||||||
* {
|
* {
|
||||||
* }
|
* }
|
||||||
|
|
@ -588,25 +584,6 @@ DBTreeSrLabels(scx, mask, xMask, tpath, flags, func, cdarg)
|
||||||
if (!DBCellRead(def, TRUE, TRUE, NULL))
|
if (!DBCellRead(def, TRUE, TRUE, NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (flags & TF_LABEL_REVERSE_SEARCH)
|
|
||||||
{
|
|
||||||
/* Search children first */
|
|
||||||
filter.tf_func = func;
|
|
||||||
filter.tf_arg = cdarg;
|
|
||||||
filter.tf_mask = mask;
|
|
||||||
filter.tf_xmask = xMask;
|
|
||||||
filter.tf_tpath = tpath;
|
|
||||||
filter.tf_flags = flags;
|
|
||||||
|
|
||||||
scx2 = *scx;
|
|
||||||
if (scx2.scx_area.r_xbot > TiPlaneRect.r_xbot) scx2.scx_area.r_xbot -= 1;
|
|
||||||
if (scx2.scx_area.r_ybot > TiPlaneRect.r_ybot) scx2.scx_area.r_ybot -= 1;
|
|
||||||
if (scx2.scx_area.r_xtop < TiPlaneRect.r_xtop) scx2.scx_area.r_xtop += 1;
|
|
||||||
if (scx2.scx_area.r_ytop < TiPlaneRect.r_ytop) scx2.scx_area.r_ytop += 1;
|
|
||||||
if (DBCellSrArea(&scx2, dbCellLabelSrFunc, (ClientData) &filter))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (lab = def->cd_labels; lab; lab = lab->lab_next)
|
for (lab = def->cd_labels; lab; lab = lab->lab_next)
|
||||||
{
|
{
|
||||||
if (SigInterruptPending) break;
|
if (SigInterruptPending) break;
|
||||||
|
|
@ -659,8 +636,6 @@ DBTreeSrLabels(scx, mask, xMask, tpath, flags, func, cdarg)
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TF_LABEL_REVERSE_SEARCH) return 0; /* children already searched */
|
|
||||||
|
|
||||||
filter.tf_func = func;
|
filter.tf_func = func;
|
||||||
filter.tf_arg = cdarg;
|
filter.tf_arg = cdarg;
|
||||||
filter.tf_mask = mask;
|
filter.tf_mask = mask;
|
||||||
|
|
@ -702,7 +677,7 @@ dbCellLabelSrFunc(scx, fp)
|
||||||
{
|
{
|
||||||
Label *lab;
|
Label *lab;
|
||||||
Rect *r = &scx->scx_area;
|
Rect *r = &scx->scx_area;
|
||||||
const TileTypeBitMask *mask = fp->tf_mask;
|
TileTypeBitMask *mask = fp->tf_mask;
|
||||||
CellDef *def = scx->scx_use->cu_def;
|
CellDef *def = scx->scx_use->cu_def;
|
||||||
char *tnext;
|
char *tnext;
|
||||||
int result;
|
int result;
|
||||||
|
|
@ -732,16 +707,6 @@ dbCellLabelSrFunc(scx, fp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If fp->tf_flags has TF_LABEL_REVERSE_SEARCH, then search child
|
|
||||||
* uses first, then the parent. This is for display, so that if
|
|
||||||
* a child cell and parent cell have overlapping labels, the parent
|
|
||||||
* label is the one on top.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (fp->tf_flags & TF_LABEL_REVERSE_SEARCH)
|
|
||||||
if (DBCellSrArea(scx, dbCellLabelSrFunc, (ClientData) fp))
|
|
||||||
result = 1;
|
|
||||||
|
|
||||||
/* Apply the function first to any of the labels in this def. */
|
/* Apply the function first to any of the labels in this def. */
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
@ -763,11 +728,9 @@ dbCellLabelSrFunc(scx, fp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now visit each child use recursively, if not doing a reverse search */
|
/* Now visit each child use recursively */
|
||||||
|
if (DBCellSrArea(scx, dbCellLabelSrFunc, (ClientData) fp))
|
||||||
if (!(fp->tf_flags & TF_LABEL_REVERSE_SEARCH))
|
result = 1;
|
||||||
if (DBCellSrArea(scx, dbCellLabelSrFunc, (ClientData) fp))
|
|
||||||
result = 1;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
/* Remove the trailing pathname component from the TerminalPath */
|
/* Remove the trailing pathname component from the TerminalPath */
|
||||||
|
|
@ -949,9 +912,8 @@ DBSeeTypesAll(rootUse, rootRect, xMask, mask)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbSeeTypesAllSrFunc(tile, dinfo, cxp)
|
dbSeeTypesAllSrFunc(tile, cxp)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo;
|
|
||||||
TreeContext *cxp;
|
TreeContext *cxp;
|
||||||
{
|
{
|
||||||
Rect tileRect;
|
Rect tileRect;
|
||||||
|
|
@ -962,7 +924,7 @@ dbSeeTypesAllSrFunc(tile, dinfo, cxp)
|
||||||
if (GEO_OVERLAP((&tileRect), area))
|
if (GEO_OVERLAP((&tileRect), area))
|
||||||
{
|
{
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
TTMaskSetType(mask, (dinfo & TT_SIDE) ?
|
TTMaskSetType(mask, SplitSide(tile) ?
|
||||||
SplitRightType(tile) : SplitLeftType(tile));
|
SplitRightType(tile) : SplitLeftType(tile));
|
||||||
else
|
else
|
||||||
TTMaskSetType(mask, TiGetType(tile));
|
TTMaskSetType(mask, TiGetType(tile));
|
||||||
|
|
@ -1552,22 +1514,19 @@ DBScaleEverything(scalen, scaled)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the linked CellDef list */
|
/* Free the linked CellDef list */
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
lcd = lhead;
|
lcd = lhead;
|
||||||
while (lcd != NULL)
|
while (lcd != NULL)
|
||||||
{
|
{
|
||||||
freeMagic1(&mm1, (char *)lcd);
|
freeMagic((char *)lcd);
|
||||||
lcd = lcd->cd_next;
|
lcd = lcd->cd_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
|
|
||||||
/* Scale all elements */
|
/* Scale all elements */
|
||||||
DBWScaleElements(scalen, scaled);
|
DBWScaleElements(scalen, scaled);
|
||||||
|
|
||||||
#ifdef ROUTE_MODULE
|
|
||||||
/* Recovery of global plane pointers */
|
/* Recovery of global plane pointers */
|
||||||
MZAttachHintPlanes();
|
MZAttachHintPlanes();
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Modify root box */
|
/* Modify root box */
|
||||||
ToolScaleBox(scalen, scaled);
|
ToolScaleBox(scalen, scaled);
|
||||||
|
|
@ -1643,9 +1602,8 @@ dbScalePlane(oldplane, newplane, pnum, scalen, scaled, doCIF)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbTileScaleFunc(tile, dinfo, scvals)
|
dbTileScaleFunc(tile, scvals)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo;
|
|
||||||
struct scaleArg *scvals;
|
struct scaleArg *scvals;
|
||||||
{
|
{
|
||||||
TileType type;
|
TileType type;
|
||||||
|
|
@ -1663,20 +1621,17 @@ dbTileScaleFunc(tile, dinfo, scvals)
|
||||||
if ((targetRect.r_xtop - targetRect.r_xbot == 0) ||
|
if ((targetRect.r_xtop - targetRect.r_xbot == 0) ||
|
||||||
(targetRect.r_ytop - targetRect.r_ybot == 0))
|
(targetRect.r_ytop - targetRect.r_ybot == 0))
|
||||||
{
|
{
|
||||||
TxPrintf("Tile %p at (%d, %d) has zero area after scaling: Removed.\n",
|
TxPrintf("Tile 0x%x at (%d, %d) has zero area after scaling: Removed.\n",
|
||||||
(void *) tile, targetRect.r_xbot, targetRect.r_ybot);
|
tile, targetRect.r_xbot, targetRect.r_ybot);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = TiGetTypeExact(tile) | dinfo;
|
type = TiGetTypeExact(tile);
|
||||||
exact = type;
|
exact = type;
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile);
|
type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
DBNMPaintPlane(scvals->ptarget, exact, &targetRect,
|
DBNMPaintPlane(scvals->ptarget, exact, &targetRect,
|
||||||
(
|
((scvals->doCIF) ? CIFPaintTable :
|
||||||
#ifdef CIF_MODULE
|
|
||||||
(scvals->doCIF) ? CIFPaintTable :
|
|
||||||
#endif
|
|
||||||
DBStdPaintTbl(type, scvals->pnum)),
|
DBStdPaintTbl(type, scvals->pnum)),
|
||||||
(PaintUndoInfo *)NULL);
|
(PaintUndoInfo *)NULL);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1726,9 +1681,8 @@ dbMovePlane(oldplane, newplane, pnum, origx, origy)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbTileMoveFunc(tile, dinfo, mvvals)
|
dbTileMoveFunc(tile, mvvals)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo;
|
|
||||||
struct moveArg *mvvals;
|
struct moveArg *mvvals;
|
||||||
{
|
{
|
||||||
TileType type;
|
TileType type;
|
||||||
|
|
@ -1741,12 +1695,12 @@ dbTileMoveFunc(tile, dinfo, mvvals)
|
||||||
DBMovePoint(&targetRect.r_ll, mvvals->origx, mvvals->origy);
|
DBMovePoint(&targetRect.r_ll, mvvals->origx, mvvals->origy);
|
||||||
DBMovePoint(&targetRect.r_ur, mvvals->origx, mvvals->origy);
|
DBMovePoint(&targetRect.r_ur, mvvals->origx, mvvals->origy);
|
||||||
|
|
||||||
type = TiGetTypeExact(tile) | dinfo;
|
type = TiGetTypeExact(tile);
|
||||||
exact = type;
|
exact = type;
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile);
|
type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
DBNMPaintPlane(mvvals->ptarget, exact, &targetRect,
|
DBNMPaintPlane(mvvals->ptarget, exact, &targetRect,
|
||||||
(mvvals->pnum < 0) ? CIFPaintTable : DBStdPaintTbl(type, mvvals->pnum),
|
DBStdPaintTbl(type, mvvals->pnum),
|
||||||
(PaintUndoInfo *)NULL);
|
(PaintUndoInfo *)NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1808,14 +1762,12 @@ DBSrCellUses(cellDef, func, arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free this linked cellUse structure */
|
/* Free this linked cellUse structure */
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
lu = luhead;
|
lu = luhead;
|
||||||
while (lu != NULL)
|
while (lu != NULL)
|
||||||
{
|
{
|
||||||
freeMagic1(&mm1, (char *)lu);
|
freeMagic((char *)lu);
|
||||||
lu = lu->cu_next;
|
lu = lu->cu_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1839,48 +1791,84 @@ typedef struct _cellpropstruct {
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int dbScaleProp(name, proprec, cps)
|
int dbScaleProp(name, value, cps)
|
||||||
char *name;
|
char *name;
|
||||||
PropertyRecord *proprec;
|
char *value;
|
||||||
CellPropStruct *cps;
|
CellPropStruct *cps;
|
||||||
{
|
{
|
||||||
int i, scalen, scaled;
|
int scalen, scaled;
|
||||||
Point p;
|
char *newvalue, *vptr;
|
||||||
|
Rect r;
|
||||||
|
|
||||||
/* Only "dimension" and "plane" type properties get scaled */
|
if ((strlen(name) > 5) && !strncmp(name + strlen(name) - 5, "_BBOX", 5))
|
||||||
|
|
||||||
if (proprec->prop_type == PROPERTY_TYPE_PLANE)
|
|
||||||
{
|
{
|
||||||
Plane *newplane;
|
if (sscanf(value, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||||
newplane = DBNewPlane((ClientData)TT_SPACE);
|
&r.r_xtop, &r.r_ytop) == 4)
|
||||||
DBClearPaintPlane(newplane);
|
{
|
||||||
/* Plane index is unused; arbitrarily substitute -1 */
|
/* Scale numerator held in point X value, */
|
||||||
dbScalePlane(proprec->prop_value.prop_plane, newplane, -1,
|
/* scale denominator held in point Y value */
|
||||||
scalen, scaled, TRUE);
|
|
||||||
DBFreePaintPlane(proprec->prop_value.prop_plane);
|
scalen = cps->cps_point.p_x;
|
||||||
TiFreePlane(proprec->prop_value.prop_plane);
|
scaled = cps->cps_point.p_y;
|
||||||
proprec->prop_value.prop_plane = newplane;
|
|
||||||
return 0;
|
DBScalePoint(&r.r_ll, scalen, scaled);
|
||||||
|
DBScalePoint(&r.r_ur, scalen, scaled);
|
||||||
|
|
||||||
|
newvalue = (char *)mallocMagic(40);
|
||||||
|
sprintf(newvalue, "%d %d %d %d", r.r_xbot, r.r_ybot,
|
||||||
|
r.r_xtop, r.r_ytop);
|
||||||
|
DBPropPut(cps->cps_def, name, newvalue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (!strncmp(name, "MASKHINTS_", 10))
|
||||||
if (proprec->prop_type != PROPERTY_TYPE_DIMENSION) return 0;
|
|
||||||
|
|
||||||
/* Scale numerator held in point X value, */
|
|
||||||
/* scale denominator held in point Y value */
|
|
||||||
scalen = cps->cps_point.p_x;
|
|
||||||
scaled = cps->cps_point.p_y;
|
|
||||||
|
|
||||||
for (i = 0; i < proprec->prop_len; i += 2)
|
|
||||||
{
|
{
|
||||||
if ((i + 1) >= proprec->prop_len) break;
|
char *vptr, *lastval;
|
||||||
|
int lastlen;
|
||||||
|
|
||||||
p.p_x = proprec->prop_value.prop_integer[i];
|
newvalue = (char *)NULL;
|
||||||
p.p_y = proprec->prop_value.prop_integer[i + 1];
|
vptr = value;
|
||||||
DBScalePoint(&p, scalen, scaled);
|
while (*vptr != '\0')
|
||||||
proprec->prop_value.prop_integer[i] = p.p_x;
|
{
|
||||||
proprec->prop_value.prop_integer[i + 1] = p.p_y;
|
if (sscanf(vptr, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||||
|
&r.r_xtop, &r.r_ytop) == 4)
|
||||||
|
{
|
||||||
|
/* Scale numerator held in point X value, */
|
||||||
|
/* scale denominator held in point Y value */
|
||||||
|
|
||||||
|
scalen = cps->cps_point.p_x;
|
||||||
|
scaled = cps->cps_point.p_y;
|
||||||
|
|
||||||
|
DBScalePoint(&r.r_ll, scalen, scaled);
|
||||||
|
DBScalePoint(&r.r_ur, scalen, scaled);
|
||||||
|
|
||||||
|
lastval = newvalue;
|
||||||
|
lastlen = (lastval) ? strlen(lastval) : 0;
|
||||||
|
newvalue = mallocMagic(40 + lastlen);
|
||||||
|
|
||||||
|
if (lastval)
|
||||||
|
strcpy(newvalue, lastval);
|
||||||
|
else
|
||||||
|
*newvalue = '\0';
|
||||||
|
|
||||||
|
sprintf(newvalue + lastlen, "%s%d %d %d %d", (lastval) ? " " : "",
|
||||||
|
r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop);
|
||||||
|
if (lastval) freeMagic(lastval);
|
||||||
|
|
||||||
|
/* Parse through the four values and check if there's more */
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
if (newvalue)
|
||||||
|
DBPropPut(cps->cps_def, name, newvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; /* Keep enumerating through properties */
|
return 0; /* Keep enumerating through properties */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1896,47 +1884,33 @@ int dbScaleProp(name, proprec, cps)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int dbMoveProp(name, proprec, cps)
|
int dbMoveProp(name, value, cps)
|
||||||
char *name;
|
char *name;
|
||||||
PropertyRecord *proprec;
|
char *value;
|
||||||
CellPropStruct *cps;
|
CellPropStruct *cps;
|
||||||
{
|
{
|
||||||
int i, origx, origy;
|
int origx, origy;
|
||||||
char *newvalue;
|
char *newvalue;
|
||||||
Point p;
|
Rect r;
|
||||||
|
|
||||||
/* Only "dimension" and "plane" type properties get scaled */
|
if (((strlen(name) > 5) && !strncmp(name + strlen(name) - 5, "_BBOX", 5))
|
||||||
|
|| !strncmp(name, "MASKHINTS_", 10))
|
||||||
if (proprec->prop_type == PROPERTY_TYPE_PLANE)
|
|
||||||
{
|
{
|
||||||
Plane *newplane;
|
if (sscanf(value, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||||
|
&r.r_xtop, &r.r_ytop) == 4)
|
||||||
|
{
|
||||||
|
origx = cps->cps_point.p_x;
|
||||||
|
origy = cps->cps_point.p_y;
|
||||||
|
|
||||||
newplane = DBNewPlane((ClientData) TT_SPACE);
|
DBMovePoint(&r.r_ll, origx, origy);
|
||||||
DBClearPaintPlane(newplane);
|
DBMovePoint(&r.r_ur, origx, origy);
|
||||||
/* Use plane index -1 to indicate use of CIFPaintTable */
|
|
||||||
dbMovePlane(proprec->prop_value.prop_plane, newplane, -1, origx, origy);
|
newvalue = (char *)mallocMagic(40);
|
||||||
DBFreePaintPlane(proprec->prop_value.prop_plane);
|
sprintf(newvalue, "%d %d %d %d", r.r_xbot, r.r_ybot,
|
||||||
TiFreePlane(proprec->prop_value.prop_plane);
|
r.r_xtop, r.r_ytop);
|
||||||
proprec->prop_value.prop_plane = newplane;
|
DBPropPut(cps->cps_def, name, newvalue);
|
||||||
return 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proprec->prop_type != PROPERTY_TYPE_DIMENSION) return 0;
|
|
||||||
|
|
||||||
origx = cps->cps_point.p_x;
|
|
||||||
origy = cps->cps_point.p_y;
|
|
||||||
|
|
||||||
for (i = 0; i < proprec->prop_len; i += 2)
|
|
||||||
{
|
|
||||||
if ((i + 1) >= proprec->prop_len) break;
|
|
||||||
|
|
||||||
p.p_x = proprec->prop_value.prop_integer[i];
|
|
||||||
p.p_y = proprec->prop_value.prop_integer[i + 1];
|
|
||||||
DBMovePoint(&p, origx, origy);
|
|
||||||
proprec->prop_value.prop_integer[i] = p.p_x;
|
|
||||||
proprec->prop_value.prop_integer[i + 1] = p.p_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0; /* Keep enumerating through properties */
|
return 0; /* Keep enumerating through properties */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2021,14 +1995,12 @@ dbScaleCell(cellDef, scalen, scaled)
|
||||||
BPFree(cellPlaneOrig);
|
BPFree(cellPlaneOrig);
|
||||||
|
|
||||||
/* Free this linked cellUse structure */
|
/* Free this linked cellUse structure */
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
lu = luhead;
|
lu = luhead;
|
||||||
while (lu != NULL)
|
while (lu != NULL)
|
||||||
{
|
{
|
||||||
freeMagic1(&mm1, (char *)lu);
|
freeMagic((char *)lu);
|
||||||
lu = lu->cu_next;
|
lu = lu->cu_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
|
|
||||||
/* Scale all of the paint tiles in this cell by creating a new plane */
|
/* Scale all of the paint tiles in this cell by creating a new plane */
|
||||||
/* and copying all tiles into the new plane at scaled dimensions. */
|
/* and copying all tiles into the new plane at scaled dimensions. */
|
||||||
|
|
@ -2080,16 +2052,38 @@ donecell:
|
||||||
DBScalePoint(&cellDef->cd_extended.r_ll, scalen, scaled);
|
DBScalePoint(&cellDef->cd_extended.r_ll, scalen, scaled);
|
||||||
DBScalePoint(&cellDef->cd_extended.r_ur, scalen, scaled);
|
DBScalePoint(&cellDef->cd_extended.r_ur, scalen, scaled);
|
||||||
|
|
||||||
|
/* If the cell is an abstract view with a fixed bounding box, then */
|
||||||
|
/* adjust the bounding box property to match the new scale. */
|
||||||
|
|
||||||
|
if ((cellDef->cd_flags & CDFIXEDBBOX) != 0)
|
||||||
|
{
|
||||||
|
Rect r;
|
||||||
|
bool found;
|
||||||
|
char *propval;
|
||||||
|
|
||||||
|
propval = (char *)DBPropGet(cellDef, "FIXED_BBOX", &found);
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
if (sscanf(propval, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||||
|
&r.r_xtop, &r.r_ytop) == 4)
|
||||||
|
{
|
||||||
|
DBScalePoint(&r.r_ll, scalen, scaled);
|
||||||
|
DBScalePoint(&r.r_ur, scalen, scaled);
|
||||||
|
|
||||||
|
propval = (char *)mallocMagic(40);
|
||||||
|
sprintf(propval, "%d %d %d %d", r.r_xbot, r.r_ybot,
|
||||||
|
r.r_xtop, r.r_ytop);
|
||||||
|
DBPropPut(cellDef, "FIXED_BBOX", propval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Check all properties for ones with keys beginning with "MASKHINTS_"
|
/* Check all properties for ones with keys beginning with "MASKHINTS_"
|
||||||
* or ending with "_BBOX", and scale them by the same amount as all
|
* or ending with "_BBOX", and scale them by the same amount as all
|
||||||
* the geometry.
|
* the geometry.
|
||||||
*
|
|
||||||
* Note: This would be better handled if there were a special type
|
|
||||||
* for properties which are coordinates; currently the only property
|
|
||||||
* type is a string, thus requiring the string to be parsed every time
|
|
||||||
* the coordinates are needed.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
cps.cps_point.p_x = scalen;
|
cps.cps_point.p_x = scalen;
|
||||||
cps.cps_point.p_y = scaled;
|
cps.cps_point.p_y = scaled;
|
||||||
cps.cps_def = cellDef;
|
cps.cps_def = cellDef;
|
||||||
|
|
@ -2231,14 +2225,12 @@ DBMoveCell(cellDef, origx, origy)
|
||||||
BPFree(cellPlaneOrig);
|
BPFree(cellPlaneOrig);
|
||||||
|
|
||||||
/* Free this linked cellUse structure */
|
/* Free this linked cellUse structure */
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
lu = luhead;
|
lu = luhead;
|
||||||
while (lu != NULL)
|
while (lu != NULL)
|
||||||
{
|
{
|
||||||
freeMagic1(&mm1, (char *)lu);
|
freeMagic((char *)lu);
|
||||||
lu = lu->cu_next;
|
lu = lu->cu_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
|
|
||||||
/* Move all of the paint tiles in this cell by creating a new plane */
|
/* Move all of the paint tiles in this cell by creating a new plane */
|
||||||
/* and copying all tiles into the new plane at the new position. */
|
/* and copying all tiles into the new plane at the new position. */
|
||||||
|
|
@ -2249,7 +2241,7 @@ DBMoveCell(cellDef, origx, origy)
|
||||||
newplane = DBNewPlane((ClientData) TT_SPACE);
|
newplane = DBNewPlane((ClientData) TT_SPACE);
|
||||||
DBClearPaintPlane(newplane);
|
DBClearPaintPlane(newplane);
|
||||||
if (dbMovePlane(cellDef->cd_planes[pNum], newplane, pNum,
|
if (dbMovePlane(cellDef->cd_planes[pNum], newplane, pNum,
|
||||||
origx, origy))
|
origx, origy, FALSE))
|
||||||
cellDef->cd_flags |= (CDMODIFIED | CDGETNEWSTAMP);
|
cellDef->cd_flags |= (CDMODIFIED | CDGETNEWSTAMP);
|
||||||
DBFreePaintPlane(cellDef->cd_planes[pNum]);
|
DBFreePaintPlane(cellDef->cd_planes[pNum]);
|
||||||
TiFreePlane(cellDef->cd_planes[pNum]);
|
TiFreePlane(cellDef->cd_planes[pNum]);
|
||||||
|
|
|
||||||
|
|
@ -218,10 +218,8 @@ DBCellClearDef(cellDef)
|
||||||
cellDef->cd_bbox.r_xtop = cellDef->cd_bbox.r_ytop = 1;
|
cellDef->cd_bbox.r_xtop = cellDef->cd_bbox.r_ytop = 1;
|
||||||
cellDef->cd_extended.r_xbot = cellDef->cd_extended.r_ybot = 0;
|
cellDef->cd_extended.r_xbot = cellDef->cd_extended.r_ybot = 0;
|
||||||
cellDef->cd_extended.r_xtop = cellDef->cd_extended.r_ytop = 1;
|
cellDef->cd_extended.r_xtop = cellDef->cd_extended.r_ytop = 1;
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (lab = cellDef->cd_labels; lab; lab = lab->lab_next)
|
for (lab = cellDef->cd_labels; lab; lab = lab->lab_next)
|
||||||
freeMagic1(&mm1, (char *) lab);
|
freeMagic((char *) lab);
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
cellDef->cd_labels = (Label *) NULL;
|
cellDef->cd_labels = (Label *) NULL;
|
||||||
cellDef->cd_lastLabel = (Label *) NULL;
|
cellDef->cd_lastLabel = (Label *) NULL;
|
||||||
|
|
||||||
|
|
@ -264,7 +262,7 @@ DBClearPaintPlane(plane)
|
||||||
|
|
||||||
/* Allocate a new central space tile */
|
/* Allocate a new central space tile */
|
||||||
newCenterTile = TiAlloc();
|
newCenterTile = TiAlloc();
|
||||||
PlaneSetHint(plane, newCenterTile);
|
plane->pl_hint = newCenterTile;
|
||||||
TiSetBody(newCenterTile, TT_SPACE);
|
TiSetBody(newCenterTile, TT_SPACE);
|
||||||
dbSetPlaneTile(plane, newCenterTile);
|
dbSetPlaneTile(plane, newCenterTile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,86 @@ DBInvTransformDiagonal(oldtype, trans)
|
||||||
return dinfo;
|
return dinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* DBSrConnectOnePlane --
|
||||||
|
*
|
||||||
|
* Search from a starting tile to find all paint that is electrically
|
||||||
|
* connected to that tile in the same plane.
|
||||||
|
*
|
||||||
|
* Results:
|
||||||
|
* 0 is returned if the search finished normally. 1 is returned
|
||||||
|
* if the search was aborted.
|
||||||
|
*
|
||||||
|
* Side effects:
|
||||||
|
* For every paint tile that is electrically connected to the initial
|
||||||
|
* tile, func is called. Func should have the following form:
|
||||||
|
*
|
||||||
|
* int
|
||||||
|
* func(tile, clientData)
|
||||||
|
* Tile *tile;
|
||||||
|
* ClientData clientData;
|
||||||
|
* {
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* The clientData passed to func is the same one that was passed
|
||||||
|
* to us. Func returns 0 under normal conditions; if it returns
|
||||||
|
* 1 then the search is aborted.
|
||||||
|
*
|
||||||
|
* *** WARNING ***
|
||||||
|
*
|
||||||
|
* Func should not modify any paint during the search, since this
|
||||||
|
* will mess up pointers kept by these procedures and likely cause
|
||||||
|
* a core-dump.
|
||||||
|
*
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
DBSrConnectOnePlane(startTile, connect, func, clientData)
|
||||||
|
Tile *startTile; /* Starting tile for search */
|
||||||
|
TileTypeBitMask *connect; /* Pointer to a table indicating what tile
|
||||||
|
* types connect to what other tile types.
|
||||||
|
* Each entry gives a mask of types that
|
||||||
|
* connect to tiles of a given type.
|
||||||
|
*/
|
||||||
|
int (*func)(); /* Function to apply at each connected tile. */
|
||||||
|
ClientData clientData; /* Client data for above function. */
|
||||||
|
|
||||||
|
{
|
||||||
|
struct conSrArg csa;
|
||||||
|
int result;
|
||||||
|
extern int dbSrConnectFunc(); /* Forward declaration. */
|
||||||
|
|
||||||
|
result = 0;
|
||||||
|
csa.csa_def = (CellDef *)NULL;
|
||||||
|
csa.csa_bounds = TiPlaneRect;
|
||||||
|
|
||||||
|
/* Pass 1. During this pass the client function gets called. */
|
||||||
|
|
||||||
|
csa.csa_clientFunc = func;
|
||||||
|
csa.csa_clientData = clientData;
|
||||||
|
csa.csa_clientDefault = startTile->ti_client;
|
||||||
|
csa.csa_clear = FALSE;
|
||||||
|
csa.csa_connect = connect;
|
||||||
|
csa.csa_pNum = -1;
|
||||||
|
if (dbSrConnectFunc(startTile, &csa) != 0) result = 1;
|
||||||
|
|
||||||
|
/* Pass 2. Don't call any client function, just clear the marks.
|
||||||
|
* Don't allow any interruptions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
SigDisableInterrupts();
|
||||||
|
csa.csa_clientFunc = NULL;
|
||||||
|
csa.csa_clear = TRUE;
|
||||||
|
(void) dbSrConnectFunc(startTile, &csa);
|
||||||
|
SigEnableInterrupts();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
@ -197,7 +277,9 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData)
|
||||||
{
|
{
|
||||||
struct conSrArg csa;
|
struct conSrArg csa;
|
||||||
int startPlane, result;
|
int startPlane, result;
|
||||||
TileAndDinfo start_tad; /* Starting tile and split information */
|
Tile *startTile; /* Starting tile for search. */
|
||||||
|
extern int dbSrConnectFunc(); /* Forward declaration. */
|
||||||
|
extern int dbSrConnectStartFunc();
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
csa.csa_def = def;
|
csa.csa_def = def;
|
||||||
|
|
@ -208,18 +290,17 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData)
|
||||||
* the tile address and returns.
|
* the tile address and returns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
start_tad.tad_tile = NULL;
|
startTile = NULL;
|
||||||
start_tad.tad_next = NULL; /* unused */
|
|
||||||
for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++)
|
for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++)
|
||||||
{
|
{
|
||||||
csa.csa_pNum = startPlane;
|
csa.csa_pNum = startPlane;
|
||||||
if (DBSrPaintArea((Tile *) NULL,
|
if (DBSrPaintArea((Tile *) NULL,
|
||||||
def->cd_planes[startPlane], startArea, mask,
|
def->cd_planes[startPlane], startArea, mask,
|
||||||
dbSrConnectStartFunc, PTR2CD(&start_tad)) != 0) break;
|
dbSrConnectStartFunc, (ClientData) &startTile) != 0) break;
|
||||||
}
|
}
|
||||||
if (start_tad.tad_tile == NULL) return 0;
|
if (startTile == NULL) return 0;
|
||||||
/* The following lets us call DBSrConnect recursively */
|
/* The following lets us call DBSrConnect recursively */
|
||||||
else if (start_tad.tad_tile->ti_client == (ClientData)1) return 0;
|
else if (startTile->ti_client == (ClientData)1) return 0;
|
||||||
|
|
||||||
/* Pass 1. During this pass the client function gets called. */
|
/* Pass 1. During this pass the client function gets called. */
|
||||||
|
|
||||||
|
|
@ -228,8 +309,7 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData)
|
||||||
csa.csa_clientDefault = CLIENTDEFAULT;
|
csa.csa_clientDefault = CLIENTDEFAULT;
|
||||||
csa.csa_clear = FALSE;
|
csa.csa_clear = FALSE;
|
||||||
csa.csa_connect = connect;
|
csa.csa_connect = connect;
|
||||||
if (dbSrConnectFunc(start_tad.tad_tile, start_tad.tad_dinfo,
|
if (dbSrConnectFunc(startTile, &csa) != 0) result = 1;
|
||||||
PTR2CD(&csa)) != 0) result = 1;
|
|
||||||
|
|
||||||
/* Pass 2. Don't call any client function, just clear the marks.
|
/* Pass 2. Don't call any client function, just clear the marks.
|
||||||
* Don't allow any interruptions.
|
* Don't allow any interruptions.
|
||||||
|
|
@ -238,22 +318,18 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData)
|
||||||
SigDisableInterrupts();
|
SigDisableInterrupts();
|
||||||
csa.csa_clientFunc = NULL;
|
csa.csa_clientFunc = NULL;
|
||||||
csa.csa_clear = TRUE;
|
csa.csa_clear = TRUE;
|
||||||
(void) dbSrConnectFunc(start_tad.tad_tile, start_tad.tad_dinfo, PTR2CD(&csa));
|
(void) dbSrConnectFunc(startTile, &csa);
|
||||||
SigEnableInterrupts();
|
SigEnableInterrupts();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @typedef cb_database_srpaintarea_t */
|
|
||||||
int
|
int
|
||||||
dbSrConnectStartFunc(
|
dbSrConnectStartFunc(tile, pTile)
|
||||||
Tile *tile, /* This will be the starting tile. */
|
Tile *tile; /* This will be the starting tile. */
|
||||||
TileType dinfo, /* (unused) */
|
Tile **pTile; /* We store tile's address here. */
|
||||||
ClientData cdata) /* We store tile and split info here. */
|
|
||||||
{
|
{
|
||||||
TileAndDinfo *tad = (TileAndDinfo *)CD2PTR(cdata);
|
*pTile = tile;
|
||||||
tad->tad_tile = tile;
|
|
||||||
tad->tad_dinfo = dinfo;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,7 +367,9 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData)
|
||||||
{
|
{
|
||||||
struct conSrArg csa;
|
struct conSrArg csa;
|
||||||
int startPlane, result;
|
int startPlane, result;
|
||||||
TileAndDinfo tad;
|
Tile *startTile; /* Starting tile for search. */
|
||||||
|
extern int dbSrConnectFunc(); /* Forward declaration. */
|
||||||
|
extern int dbSrConnectStartFunc();
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
csa.csa_def = def;
|
csa.csa_def = def;
|
||||||
|
|
@ -302,18 +380,17 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData)
|
||||||
* the tile address and returns.
|
* the tile address and returns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tad.tad_tile = NULL;
|
startTile = NULL;
|
||||||
tad.tad_next = NULL; /* unused */
|
|
||||||
for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++)
|
for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++)
|
||||||
{
|
{
|
||||||
csa.csa_pNum = startPlane;
|
csa.csa_pNum = startPlane;
|
||||||
if (DBSrPaintArea((Tile *) NULL,
|
if (DBSrPaintArea((Tile *) NULL,
|
||||||
def->cd_planes[startPlane], startArea, mask,
|
def->cd_planes[startPlane], startArea, mask,
|
||||||
dbSrConnectStartFunc, PTR2CD(&tad)) != 0) break;
|
dbSrConnectStartFunc, (ClientData) &startTile) != 0) break;
|
||||||
}
|
}
|
||||||
if (tad.tad_tile == NULL) return 0;
|
if (startTile == NULL) return 0;
|
||||||
/* The following lets us call DBSrConnect recursively */
|
/* The following lets us call DBSrConnect recursively */
|
||||||
else if (tad.tad_tile->ti_client == (ClientData)1) return 0;
|
else if (startTile->ti_client == (ClientData)1) return 0;
|
||||||
|
|
||||||
/* Pass 1. During this pass the client function gets called. */
|
/* Pass 1. During this pass the client function gets called. */
|
||||||
|
|
||||||
|
|
@ -322,7 +399,7 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData)
|
||||||
csa.csa_clientDefault = CLIENTDEFAULT;
|
csa.csa_clientDefault = CLIENTDEFAULT;
|
||||||
csa.csa_clear = FALSE;
|
csa.csa_clear = FALSE;
|
||||||
csa.csa_connect = connect;
|
csa.csa_connect = connect;
|
||||||
if (dbSrConnectFunc(tad.tad_tile, tad.tad_dinfo, PTR2CD(&csa)) != 0) result = 1;
|
if (dbSrConnectFunc(startTile, &csa) != 0) result = 1;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -345,15 +422,12 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbcFindTileFunc(tile, dinfo, arg)
|
dbcFindTileFunc(tile, arg)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo;
|
|
||||||
ClientData arg;
|
ClientData arg;
|
||||||
{
|
{
|
||||||
TileAndDinfo *tad = (TileAndDinfo *)arg;
|
Tile **tptr = (Tile **)arg;
|
||||||
|
*tptr = tile;
|
||||||
tad->tad_tile = tile;
|
|
||||||
tad->tad_dinfo = dinfo;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,19 +465,16 @@ dbcFindTileFunc(tile, dinfo, arg)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbSrConnectFunc(
|
dbSrConnectFunc(tile, csa)
|
||||||
Tile *tile, /* Tile that is connected. */
|
Tile *tile; /* Tile that is connected. */
|
||||||
TileType dinfo, /* Split tile information */
|
struct conSrArg *csa; /* Contains information about the search. */
|
||||||
ClientData cdata) /* Contains information about the search. */
|
|
||||||
/* (struct conSrArg *csa) */
|
|
||||||
{
|
{
|
||||||
struct conSrArg *csa = (struct conSrArg *)CD2PTR(cdata);
|
|
||||||
Tile *t2;
|
Tile *t2;
|
||||||
Rect tileArea;
|
Rect tileArea;
|
||||||
int i, pNum;
|
int i, pNum;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
bool callClient;
|
bool callClient;
|
||||||
const TileTypeBitMask *connectMask;
|
TileTypeBitMask *connectMask;
|
||||||
TileType loctype, checktype;
|
TileType loctype, checktype;
|
||||||
PlaneMask planes;
|
PlaneMask planes;
|
||||||
|
|
||||||
|
|
@ -412,15 +483,13 @@ dbSrConnectFunc(
|
||||||
|
|
||||||
/* Drop the first entry on the stack */
|
/* Drop the first entry on the stack */
|
||||||
pNum = csa->csa_pNum;
|
pNum = csa->csa_pNum;
|
||||||
STACKPUSH(INT2CD(tile), dbConnectStack);
|
STACKPUSH((ClientData)tile, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(dinfo), dbConnectStack);
|
STACKPUSH((ClientData)pNum, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(pNum), dbConnectStack);
|
|
||||||
|
|
||||||
while (!StackEmpty(dbConnectStack))
|
while (!StackEmpty(dbConnectStack))
|
||||||
{
|
{
|
||||||
pNum = (int)CD2INT(STACKPOP(dbConnectStack));
|
pNum = (int)STACKPOP(dbConnectStack);
|
||||||
dinfo = (int)CD2INT(STACKPOP(dbConnectStack));
|
tile = (Tile *)STACKPOP(dbConnectStack);
|
||||||
tile = (Tile *)CD2INT(STACKPOP(dbConnectStack));
|
|
||||||
if (result == 1) continue;
|
if (result == 1) continue;
|
||||||
|
|
||||||
TiToRect(tile, &tileArea);
|
TiToRect(tile, &tileArea);
|
||||||
|
|
@ -453,7 +522,7 @@ dbSrConnectFunc(
|
||||||
|
|
||||||
if (callClient && (csa->csa_clientFunc != NULL))
|
if (callClient && (csa->csa_clientFunc != NULL))
|
||||||
{
|
{
|
||||||
if ((*csa->csa_clientFunc)(tile, dinfo, pNum, csa->csa_clientData) != 0)
|
if ((*csa->csa_clientFunc)(tile, pNum, csa->csa_clientData) != 0)
|
||||||
{
|
{
|
||||||
result = 1;
|
result = 1;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -467,7 +536,7 @@ dbSrConnectFunc(
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
if (dinfo & TT_SIDE)
|
if (SplitSide(tile))
|
||||||
loctype = SplitRightType(tile);
|
loctype = SplitRightType(tile);
|
||||||
else
|
else
|
||||||
loctype = SplitLeftType(tile);
|
loctype = SplitLeftType(tile);
|
||||||
|
|
@ -478,7 +547,7 @@ dbSrConnectFunc(
|
||||||
|
|
||||||
/* Left side: */
|
/* Left side: */
|
||||||
|
|
||||||
if (IsSplit(tile) && (dinfo & TT_SIDE)) goto bottomside;
|
if (IsSplit(tile) && SplitSide(tile)) goto bottomside;
|
||||||
|
|
||||||
for (t2 = BL(tile); BOTTOM(t2) < tileArea.r_ytop; t2 = RT(t2))
|
for (t2 = BL(tile); BOTTOM(t2) < tileArea.r_ytop; t2 = RT(t2))
|
||||||
{
|
{
|
||||||
|
|
@ -495,19 +564,17 @@ dbSrConnectFunc(
|
||||||
if (t2->ti_client == csa->csa_clientDefault) continue;
|
if (t2->ti_client == csa->csa_clientDefault) continue;
|
||||||
}
|
}
|
||||||
else if (t2->ti_client == (ClientData) 1) continue;
|
else if (t2->ti_client == (ClientData) 1) continue;
|
||||||
STACKPUSH(INT2CD(t2), dbConnectStack);
|
|
||||||
if (IsSplit(t2))
|
if (IsSplit(t2))
|
||||||
STACKPUSH(INT2CD((TileType)TT_SIDE), dbConnectStack);
|
TiSetBody(t2, (ClientData)(t2->ti_body | TT_SIDE)); /* bit set */
|
||||||
else
|
STACKPUSH((ClientData)t2, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(0), dbConnectStack);
|
STACKPUSH((ClientData)pNum, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(pNum), dbConnectStack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bottom side: */
|
/* Bottom side: */
|
||||||
|
|
||||||
bottomside:
|
bottomside:
|
||||||
if (IsSplit(tile) && ((!((dinfo & TT_SIDE) ? 1 : 0)) ^ SplitDirection(tile)))
|
if (IsSplit(tile) && (!(SplitSide(tile) ^ SplitDirection(tile))))
|
||||||
goto rightside;
|
goto rightside;
|
||||||
|
|
||||||
for (t2 = LB(tile); LEFT(t2) < tileArea.r_xtop; t2 = TR(t2))
|
for (t2 = LB(tile); LEFT(t2) < tileArea.r_xtop; t2 = TR(t2))
|
||||||
|
|
@ -525,25 +592,24 @@ bottomside:
|
||||||
if (t2->ti_client == csa->csa_clientDefault) continue;
|
if (t2->ti_client == csa->csa_clientDefault) continue;
|
||||||
}
|
}
|
||||||
else if (t2->ti_client == (ClientData) 1) continue;
|
else if (t2->ti_client == (ClientData) 1) continue;
|
||||||
STACKPUSH(INT2CD(t2), dbConnectStack);
|
|
||||||
if (IsSplit(t2))
|
if (IsSplit(t2))
|
||||||
{
|
{
|
||||||
if (SplitDirection(t2))
|
if (SplitDirection(t2))
|
||||||
STACKPUSH(INT2CD((TileType)TT_SIDE), dbConnectStack);
|
/* bit set */
|
||||||
|
TiSetBody(t2, (ClientData)(t2->ti_body | TT_SIDE));
|
||||||
else
|
else
|
||||||
/* bit clear */
|
/* bit clear */
|
||||||
STACKPUSH(INT2CD(0), dbConnectStack);
|
TiSetBody(t2, (ClientData)(t2->ti_body & ~TT_SIDE));
|
||||||
}
|
}
|
||||||
else
|
STACKPUSH((ClientData)t2, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(0), dbConnectStack);
|
STACKPUSH((ClientData)pNum, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(pNum), dbConnectStack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Right side: */
|
/* Right side: */
|
||||||
|
|
||||||
rightside:
|
rightside:
|
||||||
if (IsSplit(tile) && !(dinfo & TT_SIDE)) goto topside;
|
if (IsSplit(tile) && !SplitSide(tile)) goto topside;
|
||||||
|
|
||||||
for (t2 = TR(tile); ; t2 = LB(t2))
|
for (t2 = TR(tile); ; t2 = LB(t2))
|
||||||
{
|
{
|
||||||
|
|
@ -560,9 +626,10 @@ rightside:
|
||||||
if (t2->ti_client == csa->csa_clientDefault) goto nextRight;
|
if (t2->ti_client == csa->csa_clientDefault) goto nextRight;
|
||||||
}
|
}
|
||||||
else if (t2->ti_client == (ClientData) 1) goto nextRight;
|
else if (t2->ti_client == (ClientData) 1) goto nextRight;
|
||||||
STACKPUSH(INT2CD(t2), dbConnectStack);
|
if (IsSplit(t2))
|
||||||
STACKPUSH(INT2CD(0), dbConnectStack);
|
TiSetBody(t2, (ClientData)(t2->ti_body & ~TT_SIDE)); /* bit clear */
|
||||||
STACKPUSH(INT2CD(pNum), dbConnectStack);
|
STACKPUSH((ClientData)t2, dbConnectStack);
|
||||||
|
STACKPUSH((ClientData)pNum, dbConnectStack);
|
||||||
}
|
}
|
||||||
nextRight: if (BOTTOM(t2) <= tileArea.r_ybot) break;
|
nextRight: if (BOTTOM(t2) <= tileArea.r_ybot) break;
|
||||||
}
|
}
|
||||||
|
|
@ -570,8 +637,7 @@ rightside:
|
||||||
/* Top side: */
|
/* Top side: */
|
||||||
topside:
|
topside:
|
||||||
|
|
||||||
if (IsSplit(tile) && (((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile)))
|
if (IsSplit(tile) && (SplitSide(tile) ^ SplitDirection(tile))) goto donesides;
|
||||||
goto donesides;
|
|
||||||
|
|
||||||
for (t2 = RT(tile); ; t2 = BL(t2))
|
for (t2 = RT(tile); ; t2 = BL(t2))
|
||||||
{
|
{
|
||||||
|
|
@ -588,19 +654,17 @@ topside:
|
||||||
if (t2->ti_client == csa->csa_clientDefault) goto nextTop;
|
if (t2->ti_client == csa->csa_clientDefault) goto nextTop;
|
||||||
}
|
}
|
||||||
else if (t2->ti_client == (ClientData) 1) goto nextTop;
|
else if (t2->ti_client == (ClientData) 1) goto nextTop;
|
||||||
STACKPUSH(INT2CD(t2), dbConnectStack);
|
|
||||||
if (IsSplit(t2))
|
if (IsSplit(t2))
|
||||||
{
|
{
|
||||||
if (SplitDirection(t2))
|
if (SplitDirection(t2))
|
||||||
/* bit clear */
|
/* bit clear */
|
||||||
STACKPUSH(INT2CD(0), dbConnectStack);
|
TiSetBody(t2, (ClientData)(t2->ti_body & ~TT_SIDE));
|
||||||
else
|
else
|
||||||
/* bit set */
|
/* bit set */
|
||||||
STACKPUSH(INT2CD((TileType)TT_SIDE), dbConnectStack);
|
TiSetBody(t2, (ClientData)(t2->ti_body | TT_SIDE));
|
||||||
}
|
}
|
||||||
else
|
STACKPUSH((ClientData)t2, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(0), dbConnectStack);
|
STACKPUSH((ClientData)pNum, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(pNum), dbConnectStack);
|
|
||||||
}
|
}
|
||||||
nextTop: if (LEFT(t2) <= tileArea.r_xbot) break;
|
nextTop: if (LEFT(t2) <= tileArea.r_xbot) break;
|
||||||
}
|
}
|
||||||
|
|
@ -618,7 +682,6 @@ donesides:
|
||||||
{
|
{
|
||||||
Rect newArea;
|
Rect newArea;
|
||||||
GEO_EXPAND(&tileArea, 1, &newArea);
|
GEO_EXPAND(&tileArea, 1, &newArea);
|
||||||
TileAndDinfo tad;
|
|
||||||
|
|
||||||
for (i = PL_TECHDEPBASE; i < DBNumPlanes; i++)
|
for (i = PL_TECHDEPBASE; i < DBNumPlanes; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -626,21 +689,19 @@ donesides:
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
if (DBSrPaintNMArea((Tile *) NULL, csa->csa_def->cd_planes[i],
|
if (DBSrPaintNMArea((Tile *) NULL, csa->csa_def->cd_planes[i],
|
||||||
TiGetTypeExact(tile) | dinfo, &newArea, connectMask,
|
TiGetTypeExact(tile), &newArea, connectMask,
|
||||||
dbcFindTileFunc, (ClientData)&tad) != 0)
|
dbcFindTileFunc, (ClientData)&t2) != 0)
|
||||||
{
|
{
|
||||||
STACKPUSH(PTR2CD(tad.tad_tile), dbConnectStack);
|
STACKPUSH((ClientData)t2, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(tad.tad_dinfo), dbConnectStack);
|
STACKPUSH((ClientData)i, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(i), dbConnectStack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (DBSrPaintArea((Tile *) NULL, csa->csa_def->cd_planes[i],
|
else if (DBSrPaintArea((Tile *) NULL, csa->csa_def->cd_planes[i],
|
||||||
&newArea, connectMask, dbcFindTileFunc,
|
&newArea, connectMask, dbcFindTileFunc,
|
||||||
(ClientData)&tad) != 0)
|
(ClientData)&t2) != 0)
|
||||||
{
|
{
|
||||||
STACKPUSH(PTR2CD(tad.tad_tile), dbConnectStack);
|
STACKPUSH((ClientData)t2, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(tad.tad_dinfo), dbConnectStack);
|
STACKPUSH((ClientData)i, dbConnectStack);
|
||||||
STACKPUSH(INT2CD(i), dbConnectStack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -670,13 +731,10 @@ donesides:
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef cb_database_srpaintnmarea_t */
|
|
||||||
/** @typedef cb_database_srpaintarea_t */
|
|
||||||
int
|
int
|
||||||
dbcUnconnectFunc(tile, dinfo, clientData)
|
dbcUnconnectFunc(tile, clientData)
|
||||||
Tile *tile; /* Current tile */
|
Tile *tile; /* Current tile */
|
||||||
TileType dinfo; /* Split tile information, unused */
|
ClientData clientData; /* Unused. */
|
||||||
ClientData clientData; /* Unused. */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -768,8 +826,7 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2)
|
||||||
CellDef *orig_def = scx->scx_use->cu_def;
|
CellDef *orig_def = scx->scx_use->cu_def;
|
||||||
Label *slab;
|
Label *slab;
|
||||||
int lidx = lab->lab_port;
|
int lidx = lab->lab_port;
|
||||||
bool foundOne;
|
TileTypeBitMask *connectMask;
|
||||||
const TileTypeBitMask *connectMask;
|
|
||||||
|
|
||||||
/* Check for equivalent ports. For any found, call */
|
/* Check for equivalent ports. For any found, call */
|
||||||
/* DBTreeSrTiles recursively on the type and area */
|
/* DBTreeSrTiles recursively on the type and area */
|
||||||
|
|
@ -780,7 +837,6 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2)
|
||||||
/* are more equivalent ports, they will be found when */
|
/* are more equivalent ports, they will be found when */
|
||||||
/* processing this label's area. */
|
/* processing this label's area. */
|
||||||
|
|
||||||
foundOne = FALSE;
|
|
||||||
for (slab = orig_def->cd_labels; slab != NULL; slab = slab->lab_next)
|
for (slab = orig_def->cd_labels; slab != NULL; slab = slab->lab_next)
|
||||||
if ((slab->lab_flags & PORT_DIR_MASK) && (slab != lab))
|
if ((slab->lab_flags & PORT_DIR_MASK) && (slab != lab))
|
||||||
if (slab->lab_port == lidx)
|
if (slab->lab_port == lidx)
|
||||||
|
|
@ -841,20 +897,6 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2)
|
||||||
csa2->csa2_list[csa2->csa2_top].connectMask = connectMask;
|
csa2->csa2_list[csa2->csa2_top].connectMask = connectMask;
|
||||||
csa2->csa2_list[csa2->csa2_top].dinfo = 0;
|
csa2->csa2_list[csa2->csa2_top].dinfo = 0;
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* This warning is useful but currently is generating
|
|
||||||
* multiple messages per instance and so its more of
|
|
||||||
* an annoyance than an aid.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (foundOne == FALSE)
|
|
||||||
TxError("Warning: Port %s at location (%d %d) connects"
|
|
||||||
" a net across multiple disconnected areas!\n",
|
|
||||||
lab->lab_text, lab->lab_rect.r_xbot,
|
|
||||||
lab->lab_rect.r_ybot);
|
|
||||||
#endif
|
|
||||||
foundOne = TRUE;
|
|
||||||
|
|
||||||
/* See above: Process only one equivalent port at a time */
|
/* See above: Process only one equivalent port at a time */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -889,9 +931,8 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbcConnectFunc(tile, dinfo, cx)
|
dbcConnectFunc(tile, cx)
|
||||||
Tile *tile; /* Tile found. */
|
Tile *tile; /* Tile found. */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
TreeContext *cx; /* Describes context of search. The client
|
TreeContext *cx; /* Describes context of search. The client
|
||||||
* data is a pointer to a conSrArg2 record
|
* data is a pointer to a conSrArg2 record
|
||||||
* containing various required information.
|
* containing various required information.
|
||||||
|
|
@ -899,13 +940,12 @@ dbcConnectFunc(tile, dinfo, cx)
|
||||||
{
|
{
|
||||||
struct conSrArg2 *csa2;
|
struct conSrArg2 *csa2;
|
||||||
Rect tileArea, newarea;
|
Rect tileArea, newarea;
|
||||||
const TileTypeBitMask *connectMask;
|
TileTypeBitMask *connectMask, notConnectMask;
|
||||||
TileTypeBitMask notConnectMask;
|
|
||||||
Rect *srArea;
|
Rect *srArea;
|
||||||
SearchContext *scx = cx->tc_scx;
|
SearchContext *scx = cx->tc_scx;
|
||||||
SearchContext scx2;
|
SearchContext scx2;
|
||||||
TileType loctype = TiGetTypeExact(tile) | dinfo;
|
TileType loctype = TiGetTypeExact(tile);
|
||||||
TileType newdinfo = 0;
|
TileType dinfo = 0;
|
||||||
int retval, i, pNum = cx->tc_plane;
|
int retval, i, pNum = cx->tc_plane;
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
|
|
||||||
|
|
@ -937,8 +977,8 @@ dbcConnectFunc(tile, dinfo, cx)
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
{
|
{
|
||||||
newdinfo = DBTransformDiagonal(loctype, &scx->scx_trans);
|
dinfo = DBTransformDiagonal(loctype, &scx->scx_trans);
|
||||||
loctype = ((dinfo & TT_SIDE)) ? SplitRightType(tile) : SplitLeftType(tile);
|
loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if the destination cell contains stuff over the whole
|
/* See if the destination cell contains stuff over the whole
|
||||||
|
|
@ -976,7 +1016,7 @@ dbcConnectFunc(tile, dinfo, cx)
|
||||||
def = csa2->csa2_use->cu_def;
|
def = csa2->csa2_use->cu_def;
|
||||||
retval = 1;
|
retval = 1;
|
||||||
if (DBSrPaintNMArea((Tile *) NULL, def->cd_planes[pNum],
|
if (DBSrPaintNMArea((Tile *) NULL, def->cd_planes[pNum],
|
||||||
newdinfo, &newarea, ¬ConnectMask, dbcUnconnectFunc,
|
dinfo, &newarea, ¬ConnectMask, dbcUnconnectFunc,
|
||||||
(ClientData) NULL) == 0)
|
(ClientData) NULL) == 0)
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
|
|
@ -985,7 +1025,8 @@ dbcConnectFunc(tile, dinfo, cx)
|
||||||
* the storage for the current list element.
|
* the storage for the current list element.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DBNMPaintPlane(def->cd_planes[pNum], newdinfo,
|
if ((retval == 1) || DBIsContact(loctype))
|
||||||
|
DBNMPaintPlane(def->cd_planes[pNum], dinfo,
|
||||||
&newarea, DBStdPaintTbl(loctype, pNum),
|
&newarea, DBStdPaintTbl(loctype, pNum),
|
||||||
(PaintUndoInfo *) NULL);
|
(PaintUndoInfo *) NULL);
|
||||||
|
|
||||||
|
|
@ -1002,14 +1043,14 @@ dbcConnectFunc(tile, dinfo, cx)
|
||||||
|
|
||||||
/* Only extend those sides bordering the diagonal tile */
|
/* Only extend those sides bordering the diagonal tile */
|
||||||
|
|
||||||
if (newdinfo & TT_DIAGONAL)
|
if (dinfo & TT_DIAGONAL)
|
||||||
{
|
{
|
||||||
if (newdinfo & TT_SIDE) /* right */
|
if (dinfo & TT_SIDE) /* right */
|
||||||
newarea.r_xtop += 1;
|
newarea.r_xtop += 1;
|
||||||
else /* left */
|
else /* left */
|
||||||
newarea.r_xbot -= 1;
|
newarea.r_xbot -= 1;
|
||||||
if (((newdinfo & TT_SIDE) >> 1)
|
if (((dinfo & TT_SIDE) >> 1)
|
||||||
== (newdinfo & TT_DIRECTION)) /* top */
|
== (dinfo & TT_DIRECTION)) /* top */
|
||||||
newarea.r_ytop += 1;
|
newarea.r_ytop += 1;
|
||||||
else /* bottom */
|
else /* bottom */
|
||||||
newarea.r_ybot -= 1;
|
newarea.r_ybot -= 1;
|
||||||
|
|
@ -1037,13 +1078,7 @@ dbcConnectFunc(tile, dinfo, cx)
|
||||||
if (++csa2->csa2_top == CSA2_LIST_SIZE)
|
if (++csa2->csa2_top == CSA2_LIST_SIZE)
|
||||||
{
|
{
|
||||||
/* Reached list size limit---need to push the list and */
|
/* Reached list size limit---need to push the list and */
|
||||||
/* start a new one. NOTE: Setting lasttop to -1 means */
|
/* start a new one. */
|
||||||
/* that some entries may be duplicated between the */
|
|
||||||
/* stacks, which is a small inefficiency. In theory, */
|
|
||||||
/* lasttop could be left as is, then if lasttop > top */
|
|
||||||
/* when searching the last 5 entries, pop the stack, do */
|
|
||||||
/* the search, and then push the stack again. But it's */
|
|
||||||
/* a lot easier just to be slightly inefficient. */
|
|
||||||
|
|
||||||
conSrArea *newlist;
|
conSrArea *newlist;
|
||||||
|
|
||||||
|
|
@ -1051,12 +1086,11 @@ dbcConnectFunc(tile, dinfo, cx)
|
||||||
StackPush((ClientData)csa2->csa2_list, csa2->csa2_stack);
|
StackPush((ClientData)csa2->csa2_list, csa2->csa2_stack);
|
||||||
csa2->csa2_list = newlist;
|
csa2->csa2_list = newlist;
|
||||||
csa2->csa2_top = 0;
|
csa2->csa2_top = 0;
|
||||||
csa2->csa2_lasttop = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
csa2->csa2_list[csa2->csa2_top].area = newarea;
|
csa2->csa2_list[csa2->csa2_top].area = newarea;
|
||||||
csa2->csa2_list[csa2->csa2_top].connectMask = connectMask;
|
csa2->csa2_list[csa2->csa2_top].connectMask = connectMask;
|
||||||
csa2->csa2_list[csa2->csa2_top].dinfo = newdinfo;
|
csa2->csa2_list[csa2->csa2_top].dinfo = dinfo;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1122,7 +1156,7 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, doLabels, destUse)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
struct conSrArg2 csa2;
|
struct conSrArg2 csa2;
|
||||||
const TileTypeBitMask *newmask;
|
TileTypeBitMask *newmask;
|
||||||
TileType newtype;
|
TileType newtype;
|
||||||
unsigned char searchtype;
|
unsigned char searchtype;
|
||||||
|
|
||||||
|
|
@ -1211,8 +1245,7 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, doLabels, destUse)
|
||||||
if (DBTreeSrLabels(scx, newmask, xMask, &tpath, searchtype,
|
if (DBTreeSrLabels(scx, newmask, xMask, &tpath, searchtype,
|
||||||
dbcConnectLabelFunc, (ClientData) &csa2) != 0)
|
dbcConnectLabelFunc, (ClientData) &csa2) != 0)
|
||||||
{
|
{
|
||||||
TxError("Connection search was interrupted or hit "
|
TxError("Connection search hit memory limit and stopped.\n");
|
||||||
"memory limit and stopped.\n");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,13 +50,12 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
* cell graph; if it returns 0 then the subcells of 'def' are visited;
|
* cell graph; if it returns 0 then the subcells of 'def' are visited;
|
||||||
* if it returns 1 then the subcells are not visited.
|
* if it returns 1 then the subcells are not visited.
|
||||||
*
|
*
|
||||||
* void
|
* int
|
||||||
* hiercount(parent, uses, child, cdata)
|
* hiercount(parent, uses, child, cdata)
|
||||||
* CellDef *parent;
|
* CellDef *parent, *child;
|
||||||
* int uses; /# Scale factor: number of times child
|
* int uses; /# Scale factor: number of times child
|
||||||
* # is used by parent
|
* # is used by parent
|
||||||
* #/
|
* #/
|
||||||
* CellDef *child;
|
|
||||||
* ClientData cdata;
|
* ClientData cdata;
|
||||||
* {
|
* {
|
||||||
* }
|
* }
|
||||||
|
|
@ -104,7 +103,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
struct countArg
|
struct countArg
|
||||||
{
|
{
|
||||||
int (*ca_count)();
|
int (*ca_count)();
|
||||||
void (*ca_hiercount)();
|
int (*ca_hiercount)();
|
||||||
ClientData ca_cdata;
|
ClientData ca_cdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -112,7 +111,7 @@ void
|
||||||
DBTreeCountPaint(def, count, hiercount, cleanup, cdata)
|
DBTreeCountPaint(def, count, hiercount, cleanup, cdata)
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
int (*count)();
|
int (*count)();
|
||||||
void (*hiercount)();
|
int (*hiercount)();
|
||||||
int (*cleanup)();
|
int (*cleanup)();
|
||||||
ClientData cdata;
|
ClientData cdata;
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ struct expandArg
|
||||||
{
|
{
|
||||||
bool ea_deref; /* TRUE if root def dereference flag is set */
|
bool ea_deref; /* TRUE if root def dereference flag is set */
|
||||||
int ea_xmask; /* Expand mask. */
|
int ea_xmask; /* Expand mask. */
|
||||||
int ea_type; /* Expand, unexpand, or toggle */
|
|
||||||
int (*ea_func)(); /* Function to call for each cell whose
|
int (*ea_func)(); /* Function to call for each cell whose
|
||||||
* status is changed.
|
* status is changed.
|
||||||
*/
|
*/
|
||||||
|
|
@ -68,22 +67,15 @@ struct expandArg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
DBExpand(cellUse, expandMask, expandType)
|
DBExpand(cellUse, expandMask, expandFlag)
|
||||||
CellUse *cellUse;
|
CellUse *cellUse;
|
||||||
int expandMask;
|
int expandMask;
|
||||||
int expandType;
|
bool expandFlag;
|
||||||
{
|
{
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
bool expandFlag, expandTest;
|
|
||||||
|
if (DBDescendSubcell(cellUse, expandMask) == expandFlag)
|
||||||
expandTest = DBDescendSubcell(cellUse, expandMask);
|
return;
|
||||||
if ((expandType & DB_EXPAND_MASK) == DB_EXPAND_TOGGLE)
|
|
||||||
expandFlag = expandTest;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
expandFlag = ((expandType & DB_EXPAND_MASK) == DB_EXPAND) ? TRUE : FALSE;
|
|
||||||
if (expandFlag == expandTest) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (expandFlag)
|
if (expandFlag)
|
||||||
{
|
{
|
||||||
|
|
@ -138,17 +130,17 @@ DBExpand(cellUse, expandMask, expandType)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
DBExpandAll(rootUse, rootRect, expandMask, expandType, func, cdarg)
|
DBExpandAll(rootUse, rootRect, expandMask, expandFlag, func, cdarg)
|
||||||
CellUse *rootUse; /* Root cell use from which search begins */
|
CellUse *rootUse; /* Root cell use from which search begins */
|
||||||
Rect *rootRect; /* Area to be expanded, in root coordinates */
|
Rect *rootRect; /* Area to be expanded, in root coordinates */
|
||||||
int expandMask; /* Window mask in which cell is to be expanded */
|
int expandMask; /* Window mask in which cell is to be expanded */
|
||||||
int expandType; /* DB_EXPAND, DB_UNEXPAND, DB_EXPAND_TOGGLE */
|
bool expandFlag; /* TRUE => expand, FALSE => unexpand */
|
||||||
int (*func)(); /* Function to call for each cell whose expansion
|
int (*func)(); /* Function to call for each cell whose expansion
|
||||||
* status is modified. NULL means don't call anyone.
|
* status is modified. NULL means don't call anyone.
|
||||||
*/
|
*/
|
||||||
ClientData cdarg; /* Argument to pass to func. */
|
ClientData cdarg; /* Argument to pass to func. */
|
||||||
{
|
{
|
||||||
int dbExpandFunc();
|
int dbExpandFunc(), dbUnexpandFunc();
|
||||||
SearchContext scontext;
|
SearchContext scontext;
|
||||||
struct expandArg arg;
|
struct expandArg arg;
|
||||||
|
|
||||||
|
|
@ -156,26 +148,29 @@ DBExpandAll(rootUse, rootRect, expandMask, expandType, func, cdarg)
|
||||||
(void) DBCellRead(rootUse->cu_def, TRUE, TRUE, NULL);
|
(void) DBCellRead(rootUse->cu_def, TRUE, TRUE, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Walk through the area and set the expansion state appropriately.
|
* Walk through the area and set the expansion state
|
||||||
|
* appropriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
arg.ea_xmask = expandMask;
|
arg.ea_xmask = expandMask;
|
||||||
arg.ea_func = func;
|
arg.ea_func = func;
|
||||||
arg.ea_arg = cdarg;
|
arg.ea_arg = cdarg;
|
||||||
arg.ea_type = expandType;
|
|
||||||
arg.ea_deref = (rootUse->cu_def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
arg.ea_deref = (rootUse->cu_def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||||
|
|
||||||
scontext.scx_use = rootUse;
|
scontext.scx_use = rootUse;
|
||||||
scontext.scx_trans = GeoIdentityTransform;
|
scontext.scx_trans = GeoIdentityTransform;
|
||||||
scontext.scx_area = *rootRect;
|
scontext.scx_area = *rootRect;
|
||||||
DBCellSrArea(&scontext, dbExpandFunc, (ClientData) &arg);
|
if (expandFlag)
|
||||||
|
DBCellSrArea(&scontext, dbExpandFunc, (ClientData) &arg);
|
||||||
|
else
|
||||||
|
DBCellSrArea(&scontext, dbUnexpandFunc, (ClientData) &arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dbExpandFunc --
|
* dbExpandFunc --
|
||||||
*
|
*
|
||||||
* Filter function called by DBCellSrArea on behalf of DBExpandAll above
|
* Filter function called by DBCellSrArea on behalf of DBExpandAll above
|
||||||
* when cells are being expanded, unexpanded, or toggled.
|
* when cells are being expanded.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -189,55 +184,68 @@ dbExpandFunc(scx, arg)
|
||||||
{
|
{
|
||||||
CellUse *childUse = scx->scx_use;
|
CellUse *childUse = scx->scx_use;
|
||||||
int n = DBLambda[1];
|
int n = DBLambda[1];
|
||||||
int expandTest;
|
|
||||||
int expandType = (arg->ea_type & DB_EXPAND_MASK);
|
|
||||||
int expandSurround = (arg->ea_type & DB_EXPAND_SURROUND_MASK);
|
|
||||||
bool surround;
|
|
||||||
|
|
||||||
expandTest = DBDescendSubcell(childUse, arg->ea_xmask);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change the expansion status of this cell if necessary. Call the
|
* Change the expansion status of this cell if necessary. Call the
|
||||||
* client's function if the expansion status has changed.
|
* client's function if the expansion status has changed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!expandTest && ((expandType == DB_EXPAND) || (expandType == DB_EXPAND_TOGGLE)))
|
if (!DBDescendSubcell(childUse, arg->ea_xmask))
|
||||||
{
|
{
|
||||||
surround = (!GEO_SURROUND(&childUse->cu_def->cd_bbox, &scx->scx_area)
|
/* If the cell is unavailable, then don't expand it.
|
||||||
|| GEO_SURROUND(&scx->scx_area, &childUse->cu_def->cd_bbox));
|
*/
|
||||||
if (surround || (expandSurround == DB_EXPAND_OVERLAP))
|
if ((childUse->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||||
{
|
{
|
||||||
/* If the cell is unavailable, then don't expand it.
|
/* If the parent is dereferenced, then the child should be, too */
|
||||||
*/
|
if (arg->ea_deref) childUse->cu_def->cd_flags |= CDDEREFERENCE;
|
||||||
if ((childUse->cu_def->cd_flags & CDAVAILABLE) == 0)
|
if(!DBCellRead(childUse->cu_def, TRUE, TRUE, NULL))
|
||||||
{
|
{
|
||||||
/* If the parent is dereferenced, then the child should be, too */
|
TxError("Cell %s is unavailable. It could not be expanded.\n",
|
||||||
if (arg->ea_deref) childUse->cu_def->cd_flags |= CDDEREFERENCE;
|
childUse->cu_def->cd_name);
|
||||||
if (!DBCellRead(childUse->cu_def, TRUE, TRUE, NULL))
|
return 2;
|
||||||
{
|
|
||||||
TxError("Cell %s is unavailable. It could not be expanded.\n",
|
|
||||||
childUse->cu_def->cd_name);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
childUse->cu_expandMask |= arg->ea_xmask;
|
|
||||||
expandTest = TRUE;
|
|
||||||
if (arg->ea_func != NULL)
|
|
||||||
{
|
|
||||||
if ((*arg->ea_func)(childUse, arg->ea_arg) != 0) return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
childUse->cu_expandMask |= arg->ea_xmask;
|
||||||
|
if (arg->ea_func != NULL)
|
||||||
|
{
|
||||||
|
if ((*arg->ea_func)(childUse, arg->ea_arg) != 0) return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (expandTest && ((expandType == DB_UNEXPAND) ||
|
|
||||||
(expandType == DB_EXPAND_TOGGLE)))
|
if (DBCellSrArea(scx, dbExpandFunc, (ClientData) arg))
|
||||||
|
return 1;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dbUnexpandFunc --
|
||||||
|
*
|
||||||
|
* Filter function called by DBCellSrArea on behalf of DBExpandAll above
|
||||||
|
* when cells are being unexpanded.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
dbUnexpandFunc(scx, arg)
|
||||||
|
SearchContext *scx; /* Pointer to search context containing
|
||||||
|
* child use, search area in coor-
|
||||||
|
* dinates of the child use, and
|
||||||
|
* transform back to "root".
|
||||||
|
*/
|
||||||
|
struct expandArg *arg; /* Client data from caller */
|
||||||
|
{
|
||||||
|
CellUse *childUse = scx->scx_use;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Change the expansion status of this cell if necessary.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (DBDescendSubcell(childUse, arg->ea_xmask))
|
||||||
{
|
{
|
||||||
surround = (!GEO_SURROUND(&childUse->cu_def->cd_bbox, &scx->scx_area)
|
if (!GEO_SURROUND(&childUse->cu_def->cd_bbox, &scx->scx_area)
|
||||||
|| GEO_SURROUND(&scx->scx_area, &childUse->cu_def->cd_bbox));
|
|| GEO_SURROUND(&scx->scx_area, &childUse->cu_def->cd_bbox))
|
||||||
if (surround || (expandSurround == DB_EXPAND_OVERLAP))
|
|
||||||
{
|
{
|
||||||
childUse->cu_expandMask &= ~arg->ea_xmask;
|
childUse->cu_expandMask &= ~arg->ea_xmask;
|
||||||
expandTest = FALSE;
|
|
||||||
|
|
||||||
/* Call the client's function, if there is one. */
|
/* Call the client's function, if there is one. */
|
||||||
|
|
||||||
|
|
@ -248,7 +256,11 @@ dbExpandFunc(scx, arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DBCellSrArea(scx, dbExpandFunc, (ClientData) arg))
|
/* Don't recursively search things that aren't already expanded. */
|
||||||
|
|
||||||
|
else return 2;
|
||||||
|
|
||||||
|
if (DBCellSrArea(scx, dbUnexpandFunc, (ClientData) arg))
|
||||||
return 1;
|
return 1;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
@ -262,8 +274,8 @@ dbExpandFunc(scx, arg)
|
||||||
* the given rectangle.
|
* the given rectangle.
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* If "halt_on_error" is TRUE, then return a pointer to the first
|
* If "halt_on_error" is TRUE, then return 1 if any subcell could not
|
||||||
* subcell that could not be read. Otherwise, return NULL.
|
* be read. Otherwise, return 0.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* May make new cells known to the database. Sets the CDAVAILABLE
|
* May make new cells known to the database. Sets the CDAVAILABLE
|
||||||
|
|
@ -272,7 +284,7 @@ dbExpandFunc(scx, arg)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CellDef *
|
int
|
||||||
DBCellReadArea(rootUse, rootRect, halt_on_error)
|
DBCellReadArea(rootUse, rootRect, halt_on_error)
|
||||||
CellUse *rootUse; /* Root cell use from which search begins */
|
CellUse *rootUse; /* Root cell use from which search begins */
|
||||||
Rect *rootRect; /* Area to be read, in root coordinates */
|
Rect *rootRect; /* Area to be read, in root coordinates */
|
||||||
|
|
@ -280,44 +292,32 @@ DBCellReadArea(rootUse, rootRect, halt_on_error)
|
||||||
{
|
{
|
||||||
int dbReadAreaFunc();
|
int dbReadAreaFunc();
|
||||||
SearchContext scontext;
|
SearchContext scontext;
|
||||||
CellDef *err_def = NULL;
|
|
||||||
|
|
||||||
scontext.scx_use = rootUse;
|
scontext.scx_use = rootUse;
|
||||||
scontext.scx_trans = GeoIdentityTransform;
|
scontext.scx_trans = GeoIdentityTransform;
|
||||||
scontext.scx_area = *rootRect;
|
scontext.scx_area = *rootRect;
|
||||||
if (dbReadAreaFunc(&scontext, ((halt_on_error == TRUE) ? &err_def : NULL)) == 1)
|
if (dbReadAreaFunc(&scontext, halt_on_error) == 1)
|
||||||
return err_def;
|
return 1;
|
||||||
|
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dbReadAreaFunc(scx, err_ptr)
|
dbReadAreaFunc(scx, halt_on_error)
|
||||||
SearchContext *scx; /* Pointer to context specifying
|
SearchContext *scx; /* Pointer to context specifying
|
||||||
* the cell use to be read in, and
|
* the cell use to be read in, and
|
||||||
* an area to be recursively read in
|
* an area to be recursively read in
|
||||||
* coordinates of the cell use's def.
|
* coordinates of the cell use's def.
|
||||||
*/
|
*/
|
||||||
CellDef **err_ptr; /* If non-NULL, failure to find a cell causes a halt
|
bool halt_on_error; /* If TRUE, failure to find a cell causes a halt */
|
||||||
* and the CellDef in error is returned in err_def.
|
|
||||||
* If NULL, failure to find a cell still causes a
|
|
||||||
* halt but no information is passed back to the
|
|
||||||
* calling routine.
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
CellDef *def = scx->scx_use->cu_def;
|
CellDef *def = scx->scx_use->cu_def;
|
||||||
|
|
||||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||||
{
|
{
|
||||||
if (DBCellRead(def, TRUE, TRUE, NULL) == FALSE)
|
if (DBCellRead(def, TRUE, TRUE, NULL) == FALSE)
|
||||||
{
|
if (halt_on_error)
|
||||||
if (err_ptr != NULL) {
|
|
||||||
*err_ptr = def;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Note: we don't have to invoke DBReComputeBbox here because
|
/* Note: we don't have to invoke DBReComputeBbox here because
|
||||||
* if the bbox changed then there was a timestamp mismatch and
|
* if the bbox changed then there was a timestamp mismatch and
|
||||||
|
|
@ -325,8 +325,9 @@ dbReadAreaFunc(scx, err_ptr)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DBCellSrArea(scx, dbReadAreaFunc, (ClientData)err_ptr))
|
if (DBCellSrArea(scx, dbReadAreaFunc, (ClientData)halt_on_error))
|
||||||
return 1;
|
if (halt_on_error)
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* Be clever about handling arrays: if the search area covers this
|
/* Be clever about handling arrays: if the search area covers this
|
||||||
* whole definition, then there's no need to look at any other
|
* whole definition, then there's no need to look at any other
|
||||||
|
|
|
||||||
1745
database/DBio.c
1745
database/DBio.c
File diff suppressed because it is too large
Load Diff
|
|
@ -24,7 +24,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
|
||||||
#include <math.h> /* For sin(), cos(), and round() functions */
|
#include <math.h> /* For sin(), cos(), and round() functions */
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
@ -280,7 +279,6 @@ DBEraseGlobLabel(cellDef, area, mask, areaReturn, globmatch)
|
||||||
bool erasedAny = FALSE;
|
bool erasedAny = FALSE;
|
||||||
TileType newType;
|
TileType newType;
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
labPrev = NULL;
|
labPrev = NULL;
|
||||||
lab = cellDef->cd_labels;
|
lab = cellDef->cd_labels;
|
||||||
while (lab != NULL)
|
while (lab != NULL)
|
||||||
|
|
@ -314,7 +312,7 @@ DBEraseGlobLabel(cellDef, area, mask, areaReturn, globmatch)
|
||||||
if ((lab->lab_font >= 0) && areaReturn)
|
if ((lab->lab_font >= 0) && areaReturn)
|
||||||
GeoInclude(&lab->lab_bbox, areaReturn);
|
GeoInclude(&lab->lab_bbox, areaReturn);
|
||||||
|
|
||||||
freeMagic1(&mm1, (char *) lab);
|
freeMagic((char *) lab);
|
||||||
lab = lab->lab_next;
|
lab = lab->lab_next;
|
||||||
erasedAny = TRUE;
|
erasedAny = TRUE;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -322,7 +320,6 @@ DBEraseGlobLabel(cellDef, area, mask, areaReturn, globmatch)
|
||||||
nextLab: labPrev = lab;
|
nextLab: labPrev = lab;
|
||||||
lab = lab->lab_next;
|
lab = lab->lab_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
|
|
||||||
if (erasedAny)
|
if (erasedAny)
|
||||||
cellDef->cd_flags |= CDMODIFIED|CDGETNEWSTAMP;
|
cellDef->cd_flags |= CDMODIFIED|CDGETNEWSTAMP;
|
||||||
|
|
@ -444,7 +441,6 @@ DBEraseLabelsByContent(def, rect, type, text)
|
||||||
{
|
{
|
||||||
Label *lab, *labPrev;
|
Label *lab, *labPrev;
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (labPrev = NULL, lab = def->cd_labels;
|
for (labPrev = NULL, lab = def->cd_labels;
|
||||||
lab != NULL;
|
lab != NULL;
|
||||||
labPrev = lab, lab = lab->lab_next)
|
labPrev = lab, lab = lab->lab_next)
|
||||||
|
|
@ -460,7 +456,7 @@ DBEraseLabelsByContent(def, rect, type, text)
|
||||||
else labPrev->lab_next = lab->lab_next;
|
else labPrev->lab_next = lab->lab_next;
|
||||||
if (def->cd_lastLabel == lab)
|
if (def->cd_lastLabel == lab)
|
||||||
def->cd_lastLabel = labPrev;
|
def->cd_lastLabel = labPrev;
|
||||||
freeMagic1(&mm1, (char *) lab);
|
freeMagic((char *) lab);
|
||||||
|
|
||||||
/* Don't iterate through loop, since this will skip a label:
|
/* Don't iterate through loop, since this will skip a label:
|
||||||
* just go back to top. This is tricky!
|
* just go back to top. This is tricky!
|
||||||
|
|
@ -470,7 +466,6 @@ DBEraseLabelsByContent(def, rect, type, text)
|
||||||
if (lab == NULL) break;
|
if (lab == NULL) break;
|
||||||
else goto nextCheck;
|
else goto nextCheck;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -499,7 +494,6 @@ DBRemoveLabel(def, refLab)
|
||||||
{
|
{
|
||||||
Label *lab, *labPrev;
|
Label *lab, *labPrev;
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (labPrev = NULL, lab = def->cd_labels;
|
for (labPrev = NULL, lab = def->cd_labels;
|
||||||
lab != NULL;
|
lab != NULL;
|
||||||
labPrev = lab, lab = lab->lab_next)
|
labPrev = lab, lab = lab->lab_next)
|
||||||
|
|
@ -513,7 +507,7 @@ DBRemoveLabel(def, refLab)
|
||||||
else labPrev->lab_next = lab->lab_next;
|
else labPrev->lab_next = lab->lab_next;
|
||||||
if (def->cd_lastLabel == lab)
|
if (def->cd_lastLabel == lab)
|
||||||
def->cd_lastLabel = labPrev;
|
def->cd_lastLabel = labPrev;
|
||||||
freeMagic1(&mm1, (char *) lab);
|
freeMagic((char *) lab);
|
||||||
|
|
||||||
/* Don't iterate through loop, since this will skip a label:
|
/* Don't iterate through loop, since this will skip a label:
|
||||||
* just go back to top. This is tricky!
|
* just go back to top. This is tricky!
|
||||||
|
|
@ -523,7 +517,6 @@ DBRemoveLabel(def, refLab)
|
||||||
if (lab == NULL) break;
|
if (lab == NULL) break;
|
||||||
else goto nextCheck;
|
else goto nextCheck;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -568,63 +561,6 @@ DBReOrientLabel(cellDef, area, newPos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* dbGetLabelArea ---
|
|
||||||
*
|
|
||||||
* Callback function used by DBAdjustLabels. Find all material under a label
|
|
||||||
* that is *not* the label type, and return the label area adjusted to leave
|
|
||||||
* out that amount.
|
|
||||||
*
|
|
||||||
* Note: This clips in a regular order, and does not consider what is the
|
|
||||||
* largest rectangular area outside the area that has been clipped out.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
dbGetLabelArea(tile, dinfo, area)
|
|
||||||
Tile *tile; /* Tile found. */
|
|
||||||
TileType dinfo; /* Split tile information (unused) */
|
|
||||||
Rect *area; /* Area to be modified. */
|
|
||||||
{
|
|
||||||
Rect r;
|
|
||||||
|
|
||||||
TiToRect(tile, &r);
|
|
||||||
|
|
||||||
if (r.r_xbot > area->r_xbot)
|
|
||||||
area->r_xtop = r.r_xbot;
|
|
||||||
else if (r.r_xtop < area->r_xtop)
|
|
||||||
area->r_xbot = r.r_xtop;
|
|
||||||
else if (r.r_ybot > area->r_ybot)
|
|
||||||
area->r_ytop = r.r_ybot;
|
|
||||||
else if (r.r_ytop < area->r_ytop)
|
|
||||||
area->r_ybot = r.r_ytop;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* dbLabelNotEmpty ---
|
|
||||||
*
|
|
||||||
* Callback function used by DBAdjustLabels. Finds any material under a
|
|
||||||
* label that is the label type, and returns 1 to stop the search.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
dbLabelNotEmpty(tile, dinfo, clientData)
|
|
||||||
Tile *tile; /* Tile found. */
|
|
||||||
TileType dinfo; /* Split tile information (unused) */
|
|
||||||
ClientData clientData; /* (unused) */
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
@ -654,7 +590,7 @@ DBAdjustLabels(def, area)
|
||||||
{
|
{
|
||||||
Label *lab;
|
Label *lab;
|
||||||
TileType newType;
|
TileType newType;
|
||||||
bool modified = FALSE, adjusted = FALSE;
|
bool modified = FALSE;
|
||||||
|
|
||||||
/* First, find each label that crosses the area we're
|
/* First, find each label that crosses the area we're
|
||||||
* interested in.
|
* interested in.
|
||||||
|
|
@ -666,69 +602,16 @@ DBAdjustLabels(def, area)
|
||||||
newType = DBPickLabelLayer(def, lab, FALSE);
|
newType = DBPickLabelLayer(def, lab, FALSE);
|
||||||
if (newType == lab->lab_type) continue;
|
if (newType == lab->lab_type) continue;
|
||||||
if (lab->lab_flags & LABEL_STICKY) continue;
|
if (lab->lab_flags & LABEL_STICKY) continue;
|
||||||
|
if ((DBVerbose >= DB_VERBOSE_ALL) && ((def->cd_flags & CDINTERNAL) == 0))
|
||||||
/* New behavior (5/2024) (idea from Philipp Guhring)---If the new
|
|
||||||
* type is space, then instead of immediately casting the label off
|
|
||||||
* of its material, find the amount of the label that is still
|
|
||||||
* covered by the material. If the material covers more than half
|
|
||||||
* the label area, then adjust the label area to match the material.
|
|
||||||
*/
|
|
||||||
|
|
||||||
adjusted = FALSE;
|
|
||||||
if (newType == TT_SPACE)
|
|
||||||
{
|
{
|
||||||
Rect r;
|
TxPrintf("Moving label \"%s\" from %s to %s in cell %s.\n",
|
||||||
TileTypeBitMask lmask;
|
lab->lab_text, DBTypeLongName(lab->lab_type),
|
||||||
|
DBTypeLongName(newType), def->cd_name);
|
||||||
TTMaskSetOnlyType(&lmask, lab->lab_type);
|
|
||||||
/* To do: Add compatible types (contact, residue) */
|
|
||||||
|
|
||||||
/* If there is no material left inside the label area, then
|
|
||||||
* the label gets reassigned to space.
|
|
||||||
*/
|
|
||||||
if (DBSrPaintArea((Tile *) NULL, def->cd_planes[DBPlane(lab->lab_type)],
|
|
||||||
&lab->lab_rect, &lmask, dbLabelNotEmpty, (ClientData)NULL) == 1)
|
|
||||||
{
|
|
||||||
TTMaskCom(&lmask);
|
|
||||||
|
|
||||||
r = lab->lab_rect;
|
|
||||||
DBSrPaintArea((Tile *) NULL, def->cd_planes[DBPlane(lab->lab_type)],
|
|
||||||
&lab->lab_rect, &lmask, dbGetLabelArea, (ClientData) &r);
|
|
||||||
|
|
||||||
if (!GEO_RECTNULL(&r))
|
|
||||||
{
|
|
||||||
if ((DBVerbose >= DB_VERBOSE_ALL) &&
|
|
||||||
((def->cd_flags & CDINTERNAL) == 0))
|
|
||||||
{
|
|
||||||
TxPrintf("Adjusting size of label \"%s\" in cell %s.\n",
|
|
||||||
lab->lab_text, def->cd_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
DBUndoEraseLabel(def, lab);
|
|
||||||
DBWLabelChanged(def, lab, DBW_ALLWINDOWS);
|
|
||||||
lab->lab_rect = r;
|
|
||||||
DBFontLabelSetBBox(lab);
|
|
||||||
DBUndoPutLabel(def, lab);
|
|
||||||
DBWLabelChanged(def, lab, DBW_ALLWINDOWS);
|
|
||||||
modified = TRUE;
|
|
||||||
adjusted = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!adjusted)
|
|
||||||
{
|
|
||||||
if ((DBVerbose >= DB_VERBOSE_ALL) && ((def->cd_flags & CDINTERNAL) == 0))
|
|
||||||
{
|
|
||||||
TxPrintf("Moving label \"%s\" from %s to %s in cell %s.\n",
|
|
||||||
lab->lab_text, DBTypeLongName(lab->lab_type),
|
|
||||||
DBTypeLongName(newType), def->cd_name);
|
|
||||||
}
|
|
||||||
DBUndoEraseLabel(def, lab);
|
|
||||||
lab->lab_type = newType;
|
|
||||||
DBUndoPutLabel(def, lab);
|
|
||||||
modified = TRUE;
|
|
||||||
}
|
}
|
||||||
|
DBUndoEraseLabel(def, lab);
|
||||||
|
lab->lab_type = newType;
|
||||||
|
DBUndoPutLabel(def, lab);
|
||||||
|
modified = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modified) DBCellSetModified(def, TRUE);
|
if (modified) DBCellSetModified(def, TRUE);
|
||||||
|
|
@ -797,10 +680,8 @@ DBAdjustLabelsNew(def, area)
|
||||||
def->cd_lastLabel = labPrev;
|
def->cd_lastLabel = labPrev;
|
||||||
DBUndoEraseLabel(def, lab);
|
DBUndoEraseLabel(def, lab);
|
||||||
DBWLabelChanged(def, lab, DBW_ALLWINDOWS);
|
DBWLabelChanged(def, lab, DBW_ALLWINDOWS);
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
freeMagic((char *) lab);
|
||||||
freeMagic1(&mm1, (char *) lab);
|
|
||||||
lab = lab->lab_next;
|
lab = lab->lab_next;
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
modified = TRUE;
|
modified = TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1116,15 +997,14 @@ DBPickLabelLayer(def, lab, doCalma)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbPickFunc1(tile, dinfo, mask)
|
dbPickFunc1(tile, mask)
|
||||||
Tile *tile; /* Tile found. */
|
Tile *tile; /* Tile found. */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
TileTypeBitMask *mask; /* Mask to be modified. */
|
TileTypeBitMask *mask; /* Mask to be modified. */
|
||||||
{
|
{
|
||||||
TileType type;
|
TileType type;
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile);
|
type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
else
|
else
|
||||||
type = TiGetType(tile);
|
type = TiGetType(tile);
|
||||||
|
|
||||||
|
|
@ -1143,16 +1023,15 @@ dbPickFunc1(tile, dinfo, mask)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbPickFunc2(tile, dinfo, mask)
|
dbPickFunc2(tile, mask)
|
||||||
Tile *tile; /* Tile found. */
|
Tile *tile; /* Tile found. */
|
||||||
TileType dinfo; /* Split tile information */
|
|
||||||
TileTypeBitMask *mask; /* Mask to be modified. */
|
TileTypeBitMask *mask; /* Mask to be modified. */
|
||||||
{
|
{
|
||||||
TileType type;
|
TileType type;
|
||||||
TileTypeBitMask tmp, *rMask;
|
TileTypeBitMask tmp, *rMask;
|
||||||
|
|
||||||
if (IsSplit(tile))
|
if (IsSplit(tile))
|
||||||
type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile);
|
type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile);
|
||||||
else
|
else
|
||||||
type = TiGetType(tile);
|
type = TiGetType(tile);
|
||||||
|
|
||||||
|
|
@ -1590,7 +1469,7 @@ DBLoadFont(fontfile, scale)
|
||||||
float scale;
|
float scale;
|
||||||
{
|
{
|
||||||
FILE *ff;
|
FILE *ff;
|
||||||
const char * const ascii_names[] = {
|
char *ascii_names[] = {
|
||||||
"space", "exclam", "quotedbl", "numbersign", "dollar",
|
"space", "exclam", "quotedbl", "numbersign", "dollar",
|
||||||
"percent", "ampersand", "quoteright", "parenleft", "parenright",
|
"percent", "ampersand", "quoteright", "parenleft", "parenright",
|
||||||
"asterisk", "plus", "comma", "hyphen", "period", "slash", "zero",
|
"asterisk", "plus", "comma", "hyphen", "period", "slash", "zero",
|
||||||
|
|
@ -1695,7 +1574,7 @@ DBLoadFont(fontfile, scale)
|
||||||
{
|
{
|
||||||
if (psname != NULL)
|
if (psname != NULL)
|
||||||
{
|
{
|
||||||
asciiidx = LookupStructFull(psname, ascii_names, sizeof(const char *));
|
asciiidx = LookupStructFull(psname, ascii_names, sizeof(char *));
|
||||||
if (asciiidx >= 0)
|
if (asciiidx >= 0)
|
||||||
chardef = 2;
|
chardef = 2;
|
||||||
}
|
}
|
||||||
|
|
@ -1785,10 +1664,8 @@ DBLoadFont(fontfile, scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the pointlist */
|
/* Remove the pointlist */
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (newPath = pathStart; newPath != NULL; newPath = newPath->fp_next)
|
for (newPath = pathStart; newPath != NULL; newPath = newPath->fp_next)
|
||||||
freeMagic1(&mm1, newPath);
|
freeMagic(newPath);
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
pathStart = NULL;
|
pathStart = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ DBSrLabelLoc(rootUse, name, func, cdarg)
|
||||||
char csave;
|
char csave;
|
||||||
Rect r;
|
Rect r;
|
||||||
|
|
||||||
if ((cp = strrchr(name, '/')))
|
if (cp = strrchr(name, '/'))
|
||||||
{
|
{
|
||||||
csave = *cp;
|
csave = *cp;
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,6 @@ Tile *TiNMMergeRight();
|
||||||
Tile *TiNMMergeLeft();
|
Tile *TiNMMergeLeft();
|
||||||
|
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
void dbPaintShowTile(Tile *tile, PaintUndoInfo *undo, char *str);
|
|
||||||
|
|
||||||
int dbPaintDebug = 0;
|
int dbPaintDebug = 0;
|
||||||
#endif /* PAINTDEBUG */
|
#endif /* PAINTDEBUG */
|
||||||
|
|
||||||
|
|
@ -242,7 +240,7 @@ int
|
||||||
DBPaintPlane0(plane, area, resultTbl, undo, method)
|
DBPaintPlane0(plane, area, resultTbl, undo, method)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
const PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
||||||
* present in the plane, giving the type to
|
* present in the plane, giving the type to
|
||||||
* which the existing tile must change as a
|
* which the existing tile must change as a
|
||||||
* result of this paint operation.
|
* result of this paint operation.
|
||||||
|
|
@ -273,10 +271,9 @@ DBPaintPlane0(plane, area, resultTbl, undo, method)
|
||||||
* search.
|
* search.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
start.p_x = area->r_xbot;
|
start.p_x = area->r_xbot;
|
||||||
start.p_y = area->r_ytop - 1;
|
start.p_y = area->r_ytop - 1;
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, &start);
|
GOTOPOINT(tile, &start);
|
||||||
|
|
||||||
/* Each iteration visits another tile on the LHS of the search area */
|
/* Each iteration visits another tile on the LHS of the search area */
|
||||||
|
|
@ -313,11 +310,6 @@ enumerate:
|
||||||
* Set up the directions in which we will have to
|
* Set up the directions in which we will have to
|
||||||
* merge initially. Clipping can cause some of these
|
* merge initially. Clipping can cause some of these
|
||||||
* to be turned off.
|
* to be turned off.
|
||||||
*
|
|
||||||
* The search runs from left to right, top to bottom.
|
|
||||||
* Therefore always merge left and up, but never right
|
|
||||||
* and down, unless at or beyond the each of the search
|
|
||||||
* area.
|
|
||||||
*/
|
*/
|
||||||
mergeFlags = MRG_TOP | MRG_LEFT;
|
mergeFlags = MRG_TOP | MRG_LEFT;
|
||||||
if (RIGHT(tile) >= area->r_xtop) mergeFlags |= MRG_RIGHT;
|
if (RIGHT(tile) >= area->r_xtop) mergeFlags |= MRG_RIGHT;
|
||||||
|
|
@ -347,7 +339,6 @@ enumerate:
|
||||||
* Merging is only necessary if we clip to the left or to
|
* Merging is only necessary if we clip to the left or to
|
||||||
* the right, and then only to the top or the bottom.
|
* the right, and then only to the top or the bottom.
|
||||||
* We do the merge in-line for efficiency.
|
* We do the merge in-line for efficiency.
|
||||||
* Clipping of split tiles is more complicated.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Clip up */
|
/* Clip up */
|
||||||
|
|
@ -362,17 +353,13 @@ enumerate:
|
||||||
newType = (method == (unsigned char)PAINT_XOR) ?
|
newType = (method == (unsigned char)PAINT_XOR) ?
|
||||||
*resultTbl : resultTbl[oldType];
|
*resultTbl : resultTbl[oldType];
|
||||||
|
|
||||||
if (mergeFlags & MRG_LEFT)
|
tile = TiNMMergeLeft(tile, plane);
|
||||||
tile = TiNMMergeLeft(tile, plane);
|
TiNMMergeRight(TR(newtile), plane);
|
||||||
if ((mergeFlags & MRG_RIGHT) || SplitDirection(newtile) == 1)
|
|
||||||
TiNMMergeRight(TR(newtile), plane);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mergeFlags & MRG_LEFT)
|
TiNMMergeLeft(newtile, plane);
|
||||||
TiNMMergeLeft(newtile, plane);
|
TiNMMergeRight(TR(tile), plane);
|
||||||
if ((mergeFlags & MRG_RIGHT) || SplitDirection(tile) == 1)
|
|
||||||
TiNMMergeRight(TR(tile), plane);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -401,17 +388,13 @@ enumerate:
|
||||||
newType = (method == (unsigned char)PAINT_XOR) ?
|
newType = (method == (unsigned char)PAINT_XOR) ?
|
||||||
*resultTbl : resultTbl[oldType];
|
*resultTbl : resultTbl[oldType];
|
||||||
|
|
||||||
if (mergeFlags & MRG_LEFT)
|
tile = TiNMMergeLeft(tile, plane);
|
||||||
tile = TiNMMergeLeft(tile, plane);
|
TiNMMergeRight(TR(newtile), plane);
|
||||||
if ((mergeFlags & MRG_RIGHT) || SplitDirection(newtile) == 0)
|
|
||||||
TiNMMergeRight(TR(newtile), plane);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mergeFlags & MRG_LEFT)
|
TiNMMergeLeft(newtile, plane);
|
||||||
TiNMMergeLeft(newtile, plane);
|
TiNMMergeRight(TR(tile), plane);
|
||||||
if ((mergeFlags & MRG_RIGHT) || SplitDirection(tile) == 0)
|
|
||||||
TiNMMergeRight(TR(tile), plane);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -440,17 +423,13 @@ enumerate:
|
||||||
newType = (method == (unsigned char)PAINT_XOR) ?
|
newType = (method == (unsigned char)PAINT_XOR) ?
|
||||||
*resultTbl : resultTbl[oldType];
|
*resultTbl : resultTbl[oldType];
|
||||||
|
|
||||||
if (mergeFlags & MRG_LEFT)
|
tile = TiNMMergeLeft(tile, plane);
|
||||||
tile = TiNMMergeLeft(tile, plane);
|
TiNMMergeRight(LB(newtile), plane);
|
||||||
if (mergeFlags & MRG_RIGHT)
|
|
||||||
TiNMMergeRight(LB(newtile), plane);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mergeFlags & MRG_LEFT)
|
TiNMMergeRight(newtile, plane);
|
||||||
TiNMMergeRight(newtile, plane);
|
TiNMMergeLeft(LB(tile), plane);
|
||||||
if (mergeFlags & MRG_RIGHT)
|
|
||||||
TiNMMergeLeft(LB(tile), plane);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -460,11 +439,11 @@ enumerate:
|
||||||
|
|
||||||
/* Merge the outside tile to its top */
|
/* Merge the outside tile to its top */
|
||||||
tp = RT(newtile);
|
tp = RT(newtile);
|
||||||
if (CANMERGE_Y(newtile, tp)) TiJoinY1(&delayed, newtile, tp, plane);
|
if (CANMERGE_Y(newtile, tp)) TiJoinY(newtile, tp, plane);
|
||||||
|
|
||||||
/* Merge the outside tile to its bottom */
|
/* Merge the outside tile to its bottom */
|
||||||
tp = LB(newtile);
|
tp = LB(newtile);
|
||||||
if (CANMERGE_Y(newtile, tp)) TiJoinY1(&delayed, newtile, tp, plane);
|
if (CANMERGE_Y(newtile, tp)) TiJoinY(newtile, tp, plane);
|
||||||
}
|
}
|
||||||
mergeFlags &= ~MRG_RIGHT;
|
mergeFlags &= ~MRG_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
@ -487,13 +466,13 @@ enumerate:
|
||||||
newType = (method == (unsigned char)PAINT_XOR) ?
|
newType = (method == (unsigned char)PAINT_XOR) ?
|
||||||
*resultTbl : resultTbl[oldType];
|
*resultTbl : resultTbl[oldType];
|
||||||
|
|
||||||
if (mergeFlags & MRG_LEFT)
|
// tile = TiNMMergeRight(tile, plane);
|
||||||
TiNMMergeLeft(LB(newtile), plane);
|
TiNMMergeLeft(LB(newtile), plane);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mergeFlags & MRG_LEFT)
|
TiNMMergeLeft(newtile, plane);
|
||||||
TiNMMergeLeft(newtile, plane);
|
// TiNMMergeRight(LB(tile), plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -504,11 +483,11 @@ enumerate:
|
||||||
|
|
||||||
/* Merge the outside tile to its top */
|
/* Merge the outside tile to its top */
|
||||||
tp = RT(newtile);
|
tp = RT(newtile);
|
||||||
if (CANMERGE_Y(newtile, tp)) TiJoinY1(&delayed, newtile, tp, plane);
|
if (CANMERGE_Y(newtile, tp)) TiJoinY(newtile, tp, plane);
|
||||||
|
|
||||||
/* Merge the outside tile to its bottom */
|
/* Merge the outside tile to its bottom */
|
||||||
tp = LB(newtile);
|
tp = LB(newtile);
|
||||||
if (CANMERGE_Y(newtile, tp)) TiJoinY1(&delayed, newtile, tp, plane);
|
if (CANMERGE_Y(newtile, tp)) TiJoinY(newtile, tp, plane);
|
||||||
}
|
}
|
||||||
mergeFlags &= ~MRG_LEFT;
|
mergeFlags &= ~MRG_LEFT;
|
||||||
}
|
}
|
||||||
|
|
@ -600,7 +579,7 @@ clipdone:
|
||||||
if (mergeFlags & MRG_TOP)
|
if (mergeFlags & MRG_TOP)
|
||||||
{
|
{
|
||||||
tp = RT(tile);
|
tp = RT(tile);
|
||||||
if (CANMERGE_Y(tile, tp)) TiJoinY1(&delayed, tile, tp, plane);
|
if (CANMERGE_Y(tile, tp)) TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "merged up (CHEAP)");
|
dbPaintShowTile(tile, undo, "merged up (CHEAP)");
|
||||||
|
|
@ -609,7 +588,7 @@ clipdone:
|
||||||
if (mergeFlags & MRG_BOTTOM)
|
if (mergeFlags & MRG_BOTTOM)
|
||||||
{
|
{
|
||||||
tp = LB(tile);
|
tp = LB(tile);
|
||||||
if (CANMERGE_Y(tile, tp)) TiJoinY1(&delayed, tile, tp, plane);
|
if (CANMERGE_Y(tile, tp)) TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "merged down (CHEAP)");
|
dbPaintShowTile(tile, undo, "merged down (CHEAP)");
|
||||||
|
|
@ -669,7 +648,7 @@ done:
|
||||||
start.p_x = area->r_xbot;
|
start.p_x = area->r_xbot;
|
||||||
start.p_y = area->r_ytop - 1;
|
start.p_y = area->r_ytop - 1;
|
||||||
|
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, &start);
|
GOTOPOINT(tile, &start);
|
||||||
|
|
||||||
while (TOP(tile) > area->r_ybot)
|
while (TOP(tile) > area->r_ybot)
|
||||||
|
|
@ -717,8 +696,7 @@ enum2:
|
||||||
}
|
}
|
||||||
|
|
||||||
done2:
|
done2:
|
||||||
PlaneSetHint(plane, tile);
|
plane->pl_hint = tile;
|
||||||
TiFreeIf(delayed);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -741,7 +719,7 @@ DBSplitTile(plane, point, splitx)
|
||||||
int splitx;
|
int splitx;
|
||||||
{
|
{
|
||||||
Tile *tile, *newtile, *tp;
|
Tile *tile, *newtile, *tp;
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, point);
|
GOTOPOINT(tile, point);
|
||||||
|
|
||||||
if (IsSplit(tile)) /* This should always be true */
|
if (IsSplit(tile)) /* This should always be true */
|
||||||
|
|
@ -788,7 +766,7 @@ void
|
||||||
DBFracturePlane(plane, area, resultTbl, undo)
|
DBFracturePlane(plane, area, resultTbl, undo)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
const PaintResultType *resultTbl; /* Paint table, to pinpoint those tiles
|
PaintResultType *resultTbl; /* Paint table, to pinpoint those tiles
|
||||||
* that interact with the paint type.
|
* that interact with the paint type.
|
||||||
*/
|
*/
|
||||||
PaintUndoInfo *undo; /* Record containing everything needed to
|
PaintUndoInfo *undo; /* Record containing everything needed to
|
||||||
|
|
@ -815,7 +793,7 @@ DBFracturePlane(plane, area, resultTbl, undo)
|
||||||
|
|
||||||
start.p_x = area->r_xbot;
|
start.p_x = area->r_xbot;
|
||||||
start.p_y = area->r_ytop - 1;
|
start.p_y = area->r_ytop - 1;
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, &start);
|
GOTOPOINT(tile, &start);
|
||||||
|
|
||||||
/* Each iteration visits another tile on the LHS of the search area */
|
/* Each iteration visits another tile on the LHS of the search area */
|
||||||
|
|
@ -1012,7 +990,7 @@ paintdone:
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
PlaneSetHint(plane, tile);
|
plane->pl_hint = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1054,12 +1032,11 @@ DBMergeNMTiles0(plane, area, undo, mergeOnce)
|
||||||
int clipTop;
|
int clipTop;
|
||||||
Tile *tile, *tp, *tp2, *newtile, *tpnew;
|
Tile *tile, *tp, *tp2, *newtile, *tpnew;
|
||||||
int aspecta, aspectb;
|
int aspecta, aspectb;
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
TileType ttype, ltype, rtype;
|
TileType ttype, ltype, rtype;
|
||||||
|
|
||||||
start.p_x = area->r_xbot;
|
start.p_x = area->r_xbot;
|
||||||
start.p_y = area->r_ytop - 1;
|
start.p_y = area->r_ytop - 1;
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, &start);
|
GOTOPOINT(tile, &start);
|
||||||
|
|
||||||
/* Each iteration visits another tile on the LHS of the search area */
|
/* Each iteration visits another tile on the LHS of the search area */
|
||||||
|
|
@ -1144,23 +1121,23 @@ nmenum:
|
||||||
newtile = TiSplitY(tp2, TOP(tile));
|
newtile = TiSplitY(tp2, TOP(tile));
|
||||||
TiSetBody(newtile, ltype);
|
TiSetBody(newtile, ltype);
|
||||||
if (CANMERGE_X(newtile, BL(newtile)))
|
if (CANMERGE_X(newtile, BL(newtile)))
|
||||||
TiJoinX1(&delayed, newtile, BL(newtile), plane);
|
TiJoinX(newtile, BL(newtile), plane);
|
||||||
if (CANMERGE_X(newtile, TR(newtile)))
|
if (CANMERGE_X(newtile, TR(newtile)))
|
||||||
TiJoinX1(&delayed, newtile, TR(newtile), plane);
|
TiJoinX(newtile, TR(newtile), plane);
|
||||||
if (CANMERGE_Y(newtile, RT(newtile)))
|
if (CANMERGE_Y(newtile, RT(newtile)))
|
||||||
TiJoinY1(&delayed, newtile, RT(newtile), plane);
|
TiJoinY(newtile, RT(newtile), plane);
|
||||||
}
|
}
|
||||||
if (LEFT(tp2) < LEFT(tp))
|
if (LEFT(tp2) < LEFT(tp))
|
||||||
{
|
{
|
||||||
newtile = TiSplitX(tp2, LEFT(tp));
|
newtile = TiSplitX(tp2, LEFT(tp));
|
||||||
TiSetBody(newtile, ltype);
|
TiSetBody(newtile, ltype);
|
||||||
if (CANMERGE_Y(tp2, LB(tp2)))
|
if (CANMERGE_Y(tp2, LB(tp2)))
|
||||||
TiJoinY1(&delayed, tp2, LB(tp2), plane);
|
TiJoinY(tp2, LB(tp2), plane);
|
||||||
if (CANMERGE_Y(tp2, RT(tp2)))
|
if (CANMERGE_Y(tp2, RT(tp2)))
|
||||||
TiJoinY1(&delayed, tp2, RT(tp2), plane);
|
TiJoinY(tp2, RT(tp2), plane);
|
||||||
tp2 = newtile;
|
tp2 = newtile;
|
||||||
}
|
}
|
||||||
TiJoinY1(&delayed, tp2, tp, plane);
|
TiJoinY(tp2, tp, plane);
|
||||||
tp = tp2;
|
tp = tp2;
|
||||||
tp2 = RT(tp2);
|
tp2 = RT(tp2);
|
||||||
}
|
}
|
||||||
|
|
@ -1174,11 +1151,11 @@ nmenum:
|
||||||
newtile = TiSplitY(tp2, BOTTOM(tp));
|
newtile = TiSplitY(tp2, BOTTOM(tp));
|
||||||
TiSetBody(newtile, rtype);
|
TiSetBody(newtile, rtype);
|
||||||
if (CANMERGE_X(tp2, BL(tp2)))
|
if (CANMERGE_X(tp2, BL(tp2)))
|
||||||
TiJoinX1(&delayed, tp2, BL(tp2), plane);
|
TiJoinX(tp2, BL(tp2), plane);
|
||||||
if (CANMERGE_X(tp2, TR(tp2)))
|
if (CANMERGE_X(tp2, TR(tp2)))
|
||||||
TiJoinX1(&delayed, tp2, TR(tp2), plane);
|
TiJoinX(tp2, TR(tp2), plane);
|
||||||
if (CANMERGE_Y(tp2, LB(tp2)))
|
if (CANMERGE_Y(tp2, LB(tp2)))
|
||||||
TiJoinY1(&delayed, tp2, LB(tp2), plane);
|
TiJoinY(tp2, LB(tp2), plane);
|
||||||
tp2 = newtile;
|
tp2 = newtile;
|
||||||
}
|
}
|
||||||
if (RIGHT(tp2) > RIGHT(tile))
|
if (RIGHT(tp2) > RIGHT(tile))
|
||||||
|
|
@ -1186,16 +1163,16 @@ nmenum:
|
||||||
newtile = TiSplitX(tp2, RIGHT(tile));
|
newtile = TiSplitX(tp2, RIGHT(tile));
|
||||||
TiSetBody(newtile, rtype);
|
TiSetBody(newtile, rtype);
|
||||||
if (CANMERGE_Y(newtile, LB(newtile)))
|
if (CANMERGE_Y(newtile, LB(newtile)))
|
||||||
TiJoinY1(&delayed, newtile, LB(newtile), plane);
|
TiJoinY(newtile, LB(newtile), plane);
|
||||||
if (CANMERGE_Y(newtile, RT(newtile)))
|
if (CANMERGE_Y(newtile, RT(newtile)))
|
||||||
TiJoinY1(&delayed, newtile, RT(newtile), plane);
|
TiJoinY(newtile, RT(newtile), plane);
|
||||||
}
|
}
|
||||||
TiJoinY1(&delayed, tp2, tile, plane);
|
TiJoinY(tp2, tile, plane);
|
||||||
tile = tp2;
|
tile = tp2;
|
||||||
tp2 = LB(tp2);
|
tp2 = LB(tp2);
|
||||||
}
|
}
|
||||||
/* Merge tp and tile */
|
/* Merge tp and tile */
|
||||||
TiJoinX1(&delayed, tile, tp, plane);
|
TiJoinX(tile, tp, plane);
|
||||||
TiSetBody(tile, ttype);
|
TiSetBody(tile, ttype);
|
||||||
}
|
}
|
||||||
else /* split direction 1 */
|
else /* split direction 1 */
|
||||||
|
|
@ -1236,11 +1213,11 @@ nmenum:
|
||||||
newtile = TiSplitY(tp2, BOTTOM(tp));
|
newtile = TiSplitY(tp2, BOTTOM(tp));
|
||||||
TiSetBody(newtile, ltype);
|
TiSetBody(newtile, ltype);
|
||||||
if (CANMERGE_X(tp2, BL(tp2)))
|
if (CANMERGE_X(tp2, BL(tp2)))
|
||||||
TiJoinX1(&delayed, tp2, BL(tp2), plane);
|
TiJoinX(tp2, BL(tp2), plane);
|
||||||
if (CANMERGE_X(tp2, TR(tp2)))
|
if (CANMERGE_X(tp2, TR(tp2)))
|
||||||
TiJoinX1(&delayed, tp2, TR(tp2), plane);
|
TiJoinX(tp2, TR(tp2), plane);
|
||||||
if (CANMERGE_Y(tp2, LB(tp2)))
|
if (CANMERGE_Y(tp2, LB(tp2)))
|
||||||
TiJoinY1(&delayed, tp2, LB(tp2), plane);
|
TiJoinY(tp2, LB(tp2), plane);
|
||||||
tp2 = newtile;
|
tp2 = newtile;
|
||||||
}
|
}
|
||||||
if (LEFT(tp2) < LEFT(tile))
|
if (LEFT(tp2) < LEFT(tile))
|
||||||
|
|
@ -1248,12 +1225,12 @@ nmenum:
|
||||||
newtile = TiSplitX(tp2, LEFT(tile));
|
newtile = TiSplitX(tp2, LEFT(tile));
|
||||||
TiSetBody(newtile, ltype);
|
TiSetBody(newtile, ltype);
|
||||||
if (CANMERGE_Y(tp2, LB(tp2)))
|
if (CANMERGE_Y(tp2, LB(tp2)))
|
||||||
TiJoinY1(&delayed, tp2, LB(tp2), plane);
|
TiJoinY(tp2, LB(tp2), plane);
|
||||||
if (CANMERGE_Y(tp2, RT(tp2)))
|
if (CANMERGE_Y(tp2, RT(tp2)))
|
||||||
TiJoinY1(&delayed, tp2, RT(tp2), plane);
|
TiJoinY(tp2, RT(tp2), plane);
|
||||||
tp2 = newtile;
|
tp2 = newtile;
|
||||||
}
|
}
|
||||||
TiJoinY1(&delayed, tp2, tile, plane);
|
TiJoinY(tp2, tile, plane);
|
||||||
tile = tp2;
|
tile = tp2;
|
||||||
tp2 = LB(tp2);
|
tp2 = LB(tp2);
|
||||||
}
|
}
|
||||||
|
|
@ -1268,27 +1245,27 @@ nmenum:
|
||||||
newtile = TiSplitY(tp2, TOP(tile));
|
newtile = TiSplitY(tp2, TOP(tile));
|
||||||
TiSetBody(newtile, rtype);
|
TiSetBody(newtile, rtype);
|
||||||
if (CANMERGE_X(newtile, BL(newtile)))
|
if (CANMERGE_X(newtile, BL(newtile)))
|
||||||
TiJoinX1(&delayed, newtile, BL(newtile), plane);
|
TiJoinX(newtile, BL(newtile), plane);
|
||||||
if (CANMERGE_X(newtile, TR(newtile)))
|
if (CANMERGE_X(newtile, TR(newtile)))
|
||||||
TiJoinX1(&delayed, newtile, TR(newtile), plane);
|
TiJoinX(newtile, TR(newtile), plane);
|
||||||
if (CANMERGE_Y(newtile, RT(newtile)))
|
if (CANMERGE_Y(newtile, RT(newtile)))
|
||||||
TiJoinY1(&delayed, newtile, RT(newtile), plane);
|
TiJoinY(newtile, RT(newtile), plane);
|
||||||
}
|
}
|
||||||
if (RIGHT(tp2) > RIGHT(tp))
|
if (RIGHT(tp2) > RIGHT(tp))
|
||||||
{
|
{
|
||||||
newtile = TiSplitX(tp2, RIGHT(tp));
|
newtile = TiSplitX(tp2, RIGHT(tp));
|
||||||
TiSetBody(newtile, rtype);
|
TiSetBody(newtile, rtype);
|
||||||
if (CANMERGE_Y(newtile, LB(newtile)))
|
if (CANMERGE_Y(newtile, LB(newtile)))
|
||||||
TiJoinY1(&delayed, newtile, LB(newtile), plane);
|
TiJoinY(newtile, LB(newtile), plane);
|
||||||
if (CANMERGE_Y(newtile, RT(newtile)))
|
if (CANMERGE_Y(newtile, RT(newtile)))
|
||||||
TiJoinY1(&delayed, newtile, RT(newtile), plane);
|
TiJoinY(newtile, RT(newtile), plane);
|
||||||
}
|
}
|
||||||
TiJoinY1(&delayed, tp2, tp, plane);
|
TiJoinY(tp2, tp, plane);
|
||||||
tp = tp2;
|
tp = tp2;
|
||||||
tp2 = RT(tp2);
|
tp2 = RT(tp2);
|
||||||
}
|
}
|
||||||
/* Merge tp and tile */
|
/* Merge tp and tile */
|
||||||
TiJoinX1(&delayed, tile, tp, plane);
|
TiJoinX(tile, tp, plane);
|
||||||
TiSetBody(tile, ttype);
|
TiSetBody(tile, ttype);
|
||||||
}
|
}
|
||||||
/* Now repeat until no more merging is possible */
|
/* Now repeat until no more merging is possible */
|
||||||
|
|
@ -1329,8 +1306,7 @@ nmenum:
|
||||||
}
|
}
|
||||||
|
|
||||||
nmdone:
|
nmdone:
|
||||||
PlaneSetHint(plane, tile);
|
plane->pl_hint = tile;
|
||||||
TiFreeIf(delayed);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1364,7 +1340,7 @@ DBDiagonalProc(oldtype, dinfo)
|
||||||
TileType old_n, old_s, old_e, old_w;
|
TileType old_n, old_s, old_e, old_w;
|
||||||
TileType new_n, new_s, new_e, new_w;
|
TileType new_n, new_s, new_e, new_w;
|
||||||
TileType newtype;
|
TileType newtype;
|
||||||
const PaintResultType *resultTbl = dinfo->resultTbl;
|
PaintResultType *resultTbl = dinfo->resultTbl;
|
||||||
|
|
||||||
/* Disassemble old and new types into four quadrants, find the */
|
/* Disassemble old and new types into four quadrants, find the */
|
||||||
/* paint result for each quadrant, then reassemble the result. */
|
/* paint result for each quadrant, then reassemble the result. */
|
||||||
|
|
@ -1435,6 +1411,10 @@ DBDiagonalProc(oldtype, dinfo)
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* For purposes of "undo" recording, record which side we just painted */
|
||||||
|
if (dinfo->side)
|
||||||
|
newtype |= TT_SIDE;
|
||||||
|
|
||||||
return newtype;
|
return newtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1477,7 +1457,7 @@ DBNMPaintPlane0(plane, exacttype, area, resultTbl, undo, method)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
TileType exacttype; /* diagonal info for tile to be changed */
|
TileType exacttype; /* diagonal info for tile to be changed */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
const PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
||||||
* present in the plane, giving the type to
|
* present in the plane, giving the type to
|
||||||
* which the existing tile must change as a
|
* which the existing tile must change as a
|
||||||
* result of this paint operation.
|
* result of this paint operation.
|
||||||
|
|
@ -1519,7 +1499,7 @@ DBNMPaintPlane0(plane, exacttype, area, resultTbl, undo, method)
|
||||||
/* linked list out of them. */
|
/* linked list out of them. */
|
||||||
|
|
||||||
lhead = NULL;
|
lhead = NULL;
|
||||||
DBSrPaintArea(PlaneGetHint(plane), plane, area, &DBAllTypeBits,
|
DBSrPaintArea(plane->pl_hint, plane, area, &DBAllTypeBits,
|
||||||
dbNMEnumFunc, (ClientData) &lhead);
|
dbNMEnumFunc, (ClientData) &lhead);
|
||||||
|
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
|
|
@ -1539,7 +1519,7 @@ DBNMPaintPlane0(plane, exacttype, area, resultTbl, undo, method)
|
||||||
GeoClip(&lhead->r_r, area);
|
GeoClip(&lhead->r_r, area);
|
||||||
start.p_x = area->r_xbot;
|
start.p_x = area->r_xbot;
|
||||||
start.p_y = area->r_ytop - 1;
|
start.p_y = area->r_ytop - 1;
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, &start);
|
GOTOPOINT(tile, &start);
|
||||||
|
|
||||||
/* Ignore tiles that don't interact. This has */
|
/* Ignore tiles that don't interact. This has */
|
||||||
|
|
@ -1628,7 +1608,7 @@ DBNMPaintPlane0(plane, exacttype, area, resultTbl, undo, method)
|
||||||
{
|
{
|
||||||
result = DBPaintPlane(plane, &(lr->r_r), DBSpecialPaintTbl,
|
result = DBPaintPlane(plane, &(lr->r_r), DBSpecialPaintTbl,
|
||||||
(PaintUndoInfo *)NULL);
|
(PaintUndoInfo *)NULL);
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, &(lr->r_r.r_ll));
|
GOTOPOINT(tile, &(lr->r_r.r_ll));
|
||||||
if (undo && UndoIsEnabled())
|
if (undo && UndoIsEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -1788,14 +1768,12 @@ nextrect:
|
||||||
lr = lr->r_next;
|
lr = lr->r_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
lr = lhead;
|
lr = lhead;
|
||||||
while (lr != NULL)
|
while (lr != NULL)
|
||||||
{
|
{
|
||||||
freeMagic1(&mm1, (char *) lr);
|
freeMagic((char *) lr);
|
||||||
lr = lr->r_next;
|
lr = lr->r_next;
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = DBPaintPlane0(plane, area, resultTbl, undo, (method == PAINT_MARK) ?
|
result = DBPaintPlane0(plane, area, resultTbl, undo, (method == PAINT_MARK) ?
|
||||||
|
|
@ -1816,15 +1794,14 @@ nextrect:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbNMEnumFunc(tile, dinfo, arg)
|
dbNMEnumFunc(tile, arg)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo;
|
|
||||||
LinkedRect **arg;
|
LinkedRect **arg;
|
||||||
{
|
{
|
||||||
LinkedRect *lr;
|
LinkedRect *lr;
|
||||||
|
|
||||||
/* Ignore the second call to any diagonal---only count once! */
|
/* Ignore the second call to any diagonal---only count once! */
|
||||||
if (IsSplit(tile) && (dinfo & TT_SIDE)) return 0;
|
if (IsSplit(tile) && SplitSide(tile)) return 0;
|
||||||
|
|
||||||
lr = (LinkedRect *) mallocMagic(sizeof(LinkedRect));
|
lr = (LinkedRect *) mallocMagic(sizeof(LinkedRect));
|
||||||
TiToRect(tile, &lr->r_r);
|
TiToRect(tile, &lr->r_r);
|
||||||
|
|
@ -1908,7 +1885,6 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
||||||
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
||||||
bool mark; /* Mark tiles that were processed */
|
bool mark; /* Mark tiles that were processed */
|
||||||
{
|
{
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
Tile *tp, *tpLast;
|
Tile *tp, *tpLast;
|
||||||
int ysplit;
|
int ysplit;
|
||||||
|
|
||||||
|
|
@ -2015,7 +1991,7 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
||||||
if (mark) dbMarkClient(tile, area);
|
if (mark) dbMarkClient(tile, area);
|
||||||
}
|
}
|
||||||
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
||||||
TiJoinX1(&delayed, tile, tp, plane);
|
TiJoinX(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
||||||
|
|
@ -2031,7 +2007,7 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
||||||
if (mark) dbMarkClient(tile, area);
|
if (mark) dbMarkClient(tile, area);
|
||||||
}
|
}
|
||||||
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
||||||
TiJoinX1(&delayed, tile, tp, plane);
|
TiJoinX(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
||||||
|
|
@ -2040,7 +2016,7 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
||||||
if (mergeFlags&MRG_TOP)
|
if (mergeFlags&MRG_TOP)
|
||||||
{
|
{
|
||||||
tp = RT(tile);
|
tp = RT(tile);
|
||||||
if (CANMERGE_Y(tp, tile)) TiJoinY1(&delayed, tile, tp, plane);
|
if (CANMERGE_Y(tp, tile)) TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
||||||
|
|
@ -2049,14 +2025,13 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
||||||
if (mergeFlags&MRG_BOTTOM)
|
if (mergeFlags&MRG_BOTTOM)
|
||||||
{
|
{
|
||||||
tp = LB(tile);
|
tp = LB(tile);
|
||||||
if (CANMERGE_Y(tp, tile)) TiJoinY1(&delayed, tile, tp, plane);
|
if (CANMERGE_Y(tp, tile)) TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
||||||
#endif /* PAINTDEBUG */
|
#endif /* PAINTDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
TiFreeIf(delayed);
|
|
||||||
return (tile);
|
return (tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2089,7 +2064,7 @@ void
|
||||||
DBPaintType(plane, area, resultTbl, client, undo, tileMask)
|
DBPaintType(plane, area, resultTbl, client, undo, tileMask)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
const PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
||||||
* present in the plane, giving the type to
|
* present in the plane, giving the type to
|
||||||
* which the existing tile must change as a
|
* which the existing tile must change as a
|
||||||
* result of this paint operation.
|
* result of this paint operation.
|
||||||
|
|
@ -2119,10 +2094,9 @@ DBPaintType(plane, area, resultTbl, client, undo, tileMask)
|
||||||
* search.
|
* search.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
start.p_x = area->r_xbot;
|
start.p_x = area->r_xbot;
|
||||||
start.p_y = area->r_ytop - 1;
|
start.p_y = area->r_ytop - 1;
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, &start);
|
GOTOPOINT(tile, &start);
|
||||||
|
|
||||||
/* Each iteration visits another tile on the LHS of the search area */
|
/* Each iteration visits another tile on the LHS of the search area */
|
||||||
|
|
@ -2212,14 +2186,14 @@ enumerate:
|
||||||
if (CANMERGE_Y(newtile, tp) &&
|
if (CANMERGE_Y(newtile, tp) &&
|
||||||
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
||||||
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
||||||
TiJoinY1(&delayed, newtile, tp, plane);
|
TiJoinY(newtile, tp, plane);
|
||||||
|
|
||||||
/* Merge the outside tile to its bottom */
|
/* Merge the outside tile to its bottom */
|
||||||
tp = LB(newtile);
|
tp = LB(newtile);
|
||||||
if (CANMERGE_Y(newtile, tp) &&
|
if (CANMERGE_Y(newtile, tp) &&
|
||||||
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
||||||
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
||||||
TiJoinY1(&delayed, newtile, tp, plane);
|
TiJoinY(newtile, tp, plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clip left */
|
/* Clip left */
|
||||||
|
|
@ -2236,14 +2210,14 @@ enumerate:
|
||||||
if (CANMERGE_Y(newtile, tp) &&
|
if (CANMERGE_Y(newtile, tp) &&
|
||||||
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
||||||
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
||||||
TiJoinY1(&delayed, newtile, tp, plane);
|
TiJoinY(newtile, tp, plane);
|
||||||
|
|
||||||
/* Merge the outside tile to its bottom */
|
/* Merge the outside tile to its bottom */
|
||||||
tp = LB(newtile);
|
tp = LB(newtile);
|
||||||
if (CANMERGE_Y(newtile, tp) &&
|
if (CANMERGE_Y(newtile, tp) &&
|
||||||
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
||||||
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
||||||
TiJoinY1(&delayed, newtile, tp, plane);
|
TiJoinY(newtile, tp, plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
|
|
@ -2302,7 +2276,7 @@ enumerate:
|
||||||
{
|
{
|
||||||
tp = RT(tile);
|
tp = RT(tile);
|
||||||
if (CANMERGE_Y(tile, tp) && (tp->ti_client == client))
|
if (CANMERGE_Y(tile, tp) && (tp->ti_client == client))
|
||||||
TiJoinY1(&delayed, tile, tp, plane);
|
TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "merged up (CHEAP)");
|
dbPaintShowTile(tile, undo, "merged up (CHEAP)");
|
||||||
|
|
@ -2312,7 +2286,7 @@ enumerate:
|
||||||
{
|
{
|
||||||
tp = LB(tile);
|
tp = LB(tile);
|
||||||
if (CANMERGE_Y(tile, tp) && (tp->ti_client == client))
|
if (CANMERGE_Y(tile, tp) && (tp->ti_client == client))
|
||||||
TiJoinY1(&delayed, tile, tp, plane);
|
TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "merged down (CHEAP)");
|
dbPaintShowTile(tile, undo, "merged down (CHEAP)");
|
||||||
|
|
@ -2359,8 +2333,7 @@ paintdone:
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
PlaneSetHint(plane, tile);
|
plane->pl_hint = tile;
|
||||||
TiFreeIf(delayed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -2407,7 +2380,6 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
||||||
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
||||||
ClientData client;
|
ClientData client;
|
||||||
{
|
{
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
Tile *tp, *tpLast;
|
Tile *tp, *tpLast;
|
||||||
int ysplit;
|
int ysplit;
|
||||||
|
|
||||||
|
|
@ -2509,7 +2481,7 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
||||||
TiSetClient(tpLast, client);
|
TiSetClient(tpLast, client);
|
||||||
}
|
}
|
||||||
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
||||||
TiJoinX1(&delayed, tile, tp, plane);
|
TiJoinX(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
||||||
|
|
@ -2525,7 +2497,7 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
||||||
TiSetClient(tpLast, client);
|
TiSetClient(tpLast, client);
|
||||||
}
|
}
|
||||||
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
||||||
TiJoinX1(&delayed, tile, tp, plane);
|
TiJoinX(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
||||||
|
|
@ -2534,7 +2506,7 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
||||||
if (mergeFlags&MRG_TOP)
|
if (mergeFlags&MRG_TOP)
|
||||||
{
|
{
|
||||||
tp = RT(tile);
|
tp = RT(tile);
|
||||||
if (CANMERGE_Y(tp, tile) && (tp->ti_client == client)) TiJoinY1(&delayed, tile, tp, plane);
|
if (CANMERGE_Y(tp, tile) && (tp->ti_client == client)) TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
||||||
|
|
@ -2543,14 +2515,13 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
||||||
if (mergeFlags&MRG_BOTTOM)
|
if (mergeFlags&MRG_BOTTOM)
|
||||||
{
|
{
|
||||||
tp = LB(tile);
|
tp = LB(tile);
|
||||||
if (CANMERGE_Y(tp, tile) && (tp->ti_client == client)) TiJoinY1(&delayed, tile, tp, plane);
|
if (CANMERGE_Y(tp, tile) && (tp->ti_client == client)) TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
||||||
#endif /* PAINTDEBUG */
|
#endif /* PAINTDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
TiFreeIf(delayed);
|
|
||||||
return (tile);
|
return (tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2584,7 +2555,7 @@ int
|
||||||
DBPaintPlaneVert(plane, area, resultTbl, undo)
|
DBPaintPlaneVert(plane, area, resultTbl, undo)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
const PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
||||||
* present in the plane, giving the type to
|
* present in the plane, giving the type to
|
||||||
* which the existing tile must change as a
|
* which the existing tile must change as a
|
||||||
* result of this paint operation.
|
* result of this paint operation.
|
||||||
|
|
@ -2610,10 +2581,9 @@ DBPaintPlaneVert(plane, area, resultTbl, undo)
|
||||||
* search.
|
* search.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
start.p_x = area->r_xbot;
|
start.p_x = area->r_xbot;
|
||||||
start.p_y = area->r_ytop - 1;
|
start.p_y = area->r_ytop - 1;
|
||||||
tile = PlaneGetHint(plane);
|
tile = plane->pl_hint;
|
||||||
GOTOPOINT(tile, &start);
|
GOTOPOINT(tile, &start);
|
||||||
|
|
||||||
/* Each iteration visits another tile on the LHS of the search area */
|
/* Each iteration visits another tile on the LHS of the search area */
|
||||||
|
|
@ -2692,11 +2662,11 @@ enumerate:
|
||||||
|
|
||||||
/* Merge the outside tile to its left */
|
/* Merge the outside tile to its left */
|
||||||
tp = BL(newtile);
|
tp = BL(newtile);
|
||||||
if (CANMERGE_X(newtile, tp)) TiJoinX1(&delayed, newtile, tp, plane);
|
if (CANMERGE_X(newtile, tp)) TiJoinX(newtile, tp, plane);
|
||||||
|
|
||||||
/* Merge the outside tile to its right */
|
/* Merge the outside tile to its right */
|
||||||
tp = TR(newtile);
|
tp = TR(newtile);
|
||||||
if (CANMERGE_X(newtile, tp)) TiJoinX1(&delayed, newtile, tp, plane);
|
if (CANMERGE_X(newtile, tp)) TiJoinX(newtile, tp, plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clip down */
|
/* Clip down */
|
||||||
|
|
@ -2708,11 +2678,11 @@ enumerate:
|
||||||
|
|
||||||
/* Merge the outside tile to its left */
|
/* Merge the outside tile to its left */
|
||||||
tp = BL(newtile);
|
tp = BL(newtile);
|
||||||
if (CANMERGE_X(newtile, tp)) TiJoinX1(&delayed, newtile, tp, plane);
|
if (CANMERGE_X(newtile, tp)) TiJoinX(newtile, tp, plane);
|
||||||
|
|
||||||
/* Merge the outside tile to its right */
|
/* Merge the outside tile to its right */
|
||||||
tp = TR(newtile);
|
tp = TR(newtile);
|
||||||
if (CANMERGE_X(newtile, tp)) TiJoinX1(&delayed, newtile, tp, plane);
|
if (CANMERGE_X(newtile, tp)) TiJoinX(newtile, tp, plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
|
|
@ -2770,7 +2740,7 @@ enumerate:
|
||||||
if (mergeFlags & MRG_LEFT)
|
if (mergeFlags & MRG_LEFT)
|
||||||
{
|
{
|
||||||
tp = BL(tile);
|
tp = BL(tile);
|
||||||
if (CANMERGE_X(tile, tp)) TiJoinX1(&delayed, tile, tp, plane);
|
if (CANMERGE_X(tile, tp)) TiJoinX(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "merged left (CHEAP)");
|
dbPaintShowTile(tile, undo, "merged left (CHEAP)");
|
||||||
|
|
@ -2779,7 +2749,7 @@ enumerate:
|
||||||
if (mergeFlags & MRG_RIGHT)
|
if (mergeFlags & MRG_RIGHT)
|
||||||
{
|
{
|
||||||
tp = TR(tile);
|
tp = TR(tile);
|
||||||
if (CANMERGE_X(tile, tp)) TiJoinX1(&delayed, tile, tp, plane);
|
if (CANMERGE_X(tile, tp)) TiJoinX(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "merged right (CHEAP)");
|
dbPaintShowTile(tile, undo, "merged right (CHEAP)");
|
||||||
|
|
@ -2826,8 +2796,7 @@ paintdone:
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
PlaneSetHint(plane, tile);
|
plane->pl_hint = tile;
|
||||||
TiFreeIf(delayed);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2880,7 +2849,6 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
||||||
int mergeFlags; /* Specify which directions to merge */
|
int mergeFlags; /* Specify which directions to merge */
|
||||||
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
||||||
{
|
{
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
Tile *tp, *tpLast;
|
Tile *tp, *tpLast;
|
||||||
int xsplit;
|
int xsplit;
|
||||||
|
|
||||||
|
|
@ -2975,7 +2943,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
||||||
if (LEFT(tp) < LEFT(tile)) tp = TiSplitX(tp, LEFT(tile));
|
if (LEFT(tp) < LEFT(tile)) tp = TiSplitX(tp, LEFT(tile));
|
||||||
if (RIGHT(tp) > RIGHT(tile))
|
if (RIGHT(tp) > RIGHT(tile))
|
||||||
tpLast = TiSplitX(tp, RIGHT(tile)), TiSetBody(tpLast, newType);
|
tpLast = TiSplitX(tp, RIGHT(tile)), TiSetBody(tpLast, newType);
|
||||||
TiJoinY1(&delayed, tile, tp, plane);
|
TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
||||||
|
|
@ -2988,7 +2956,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
||||||
if (LEFT(tp) < LEFT(tile)) tp = TiSplitX(tp, LEFT(tile));
|
if (LEFT(tp) < LEFT(tile)) tp = TiSplitX(tp, LEFT(tile));
|
||||||
if (RIGHT(tp) > RIGHT(tile))
|
if (RIGHT(tp) > RIGHT(tile))
|
||||||
tpLast = TiSplitX(tp, RIGHT(tile)), TiSetBody(tpLast, newType);
|
tpLast = TiSplitX(tp, RIGHT(tile)), TiSetBody(tpLast, newType);
|
||||||
TiJoinY1(&delayed, tile, tp, plane);
|
TiJoinY(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
||||||
|
|
@ -2998,7 +2966,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
||||||
if (mergeFlags&MRG_LEFT)
|
if (mergeFlags&MRG_LEFT)
|
||||||
{
|
{
|
||||||
tp = BL(tile);
|
tp = BL(tile);
|
||||||
if (CANMERGE_X(tp, tile)) TiJoinX1(&delayed, tile, tp, plane);
|
if (CANMERGE_X(tp, tile)) TiJoinX(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
||||||
|
|
@ -3007,14 +2975,13 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
||||||
if (mergeFlags&MRG_RIGHT)
|
if (mergeFlags&MRG_RIGHT)
|
||||||
{
|
{
|
||||||
tp = TR(tile);
|
tp = TR(tile);
|
||||||
if (CANMERGE_X(tp, tile)) TiJoinX1(&delayed, tile, tp, plane);
|
if (CANMERGE_X(tp, tile)) TiJoinX(tile, tp, plane);
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
if (dbPaintDebug)
|
if (dbPaintDebug)
|
||||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
||||||
#endif /* PAINTDEBUG */
|
#endif /* PAINTDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
TiFreeIf(delayed);
|
|
||||||
return (tile);
|
return (tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3037,7 +3004,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils/styles.h"
|
#include "styles.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
dbPaintShowTile(tile, undo, str)
|
dbPaintShowTile(tile, undo, str)
|
||||||
|
|
@ -3060,16 +3027,6 @@ dbPaintShowTile(tile, undo, str)
|
||||||
TxPrintf("%s --more--", str); fflush(stdout);
|
TxPrintf("%s --more--", str); fflush(stdout);
|
||||||
(void) TxGetLine(answer, sizeof answer);
|
(void) TxGetLine(answer, sizeof answer);
|
||||||
DBWFeedbackClear(NULL);
|
DBWFeedbackClear(NULL);
|
||||||
|
|
||||||
/* To debug tile operations that happen away from the active layout
|
|
||||||
* window, it may be advantageous to replace the display code above
|
|
||||||
* with the print statement below.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
TxPrintf("Debug %s: Tile (%d %d) to (%d %d) type %d\n",
|
|
||||||
str, LEFT(tile), BOTTOM(tile), RIGHT(tile), TOP(tile),
|
|
||||||
TiGetBody(tile));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
#endif /* PAINTDEBUG */
|
#endif /* PAINTDEBUG */
|
||||||
|
|
||||||
|
|
@ -3359,7 +3316,6 @@ TiNMMergeRight(tile, plane)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
Plane *plane;
|
Plane *plane;
|
||||||
{
|
{
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
TileType ttype = TiGetTypeExact(tile);
|
TileType ttype = TiGetTypeExact(tile);
|
||||||
Tile *tp, *tp2, *newtile;
|
Tile *tp, *tp2, *newtile;
|
||||||
|
|
||||||
|
|
@ -3391,7 +3347,7 @@ TiNMMergeRight(tile, plane)
|
||||||
else
|
else
|
||||||
newtile = tile;
|
newtile = tile;
|
||||||
// Join tp to newtile
|
// Join tp to newtile
|
||||||
TiJoinX1(&delayed, newtile, tp, plane);
|
TiJoinX(newtile, tp, plane);
|
||||||
}
|
}
|
||||||
tp = tp2;
|
tp = tp2;
|
||||||
}
|
}
|
||||||
|
|
@ -3408,13 +3364,11 @@ TiNMMergeRight(tile, plane)
|
||||||
newtile = TiSplitY(tp, BOTTOM(tile));
|
newtile = TiSplitY(tp, BOTTOM(tile));
|
||||||
TiSetBody(newtile, ttype);
|
TiSetBody(newtile, ttype);
|
||||||
// join newtile to tile
|
// join newtile to tile
|
||||||
TiJoinX1(&delayed, tile, newtile, plane);
|
TiJoinX(tile, newtile, plane);
|
||||||
// merge up if possible
|
// merge up if possible
|
||||||
if (CANMERGE_Y(tile, RT(tile))) TiJoinY1(&delayed, tile, RT(tile), plane);
|
if (CANMERGE_Y(tile, RT(tile))) TiJoinY(tile, RT(tile), plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TiFreeIf(delayed);
|
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3442,7 +3396,6 @@ TiNMMergeLeft(tile, plane)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
Plane *plane;
|
Plane *plane;
|
||||||
{
|
{
|
||||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
|
||||||
TileType ttype = TiGetTypeExact(tile);
|
TileType ttype = TiGetTypeExact(tile);
|
||||||
Tile *tp, *tp2, *newtile;
|
Tile *tp, *tp2, *newtile;
|
||||||
|
|
||||||
|
|
@ -3475,7 +3428,7 @@ TiNMMergeLeft(tile, plane)
|
||||||
else
|
else
|
||||||
newtile = tile;
|
newtile = tile;
|
||||||
// Join tp to tile
|
// Join tp to tile
|
||||||
TiJoinX1(&delayed, tile, tp, plane);
|
TiJoinX(tile, tp, plane);
|
||||||
tile = newtile;
|
tile = newtile;
|
||||||
}
|
}
|
||||||
tp = tp2;
|
tp = tp2;
|
||||||
|
|
@ -3493,16 +3446,14 @@ TiNMMergeLeft(tile, plane)
|
||||||
newtile = TiSplitY(tp, TOP(tile));
|
newtile = TiSplitY(tp, TOP(tile));
|
||||||
TiSetBody(newtile, ttype);
|
TiSetBody(newtile, ttype);
|
||||||
// join tp to tile
|
// join tp to tile
|
||||||
TiJoinX1(&delayed, tile, tp, plane);
|
TiJoinX(tile, tp, plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Merge up if possible
|
// Merge up if possible
|
||||||
if (CANMERGE_Y(tile, tp)) TiJoinY1(&delayed, tile, tp, plane);
|
if (CANMERGE_Y(tile, tp)) TiJoinY(tile, tp, plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
TiFreeIf(delayed);
|
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,9 +119,8 @@ DBPaint (cellDef, rect, type)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbResolveImages(tile, dinfo, cellDef)
|
dbResolveImages(tile, cellDef)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo;
|
|
||||||
CellDef *cellDef;
|
CellDef *cellDef;
|
||||||
{
|
{
|
||||||
Rect rect;
|
Rect rect;
|
||||||
|
|
@ -131,7 +130,7 @@ dbResolveImages(tile, dinfo, cellDef)
|
||||||
/* Recursive call back to DBPaint---this will ensure that */
|
/* Recursive call back to DBPaint---this will ensure that */
|
||||||
/* all of the planes of the image type are painted. */
|
/* all of the planes of the image type are painted. */
|
||||||
|
|
||||||
DBPaint(cellDef, &rect, TiGetTypeExact(tile) | dinfo);
|
DBPaint(cellDef, &rect, TiGetTypeExact(tile));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -284,7 +283,6 @@ DBPaintValid(cellDef, rect, mask, dinfo)
|
||||||
|
|
||||||
for (t = TT_SELECTBASE; t < DBNumUserLayers; t++)
|
for (t = TT_SELECTBASE; t < DBNumUserLayers; t++)
|
||||||
if (TTMaskHasType(&mmask, t))
|
if (TTMaskHasType(&mmask, t))
|
||||||
{
|
|
||||||
if (DBIsContact(t))
|
if (DBIsContact(t))
|
||||||
{
|
{
|
||||||
tMask = DBResidueMask(t);
|
tMask = DBResidueMask(t);
|
||||||
|
|
@ -312,7 +310,6 @@ DBPaintValid(cellDef, rect, mask, dinfo)
|
||||||
(t << 14) : t) : t);
|
(t << 14) : t) : t);
|
||||||
DBPaint(cellDef, rect, tloc);
|
DBPaint(cellDef, rect, tloc);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -385,7 +382,6 @@ DBEraseValid(cellDef, rect, mask, dinfo)
|
||||||
|
|
||||||
for (t = TT_SELECTBASE; t < DBNumUserLayers; t++)
|
for (t = TT_SELECTBASE; t < DBNumUserLayers; t++)
|
||||||
if (TTMaskHasType(&mmask, t))
|
if (TTMaskHasType(&mmask, t))
|
||||||
{
|
|
||||||
if (DBIsContact(t))
|
if (DBIsContact(t))
|
||||||
{
|
{
|
||||||
tMask = DBResidueMask(t);
|
tMask = DBResidueMask(t);
|
||||||
|
|
@ -413,5 +409,4 @@ DBEraseValid(cellDef, rect, mask, dinfo)
|
||||||
(t << 14) : t) : t);
|
(t << 14) : t) : t);
|
||||||
DBErase(cellDef, rect, tloc);
|
DBErase(cellDef, rect, tloc);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
#include "utils/malloc.h"
|
#include "utils/malloc.h"
|
||||||
|
|
||||||
/* Global variable */
|
|
||||||
|
|
||||||
bool DBPropCompat = TRUE; /* If TRUE, then always save properties to
|
|
||||||
* .mag files as type "string" for backwards
|
|
||||||
* compatibility. If FALSE, then properties
|
|
||||||
* are saved to the .mag file along with their
|
|
||||||
* type. Regardless of the setting, properties
|
|
||||||
* which are reserved keywords are converted
|
|
||||||
* to the best internal representation on input.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
@ -57,16 +47,16 @@ bool DBPropCompat = TRUE; /* If TRUE, then always save properties to
|
||||||
|
|
||||||
void
|
void
|
||||||
DBPropPut(cellDef, name, value)
|
DBPropPut(cellDef, name, value)
|
||||||
CellDef *cellDef; /* Pointer to definition of cell. */
|
CellDef *cellDef; /* Pointer to definition of cell. */
|
||||||
char *name; /* The name of the property desired. */
|
char *name; /* The name of the property desired. */
|
||||||
PropertyRecord *value; /* MUST point to a malloc'ed structure, or NULL.
|
ClientData value; /* MUST point to a malloc'ed structure, or NULL.
|
||||||
* This will be freed when the CellDef is freed.
|
* This will be freed when the CellDef is freed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
HashTable *htab;
|
HashTable *htab;
|
||||||
HashEntry *entry;
|
HashEntry *entry;
|
||||||
PropertyRecord *oldvalue;
|
char *oldvalue;
|
||||||
|
|
||||||
/* Honor the NOEDIT flag. Note that the caller always assumes that */
|
/* Honor the NOEDIT flag. Note that the caller always assumes that */
|
||||||
/* the value would be saved in the hash table, so if it is not */
|
/* the value would be saved in the hash table, so if it is not */
|
||||||
|
|
@ -105,23 +95,12 @@ DBPropPut(cellDef, name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = HashFind(htab, name);
|
entry = HashFind(htab, name);
|
||||||
oldvalue = (PropertyRecord *)HashGetValue(entry);
|
oldvalue = (char *)HashGetValue(entry);
|
||||||
/* All properties are allocated as a single block and can just be freed,
|
if (oldvalue != NULL) freeMagic(oldvalue);
|
||||||
* except for plane properties, which require freeing the plane.
|
if (value == (ClientData)NULL)
|
||||||
*/
|
|
||||||
if (oldvalue != NULL)
|
|
||||||
{
|
|
||||||
if (oldvalue->prop_type == PROPERTY_TYPE_PLANE)
|
|
||||||
{
|
|
||||||
DBFreePaintPlane(oldvalue->prop_value.prop_plane);
|
|
||||||
TiFreePlane(oldvalue->prop_value.prop_plane);
|
|
||||||
}
|
|
||||||
freeMagic((char *)oldvalue);
|
|
||||||
}
|
|
||||||
if (value == (PropertyRecord *)NULL)
|
|
||||||
HashRemove(htab, name);
|
HashRemove(htab, name);
|
||||||
else
|
else
|
||||||
HashSetValue(entry, PTR2CD(value));
|
HashSetValue(entry, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
@ -131,13 +110,13 @@ DBPropPut(cellDef, name, value)
|
||||||
* Get a property from a celldef.
|
* Get a property from a celldef.
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* NULL if the property didn't exist, or if the property record was NULL.
|
* NULL if the property didn't exist, or if the property value was NULL.
|
||||||
* Otherwise, returns a pointer to the property record.
|
* Otherwise, ClientData that represents the property.
|
||||||
*
|
*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PropertyRecord *
|
ClientData
|
||||||
DBPropGet(cellDef, name, found)
|
DBPropGet(cellDef, name, found)
|
||||||
CellDef *cellDef; /* Pointer to definition of cell. */
|
CellDef *cellDef; /* Pointer to definition of cell. */
|
||||||
char *name; /* The name of the property desired. */
|
char *name; /* The name of the property desired. */
|
||||||
|
|
@ -145,12 +124,12 @@ DBPropGet(cellDef, name, found)
|
||||||
* exists.
|
* exists.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PropertyRecord *result;
|
ClientData result;
|
||||||
bool haveit;
|
bool haveit;
|
||||||
HashTable *htab;
|
HashTable *htab;
|
||||||
HashEntry *entry;
|
HashEntry *entry;
|
||||||
|
|
||||||
result = (PropertyRecord *)NULL;
|
result = (ClientData) NULL;
|
||||||
haveit = FALSE;
|
haveit = FALSE;
|
||||||
htab = (HashTable *) cellDef->cd_props;
|
htab = (HashTable *) cellDef->cd_props;
|
||||||
if (htab == (HashTable *) NULL) goto done;
|
if (htab == (HashTable *) NULL) goto done;
|
||||||
|
|
@ -159,7 +138,7 @@ DBPropGet(cellDef, name, found)
|
||||||
if (entry != NULL)
|
if (entry != NULL)
|
||||||
{
|
{
|
||||||
haveit = TRUE;
|
haveit = TRUE;
|
||||||
result = (PropertyRecord *)HashGetValue(entry);
|
result = (ClientData) HashGetValue(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
@ -167,109 +146,6 @@ done:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* DBPropGetString --
|
|
||||||
*
|
|
||||||
* Get a string property from a celldef.
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* NULL if the property didn't exist, or if the property record was NULL.
|
|
||||||
* Otherwise, returns a pointer to the property's string record.
|
|
||||||
*
|
|
||||||
* Notes:
|
|
||||||
* This is basically the original DBPropGet(), when properties were only
|
|
||||||
* allowed to be strings.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *
|
|
||||||
DBPropGetString(cellDef, name, found)
|
|
||||||
CellDef *cellDef; /* Pointer to definition of cell. */
|
|
||||||
char *name; /* The name of the property desired. */
|
|
||||||
bool *found; /* If not NULL, filled in with TRUE iff the property
|
|
||||||
* exists.
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
char *result = NULL;
|
|
||||||
PropertyRecord *proprec;
|
|
||||||
bool haveit;
|
|
||||||
HashTable *htab;
|
|
||||||
HashEntry *entry;
|
|
||||||
|
|
||||||
haveit = FALSE;
|
|
||||||
htab = (HashTable *) cellDef->cd_props;
|
|
||||||
if (htab == (HashTable *) NULL) goto pdone;
|
|
||||||
|
|
||||||
entry = HashLookOnly(htab, name);
|
|
||||||
if (entry != NULL)
|
|
||||||
{
|
|
||||||
proprec = (PropertyRecord *)HashGetValue(entry);
|
|
||||||
if (proprec->prop_type == PROPERTY_TYPE_STRING)
|
|
||||||
{
|
|
||||||
haveit = TRUE;
|
|
||||||
result = proprec->prop_value.prop_string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pdone:
|
|
||||||
if (found != (bool *) NULL) *found = haveit;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* DBPropGetDouble --
|
|
||||||
*
|
|
||||||
* Get a single double-long integer property from a celldef.
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* NULL if the property didn't exist, or if the property record was NULL.
|
|
||||||
* Otherwise, returns a pointer to the property's value record.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
dlong
|
|
||||||
DBPropGetDouble(cellDef, name, found)
|
|
||||||
CellDef *cellDef; /* Pointer to definition of cell. */
|
|
||||||
char *name; /* The name of the property desired. */
|
|
||||||
bool *found; /* If not NULL, filled in with TRUE iff the property
|
|
||||||
* exists.
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
dlong result = 0;
|
|
||||||
PropertyRecord *proprec;
|
|
||||||
bool haveit;
|
|
||||||
HashTable *htab;
|
|
||||||
HashEntry *entry;
|
|
||||||
|
|
||||||
haveit = FALSE;
|
|
||||||
htab = (HashTable *) cellDef->cd_props;
|
|
||||||
if (htab == (HashTable *) NULL) goto ddone;
|
|
||||||
|
|
||||||
entry = HashLookOnly(htab, name);
|
|
||||||
if (entry != NULL)
|
|
||||||
{
|
|
||||||
proprec = (PropertyRecord *)HashGetValue(entry);
|
|
||||||
if (proprec->prop_type == PROPERTY_TYPE_DOUBLE)
|
|
||||||
{
|
|
||||||
haveit = TRUE;
|
|
||||||
result = proprec->prop_value.prop_double[0];
|
|
||||||
}
|
|
||||||
else if (proprec->prop_type == PROPERTY_TYPE_STRING)
|
|
||||||
{
|
|
||||||
haveit = TRUE;
|
|
||||||
sscanf(proprec->prop_value.prop_string, "%"DLONG_PREFIX"d", &result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ddone:
|
|
||||||
if (found != (bool *) NULL) *found = haveit;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* DBPropEnum --
|
* DBPropEnum --
|
||||||
|
|
@ -292,7 +168,7 @@ DBPropEnum(cellDef, func, cdata)
|
||||||
*
|
*
|
||||||
* int foo(name, value, cdata)
|
* int foo(name, value, cdata)
|
||||||
* char *name;
|
* char *name;
|
||||||
* PropertyRecord *value;
|
* ClientData value;
|
||||||
* ClientData cdata;
|
* ClientData cdata;
|
||||||
* {
|
* {
|
||||||
* -- return 0 to continue,
|
* -- return 0 to continue,
|
||||||
|
|
@ -313,7 +189,7 @@ DBPropEnum(cellDef, func, cdata)
|
||||||
HashStartSearch(&hs);
|
HashStartSearch(&hs);
|
||||||
while ((entry = HashNext(htab, &hs)) != NULL)
|
while ((entry = HashNext(htab, &hs)) != NULL)
|
||||||
{
|
{
|
||||||
res = (*func)(entry->h_key.h_name, (PropertyRecord *)entry->h_pointer, cdata);
|
res = (*func)(entry->h_key.h_name, (ClientData) entry->h_pointer, cdata);
|
||||||
if (res != 0) return res;
|
if (res != 0) return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -895,24 +895,6 @@ DBIsContact(type)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* DBLayerPlanes --
|
|
||||||
*
|
|
||||||
* Like LayerPlaneMask(), except as a subroutine, not a macro. For export
|
|
||||||
* to other routines.
|
|
||||||
*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
PlaneMask
|
|
||||||
DBLayerPlanes(type)
|
|
||||||
TileType type;
|
|
||||||
{
|
|
||||||
return LayerPlaneMask(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ DBTechSetVersion(sectionName, argc, argv)
|
||||||
major = minor = rev = 0;
|
major = minor = rev = 0;
|
||||||
rmajor = rminor = rrev = 0;
|
rmajor = rminor = rrev = 0;
|
||||||
|
|
||||||
if (sscanf(vstring, "%d.%d.%d", &rmajor, &rminor, &rrev) != 3)
|
if (sscanf(vstring, "%d.%d.%d", &rmajor, &rminor, &rrev) == 0)
|
||||||
{
|
{
|
||||||
TechError("Badly formed magic version string, should be major.minor.rev\n");
|
TechError("Badly formed magic version string, should be major.minor.rev\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
||||||
|
|
@ -327,11 +327,11 @@ DBTechNoisyNamePlane(planename)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char *
|
char *
|
||||||
DBTypeShortName(
|
DBTypeShortName(type)
|
||||||
TileType type)
|
TileType type;
|
||||||
{
|
{
|
||||||
const NameList *tbl;
|
NameList *tbl;
|
||||||
|
|
||||||
for (tbl = dbTypeNameLists.sn_next;
|
for (tbl = dbTypeNameLists.sn_next;
|
||||||
tbl != &dbTypeNameLists;
|
tbl != &dbTypeNameLists;
|
||||||
|
|
@ -347,11 +347,11 @@ DBTypeShortName(
|
||||||
return ("???");
|
return ("???");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
char *
|
||||||
DBPlaneShortName(
|
DBPlaneShortName(pNum)
|
||||||
int pNum)
|
int pNum;
|
||||||
{
|
{
|
||||||
const NameList *tbl;
|
NameList *tbl;
|
||||||
|
|
||||||
for (tbl = dbPlaneNameLists.sn_next;
|
for (tbl = dbPlaneNameLists.sn_next;
|
||||||
tbl != &dbPlaneNameLists;
|
tbl != &dbPlaneNameLists;
|
||||||
|
|
@ -478,7 +478,7 @@ DBTechPrintTypes(mask, dolist)
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_AppendResult(magicinterp, " ", (char *)NULL);
|
Tcl_AppendResult(magicinterp, " ", (char *)NULL);
|
||||||
#else
|
#else
|
||||||
TxPrintf(" ");
|
TxPrintf(" ", keepname);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -530,7 +530,7 @@ DBTechPrintTypes(mask, dolist)
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_AppendResult(magicinterp, " ", (char *)NULL);
|
Tcl_AppendResult(magicinterp, " ", (char *)NULL);
|
||||||
#else
|
#else
|
||||||
TxPrintf(" ");
|
TxPrintf(" ", keepname);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,14 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
|
|
||||||
/* Types and their names */
|
/* Types and their names */
|
||||||
int DBNumTypes;
|
int DBNumTypes;
|
||||||
const char *DBTypeLongNameTbl[NT];
|
char *DBTypeLongNameTbl[NT];
|
||||||
int DBTypePlaneTbl[NT]; /* Normally accessed as macro "DBPlane(x)" */
|
int DBTypePlaneTbl[NT]; /* Normally accessed as macro "DBPlane(x)" */
|
||||||
NameList dbTypeNameLists = {NULL, NULL, NULL, (ClientData)0, FALSE};
|
NameList dbTypeNameLists = {NULL, NULL, NULL, (ClientData)0, FALSE};
|
||||||
HashTable DBTypeAliasTable;
|
HashTable DBTypeAliasTable;
|
||||||
|
|
||||||
/* Planes and their names */
|
/* Planes and their names */
|
||||||
int DBNumPlanes;
|
int DBNumPlanes;
|
||||||
const char *DBPlaneLongNameTbl[PL_MAXTYPES];
|
char *DBPlaneLongNameTbl[PL_MAXTYPES];
|
||||||
NameList dbPlaneNameLists = {NULL, NULL, NULL, (ClientData)0, FALSE};
|
NameList dbPlaneNameLists = {NULL, NULL, NULL, (ClientData)0, FALSE};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -70,28 +70,28 @@ TileTypeBitMask DBTechActiveLayerBits; /* Layers marked locked in the techfile *
|
||||||
/* Table of default, builtin planes */
|
/* Table of default, builtin planes */
|
||||||
DefaultPlane dbTechDefaultPlanes[] =
|
DefaultPlane dbTechDefaultPlanes[] =
|
||||||
{
|
{
|
||||||
{PL_ROUTER, "router"},
|
PL_ROUTER, "router",
|
||||||
{PL_DRC_ERROR, "designRuleError"},
|
PL_DRC_ERROR, "designRuleError",
|
||||||
{PL_DRC_CHECK, "designRuleCheck"},
|
PL_DRC_CHECK, "designRuleCheck",
|
||||||
{PL_M_HINT, "mhint"},
|
PL_M_HINT, "mhint",
|
||||||
{PL_F_HINT, "fhint"},
|
PL_F_HINT, "fhint",
|
||||||
{PL_R_HINT, "rhint"},
|
PL_R_HINT, "rhint",
|
||||||
{0, NULL}
|
0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Table of default, builtin types */
|
/* Table of default, builtin types */
|
||||||
DefaultType dbTechDefaultTypes[] =
|
DefaultType dbTechDefaultTypes[] =
|
||||||
{
|
{
|
||||||
{TT_SPACE, -1, "space", FALSE},
|
TT_SPACE, -1, "space", FALSE,
|
||||||
{TT_CHECKPAINT, PL_DRC_CHECK, "checkpaint,CP", FALSE},
|
TT_CHECKPAINT, PL_DRC_CHECK, "checkpaint,CP", FALSE,
|
||||||
{TT_CHECKSUBCELL, PL_DRC_CHECK, "checksubcell,CS", FALSE},
|
TT_CHECKSUBCELL, PL_DRC_CHECK, "checksubcell,CS", FALSE,
|
||||||
{TT_ERROR_P, PL_DRC_ERROR, "error_p,EP", FALSE},
|
TT_ERROR_P, PL_DRC_ERROR, "error_p,EP", FALSE,
|
||||||
{TT_ERROR_S, PL_DRC_ERROR, "error_s,ES", FALSE},
|
TT_ERROR_S, PL_DRC_ERROR, "error_s,ES", FALSE,
|
||||||
{TT_ERROR_PS, PL_DRC_ERROR, "error_ps,EPS", FALSE},
|
TT_ERROR_PS, PL_DRC_ERROR, "error_ps,EPS", FALSE,
|
||||||
{TT_MAGNET, PL_M_HINT, "magnet,mag", TRUE},
|
TT_MAGNET, PL_M_HINT, "magnet,mag", TRUE,
|
||||||
{TT_FENCE, PL_F_HINT, "fence,f", TRUE},
|
TT_FENCE, PL_F_HINT, "fence,f", TRUE,
|
||||||
{TT_ROTATE, PL_R_HINT, "rotate,r", TRUE},
|
TT_ROTATE, PL_R_HINT, "rotate,r", TRUE,
|
||||||
{0, 0, NULL, 0}
|
0, 0, NULL, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
|
|
@ -116,24 +116,22 @@ NameList *dbTechNameAddOne();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
DBTechInitPlane(void)
|
DBTechInitPlane()
|
||||||
{
|
{
|
||||||
DefaultPlane *dpp;
|
DefaultPlane *dpp;
|
||||||
const char *cp;
|
char *cp;
|
||||||
|
|
||||||
/* Clear out any old information */
|
/* Clear out any old information */
|
||||||
if (dbPlaneNameLists.sn_next != NULL)
|
if (dbPlaneNameLists.sn_next != NULL)
|
||||||
{
|
{
|
||||||
NameList *tbl;
|
NameList *tbl;
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (tbl = dbPlaneNameLists.sn_next; tbl != &dbPlaneNameLists;
|
for (tbl = dbPlaneNameLists.sn_next; tbl != &dbPlaneNameLists;
|
||||||
tbl = tbl->sn_next)
|
tbl = tbl->sn_next)
|
||||||
{
|
{
|
||||||
freeMagic(tbl->sn_name);
|
freeMagic(tbl->sn_name);
|
||||||
freeMagic1(&mm1, tbl);
|
freeMagic(tbl);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tables of short names */
|
/* Tables of short names */
|
||||||
|
|
@ -142,7 +140,7 @@ DBTechInitPlane(void)
|
||||||
|
|
||||||
for (dpp = dbTechDefaultPlanes; dpp->dp_names; dpp++)
|
for (dpp = dbTechDefaultPlanes; dpp->dp_names; dpp++)
|
||||||
{
|
{
|
||||||
cp = dbTechNameAdd(dpp->dp_names, INT2CD(dpp->dp_plane),
|
cp = dbTechNameAdd(dpp->dp_names, (ClientData) dpp->dp_plane,
|
||||||
&dbPlaneNameLists, FALSE);
|
&dbPlaneNameLists, FALSE);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -207,14 +205,12 @@ DBTechInitType()
|
||||||
{
|
{
|
||||||
NameList *tbl;
|
NameList *tbl;
|
||||||
|
|
||||||
free_magic1_t mm1 = freeMagic1_init();
|
|
||||||
for (tbl = dbTypeNameLists.sn_next; tbl != &dbTypeNameLists;
|
for (tbl = dbTypeNameLists.sn_next; tbl != &dbTypeNameLists;
|
||||||
tbl = tbl->sn_next)
|
tbl = tbl->sn_next)
|
||||||
{
|
{
|
||||||
freeMagic(tbl->sn_name);
|
freeMagic(tbl->sn_name);
|
||||||
freeMagic1(&mm1, tbl);
|
freeMagic(tbl);
|
||||||
}
|
}
|
||||||
freeMagic1_end(&mm1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tables of short names */
|
/* Tables of short names */
|
||||||
|
|
@ -227,7 +223,7 @@ DBTechInitType()
|
||||||
*/
|
*/
|
||||||
for (dtp = dbTechDefaultTypes; dtp->dt_names; dtp++)
|
for (dtp = dbTechDefaultTypes; dtp->dt_names; dtp++)
|
||||||
{
|
{
|
||||||
cp = dbTechNameAdd(dtp->dt_names, INT2CD(dtp->dt_type),
|
cp = dbTechNameAdd(dtp->dt_names, (ClientData) dtp->dt_type,
|
||||||
&dbTypeNameLists, FALSE);
|
&dbTypeNameLists, FALSE);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -268,12 +264,12 @@ DBTechInitType()
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
bool
|
bool
|
||||||
DBTechAddPlane(
|
DBTechAddPlane(sectionName, argc, argv)
|
||||||
const char *sectionName,
|
char *sectionName;
|
||||||
int argc,
|
int argc;
|
||||||
char *argv[])
|
char *argv[];
|
||||||
{
|
{
|
||||||
const char *cp;
|
char *cp;
|
||||||
|
|
||||||
if (DBNumPlanes >= PL_MAXTYPES)
|
if (DBNumPlanes >= PL_MAXTYPES)
|
||||||
{
|
{
|
||||||
|
|
@ -287,7 +283,7 @@ DBTechAddPlane(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cp = dbTechNameAdd(argv[0], INT2CD(DBNumPlanes), &dbPlaneNameLists, FALSE);
|
cp = dbTechNameAdd(argv[0], (ClientData) DBNumPlanes, &dbPlaneNameLists, FALSE);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
DBPlaneLongNameTbl[DBNumPlanes++] = cp;
|
DBPlaneLongNameTbl[DBNumPlanes++] = cp;
|
||||||
|
|
@ -319,7 +315,7 @@ DBTechAddNameToType(newname, ttype, canonical)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
cp = dbTechNameAdd(newname, INT2CD(ttype), &dbTypeNameLists, TRUE);
|
cp = dbTechNameAdd(newname, (ClientData) ttype, &dbTypeNameLists, TRUE);
|
||||||
if (canonical)
|
if (canonical)
|
||||||
DBTypeLongNameTbl[ttype] = cp;
|
DBTypeLongNameTbl[ttype] = cp;
|
||||||
}
|
}
|
||||||
|
|
@ -459,7 +455,7 @@ DBTechAddType(sectionName, argc, argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cp = dbTechNameAdd(argv[1], INT2CD(DBNumTypes), &dbTypeNameLists, FALSE);
|
cp = dbTechNameAdd(argv[1], (ClientData) DBNumTypes, &dbTypeNameLists, FALSE);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
@ -517,7 +513,7 @@ dbTechNewStackedType(type1, type2)
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf, "%s+%s", DBTypeShortName(type1), DBTypeShortName(type2));
|
sprintf(buf, "%s+%s", DBTypeShortName(type1), DBTypeShortName(type2));
|
||||||
cp = dbTechNameAdd(buf, INT2CD(DBNumTypes), &dbTypeNameLists, FALSE);
|
cp = dbTechNameAdd(buf, (ClientData) DBNumTypes, &dbTypeNameLists, FALSE);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
{
|
{
|
||||||
TechError("Couldn't generate new stacking type %s\n", buf);
|
TechError("Couldn't generate new stacking type %s\n", buf);
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue