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.
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
Any other better appoach.
Regards,
Suresh J
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
____________________________________________________________________
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
viewId=ddGetObj(cv~>libName cv~>cellName viewName "test.txt" nil "w" )
---
Erik
Andrew Beckett <and...@DELETETHISBITcadence.com> wrote in message news:<1l9pdvkr7hoemb892...@4ax.com>...
thanks, I was not aware of this.
Bernd
--
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
--
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
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.