text:
#ifndef _RICHEDIT_
#define	_RICHEDIT_

#ifdef _WIN32
#include <pshpack4.h>
#elif !defined(RC_INVOKED)
#pragma pack(4)
#endif

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

// To mimic older RichEdit behavior, set _RICHEDIT_VER to appropriate value
//		Version 1.0		0x0100
//		Version 2.0		0x0200
//		Version 2.1		0x0210
#ifndef _RICHEDIT_VER
#define _RICHEDIT_VER	0x0300
#endif

#define cchTextLimitDefault 32767

#define MSFTEDIT_CLASS		L"RICHEDIT50W"
// NOTE:  MSFTEDIT.DLL only registers MSFTEDIT_CLASS.  If an application wants
// to use the following Richedit classes, it needs to load the riched20.dll.
// Otherwise, CreateWindow with RICHEDIT_CLASS would fail.
// This also applies to any dialog that uses RICHEDIT_CLASS,

// RichEdit 2.0 Window Class
// On Windows CE, avoid possible conflicts on Win95
#define CERICHEDIT_CLASSA	"RichEditCEA"
#define CERICHEDIT_CLASSW	L"RichEditCEW"

#define RICHEDIT_CLASSA		"RichEdit20A"
#define RICHEDIT_CLASS10A	"RICHEDIT"			// Richedit 1.0

#ifndef MACPORT
#define RICHEDIT_CLASSW		L"RichEdit20W"
#else	//----------------------MACPORT
#define RICHEDIT_CLASSW		TEXT("RichEdit20W")	// MACPORT change
#endif // MACPORT

#if (_RICHEDIT_VER >= 0x0200 )
#ifdef UNICODE
#define RICHEDIT_CLASS		RICHEDIT_CLASSW
#else
#define RICHEDIT_CLASS		RICHEDIT_CLASSA
#endif // UNICODE
#else
#define RICHEDIT_CLASS		RICHEDIT_CLASS10A
#endif // _RICHEDIT_VER >= 0x0200

// RichEdit messages

#ifndef WM_CONTEXTMENU
#define WM_CONTEXTMENU			0x007B
#endif

#ifndef WM_UNICHAR
#define WM_UNICHAR				0x0109
#endif

#ifndef WM_PRINTCLIENT
#define WM_PRINTCLIENT			0x0318
#endif

#ifndef EM_GETLIMITTEXT
#define EM_GETLIMITTEXT			(WM_USER + 37)
#endif

#ifndef EM_POSFROMCHAR
#define EM_POSFROMCHAR			(WM_USER + 38)
#define EM_CHARFROMPOS			(WM_USER + 39)
#endif

#ifndef EM_SCROLLCARET
#define EM_SCROLLCARET			(WM_USER + 49)
#endif
#define EM_CANPASTE				(WM_USER + 50)
#define EM_DISPLAYBAND			(WM_USER + 51)
#define EM_EXGETSEL				(WM_USER + 52)
#define EM_EXLIMITTEXT			(WM_USER + 53)
#define EM_EXLINEFROMCHAR		(WM_USER + 54)
#define EM_EXSETSEL				(WM_USER + 55)
#define EM_FINDTEXT				(WM_USER + 56)
#define EM_FORMATRANGE			(WM_USER + 57)
#define EM_GETCHARFORMAT		(WM_USER + 58)
#define EM_GETEVENTMASK			(WM_USER + 59)
#define EM_GETOLEINTERFACE		(WM_USER + 60)
#define EM_GETPARAFORMAT		(WM_USER + 61)
#define EM_GETSELTEXT			(WM_USER + 62)
#define EM_HIDESELECTION		(WM_USER + 63)
#define EM_PASTESPECIAL			(WM_USER + 64)
#define EM_REQUESTRESIZE		(WM_USER + 65)
#define EM_SELECTIONTYPE		(WM_USER + 66)
#define EM_SETBKGNDCOLOR		(WM_USER + 67)
#define EM_SETCHARFORMAT		(WM_USER + 68)
#define EM_SETEVENTMASK			(WM_USER + 69)
#define EM_SETOLECALLBACK		(WM_USER + 70)
#define EM_SETPARAFORMAT		(WM_USER + 71)
#define EM_SETTARGETDEVICE		(WM_USER + 72)
#define EM_STREAMIN				(WM_USER + 73)
#define EM_STREAMOUT			(WM_USER + 74)
#define EM_GETTEXTRANGE			(WM_USER + 75)
#define EM_FINDWORDBREAK		(WM_USER + 76)
#define EM_SETOPTIONS			(WM_USER + 77)
#define EM_GETOPTIONS			(WM_USER + 78)
#define EM_FINDTEXTEX			(WM_USER + 79)
#ifdef _WIN32
#define EM_GETWORDBREAKPROCEX	(WM_USER + 80)
#define EM_SETWORDBREAKPROCEX	(WM_USER + 81)
#endif

// RichEdit 2.0 messages
#define	EM_SETUNDOLIMIT			(WM_USER + 82)
#define EM_REDO					(WM_USER + 84)
#define EM_CANREDO				(WM_USER + 85)
#define EM_GETUNDONAME			(WM_USER + 86)
#define EM_GETREDONAME			(WM_USER + 87)
#define EM_STOPGROUPTYPING		(WM_USER + 88)

#define EM_SETTEXTMODE			(WM_USER + 89)
#define EM_GETTEXTMODE			(WM_USER + 90)

// enum for use with EM_GET/SETTEXTMODE
typedef enum tagTextMode
{
	TM_PLAINTEXT			= 1,
	TM_RICHTEXT				= 2,	// Default behavior
	TM_SINGLELEVELUNDO		= 4,
	TM_MULTILEVELUNDO		= 8,	// Default behavior
	TM_SINGLECODEPAGE		= 16,
	TM_MULTICODEPAGE		= 32	// Default behavior
} TEXTMODE;

#define EM_AUTOURLDETECT		(WM_USER + 91)
#define EM_GETAUTOURLDETECT		(WM_USER + 92)
#define EM_SETPALETTE			(WM_USER + 93)
#define EM_GETTEXTEX			(WM_USER + 94)
#define EM_GETTEXTLENGTHEX		(WM_USER + 95)
#define EM_SHOWSCROLLBAR		(WM_USER + 96)
#define EM_SETTEXTEX			(WM_USER + 97)

// East Asia specific messages
#define EM_SETPUNCTUATION		(WM_USER + 100)
#define EM_GETPUNCTUATION		(WM_USER + 101)
#define EM_SETWORDWRAPMODE		(WM_USER + 102)
#define EM_GETWORDWRAPMODE		(WM_USER + 103)
#define EM_SETIMECOLOR			(WM_USER + 104)
#define EM_GETIMECOLOR			(WM_USER + 105)
#define EM_SETIMEOPTIONS		(WM_USER + 106)
#define EM_GETIMEOPTIONS		(WM_USER + 107)
#define EM_CONVPOSITION 		(WM_USER + 108)

#define EM_SETLANGOPTIONS		(WM_USER + 120)
#define EM_GETLANGOPTIONS		(WM_USER + 121)
#define EM_GETIMECOMPMODE		(WM_USER + 122)

#define EM_FINDTEXTW			(WM_USER + 123)
#define EM_FINDTEXTEXW			(WM_USER + 124)

// RE3.0 FE messages
#define EM_RECONVERSION			(WM_USER + 125)
#define EM_SETIMEMODEBIAS		(WM_USER + 126)
#define EM_GETIMEMODEBIAS		(WM_USER + 127)

// BiDi specific messages
#define EM_SETBIDIOPTIONS		(WM_USER + 200)
#define EM_GETBIDIOPTIONS		(WM_USER + 201)

#define EM_SETTYPOGRAPHYOPTIONS	(WM_USER + 202)
#define EM_GETTYPOGRAPHYOPTIONS	(WM_USER + 203)

// Extended edit style specific messages
#define EM_SETEDITSTYLE			(WM_USER + 204)
#define EM_GETEDITSTYLE			(WM_USER + 205)

// Extended edit style masks
#define	SES_EMULATESYSEDIT		1
#define SES_BEEPONMAXTEXT		2
#define	SES_EXTENDBACKCOLOR		4
#define SES_MAPCPS				8
#define SES_EMULATE10			16
#define	SES_USECRLF				32
#define SES_USEAIMM				64
#define SES_NOIME				128

#define SES_ALLOWBEEPS			256
#define SES_UPPERCASE			512
#define	SES_LOWERCASE			1024
#define SES_NOINPUTSEQUENCECHK	2048
#define SES_BIDI				4096
#define SES_SCROLLONKILLFOCUS	8192
#define	SES_XLTCRCRLFTOCR		16384
#define SES_DRAFTMODE			32768

#define	SES_USECTF				0x0010000
#define SES_HIDEGRIDLINES		0x0020000
#define SES_USEATFONT			0x0040000
#define SES_CUSTOMLOOK			0x0080000
#define SES_LBSCROLLNOTIFY		0x0100000
#define SES_CTFALLOWEMBED		0x0200000
#define SES_CTFALLOWSMARTTAG	0x0400000
#define SES_CTFALLOWPROOFING	0x0800000

// Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS
#define IMF_AUTOKEYBOARD		0x0001
#define IMF_AUTOFONT			0x0002
#define IMF_IMECANCELCOMPLETE	0x0004	// High completes comp string when aborting, low cancels
#define IMF_IMEALWAYSSENDNOTIFY 0x0008
#define IMF_AUTOFONTSIZEADJUST	0x0010
#define IMF_UIFONTS				0x0020
#define IMF_DUALFONT			0x0080

// Values for EM_GETIMECOMPMODE
#define ICM_NOTOPEN				0x0000
#define ICM_LEVEL3				0x0001
#define ICM_LEVEL2				0x0002
#define ICM_LEVEL2_5			0x0003
#define ICM_LEVEL2_SUI			0x0004
#define ICM_CTF					0x0005

// Options for EM_SETTYPOGRAPHYOPTIONS
#define	TO_ADVANCEDTYPOGRAPHY	1
#define	TO_SIMPLELINEBREAK		2
#define TO_DISABLECUSTOMTEXTOUT	4
#define TO_ADVANCEDLAYOUT		8

// Pegasus outline mode messages (RE 3.0)

// Outline mode message
#define EM_OUTLINE              (WM_USER + 220)
// Message for getting and restoring scroll pos
#define EM_GETSCROLLPOS         (WM_USER + 221)
#define EM_SETSCROLLPOS         (WM_USER + 222)
// Change fontsize in current selection by wParam
#define EM_SETFONTSIZE          (WM_USER + 223)
#define EM_GETZOOM				(WM_USER + 224)
#define EM_SETZOOM				(WM_USER + 225)
#define EM_GETVIEWKIND			(WM_USER + 226)
#define EM_SETVIEWKIND			(WM_USER + 227)

// RichEdit 4.0 messages
#define EM_GETPAGE				(WM_USER + 228)
#define EM_SETPAGE				(WM_USER + 229)
#define EM_GETHYPHENATEINFO		(WM_USER + 230)
#define EM_SETHYPHENATEINFO		(WM_USER + 231)
#define EM_GETPAGEROTATE		(WM_USER + 235)
#define EM_SETPAGEROTATE		(WM_USER + 236)
#define EM_GETCTFMODEBIAS		(WM_USER + 237)
#define EM_SETCTFMODEBIAS		(WM_USER + 238)
#define EM_GETCTFOPENSTATUS		(WM_USER + 240)
#define EM_SETCTFOPENSTATUS		(WM_USER + 241)
#define EM_GETIMECOMPTEXT		(WM_USER + 242)
#define EM_ISIME				(WM_USER + 243)
#define EM_GETIMEPROPERTY		(WM_USER + 244)

// EM_SETPAGEROTATE wparam values
#define EPR_0					0		// Text flows left to right and top to bottom
#define EPR_270					1		// Text flows top to bottom and right to left
#define EPR_180					2		// Text flows right to left and bottom to top
#define	EPR_90					3		// Text flows bottom to top and left to right

// EM_SETCTFMODEBIAS wparam values
#define CTFMODEBIAS_DEFAULT					0x0000
#define CTFMODEBIAS_FILENAME				0x0001
#define CTFMODEBIAS_NAME					0x0002
#define CTFMODEBIAS_READING					0x0003
#define CTFMODEBIAS_DATETIME				0x0004
#define CTFMODEBIAS_CONVERSATION			0x0005
#define CTFMODEBIAS_NUMERIC					0x0006
#define CTFMODEBIAS_HIRAGANA				0x0007
#define CTFMODEBIAS_KATAKANA				0x0008
#define CTFMODEBIAS_HANGUL					0x0009
#define CTFMODEBIAS_HALFWIDTHKATAKANA		0x000A
#define CTFMODEBIAS_FULLWIDTHALPHANUMERIC	0x000B
#define CTFMODEBIAS_HALFWIDTHALPHANUMERIC	0x000C

// EM_SETIMEMODEBIAS lparam values
#define IMF_SMODE_PLAURALCLAUSE	0x0001
#define IMF_SMODE_NONE			0x0002

// EM_GETIMECOMPTEXT wparam structure
typedef struct _imecomptext {
	LONG	cb;			// count of bytes in the output buffer.
	DWORD	flags;		// value specifying the composition string type.
						//	Currently only support ICT_RESULTREADSTR
} IMECOMPTEXT;
#define ICT_RESULTREADSTR		1

// Outline mode wparam values
#define EMO_EXIT                0       // Enter normal mode,  lparam ignored
#define EMO_ENTER               1       // Enter outline mode, lparam ignored
#define EMO_PROMOTE             2       // LOWORD(lparam) == 0 ==>
                                        //  promote  to body-text
                                        // LOWORD(lparam) != 0 ==>
                                        //  promote/demote current selection
                                        //  by indicated number of levels
