PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
libbif.c File Reference
Include dependency graph for libbif.c:

Go to the source code of this file.

Data Structures

struct  bof_record
 
struct  int_record
 
struct  label_record
 
struct  float_record
 

Macros

#define ENDIAN_1   1
 
#define ENDIAN_2   2
 
#define ENDIAN_3   3
 
#define ENDIAN_4   4
 
#define BOF   0x9
 
#define INTEGER   0x2
 
#define FLOAT   0x3
 
#define LABEL   0x4
 
#define EXCEL_VERS   0x2
 
#define WORKSHEET   0x10
 

Functions

 close (fd)
 
 unlink (name)
 
 if (fd< 0)
 
 do_header (fd)
 
 return (fd)
 
 if (endian()==ENDIAN_2)
 
 if (i, 255)
 
int endian (void)
 

Variables

int junk =write(fd,&bof,sizeof(struct bof_record))
 
intjunkp
 
int fd =open(name,O_CREAT|O_RDWR,0666)
 
char * name
 
bof hi_opcode =BOF
 
bof lo_opcode = 0x0
 
bof hi_length =0x4
 
bof lo_length =0x0
 
bof hi_version =EXCEL_VERS
 
bof lo_version =0x0
 
bof hi_filetype =WORKSHEET
 
bof lo_filetype =0x0
 
int val
 
int row
 
int column
 
short s_row
 
short s_column =(short)column
 
intrec rgbhi =0x0
 
intrec rgbmed =0x0
 
intrec rgblo =0x0
 
intrec hi_row =(char)s_row&0xff
 
intrec lo_row =(char)(s_row>>8)&0xff
 
intrec hi_column =(char)(s_column&0xff)
 
intrec lo_column =(char)(s_column>>8)&0xff
 
intrec hi_data =(val & 0xff)
 
intrec lo_data =(val & 0xff00)>>8
 
double value
 
unsigned char * sptr =(unsigned char *) &value
 
unsigned char * dptr =(unsigned char *) &floatrec.data
 
char * string
 
int i =strlen(string)
 
labelrec str_array [i] =0
 
labelrec string_length =i
 

Macro Definition Documentation

#define BOF   0x9

Definition at line 100 of file libbif.c.

#define ENDIAN_1   1

Definition at line 50 of file libbif.c.

#define ENDIAN_2   2

Definition at line 52 of file libbif.c.

#define ENDIAN_3   3

Definition at line 54 of file libbif.c.

#define ENDIAN_4   4

Definition at line 56 of file libbif.c.

#define EXCEL_VERS   0x2

Definition at line 104 of file libbif.c.

#define FLOAT   0x3

Definition at line 102 of file libbif.c.

#define INTEGER   0x2

Definition at line 101 of file libbif.c.

#define LABEL   0x4

Definition at line 103 of file libbif.c.

#define WORKSHEET   0x10

Definition at line 105 of file libbif.c.

Function Documentation

close ( fd  )
do_header ( fd  )
int endian ( void  )

Definition at line 411 of file libbif.c.

412 {
413  long long foo = 0x0102030405060708LL;
414  long foo1 = 0x012345678;
415  unsigned char *c,c1,c2,c3,c4,c5,c6,c7,c8;
416  c=(unsigned char *)&foo;
417  c1=*c++;
418  c2=*c++;
419  c3=*c++;
420  c4=*c++;
421  c5=*c++;
422  c6=*c++;
423  c7=*c++;
424  c8=*c;
425 
426  /*--------------------------------------------------------------*/
427  /* printf("%x %x %x %x %x %x %x %x\n",c1,c2,c3,c4,c5,c6,c7,c8); */
428  /*--------------------------------------------------------------*/
429 
430  /* Little Endian format ? ( Intel ) */
431  if( (c1==0x08) && (c2==0x07) && (c3==0x06) && (c4==0x05) &&
432  (c5==0x04) && (c6==0x03) && (c7==0x02) && (c8==0x01) )
433  return(ENDIAN_1);
434  /* Big Endian format ? ( Sparc, Risc... */
435  if( (c1==0x01) && (c2==0x02) && (c3==0x03) && (c4==0x04) &&
436  (c5==0x05) && (c6==0x06) && (c7==0x07) && (c8==0x08) )
437  return(ENDIAN_2);
438  /* Middle Endian format ? ( ARM ... ) */
439  if( (c1==0x04) && (c2==0x03) && (c3==0x02) && (c4==0x01) &&
440  (c5==0x08) && (c6==0x07) && (c7==0x06) && (c8==0x05) )
441  return(ENDIAN_3);
442  c=(unsigned char *)&foo1;
443  c1=*c++;
444  c2=*c++;
445  c3=*c++;
446  c4=*c++;
447  /* Another middle endian format ? ( PDP-11 ... ) */
448  if( (c1==0x34) && (c2==0x12) && (c3==0x78) && (c4==0x56))
449  return(ENDIAN_4);
450 
451  return(-1);
452 }
double c
Definition: multiplex.c:22
#define ENDIAN_4
Definition: libbif.c:56
pthread_attr_t foo
Definition: iozone.c:18592
#define ENDIAN_3
Definition: libbif.c:54
#define ENDIAN_1
Definition: libbif.c:50
#define ENDIAN_2
Definition: libbif.c:52
if ( )

