bitvect.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. #ifndef YASM_BITVECT_H
  2. #define YASM_BITVECT_H
  3. /*****************************************************************************/
  4. /* MODULE NAME: BitVector.h MODULE TYPE: (adt) */
  5. /*****************************************************************************/
  6. /* MODULE IMPORTS: */
  7. /*****************************************************************************/
  8. /* ToolBox.h */
  9. /*****************************************************************************/
  10. /* NOTE: The type names that have been chosen here are somewhat weird on */
  11. /* purpose, in order to avoid name clashes with system header files */
  12. /* and your own application(s) which might - directly or indirectly - */
  13. /* include this definitions file. */
  14. /*****************************************************************************/
  15. #ifndef YASM_LIB_DECL
  16. #define YASM_LIB_DECL
  17. #endif
  18. typedef unsigned char N_char;
  19. typedef unsigned char N_byte;
  20. typedef unsigned short N_short;
  21. typedef unsigned short N_shortword;
  22. typedef unsigned int N_int;
  23. typedef unsigned int N_word;
  24. typedef unsigned long N_long;
  25. typedef unsigned long N_longword;
  26. /* Mnemonic 1: The natural numbers, N = { 0, 1, 2, 3, ... } */
  27. /* Mnemonic 2: Nnnn = u_N_signed, _N_ot signed */
  28. typedef signed char Z_char;
  29. typedef signed char Z_byte;
  30. typedef signed short Z_short;
  31. typedef signed short Z_shortword;
  32. typedef signed int Z_int;
  33. typedef signed int Z_word;
  34. typedef signed long Z_long;
  35. typedef signed long Z_longword;
  36. /* Mnemonic 1: The whole numbers, Z = { 0, -1, 1, -2, 2, -3, 3, ... } */
  37. /* Mnemonic 2: Zzzz = Ssss_igned */
  38. typedef void *voidptr;
  39. typedef N_char *charptr;
  40. typedef N_byte *byteptr;
  41. typedef N_short *shortptr;
  42. typedef N_shortword *shortwordptr;
  43. typedef N_int *intptr;
  44. typedef N_word *wordptr;
  45. typedef N_long *longptr;
  46. typedef N_longword *longwordptr;
  47. typedef N_char *N_charptr;
  48. typedef N_byte *N_byteptr;
  49. typedef N_short *N_shortptr;
  50. typedef N_shortword *N_shortwordptr;
  51. typedef N_int *N_intptr;
  52. typedef N_word *N_wordptr;
  53. typedef N_long *N_longptr;
  54. typedef N_longword *N_longwordptr;
  55. typedef Z_char *Z_charptr;
  56. typedef Z_byte *Z_byteptr;
  57. typedef Z_short *Z_shortptr;
  58. typedef Z_shortword *Z_shortwordptr;
  59. typedef Z_int *Z_intptr;
  60. typedef Z_word *Z_wordptr;
  61. typedef Z_long *Z_longptr;
  62. typedef Z_longword *Z_longwordptr;
  63. #ifndef FALSE
  64. #define FALSE (0!=0)
  65. #endif
  66. #ifndef TRUE
  67. #define TRUE (0==0)
  68. #endif
  69. #ifdef __cplusplus
  70. typedef bool boolean;
  71. #else
  72. #ifdef MACOS_TRADITIONAL
  73. #define boolean Boolean
  74. #else
  75. typedef enum boolean { false = FALSE, true = TRUE } boolean;
  76. #endif
  77. #endif
  78. /*****************************************************************************/
  79. /* MODULE INTERFACE: */
  80. /*****************************************************************************/
  81. typedef enum ErrCode
  82. {
  83. ErrCode_Ok = 0, /* everything went allright */
  84. ErrCode_Type, /* types word and size_t have incompatible sizes */
  85. ErrCode_Bits, /* bits of word and sizeof(word) are inconsistent */
  86. ErrCode_Word, /* size of word is less than 16 bits */
  87. ErrCode_Long, /* size of word is greater than size of long */
  88. ErrCode_Powr, /* number of bits of word is not a power of two */
  89. ErrCode_Loga, /* error in calculation of logarithm */
  90. ErrCode_Null, /* unable to allocate memory */
  91. ErrCode_Indx, /* index out of range */
  92. ErrCode_Ordr, /* minimum > maximum index */
  93. ErrCode_Size, /* bit vector size mismatch */
  94. ErrCode_Pars, /* input string syntax error */
  95. ErrCode_Ovfl, /* numeric overflow error */
  96. ErrCode_Same, /* operands must be distinct */
  97. ErrCode_Expo, /* exponent must be positive */
  98. ErrCode_Zero /* division by zero error */
  99. } ErrCode;
  100. typedef wordptr *listptr;
  101. /* ===> MISCELLANEOUS BASIC FUNCTIONS: <=== */
  102. YASM_LIB_DECL
  103. const char * BitVector_Error (ErrCode error); /* return string for err code */
  104. YASM_LIB_DECL
  105. ErrCode BitVector_Boot (void); /* 0 = ok, 1..7 = error */
  106. YASM_LIB_DECL
  107. void BitVector_Shutdown (void); /* undo Boot */
  108. YASM_LIB_DECL
  109. N_word BitVector_Size (N_int bits); /* bit vector size (# of words) */
  110. YASM_LIB_DECL
  111. N_word BitVector_Mask (N_int bits); /* bit vector mask (unused bits) */
  112. /* ===> CLASS METHODS: <=== */
  113. YASM_LIB_DECL
  114. const char * BitVector_Version (void); /* returns version string */
  115. YASM_LIB_DECL
  116. N_int BitVector_Word_Bits (void); /* return # of bits in machine word */
  117. YASM_LIB_DECL
  118. N_int BitVector_Long_Bits (void); /* return # of bits in unsigned long */
  119. /* ===> CONSTRUCTOR METHODS: <=== */
  120. YASM_LIB_DECL
  121. /*@only@*/ wordptr BitVector_Create (N_int bits, boolean clear); /* malloc */
  122. YASM_LIB_DECL
  123. listptr BitVector_Create_List(N_int bits, boolean clear, N_int count);
  124. YASM_LIB_DECL
  125. wordptr BitVector_Resize (wordptr oldaddr, N_int bits); /* realloc */
  126. YASM_LIB_DECL
  127. wordptr BitVector_Shadow (wordptr addr); /* make new same size but empty */
  128. YASM_LIB_DECL
  129. wordptr BitVector_Clone (wordptr addr); /* make exact duplicate */
  130. YASM_LIB_DECL
  131. wordptr BitVector_Concat (wordptr X, wordptr Y); /* return concatenation */
  132. /* ===> DESTRUCTOR METHODS: <=== */
  133. YASM_LIB_DECL
  134. void BitVector_Dispose (/*@only@*/ /*@out@*/ charptr string); /* string */
  135. YASM_LIB_DECL
  136. void BitVector_Destroy (/*@only@*/ wordptr addr); /* bitvec */
  137. YASM_LIB_DECL
  138. void BitVector_Destroy_List (listptr list, N_int count); /* list */
  139. /* ===> OBJECT METHODS: <=== */
  140. /* ===> bit vector copy function: */
  141. YASM_LIB_DECL
  142. void BitVector_Copy (wordptr X, wordptr Y); /* X = Y */
  143. /* ===> bit vector initialization: */
  144. YASM_LIB_DECL
  145. void BitVector_Empty (wordptr addr); /* X = {} */
  146. YASM_LIB_DECL
  147. void BitVector_Fill (wordptr addr); /* X = ~{} */
  148. YASM_LIB_DECL
  149. void BitVector_Flip (wordptr addr); /* X = ~X */
  150. YASM_LIB_DECL
  151. void BitVector_Primes (wordptr addr);
  152. /* ===> miscellaneous functions: */
  153. YASM_LIB_DECL
  154. void BitVector_Reverse (wordptr X, wordptr Y);
  155. /* ===> bit vector interval operations and functions: */
  156. YASM_LIB_DECL
  157. void BitVector_Interval_Empty (/*@out@*/ wordptr addr, N_int lower, N_int upper);
  158. YASM_LIB_DECL
  159. void BitVector_Interval_Fill (/*@out@*/ wordptr addr, N_int lower, N_int upper);
  160. YASM_LIB_DECL
  161. void BitVector_Interval_Flip (/*@out@*/ wordptr addr, N_int lower, N_int upper);
  162. YASM_LIB_DECL
  163. void BitVector_Interval_Reverse (/*@out@*/ wordptr addr, N_int lower, N_int upper);
  164. YASM_LIB_DECL
  165. boolean BitVector_interval_scan_inc (wordptr addr, N_int start,
  166. N_intptr min, N_intptr max);
  167. YASM_LIB_DECL
  168. boolean BitVector_interval_scan_dec (wordptr addr, N_int start,
  169. N_intptr min, N_intptr max);
  170. YASM_LIB_DECL
  171. void BitVector_Interval_Copy (/*@out@*/ wordptr X, wordptr Y, N_int Xoffset,
  172. N_int Yoffset, N_int length);
  173. YASM_LIB_DECL
  174. wordptr BitVector_Interval_Substitute(/*@out@*/ wordptr X, wordptr Y,
  175. N_int Xoffset, N_int Xlength,
  176. N_int Yoffset, N_int Ylength);
  177. /* ===> bit vector test functions: */
  178. YASM_LIB_DECL
  179. boolean BitVector_is_empty (wordptr addr); /* X == {} ? */
  180. YASM_LIB_DECL
  181. boolean BitVector_is_full (wordptr addr); /* X == ~{} ? */
  182. YASM_LIB_DECL
  183. boolean BitVector_equal (wordptr X, wordptr Y); /* X == Y ? */
  184. YASM_LIB_DECL
  185. Z_int BitVector_Lexicompare(wordptr X, wordptr Y); /* X <,=,> Y ? */
  186. YASM_LIB_DECL
  187. Z_int BitVector_Compare (wordptr X, wordptr Y); /* X <,=,> Y ? */
  188. /* ===> bit vector string conversion functions: */
  189. YASM_LIB_DECL
  190. /*@only@*/ charptr BitVector_to_Hex (wordptr addr);
  191. YASM_LIB_DECL
  192. ErrCode BitVector_from_Hex (/*@out@*/wordptr addr, charptr string);
  193. YASM_LIB_DECL
  194. ErrCode BitVector_from_Oct(/*@out@*/ wordptr addr, charptr string);
  195. YASM_LIB_DECL
  196. /*@only@*/ charptr BitVector_to_Bin (wordptr addr);
  197. YASM_LIB_DECL
  198. ErrCode BitVector_from_Bin (/*@out@*/ wordptr addr, charptr string);
  199. YASM_LIB_DECL
  200. /*@only@*/ charptr BitVector_to_Dec (wordptr addr);
  201. YASM_LIB_DECL
  202. ErrCode BitVector_from_Dec (/*@out@*/ wordptr addr, charptr string);
  203. typedef struct BitVector_from_Dec_static_data BitVector_from_Dec_static_data;
  204. YASM_LIB_DECL
  205. BitVector_from_Dec_static_data *BitVector_from_Dec_static_Boot(N_word bits);
  206. YASM_LIB_DECL
  207. void BitVector_from_Dec_static_Shutdown(/*@null@*/ BitVector_from_Dec_static_data *data);
  208. YASM_LIB_DECL
  209. ErrCode BitVector_from_Dec_static(BitVector_from_Dec_static_data *data,
  210. /*@out@*/ wordptr addr, charptr string);
  211. YASM_LIB_DECL
  212. /*@only@*/ charptr BitVector_to_Enum (wordptr addr);
  213. YASM_LIB_DECL
  214. ErrCode BitVector_from_Enum (/*@out@*/ wordptr addr, charptr string);
  215. /* ===> bit vector bit operations, functions & tests: */
  216. YASM_LIB_DECL
  217. void BitVector_Bit_Off (/*@out@*/ wordptr addr, N_int indx); /* X = X \ {x} */
  218. YASM_LIB_DECL
  219. void BitVector_Bit_On (/*@out@*/ wordptr addr, N_int indx); /* X = X + {x} */
  220. YASM_LIB_DECL
  221. boolean BitVector_bit_flip (/*@out@*/ wordptr addr, N_int indx); /* (X+{x})\(X*{x}) */
  222. YASM_LIB_DECL
  223. boolean BitVector_bit_test (wordptr addr, N_int indx); /* {x} in X ? */
  224. YASM_LIB_DECL
  225. void BitVector_Bit_Copy (/*@out@*/ wordptr addr, N_int indx, boolean bit);
  226. /* ===> bit vector bit shift & rotate functions: */
  227. YASM_LIB_DECL
  228. void BitVector_LSB (/*@out@*/ wordptr addr, boolean bit);
  229. YASM_LIB_DECL
  230. void BitVector_MSB (/*@out@*/ wordptr addr, boolean bit);
  231. YASM_LIB_DECL
  232. boolean BitVector_lsb_ (wordptr addr);
  233. YASM_LIB_DECL
  234. boolean BitVector_msb_ (wordptr addr);
  235. YASM_LIB_DECL
  236. boolean /*@alt void@*/ BitVector_rotate_left (wordptr addr);
  237. YASM_LIB_DECL
  238. boolean /*@alt void@*/ BitVector_rotate_right (wordptr addr);
  239. YASM_LIB_DECL
  240. boolean /*@alt void@*/ BitVector_shift_left (wordptr addr, boolean carry_in);
  241. YASM_LIB_DECL
  242. boolean /*@alt void@*/ BitVector_shift_right (wordptr addr, boolean carry_in);
  243. YASM_LIB_DECL
  244. void BitVector_Move_Left (wordptr addr, N_int bits);
  245. YASM_LIB_DECL
  246. void BitVector_Move_Right (wordptr addr, N_int bits);
  247. /* ===> bit vector insert/delete bits: */
  248. YASM_LIB_DECL
  249. void BitVector_Insert (wordptr addr, N_int offset, N_int count,
  250. boolean clear);
  251. YASM_LIB_DECL
  252. void BitVector_Delete (wordptr addr, N_int offset, N_int count,
  253. boolean clear);
  254. /* ===> bit vector arithmetic: */
  255. YASM_LIB_DECL
  256. boolean /*@alt void@*/ BitVector_increment (wordptr addr); /* X++ */
  257. YASM_LIB_DECL
  258. boolean /*@alt void@*/ BitVector_decrement (wordptr addr); /* X-- */
  259. YASM_LIB_DECL
  260. boolean /*@alt void@*/ BitVector_compute (wordptr X, wordptr Y, wordptr Z, boolean minus,
  261. boolean *carry);
  262. YASM_LIB_DECL
  263. boolean /*@alt void@*/ BitVector_add (wordptr X, wordptr Y, wordptr Z, boolean *carry);
  264. YASM_LIB_DECL
  265. boolean /*@alt void@*/ BitVector_sub (wordptr X, wordptr Y, wordptr Z, boolean *carry);
  266. YASM_LIB_DECL
  267. boolean /*@alt void@*/ BitVector_inc (wordptr X, wordptr Y);
  268. YASM_LIB_DECL
  269. boolean /*@alt void@*/ BitVector_dec (wordptr X, wordptr Y);
  270. YASM_LIB_DECL
  271. void BitVector_Negate (wordptr X, wordptr Y);
  272. YASM_LIB_DECL
  273. void BitVector_Absolute (wordptr X, wordptr Y);
  274. YASM_LIB_DECL
  275. Z_int BitVector_Sign (wordptr addr);
  276. YASM_LIB_DECL
  277. ErrCode BitVector_Mul_Pos (wordptr X, wordptr Y, wordptr Z, boolean strict);
  278. YASM_LIB_DECL
  279. ErrCode BitVector_Multiply (wordptr X, wordptr Y, wordptr Z);
  280. YASM_LIB_DECL
  281. ErrCode BitVector_Div_Pos (wordptr Q, wordptr X, wordptr Y, wordptr R);
  282. YASM_LIB_DECL
  283. ErrCode BitVector_Divide (wordptr Q, wordptr X, wordptr Y, wordptr R);
  284. YASM_LIB_DECL
  285. ErrCode BitVector_GCD (wordptr X, wordptr Y, wordptr Z);
  286. YASM_LIB_DECL
  287. ErrCode BitVector_GCD2 (wordptr U, wordptr V, wordptr W, /* O */
  288. wordptr X, wordptr Y); /* I */
  289. YASM_LIB_DECL
  290. ErrCode BitVector_Power (wordptr X, wordptr Y, wordptr Z);
  291. /* ===> direct memory access functions: */
  292. YASM_LIB_DECL
  293. void BitVector_Block_Store(wordptr addr, charptr buffer, N_int length);
  294. YASM_LIB_DECL
  295. charptr BitVector_Block_Read (wordptr addr, /*@out@*/ N_intptr length);
  296. /* ===> word array functions: */
  297. YASM_LIB_DECL
  298. void BitVector_Word_Store (wordptr addr, N_int offset, N_int value);
  299. YASM_LIB_DECL
  300. N_int BitVector_Word_Read (wordptr addr, N_int offset);
  301. YASM_LIB_DECL
  302. void BitVector_Word_Insert(wordptr addr, N_int offset, N_int count,
  303. boolean clear);
  304. YASM_LIB_DECL
  305. void BitVector_Word_Delete(wordptr addr, N_int offset, N_int count,
  306. boolean clear);
  307. /* ===> arbitrary size chunk functions: */
  308. YASM_LIB_DECL
  309. void BitVector_Chunk_Store(wordptr addr, N_int chunksize,
  310. N_int offset, N_long value);
  311. YASM_LIB_DECL
  312. N_long BitVector_Chunk_Read (wordptr addr, N_int chunksize,
  313. N_int offset);
  314. /* ===> set operations: */
  315. YASM_LIB_DECL
  316. void Set_Union (wordptr X, wordptr Y, wordptr Z); /* X = Y + Z */
  317. YASM_LIB_DECL
  318. void Set_Intersection (wordptr X, wordptr Y, wordptr Z); /* X = Y * Z */
  319. YASM_LIB_DECL
  320. void Set_Difference (wordptr X, wordptr Y, wordptr Z); /* X = Y \ Z */
  321. YASM_LIB_DECL
  322. void Set_ExclusiveOr (wordptr X, wordptr Y, wordptr Z); /*(Y+Z)\(Y*Z)*/
  323. YASM_LIB_DECL
  324. void Set_Complement (wordptr X, wordptr Y); /* X = ~Y */
  325. /* ===> set functions: */
  326. YASM_LIB_DECL
  327. boolean Set_subset (wordptr X, wordptr Y); /* X in Y ? */
  328. YASM_LIB_DECL
  329. N_int Set_Norm (wordptr addr); /* = | X | */
  330. YASM_LIB_DECL
  331. N_int Set_Norm2 (wordptr addr); /* = | X | */
  332. YASM_LIB_DECL
  333. N_int Set_Norm3 (wordptr addr); /* = | X | */
  334. YASM_LIB_DECL
  335. Z_long Set_Min (wordptr addr); /* = min(X) */
  336. YASM_LIB_DECL
  337. Z_long Set_Max (wordptr addr); /* = max(X) */
  338. /* ===> matrix-of-booleans operations: */
  339. YASM_LIB_DECL
  340. void Matrix_Multiplication(wordptr X, N_int rowsX, N_int colsX,
  341. wordptr Y, N_int rowsY, N_int colsY,
  342. wordptr Z, N_int rowsZ, N_int colsZ);
  343. YASM_LIB_DECL
  344. void Matrix_Product (wordptr X, N_int rowsX, N_int colsX,
  345. wordptr Y, N_int rowsY, N_int colsY,
  346. wordptr Z, N_int rowsZ, N_int colsZ);
  347. YASM_LIB_DECL
  348. void Matrix_Closure (wordptr addr, N_int rows, N_int cols);
  349. YASM_LIB_DECL
  350. void Matrix_Transpose (wordptr X, N_int rowsX, N_int colsX,
  351. wordptr Y, N_int rowsY, N_int colsY);
  352. /*****************************************************************************/
  353. /* VERSION: 6.4 */
  354. /*****************************************************************************/
  355. /* VERSION HISTORY: */
  356. /*****************************************************************************/
  357. /* */
  358. /* Version 6.4 03.10.04 Added C++ comp. directives. Improved "Norm()". */
  359. /* Version 6.3 28.09.02 Added "Create_List()" and "GCD2()". */
  360. /* Version 6.2 15.09.02 Overhauled error handling. Fixed "GCD()". */
  361. /* Version 6.1 08.10.01 Make VMS linker happy: _lsb,_msb => _lsb_,_msb_ */
  362. /* Version 6.0 08.10.00 Corrected overflow handling. */
  363. /* Version 5.8 14.07.00 Added "Power()". Changed "Copy()". */
  364. /* Version 5.7 19.05.99 Quickened "Div_Pos()". Added "Product()". */
  365. /* Version 5.6 02.11.98 Leading zeros eliminated in "to_Hex()". */
  366. /* Version 5.5 21.09.98 Fixed bug of uninitialized "error" in Multiply. */
  367. /* Version 5.4 07.09.98 Fixed bug of uninitialized "error" in Divide. */
  368. /* Version 5.3 12.05.98 Improved Norm. Completed history. */
  369. /* Version 5.2 31.03.98 Improved Norm. */
  370. /* Version 5.1 09.03.98 No changes. */
  371. /* Version 5.0 01.03.98 Major additions and rewrite. */
  372. /* Version 4.2 16.07.97 Added is_empty, is_full. */
  373. /* Version 4.1 30.06.97 Added word-ins/del, move-left/right, inc/dec. */
  374. /* Version 4.0 23.04.97 Rewrite. Added bit shift and bool. matrix ops. */
  375. /* Version 3.2 04.02.97 Added interval methods. */
  376. /* Version 3.1 21.01.97 Fixed bug on 64 bit machines. */
  377. /* Version 3.0 12.01.97 Added flip. */
  378. /* Version 2.0 14.12.96 Efficiency and consistency improvements. */
  379. /* Version 1.1 08.01.96 Added Resize and ExclusiveOr. */
  380. /* Version 1.0 14.12.95 First version under UNIX (with Perl module). */
  381. /* Version 0.9 01.11.93 First version of C library under MS-DOS. */
  382. /* Version 0.1 ??.??.89 First version in Turbo Pascal under CP/M. */
  383. /* */
  384. /*****************************************************************************/
  385. /* AUTHOR: */
  386. /*****************************************************************************/
  387. /* */
  388. /* Steffen Beyer */
  389. /* mailto:sb@engelschall.com */
  390. /* http://www.engelschall.com/u/sb/download/ */
  391. /* */
  392. /*****************************************************************************/
  393. /* COPYRIGHT: */
  394. /*****************************************************************************/
  395. /* */
  396. /* Copyright (c) 1995 - 2004 by Steffen Beyer. */
  397. /* All rights reserved. */
  398. /* */
  399. /*****************************************************************************/
  400. /* LICENSE: */
  401. /*****************************************************************************/
  402. /* This package is free software; you can use, modify and redistribute */
  403. /* it under the same terms as Perl itself, i.e., under the terms of */
  404. /* the "Artistic License" or the "GNU General Public License". */
  405. /* */
  406. /* The C library at the core of this Perl module can additionally */
  407. /* be used, modified and redistributed under the terms of the */
  408. /* "GNU Library General Public License". */
  409. /* */
  410. /*****************************************************************************/
  411. /* ARTISTIC LICENSE: */
  412. /*****************************************************************************/
  413. /*
  414. The "Artistic License"
  415. Preamble
  416. The intent of this document is to state the conditions under which a
  417. Package may be copied, such that the Copyright Holder maintains some
  418. semblance of artistic control over the development of the package,
  419. while giving the users of the package the right to use and distribute
  420. the Package in a more-or-less customary fashion, plus the right to make
  421. reasonable modifications.
  422. Definitions:
  423. "Package" refers to the collection of files distributed by the
  424. Copyright Holder, and derivatives of that collection of files
  425. created through textual modification.
  426. "Standard Version" refers to such a Package if it has not been
  427. modified, or has been modified in accordance with the wishes
  428. of the Copyright Holder as specified below.
  429. "Copyright Holder" is whoever is named in the copyright or
  430. copyrights for the package.
  431. "You" is you, if you're thinking about copying or distributing
  432. this Package.
  433. "Reasonable copying fee" is whatever you can justify on the
  434. basis of media cost, duplication charges, time of people involved,
  435. and so on. (You will not be required to justify it to the
  436. Copyright Holder, but only to the computing community at large
  437. as a market that must bear the fee.)
  438. "Freely Available" means that no fee is charged for the item
  439. itself, though there may be fees involved in handling the item.
  440. It also means that recipients of the item may redistribute it
  441. under the same conditions they received it.
  442. 1. You may make and give away verbatim copies of the source form of the
  443. Standard Version of this Package without restriction, provided that you
  444. duplicate all of the original copyright notices and associated disclaimers.
  445. 2. You may apply bug fixes, portability fixes and other modifications
  446. derived from the Public Domain or from the Copyright Holder. A Package
  447. modified in such a way shall still be considered the Standard Version.
  448. 3. You may otherwise modify your copy of this Package in any way, provided
  449. that you insert a prominent notice in each changed file stating how and
  450. when you changed that file, and provided that you do at least ONE of the
  451. following:
  452. a) place your modifications in the Public Domain or otherwise make them
  453. Freely Available, such as by posting said modifications to Usenet or
  454. an equivalent medium, or placing the modifications on a major archive
  455. site such as uunet.uu.net, or by allowing the Copyright Holder to include
  456. your modifications in the Standard Version of the Package.
  457. b) use the modified Package only within your corporation or organization.
  458. c) rename any non-standard executables so the names do not conflict
  459. with standard executables, which must also be provided, and provide
  460. a separate manual page for each non-standard executable that clearly
  461. documents how it differs from the Standard Version.
  462. d) make other distribution arrangements with the Copyright Holder.
  463. 4. You may distribute the programs of this Package in object code or
  464. executable form, provided that you do at least ONE of the following:
  465. a) distribute a Standard Version of the executables and library files,
  466. together with instructions (in the manual page or equivalent) on where
  467. to get the Standard Version.
  468. b) accompany the distribution with the machine-readable source of
  469. the Package with your modifications.
  470. c) give non-standard executables non-standard names, and clearly
  471. document the differences in manual pages (or equivalent), together
  472. with instructions on where to get the Standard Version.
  473. d) make other distribution arrangements with the Copyright Holder.
  474. 5. You may charge a reasonable copying fee for any distribution of this
  475. Package. You may charge any fee you choose for support of this
  476. Package. You may not charge a fee for this Package itself. However,
  477. you may distribute this Package in aggregate with other (possibly
  478. commercial) programs as part of a larger (possibly commercial) software
  479. distribution provided that you do not advertise this Package as a
  480. product of your own. You may embed this Package's interpreter within
  481. an executable of yours (by linking); this shall be construed as a mere
  482. form of aggregation, provided that the complete Standard Version of the
  483. interpreter is so embedded.
  484. 6. The scripts and library files supplied as input to or produced as
  485. output from the programs of this Package do not automatically fall
  486. under the copyright of this Package, but belong to whoever generated
  487. them, and may be sold commercially, and may be aggregated with this
  488. Package. If such scripts or library files are aggregated with this
  489. Package via the so-called "undump" or "unexec" methods of producing a
  490. binary executable image, then distribution of such an image shall
  491. neither be construed as a distribution of this Package nor shall it
  492. fall under the restrictions of Paragraphs 3 and 4, provided that you do
  493. not represent such an executable image as a Standard Version of this
  494. Package.
  495. 7. C subroutines (or comparably compiled subroutines in other
  496. languages) supplied by you and linked into this Package in order to
  497. emulate subroutines and variables of the language defined by this
  498. Package shall not be considered part of this Package, but are the
  499. equivalent of input as in Paragraph 6, provided these subroutines do
  500. not change the language in any way that would cause it to fail the
  501. regression tests for the language.
  502. 8. Aggregation of this Package with a commercial distribution is always
  503. permitted provided that the use of this Package is embedded; that is,
  504. when no overt attempt is made to make this Package's interfaces visible
  505. to the end user of the commercial distribution. Such use shall not be
  506. construed as a distribution of this Package.
  507. 9. The name of the Copyright Holder may not be used to endorse or promote
  508. products derived from this software without specific prior written permission.
  509. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  510. IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  511. WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  512. The End
  513. */
  514. /*****************************************************************************/
  515. /* GNU GENERAL PUBLIC LICENSE: */
  516. /*****************************************************************************/
  517. /* This program is free software; you can redistribute it and/or */
  518. /* modify it under the terms of the GNU General Public License */
  519. /* as published by the Free Software Foundation; either version 2 */
  520. /* of the License, or (at your option) any later version. */
  521. /* */
  522. /* This program is distributed in the hope that it will be useful, */
  523. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  524. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  525. /* GNU General Public License for more details. */
  526. /* */
  527. /* You should have received a copy of the GNU General Public License */
  528. /* along with this program; if not, write to the */
  529. /* Free Software Foundation, Inc., */
  530. /* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  531. /* */
  532. /*****************************************************************************/
  533. /* GNU LIBRARY GENERAL PUBLIC LICENSE: */
  534. /*****************************************************************************/
  535. /* */
  536. /* This library is free software; you can redistribute it and/or */
  537. /* modify it under the terms of the GNU Library General Public */
  538. /* License as published by the Free Software Foundation; either */
  539. /* version 2 of the License, or (at your option) any later version. */
  540. /* */
  541. /* This library is distributed in the hope that it will be useful, */
  542. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  543. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
  544. /* Library General Public License for more details. */
  545. /* */
  546. /* You should have received a copy of the GNU Library General Public */
  547. /* License along with this library; if not, write to the */
  548. /* Free Software Foundation, Inc., */
  549. /* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  550. /* */
  551. /* or download a copy from ftp://ftp.gnu.org/pub/gnu/COPYING.LIB-2.0 */
  552. /* */
  553. /*****************************************************************************/
  554. #endif