#define EMO_EXPAND              3       // HIWORD(lparam) = EMO_EXPANDSELECTION
                                        //  -> expands selection to level
                                        //  indicated in LOWORD(lparam)
                                        //  LOWORD(lparam) = -1/+1 corresponds
                                        //  to collapse/expand button presses
                                        //  in winword (other values are
                                        //  equivalent to having pressed these
                                        //  buttons more than once)
                                        //  HIWORD(lparam) = EMO_EXPANDDOCUMENT
                                        //  -> expands whole document to
                                        //  indicated level
#define EMO_MOVESELECTION       4       // LOWORD(lparam) != 0 -> move current
                                        //  selection up/down by indicated amount
#define EMO_GETVIEWMODE			5		// Returns VM_NORMAL or VM_OUTLINE

// EMO_EXPAND options
#define EMO_EXPANDSELECTION     0
#define EMO_EXPANDDOCUMENT      1

#define VM_NORMAL				4		// Agrees with RTF \viewkindN
#define VM_OUTLINE				2
#define VM_PAGE					9		// Screen page view (not print layout)

// New notifications
#define EN_MSGFILTER			0x0700
#define EN_REQUESTRESIZE		0x0701
#define EN_SELCHANGE			0x0702
#define EN_DROPFILES			0x0703
#define EN_PROTECTED			0x0704
#define EN_CORRECTTEXT			0x0705			// PenWin specific
#define EN_STOPNOUNDO			0x0706
#define EN_IMECHANGE			0x0707			// East Asia specific
#define EN_SAVECLIPBOARD		0x0708
#define EN_OLEOPFAILED			0x0709
#define EN_OBJECTPOSITIONS		0x070a
#define EN_LINK					0x070b
#define EN_DRAGDROPDONE			0x070c
#define EN_PARAGRAPHEXPANDED	0x070d
#define EN_PAGECHANGE			0x070e
#define EN_LOWFIRTF				0x070f
#define EN_ALIGNLTR				0x0710			// BiDi specific notification
#define EN_ALIGNRTL				0x0711			// BiDi specific notification

// Event notification masks
#define ENM_NONE				0x00000000
#define ENM_CHANGE				0x00000001
#define ENM_UPDATE				0x00000002
#define ENM_SCROLL				0x00000004
#define ENM_SCROLLEVENTS		0x00000008
#define ENM_DRAGDROPDONE		0x00000010
#define ENM_PARAGRAPHEXPANDED	0x00000020
#define ENM_PAGECHANGE			0x00000040
#define ENM_KEYEVENTS			0x00010000
#define ENM_MOUSEEVENTS			0x00020000
#define ENM_REQUESTRESIZE		0x00040000
#define ENM_SELCHANGE			0x00080000
#define ENM_DROPFILES			0x00100000
#define ENM_PROTECTED			0x00200000
#define ENM_CORRECTTEXT			0x00400000		// PenWin specific
#define ENM_IMECHANGE			0x00800000		// Used by RE1.0 compatibility
#define ENM_LANGCHANGE			0x01000000
#define ENM_OBJECTPOSITIONS		0x02000000
#define ENM_LINK				0x04000000
#define ENM_LOWFIRTF			0x08000000

// New edit control styles
#define ES_SAVESEL				0x00008000
#define ES_SUNKEN				0x00004000
#define ES_DISABLENOSCROLL		0x00002000
// Same as WS_MAXIMIZE, but that doesn't make sense so we re-use the value
#define ES_SELECTIONBAR			0x01000000
// Same as ES_UPPERCASE, but re-used to completely disable OLE drag'n'drop
#define ES_NOOLEDRAGDROP		0x00000008

// New edit control extended style
#if (_WIN32_WINNT > 0x0400) || (WINVER > 0x0400)
#define ES_EX_NOCALLOLEINIT		0x00000000		// Not supported in RE 2.0/3.0
#else
#ifdef	_WIN32
#define ES_EX_NOCALLOLEINIT		0x01000000
#endif
#endif

// These flags are used in FE Windows
#define ES_VERTICAL				0x00400000		// Not supported in RE 2.0/3.0
#define	ES_NOIME				0x00080000
#define ES_SELFIME				0x00040000

// Edit control options
#define ECO_AUTOWORDSELECTION	0x00000001
#define ECO_AUTOVSCROLL			0x00000040
#define ECO_AUTOHSCROLL			0x00000080
#define ECO_NOHIDESEL			0x00000100
#define ECO_READONLY			0x00000800
#define ECO_WANTRETURN			0x00001000
#define ECO_SAVESEL				0x00008000
#define ECO_SELECTIONBAR		0x01000000
#define ECO_VERTICAL			0x00400000		// FE specific

// ECO operations
#define ECOOP_SET				0x0001
#define ECOOP_OR				0x0002
#define ECOOP_AND				0x0003
#define ECOOP_XOR				0x0004

// New word break function actions
#define WB_CLASSIFY			3
#define WB_MOVEWORDLEFT		4
#define WB_MOVEWORDRIGHT	5
#define WB_LEFTBREAK		6
#define WB_RIGHTBREAK		7

// East Asia specific flags
#define WB_MOVEWORDPREV		4
#define WB_MOVEWORDNEXT		5
#define WB_PREVBREAK		6
#define WB_NEXTBREAK		7

#define PC_FOLLOWING		1
#define	PC_LEADING			2
#define	PC_OVERFLOW			3
#define	PC_DELIMITER		4
#define WBF_WORDWRAP		0x010
#define WBF_WORDBREAK		0x020
#define	WBF_OVERFLOW		0x040
#define WBF_LEVEL1			0x080
#define	WBF_LEVEL2			0x100
#define	WBF_CUSTOM			0x200

// East Asia specific flags
#define IMF_FORCENONE           0x0001
#define IMF_FORCEENABLE         0x0002
#define IMF_FORCEDISABLE        0x0004
#define IMF_CLOSESTATUSWINDOW   0x0008
#define IMF_VERTICAL            0x0020
#define IMF_FORCEACTIVE         0x0040
#define IMF_FORCEINACTIVE       0x0080
#define IMF_FORCEREMEMBER       0x0100
#define IMF_MULTIPLEEDIT        0x0400

// Word break flags (used with WB_CLASSIFY)
#define WBF_CLASS			((BYTE) 0x0F)
#define WBF_ISWHITE			((BYTE) 0x10)
#define WBF_BREAKLINE		((BYTE) 0x20)
#define WBF_BREAKAFTER		((BYTE) 0x40)

// Data types

#ifdef _WIN32
// Extended edit word break proc (character set aware)
typedef LONG (*EDITWORDBREAKPROCEX)(char *pchText, LONG cchText, BYTE bCharSet, INT action);
#endif

// All character format measurements are in twips
typedef struct _charformat
{
	UINT		cbSize;
	DWORD		dwMask;
	DWORD		dwEffects;
	LONG		yHeight;
	LONG		yOffset;
	COLORREF	crTextColor;
	BYTE		bCharSet;
	BYTE		bPitchAndFamily;
	char		szFaceName[LF_FACESIZE];
} CHARFORMATA;

typedef struct _charformatw
{
	UINT		cbSize;
	DWORD		dwMask;
	DWORD		dwEffects;
	LONG		yHeight;
	LONG		yOffset;
	COLORREF	crTextColor;
	BYTE		bCharSet;
	BYTE		bPitchAndFamily;
	WCHAR		szFaceName[LF_FACESIZE];
} CHARFORMATW;

#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define CHARFORMAT CHARFORMATW
#else
#define CHARFORMAT CHARFORMATA
#endif // UNICODE
#else
#define CHARFORMAT CHARFORMATA
#endif // _RICHEDIT_VER >= 0x0200

// CHARFORMAT2 structure

#ifdef __cplusplus

struct CHARFORMAT2W : _charformatw
{
	WORD		wWeight;			// Font weight (LOGFONT value)
	SHORT		sSpacing;			// Amount to space between letters
	COLORREF	crBackColor;		// Background color
	LCID		lcid;				// Locale ID
	DWORD		dwReserved;			// Reserved. Must be 0
	SHORT		sStyle;				// Style handle
	WORD		wKerning;			// Twip size above which to kern char pair
	BYTE		bUnderlineType;		// Underline type
	BYTE		bAnimation;			// Animated text like marching ants
	BYTE		bRevAuthor;			// Revision author index
};

struct CHARFORMAT2A : _charformat
{
	WORD		wWeight;			// Font weight (LOGFONT value)
	SHORT		sSpacing;			// Amount to space between letters
	COLORREF	crBackColor;		// Background color
	LCID		lcid;				// Locale ID
	DWORD		dwReserved;			// Reserved. Must be 0
	SHORT		sStyle;				// Style handle
	WORD		wKerning;			// Twip size above which to kern char pair
	BYTE		bUnderlineType;		// Underline type
	BYTE		bAnimation;			// Animated text like marching ants
	BYTE		bRevAuthor;			// Revision author index
};

#else	// regular C-style

typedef struct _charformat2w
{
	UINT		cbSize;
	DWORD		dwMask;
	DWORD		dwEffects;
	LONG		yHeight;
	LONG		yOffset;			// > 0 for superscript, < 0 for subscript
	COLORREF	crTextColor;
	BYTE		bCharSet;
	BYTE		bPitchAndFamily;
	WCHAR		szFaceName[LF_FACESIZE];
	WORD		wWeight;			// Font weight (LOGFONT value)
	SHORT		sSpacing;			// Amount to space between letters
	COLORREF	crBackColor;		// Background color
	LCID		lcid;				// Locale ID
	DWORD		dwReserved;			// Reserved. Must be 0
	SHORT		sStyle;				// Style handle
	WORD		wKerning;			// Twip size above which to kern char pair
	BYTE		bUnderlineType;		// Underline type
	BYTE		bAnimation;			// Animated text like marching ants
	BYTE		bRevAuthor;			// Revision author index
	BYTE		bReserved1;
} CHARFORMAT2W;

typedef struct _charformat2a
{
	UINT		cbSize;
	DWORD		dwMask;
	DWORD		dwEffects;
	LONG		yHeight;
	LONG		yOffset;			// > 0 for superscript, < 0 for subscript
	COLORREF	crTextColor;
	BYTE		bCharSet;
	BYTE		bPitchAndFamily;
	char		szFaceName[LF_FACESIZE];
	WORD		wWeight;			// Font weight (LOGFONT value)
	SHORT		sSpacing;			// Amount to space between letters
	COLORREF	crBackColor;		// Background color
	LCID		lcid;				// Locale ID
	DWORD		dwReserved;			// Reserved. Must be 0
	SHORT		sStyle;				// Style handle
	WORD		wKerning;			// Twip size above which to kern char pair
	BYTE		bUnderlineType;		// Underline type
	BYTE		bAnimation;			// Animated text like marching ants
	BYTE		bRevAuthor;			// Revision author index
} CHARFORMAT2A;

#endif // C++

#ifdef UNICODE
#define CHARFORMAT2	CHARFORMAT2W
#else
#define CHARFORMAT2 CHARFORMAT2A
#endif

#define CHARFORMATDELTA		(sizeof(CHARFORMAT2) - sizeof(CHARFORMAT))

// CFM_COLOR mirrors CFE_AUTOCOLOR, a little hack to easily deal with autocolor

// CHARFORMAT masks
#define CFM_BOLD		0x00000001
#define CFM_ITALIC		0x00000002
#define CFM_UNDERLINE	0x00000004
#define CFM_STRIKEOUT	0x00000008
#define CFM_PROTECTED	0x00000010
#define CFM_LINK		0x00000020			// Exchange hyperlink extension
#define CFM_SIZE		0x80000000
#define CFM_COLOR		0x40000000
#define CFM_FACE		0x20000000
#define CFM_OFFSET		0x10000000
#define CFM_CHARSET		0x08000000

// CHARFORMAT effects
#define CFE_BOLD		0x0001
#define CFE_ITALIC		0x0002
#define CFE_UNDERLINE	0x0004
#define CFE_STRIKEOUT	0x0008
#define CFE_PROTECTED	0x0010
#define CFE_LINK		0x0020
#define CFE_AUTOCOLOR	0x40000000			// NOTE: this corresponds to
											// CFM_COLOR, which controls it
// Masks and effects defined for CHARFORMAT2 -- an (*) indicates
// that the data is stored by RichEdit 2.0/3.0, but not displayed
#define CFM_SMALLCAPS		0x0040			// (*)
#define	CFM_ALLCAPS			0x0080			// Displayed by 3.0
#define	CFM_HIDDEN			0x0100			// Hidden by 3.0
#define	CFM_OUTLINE			0x0200			// (*)
#define	CFM_SHADOW			0x0400			// (*)
#define	CFM_EMBOSS			0x0800			// (*)
#define	CFM_IMPRINT			0x1000			// (*)
#define CFM_DISABLED		0x2000
#define	CFM_REVISED			0x4000

#define CFM_BACKCOLOR		0x04000000
#define CFM_LCID			0x02000000
#define	CFM_UNDERLINETYPE	0x00800000		// Many displayed by 3.0
#define	CFM_WEIGHT			0x00400000
#define CFM_SPACING			0x00200000		// Displayed by 3.0
#define CFM_KERNING			0x00100000		// (*)
#define CFM_STYLE			0x00080000		// (*)
#define CFM_ANIMATION		0x00040000		// (*)
#define CFM_REVAUTHOR		0x00008000

#define CFE_SUBSCRIPT		0x00010000		// Superscript and subscript are
#define CFE_SUPERSCRIPT		0x00020000		//  mutually exclusive

#define CFM_SUBSCRIPT		CFE_SUBSCRIPT | CFE_SUPERSCRIPT
#define CFM_SUPERSCRIPT		CFM_SUBSCRIPT

// CHARFORMAT "ALL" masks
#define CFM_EFFECTS (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | \
					 CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK)
