home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34src.zip / me3 / util / util.h < prev    next >
C/C++ Source or Header  |  1995-01-14  |  2KB  |  59 lines

  1. /* util.h: header file for utilities and stuff that uses utilities
  2.  * C Durland    Public Domain
  3.  */
  4.  
  5. #ifndef __UTIL_H_INCLUDED
  6. #define __UTIL_H_INCLUDED
  7.  
  8. #define CAD    /* Craig's stuff is available */
  9.  
  10. /* ***************************************************************** */
  11. /* ************** files and file io ******************************** */
  12. /* ***************************************************************** */
  13.  
  14. #define STDIN 0
  15. #define STDOUT 1
  16. #define STDERR 2
  17.  
  18. /* ***************************************************************** */
  19. /* ************** spew stuff *************************************** */
  20. /* ***************************************************************** */
  21.  
  22. #define crlf() write(STDOUT,"\r\n",2)
  23. #define fspews(string,filedes) write(filedes,string,strlen(string)) /* fputs*/
  24. #define spew(string) fspews(string,STDOUT) /* puts with no added \n */
  25. #define spewj(string,width,left_just) fspewj(STDOUT,string,width,left_just)
  26.  
  27. #ifdef USESPEW
  28. #define printf spewf
  29. #define putchar spewc
  30. #define puts spews
  31. #endif
  32.  
  33. /* ***************************************************************** */
  34. /* ************** time and date ************************************ */
  35. /* ***************************************************************** */
  36.  
  37. typedef struct
  38. {
  39.   int month, day, weekday, year;  /* year is 4 digits. year%100 for last 2 */
  40.   int hh, mm, ss;
  41. } TIMEDATE;
  42.  
  43. /* ***************************************************************** */
  44. /* ************** misc handi stuff ********************************* */
  45. /* ***************************************************************** */
  46.  
  47. #define cm_to_i(cm) ((cm)/2.54)
  48. #define i_to_cm(inches) ((inches)*2.54)
  49.  
  50. #ifndef PI
  51. #define PI 3.14159265
  52. #endif
  53.  
  54.     /* convert degrees to radians and vice versa */
  55. #define d_to_r(angle) ((angle)*PI/180.0)
  56. #define r_to_d(angle) ((angle)*180.0/PI)
  57.  
  58. #endif    /* __UTIL_H_INCLUDED */
  59.