[comp.os.vms] ACCDEF vs ACRDEF

hydrovax@nmtsun.nmt.edu (M. Warner Losh) (01/27/88)

Greetings,
  time for a new discussion on this group.  I'm sure this one
gets talked about every so often.  If so, would some kind sole
send me summaries of the previous discussions so we can use the
bandwidth to discuss more pressing issues.

  I am in the process of writing an accounting utility that reads
ACCOUNTING records from an accounting file that was written by VMS
Version 4.4.  I have found the supplemental information in the
accounting utility documentation very useful.  However, I'm a bit
fuzzy on a few points.

    First, since I'm writing this utility in 'C', I'd like to be
able to use the pre-defined structures that DEC gives you as part of
the distribution.  However, I find that there is no ACRDEF.H,
which is the name that SHOULD be there, according to the appendix
in the accounting utility manual.  There is a ACCDEF.H that looks
a little bit like the correct data structures, but not quite.
Upon close inspection, I found that the data structures had the
same fields (sort of), but they were in a different order, in addition
to some other basic differences.

   Second, I found $ACRDEF in the SYS$LIBRARY:STARLET.MLB (I think, or
maybe it was LIB.)  Does anybody have a way of converting this into
'C' structure definitions?  I have asked this question before on the
SDL discussion, but haven't gotten an answer yet.

   Finally, I get to my question : What is ACCDEF used for, and why did
I get this module with my 'C' compiler (version 2.2 on VMS 4.4) instead
of ACRDEF.  Is there some accounting file reading facility that I have
overlooked in my search through the Orange binders?  Or do I have
to hack out my own ACRDEF.H file, so I can read the raw data.


-- 
bitnet:	lush@nmt.csnet			M. Warner Losh
csnet:	warner%hydrovax@nmtsun
uucp:	...{cmcl2, ihnp4}!lanl!unmvax!nmtsun!warner%hydrovax
	...{cmcl2, ihnp4}!lanl!unmvax!nmtsun!hydrovax
Warning:  Hydrovax is both a machine, and an account, so be careful.

LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU) (02/12/88)

	I am in the process of writing an accounting utility that reads
	ACCOUNTING records from an accounting file that was written by VMS
	Version 4.4....I'm writing this utility in 'C', I'd like to be able to
	use the pre-defined structures that DEC gives you as part of the
	distribution.  However, I find that there is no ACRDEF.H, which is the
	name that SHOULD be there, according to the appendix in the accounting
	utility manual.  There is a ACCDEF.H that looks a little bit like the
	correct data structures, but not quite.  Upon close inspection, I
	found that the data structures had the same fields (sort of), but they
	were in a different order, in addition to some other basic
	differences.

	...I found $ACRDEF in the SYS$LIBRARY:STARLET.MLB (I think, or
	maybe it was LIB.)  Does anybody have a way of converting this into
	'C' structure definitions?

See below.

	...What is ACCDEF used for, and why did I get this module with my 'C'
	compiler (version 2.2 on VMS 4.4) instead of ACRDEF.  Is there some
	accounting file reading facility that I have overlooked in my search
	through the Orange binders?  Or do I have to hack out my own ACRDEF.H
	file, so I can read the raw data.

$ACCDEF contains definitions for describing accounting messages; see the
documentation of $CREPRC for an example - you can receive such a message when
a subprocess terminates.  You would also use it when constructing accounting
messages.

As to building .H files:  I guess it is time to post the enclosed file again.

							-- Jerry