#define CFM_ALL (CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET)

#define	CFM_EFFECTS2 (CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS \
					| CFM_HIDDEN  | CFM_OUTLINE | CFM_SHADOW | CFM_EMBOSS \
					| CFM_IMPRINT | CFM_DISABLED | CFM_REVISED \
					| CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR)

#define CFM_ALL2	 (CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID \
					| CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR \
					| CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION)

#define	CFE_SMALLCAPS		CFM_SMALLCAPS
#define	CFE_ALLCAPS			CFM_ALLCAPS
#define	CFE_HIDDEN			CFM_HIDDEN
#define	CFE_OUTLINE			CFM_OUTLINE
#define	CFE_SHADOW			CFM_SHADOW
#define	CFE_EMBOSS			CFM_EMBOSS
#define	CFE_IMPRINT			CFM_IMPRINT
#define	CFE_DISABLED		CFM_DISABLED
#define	CFE_REVISED			CFM_REVISED

// CFE_AUTOCOLOR and CFE_AUTOBACKCOLOR correspond to CFM_COLOR and
// CFM_BACKCOLOR, respectively, which control them
#define CFE_AUTOBACKCOLOR	CFM_BACKCOLOR

// Underline types. RE 1.0 displays only CFU_UNDERLINE
#define CFU_CF1UNDERLINE	0xFF	// Map charformat's bit underline to CF2
#define CFU_INVERT			0xFE	// For IME composition fake a selection
#define CFU_UNDERLINETHICKLONGDASH		18	// (*) display as dash
#define CFU_UNDERLINETHICKDOTTED		17	// (*) display as dot
#define CFU_UNDERLINETHICKDASHDOTDOT	16	// (*) display as dash dot dot
#define CFU_UNDERLINETHICKDASHDOT		15	// (*) display as dash dot
#define CFU_UNDERLINETHICKDASH			14	// (*) display as dash
#define CFU_UNDERLINELONGDASH			13	// (*) display as dash
#define CFU_UNDERLINEHEAVYWAVE			12	// (*) display as wave
#define CFU_UNDERLINEDOUBLEWAVE			11	// (*) display as wave
#define CFU_UNDERLINEHAIRLINE			10	// (*) display as single
#define CFU_UNDERLINETHICK				9
#define CFU_UNDERLINEWAVE				8
#define	CFU_UNDERLINEDASHDOTDOT			7
#define	CFU_UNDERLINEDASHDOT			6
#define	CFU_UNDERLINEDASH				5
#define	CFU_UNDERLINEDOTTED				4
#define	CFU_UNDERLINEDOUBLE				3	// (*) display as single
#define CFU_UNDERLINEWORD				2	// (*) display as single
#define CFU_UNDERLINE					1
#define CFU_UNDERLINENONE				0

#define yHeightCharPtsMost 1638

// EM_SETCHARFORMAT wParam masks
#define SCF_SELECTION		0x0001
#define SCF_WORD			0x0002
#define SCF_DEFAULT			0x0000	// Set default charformat or paraformat
#define SCF_ALL				0x0004	// Not valid with SCF_SELECTION or SCF_WORD
#define SCF_USEUIRULES		0x0008	// Modifier for SCF_SELECTION; says that
									//  format came from a toolbar, etc., and
									//  hence UI formatting rules should be
									//  used instead of literal formatting
#define SCF_ASSOCIATEFONT	0x0010	// Associate fontname with bCharSet (one
									//  possible for each of Western, ME, FE,
									//  Thai)
#define SCF_NOKBUPDATE		0x0020	// Do not update KB layput for this change
									//  even if autokeyboard is on
#define SCF_ASSOCIATEFONT2	0x0040	// Associate plane-2 (surrogate) font

typedef struct _charrange
{
	LONG	cpMin;
	LONG	cpMax;
} CHARRANGE;

typedef struct _textrange
{
	CHARRANGE chrg;
	LPSTR lpstrText;	// Allocated by caller, zero terminated by RichEdit
} TEXTRANGEA;

typedef struct _textrangew
{
	CHARRANGE chrg;
	LPWSTR lpstrText;	// Allocated by caller, zero terminated by RichEdit
} TEXTRANGEW;

#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define TEXTRANGE 	TEXTRANGEW
#else
#define TEXTRANGE	TEXTRANGEA
#endif // UNICODE
#else
#define TEXTRANGE	TEXTRANGEA
#endif // _RICHEDIT_VER >= 0x0200

typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);

typedef struct _editstream
{
	DWORD_PTR dwCookie;		// User value passed to callback as first parameter
	DWORD	  dwError;		// Last error
	EDITSTREAMCALLBACK pfnCallback;
} EDITSTREAM;

// Stream formats. Flags are all in low word, since high word
// gives possible codepage choice.
#define SF_TEXT			0x0001
#define SF_RTF			0x0002
#define SF_RTFNOOBJS	0x0003		// Write only
#define SF_TEXTIZED		0x0004		// Write only

#define SF_UNICODE		0x0010		// Unicode file (UCS2 little endian)
#define SF_USECODEPAGE	0x0020		// CodePage given by high word
#define SF_NCRFORNONASCII 0x40		// Output /uN for nonASCII
#define	SFF_WRITEXTRAPAR  0x80		// Output \par at end

// Flag telling stream operations to operate on selection only
// EM_STREAMIN  replaces current selection
// EM_STREAMOUT streams out current selection
#define SFF_SELECTION	0x8000

// Flag telling stream operations to ignore some FE control words
// having to do with FE word breaking and horiz vs vertical text.
// Not used in RichEdit 2.0 and later
#define SFF_PLAINRTF	0x4000

// Flag telling file stream output (SFF_SELECTION flag not set) to persist
// \viewscaleN control word.
#define SFF_PERSISTVIEWSCALE 0x2000

// Flag telling file stream input with SFF_SELECTION flag not set not to
// close the document
#define SFF_KEEPDOCINFO	0x1000

// Flag telling stream operations to output in Pocket Word format
#define SFF_PWD			0x0800

// 3-bit field specifying the value of N - 1 to use for \rtfN or \pwdN
#define SF_RTFVAL		0x0700

typedef struct _findtext
{
	CHARRANGE chrg;
	LPCSTR lpstrText;
} FINDTEXTA;

typedef struct _findtextw
{
	CHARRANGE chrg;
	LPCWSTR lpstrText;
} FINDTEXTW;

#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define FINDTEXT	FINDTEXTW
#else
#define FINDTEXT	FINDTEXTA
#endif	// UNICODE
#else
#define FINDTEXT	FINDTEXTA
#endif // _RICHEDIT_VER >= 0x0200

typedef struct _findtextexa
{
	CHARRANGE chrg;
	LPCSTR	  lpstrText;
	CHARRANGE chrgText;
} FINDTEXTEXA;

typedef struct _findtextexw
{
	CHARRANGE chrg;
	LPCWSTR	  lpstrText;
	CHARRANGE chrgText;
} FINDTEXTEXW;

#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define FINDTEXTEX	FINDTEXTEXW
#else
#define FINDTEXTEX	FINDTEXTEXA
#endif // UNICODE
#else
#define FINDTEXTEX	FINDTEXTEXA
#endif // _RICHEDIT_VER >= 0x0200

typedef struct _formatrange
{
	HDC hdc;
	HDC hdcTarget;
	RECT rc;
	RECT rcPage;
	CHARRANGE chrg;
} FORMATRANGE;

// All paragraph measurements are in twips

#define MAX_TAB_STOPS 32
#define lDefaultTab 720
#define MAX_TABLE_CELLS 63

// This is a hack to make PARAFORMAT compatible with RE 1.0
#define	wReserved	wEffects

typedef struct _paraformat
{
	UINT	cbSize;
	DWORD	dwMask;
	WORD	wNumbering;
	WORD	wEffects;
	LONG	dxStartIndent;
	LONG	dxRightIndent;
	LONG	dxOffset;
	WORD	wAlignment;
	SHORT	cTabCount;
	LONG	rgxTabs[MAX_TAB_STOPS];
} PARAFORMAT;

#ifdef __cplusplus
struct PARAFORMAT2 : _paraformat
{
	LONG	dySpaceBefore;			// Vertical spacing before para
	LONG	dySpaceAfter;			// Vertical spacing after para
	LONG	dyLineSpacing;			// Line spacing depending on Rule
	SHORT	sStyle;					// Style handle
	BYTE	bLineSpacingRule;		// Rule for line spacing (see tom.doc)
	BYTE	bOutlineLevel;			// Outline level
	WORD	wShadingWeight;			// Shading in hundredths of a per cent
	WORD	wShadingStyle;			// Nibble 0: style, 1: cfpat, 2: cbpat
	WORD	wNumberingStart;		// Starting value for numbering
	WORD	wNumberingStyle;		// Alignment, roman/arabic, (), ), ., etc.
	WORD	wNumberingTab;			// Space bet FirstIndent & 1st-line text
	WORD	wBorderSpace;			// Border-text spaces (nbl/bdr in pts)
	WORD	wBorderWidth;			// Pen widths (nbl/bdr in half pts)
	WORD	wBorders;				// Border styles (nibble/border)
};

#else	// Regular C-style

typedef struct _paraformat2
{
	UINT	cbSize;
	DWORD	dwMask;
	WORD	wNumbering;
	WORD	wReserved;
	LONG	dxStartIndent;
	LONG	dxRightIndent;
	LONG	dxOffset;
	WORD	wAlignment;
	SHORT	cTabCount;
	LONG	rgxTabs[MAX_TAB_STOPS];
 	LONG	dySpaceBefore;			// Vertical spacing before para
	LONG	dySpaceAfter;			// Vertical spacing after para
	LONG	dyLineSpacing;			// Line spacing depending on Rule
	SHORT	sStyle;					// Style handle
	BYTE	bLineSpacingRule;		// Rule for line spacing (see tom.doc)
	BYTE	bOutlineLevel;			// Outline Level
	WORD	wShadingWeight;			// Shading in hundredths of a per cent
	WORD	wShadingStyle;			// Byte 0: style, nib 2: cfpat, 3: cbpat
	WORD	wNumberingStart;		// Starting value for numbering
	WORD	wNumberingStyle;		// Alignment, Roman/Arabic, (), ), ., etc.
	WORD	wNumberingTab;			// Space bet 1st indent and 1st-line text
	WORD	wBorderSpace;			// Border-text spaces (nbl/bdr in pts)
	WORD	wBorderWidth;			// Pen widths (nbl/bdr in half twips)
	WORD	wBorders;				// Border styles (nibble/border)
} PARAFORMAT2;

#endif // C++

// PARAFORMAT mask values
#define PFM_STARTINDENT			0x00000001
#define PFM_RIGHTINDENT			0x00000002
#define PFM_OFFSET				0x00000004
#define PFM_ALIGNMENT			0x00000008
#define PFM_TABSTOPS			0x00000010
#define PFM_NUMBERING			0x00000020
#define PFM_OFFSETINDENT		0x80000000

// PARAFORMAT 2.0 masks and effects
#define PFM_SPACEBEFORE			0x00000040
#define PFM_SPACEAFTER			0x00000080
#define PFM_LINESPACING			0x00000100
#define	PFM_STYLE				0x00000400
#define PFM_BORDER				0x00000800	// (*)
#define PFM_SHADING				0x00001000	// (*)
#define PFM_NUMBERINGSTYLE		0x00002000	// RE 3.0
#define PFM_NUMBERINGTAB		0x00004000	// RE 3.0
#define PFM_NUMBERINGSTART		0x00008000	// RE 3.0

#define PFM_RTLPARA				0x00010000
#define PFM_KEEP				0x00020000	// (*)
#define PFM_KEEPNEXT			0x00040000	// (*)
#define PFM_PAGEBREAKBEFORE		0x00080000	// (*)
#define PFM_NOLINENUMBER		0x00100000	// (*)
#define PFM_NOWIDOWCONTROL		0x00200000	// (*)
#define PFM_DONOTHYPHEN			0x00400000	// (*)
#define PFM_SIDEBYSIDE			0x00800000	// (*)
#define PFM_TABLE				0x40000000	// RE 3.0
#define PFM_TEXTWRAPPINGBREAK	0x20000000	// RE 3.0
#define PFM_TABLEROWDELIMITER	0x10000000	// RE 4.0

// The following three properties are read only
#define PFM_COLLAPSED			0x01000000	// RE 3.0
#define PFM_OUTLINELEVEL		0x02000000	// RE 3.0
#define PFM_BOX					0x04000000	// RE 3.0
#define PFM_RESERVED2			0x08000000	// RE 4.0

// PARAFORMAT "ALL" masks
#define	PFM_ALL (PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET	| \
				 PFM_ALIGNMENT   | PFM_TABSTOPS    | PFM_NUMBERING | \
				 PFM_OFFSETINDENT| PFM_RTLPARA)

// Note: PARAFORMAT has no effects (BiDi RichEdit 1.0 does have PFE_RTLPARA)
#define PFM_EFFECTS (PFM_RTLPARA | PFM_KEEP | PFM_KEEPNEXT | PFM_TABLE \
					| PFM_PAGEBREAKBEFORE | PFM_NOLINENUMBER  \
					| PFM_NOWIDOWCONTROL | PFM_DONOTHYPHEN | PFM_SIDEBYSIDE \
					| PFM_TABLE | PFM_TABLEROWDELIMITER)

#define PFM_ALL2	(PFM_ALL | PFM_EFFECTS | PFM_SPACEBEFORE | PFM_SPACEAFTER \
					| PFM_LINESPACING | PFM_STYLE | PFM_SHADING | PFM_BORDER \
					| PFM_NUMBERINGTAB | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE)

