Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating text view

941 views
Skip to first unread message

Suresh J

unread,
Jun 3, 2003, 1:17:37 AM6/3/03
to
If we want to create a text view in a cell,
we do in the library manager ,
File -> New -> CellView and selecting Text Editor as the tool in the
new form.

But how to do this in a skill program.
I could not find functions to do this and so decided to create a
directory with the view name and creating two files master.tag and
text.txt inside that directory.

Any other better approach..

Rgds,
Suresh J.

Bernd Fischer

unread,
Jun 3, 2003, 4:15:20 AM6/3/03
to

Open a cell view in memory only with the vie type "text".

dbOpenCellViewByType(
t_libName t_cellName t_viewName t_viewType t_mode
)

Where t_viewType must be "text" e.g.

dbOpenCellViewByType( "myLibName" "myCellName" "myViewName" "text" "a" )


Or open a cell view graphically with

geOpen(
?window w_windowId
?lib t_libName
?cell t_cellName
?view t_viewName
?viewType t_viewType
?mode t_mode
)

Where the keyword argument window don't has to be specified if you use the
viewType "text", e.g.

geOpen(
?lib "myLibName"
?cell "myCellName"
?view "myViewName"
?viewType "text"
?mode "a"
)


Bernd

Suresh J

unread,
Jun 3, 2003, 5:25:01 AM6/3/03
to

Hi,
This works fine.
Thanks.
To edit the text, I do ,
textCV = dbOpenCellViewByType("myLibName" "myCellName" "myViewName"
"text" "r" )
textFP = outfile(textCV->fileName)
fprintf(textFP, "Hi This is a text")
close(textFP)
dbClose(textCV)

Any other better appoach.

Regards,
Suresh J

Bernd Fischer

unread,
Jun 3, 2003, 5:56:17 AM6/3/03
to
I have not tested this. but the mode "r" is read only,
I belief and with 'dbClose' you will not save your
edits. So you may loose all your edits in the cell view.

Try the modes "a" append or "w" overwrite, I guess
and use 'dbSave' before you close the cell view.

But be aware this are only thoughts I have not tested it.

Bernd

--
____________________________________________________________________

Bernd Fischer

Manager Xignal Technologies AG
Electronic Design Automation Leipziger Str. 16
D-82008 Unterhaching
Germany
Fon: +49 89 32 22 72-184
Fax: +49 89 32 22 72-14
mailto:bernd....@xignal.com
http://www.xignal.com
____________________________________________________________________

Andrew Beckett

unread,
Jun 3, 2003, 10:05:41 AM6/3/03
to
Bernd,

Using dbOpenCellViewByType() to open a textual cellView is actually a bug.

