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