Definition at line 196 of file libbif.c.

197  {
198  printf("Error opening file %s\n",name);
199  exit(-1);
200  }
#define printf
Definition: papi_test.h:125
char * name
Definition: iozone.c:23648
void exit()

Here is the call graph for this function:

if ( endian()  = =ENDIAN_2)

Definition at line 295 of file libbif.c.

296  {
297  dptr[0]=sptr[7]; /* Convert to Little Endian */
298  dptr[1]=sptr[6];
299  dptr[2]=sptr[5];
300  dptr[3]=sptr[4];
301  dptr[4]=sptr[3];
302  dptr[5]=sptr[2];
303  dptr[6]=sptr[1];
304  dptr[7]=sptr[0];
305  }
unsigned char * dptr
Definition: libbif.c:278
unsigned char * sptr
Definition: libbif.c:278
if ( i  ,
255   
)

Definition at line 379 of file libbif.c.

394 {
395 #else
396 do_eof(fd)
397 int fd;
398 {
399 #endif
400  char buf[]={0x0a,0x00,0x00,0x00};
401  junk=write(fd,buf,4);
402 }
int fd
Definition: iozone.c:1291
char buf[200]
Definition: iozone.c:19609
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
int junk
Definition: fileop.c:77
int
Definition: iozone.c:18528
return ( fd  )
unlink ( name  )

Variable Documentation

int column

Definition at line 235 of file libbif.c.

dptr =(unsigned char *) &floatrec.data

Definition at line 278 of file libbif.c.

int fd =open(name,O_CREAT|O_RDWR,0666)

Definition at line 170 of file libbif.c.

labelrec hi_column =(char)(s_column&0xff)

Definition at line 251 of file libbif.c.

intrec hi_data =(val & 0xff)

Definition at line 253 of file libbif.c.

bof hi_filetype =WORKSHEET

Definition at line 221 of file libbif.c.

labelrec hi_length =0x4

Definition at line 217 of file libbif.c.

labelrec hi_opcode =BOF

Definition at line 215 of file libbif.c.

labelrec hi_row =(char)s_row&0xff

Definition at line 249 of file libbif.c.

bof hi_version =EXCEL_VERS

Definition at line 219 of file libbif.c.

i =strlen(string)

Definition at line 361 of file libbif.c.

junk =write(fd,&bof,sizeof(struct bof_record))

Definition at line 58 of file libbif.c.

int * junkp

Definition at line 58 of file libbif.c.

labelrec lo_column =(char)(s_column>>8)&0xff

Definition at line 252 of file libbif.c.

intrec lo_data =(val & 0xff00)>>8

Definition at line 254 of file libbif.c.

bof lo_filetype =0x0

Definition at line 222 of file libbif.c.

labelrec lo_length =0x0

Definition at line 218 of file libbif.c.

labelrec lo_opcode = 0x0

Definition at line 216 of file libbif.c.

labelrec lo_row =(char)(s_row>>8)&0xff

Definition at line 250 of file libbif.c.

bof lo_version =0x0

Definition at line 220 of file libbif.c.

char* name

Definition at line 186 of file libbif.c.

labelrec rgbhi =0x0

Definition at line 246 of file libbif.c.

labelrec rgblo =0x0

Definition at line 248 of file libbif.c.

labelrec rgbmed =0x0

Definition at line 247 of file libbif.c.

int row

Definition at line 235 of file libbif.c.

short s_column =(short)column

Definition at line 236 of file libbif.c.

short s_row
Initial value:
{
struct int_record intrec

Definition at line 236 of file libbif.c.

sptr =(unsigned char *) &value

Definition at line 278 of file libbif.c.

labelrec str_array[i] =0

Definition at line 363 of file libbif.c.

char* string

Definition at line 355 of file libbif.c.

labelrec string_length =i

Definition at line 378 of file libbif.c.

int val

Definition at line 235 of file libbif.c.

double value

Definition at line 272 of file libbif.c.