#define PFE_RTLPARA				(PFM_RTLPARA		 >> 16)
#define PFE_KEEP				(PFM_KEEP			 >> 16)	// (*)
#define PFE_KEEPNEXT			(PFM_KEEPNEXT		 >> 16)	// (*)
#define PFE_PAGEBREAKBEFORE		(PFM_PAGEBREAKBEFORE >> 16)	// (*)
#define PFE_NOLINENUMBER		(PFM_NOLINENUMBER	 >> 16)	// (*)
#define PFE_NOWIDOWCONTROL		(PFM_NOWIDOWCONTROL	 >> 16)	// (*)
#define PFE_DONOTHYPHEN			(PFM_DONOTHYPHEN 	 >> 16)	// (*)
#define PFE_SIDEBYSIDE			(PFM_SIDEBYSIDE		 >> 16)	// (*)
#define PFE_TEXTWRAPPINGBREAK	(PFM_TEXTWRAPPINGBREAK>>16) // (*)

// The following four effects are read only
#define PFE_COLLAPSED			(PFM_COLLAPSED		 >> 16)	// (+)
#define PFE_BOX					(PFM_BOX			 >> 16)	// (+)
#define PFE_TABLE				(PFM_TABLE			 >> 16)	// Inside table row. RE 3.0
#define PFE_TABLEROWDELIMITER	(PFM_TABLEROWDELIMITER>>16)	// Table row start. RE 4.0

// PARAFORMAT numbering options
#define PFN_BULLET		1		// tomListBullet

// PARAFORMAT2 wNumbering options
#define PFN_ARABIC		2		// tomListNumberAsArabic:   0, 1, 2,	...
#define PFN_LCLETTER	3		// tomListNumberAsLCLetter: a, b, c,	...
#define	PFN_UCLETTER	4		// tomListNumberAsUCLetter: A, B, C,	...
#define	PFN_LCROMAN		5		// tomListNumberAsLCRoman:  i, ii, iii,	...
#define	PFN_UCROMAN		6		// tomListNumberAsUCRoman:  I, II, III,	...

// PARAFORMAT2 wNumberingStyle options
#define PFNS_PAREN		0x000	// default, e.g.,				  1)
#define	PFNS_PARENS		0x100	// tomListParentheses/256, e.g., (1)
#define PFNS_PERIOD		0x200	// tomListPeriod/256, e.g.,		  1.
#define PFNS_PLAIN		0x300	// tomListPlain/256, e.g.,		  1
#define PFNS_NONUMBER	0x400	// Used for continuation w/o number

#define PFNS_NEWNUMBER	0x8000	// Start new number with wNumberingStart
								// (can be combined with other PFNS_xxx)
// PARAFORMAT alignment options
#define PFA_LEFT			 1
#define PFA_RIGHT			 2
#define PFA_CENTER			 3

// PARAFORMAT2 alignment options
#define	PFA_JUSTIFY			 4	// New paragraph-alignment option 2.0 (*)
#define PFA_FULL_INTERWORD	 4	// These are supported in 3.0 with advanced
#define PFA_FULL_INTERLETTER 5	//  typography enabled
#define PFA_FULL_SCALED		 6
#define	PFA_FULL_GLYPHS		 7
#define	PFA_SNAP_GRID		 8

// Notification structures
#ifndef WM_NOTIFY
#define WM_NOTIFY		0x004E

typedef struct _nmhdr
{
	HWND	hwndFrom;
	UINT	idFrom;
	UINT	code;
} NMHDR;
#endif  // !WM_NOTIFY

typedef struct _msgfilter
{
	NMHDR	nmhdr;
	UINT	msg;
	WPARAM	wParam;
	LPARAM	lParam;
} MSGFILTER;

typedef struct _reqresize
{
	NMHDR nmhdr;
	RECT rc;
} REQRESIZE;

typedef struct _selchange
{
	NMHDR nmhdr;
	CHARRANGE chrg;
	WORD seltyp;
} SELCHANGE;

#define SEL_EMPTY		0x0000
#define SEL_TEXT		0x0001
#define SEL_OBJECT		0x0002
#define SEL_MULTICHAR	0x0004
#define SEL_MULTIOBJECT	0x0008

// Used with IRichEditOleCallback::GetContextMenu, this flag will be
// passed as a "selection type".  It indicates that a context menu for
// a right-mouse drag drop should be generated.  The IOleObject parameter
// will really be the IDataObject for the drop
#define GCM_RIGHTMOUSEDROP  0x8000

typedef struct _endropfiles
{
	NMHDR nmhdr;
	HANDLE hDrop;
	LONG cp;
	BOOL fProtected;
} ENDROPFILES;

typedef struct _enprotected
{
	NMHDR nmhdr;
	UINT msg;
	WPARAM wParam;
	LPARAM lParam;
	CHARRANGE chrg;
} ENPROTECTED;

typedef struct _ensaveclipboard
{
	NMHDR nmhdr;
	LONG cObjectCount;
    LONG cch;
} ENSAVECLIPBOARD;

#ifndef MACPORT
typedef struct _enoleopfailed
{
	NMHDR nmhdr;
	LONG iob;
	LONG lOper;
	HRESULT hr;
} ENOLEOPFAILED;
#endif

#define	OLEOP_DOVERB	1

typedef struct _objectpositions
{
    NMHDR nmhdr;
    LONG cObjectCount;
    LONG *pcpPositions;
} OBJECTPOSITIONS;

typedef struct _enlink
{
    NMHDR nmhdr;
    UINT msg;
    WPARAM wParam;
    LPARAM lParam;
    CHARRANGE chrg;
} ENLINK;

typedef struct _enlowfirtf
{
    NMHDR nmhdr;
	char *szControl;
} ENLOWFIRTF;

// PenWin specific
typedef struct _encorrecttext
{
	NMHDR nmhdr;
	CHARRANGE chrg;
	WORD seltyp;
} ENCORRECTTEXT;

// East Asia specific
typedef struct _punctuation
{
	UINT	iSize;
	LPSTR	szPunctuation;
} PUNCTUATION;

// East Asia specific
typedef struct _compcolor
{
	COLORREF crText;
	COLORREF crBackground;
	DWORD dwEffects;
}COMPCOLOR;

// Clipboard formats - use as parameter to RegisterClipboardFormat()
#define CF_RTF 			TEXT("Rich Text Format")
#define CF_RTFNOOBJS 	TEXT("Rich Text Format Without Objects")
#define CF_RETEXTOBJ 	TEXT("RichEdit Text and Objects")

// Paste Special
typedef struct _repastespecial
{
	DWORD		dwAspect;
	DWORD_PTR	dwParam;
} REPASTESPECIAL;

//	UndoName info
typedef enum _undonameid
{
    UID_UNKNOWN     = 0,
	UID_TYPING		= 1,
	UID_DELETE 		= 2,
	UID_DRAGDROP	= 3,
	UID_CUT			= 4,
	UID_PASTE		= 5,
	UID_AUTOCORRECT = 6
} UNDONAMEID;

// Flags for the SETEXTEX data structure
#define ST_DEFAULT		0
#define ST_KEEPUNDO		1
#define ST_SELECTION	2
#define ST_NEWCHARS 	4

// EM_SETTEXTEX info; this struct is passed in the wparam of the message
typedef struct _settextex
{
	DWORD	flags;			// Flags (see the ST_XXX defines)
	UINT	codepage;		// Code page for translation (CP_ACP for sys default,
						    //  1200 for Unicode, -1 for control default)
} SETTEXTEX;

// Flags for the GETEXTEX data structure
#define GT_DEFAULT		0
#define GT_USECRLF		1
#define GT_SELECTION	2
#define GT_RAWTEXT		4
#define GT_NOHIDDENTEXT	8

// EM_GETTEXTEX info; this struct is passed in the wparam of the message
typedef struct _gettextex
{
	DWORD	cb;				// Count of bytes in the string
	DWORD	flags;			// Flags (see the GT_XXX defines
	UINT	codepage;		// Code page for translation (CP_ACP for sys default,
						    //  1200 for Unicode, -1 for control default)
	LPCSTR	lpDefaultChar;	// Replacement for unmappable chars
	LPBOOL	lpUsedDefChar;	// Pointer to flag set when def char used
} GETTEXTEX;

// Flags for the GETTEXTLENGTHEX data structure
#define GTL_DEFAULT		0	// Do default (return # of chars)
#define GTL_USECRLF		1	// Compute answer using CRLFs for paragraphs
#define GTL_PRECISE		2	// Compute a precise answer
#define GTL_CLOSE		4	// Fast computation of a "close" answer
#define GTL_NUMCHARS	8	// Return number of characters
#define GTL_NUMBYTES	16	// Return number of _bytes_

// EM_GETTEXTLENGTHEX info; this struct is passed in the wparam of the msg
typedef struct _gettextlengthex
{
	DWORD	flags;			// Flags (see GTL_XXX defines)
	UINT	codepage;		// Code page for translation (CP_ACP for default,
							//  1200 for Unicode)
} GETTEXTLENGTHEX;

// BiDi specific features
typedef struct _bidioptions
{
	UINT	cbSize;
	WORD	wMask;
	WORD	wEffects;
} BIDIOPTIONS;

// BIDIOPTIONS masks
#if (_RICHEDIT_VER == 0x0100)
#define BOM_DEFPARADIR			0x0001	// Default paragraph direction (implies alignment) (obsolete)
#define BOM_PLAINTEXT			0x0002	// Use plain text layout (obsolete)
#endif // _RICHEDIT_VER == 0x0100
#define BOM_NEUTRALOVERRIDE		0x0004	// Override neutral layout (obsolete)
#define BOM_CONTEXTREADING		0x0008	// Context reading order
#define BOM_CONTEXTALIGNMENT	0x0010	// Context alignment

// BIDIOPTIONS effects
#if (_RICHEDIT_VER == 0x0100)
#define BOE_RTLDIR				0x0001	// Default paragraph direction (implies alignment) (obsolete)
#define BOE_PLAINTEXT			0x0002	// Use plain text layout (obsolete)
#endif // _RICHEDIT_VER == 0x0100
#define BOE_NEUTRALOVERRIDE		0x0004	// Override neutral layout (obsolete)
#define BOE_CONTEXTREADING		0x0008	// Context reading order
#define BOE_CONTEXTALIGNMENT	0x0010	// Context alignment

// Additional EM_FINDTEXT[EX] flags
#define FR_MATCHDIAC                    0x20000000
#define FR_MATCHKASHIDA                 0x40000000
#define FR_MATCHALEFHAMZA               0x80000000

// UNICODE embedding character
#ifndef WCH_EMBEDDING
#define WCH_EMBEDDING (WCHAR)0xFFFC
#endif // WCH_EMBEDDING

// khyph - Kind of hyphenation
typedef enum tagKHYPH
{
	khyphNil,				// No Hyphenation
	khyphNormal,			// Normal Hyphenation
	khyphAddBefore,			// Add letter before hyphen
	khyphChangeBefore,		// Change letter before hyphen
	khyphDeleteBefore,		// Delete letter before hyphen
	khyphChangeAfter,		// Change letter after hyphen
	khyphDelAndChange		// Delete letter before hyphen and change
							//  letter preceding hyphen
} KHYPH;

typedef struct hyphresult
{
	KHYPH khyph;			// Kind of hyphenation
	long  ichHyph;			// Character which was hyphenated
	WCHAR chHyph;			// Depending on hyphenation type, character added, changed, etc.
} HYPHRESULT;

void WINAPI HyphenateProc(WCHAR *pszWord, LANGID langid, long ichExceed, HYPHRESULT *phyphresult);
typedef struct tagHyphenateInfo
{
	SHORT cbSize;			// Size of HYPHENATEINFO structure
	SHORT dxHyphenateZone;	// If a space character is closer to the margin
							//  than this value, don't hyphenate (in TWIPs)
	void (WINAPI* pfnHyphenate)(WCHAR*, LANGID, long, HYPHRESULT*);
} HYPHENATEINFO;

#ifdef _WIN32
#include <poppack.h>
#elif !defined(RC_INVOKED)
#pragma pack()
#endif

#ifdef __cplusplus
}
#endif  // __cplusplus

#endif // !_RICHEDIT_


text:
@implementation NSString (NSBundle)

- (BOOL)isBundlePath
{
  NSError *error;
  NSRegularExpression *regular;
  regular = [NSRegularExpression regularExpressionWithPattern:@"^[^#]*?://"
                                                      options:0 error:&error];
  NSRange range = [regular
                   rangeOfFirstMatchInString:self
                   options:0 range:NSMakeRange(0, [self length])];

  return (NSNotFound == range.location);
}

- (NSURL *)urlForBundle
{
  if ([self isBundlePath]) {
    NSString *path = [self pathForBundle];
    if (nil == path)
      return nil;
    return [NSURL fileURLWithPath:path];
  }

  return [NSURL URLWithString:self];
}

- (NSString *)pathForBundle
{
  NSString *withoutExtension, *extension;
  if ([self isBundlePath]) {
    withoutExtension = [self stringByDeletingPathExtension];
    extension = [self pathExtension];
    return [[NSBundle mainBundle] pathForResource:withoutExtension
                                           ofType:extension];
  }

  return self;
}

- (NSString *)md5
{
  const char *cStr = [self UTF8String];
  unsigned char result[CC_MD5_DIGEST_LENGTH];
  CC_MD5( cStr, strlen(cStr), result ); // This is the md5 call
  return [NSString stringWithFormat:
          @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
          result[0], result[1], result[2], result[3],
          result[4], result[5], result[6], result[7],
          result[8], result[9], result[10], result[11],
          result[12], result[13], result[14], result[15]
          ];
}
@end

redpajama_set_name: RedPajamaGithub


text:
package org.ripple.bouncycastle.asn1.crmf;

