~ubuntu-branches/ubuntu/quantal/texmacs/quantal

« back to all changes in this revision

Viewing changes to src/Classes/Atomic/space.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA, Kamaraju Kusumanchi, kohda
  • Date: 2008-04-06 15:11:41 UTC
  • mfrom: (1.1.7 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080406151141-w0sg20jnv86mlt6f
Tags: 1:1.0.6.14-1
[Kamaraju Kusumanchi <kamaraju@gmail.com>]
* New upstream release
* 01_american.dpatch is updated
* Since thread support in guile-1.8 is now disabled, the segmentation faults
  should not arise anymore. More info at #439923. (Closes: #450499, #458685)
[kohda]
* This version fixed menu problem.  (Closes: #447083)
* Reverted orig.tar.gz to the upstream tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/******************************************************************************
3
 
* MODULE     : space.cpp
4
 
* DESCRIPTION: spacing
5
 
* COPYRIGHT  : (C) 1999  Joris van der Hoeven
6
 
*******************************************************************************
7
 
* This software falls under the GNU general public license and comes WITHOUT
8
 
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
9
 
* If you don't have this file, write to the Free Software Foundation, Inc.,
10
 
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11
 
******************************************************************************/
12
 
 
13
 
#include "space.hpp"
14
 
 
15
 
/******************************************************************************
16
 
* Constructors
17
 
******************************************************************************/
18
 
 
19
 
space_rep::space_rep (SI min2, SI def2, SI max2) {
20
 
  min= min2;
21
 
  def= def2;
22
 
  max= max2;
23
 
}
24
 
 
25
 
space_rep::space_rep (SI def2) {
26
 
  min= def= max= def2;
27
 
}
28
 
 
29
 
space::space (SI min, SI def, SI max) {
30
 
  rep= new space_rep (min, def, max);
31
 
}
32
 
 
33
 
space::space (SI def) {
34
 
  rep= new space_rep (def);
35
 
}
36
 
 
37
 
space::operator tree () {
38
 
  return tree (TUPLE,
39
 
               as_string (rep->min),
40
 
               as_string (rep->def),
41
 
               as_string (rep->max));
42
 
}
43
 
 
44
 
/******************************************************************************
45
 
* The routines which are provided
46
 
******************************************************************************/
47
 
 
48
 
bool
49
 
operator == (space spc1, space spc2) {
50
 
  return
51
 
    (spc1->min == spc2->min) &&
52
 
    (spc1->def == spc2->def) &&
53
 
    (spc1->max == spc2->max);
54
 
}
55
 
 
56
 
bool
57
 
operator != (space spc1, space spc2) {
58
 
  return
59
 
    (spc1->min != spc2->min) ||
60
 
    (spc1->def != spc2->def) ||
61
 
    (spc1->max != spc2->max);
62
 
}
63
 
 
64
 
ostream&
65
 
operator << (ostream& out, space spc) {
66
 
  out << "[ " << spc->min << ", " << spc->def << ", " << spc->max << " ]";
67
 
  return out;
68
 
}
69
 
 
70
 
space
71
 
copy (space spc) {
72
 
  return space (spc->min, spc->def, spc->max);
73
 
}
74
 
 
75
 
space
76
 
operator + (space spc1, space spc2) {
77
 
  return space (spc1->min + spc2->min,
78
 
                spc1->def + spc2->def,
79
 
                spc1->max + spc2->max);
80
 
}
81
 
 
82
 
space
83
 
operator - (space spc1, space spc2) {
84
 
  return space (spc1->min - spc2->min,
85
 
                spc1->def - spc2->def,
86
 
                spc1->max - spc2->max);
87
 
}
88
 
 
89
 
space
90
 
operator * (int i, space spc) {
91
 
  return space (i*spc->min, i*spc->def, i*spc->max);
92
 
}
93
 
 
94
 
space
95
 
operator / (space spc, int i) {
96
 
  return space (spc->min/i, spc->def/i, spc->max/i);
97
 
}
98
 
 
99
 
space
100
 
max (space spc1, space spc2) {
101
 
  return space (max (spc1->min, spc2->min),
102
 
                max (spc1->def, spc2->def),
103
 
                max (spc1->max, spc2->max));
104
 
}