summaryrefslogtreecommitdiffstats
path: root/private/sdktools/masm/msghdr.c
blob: 4ad8547277a550223310f4cb0cc15030d0f37573 (plain) (blame)
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
/* msghdr.c -- Message code - replacement for nmsghdr.asm fmsghdr.asm
**
** microsoft (r) macro assembler
** copyright (c) microsoft corp 1986.  all rights reserved
**
** Note: This module is only used for FLATMODEL versions of masm
**	 __NMSG_TEXT is used whenever segments are allowed.
**
** Jeff Spencer 10/90
*/

#include <stdio.h>
#include "asm86.h"
#include "asmfcn.h"
#include "asmmsg.h"

/* Used by asmmsg2.h */
struct Message {
	USHORT	 usNum; 	/* Message number */
	UCHAR	 *pszMsg;	/* Message pointer */
	};

#include "asmmsg2.h"

UCHAR * GetMsgText( USHORT, USHORT );

/* Performs same function as internal C library function __NMSG_TEXT */
/* Only the C library function uses segments, and a different data */
/* format */
UCHAR NEAR * PASCAL
NMsgText(
	USHORT messagenum
){
    return( (UCHAR NEAR *)GetMsgText( messagenum, 0 ) );
}


/* Same functionality as internal C library function __FMSG_TEXT */
/* Only the C library function uses segments, and a different data */
/* format */
UCHAR FAR * PASCAL
FMsgText(
	USHORT messagenum
){
    return( (UCHAR FAR *)GetMsgText( messagenum, 1 ) );
}


UCHAR *
GetMsgText(
	USHORT messagenum,
	USHORT tablenum
){
    struct Message *pMsg;

    pMsg = ( tablenum ) ? FAR_MSG_tbl : MSG_tbl;
    while( pMsg->usNum != ER_ENDOFLIST ){
	if( pMsg->usNum == messagenum ){
	    return( pMsg->pszMsg );
	}
	pMsg++;
    }
    return( (UCHAR *)0 );
}