It actually creates a CDBA database called "text.txt" (try doing:

cv=dbOpenCellViewByType( "myLibName" "myCellName" "myViewName" "text" "a" )
cv~>myProp="hello"
dbSave(cv)

Take a look at text.txt and it is binary.

This has been fixed in IC50 - it no longer works with "text" as the viewType.

So you should _not_ rely on this behaviour.

Here's some code which allows you to do this in a supported way.

Regards,

Andrew.

/* abOpenTextCellView.il

Author A.D.Beckett
Group Custom IC (UK), Cadence Design Systems Ltd.
Language SKILL
Date Mar 31, 2000
Modified
By

Simple PI for dealing with text cellViews. Typical use is
as follows:

cv=abOpenTextCellView("mylib" "mycell" "notes" "a")
fprintf(cv->port "Testing 123\n")
abCloseTextCellView(cv)

Takes care of creating the files, locking them, and so on.

Ideas for the future:

1. Keep a record of all open text cellViews so that they
can be accessed as a whole - e.g. to close all of them
at once.
2. Multiple calls to abOpenTextCellView() for the same file
whilst still open should be handled gracefully - will just
clobber it at the moment.

***************************************************

SCCS Info: @(#) abOpenTextCellView.il 03/31/00.14:58:19 1.1

*/

;------------------------------------------------------------------------
; Structure for keeping track of a text object
;------------------------------------------------------------------------
(defstruct abTextCellView libName cellName viewName fileName fullPath mode port)

/************************************************************************
* *
* (abOpenTextCellView libName cellName viewName @optional (mode "r")) *
* *
* Open up a text cellView in the same kind of way as a CDBA cellView. *
* The cellView may be opened in "r","a", or "w" modes - default is "r". *
* The return value is a structure instance, of which the most useful *
* slot is the port slot - this enables you to read or write to the *
* file in the cellView. *
* *
************************************************************************/

(procedure (abOpenTextCellView libName cellName viewName @optional (mode "r"))
(let ((fileTail (ddMapGetViewTypeFileName "text"))
fileObj fileName lockId portId textObj)
(setq fileObj (ddGetObj libName cellName viewName fileTail nil mode))
(when fileObj
(if (member mode '("a" "w"))
(progn
;------------------------------------------------------
; Lock the file if in "a" or "w" mode
;------------------------------------------------------
(setq fileName (getq fileObj writePath))
(setq lockId (ddLockPath fileName))
;------------------------------------------------------
; If lockable, then try to open the file
;------------------------------------------------------
(when (ddLockSet lockId "w")
(unless
(setq portId (outfile fileName mode))
(ddLockFree lockId)
)
)
)
(progn
;------------------------------------------------------
; Otherwise if read mode, open file for read - don't
; bother locking it
;------------------------------------------------------
(setq fileName (getq fileObj readPath))
(setq portId (infile fileName))
)
)
;-----------------------------------------------------------
; If the file was opened OK, create the structure
;-----------------------------------------------------------
(when portId
(setq textObj
(make_abTextCellView
?libName libName
?cellName cellName
?viewName viewName
?fileName fileTail
?fullPath fileName
?mode mode
?port portId
)
)
)
)
;-----------------------------------------------------------------
; Return the text object
;-----------------------------------------------------------------
textObj
))

/***********************************************************************
* *
* (abCloseTextCellView textObj) *
* *
* Close a text cellView, referenced by the textObj structure, as *
* returned by abOpenTextCellView. This takes care of closing the file, *
* removing the lock, and cleaning up if the file was empty. *
* *
***********************************************************************/

(procedure (abCloseTextCellView textObj)
(let (lockId)
;-----------------------------------------------------------------
; Close the file itself
;-----------------------------------------------------------------
(when (portp (getq textObj port))
(close (getq textObj port)))
;-----------------------------------------------------------------
; Mark the port as nil, just to avoid accidents
;-----------------------------------------------------------------
(putpropq textObj nil port)
;-----------------------------------------------------------------
; Free any locks on the file (if there were any)
;-----------------------------------------------------------------
(setq lockId (ddLockPath (getq textObj fullPath)))
(ddLockFree lockId)
;-----------------------------------------------------------------
; Release the object. This has the benefit of removing the cellView
; if the text file was empty
;-----------------------------------------------------------------
(ddReleaseObj
(ddGetObj
(getq textObj libName)
(getq textObj cellName)
(getq textObj viewName)
(getq textObj fileName)
)
)
t
))

On Tue, 03 Jun 2003 10:15:20 +0200, Bernd Fischer <bernd....@xignal.de>
wrote:

--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd

Erik Wanta

unread,
Jun 3, 2003, 2:37:08 PM6/3/03
to
Bernd:
I recently ran into the case where dbOpenCellViewByType didn't work in
IC50 like it did in IC446. I had to use ddGetObj instead.

viewId=ddGetObj(cv~>libName cv~>cellName viewName "test.txt" nil "w" )

---
Erik

Andrew Beckett <and...@DELETETHISBITcadence.com> wrote in message news:<1l9pdvkr7hoemb892...@4ax.com>...

Bernd Fischer

unread,
Jun 4, 2003, 4:11:09 AM6/4/03
to
Hi guys,

thanks, I was not aware of this.

Bernd

--

Bernd Fischer

unread,
Jun 4, 2003, 4:45:22 AM6/4/03
to
Andrew,

I was curious and tested this a little bit.
It seems to me a little bit strange.
So if I use your example, your statement is true.
If I use Suresh approach it is also true.

cv = dbOpenCellViewByType( "wk_bernd" "test5" "text" "text" "a" )
port = outfile( cv~>fileName )
fprintf( port "This is a test\n" )
close( port )
dbSave(cv)

file text.txt => text.txt: data

But if I only create a cellview with
cv = dbOpenCellViewByType( "wk_bernd" "test6" "text" "text" "a" )
Open this with the library manager and write some text in it, it becomes
ascii?

file text.txt => text.txt: ascii text

So it seems it is more or less the way how the data was carried into the
file which defines the file type?

Bernd

--

Suresh J

unread,
Jun 4, 2003, 10:01:26 AM6/4/03
to
Andrew thanks for the help.

textCV = abOpenTextCellView(libName, cellName, viewName, "w")
fprintf(textCV->port, "Hi This is a test")
abCloseTextCellView(textCV)

works fine. Also takes care of file locking provided this is the only
function all the users will be using to edit their notes.
(If they directly open from the Library manager, and edit using the text
editor, then two users can edit a text cellview simultaneously).

> cv = dbOpenCellViewByType( "wk_bernd" "test5" "text" "text" "a" )
> port = outfile( cv~>fileName )
> fprintf( port "This is a test\n" )
> close( port )
> dbSave(cv)

Here, for me it puts binary content if I do dbSave(cv).(Mine is IC446)

Thanks & Regards,
Suresh J

Andrew Beckett

unread,
Jun 4, 2003, 12:44:01 PM6/4/03
to
Bernd,

The reason why your second example works is because you don't save the
cellView created with dbOpenCellViewByType. When you invoke
dbOpenCellViewByType, it does the ddGetObj immediately and creates the
directories - but the CDBA file doesn't get created until you save.

That's why the dbSave(cv) clobbers the text file (had you written it).

This is why it got fixed in IC50, so it fails to create the cellView in the
first place - it was just a glorified way of creating the directory in IC446.

Andrew.

ivick...@gmail.com

unread,
Apr 16, 2014, 12:06:58 PM4/16/14
to
Sorry Bernd, I have tried as:

cv = dbOpenCellViewByType( Lib_Name Cell_Name "text" "text" "a" )

and I have the following waring: "*WARNING* (DB-270208): dbOpenCellViewByType: unrecognized database viewType 'text'". Do you think that my current IC (IC6.1.6) version is different?

ivick...@gmail.com

unread,
Apr 16, 2014, 12:01:37 PM4/16/14
to
Sorry Andrew, I have tried your abOpenTextCellView function however I am having the following error: "*Error* eval: undefined function - make_abTextCellView",
Does the make_abTextCellView belong to standar SKILL functions?

Thanks,
Ivick.

Andrew Beckett

unread,
Apr 16, 2014, 11:49:00 PM4/16/14
to
On 04/16/14 17:01, ivick...@gmail.com wrote:
> (defstruct abTextCellView libName cellName viewName fileName fullPath mode port)
...
> Sorry Andrew, I have tried your abOpenTextCellView function however I am having the following error: "*Error* eval: undefined function - make_abTextCellView",
> Does the make_abTextCellView belong to standar SKILL functions?


As I mentioned elsewhere, this is because you've omitted the above line
from the code (for some reason).

Andrew.

Andrew Beckett

unread,
Apr 16, 2014, 11:51:07 PM4/16/14
to
On 04/16/14 17:06, ivick...@gmail.com wrote:
> Sorry Bernd, I have tried as:
>
> cv = dbOpenCellViewByType( Lib_Name Cell_Name "text" "text" "a" )
>
> and I have the following waring: "*WARNING* (DB-270208):
> dbOpenCellViewByType: unrecognized database viewType 'text'". Do you
> think that my current IC (IC6.1.6) version is different?

As I mentioned earlier in the post that you quoted:

> Using dbOpenCellViewByType() to open a textual cellView is actually a bug.
>
> It actually creates a CDBA database called "text.txt" (try doing:
>
> cv=dbOpenCellViewByType( "myLibName" "myCellName" "myViewName" "text" "a" )
> cv~>myProp="hello"
> dbSave(cv)
>
> Take a look at text.txt and it is binary.
>
> This has been fixed in IC50 - it no longer works with "text" as the viewType.
>
> So you should _not_ rely on this behaviour.

That's equally true in IC616. It is the wrong way of creating a text view.

Use something like my abOpenTextCellView() instead.

Andrew.
0 new messages