Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to specify an empty string for strm2oas --subst-char ? #1885

Closed
stefanottili opened this issue Oct 10, 2024 · 5 comments · Fixed by #1888
Closed

how to specify an empty string for strm2oas --subst-char ? #1885

stefanottili opened this issue Oct 10, 2024 · 5 comments · Fixed by #1888
Assignees
Labels
Milestone

Comments

@stefanottili
Copy link

stefanottili commented Oct 10, 2024

In klayout, if the substitution string is "empty" illegal characters in TEXT will not be substituted.

image

How can I specify an empty string for strm2oas on the command line ?

strm2oas --subst-char test_illegal_char/test.oas a.oas
ERROR: Additional arguments required (use -h for help)

strm2oas --subst-char "" test_illegal_char/test.oas a.oas
ERROR: Additional arguments required (use -h for help)

strm2oas --subst-char '' test_illegal_char/test.oas a.oas
ERROR: Additional arguments required (use -h for help)

strm2oas --subst-char \"\" test_illegal_char/test.oas a.oas
This is the only one not giving an ERROR, but uses * as substitution character.
TEXTSTRING "illegal*"

I had to gzip the .oas file to be able to attach it, please gunzip, it's a strict oas.
test.oas.gz

@stefanottili
Copy link
Author

I would prefer the "default" to be "don't replace anything", one could use --subst-char "*" to get the current behavior.
A warning about "illegal" characters would be nice either way.

@klayoutmatthias
Copy link
Collaborator

klayoutmatthias commented Oct 11, 2024

Hi Stefan,

Looks like the parser has trouble with passing empty strings.

The "don't substitute" default behavior proposal is fine with me as long as it applies to "strm2oas". For the GUI application I think, the default should be some safe value. But it could be made optional, so you can turn off character substitution.

Matthias

@stefanottili
Copy link
Author

stefanottili commented Oct 11, 2024

I always expect any tool to write exactly what it read by default.
That even applies to “illegal” oasis, garbage in garbage out.
Especially since “other tools” aka the $$$ tools allow one do this too.

Currently I can’t switch off strm2oas subst-char, in klayout I can do that.

I believe the best solution is to change strm2oas default to “don’t substitute”.
One can use —subst-char “*” if one wants to substitute. A warning would be nice.

@stefanottili
Copy link
Author

stefanottili commented Oct 11, 2024

gds doesn't have the concept of "illegal characters".
I've never seen them used in cell names, only in TEXT, they won't really do any harm there.

They were there either because a certain layout tools allows <tab> or <cr> to be entered in their text entry form and people created multi-line text entries.
Or because a certain fab used binary numbers in the layer:datatype 63:63 IPTAG TEXT as some sort of signature in their stdcell gds.

In both cases, it would be much preferred if a round trip gds->oasis->gds "keeps the TEXT as it was".

@klayoutmatthias klayoutmatthias self-assigned this Oct 12, 2024
@klayoutmatthias klayoutmatthias added this to the 0.29.7 milestone Oct 12, 2024
@klayoutmatthias klayoutmatthias linked a pull request Oct 12, 2024 that will close this issue
@klayoutmatthias
Copy link
Collaborator

I changed the parser to accept empty --subst-char using

strm2oas --subst-char= in.gds out.oas

However, the default is "don't substitute" now, so this patch actually is not required. I left it for completeness.

Matthias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants