# Icon on Cygwin

Gregg M. Townsend
Department of Computer Science
The University of Arizona

www.cs.arizona.edu/icon/v950/cygwin.htm
Last updated November 8, 2009

## Introduction

Most contemporary operating systems trace their underlying design to the Unix operating system, as refined and specified today by the POSIX family of standards. Microsoft Windows, however, was developed independently and defines a different set of interfaces for the programmer and the user.

The Cygwin package provides a Unix environment under Microsoft Windows. This allows the latest version of Icon (and many other things) to be built on a Windows system. Successful use of Cygwin requires familiarity with both Windows and Unix.

This document describes some of the peculiarities of the Cygwin port of Icon. These differences are not necessarily identified in other documentation.

## Building Icon

Icon is built in a Cygwin shell window using the same process as on on other platforms. See the installation documentation for instructions. There are two possible choices for configuration name: The `cygwin` configuration uses the native Windows graphics system; the `xcygwin` configuration uses the X window system and thus is closer to other Unix implementations of Icon.

The Cygwin package is available from www.cygwin.com. A custom installation of the Cygwin system is required; the default installation provides a bare-bones system insufficient for building software. Icon requires a C compiler and the usual tools and utilities available on a standard POSIX development system; these are found in the `gcc-core` and `make` packages. The `xinit` and `libXt-devel` packages are also needed to build the `xcygwin` configuration with graphics enabled.

## Running Icon programs

Icon is run by commands entered in a Cygwin terminal window. The simplest command is "`icon prog.icn`", which runs the program contained in the source file `prog.icn`. The translator `icont` can create executable programs from Icon source code. The Unix-style "man pages" for `icon` and `icont` describe the command options in a traditionally cryptic manner.

## Interpreter path and environment

Icon programs require an interpreter for execution. On Windows, the path of the interpreter is not embedded in an executable program. The program must be able to find `iconx.exe` in the search path.

The Cygwin X server must be running, with a correct `DISPLAY` variable in the environment, to execute graphics programs built by the `xcygwin` configuration of Icon.

When the environment is correctly set, with `cygwin1.dll` in the Windows path, a compiled Icon program may be run from the Cygwin shell or by double-clicking its graphical icon.

## Extra built-in functions

For compatibility with an earlier port of Icon to Windows, the `cygwin` configuration includes some extra built-in functions. These are described in section 6.2 of IPD271, which documents that earlier port.

These unsupported functions are not part of Icon on other platforms, nor of the `xcygwin` configuration, so their use renders a program non-portable.

## Feature test symbols

The symbols `_MS_WINDOWS` and `_CYGWIN` are defined by the Icon preprocessor. The symbol `_UNIX` is not defined. The symbol `_GRAPHICS` is defined if Icon is built with graphics enabled; the symbol `_X_WINDOW_SYSTEM` is also defined in the `xcygwin` configuration. The corresponding strings are produced or omitted, as appropriate, by the `&features` keyword.

## Known bugs

- Some Unix dependencies cause the `tpp` and `opts` tests to fail.
- Resizing a window sends a large number of events to the program.