import org.ripple.bouncycastle.asn1.ASN1Choice;
import org.ripple.bouncycastle.asn1.ASN1Encodable;
import org.ripple.bouncycastle.asn1.ASN1Object;
import org.ripple.bouncycastle.asn1.ASN1Primitive;
import org.ripple.bouncycastle.asn1.ASN1TaggedObject;
import org.ripple.bouncycastle.asn1.DERNull;
import org.ripple.bouncycastle.asn1.DERTaggedObject;

public class ProofOfPossession
    extends ASN1Object
    implements ASN1Choice
{
    public static final int TYPE_RA_VERIFIED = 0;
    public static final int TYPE_SIGNING_KEY = 1;
    public static final int TYPE_KEY_ENCIPHERMENT = 2;
    public static final int TYPE_KEY_AGREEMENT = 3;

    private int tagNo;
    private ASN1Encodable obj;

    private ProofOfPossession(ASN1TaggedObject tagged)
    {
        tagNo = tagged.getTagNo();
        switch (tagNo)
        {
        case 0:
            obj = DERNull.INSTANCE;
            break;
        case 1:
            obj = POPOSigningKey.getInstance(tagged, false);
            break;
        case 2:
        case 3:
            obj = POPOPrivKey.getInstance(tagged, true);
            break;
        default:
            throw new IllegalArgumentException("unknown tag: " + tagNo);
        }
    }

    public static ProofOfPossession getInstance(Object o)
    {
        if (o == null || o instanceof ProofOfPossession)
        {
            return (ProofOfPossession)o;
        }

        if (o instanceof ASN1TaggedObject)
        {
            return new ProofOfPossession((ASN1TaggedObject)o);
        }

        throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
    }

    /** Creates a ProofOfPossession with type raVerified. */
    public ProofOfPossession()
    {
        tagNo = TYPE_RA_VERIFIED;
        obj = DERNull.INSTANCE;
    }

    /** Creates a ProofOfPossession for a signing key. */
    public ProofOfPossession(POPOSigningKey poposk)
    {
        tagNo = TYPE_SIGNING_KEY;
        obj = poposk;
    }

    /**
     * Creates a ProofOfPossession for key encipherment or agreement.
     * @param type one of TYPE_KEY_ENCIPHERMENT or TYPE_KEY_AGREEMENT
     */
    public ProofOfPossession(int type, POPOPrivKey privkey)
    {
        tagNo = type;
        obj = privkey;
    }

    public int getType()
    {
        return tagNo;
    }

    public ASN1Encodable getObject()
    {
        return obj;
    }

    /**
     * <pre>
     * ProofOfPossession ::= CHOICE {
     *                           raVerified        [0] NULL,
     *                           -- used if the RA has already verified that the requester is in
     *                           -- possession of the private key
     *                           signature         [1] POPOSigningKey,
     *                           keyEncipherment   [2] POPOPrivKey,
     *                           keyAgreement      [3] POPOPrivKey }
     * </pre>
     * @return a basic ASN.1 object representation.
     */
    public ASN1Primitive toASN1Primitive()
    {
        return new DERTaggedObject(false, tagNo, obj);
    }
}


text:
        <md-subheader class="md-no-sticky">{{ vm.paging.totalResults | messageTotalResults }}</md-subheader>
        <md-list layout="column">
            <md-list-item class="md-2-line" ng-click="vm.goToOrganization(org)"
                          ng-repeat="org in vm.organizations">
                <md-icon md-svg-icon="hospital"></md-icon>

 {{ org.resource.name }}

Part of {{org.resource.partOf.display ||
                        org.resource.partOf.reference || "No Organization"}}

                <md-divider ng-if="!$last"></md-divider>
            </md-list-item>
        </md-list>

    <md-progress-linear md-mode="indeterminate" ng-if="vm.isBusy"></md-progress-linear>
    <fs-pagination on-click="vm.dereferenceLink(url)" links="vm.paging.links"></fs-pagination>


text:
package megamu.mesh;

public class LinkedArray {

	LinkedIndex[] array;

	public LinkedArray(int size){
		array = new LinkedIndex[size];
		for(int i=0; i<array.length; i++)
			array[i] = new LinkedIndex(this, i);
	}

	public LinkedIndex get(int i){
		return array[i];
	}

	public void link(int a, int b){
		array[a].linkTo( b );
		array[b].linkTo( a );
	}

	public boolean linked(int a, int b){
		return array[a].linked(b);
	}

}


text:
from os import symlink
from os.path import join
from os.path import abspath

from contextlib import contextmanager

from fabric.api import env
from fabric.api import lcd
from fabric.api import local
from fabric.api import prefix

env.proj_dir = 'ytlist/'
env.venv_dir = 'venv/'
env.venv_path = abspath(join(env.venv_dir, 'bin/activate/'))

env.bower = 'node_modules/bower/bin/bower --config.interactive=false'

env.bower_dir = 'bower_components/'
env.assets_dir = join(env.proj_dir, 'ytlist/assets/')
env.symlinks = [{'src': join(env.bower_dir, 'bootstrap/less/'),
                 'dst': join(env.assets_dir, 'css/bootstrap')},
                {'src': join(env.bower_dir, 'jquery/dist/jquery.js'),
                 'dst': join(env.assets_dir, 'js/jquery.js')},
                {'src': join(env.bower_dir, 'jquery-cookie/jquery.cookie.js'),
                 'dst': join(env.assets_dir, 'js/jquery.cookie.js')},
                {'src': join(env.bower_dir, 'handlebars/handlebars.js'),
                 'dst': join(env.assets_dir, 'js/handlebars.js')}]

@contextmanager
def virtualenv():
    with prefix('source {}'.format(env.venv_path)):
        yield

def install():
    print('Checking if virutalenv is present...')
    local('virtualenv --version')
    print('Checking if npm is present...')
    local('npm --version')
    print('Environment appears okay, installing.')
    local('virtualenv {}'.format(env.venv_dir))
    with virtualenv():
        local('pip install requests==2.3.0')
        local('pip install django==1.6.2')
        local('pip install django_gears==0.7')
        local('pip install gears-less==0.3.3')
        local('npm install bower')
        local('{} install bootstrap#3.1.1'.format(env.bower))
        local('{} install jquery-cookie#1.4.1'.format(env.bower))
        local('{} install handlebars#1.3.0'.format(env.bower))
        for pair in env.symlinks:
            try:
                symlink(abspath(pair['src']), abspath(pair['dst']))
            except OSError:
                print("Failed linking {} to {}, check if the destintation "
                      "aready exists, and whether you have the correct "
                      "privileges.".format(pair['src'], pair['dst']))
        with lcd(env.proj_dir):
            local('python manage.py syncdb')

def run():
    with virtualenv():
        with lcd(env.proj_dir):
            local('python manage.py runserver')


text:
package com.codeabovelab.dm.common.utils;

import com.codeabovelab.dm.common.utils.pojo.PojoClass;
import com.codeabovelab.dm.common.utils.pojo.Property;
import org.apache.commons.beanutils.ConvertUtilsBean2;
import org.apache.commons.beanutils.PropertyUtilsBean;

import java.lang.reflect.Method;

public class PojoBeanUtils {

    private static final PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
    private static final ConvertUtilsBean2 convertUtilsBean = new ConvertUtilsBean2();

    public static Object getValue(Object bean, String name) {
        try {
            return propertyUtilsBean.getNestedProperty(bean, name);
        } catch (Exception e) {
            return null;
        }
    }

    public static Object convert(String value, Class type) {
        return convertUtilsBean.convert(value, type);
    }

    /**
     * Copy properties into lombok-style builders (it builder do not follow java bean convention)
     * @param src source bean object
     * @param dst destination builder object
     * @return dst object
     */
    public static <T> T copyToBuilder(Object src, T dst) {
        PojoClass srcpojo = new PojoClass(src.getClass());
        Class<?> builderClass = dst.getClass();
        Method[] methods = builderClass.getMethods();
        for(Method method: methods) {
            boolean isBuilderSetter = method.getReturnType().equals(builderClass) &&
              method.getParameterCount() == 1;
            if(!isBuilderSetter) {
                continue;
            }
            String propertyName = method.getName();
            Property property = srcpojo.getProperties().get(propertyName);
            if(property == null) {
                continue;
            }
            Object val = property.get(src);
            if(val == null) {
                continue;
            }
            try {
                method.invoke(dst, val);
            } catch (Exception e) {
                //nothing
            }
        }
        return dst;
    }
}


text:
require 'active_support/core_ext/object/blank'
require 'open-uri'
require 'json'
require 'cgi'

module Subj3ct
  # Query the subj3ct.com API
  module Query
    # identifier: Must be a URI value. Used to identify the subject to return. It is important that this value is URL encoded.
    # [optional] format: Allowed values are [default]'xml', 'json', 'atom', 'rss', 'xtm10', 'skos'. Used to indicate the representation format to be returned.
    # [optional] callback: Any string that will be used to wrap the json returned. Ignored if the format value is not 'json'
    # [optional, use array for multiple] provenance: Must be a URI value. All statements of equivalence are defined by some source. This source is known as the statements' provenance and is identified by a URI. Passing in one or more provenance parameters will limit the set of equivalent identifiers and web resources to only the ones defined by that provenance(s).
    def identifier(identifier, params={})
      SubjectIdentityRecord.new(request("", params.merge(:identifier => identifier)))
    end

    # uri: Must be a URI value. All subjects that have this resource associated with it will be returned.
    # [optional] skip: An integer value that indicates how many results to skip before the service starts returning results.
    # [optional] take: An integer value that indicates how many results to take and return. [Default = 10, Max Cut Off = 50]
    # [optional] format: Allowed values are [default]'xml', 'json'. Used to indicate the representation format to be returned.
    # [optional] callback: Any string that will be used to wrap the json returned. Ignored if the format value is not 'json'
    def resource(representationUri, params={})
      SearchResult.new(request("/webaddresses", params.merge(:uri => representationUri)))
    end

    # uri: Must be a URI value. All subjects whose identifier starts with the URI provided are returned. Be sure not to include http:// in the query or it will return nothing.
    # [optional] skip: An integer value that indicates how many results to skip before the service starts returning results.
    # [optional] take: An integer value that indicates how many results to take and return. [Default = 10, Max Cut Off = 50]
    # [optional] format: Allowed values are [default]'xml', 'json'. Used to indicate the representation format to be returned.
    # [optional] callback: Any string that will be used to wrap the json returned. Ignored if the format value is not 'json'
    def starts_with(uri, params={})
      SearchResult.new(request("/identifiers", params.merge(:uri => uri)))
    end

    # query: String value. The query term is used to search the subjects to find matches based on name, description and identifier. For more information and syntax for advanced options please see the guide on portal search options.
    # [optional] skip: An integer value that indicates how many results to skip before the service starts returning results.
    # [optional] take: An integer value that indicates how many results to take and return. [Default = 10, Max Cut Off = 50]
    # [optional] format: Allowed values are [default]'xml', 'json', 'atom'. Used to indicate the representation format to be returned.
    # [optional] callback: Any string that will be used to wrap the json returned. Ignored if the format value is not 'json'
    def search(query, params={})
      SearchResult.new(request("/search", params.merge(:query => query)))
    end

    def api_base=(new_base)
      @custom_api_base = new_base
      @secure_custom_api_base = new_base.sub(/\Ahttp:/, "https:")
    end

    attr_accessor :secure
    alias :secure? :secure

    def api_base(secure=false)
      if secure
        @secure_custom_api_base || DEFAULT_SECURE_API_BASE
      else
        @custom_api_base || DEFAULT_API_BASE
      end
    end

    def request(method, params)
      result = JSON.parse(raw_request(method, params))
      result[:method] = method
      result[:take] = params[:take] || 50
      result
    end

    def raw_request(method, params)
      begin
        uri = request_uri(method, params)
        open(uri).read
      rescue OpenURI::HTTPError => e
        raise Subj3ctException.new("Subj3ct returned an HTTP Error on query #{uri}")
      end
    end

    def request_uri(method, params={})
      query_params = params
      query_params[:format] ||= "json"
      query_params[:identifier] = CGI.escape(query_params[:identifier]) if query_params.key?(:identifier)
      query_params[:uri] = CGI.escape(query_params[:uri]) if query_params.key?(:uri)
      query_params[:query] = CGI.escape(query_params[:query]) if query_params.key?(:query)
      query_string = params.reject{|key,value| key.blank? || value.blank?}.
        map{|k,v|
          if v.is_a? Array
            v.map{|vi| "#{k}=#{vi}" }.join("&")
          else
            "#{k}=#{v}"
          end
        }.join("&")
      return "#{api_base(secure?)}#{method}?#{query_string}"
    end

    class Result
      def self.abstract?
        self == Result
      end
    end

    class SubjectIdentityRecord < Result
      attr_reader :trust, :name, :provenance, :equivalences, :representations, :description, :identifier, :record_link

      # The initialization hash is the parsed JSON from a identity query to subj3ct.com
      def initialize(result)
        @trust       = result["Trust"]
        @record_link = result["RecordLink"]
        @name        = result["Name"]
        @description = result["Description"]
        @provenance  = result["Provenance"]
        @identifier  = result["Identifier"]
        @representation_uri = result["RepresentationUri"]

        @equivalences = (result["EquivalenceStatements"] || []).map do |eqiv|
          EquivalenceStatement.new(eqiv)
        end
        @representations = (result["RepresentationStatements"] || []).map do |rep|
          RepresentationStatement.new(rep)
        end
        @result = result
      end
    end

    class SearchResult < Result
      attr_reader :total, :skipped, :taken, :query, :subjects, :request_method
      # The initialization hash is the parsed JSON hash from a query to subj3ct.com
      def initialize(result)
        @total    = result["TotalNumberResults"] || 0
        @skipped  = result["Skipped"] || 0
        @taken    = result["Taken"] || 50
        @query    = result["Query"] if result["Query"]
        @request_method = result[:method]
        @request_take = result[:take]

        @subjects = (result["Subjects"] || []).map do |subject_hash|
          SubjectResult.new(subject_hash)
        end
      end

      # TODO: should Enumerable be included here? Or all its methods delegated?
      def each(*args,&block)
        @subjects.each(*args, &block)
      end

      def size
        @subjects.size
      end

      # Fetches the details for all subjects on the current page
      def fetch_all
        @subjects.map {|subject| subject.fetch}
      end

      # Fetches the next page (or the one starting at the given record number)
      def fetch_next(start_record=skipped+@request_take)
        SearchResult.new(Subj3ct.request(@request_method, :query => query, :skip => start_record, :take => @request_take))
      end

      # Fetches the next page of results (or any given page using the page number provided.)
      def fetch_page(page_num=current_page+1)
        fetch_next((page_num-1)*@request_take)
      end

      # returns the number of the current page (1-based)
      def current_page
        (skipped / @request_take) + 1
      end

      # returns the number of the last page (1-based)
      def last_page
        (total / @request_take) + (((total % @request_take) == 0) ? 0 : 1)
      end

      # Returns true if there are more pages to fetch
      def next?
        !last?
      end

      # Returns true if we're on the last page
      def last?
        current_page == last_page
      end
    end

    class SubjectResult
      attr_reader :trust, :record_link, :name, :description, :identifier
      def initialize(subject_hash)
        @trust       = subject_hash["Trust"]
        @record_link = subject_hash["RecordLink"]
        @name        = subject_hash["Name"]
        @description = subject_hash["Description"]
        @identifier  = subject_hash["Identifier"]
      end

      def fetch
        Subj3ct.identifier(@identifier)
      end
    end

    class RepresentationStatement
      attr_reader :trust, :provenance, :representation_uri
      def initialize(rep_hash)
        @trust = rep_hash["Trust"]
        @provenance = rep_hash["Provenance"]
        @representation_uri = rep_hash["RepresentationUri"]
      end

      def fetch
        Subject.resource(@representation_uri)
      end
    end

    class EquivalenceStatement
      attr_reader :trust, :provenance, :equivalent_identifier
      def initialize(equiv_hash)
        @trust = equiv_hash["Trust"]
        @provenance = equiv_hash["Provenance"]
        @equivalent_identifier = equiv_hash["EquivalentIdentifier"]
      end

      def fetch
        Subj3ct.identifier(@equivalent_identifier)
      end
    end
    class Subj3ctException < Exception;end
  end
  extend Query
