view anagram/support/cint.h @ 1:60d3ca9d3f6b

Fix stupid bug in help2html.
author David A. Holland
date Tue, 12 Aug 2008 00:13:42 -0400
parents 13d2b8934445
children 607e3be6bad8
line wrap: on
line source

/*
 * AnaGram, A System for Syntax Directed Programming
 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
 * See the file COPYING for license and usage terms.
 *
 * cint.h
 */

#ifndef CINT_H
#define CINT_H

#ifdef VACLGUI
#include <ipoint.hpp>
#endif

struct rect;


struct cint {
  int x, y;

  cint()
    : x(0), y(0)
  {}
  cint(const int xarg, const int yarg)
    : x(xarg), y(yarg)
  {}
  cint(const cint &c)
    : x(c.x), y(c.y)
  {}

#ifdef VACLGUI
  cint(const IPair &p)
    : x(p.coord1()), y(p.coord2())
  {}
  operator IPair () const {
    return IPair(x, y);
  }
#endif

  int operator == (const cint r) const { return (x == r.x && y == r.y); }
  int operator != (const cint r) const { return (x != r.x || y != r.y); }
  cint operator + (cint r) const {
    r.x += x;
    r.y += y;
    return r;
  }
  cint operator += (const cint r) {
    x += r.x;
    y += r.y;
    return *this;
  }
  cint operator - (cint r) const {
    r.x = x - r.x;
    r.y = y - r.y;
    return r;
  }
  cint operator -= (const cint r) {
    x -= r.x;
    y -= r.y;
    return *this;
  }
  int operator <= (const cint &s) const;
  int operator >= (const cint &s) const;
  int operator < (const cint &s) const;
  int operator > (const cint &s) const;
  int on_boundary(cint, cint) const;
  int inside_rect(cint, cint) const;
  int inside_rect(rect) const;
};

struct rect {
  cint pos, size;
};

cint lrci(cint a, cint b);
int  measure_line(const char *s);
cint measure_string(const char *s);
cint place(cint measure, cint size, int jm);
rect place_rect(rect w, cint s, int jm);
cint ulci(cint a, cint b);


#endif /* CINT_H */