home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / var / part02 < prev    next >
Encoding:
Text File  |  1992-08-21  |  20.4 KB  |  668 lines

  1. Newsgroups: comp.sources.misc
  2. From: tlhouns@srv.pacbell.com (Lee Hounshell)
  3. Subject:  v31i092:  var - a C++ string class library, Part02/02
  4. Message-ID: <1992Aug21.155040.28983@sparky.imd.sterling.com>
  5. X-Md4-Signature: 4bbd0505512aaef7d77793d0c8f8be7d
  6. Date: Fri, 21 Aug 1992 15:50:40 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: tlhouns@srv.pacbell.com (Lee Hounshell)
  10. Posting-number: Volume 31, Issue 92
  11. Archive-name: var/part02
  12. Environment: C++
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  19. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  20. # Contents:  Makefile Misc.C Misc.H demo.C var.H
  21. # Wrapped by kent@sparky on Fri Aug 21 10:47:45 1992
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. echo If this archive is complete, you will see the following message:
  24. echo '          "shar: End of archive 2 (of 2)."'
  25. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'Makefile'\"
  27. else
  28.   echo shar: Extracting \"'Makefile'\" \(1102 characters\)
  29.   sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  30. X############################################################################
  31. X#       make - compiles the C++ library (libvar.a) 
  32. X#       make clean - removes all .o files generated in these procedures
  33. X#       make clobber - removes all libraries, cleans up .o's
  34. X############################################################################
  35. X
  36. X
  37. X# from the two below, pick the operating system closest to yours:
  38. XINCDIRS = -I.
  39. X
  40. XSYS    = SUN
  41. XCC    = CC
  42. XCFLAGS    = -O $(INCDIRS)
  43. XARFLAGS    = rv
  44. X
  45. X
  46. Xis_bsd    = test $(SYS) = SUN
  47. X
  48. Xall:    libvar.a
  49. X
  50. XC++FILES = var.C Misc.C
  51. XINS_HFILES = var.H Misc.H
  52. XHFILES   =    $(INS_HFILES)
  53. X
  54. XOBJECTS = ${C++FILES:.C=.o}
  55. X
  56. Xlibvar.a:    $(OBJECTS)
  57. X        ar $(ARFLAGS) $@ $?
  58. X        if $(is_bsd) ; then ranlib $@; fi
  59. X
  60. X$(OBJECTS):    $(HFILES)
  61. X    
  62. X
  63. Xclean:    
  64. X        rm -f *.o a.out core $(OBJECTS)
  65. X        cd demo; $(MAKE) clean
  66. X
  67. Xclobber:    clean
  68. X        rm -fr $(DOTAS)
  69. X        cd demo; $(MAKE) clobber
  70. X
  71. X#####
  72. X#####
  73. X#.SUFFIXES: .o .C .C~ .c .c~
  74. X.SUFFIXES: .o .C .C~
  75. X.C~.C:
  76. X    -cd $(<D); $(GET) $(GFLAGS) $(<F)
  77. X.C.c:
  78. X    $(CC) $(CFLAGS) -Fc $*.C > $*.c
  79. X.C.o:
  80. X    $(CC) $(CFLAGS) -c $*.C
  81. X.C~.o:
  82. X    -cd $(<D); $(GET) $(GFLAGS) $(<F)
  83. X    $(CC) $(CFLAGS) -c $*.C
  84. X
  85. END_OF_FILE
  86.   if test 1102 -ne `wc -c <'Makefile'`; then
  87.     echo shar: \"'Makefile'\" unpacked with wrong size!
  88.   fi
  89.   # end of 'Makefile'
  90. fi
  91. if test -f 'Misc.C' -a "${1}" != "-c" ; then 
  92.   echo shar: Will not clobber existing file \"'Misc.C'\"
  93. else
  94.   echo shar: Extracting \"'Misc.C'\" \(5782 characters\)
  95.   sed "s/^X//" >'Misc.C' <<'END_OF_FILE'
  96. X// 
  97. X// NAME:    MISC.C
  98. X//
  99. X// PURPOSE:    generalized functions for C++ class library routines
  100. X// AUTHOR:    Lee Hounshell
  101. X//
  102. X
  103. X#include <stdlib.h>
  104. X#include <stream.h>
  105. X#include <memory.h>
  106. X#include <string.h>
  107. X#include <ctype.h>
  108. X#include "Misc.H"
  109. X
  110. X
  111. X// =============================================================================
  112. X// stuff thet jes' be here 'cause i wuz be 2 lazy 2 done drop it sumplace else, Mazza!
  113. X// =============================================================================
  114. X
  115. X
  116. X// -----------------------------------------------------------------------------
  117. X// convert an integer into an ascii string.  return a pointer to that string.
  118. X//
  119. Xchar *itoa(const int foo)
  120. X{
  121. X    static char int_buf[28];
  122. X    sprintf(int_buf, "%d", foo);
  123. X    return int_buf;
  124. X}
  125. X
  126. X
  127. X// convert an unsigned integer into an ascii string.  return a pointer to that string.
  128. X//
  129. Xchar *uitoa(const unsigned int foo)
  130. X{
  131. X    static char int_buf[28];
  132. X    sprintf(int_buf, "%u", foo);
  133. X    return int_buf;
  134. X}
  135. X
  136. X
  137. X// convert a long into an ascii string.  return a pointer to that string.
  138. X//
  139. X#ifdef HP
  140. Xchar *ltoa(long foo)
  141. X#else
  142. Xchar *ltoa(const long foo)
  143. X#endif
  144. X{
  145. X    static char long_buf[28];
  146. X    sprintf(long_buf, "%ld", foo);
  147. X    return long_buf;
  148. X}
  149. X
  150. X
  151. X// convert an unsigned long into an ascii string.  return a pointer to that string.
  152. X//
  153. X#ifdef HP
  154. Xchar *ultoa(unsigned long foo)
  155. X#else
  156. Xchar *ultoa(const unsigned long foo)
  157. X#endif
  158. X{
  159. X    static char long_buf[28];
  160. X    sprintf(long_buf, "%lu", foo);
  161. X    return long_buf;
  162. X}
  163. X
  164. X
  165. X// convert a double into an ascii string.  return a pointer to that string.
  166. X// truncate any extra zeros after the decimal point.
  167. X//
  168. Xchar *dtoa(const double foo)
  169. X{
  170. X    static char double_buf[28];
  171. X    sprintf(double_buf, "%lf", foo);
  172. X    char *ptr;
  173. X    for (ptr = double_buf; *ptr; ++ptr) {
  174. X    if (*ptr == '.') {
  175. X        // we may need to truncate zeroes
  176. X        ptr = double_buf + (strlen(double_buf) - 1);
  177. X        while (*ptr == '0') {
  178. X        *ptr-- = 0;
  179. X        }
  180. X        if (*ptr == '.') {
  181. X        *ptr = 0;
  182. X        }
  183. X        break;
  184. X    }
  185. X    }
  186. X    return double_buf;
  187. X}
  188. X
  189. X
  190. X// convert an ascii string to a double
  191. X//
  192. Xdouble atod(char * foo)
  193. X{
  194. X    double d = 0;
  195. X    if (!foo || !*foo) {
  196. X    return d;
  197. X    }
  198. X    if (!isdigit(*foo)) {
  199. X    if (*foo != '-' && *foo != '+') {
  200. X        return d;
  201. X    }
  202. X    if (!isdigit(*(foo + 1))) {
  203. X        return d;
  204. X    }
  205. X    }
  206. X    sscanf(foo, "%lf", &d);
  207. X    return d;
  208. X}
  209. X
  210. X// -----------------------------------------------------------------------------
  211. X
  212. X// convert a 24-hour time (hhmm) into LMOS string format (hhmmZ - where Z is 'A' or 'P')
  213. X//
  214. Xchar *ltoTime(const long date24)
  215. X{
  216. X    static char time_buf[6];
  217. X    *time_buf = 0;
  218. X    if (date24 != 0L) {
  219. X    long minute = date24 % 100;
  220. X    long hour = (date24 - minute) / 100;
  221. X    char ampm = 'A';
  222. X    if (hour >= 12) {
  223. X        ampm = 'P';
  224. X        if (hour > 12) hour -= 12;
  225. X    }
  226. X    sprintf(time_buf, "%02d%02d%c", hour, minute, ampm);
  227. X    return time_buf;
  228. X    }
  229. X}
  230. X
  231. X
  232. X// -----------------------------------------------------------------------------
  233. X// scan input until the desired character is found
  234. X//
  235. Xistream & look_for(istream &in, char c)
  236. X{
  237. X    int input = 0;
  238. X    if (getenv("INPUT_DEBUG") != NULL) {
  239. X    cerr << "Debug: looking for input character '" << c << "'" << endl;
  240. X    }
  241. X    while (input != c && input != EOF) {
  242. X    input = in.get();
  243. X    if (getenv("INPUT_DEBUG") != NULL) {
  244. X        cerr << input;
  245. X    }
  246. X    }
  247. X    return in;
  248. X}
  249. X
  250. X
  251. X// -----------------------------------------------------------------------------
  252. X// this function is used by lots of other classes for I/O, also.
  253. X// it really is a sort of "general-purpose," non-class-specific routine
  254. X// i use it for extracting class memebers from a saved object
  255. X//
  256. Xvoid scan_string(istream &in, char *ptr, int size)
  257. X{
  258. X    char buffer[3];
  259. X    char *input;
  260. X    if (size) --size;
  261. X    if (getenv("INPUT_DEBUG") != NULL) {
  262. X    cerr << "Debug: scanning for string (length=" << size << ")" << endl;
  263. X    }
  264. X    if (ptr != NULL) {
  265. X    input = ptr;
  266. X    }
  267. X    else {
  268. X    input = buffer;
  269. X    }
  270. X    *input = 0;
  271. X    look_for(in, '\'');                // find first quote
  272. X    int endflag = 0;
  273. X    int count = 0;
  274. X    while (1) {
  275. X    int ch;
  276. X    if ((ch = in.get()) == EOF) {
  277. X        if (getenv("INPUT_DEBUG") != NULL) {
  278. X        cerr << "debug: scan_string(): unexpected EOF found" << endl;
  279. X        }
  280. X        *input = 0;
  281. X        break;
  282. X    }
  283. X    *input = ch;
  284. X    if (getenv("INPUT_DEBUG") != NULL) {
  285. X        cerr << *input;
  286. X    }
  287. X    if (*input == '\n' && endflag) {    // all done!
  288. X        *input = 0;
  289. X        if (getenv("INPUT_DEBUG") != NULL) {
  290. X        cerr << "\nDebug: scan_string() found: '" << ptr << "'" << endl;
  291. X        }
  292. X        break;                // found end of string
  293. X    }
  294. X    if (count >= size) {            // string is too big for buffer
  295. X        if (getenv("INPUT_DEBUG") != NULL) {
  296. X        cerr << "\nDebug: scan_string() size exceeded - truncating string" << endl;
  297. X        }
  298. X        if (ch != '\'') {
  299. X        look_for(in, '\'');        // skip to last quote
  300. X        }
  301. X        endflag = 1;
  302. X        continue;
  303. X    }
  304. X    if (ptr != NULL && endflag) {        // possibly found end of string
  305. X        *(input+1) = *input;
  306. X        *input = '\'';
  307. X        ++input;
  308. X        ++count;
  309. X    }
  310. X    if ((endflag = (*input == '\'')) == 0) {// got a close quote??
  311. X        if (*ptr) ++input;
  312. X        ++count;
  313. X    }
  314. X    }
  315. X}
  316. X
  317. X
  318. X// these functions are also used by other classes for I/O.
  319. X// they keep track of "indent" levels for printing objects with inheritance
  320. X
  321. Xstatic int no_tab_stops = 0;
  322. X
  323. X
  324. X// -----------------------------------------------------------------------------
  325. X//
  326. Xostream & Tab(ostream &out)
  327. X{
  328. X    out << "\n";
  329. X    for (int i = 0; i < no_tab_stops; ++i) {
  330. X    out << "    ";                // really one-half a tab stop
  331. X    }
  332. X    return out;
  333. X}
  334. X
  335. X
  336. X// -----------------------------------------------------------------------------
  337. X//
  338. Xostream & Inc(ostream &out)
  339. X{
  340. X    ++no_tab_stops;
  341. X    return Tab(out);
  342. X}
  343. X
  344. X
  345. X// -----------------------------------------------------------------------------
  346. X//
  347. Xostream & Dec(ostream &out)
  348. X{
  349. X    --no_tab_stops;
  350. X    return Tab(out);
  351. X}
  352. X
  353. END_OF_FILE
  354.   if test 5782 -ne `wc -c <'Misc.C'`; then
  355.     echo shar: \"'Misc.C'\" unpacked with wrong size!
  356.   fi
  357.   # end of 'Misc.C'
  358. fi
  359. if test -f 'Misc.H' -a "${1}" != "-c" ; then 
  360.   echo shar: Will not clobber existing file \"'Misc.H'\"
  361. else
  362.   echo shar: Extracting \"'Misc.H'\" \(712 characters\)
  363.   sed "s/^X//" >'Misc.H' <<'END_OF_FILE'
  364. X// 
  365. X// NAME:    MISC.H
  366. X//
  367. X// PURPOSE:    generalized functions for C++ class library routines
  368. X// AUTHOR:    Lee Hounshell
  369. X//
  370. X
  371. X#ifndef MISC_H
  372. X#define MISC_H
  373. X
  374. X#include <stream.h>
  375. X
  376. X    char *itoa(const int foo);
  377. X    char *uitoa(const unsigned int foo);
  378. X
  379. X#ifdef HP
  380. X    char *ltoa(long foo);
  381. X    char *ultoa(unsigned long foo);
  382. X#else
  383. X    char *ltoa(const long foo);
  384. X    char *ultoa(const unsigned long foo);
  385. X#endif
  386. X
  387. X    char *dtoa(const double foo);
  388. X    double atod(char * foo);
  389. X    char *ltoTime(const long date24);
  390. X    istream & look_for(istream &in, char c);
  391. X    void scan_string(istream &in, char *ptr, int size);
  392. X    ostream & Tab(ostream &out);
  393. X    ostream & Inc(ostream &out);
  394. X    ostream & Dec(ostream &out);
  395. X
  396. X#endif
  397. X
  398. END_OF_FILE
  399.   if test 712 -ne `wc -c <'Misc.H'`; then
  400.     echo shar: \"'Misc.H'\" unpacked with wrong size!
  401.   fi
  402.   # end of 'Misc.H'
  403. fi
  404. if test -f 'demo.C' -a "${1}" != "-c" ; then 
  405.   echo shar: Will not clobber existing file \"'demo.C'\"
  406. else
  407.   echo shar: Extracting \"'demo.C'\" \(815 characters\)
  408.   sed "s/^X//" >'demo.C' <<'END_OF_FILE'
  409. X#include    <stdlib.h>
  410. X#include    <stream.h>
  411. X#include    <var.H>
  412. X
  413. Xmain ()
  414. X{
  415. X    var value;                // declare an "untyped" var
  416. X    value = "hello world";            // initialize it
  417. X    cout << value << endl;            // output "hello world"
  418. X    value = value(3, value.length() - 6);    // substring example
  419. X    cout << value << endl;            // output "lo wo"
  420. X    value = 35;                // assignment of int
  421. X    value += 42.375;            // add 42.375 to present value
  422. X    cout << value << endl;            // output "77.375"
  423. X    cout << value.format("formatted output example %05d of value") << endl;
  424. X    cout << value.format("multiple outputs #1=%d, #2=%9.2f of value") << endl;
  425. X    value.null(2);                // truncate string
  426. X    value += " sunset strip";        // concatenate a string
  427. X    cout << value.format("%s") << endl;    // output "77 sunset strip"
  428. X    cout << value[3] << value[4] << value[5] << endl; // output "sun"
  429. X}
  430. X
  431. END_OF_FILE
  432.   if test 815 -ne `wc -c <'demo.C'`; then
  433.     echo shar: \"'demo.C'\" unpacked with wrong size!
  434.   fi
  435.   # end of 'demo.C'
  436. fi
  437. if test -f 'var.H' -a "${1}" != "-c" ; then 
  438.   echo shar: Will not clobber existing file \"'var.H'\"
  439. else
  440.   echo shar: Extracting \"'var.H'\" \(8731 characters\)
  441.   sed "s/^X//" >'var.H' <<'END_OF_FILE'
  442. X//
  443. X// NAME:    var.H
  444. X//
  445. X// PURPOSE:    C++ Generic "Universal Variable" Class Library Header File
  446. X// AUTHOR:    Lee Hounshell
  447. X//
  448. X
  449. X#ifndef VAR_H
  450. X#define VAR_H
  451. X
  452. X#include    "string.h"
  453. X
  454. X// -----------------------------------------------------------------------------
  455. X//
  456. Xclass varsize {
  457. X    // dummy class needed for var constructor of specific size that
  458. X    // doesn't conflict with the var integer type constructor
  459. X    public:
  460. X    // Constructors & Destructors
  461. X    varsize(int sz);                // constructor
  462. X    int size;                    // size of var
  463. X};
  464. X
  465. Xclass subvar;
  466. X
  467. X// -----------------------------------------------------------------------------
  468. X//
  469. Xclass var {
  470. X
  471. X    public:
  472. X    // Standard Interface
  473. X    const var & type(void) const;            // who am i
  474. X
  475. X    // Constructors & Destructors
  476. X    var(void);                    // constructor
  477. X    var(const varsize &);                // constructor
  478. X    var(const char *);                // constructor
  479. X    var(const char);                // constructor
  480. X    var(const short);                // constructor
  481. X    var(const unsigned short);            // constructor
  482. X    var(const int);                    // constructor
  483. X    var(const unsigned int);            // constructor
  484. X    var(const long);                // constructor
  485. X    var(const unsigned long);            // constructor
  486. X    var(const double);                // constructor
  487. X    var(const var &);                // copy constructor
  488. X    ~var(void);                    // destructor
  489. X
  490. X    // Operators
  491. X    var & operator = (const char *);        // assignment
  492. X        var & operator = (const var &);            // assignment
  493. X        char & operator [] (const int);            // indexing
  494. X        subvar & operator () (int, int) const;        // substring
  495. X        subvar & operator () (const int) const;        // substring
  496. X        friend ostream & operator << (ostream &, const var &); // output
  497. X        friend istream & operator >> (istream &, var &); // input
  498. X    friend class subvar;                // substring
  499. X
  500. X    // More Operators (used for arithmetic type extension)
  501. X    var & operator = (const char);            // assignment
  502. X    var & operator = (const short);            // assignment
  503. X    var & operator = (const unsigned short);    // assignment
  504. X    var & operator = (const int);            // assignment
  505. X    var & operator = (const unsigned int);        // assignment
  506. X    var & operator = (const long);            // assignment
  507. X    var & operator = (const unsigned long);        // assignment
  508. X    var & operator = (const double);        // assignment
  509. X
  510. X    // Casting Operators
  511. X    operator char * (void) const;            // type conversion
  512. X    operator double (void) const;            // type conversion
  513. X
  514. X    // Assignment Operators
  515. X        var & operator ++ (void);            // increment (pre-index only)
  516. X        var & operator -- (void);            // decrement (pre-index only)
  517. X        var operator ! (void) const;            // not
  518. X
  519. X        var operator + (const var &) const;        // addition OR concatenation
  520. X        var operator - (const var &) const;        // subtraction
  521. X        var operator * (const var &) const;        // multiplication
  522. X        var operator / (const var &) const;        // division
  523. X        var operator % (const var &) const;        // remainder
  524. X
  525. X        var & operator += (const var &);        // addition OR concatenation
  526. X        var & operator -= (const var &);        // subtraction
  527. X        var & operator *= (const var &);        // multiplication
  528. X        var & operator /= (const var &);        // division
  529. X        var & operator %= (const var &);        // remainder
  530. X
  531. X        var & operator += (const char &);        // addition OR concatenation
  532. X        var & operator += (const char *);        // addition OR concatenation
  533. X        var & operator -= (const char *);        // subtraction
  534. X        var & operator *= (const char *);        // multiplication
  535. X        var & operator /= (const char *);        // division
  536. X        var & operator %= (const char *);        // remainder
  537. X
  538. X        var & operator += (const double);        // addition OR concatenation
  539. X        var & operator -= (const double);        // subtraction
  540. X        var & operator *= (const double);        // multiplication
  541. X        var & operator /= (const double);        // division
  542. X        var & operator %= (const double);        // remainder
  543. X
  544. X    friend var operator + (const char *, const var &); // addition OR concatenation
  545. X    friend var operator - (const char *, const var &); // subtraction
  546. X    friend var operator * (const char *, const var &); // multiplication
  547. X    friend var operator / (const char *, const var &); // division
  548. X    friend var operator % (const char *, const var &); // remainder
  549. X    friend var operator + (const var &, const char *); // addition OR concatenation
  550. X    friend var operator - (const var &, const char *); // subtraction
  551. X    friend var operator * (const var &, const char *); // multiplication
  552. X    friend var operator / (const var &, const char *); // division
  553. X    friend var operator % (const var &, const char *); // remainder
  554. X
  555. X    friend var operator + (const var &, const double); // addition OR concatenation
  556. X    friend var operator - (const var &, const double); // subtraction
  557. X    friend var operator * (const var &, const double); // multiplication
  558. X    friend var operator / (const var &, const double); // division
  559. X    friend var operator % (const var &, const double); // remainder
  560. X    friend var operator + (const double, const var &); // addition OR concatenation
  561. X    friend var operator - (const double, const var &); // subtraction
  562. X    friend var operator * (const double, const var &); // multiplication
  563. X    friend var operator / (const double, const var &); // division
  564. X    friend var operator % (const double, const var &); // remainder
  565. X
  566. X    // Equality Operators
  567. X        int operator == (const var &) const;        // equality
  568. X        int operator != (const var &) const;        // inequality
  569. X        int operator < (const var &) const;        // less than
  570. X        int operator > (const var &) const;        // greater than
  571. X        int operator <= (const var &) const;        // less than or equal
  572. X        int operator >= (const var &) const;        // greater than or equal
  573. X
  574. X    friend int operator == (const var &, const char *); // equality
  575. X    friend int operator != (const var &, const char *); // inequality
  576. X    friend int operator < (const var &, const char *);  // less than
  577. X    friend int operator > (const var &, const char *);  // greater than
  578. X    friend int operator <= (const var &, const char *); // less than or equal
  579. X    friend int operator >= (const var &, const char *); // greater than or equal
  580. X    friend int operator == (const char *, const var &); // equality
  581. X    friend int operator != (const char *, const var &); // inequality
  582. X    friend int operator < (const char *, const var &);  // less than
  583. X    friend int operator > (const char *, const var &);  // greater than
  584. X    friend int operator <= (const char *, const var &); // less than or equal
  585. X    friend int operator >= (const char *, const var &); // greater than or equal
  586. X
  587. X    friend int operator == (const var &, const double); // equality
  588. X    friend int operator != (const var &, const double); // inequality
  589. X    friend int operator < (const var &, const double);  // less than
  590. X    friend int operator > (const var &, const double);  // greater than
  591. X    friend int operator <= (const var &, const double); // less than or equal
  592. X    friend int operator >= (const var &, const double); // greater than or equal
  593. X    friend int operator == (const double, const var &); // equality
  594. X    friend int operator != (const double, const var &); // inequality
  595. X    friend int operator < (const double, const var &);  // less than
  596. X    friend int operator > (const double, const var &);  // greater than
  597. X    friend int operator <= (const double, const var &); // less than or equal
  598. X    friend int operator >= (const double, const var &); // greater than or equal
  599. X
  600. X    // Custom Interface
  601. X    void null(int);                    // "null" out string
  602. X    void changesize(int);                // change allocated memory
  603. X    int length(void) const;                // length of string
  604. X    const char * vartype(void) const;        // name of this var type
  605. X    void change_type(const char *);            // change var type
  606. X    int is_string(void) const;            // test var type
  607. X    int is_double(void) const;            // test var type
  608. X    int is_long(void) const;            // test var type
  609. X    int strchr(const char) const;            // strchr(char) index
  610. X    int strrchr(const char) const;            // strrchr(char) index
  611. X    var & concat(const var &);            // concatenation
  612. X    var & format(const char *);            // set output format
  613. X    void print(ostream &) const;            // output
  614. X    void read(istream &);                // input
  615. X
  616. X    static int save_me;                // cntrl object input
  617. X    static int save_it(const int save_flag = var::save_me); // input ctrl
  618. X
  619. X    protected:
  620. X
  621. X    private:
  622. X    int    numcheck(const char *) const;        // determine is_numeric value
  623. X
  624. X    static    const var ctype;            // for type() function
  625. X    short    fixed;                    // 1=fixed data type
  626. X    short    is_numeric;                // 0=string, 1=short/int/long, 2=float/double
  627. X    int    data_str_len;                // length of allocated "string"
  628. X    int    data_str_end;                // index to current "end" of string
  629. X    char    *data_str;                // for "string" data
  630. X    char    *format_str;                // the input/output format string
  631. X
  632. X};
  633. X
  634. X
  635. Xclass subvar : public var {
  636. X    public:
  637. X        var & operator = (const var &);            // substring replacement
  638. X    var        *varptr;
  639. X    unsigned    offset;
  640. X    unsigned    length;
  641. X};
  642. X
  643. X#endif
  644. X
  645. END_OF_FILE
  646.   if test 8731 -ne `wc -c <'var.H'`; then
  647.     echo shar: \"'var.H'\" unpacked with wrong size!
  648.   fi
  649.   # end of 'var.H'
  650. fi
  651. echo shar: End of archive 2 \(of 2\).
  652. cp /dev/null ark2isdone
  653. MISSING=""
  654. for I in 1 2 ; do
  655.     if test ! -f ark${I}isdone ; then
  656.     MISSING="${MISSING} ${I}"
  657.     fi
  658. done
  659. if test "${MISSING}" = "" ; then
  660.     echo You have unpacked both archives.
  661.     rm -f ark[1-9]isdone
  662. else
  663.     echo You still must unpack the following archives:
  664.     echo "        " ${MISSING}
  665. fi
  666. exit 0
  667. exit 0 # Just in case...
  668.