Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Starbase problem with Fortran

SOLVED
Go to solution
Yong Zhang
Occasional Advisor

Starbase problem with Fortran

First, I run the following three commands (as 'root') and the correponding results are attached as file '1.txt', '2.txt', '3.txt', respectively (no result when runing the 3rd command):

swlist
uname -a
swlist -lfileset -astate | grep -v \# | grep -v conf



Attachment 'graphinfo.txt' is the result when runing command '/usr/bin/graphinfo > graphinfo.txt', while 'test.f' is the simple Fortran program I wrote. I am using Fortran90 compiler and the attachment 'Makefile' is used to compile and link 'test.f'.


Following is the error message when I run the program 'test':

$ ./test
Starbase error 3: Device kind is not supported for the specified device.
Procedure name: gopen
File descriptor: -1
Device file name: Unknown
Library location: device control (10)
fildes: -1
$


Any advice/help is highly appreciated.
Yong
15 REPLIES
Mike Stroyan
Honored Contributor
Solution

Re: Starbase problem with Fortran

You need to change your includes from the /usr/include ones meant for f77 to the starbase-f90.1.h and starbase-f90.2.h meant for f90.
You need to change the parameter passing for strings so you put a trailing null character at the end.
You need to specify a window name rather than a crt device file. That window can be created with xwcreate, or
can be created by some other method and then mapped to a gopen string parameter with a call to the C routine- make_X11_gopen_string.
The attached example works with a window created by "xwcreate test".
While f90 can make calls to starbase, you would be better served by using C code for the window creation and main program. Fortran is not well suited to the event loop based model that X11 expects. You can use a gopen fildes from C code that is passed into fortran routines.
You could start with an example like /opt/graphics/starbase/demos/starbase/motif_sb1.c
and call your fortran code from that C/motif main body.
Yong Zhang
Occasional Advisor

Re: Starbase problem with Fortran

It is working. Thanks so much.

BTW, besides 'Grapgics Administration Guide for HP UX 11.x' (http://www.hp.com/workstations/support/documentation/manuals/user_guides/graphics/GAG11/GAG.html), are there any documents/manuals to get more ideas?

Bill McNAMARA_1
Honored Contributor

Re: Starbase problem with Fortran

You should find a lot of docs on your system in /usr/share/docs

Bill
It works for me (tm)
Mike Stroyan
Honored Contributor

Re: Starbase problem with Fortran

There are documents on Starbase at
http://docs.hp.com./hpux/dev/index.html#Starbase
There is a paper-only manual,
98592-90081
Starbase Graphics Techniques
which is more of a Starbase tutorial. Starbase is being replaced by OpenGL. There is no Starbase support in 11iV1.5 for Itanium systems. However, there is no Fortran binding shipped for OpenGL.
You need to call OpenGL from C or C++ code.
Yong Zhang
Occasional Advisor

Re: Starbase problem with Fortran

I got another problem in using Exceed to access my HP machine remotely.

After you guru's help, I could use Starbase successfully with the demo program 'simple_f.f' from '/opt/graphics/starbase/examples/dl' (modified according to your suggestions, see attchment). I could run the program in front of the HP machine (got a cube). But when I run the program in my PC remotly, I got the following error messages:

$ ./simple_f
Starbase error 1: Graphics device is not initialized for this operation.
Procedure name: open_segment
File descriptor: 2063865000
Device file name: Unknown
Library location: global definitions (1)
Starbase error 1: Graphics device is not initialized for this operation.
Procedure name: close_segment
File descriptor: 2063865000
Device file name: Unknown
Library location: global definitions (1)
Starbase error 1: Graphics device is not initialized for this operation.
Procedure name: refresh_segment
File descriptor: 2063865000
Device file name: Unknown
Library location: global definitions (1)
$

I could run other programs like 'liberty' from '/opt/graphics/starbase/demos/dl' remotly on my PC.

Do I need to install any other patches? FYI, the result running 'swlist -l product' on the HP machine.

Any input is highly appreciated.

Volker Borowski
Honored Contributor

Re: Starbase problem with Fortran

Hi Yong,

I think the gurus above would have a slightly higher intention to help you again, if you would provide some points for the solution they already gave you.

No points for this post please.
Volker
Yong Zhang
Occasional Advisor

Re: Starbase problem with Fortran

Sure. But how can I do that?
Yong Zhang
Occasional Advisor

Re: Starbase problem with Fortran

Sorry, I knew how to that. Thank you for the help.
Yong Zhang
Occasional Advisor

Re: Starbase problem with Fortran

Sorry, I knew how to do that. Thank you for the remind.
Mike Stroyan
Honored Contributor

Re: Starbase problem with Fortran

It looks like you need to fix up the include lines for the dl header files. That error message complains about fildes
Mike Stroyan
Honored Contributor

Re: Starbase problem with Fortran

I don't know how my last posting got so truncated.

It looks like you need to fix up the include lines for the dl header files.
That error message complains about fildes 2063865000, which is a really bad number for a fildes, but reasonable value for the address of a local variable on the stack.
It looks like the "call open_segment" and other uses of dl.h functions passed fildes by reference as it would if there was no correct
header file declaration for the functions. I have attached a version of simple_f.f that includes the right f90 header files.
Yong Zhang
Occasional Advisor

Re: Starbase problem with Fortran

Is there any document I can refer to for the Starbase error number, e.g., 'Starbase error 2054'?

Thanks a lot.
Yong
Mike Stroyan
Honored Contributor

Re: Starbase problem with Fortran

You can get the strings for starbase error numbers from-
dumpmsg /opt/graphics/common/lib/nls/msg/C/hpgfx.cat
There is no document with expanded explaination of possible causes.
Error 2054 is "Exec failed.".
It is probably a failure starting one of the background process commands in /opt/graphics/common/lbin .
You could use the tusc utility on 11.0 to look for why an exec failed. It is available from
http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/tusc-7.0/
Yong Zhang
Occasional Advisor

Re: Starbase problem with Fortran

Now I have no problem with the remote display (Exceed) for 'simple_f', but there is just nothing displayed in that window I specified ('sb_win' with 'xwcreate') for 'stick_leg_f.f'. Any suggestions? Pls. refer to the attachment for the '.f' files.

Thanks,
Yong
Mike Stroyan
Honored Contributor

Re: Starbase problem with Fortran

The problem with stick_leg_f.f is likely to me that you are using Exceed in 24 bit mode but the example uses a default color of pixel value 1. That would be practically black on black.
You can call line_color(fildes, 0.1, 0.4, 0.9)
to make the program use a particular RGB line color.
It seems that the library assumes a particular RGB encoding, so it may get the red, green , and blue channels confused when displayed to exceed. You will also see much faster drawing for simple lines if you force the driver to 'sox11' instead of the default 'hpvmx' that uses software rasterization to support depth comparisons.