'adb' formatting of data files?

Doug Toppin toppin at melpar.UUCP
Tue Jul 11 05:45:02 AEST 1989


I know it is possible to use 'adb' to produce a formatted display
of data files with very little 'code'.
I have a data file composed of an unknown number of
records of the following structure:
struct
{
	unsigned int a : 5;
	unsigned int b : 7;
};
I want to use 'adb' to display the contents of each record.
To do that I need to load the current record into an adb variable,
for each field: mask off the bits from the other field,
for the upper bit field, shift down and then for both, display the field.
My problem is that I have not been able to do the load operation in a script.
If I am operating on one record interactively I can do it with
the following for the 'a' field:
       0?u               * load first record
       $v                * show variables, <0 should have first record
       <0&224%31>a       * using 'a' variable mask away all but the 7-bits,
                           shift down 5-bits by dividing, output to 'a'
       $v                * display variables to see value of 'a'
I want to do this for an unknown number of records using an
adb script but have not been able to do the same steps in the script.
If anyone knows how to do this or knows of a reference please let me know.
If I try to do something with '*0?' I get 'bad segment' error messages.
I an running IBM Xenix 2 for the 286 and it does not have 'sdb'.
thanks
Doug Toppin
uunet!melpar!toppin



More information about the Comp.unix.questions mailing list