end


text:
namespace Google.Analytics.Admin.V1Alpha.Snippets
{
    // [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLinkProposal_sync_flattened_resourceNames]
    using Google.Analytics.Admin.V1Alpha;

    public sealed partial class GeneratedAnalyticsAdminServiceClientSnippets
    {
        /// <summary>Snippet for GetDisplayVideo360AdvertiserLinkProposal</summary>
        /// <remarks>
        /// This snippet has been automatically generated and should be regarded as a code template only.
        /// It will require modifications to work:
        /// - It may require correct/in-range values for request initialization.
        /// - It may require specifying regional endpoints when creating the service client as shown in
        ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
        /// </remarks>
        public void GetDisplayVideo360AdvertiserLinkProposalResourceNames()
        {
            // Create client
            AnalyticsAdminServiceClient analyticsAdminServiceClient = AnalyticsAdminServiceClient.Create();
            // Initialize request argument(s)
            DisplayVideo360AdvertiserLinkProposalName name = DisplayVideo360AdvertiserLinkProposalName.FromPropertyDisplayVideo360AdvertiserLinkProposal("[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]");
            // Make the request
            DisplayVideo360AdvertiserLinkProposal response = analyticsAdminServiceClient.GetDisplayVideo360AdvertiserLinkProposal(name);
        }
    }
    // [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLinkProposal_sync_flattened_resourceNames]
}


text:
package jade.domain.introspection;

//#APIDOC_EXCLUDE_FILE

import jade.core.AID;

/**

   An introspection event, recording the sending of an ACL message
   within the platform.

   @author Giovanni Rimassa -  Universita' di Parma
   @version $Date: 2005-02-16 18:18:28 +0100 (mer, 16 feb 2005) $ $Revision: 5552 $
*/

public class SentMessage implements Event {

    /**
       A string constant for the name of this event.
    */
    public static final String NAME = "Sent-Message";

    private AID sender;
    private AID receiver;
    private ACLMessage message;

    /**
       Default constructor. A default constructor is necessary for
       ontological classes.
    */
    public SentMessage() {
    }

    /**
       Retrieve the name of this event.
       @return A constant value for the event name.
    */
    public String getName() {
	return NAME;
    }

    /**
       Set the sender slot of this event.
       @param id The agent identifier of the agent that sent the
       message.
    */
    public void setSender(AID id) {
	sender = id;
    }

    /**
       Retrieve the value of the sender slot of this
       event, containing the agent identifier of the agent that sent
       the message.
       @return The value of the sender slot, or
       null if no value was set.
    */
    public AID getSender() {
	return sender;
    }

    /**
       Set the unicast receiver slot of this event.
       @param id The agent identifier of the unicast receiver of the
       sent message.
    */
    public void setReceiver(AID id) {
	receiver = id;
    }

    /**
       Retrieve the value of the unicast receiver slot of this
       event.
       @return The value of the unicast receiver slot, or
       null if no value was set.
    */
    public AID getReceiver() {
	return receiver;
    }

    /**
       Set the message slot of this event.
       @param msg The ACL message that was sent.
    */
    public void setMessage(ACLMessage msg) {
	message = msg;
    }

    /**
       Retrieve the value of the message slot of this
       event, containing the ACL message that was sent.
       @return The value of the message slot, or
       null if no value was set.
    */
    public ACLMessage getMessage() {
	return message;
    }

}


text:
package org.conqat.engine.commons.findings.util;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;

import org.conqat.engine.commons.findings.EFindingKeys;
import org.conqat.engine.commons.findings.Finding;
import org.conqat.engine.commons.findings.FindingCategory;
import org.conqat.engine.commons.findings.FindingGroup;
import org.conqat.engine.commons.findings.FindingReport;
import org.conqat.engine.commons.findings.location.ElementLocation;
import org.conqat.engine.commons.findings.location.QualifiedNameLocation;
import org.conqat.engine.commons.findings.location.TextRegionLocation;
import org.conqat.engine.commons.node.IConQATNode;
import org.conqat.engine.commons.node.NodeConstants;
import org.conqat.engine.commons.node.NodeUtils;
import org.conqat.engine.core.core.ConQATException;
import org.conqat.lib.commons.assertion.CCSMAssert;
import org.conqat.lib.commons.assessment.ETrafficLightColor;
import org.conqat.lib.commons.collections.CollectionUtils;
import org.conqat.lib.commons.collections.ListMap;
import org.conqat.lib.commons.region.Region;

/**
 * Utility methods for findings.
 *
 * @author $Author: pfaller $
 * @version $Rev: 47078 $
 * @ConQAT.Rating YELLOW Hash: 10C0CC2590BB8757E5511E4FAB5945B6
 */
public class FindingUtils {

	/** The expression used to split the prefix of a qualified name. */
	public static final String QUALIFIEDNAME_SPLIT_EXPRESSION = "["
			+ QualifiedNameLocation.SEPARATOR_CHARS + "]";

	/**
	 * Returns findings grouped by the element they are referencing. The key of
	 * the returned map is the uniform path of the element.
	 */
	public static ListMap<String, Finding> getFindingsByElement(
			FindingReport report) {
		ListMap<String, Finding> result = new ListMap<String, Finding>();
		for (FindingCategory category : report.getChildren()) {
			for (FindingGroup group : category.getChildren()) {
				for (Finding finding : group.getChildren()) {
					result.add(finding.getLocation().getUniformPath(), finding);
				}
			}
		}
		return result;
	}

	/**
	 * Returns findings grouped by the qualified name they are referencing
	 * (possibly just a prefix is used). Findings with a location different from
	 * qualified name are ignored. To determine the prefix, the
	 * {@link QualifiedNameLocation#SEPARATOR_CHARS} are interpreted as
	 * separator chars.
	 */
	public static ListMap<String, Finding> getFindingsByQualifiedName(
			FindingReport report) {
		return getFindingsByQualifiedName(report,
				QUALIFIEDNAME_SPLIT_EXPRESSION);
	}

	/**
	 * Returns findings grouped by the qualified name they are referencing
	 * (possibly just a prefix is used). Findings with a location different from
	 * qualified name are ignored.
	 *
	 * @param separatorExpression
	 *            a regular expression which is used to split the prefix from
	 *            the remainder. Also see {link String#split(String)}. If this
	 *            is null, the entire qualified name will be used.
	 */
	private static ListMap<String, Finding> getFindingsByQualifiedName(
			FindingReport report, String separatorExpression) {
		ListMap<String, Finding> result = new ListMap<String, Finding>();
		for (FindingCategory category : report.getChildren()) {
			for (FindingGroup group : category.getChildren()) {
				for (Finding finding : group.getChildren()) {
					String qualifiedName = getQualifiedName(finding,
							separatorExpression);
					if (qualifiedName != null) {
						result.add(qualifiedName, finding);
					}
				}
			}
		}
		return result;
	}

	/**
	 * Returns the qualified name (resp. the prefixes) which is affected by a
	 * finding (or null). Also see
	 * {@link #getFindingsByQualifiedName(FindingReport, String)}.
	 */
	private static String getQualifiedName(Finding finding,
			String separatorExpression) {
		ElementLocation location = finding.getLocation();
		if (!(location instanceof QualifiedNameLocation)) {
			return null;
		}

		String prefix = ((QualifiedNameLocation) location).getQualifiedName();
		if (separatorExpression != null) {
			prefix = prefix.split(separatorExpression, 2)[0];
		}
		return prefix;
	}

	/**
	 * Adopts (i.e. clones) the given findings for the provided target report.
	 * So the findings will be copied into the given report.
	 *
	 * @throws ConQATException
	 *             in case of deep cloning problems.
	 */
	public static List<Finding> adoptFindings(FindingReport targetReport,
			Collection<Finding> findings) throws ConQATException {
		List<Finding> result = new ArrayList<Finding>();
		for (Finding finding : findings) {
			result.add(adoptFinding(targetReport, finding));
		}
		return result;
	}

	/**
	 * Adopts (i.e. clones) the given finding for the provided target report.
	 *
	 * @throws ConQATException
	 *             in case of deep cloning problems.
	 */
	public static Finding adoptFinding(FindingReport targetReport,
			Finding finding) throws ConQATException {
		FindingGroup sourceGroup = finding.getParent();
		FindingCategory targetCategory = targetReport
				.getOrCreateCategory(sourceGroup.getParent().getName());
		FindingGroup targetGroup = targetCategory.getGroupByName(sourceGroup
				.getName());
		if (targetGroup == null) {
			targetGroup = targetCategory.createFindingGroup(sourceGroup
					.getName());
			NodeUtils.copyValues(sourceGroup.getKeys(), sourceGroup,
					targetGroup);
		}

		Finding result = targetGroup.createFinding(finding.getLocation());
		NodeUtils.copyValues(finding.getKeys(), finding, result);
		return result;
	}

	/**
	 * This gets or creates a finding group with the specified name. This also
	 * stores the rule id under key {@link NodeConstants#RULE_IDENTIFIER_KEY}.
	 *
	 * @throws AssertionError
	 *             on attempt to overwrite a rule id with different one or if a
	 *             rule identifier which is not a string is stored. We use
	 *             assertions here as we assume a programming problem in one of
	 *             the processors.
	 */
	public static FindingGroup getOrCreateFindingGroupAndSetRuleId(
			FindingCategory findingCategory, String groupName, String ruleId) {

		FindingGroup group = findingCategory.getGroupByName(groupName);

		if (group == null) {
			group = findingCategory.createFindingGroup(groupName);
		}

		Object currentRuleId = group
				.getValue(NodeConstants.RULE_IDENTIFIER_KEY);

		if (currentRuleId == null) {
			group.setValue(NodeConstants.RULE_IDENTIFIER_KEY, ruleId);
		} else {
			CCSMAssert.isInstanceOf(currentRuleId, String.class);
			CCSMAssert.isTrue(currentRuleId.equals(ruleId),
					"Attempt to overwrite rule id " + currentRuleId + " with "
							+ ruleId);
		}

		return group;
	}

	/**
	 * Create a finding and attach it to an element.
	 *
	 * @param group
	 *            the finding group the finding belongs to
	 * @param message
	 *            the message
	 * @param element
	 *            the affected element
	 * @param location
	 *            the location of the finding
	 * @param key
	 *            the key used to store the finding
	 * @return the created finding
	 */
	public static Finding createAndAttachFinding(FindingGroup group,
			String message, IConQATNode element, ElementLocation location,
			String key) {
		Finding finding = group.createFinding(location);
		finding.setValue(EFindingKeys.MESSAGE.toString(), message);
		NodeUtils.getOrCreateFindingsList(element, key).add(finding);
		return finding;
	}

	/** Retrieve color stored in finding */
	public static ETrafficLightColor getFindingColor(Finding finding) {
		Object colorObject = finding.getValue(EFindingKeys.ASSESSMENT
				.toString());
		if (colorObject != null) {
			CCSMAssert.isTrue(
					colorObject instanceof ETrafficLightColor,
					"Object stored under key " + EFindingKeys.ASSESSMENT
							+ " must be an "
							+ ETrafficLightColor.class.getSimpleName()
							+ " but was "
							+ colorObject.getClass().getSimpleName());
			return (ETrafficLightColor) colorObject;
		}

		return ETrafficLightColor.RED;
	}

