T.R | Title | User | Personal Name | Date | Lines |
---|
669.1 | Let's C - how about Fortran? | UFP::MURPHY | Rick - WA1SPT/4 | Wed Jan 20 1988 07:52 | 2 |
| I have it in FORTRAN.. want that?
-Rick
|
669.2 | FORTRAN version | FOO::BHAVNANI | Must be the compiler... | Wed Jan 20 1988 11:27 | 9 |
| Rick,
The FORTRAN example would help. Is it a simplified version of
the example in the Sys Services Ref Manual? The problem I had
with that one was figuring out how to pass *char args to a
FORTRAN routine. If I could do that cleanly, I think I'd be
pretty much set. Tnx,
/ravi
|
669.3 | You got it licked when you solve that one | DPDMAI::BEATTIE | But, Is BLISS ignorance? | Wed Jan 20 1988 12:21 | 16 |
| There is a VAX C include file called descrip.h that declares all
the structure types you need for the BY_DESCRIPTOR passing mechanism
required to effectively talk to VAX FORTRAN (or, for that matter,
most of the rest of VMS)
I've not done it myself recently, but I seem to recall
declare a variable with the string decriptor type
stick the length of your C string in the first word
stick the address of your C string in the second longword
pass a pointer to the decriptor to FORTRAN.
If I had access to C, I'd give you a sample, but I seem to be locked
into FORTRAN-land for a while (*sigh*)
-- Brian
|
669.4 | $DESCRIPTOR (foo, "bar"); | FOO::BHAVNANI | Must be the compiler... | Wed Jan 20 1988 13:39 | 4 |
| Great, I'm going to try that. I wasn't sure what FORTRAN needed
for a *char arg. I've been having fun with descriptors for a
while in C and haven't encountered any major problems. (yet!).
/ravi
|
669.5 | I use this | THE780::MESSENGER | Things fall apart-it's scientific | Wed Jan 20 1988 15:55 | 25 |
|
This is what I use...
#include descrip
/*
* set_desc moves a C string into a string descriptor
*
* usage: set_desc(pointer_to_descriptor, pointer_to_string, length)
* if length is specified as 0, then the actual length of the string
* is used (null termination)
*/
set_desc(desc, string, len)
struct dsc$descriptor_s *desc;
char *string;
int len;
{
desc->dsc$w_length = (len != 0) ? len : strlen(string);
desc->dsc$a_pointer = string;
desc->dsc$b_class = DSC$K_CLASS_S;
desc->dsc$b_dtype = DSC$K_DTYPE_T;
}
- HBM
|
669.6 | Fortran routine (still need descriptors!) | UFP::MURPHY | Rick - WA1SPT/4 | Wed Jan 20 1988 20:58 | 96 |
| INTEGER*4 FUNCTION UTIL$SUBMIT(FILE_SPEC,QUEUE_NAME,
1 DELETE_FILE,COPIES)
C
C FUNCTIONAL DESCRIPTION:
C
C Submits a file to a batch queue or print queue
C
C DUMMY ARGUMENTS:
C
C FILE_SPEC Name of the file to submit
C QUEUE_NAME Name of the queue to use
C DELETE_FILE Boolean, TRUE to delete after submit
C COPIES Count of copies to print; zero for default or batch.
C
C IMPLICIT INPUTS:
C
C none
C
C IMPLICIT OUTPUTS:
C
C none
C
C FUNCTION VALUE:
C
C $SNDJBCW return status
C
C SIDE EFFECTS:
C
C none
C
C
IMPLICIT NONE
INCLUDE '($SJCDEF)'
INCLUDE '($SYSSRVNAM)'
INTEGER*4 STATUS
STRUCTURE /ITEM_LIST/
INTEGER*2 BUF_LEN
INTEGER*2 ITEM_CODE
INTEGER*4 BUF_ADDR
INTEGER*4 RET_LEN
END STRUCTURE !ITEM_LIST
RECORD /ITEM_LIST/ SNDJBC_LIST(5)
CHARACTER*(*) FILE_SPEC
CHARACTER*(*) QUEUE_NAME
LOGICAL*1 DELETE_FILE
INTEGER*4 COPIES
INTEGER*4 SJC_EFN
INTEGER*4 LIB$GET_EF
INTEGER*4 LIB$FREE_EF
INTEGER*4 FILE_SPEC_LEN
INTEGER*4 QUEUE_NAME_LEN
CHARACTER*255 TEMP_BUF
STATUS = LIB$GET_EF(SJC_EFN)
IF (.NOT. STATUS) THEN
UTIL$SUBMIT = STATUS
RETURN
ENDIF
CALL STR$TRIM(TEMP_BUF, FILE_SPEC,FILE_SPEC_LEN)
CALL STR$TRIM(TEMP_BUF, QUEUE_NAME,QUEUE_NAME_LEN)
SNDJBC_LIST(1).BUF_LEN = QUEUE_NAME_LEN
SNDJBC_LIST(1).ITEM_CODE = SJC$_QUEUE
SNDJBC_LIST(1).BUF_ADDR = %LOC(QUEUE_NAME)
SNDJBC_LIST(1).RET_LEN = 0
SNDJBC_LIST(2).BUF_LEN = FILE_SPEC_LEN
SNDJBC_LIST(2).ITEM_CODE = SJC$_FILE_SPECIFICATION
SNDJBC_LIST(2).BUF_ADDR = %LOC(FILE_SPEC)
SNDJBC_LIST(2).RET_LEN = 0
SNDJBC_LIST(3).BUF_LEN = 0
IF (DELETE_FILE) THEN
SNDJBC_LIST(3).ITEM_CODE = SJC$_DELETE_FILE
ELSE
SNDJBC_LIST(3).ITEM_CODE = SJC$_NO_DELETE_FILE
END IF
SNDJBC_LIST(3).RET_LEN = 0
IF (COPIES .GT. 0) THEN
SNDJBC_LIST(4).BUF_LEN = 4
SNDJBC_LIST(4).ITEM_CODE = SJC$_FILE_COPIES
SNDJBC_LIST(4).BUF_ADDR = %LOC(COPIES)
SNDJBC_LIST(4).RET_LEN = 0
SNDJBC_LIST(5).BUF_LEN = 0
SNDJBC_LIST(5).ITEM_CODE = 0
ELSE
SNDJBC_LIST(4).BUF_LEN = 0
SNDJBC_LIST(4).ITEM_CODE = 0
END IF
STATUS = sys$sndjbcw (
1 %VAL(SJC_EFN),
1 %VAL(SJC$_ENTER_FILE),,
1 SNDJBC_LIST,,,)
CALL LIB$FREE_EF(SJC_EFN)
UTIL$SUBMIT = STATUS
RETURN
END
|