File: bin_util.h

package info (click to toggle)
biew 5.2.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,808 kB
  • ctags: 5,528
  • sloc: ansic: 38,763; makefile: 389; pascal: 245
file content (82 lines) | stat: -rw-r--r-- 3,174 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/** 
 * @namespace   biew
 * @file        bin_util.h
 * @brief       This file contains prototypes of common functions of
 *              plugins\bin of BIEW project.
 * @version     -
 * @remark      this source file is part of Binary vIEW project (BIEW).
 *              The Binary vIEW (BIEW) is copyright (C) 1995 Nick Kurshev.
 *              All rights reserved. This software is redistributable under the
 *              licence given in the file "Licence.en" ("Licence.ru" in russian
 *              translation) distributed in the BIEW archive.
 * @note        Requires POSIX compatible development system
 *
 * @author      Nick Kurshev
 * @since       1995
 * @note        Development, fixes and improvements
**/
#ifndef __BIN_UTIL__H
#define __BIN_UTIL__H

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __BBIO_H
#include "biewlib/bbio.h"
#endif

#ifndef __BIEWUTIL__H
#include "biewutil.h"
#endif

#if __BYTE_ORDER == __LITTLE_ENDIAN
#define  FMT_WORD(cval,is_big)\
 (unsigned short)((tBool)is_big ? ByteSwapS(*(unsigned short *)(char *)cval) : *(unsigned short *)(char *)cval)
#define  FMT_DWORD(cval,is_big)\
 (unsigned long)((tBool)is_big ? ByteSwapL(*(unsigned long *)(char *)cval) : *(unsigned long *)(char *)cval)
#else
#define  FMT_WORD(cval,is_big)\
 (unsigned short)(!(tBool)is_big ? ByteSwapS(*(unsigned short *)(char *)cval) : *(unsigned short *)(char *)cval)
#define  FMT_DWORD(cval,is_big)\
 (unsigned long)(!(tBool)is_big ? ByteSwapL(*(unsigned long *)(char *)cval) : *(unsigned long *)(char *)cval)
#endif

struct PubName
{
  unsigned long pa;
  unsigned long nameoff;
  unsigned short addinfo;
  unsigned short attr;
};

extern linearArray *PubNames;
extern unsigned fmtActiveState;

typedef void (__FASTCALL__ *ReadPubName)(BGLOBAL b_cache,const struct PubName *it,
                            char *buff,unsigned cb_buff);
typedef void (__FASTCALL__ *ReadPubNameList)(BGLOBAL fmt_chahe,void (__FASTCALL__ *mem_out)(const char *));

extern void  __FASTCALL__ fmtSetState(int state);
extern tCompare __FASTCALL__ fmtComparePubNames(const void __HUGE__ *v1,const void __HUGE__ *v2);
extern tBool __FASTCALL__ fmtFindPubName(BGLOBAL fmt_cache,char *buff,unsigned cb_buff,
                                         unsigned long pa,
                                         ReadPubNameList fmtReadPubNameList,
                                         ReadPubName fmtReadPubName);
extern unsigned long __FASTCALL__ fmtGetPubSym(BGLOBAL fmt_cache,char *str,unsigned cb_str,
                                      unsigned *func_class,unsigned long pa,
                                      tBool as_prev,
                                      ReadPubNameList fmtReadPubNameList,
                                      ReadPubName fmtReadPubName);

typedef unsigned      __FASTCALL__ (* GetNumItems)(BGLOBAL handle);
typedef tBool         __FASTCALL__ (* ReadItems)(BGLOBAL handle,memArray * names,unsigned nnames);
typedef unsigned long __FASTCALL__ (* CalcEntry)(unsigned,int dispmsg);
extern  int           __FASTCALL__ fmtShowList( GetNumItems gni,ReadItems ri,const char * title,int flags,unsigned * ordinal);


#ifdef __cplusplus
}
#endif

#endif