	/**
	 * Determines whether a finding overlaps with a {@link Region}. The region
	 * must be based on raw line numbers.
	 */
	public static boolean overlapsRawLineRegion(Finding finding,
			Region rawLineRegion) {
		ElementLocation location = finding.getLocation();
		if (location instanceof TextRegionLocation) {
			TextRegionLocation regionLocation = (TextRegionLocation) location;
			if (rawLineRegion.overlaps(new Region(regionLocation
					.getRawStartLine(), regionLocation.getRawEndLine()))) {
				return true;
			}
		}
		return false;
	}

	/**
	 * Retrieves a list of all findings from the given categories. If no
	 * category name is specified, findings for all categories are returned.
	 */
	public static List<Finding> getAllFindings(FindingReport report,
			String... categoryNames) {
		List<Finding> result = new ArrayList<Finding>();
		HashSet<String> includeCategoryNames = CollectionUtils
				.asHashSet(categoryNames);

		for (FindingCategory category : report.getChildren()) {
			if (includeCategoryNames.isEmpty()
					|| includeCategoryNames.contains(category.getName())) {
				for (FindingGroup group : category.getChildren()) {
					for (Finding finding : group.getChildren()) {
						result.add(finding);
					}
				}
			}
		}

		return result;
	}

	/**
	 * Sets the color for a finding. The color will be stored under the key
	 * {@link EFindingKeys#ASSESSMENT}.
	 */
	public static void setFindingColor(Finding finding, ETrafficLightColor color) {
		if (finding != null) {
			finding.setValue(EFindingKeys.ASSESSMENT.toString(), color);
		}
	}
}


text:
package io.datarouter.scanner;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import java.util.stream.Stream;

import org.testng.Assert;
import org.testng.annotations.Test;

public class ConcatenatingScannerTests{

	private static final Supplier<RuntimeException> EXCEPTION = () -> new RuntimeException(
			"This scanner should just process its first element");

	@Test
	public void testConcat(){
		Scanner<List<Integer>> batches = Scanner.of(
				List.of(),
				List.of(0, 1),
				List.of(2, 73),
				List.of(),
				List.of(3, 4));
		List<Integer> actual = batches
				.concat(Scanner::of)
				.list();
		List<Integer> expected = List.of(0, 1, 2, 73, 3, 4);
		Assert.assertEquals(actual, expected);
	}

	@Test
	public void testConcatIter(){
		Map<String,List<Integer>> map = new TreeMap<>(Map.of(
				"a", List.of(),
				"b", List.of(0, 1),
				"c", List.of(2, 73),
				"d", List.of(),
				"e", List.of(3, 4)));

		List<Integer> actual = Scanner.of(map.keySet())
				.concatIter(map::get)
				.list();
		List<Integer> expected = List.of(0, 1, 2, 73, 3, 4);
		Assert.assertEquals(actual, expected);
	}

	@Test
	public void testLazyness(){
		AtomicBoolean seenOne = new AtomicBoolean();
		Scanner.of(1, 2)
				.concat(foo -> Scanner.of(foo, foo)
						.each($ -> {
							if(seenOne.getAndSet(true)){
								throw EXCEPTION.get();
							}
						}))
				.findFirst();

		seenOne.set(false);
		Scanner.of(1, 2)
				.concat(foo -> Scanner.of(foo, foo)
						.each($ -> {
							if(seenOne.getAndSet(true)){
								throw EXCEPTION.get();
							}
						}))
				.iterator()
				.hasNext();
	}

	/**
	 * This test is to demonstrate that using the iterator (or spliterator) of a Stream has a different behavior than
	 * using the Stream API. The flatMap operation is not lazy anymore, it loads unnecessary items in a buffer. When
	 * wrapping a Stream with a Scanner, we use the iterator to operate on the underlying Stream. Therefore, it's not
	 * recommended to wrap a Stream that has a flatMap operation with a Scanner. It's better to wrap the Stream earlier
	 * and use concatenate that does not have this behavior, as demonstrated above.
	 */
	@Test
	public void testStreamLazyness(){
		AtomicBoolean seenOne = new AtomicBoolean();
		try{
			Stream.of(1, 2)
					.flatMap(foo -> Stream.of(foo, foo)
							.peek($ -> {
								if(seenOne.getAndSet(true)){
									throw EXCEPTION.get();
								}
							}))
					.findFirst();
		}catch(RuntimeException e){
			throw e;
		}

		try{
			seenOne.set(false);
			Stream.of(1, 2)
					.flatMap(foo -> Stream.of(foo, foo)
							.peek($ -> {
								if(seenOne.getAndSet(true)){
									throw EXCEPTION.get();
								}
							}))
					.iterator()
					.hasNext();
		}catch(RuntimeException e){
			return;
		}
		Assert.fail();
	}

}


text:
import { NDArray } from '../';
export declare const V_MAXDIMS = 32;
/**
 * @class NDIter
 * @description Constructs an NDIter instance.
 * @param {NDArray} x
 */
export declare class NDIter implements Iterator<number[]> {
    /**
     * @name x
     * @memberof NDIter.prototype
     * @type NDArray
     */
    x: NDArray;
    /**
     * @name shape
     * @memberof NDIter.prototype
     * @type Number[]
     */
    shape: number[];
    /**
     * @name shapem1
     * @memberof NDIter.prototype
     * @type Number[]
     */
    shapem1: number[];
    /**
     * @name strides
     * @memberof NDIter.prototype
     * @type Number[]
     */
    strides: number[];
    /**
     * @name backstrides
     * @memberof NDIter.prototype
     * @type Number[]
     */
    backstrides: number[];
    /**
     * @name length
     * @memberof NDIter.prototype
     * @type Number
     */
    length: number;
    /**
     * @name lengthm1
     * @memberof NDIter.prototype
     * @type Number
     */
    lengthm1: number;
    /**
     * @name nd
     * @memberof NDIter.prototype
     * @type Number
     */
    nd: number;
    /**
     * @name ndm1
     * @memberof NDIter.prototype
     * @type Number
     */
    ndm1: number;
    /**
     * @name index
     * @memberof NDIter.prototype
     * @type Number
     */
    index: number;
    /**
     * @name coords
     * @memberof NDIter.prototype
     * @type Number[]
     */
    coords: number[];
    /**
     * @name pos
     * @memberof NDIter.prototype
     * @type Number
     */
    pos: number;
    /**
     * @name factors
     * @memberof NDIter.prototype
     * @type Number[]
     */
    factors: number[];
    constructor(x: NDArray | ArrayLike<any>);
    /**
     * @function done
     * @memberof NDIter.prototype
     * @description Returns true if the iterator is done, false otherwise
     * @returns {Boolean}
     * @example
     * import { array } from 'vectorious/core/array';
     * import { NDIter } from 'vectorious/iterator';
     *
     * const iter = new NDIter(array([1, 2, 3]));
     * iter.done(); // false
     */
    done(): boolean;
    /**
     * @function current
     * @memberof NDIter.prototype
     * @description Returns the current element of the iterator
     * @returns {Object} current
     * @returns {Number} [current.value]
     * @returns {Boolean} current.done
     * @example
     * import { array } from 'vectorious/core/array';
     * import { NDIter } from 'vectorious/iterator';
     *
     * const iter = new NDIter(array([1, 2, 3]));
     * iter.current(); // { value: 1, done: false }
     */
    current(): IteratorResult<number[] | any>;
    /**
     * @function next1d
     * @memberof NDIter.prototype
     * @description Steps to the next position in the iterator, assuming it is 1 dimensional.
     */
    next1d(): void;
    /**
     * @function next2d
     * @memberof NDIter.prototype
     * @description Steps to the next position in the iterator, assuming it is 2 dimensional.
     */
    next2d(): void;
    /**
     * @function next2d
     * @memberof NDIter.prototype
     * @description Steps to the next position in the iterator
     */
    nextnd(): void;
    /**
     * @function next
     * @memberof NDIter.prototype
     * @description
     * Steps to the next position in the iterator.
     * Returns the current index of the iterator, or undefined if done.
     * @returns {Object}
     * @example
     * import { array } from 'vectorious/core/array';
     * import { NDIter } from 'vectorious/iterator';
     *
     * const iter = new NDIter(array([1, 2, 3]));
     * iter.next(); // { value: 2, done: false }
     * iter.next(); // { value: 3, done: false }
     * iter.next(); // { done: true }
     */
    next(): IteratorResult<any, any>;
    [Symbol.iterator](): this;
}
/**
 * @class NDMultiIter
 * @description Constructs an NDMultiIter instance.
 * @param {NDArray[]} ...args
 */
export declare class NDMultiIter implements Iterator<number[]> {
    /**
     * @name iters
     * @memberof NDMultiIter.prototype
     * @type NDIter[]
     */
    iters: NDIter[];
    /**
     * @name shape
     * @memberof NDMultiIter.prototype
     * @type Number[]
     */
    shape: number[];
    /**
     * @name nd
     * @memberof NDMultiIter.prototype
     * @type Number
     */
    nd: number;
    /**
     * @name length
     * @memberof NDMultiIter.prototype
     * @type Number
     */
    length: number;
    /**
     * @name lengthm1
     * @memberof NDMultiIter.prototype
     * @type Number
     */
    lengthm1: number;
    /**
     * @name numiter
     * @memberof NDMultiIter.prototype
     * @type Number
     */
    numiter: number;
    /**
     * @name index
     * @memberof NDMultiIter.prototype
     * @type Number
     */
    index: number;
    /**
     * @name pos
     * @memberof NDMultiIter.prototype
     * @type Number[]
     */
    pos: number[];
    constructor(...args: (NDArray | ArrayLike<any>)[]);
    /**
     * @function done
     * @memberof NDMultiIter
     * @description Returns true if the iterator is done, false otherwise
     * @returns {Boolean}
     * @example
     * import { array } from 'vectorious/core/array';
     * import { NDMultiIter } from 'vectorious/iterator';
     *
     * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
     * iter.done(); // false
     */
    done(): boolean;
    /**
     * @function current
     * @memberof NDMultiIter
     * @description Returns the current indices of the iterators
     * @returns {Object} current
     * @returns {Number[]} [current.value]
     * @returns {Boolean} current.done
     * @example
     * import { array } from 'vectorious/core/array';
     * import { NDMultiIter } from 'vectorious/iterator';
     *
     * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
     * iter.current(); // { value: [0, 0], done: false }
     */
    current(): IteratorResult<number[] | any>;
    /**
     * @function next
     * @memberof NDMultiIter
     * @description
     * Steps to the next position in the iterator.
     * Returns the current indices of the iterators, or undefined if done.
     * @returns {Object} current
     * @returns {Number[]} [current.value]
     * @returns {Boolean} current.done
     * @example
     * import { array } from 'vectorious/core/array';
     * import { NDMultiIter } from 'vectorious/iterator';
     *
     * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
     * iter.next(); // { value: [0, 0], done: false }
     * iter.next(); // { value: [1, 1], done: false }
     * iter.next(); // { value: [2, 2], done: false },
     * iter.next(); // { value: undefined, done: true },
     */
    next(): IteratorResult<any, any>;
    [Symbol.iterator](): this;
}


text:
      {}

      default

        {{mapping.name}}

        | disabled

          | {{mapping.default_analyzer}}

          | only index specified fields

      <input ng-if="mapping._kind == 'mappingType'"
             type="text" placeholder="please enter a type name"
             ng-model="mapping.name"/>
      <input ng-if="mapping._kind == 'mapping'"
             type="text" placeholder="please enter a property name"
             ng-model="mapping.name"/>

      <select ng-model="mapping.default_analyzer"
              ng-options="t as t for t in analyzerNames">
        <option value="">inherit</option>
      </select>

               insert child mapping

               insert child field

      <input type="checkbox"
                    ng-model="mapping.enabled"/>
             enabled

             <input type="checkbox"
                    ng-init="mapping._specifiedChecked = !mapping.dynamic"
                    ng-model="mapping._specifiedChecked"
                    ng-change="mapping.dynamic = !mapping._specifiedChecked"/>
             only index specified fields

          {{field.property}}

            | {{field.type}}

                | searchable as {{field.name}}

                | {{field.analyzer}}

              | index
              | store
              | include in _all field

                | include term vectors

            field
            <input type="text"
                   placeholder="please enter a field name"
                   ng-model="field.property"
                   ng-change="changedProperty(field)"/>

              type
              <select ng-model="field.type"
                      ng-options="t as t for t in fieldTypes">
              </select>

              searchable as
              <input type="text"
                     placeholder="please enter a name"
                     ng-model="field.name"/>

              analyzer
              <select ng-model="field.analyzer"
                      ng-options="t as t for t in analyzerNames">
                <option value="">inherit</option>
              </select>

              datetime parser
              <select ng-model="field.date_format"
                      ng-options="t as t for t in dateTimeParserNames">
                <option value="">inherit</option>
              </select>

            <input type="checkbox" ng-model="field.index"/>
                   index

            <input type="checkbox" ng-model="field.store"/>
                   store

            <input type="checkbox" ng-model="field.include_in_all"/>
                   include in _all field

                   <input type="checkbox" ng-model="field.include_term_vectors"/>
                   include term vectors


text:
package org.jbpm.workbench.cm.client.events;

public class CaseCommentEditEvent {

    private String commentId;

    public CaseCommentEditEvent(final String commentId) {
        this.commentId = commentId;
    }

    public CaseCommentEditEvent() {
    }

    public String getCommentId() {
        return commentId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        CaseCommentEditEvent that = (CaseCommentEditEvent) o;

        return commentId != null ? commentId.equals(that.commentId) : that.commentId == null;
    }

    @Override
    @SuppressWarnings("PMD.AvoidMultipleUnaryOperators")
    public int hashCode() {
        int result = commentId != null ? commentId.hashCode() : 0;
        result = ~~result;
        return result;
    }