$!
$! Drive generation of C #define header file from MACRO definitions
$!
$! Usage:
$!		@C_DEFS	name
$!
$! where $NAME is a definitional macro in either STARLET.MLB or LIB.MLB.
$! Output: []'p1'.H
$!
$! Note:  This command file can be changed to produce files in languages other
$! than C.  To do this, change the definitions of "lang" and "type" to the
$! language name and default file type for include files; the "write DEFS_MAR"
$! statements to create header and trailer comments appropriate to the new
$! language; and the definition of the macro EMIT to produce the right kind
$! of definition lines.
$!
$! Originally written and posted to INFOVAX by:
$!
$! W.J.Moeller, GWDG, D-3400 Goettingen, F.R.Germany  <GWD21T@DGOGWD01.BITNET>
$!                                                 Phone +49 551 201516
$!
$! Later revised by Jerry Leichter (LEICHTER@YALE)
$! 
$! Revision History
$! 0.0	??-???-?? WJM	Creation
$! 1.0	 6-Apr-87 JSL	Centralize actual creation of output lines in the EMIT
$!			macro; this makes changes a lot easier.  Similarly,
$!			define the output file type ("type") and the language
$!			("lang") in symbols to simplify changes.  Allow for
$!			special handling of negative values in EMIT - for C,
$!			wrap them in parentheses.  Try to warn the user if
$!			it looks like there was an error.
$ set noon
$ on control_y then goto fin
$ lang = "C"
$ type = "H"
$ open/write DEFS_MAR []defs.tmp
$ write DEFS_MAR "    .print;/*"
$ write DEFS_MAR "    .print; *				''p1'.''type'"
$ write DEFS_MAR "    .print; *"
$ write DEFS_MAR "    .print; * Definitions created by ''lang'_DEFS",	-
					" at ''f$time()'"
$ write DEFS_MAR "    .print; */"
$ write DEFS_MAR "    $''p1'"
$ write DEFS_MAR "    .print;/*"
$ write DEFS_MAR "    .print; * End of ''lang'_DEFS definitions"
$ write DEFS_MAR "    .print; */"
$ write DEFS_MAR "    .end"
$ close DEFS_MAR
$!
$ define/user SYS$ERROR 'p1'.'type	! MACRO puts .PRINT output here
$ macro/nolist/noobject SYS$INPUT+SYS$LIBRARY:LIB/LIB+SYS$DISK:[]defs.tmp
        .MACRO  $GBLINI GBL
	.MACRO	EMIT	SYM,VALUE
	.IF	LT	%LOCATE(<->,VALUE)-%LENGTH(VALUE)
.print;#define SYM	(VALUE)
	.IFF
.print;#define SYM	VALUE
	.ENDC
	.ENDM
        .MACRO  $DEF    SYM,ALLOC,SIZ
        .if     NB,SYM
SYM:
	EMIT	SYM,\SYM
        .endc
        .IIF    NB,ALLOC,       ALLOC   SIZ
        .ENDM   $DEF
        .MACRO  $EQU    SYM,VAL
        SYM=VAL
	EMIT	SYM,\SYM
        .ENDM   $EQU
        .MACRO  $VIELD1 MOD,SEP,SYM,SIZ,MSK
        SIZ...=1
        .IIF    NB,SIZ, SIZ...=SIZ
        .IF     NB,SYM
        MOD'SEP'V_'SYM=BIT...
	EMIT	MOD'SEP'V_'SYM,\MOD'SEP'V_'SYM
        .if     nb,siz
MOD'SEP'S_'SYM=SIZ
	EMIT	MOD'SEP'S_'SYM,\MOD'SEP'S_'SYM
        .endc
        .if     nb,msk
MOD'SEP'M_'SYM=<<<1@SIZ...>-1>@BIT...>
	EMIT	MOD'SEP'M_'SYM,\MOD'SEP'M_'SYM
        .endc
        .ENDC
        BIT...=BIT...+SIZ...
        .ENDM   $VIELD1
        .ENDM   $GBLINI
$ 
$!
$ assign/user _NL: SYS$ERROR			!Avoid "No strings matched"
$ assign/user _NL: SYS$OUTPUT
$ search/nooutput 'p1'.'type' "%MACRO-"
$ if $severity .ne. 1 then goto fin
$ write SYS$ERROR "Error in producing ''p1'.''type' - file not usable."
$ write SYS$ERROR "(This probably means that there is no $",p1," macro.)"
$fin:
$ close/err=noerrdefs DEFS_MAR
$noerrdefs:
$ delete/nolog []defs.tmp;