~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to .pc/support-gcc-5.x.patch/src/lib/std/shl/Style.cpp

  • Committer: Package Import Robot
  • Author(s): Nobuhiro Iwamatsu
  • Date: 2015-07-11 02:00:35 UTC
  • mfrom: (10.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150711020035-2nhpztq7s15qyc0v
Tags: 2.5.1-1
* New upstream release. (Closes: #789968)
* Update debian/control.
  - Update Standards-Version to 3.9.6.
* Add support mips64(el) and ppc64el. (Closes: #741508, #748146)
* Add patches/support-gcc-5.x.patch. (Closes: #777767)
  - Fix build with gcc-5.x.
* Add patches/Disable-NET0001.als.patch.
  - Disable test of NET0001.als.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ---------------------------------------------------------------------------
 
2
// - Style.cpp                                                               -
 
3
// - standard object library - style class  implementation                   -
 
4
// ---------------------------------------------------------------------------
 
5
// - This program is free software;  you can redistribute it  and/or  modify -
 
6
// - it provided that this copyright notice is kept intact.                  -
 
7
// -                                                                         -
 
8
// - This program  is  distributed in  the hope  that it will be useful, but -
 
9
// - without  any  warranty;  without  even   the   implied    warranty   of -
 
10
// - merchantability or fitness for a particular purpose.  In no event shall -
 
11
// - the copyright holder be liable for any  direct, indirect, incidental or -
 
12
// - special damages arising in any way out of the use of this software.     -
 
13
// ---------------------------------------------------------------------------
 
14
// - copyright (c) 1999-2015 amaury darsch                                   -
 
15
// ---------------------------------------------------------------------------
 
16
 
 
17
#include "Item.hpp"
 
18
#include "Style.hpp"
 
19
#include "Stdsid.hxx"
 
20
#include "Vector.hpp"
 
21
#include "Utility.hpp"
 
22
#include "Boolean.hpp"
 
23
#include "Integer.hpp"
 
24
#include "Character.hpp"
 
25
#include "QuarkZone.hpp"
 
26
#include "Exception.hpp"
 
27
#include "InputStream.hpp"
 
28
#include "OutputStream.hpp"
 
29
 
 
30
namespace afnix {
 
31
 
 
32
  // -------------------------------------------------------------------------
 
33
  // - private section                                                       -
 
34
  // -------------------------------------------------------------------------
 
35
  
 
36
  // the text weight byte code
 
37
  static const t_byte STL_WGHT_N = 0x00U;
 
38
  static const t_byte STL_WGHT_B = 0x01U;
 
39
  static const t_byte STL_WGHT_I = 0x02U;
 
40
  // the text alignment byte code
 
41
  static const t_byte STL_ALGN_L = 0x00U;
 
42
  static const t_byte STL_ALGN_C = 0x01U;
 
43
  static const t_byte STL_ALGN_R = 0x02U;
 
44
 
 
45
  // this procedure converts a weight to a byte code
 
46
  static t_byte stl_tobyte (const Style::t_wght wght) {
 
47
    t_byte result = 0x00U;
 
48
    switch (wght) {
 
49
    case Style::WGHT_N:
 
50
      result = STL_WGHT_N;
 
51
      break;
 
52
    case Style::WGHT_B:
 
53
      result = STL_WGHT_B;
 
54
      break;
 
55
    case Style::WGHT_I:
 
56
      result = STL_WGHT_I;
 
57
      break;
 
58
    }
 
59
    return result;
 
60
  }
 
61
 
 
62
  // this procedure convert a byte code to a weight
 
63
  static Style::t_wght stl_towght (const t_byte code) {
 
64
    switch (code) {
 
65
    case STL_WGHT_N:
 
66
      return Style::WGHT_N;
 
67
      break;
 
68
    case STL_WGHT_B:
 
69
      return Style::WGHT_B;
 
70
      break;
 
71
    case STL_WGHT_I:
 
72
      return Style::WGHT_I;
 
73
      break;
 
74
    default:
 
75
      break;
 
76
    }
 
77
    throw Exception ("style-error", "invalid text style serialization code");
 
78
  }
 
79
 
 
80
  // this procedure converts an alignment to a byte code
 
81
  static t_byte stl_tobyte (const Style::t_algn algn) {
 
82
    t_byte result = 0x00U;
 
83
    switch (algn) {
 
84
    case Style::ALGN_L:
 
85
      result = STL_ALGN_L;
 
86
      break;
 
87
    case Style::ALGN_C:
 
88
      result = STL_ALGN_C;
 
89
      break;
 
90
    case Style::ALGN_R:
 
91
      result = STL_ALGN_R;
 
92
      break;
 
93
    }
 
94
    return result;
 
95
  }
 
96
 
 
97
  // this procedure convert a byte code to an alignment
 
98
  static Style::t_algn stl_toalgn (const t_byte code) {
 
99
    switch (code) {
 
100
    case STL_ALGN_L:
 
101
      return Style::ALGN_L;
 
102
      break;
 
103
    case STL_ALGN_C:
 
104
      return Style::ALGN_C;
 
105
      break;
 
106
    case STL_ALGN_R:
 
107
      return Style::ALGN_R;
 
108
      break;
 
109
    default:
 
110
      break;
 
111
    }
 
112
    throw Exception ("style-error", "invalid text position serialization code");
 
113
  }
 
114
 
 
115
  // this procedure returns a new style object for deserialization
 
116
  static Serial* mksob (void) {
 
117
    return new Style;
 
118
  }
 
119
  // register this style serial id
 
120
  static const t_byte SERIAL_ID = Serial::setsid (SERIAL_STYL_ID, mksob);
 
121
 
 
122
  // -------------------------------------------------------------------------
 
123
  // - class section                                                         -
 
124
  // -------------------------------------------------------------------------
 
125
 
 
126
  // create a default style
 
127
  
 
128
  Style::Style (void) {
 
129
    reset ();
 
130
  }
 
131
 
 
132
  // copy construct this style
 
133
 
 
134
  Style::Style (const Style& that) {
 
135
    that.rdlock ();
 
136
    try { 
 
137
      d_wght = that.d_wght;
 
138
      d_algn = that.d_algn;
 
139
      d_tsiz = that.d_tsiz;
 
140
      d_fill = that.d_fill;
 
141
      d_psiz = that.d_psiz;
 
142
      d_sflg = that.d_sflg;
 
143
      that.unlock ();
 
144
    } catch (...) {
 
145
      that.unlock ();
 
146
      throw;
 
147
    }
 
148
  }
 
149
 
 
150
  // return the class name
 
151
 
 
152
  String Style::repr (void) const {
 
153
    return "Style";
 
154
  }
 
155
 
 
156
  // return a clone of this object
 
157
 
 
158
  Object* Style::clone (void) const {
 
159
    return new Style (*this);
 
160
  }
 
161
 
 
162
  // return the style serial code
 
163
 
 
164
  t_byte Style::serialid (void) const {
 
165
    return SERIAL_STYL_ID;
 
166
  }
 
167
 
 
168
  // serialize this style
 
169
 
 
170
  void Style::wrstream (OutputStream& os) const {
 
171
    rdlock ();
 
172
    try {
 
173
      // write the text style
 
174
      os.write ((char) stl_tobyte (d_wght));
 
175
      os.write ((char) stl_tobyte (d_algn));
 
176
      Serial::wrlong (d_tsiz, os);
 
177
      Serial::wrchar (d_fill, os);
 
178
      // write the number formating
 
179
      Serial::wrlong (d_psiz, os);
 
180
      Serial::wrbool (d_sflg, os);
 
181
      unlock ();
 
182
    } catch (...) {
 
183
      unlock ();
 
184
      throw;
 
185
    }
 
186
  }
 
187
 
 
188
  // deserialize this style
 
189
 
 
190
  void Style::rdstream (InputStream& is) {
 
191
    wrlock ();
 
192
    try {
 
193
      // read the test style
 
194
      d_wght = stl_towght ((t_byte) is.read ());
 
195
      d_algn = stl_toalgn ((t_byte) is.read ());
 
196
      d_tsiz = Serial::rdlong (is);
 
197
      d_fill = Serial::rdchar (is);
 
198
      // get the number formating
 
199
      d_psiz = Serial::rdlong (is);
 
200
      d_sflg = Serial::rdbool (is);
 
201
      unlock ();
 
202
    } catch (...) {
 
203
      unlock ();
 
204
      throw;
 
205
    } 
 
206
  }
 
207
 
 
208
  // assign a style to this one
 
209
 
 
210
  Style& Style::operator = (const Style& that) {
 
211
    // check for self assignation
 
212
    if (this == &that) return *this;
 
213
    // lock and assign
 
214
    wrlock ();
 
215
    that.rdlock ();
 
216
    try {
 
217
      d_wght = that.d_wght;
 
218
      d_algn = that.d_algn;
 
219
      d_tsiz = that.d_tsiz;
 
220
      d_fill = that.d_fill;
 
221
      d_psiz = that.d_psiz;
 
222
      d_sflg = that.d_sflg;
 
223
      unlock ();
 
224
      that.unlock ();
 
225
      return *this;
 
226
    } catch (...) {
 
227
      unlock ();
 
228
      that.unlock ();
 
229
      throw;
 
230
    }
 
231
  }
 
232
 
 
233
  // reset this style
 
234
 
 
235
  void Style::reset (void) {
 
236
    wrlock ();
 
237
    try {
 
238
      d_wght = WGHT_N;
 
239
      d_algn = ALGN_L;
 
240
      d_tsiz = 0L;
 
241
      d_fill = ' ';
 
242
      d_psiz = 0L;
 
243
      d_sflg = false;
 
244
      unlock ();
 
245
    } catch (...) {
 
246
      unlock ();
 
247
      throw;
 
248
    }
 
249
  }
 
250
 
 
251
  // set the text weight
 
252
 
 
253
  void Style::setwght (const t_wght wght) {
 
254
    wrlock ();
 
255
    try {
 
256
      d_wght = wght;
 
257
      unlock ();
 
258
    } catch (...) {
 
259
      unlock ();
 
260
      throw;
 
261
    }
 
262
  }
 
263
 
 
264
  // get the text weight
 
265
 
 
266
  Style::t_wght Style::getwght (void) const {
 
267
    rdlock ();
 
268
    try {
 
269
      t_wght result = d_wght;
 
270
      unlock ();
 
271
      return result;
 
272
    } catch (...) {
 
273
      unlock ();
 
274
      throw;
 
275
    }
 
276
  }
 
277
 
 
278
  // set the text alignment
 
279
 
 
280
  void Style::setalgn (const t_algn algn) {
 
281
    wrlock ();
 
282
    try {
 
283
      d_algn = algn;
 
284
      unlock ();
 
285
    } catch (...) {
 
286
      unlock ();
 
287
      throw;
 
288
    }
 
289
  }
 
290
 
 
291
  // get the text alignment
 
292
 
 
293
  Style::t_algn Style::getalgn (void) const {
 
294
    rdlock ();
 
295
    try {
 
296
      t_algn result = d_algn;
 
297
      unlock ();
 
298
      return result;
 
299
    } catch (...) {
 
300
      unlock ();
 
301
      throw;
 
302
    }
 
303
  }
 
304
 
 
305
  // set the text size
 
306
 
 
307
  void Style::settsiz (const long tsiz) {
 
308
    wrlock ();
 
309
    try {
 
310
      if (tsiz < 0L) {
 
311
        throw Exception ("style-error", "invalid negative text size");
 
312
      }
 
313
      d_tsiz = tsiz;
 
314
      unlock ();
 
315
    } catch (...) {
 
316
      unlock ();
 
317
      throw;
 
318
    }
 
319
  }
 
320
 
 
321
  // get the text size
 
322
 
 
323
  long Style::gettsiz (void) const {
 
324
    rdlock ();
 
325
    try {
 
326
      long result = d_tsiz;
 
327
      unlock ();
 
328
      return result;
 
329
    } catch (...) {
 
330
      unlock ();
 
331
      throw;
 
332
    }
 
333
  }
 
334
 
 
335
  // set the filling character
 
336
 
 
337
  void Style::setfill (const t_quad fill) {
 
338
    wrlock ();
 
339
    try {
 
340
      d_fill = fill;
 
341
      unlock ();
 
342
    } catch (...) {
 
343
      unlock ();
 
344
      throw;
 
345
    }
 
346
  }
 
347
 
 
348
  // get the filling character
 
349
 
 
350
  t_quad Style::getfill (void) const {
 
351
    rdlock ();
 
352
    try {
 
353
      t_quad result = d_fill;
 
354
      unlock ();
 
355
      return result;
 
356
    } catch (...) {
 
357
      unlock ();
 
358
      throw;
 
359
    }
 
360
  }
 
361
 
 
362
  // set the number precision
 
363
 
 
364
  void Style::setpsiz (const long psiz) {
 
365
    wrlock ();
 
366
    try {
 
367
      if (psiz < 0L) {
 
368
        throw Exception ("style-error", "invalid negative number precision");
 
369
      }
 
370
      d_psiz = psiz;
 
371
      unlock ();
 
372
    } catch (...) {
 
373
      unlock ();
 
374
      throw;
 
375
    }
 
376
  }
 
377
 
 
378
  // get the number precision
 
379
 
 
380
  long Style::getpsiz (void) const {
 
381
    rdlock ();
 
382
    try {
 
383
      long result = d_psiz;
 
384
      unlock ();
 
385
      return result;
 
386
    } catch (...) {
 
387
      unlock ();
 
388
      throw;
 
389
    }
 
390
  }
 
391
 
 
392
  // set the scientific flag
 
393
 
 
394
  void Style::setsflg (const bool sflg) {
 
395
    wrlock ();
 
396
    try {
 
397
      d_sflg = sflg;
 
398
      unlock ();
 
399
    } catch (...) {
 
400
      unlock ();
 
401
      throw;
 
402
    }
 
403
  }
 
404
 
 
405
  // get the scientific flag
 
406
 
 
407
  bool Style::getsflg (void) const {
 
408
    rdlock ();
 
409
    try {
 
410
      bool result = d_sflg;
 
411
      unlock ();
 
412
      return result;
 
413
    } catch (...) {
 
414
      unlock ();
 
415
      throw;
 
416
    }
 
417
  }
 
418
 
 
419
  // convert an integer number into a string - no style
 
420
 
 
421
  String Style::format (const long ival) const {
 
422
    rdlock ();
 
423
    try {
 
424
      String result = Utility::tostring (ival, d_psiz);
 
425
      unlock ();
 
426
      return result;
 
427
    } catch (...) {
 
428
      unlock ();
 
429
      throw;
 
430
    }
 
431
  }
 
432
 
 
433
  // convert an integer number into a string - no style
 
434
 
 
435
  String Style::format (const t_long ival) const {
 
436
    rdlock ();
 
437
    try {
 
438
      String result = Utility::tostring (ival, d_psiz);
 
439
      unlock ();
 
440
      return result;
 
441
    } catch (...) {
 
442
      unlock ();
 
443
      throw;
 
444
    }
 
445
  }
 
446
 
 
447
  // convert a real number into a string - no style
 
448
 
 
449
  String Style::format (const t_real rval) const {
 
450
    rdlock ();
 
451
    try {
 
452
      String result = Utility::tostring (rval, d_psiz, d_sflg);
 
453
      unlock ();
 
454
      return result;
 
455
    } catch (...) {
 
456
      unlock ();
 
457
      throw;
 
458
    }
 
459
  }
 
460
 
 
461
  // format a string with the text style
 
462
 
 
463
  String Style::format (const String& sval, const long size) const {
 
464
    rdlock ();
 
465
    try {
 
466
      // format the result string using non combining length
 
467
      String result;
 
468
      long slen = sval.ncclen ();
 
469
      // check if we process the size or not
 
470
      if (d_tsiz == 0L) {
 
471
        if (slen < size) {
 
472
          if (d_algn == ALGN_R) {
 
473
            result = sval.lfill (d_fill, size);
 
474
          } else {
 
475
            result = sval.rfill (d_fill, size);
 
476
          }
 
477
        } else {
 
478
          result = sval;
 
479
        }            
 
480
      } else {
 
481
        if (slen == d_tsiz) result = sval;
 
482
        if (slen < d_tsiz) {
 
483
          if (d_algn == ALGN_R) {
 
484
            result = sval.lfill (d_fill, d_tsiz);
 
485
          } else {
 
486
            result = sval.rfill (d_fill, d_tsiz);
 
487
          }
 
488
        }
 
489
        if (slen > d_tsiz) {
 
490
          if (d_algn == ALGN_R) {
 
491
            result = sval.lsubstr (d_tsiz);
 
492
          } else {
 
493
            result = sval.rsubstr (slen - d_tsiz);
 
494
          }
 
495
        }
 
496
      }
 
497
      unlock ();
 
498
      return result;
 
499
    } catch (...) {
 
500
      unlock ();
 
501
      throw;
 
502
    }
 
503
  }
 
504
        
 
505
  // -------------------------------------------------------------------------
 
506
  // - object section                                                        -
 
507
  // -------------------------------------------------------------------------
 
508
 
 
509
  // the object eval quarks
 
510
  static const long QUARK_WGHTN = String::intern ("WEIGHT-NORMAL");
 
511
  static const long QUARK_WGHTB = String::intern ("WEIGHT-BOLD");
 
512
  static const long QUARK_WGHTI = String::intern ("WEIGHT-ITALIC");
 
513
  static const long QUARK_ALGNL = String::intern ("ALIGN-LEFT");
 
514
  static const long QUARK_ALGNC = String::intern ("ALIGN-CENTER");
 
515
  static const long QUARK_ALGNR = String::intern ("ALIGN-RIGHT");
 
516
  static const long QUARK_STYLE = String::intern ("Style");
 
517
 
 
518
  // the quark zone
 
519
  static const long QUARK_ZONE_LENGTH = 13;
 
520
  static QuarkZone  zone (QUARK_ZONE_LENGTH);
 
521
 
 
522
  // the object supported quarks
 
523
  static const long QUARK_RESET   = zone.intern ("reset");
 
524
  static const long QUARK_SETTSIZ = zone.intern ("set-text-size");
 
525
  static const long QUARK_GETTSIZ = zone.intern ("get-text-size");
 
526
  static const long QUARK_SETFILL = zone.intern ("set-text-fill");
 
527
  static const long QUARK_GETFILL = zone.intern ("get-text-fill");
 
528
  static const long QUARK_SETWGHT = zone.intern ("set-text-weight");
 
529
  static const long QUARK_GETWGHT = zone.intern ("get-text-weight");
 
530
  static const long QUARK_SETALGN = zone.intern ("set-text-alignment");
 
531
  static const long QUARK_GETALGN = zone.intern ("get-text-alignment");
 
532
  static const long QUARK_SETPSIZ = zone.intern ("set-number-precision");
 
533
  static const long QUARK_GETPSIZ = zone.intern ("get-number-precision");
 
534
  static const long QUARK_SETSFLG = zone.intern ("set-scientific-notation");
 
535
  static const long QUARK_GETSFLG = zone.intern ("get-scientific-notation");
 
536
 
 
537
  // map an item to a weight type
 
538
  static inline Style::t_wght item_to_wght (const Item& item) {
 
539
    // check for a stream item 
 
540
    if (item.gettid () != QUARK_STYLE) {
 
541
      throw Exception ("item-error", "item is not a style item");
 
542
    }
 
543
    // map the item to the enumeration
 
544
    long quark = item.getquark (); 
 
545
    if (quark == QUARK_WGHTN) return Style::WGHT_N;
 
546
    if (quark == QUARK_WGHTB) return Style::WGHT_B;
 
547
    if (quark == QUARK_WGHTI) return Style::WGHT_I;
 
548
    throw Exception ("item-error", "cannot map item to weight type");
 
549
  }
 
550
 
 
551
  // map a weight type to an item
 
552
  static inline Item* wght_to_item (const Style::t_wght wght) {
 
553
    Item* result  = nilp;
 
554
    switch (wght) {
 
555
    case Style::WGHT_N:
 
556
      result = new Item (QUARK_STYLE, QUARK_WGHTN);
 
557
      break;
 
558
    case Style::WGHT_B:
 
559
      result = new Item (QUARK_STYLE, QUARK_WGHTB);
 
560
      break;
 
561
    case Style::WGHT_I:
 
562
      result = new Item (QUARK_STYLE, QUARK_WGHTI);
 
563
      break;
 
564
    }
 
565
    return result;
 
566
  }
 
567
 
 
568
  // map an item to an alignment type
 
569
  static inline Style::t_algn item_to_algn (const Item& item) {
 
570
    // check for a stream item 
 
571
    if (item.gettid () != QUARK_STYLE) {
 
572
      throw Exception ("item-error", "item is not a style item");
 
573
    }
 
574
    // map the item to the enumeration
 
575
    long quark = item.getquark (); 
 
576
    if (quark == QUARK_ALGNL) return Style::ALGN_L;
 
577
    if (quark == QUARK_ALGNC) return Style::ALGN_C;
 
578
    if (quark == QUARK_ALGNR) return Style::ALGN_R;
 
579
    throw Exception ("item-error", "cannot map item to alignment type");
 
580
  }
 
581
 
 
582
  // map an alignment type to an item
 
583
  static inline Item* algn_to_item (const Style::t_algn algn) {
 
584
    Item* result  = nilp;
 
585
    switch (algn) {
 
586
    case Style::ALGN_L:
 
587
      result = new Item (QUARK_STYLE, QUARK_ALGNL);
 
588
      break;
 
589
    case Style::ALGN_C:
 
590
      result = new Item (QUARK_STYLE, QUARK_ALGNC);
 
591
      break;
 
592
    case Style::ALGN_R:
 
593
      result = new Item (QUARK_STYLE, QUARK_ALGNR);
 
594
      break;
 
595
    }
 
596
    return result;
 
597
  }
 
598
 
 
599
  // create a new object in a generic way
 
600
 
 
601
  Object* Style::mknew (Vector* argv) {
 
602
    // get number of arguments
 
603
    long argc = (argv == nilp) ? 0 : argv->length ();
 
604
    // check for 0 argument
 
605
    if (argc == 0) return new Style;
 
606
    // invalid arguments
 
607
    throw Exception ("argument-error", "too many arguments with style");
 
608
  }
 
609
 
 
610
  // evaluate a quark statically
 
611
 
 
612
  Object* Style::meval (Runnable* robj, Nameset* nset, const long quark) {
 
613
    if (quark == QUARK_WGHTN)
 
614
      return new Item (QUARK_STYLE, QUARK_WGHTN);
 
615
    if (quark == QUARK_WGHTB)
 
616
      return new Item (QUARK_STYLE, QUARK_WGHTB);
 
617
    if (quark == QUARK_WGHTI)
 
618
      return new Item (QUARK_STYLE, QUARK_WGHTI);
 
619
    if (quark == QUARK_ALGNL)
 
620
      return new Item (QUARK_STYLE, QUARK_ALGNL);
 
621
    if (quark == QUARK_ALGNC)
 
622
      return new Item (QUARK_STYLE, QUARK_ALGNC);
 
623
    if (quark == QUARK_ALGNR)
 
624
      return new Item (QUARK_STYLE, QUARK_ALGNR);
 
625
    throw Exception ("eval-error", "cannot evaluate member",
 
626
                     String::qmap (quark));
 
627
  }
 
628
 
 
629
  // return true if the given quark is defined
 
630
 
 
631
  bool Style::isquark (const long quark, const bool hflg) const {
 
632
    rdlock ();
 
633
    try {
 
634
      if (zone.exists (quark) == true) {
 
635
        unlock ();
 
636
        return true;
 
637
      }
 
638
      bool result = hflg ? Serial::isquark (quark, hflg) : false;
 
639
      unlock ();
 
640
      return result;
 
641
    } catch (...) {
 
642
      unlock ();
 
643
      throw;
 
644
    }
 
645
  }
 
646
 
 
647
  // apply this object with a set of arguments and a quark
 
648
 
 
649
  Object* Style::apply (Runnable* robj, Nameset* nset, const long quark,
 
650
                        Vector* argv) {
 
651
    // get the number of arguments
 
652
    long argc = (argv == nilp) ? 0 : argv->length ();
 
653
 
 
654
    // dispatch 0 argument
 
655
    if (argc == 0) {
 
656
      if (quark == QUARK_GETWGHT) return wght_to_item  (getwght ());
 
657
      if (quark == QUARK_GETALGN) return algn_to_item  (getalgn ());
 
658
      if (quark == QUARK_GETTSIZ) return new Integer   (gettsiz ());
 
659
      if (quark == QUARK_GETFILL) return new Character (getfill ());
 
660
      if (quark == QUARK_GETPSIZ) return new Integer   (getpsiz ());
 
661
      if (quark == QUARK_GETSFLG) return new Boolean   (getsflg ());
 
662
      if (quark == QUARK_RESET) {
 
663
        reset ();
 
664
        return nilp;
 
665
      }
 
666
    }
 
667
    // dispatch 1 argument
 
668
    if (argc == 1) {
 
669
      if (quark == QUARK_SETWGHT) {
 
670
        Object* obj = argv->get (0);
 
671
        Item*  iobj = dynamic_cast <Item*> (obj);
 
672
        if (iobj == nilp) {
 
673
          throw Exception ("type-error", "invalid object for item type",
 
674
                           Object::repr (obj));
 
675
        }
 
676
        setwght (item_to_wght (*iobj));
 
677
        return nilp;
 
678
      }
 
679
      if (quark == QUARK_SETALGN) {
 
680
        Object* obj = argv->get (0);
 
681
        Item*  iobj = dynamic_cast <Item*> (obj);
 
682
        if (iobj == nilp) {
 
683
          throw Exception ("type-error", "invalid object for item type",
 
684
                           Object::repr (obj));
 
685
        }
 
686
        setalgn (item_to_algn (*iobj));
 
687
        return nilp;
 
688
      }
 
689
      if (quark == QUARK_SETTSIZ) {
 
690
        long tsiz = argv->getlong (0);
 
691
        settsiz (tsiz);
 
692
        return nilp;
 
693
      }
 
694
      if (quark == QUARK_SETFILL) {
 
695
        t_quad fill = argv->getchar (0);
 
696
        setfill (fill);
 
697
        return nilp;
 
698
      }
 
699
      if (quark == QUARK_SETPSIZ) {
 
700
        long psiz = argv->getlong (0);
 
701
        setpsiz (psiz);
 
702
        return nilp;
 
703
      }
 
704
      if (quark == QUARK_SETSFLG) {
 
705
        bool sflg = argv->getbool (0);
 
706
        setsflg (sflg);
 
707
        return nilp;
 
708
      }
 
709
    }
 
710
    // call the serial method
 
711
    return Serial::apply (robj, nset, quark, argv);
 
712
  }
 
713
}