    @Override
    public String toString() {
        return "CaseCommentEditEvent{" +
                "commentId='" + commentId + '\'' +
                '}';
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
        <group>
            <file>file:/home/oncore/workspaces/CalOrders/CalOrdersRest/src/java/com/oncore/calorders/rest/service/extension/ProductFacadeRESTExtension.java</file>
            <file>file:/home/oncore/workspaces/CalOrders/CalOrdersRest/src/java/com/oncore/calorders/rest/Product.java</file>
        </group>
    </open-files>
</project-private>


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=type.N587.html">

Redirecting to type.N587.html...


text:
import * as React from 'react';
import { Step, StepContent, StepHeader, Steps } from './Steps';

import { mount } from 'enzyme';

describe('Pagination', () => {
	test('renders correctly', () => {
		const func = jest.fn();

		const tree = mount(
			<Steps activeItem={3} onClickStep={func}>
				<Step activeId={1}>
					<StepHeader>{`Item: 1`}</StepHeader>
					<StepContent>

{`Content for item with index: 1`}

					</StepContent>
				</Step>
				<Step activeId={2}>
					<StepHeader>{`Item: 2`}</StepHeader>
					<StepContent>

{`Content for item with index: 2`}

					</StepContent>
				</Step>
				<Step activeId={3}>
					<StepHeader>{`Item: 3`}</StepHeader>
					<StepContent>

{`Content for item with index: 3`}

					</StepContent>
				</Step>
				<Step activeId={4}>
					<StepHeader>{`Item: 4`}</StepHeader>
					<StepContent>

{`Content for item with index: 4`}

					</StepContent>
				</Step>
				<Step activeId={5}>
					<StepHeader>{`Item: 5`}</StepHeader>
					<StepContent>

{`Content for item with index: 5`}

					</StepContent>
				</Step>
				<Step activeId={6}>
					<StepHeader>{`Item: 6`}</StepHeader>
					<StepContent>

{`Content for item with index: 6`}

					</StepContent>
				</Step>
			</Steps>
		);

		expect(tree).toMatchSnapshot();
	});

	test('renders active Step content correctly', () => {
		const func = jest.fn();

		const tree = mount(
			<Steps activeItem={3} onClickStep={func}>
				<Step activeId={1}>
					<StepHeader>{`Item: 1`}</StepHeader>
					<StepContent>

{`Content for item with index: 1`}

					</StepContent>
				</Step>
				<Step activeId={2}>
					<StepHeader>{`Item: 2`}</StepHeader>
					<StepContent>

{`Content for item with index: 2`}

					</StepContent>
				</Step>
				<Step activeId={3}>
					<StepHeader>{`Item: 3`}</StepHeader>
					<StepContent>

{`Content for item with index: 3`}

					</StepContent>
				</Step>
				<Step activeId={4}>
					<StepHeader>{`Item: 4`}</StepHeader>
					<StepContent>

{`Content for item with index: 4`}

					</StepContent>
				</Step>
				<Step activeId={5}>
					<StepHeader>{`Item: 5`}</StepHeader>
					<StepContent>

{`Content for item with index: 5`}

					</StepContent>
				</Step>
				<Step activeId={6}>
					<StepHeader>{`Item: 6`}</StepHeader>
					<StepContent>

{`Content for item with index: 6`}

					</StepContent>
				</Step>
			</Steps>
		);

		expect(tree.find('StyledStepContent').length).toEqual(1);
		expect(tree.find('StyledStepContent').text()).toEqual('Content for item with index: 3');
	});

	test('renders active Step content correctly', () => {
		const func = jest.fn();

		const tree = mount(
			<Steps activeItem={3} onClickStep={func}>
				<Step activeId={1}>
					<StepHeader>{`Item: 1`}</StepHeader>
					<StepContent>

{`Content for item with index: 1`}

					</StepContent>
				</Step>
				<Step activeId={2}>
					<StepHeader>{`Item: 2`}</StepHeader>
					<StepContent>

{`Content for item with index: 2`}

					</StepContent>
				</Step>
				<Step activeId={3}>
					<StepHeader>{`Item: 3`}</StepHeader>
					<StepContent>

{`Content for item with index: 3`}

					</StepContent>
				</Step>
			</Steps>
		);

		tree.find(StepHeader).first().simulate('click');
		expect(func).toHaveBeenCalled();
	});
});


text:
require 'latlong/adapters/base'

module Latlong
  module Adapters
    class Google < Base

      def address
        "#{city(data.data)}, #{country_code(data.data)}"
      end

      def lat
        data.data['geometry']['location']['lat'].to_f
      end

      def lon
        data.data['geometry']['location']['lng'].to_f
      end

      def position
        if data.data['types'].include?('locality') && data.data['types'].include?('political')
          0
        else
          1
        end
      end

      private

      def city data
        data['address_components'].first['short_name']
      end

      def country_code data
        data['address_components'].last['short_name']
      end

    end
  end
end


text:
using PB.Frameworks.Common.General;
namespace PB.Frameworks.Types.Interfaces
{
	public interface IDEUserAction : IDbEntity
	{
		int UserId { get; set; }
		GlobalEnums.UserActionType Type { get; set; }
		string VerificationCode { get; set; }
	}
}


text:
/******************************************
 *                                        *
 *  dcm4che: A OpenSource DICOM Toolkit   *
 *                                        *
 *  Distributable under LGPL license.     *
 *  See terms of license at gnu.org.      *
 *                                        *
 ******************************************/

package org.dcm4chex.archive.ejb.entity;

import java.util.Collection;

import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.FinderException;
import javax.ejb.RemoveException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.apache.log4j.Logger;
import org.dcm4che.data.Dataset;
import org.dcm4che.data.DcmDecodeParam;
import org.dcm4che.data.DcmElement;
import org.dcm4che.dict.Tags;
import org.dcm4chex.archive.common.DatasetUtils;
import org.dcm4chex.archive.common.HPLevel;
import org.dcm4chex.archive.ejb.interfaces.CodeLocal;
import org.dcm4chex.archive.ejb.interfaces.CodeLocalHome;
import org.dcm4chex.archive.ejb.interfaces.HPLocal;
import org.dcm4chex.archive.ejb.interfaces.HPDefinitionLocalHome;

/**
 * @author gunter.zeilinger@tiani.com
 * @version $Revision: 1909 $ $Date: 2005-08-18 01:24:52 +0800 (周四, 18 8月 2005) $
 * @since Aug 2, 2005
 *
 * @ejb.bean name="HP" type="CMP" view-type="local"
 *           local-jndi-name="ejb/HP" primkey-field="pk"
 * @ejb.persistence table-name="hp"
 * @ejb.transaction type="Required"
 * @jboss.entity-command name="hsqldb-fetch-key"
 *
 * @ejb.ejb-ref ejb-name="Code" view-type="local" ref-name="ejb/Code"
 * @ejb.ejb-ref ejb-name="HPDefinition" view-type="local" ref-name="ejb/HPDefinition"
 *
 * @ejb.finder signature="org.dcm4chex.archive.ejb.interfaces.HPLocal findBySopIuid(java.lang.String uid)"
 *             query="SELECT OBJECT(o) FROM HP AS o WHERE o.sopIuid = ?1"
 *             transaction-type="Supports"
 */
public abstract class HPBean implements EntityBean {

    private static final Logger log = Logger.getLogger(HPBean.class);

    private EntityContext ejbctx;
    private CodeLocalHome codeHome;
    private HPDefinitionLocalHome defHome;

    public void setEntityContext(EntityContext ctx) {
        ejbctx = ctx;
        Context jndiCtx = null;
        try {
            jndiCtx = new InitialContext();
            codeHome = (CodeLocalHome)
                    jndiCtx.lookup("java:comp/env/ejb/Code");
			defHome = (HPDefinitionLocalHome)
                    jndiCtx.lookup("java:comp/env/ejb/HPDefinition");
        } catch (NamingException e) {
            throw new EJBException(e);
        } finally {
            if (jndiCtx != null) {
                try {
                    jndiCtx.close();
                } catch (NamingException ignore) {
                }
            }
        }
    }

    public void unsetEntityContext() {
        codeHome = null;
		defHome = null;
        ejbctx = null;
    }

    /**
     * @ejb.create-method
     */
    public Integer ejbCreate(Dataset ds) throws CreateException {
        setAttributes(ds);
        return null;
    }

    public void ejbPostCreate(Dataset ds) throws CreateException {
        DcmElement sq;
        Collection c;
        try {
			setHangingProtocolUserIdCode(CodeBean.valueOf(codeHome, ds
                    .getItem(Tags.HangingProtocolUserIdentificationCodeSeq)));
            createHPDefinition(ds.get(Tags.HangingProtocolDefinitionSeq));
        } catch (CreateException e) {
            throw new CreateException(e.getMessage());
        } catch (FinderException e) {
            throw new CreateException(e.getMessage());
        }
        log.info("Created " + toString());
    }

	private void createHPDefinition(DcmElement sq)
			throws CreateException {
        if (sq == null) return;
        Collection c = getHPDefinition();
		HPLocal hp = (HPLocal) ejbctx.getEJBLocalObject();
        for (int i = 0, n = sq.vm(); i < n; i++) {
            c.add(defHome.create(sq.getItem(i), hp));
        }
	}

	public void ejbRemove() throws RemoveException {
        log.info("Deleting " + toString());
    }

    public String toString() {
        return "HP[pk=" + getPk()
                + ", iuid=" + getSopIuid() + "]";
    }

    /**
     * Auto-generated Primary Key
     *
     * @ejb.interface-method
     * @ejb.pk-field
     * @ejb.persistence column-name="pk"
     * @jboss.persistence auto-increment="true"
     */
    public abstract Integer getPk();

    public abstract void setPk(Integer pk);

    /**
     * @ejb.persistence column-name="hp_iuid"
     * @ejb.interface-method
     */
    public abstract String getSopIuid();

    public abstract void setSopIuid(String iuid);

    /**
     * @ejb.persistence column-name="hp_cuid"
     * @ejb.interface-method
     */
    public abstract String getSopCuid();

    public abstract void setSopCuid(String cuid);

    /**
     * @ejb.persistence column-name="hp_name"
     * @ejb.interface-method
     */
    public abstract String getHangingProtocolName();

    public abstract void setHangingProtocolName(String name);

    /**
     * @ejb.interface-method
     * @ejb.persistence column-name="hp_level"
     */
    public abstract int getHangingProtocolLevelAsInt();
    public abstract void setHangingProtocolLevelAsInt(int level);

	/**
     * @ejb.interface-method
     */
    public String getHangingProtocolLevel() {
		return HPLevel.toString(getHangingProtocolLevelAsInt());
    }

    public void setHangingProtocolLevel(String level) {
		setHangingProtocolLevelAsInt(HPLevel.toInt(level));
    }

    /**
     * @ejb.persistence column-name="num_priors"
     * @ejb.interface-method
     */
    public abstract int getNumberOfPriorsReferenced();

	public abstract void setNumberOfPriorsReferenced(int priors);

    /**
     * @ejb.persistence column-name="hp_group"
     * @ejb.interface-method
     */
    public abstract String getHangingProtocolUserGroupName();

    public abstract void setHangingProtocolUserGroupName(String name);

    /**
     * @ejb.persistence column-name="num_screens"
     * @ejb.interface-method
     */
    public abstract int getNumberOfScreens();

	public abstract void setNumberOfScreens(int screens);

    /**
     * @ejb.persistence column-name="hp_attrs"
     */
    public abstract byte[] getEncodedAttributes();

    public abstract void setEncodedAttributes(byte[] bytes);

	/**
     * @ejb.relation name="hp-useridcode" role-name="hp-for-user"
     *               target-ejb="Code" target-role-name="user-of-hp"
     *               target-multiple="yes"
     * @jboss.relation fk-column="user_fk" related-pk-field="pk"
     */
    public abstract CodeLocal getHangingProtocolUserIdCode();
    public abstract void setHangingProtocolUserIdCode(CodeLocal code);

    /**
     * @ejb.relation name="hp-definition" role-name="hp-with-definition"
     */
    public abstract java.util.Collection getHPDefinition();
    public abstract void setHPDefinition(java.util.Collection definition);

    /**
     * @ejb.interface-method
     */
    public Dataset getAttributes() {
        return DatasetUtils.fromByteArray(
                getEncodedAttributes(), DcmDecodeParam.EVR_LE, null);
    }

    /**
     * @ejb.interface-method
     */
    public void setAttributes(Dataset ds) {
        setSopIuid(ds.getString(Tags.SOPInstanceUID));
		setSopCuid(ds.getString(Tags.SOPClassUID));
		setHangingProtocolName(ds.getString(Tags.HangingProtocolName));
		setHangingProtocolLevel(ds.getString(Tags.HangingProtocolLevel));
		setNumberOfPriorsReferenced(ds.getInt(Tags.NumberOfPriorsReferenced, 0));
		setHangingProtocolUserGroupName(ds.getString(Tags.HangingProtocolUserGroupName));
		setNumberOfScreens(ds.getInt(Tags.NumberOfScreens, 0));
        setEncodedAttributes(
                DatasetUtils.toByteArray(ds, DcmDecodeParam.EVR_LE));
    }

}


text:
namespace openmc {

//! \brief samples particle behavior after a collision event.
//! \param p Particle to operate on
void collision_mg(Particle& p);

//! \brief samples a reaction type.
//!
//! Note that there is special logic when suvival biasing is turned on since
//! fission and disappearance are treated implicitly.
//! \param p Particle to operate on
void sample_reaction(Particle& p);

//! \brief Samples the scattering event
//! \param p Particle to operate on
void scatter(Particle& p);

//! \brief Determines the average total, prompt and delayed neutrons produced
//! from fission and creates the appropriate bank sites.
//! \param p Particle to operate on
void create_fission_sites(Particle& p);

//! \brief Handles an absorption event
//! \param p Particle to operate on
void absorption(Particle& p);

} // namespace openmc
#endif // OPENMC_PHYSICS_MG_H