Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

How to write a simple but effective TCP/IP port scanner for Win32

, 27 Oct 2001
An article on how to write a TCP/IP port scanner with a GUI, based on the MFC's property sheet paradigm
/*
	macro.h
	Macro di utilizzo generico.
	Luca Piergentili, 27/07/93
	lpiergentili@yahoo.com
	http://www.geocities.com/lpiergentili/
*/
#ifndef _MACRO_H
#define _MACRO_H 1

#define nop

/*
	sizeofmacro()
	dimensione della macro
*/
#define sizeofmacro(m) (sizeof(m)-1)

/*
	ARRAY_SIZE
	dimensione dell'array
*/
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))

/*
	IIF()
	test in linea
*/
#define IIF(x,y,z) ((x)?(y):(z))

/*
	DIV()
	evita la divisione per zero
*/
#define DIV(x,y) (((y)==0) ? ((x)/1) : ((x)/(y)))
#define FDIV(x,y) (((y)==0.0) ? ((x)/1) : ((x)/(y)))

/*
	STR()
	converte in stringa il valore numerico
	il primo passaggio espande il valore numerico (sostituisce il nome di macro con il numero),
	mentre il secondo trasforma in stringa il valore (ad es. STR(666) viene espanso in "666")
*/
#define STR(x) VAL(x)
#define VAL(x) #x

/*
	CAST()
	permette il cast sulle macro se non si puo' accedere direttamente al valore della costante
	(ad es. se BYTEMASK vale 0xff, espande CAST(BYTEMASK,L) in 0xffL).
*/
#define EXPAND(x)	x
#define PASTE(x,y)	(x##y)
#define CAST(x,y)	PASTE(EXPAND(x),y)

/*
	PRAGMA_MESSAGE()
	indenta i messaggi inviati con la direttiva #pragma
*/
#ifdef _DEBUG
  #define PRAGMAMESSAGE(s) "   "s
  #define PRAGMA_MESSAGE(s) message(PRAGMAMESSAGE(s))
#else
  #define PRAGMAMESSAGE(s)
  #define PRAGMA_MESSAGE(s)
#endif

#endif /* _MACRO_H */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Luca Piergentili
Web Developer
Italy Italy
I like C and C++, Acid Jazz, James Brown, gli Spaghetti Aglio e Olio, alla Bolognesa, alla Puttanesca e le Fettuccine alla Matriciana ('Maccaroni' over the world). Of course I like beautiful big tits girls too, my little car, Frank Zappa, the art of Zen, italian coffee and much more...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411028.1 | Last Updated 28 Oct 2001
Article Copyright 2001 by Luca Piergentili
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid