ATS Knowledge
  • Annotated ATS Programs
    • Goal
    • Examples
      • Dining Philosopher with Animation (by Cairo)
        • Source File Download
        • Code
      • Operations pertaining to array0
        • Source File Download
        • Code
  • ATS Tools’ documentation
    • Tag Generator For ATS-Anairiats
      • Description
      • Download
      • Usage
      • Development
    • Vim plug-in for ATS-Postiats
  • ATS-Postiats’ Blog
    • Syntax for staload
      • Macros in the path
    • Various print functions in ATS-Postiats
      • dddd
    • Miscellaneous topics related to ATS-Postiats
      • Setting of Environment
      • Usage of staload
      • Standard header files
      • Type conversion
    • Targeting C# from program of ATS-Postiats
      • Convertion of types
    • Get value in the statics of ATS
    • Template for Makefile of simple ATS project
    • Global value with linear type
  • ATS-Postiats’ syntax
    • Mapping from source code to data structure
      • Function declaration and implementation
  • Model Checking ATS
    • Tutorial
    • Table of Contents
      • Ghosts for Model Checking
      • Towards Concurrent Program
        • Primitives for Concurrent Programming
        • Bibliography
      • Accessing Global Ghost Variables
        • Global ghost variables
        • Atomicity in ghost code
      • Virtual Lock
        • Bibliography
    • Bibliography
 
ATS Knowledge
  • Docs »
  • ATS-Postiats’ Blog »
  • Miscellaneous topics related to ATS-Postiats
  • Edit on GitHub

Miscellaneous topics related to ATS-Postiats¶

Setting of Environment¶

Please follow the instructions on ATS’ website to install ATS-Postiats as well as ATS2-contrib. Here I just want to emphasize the setting of environment variables PATSHOME as well as PATSHOMERELOC. These two variables should be set in the environment before invoking the ATS compiler (patscc or patsopt). Also they are commonly referred in Makefile used in ATS projects. The first one (PATSHOME) should be set to the directory where ATS is installed. Normally I just download tarball for the source of ATS, decompress it, build ATS, and use built executables. (Simply put, I don’t do make install.) Therefore I just set PATSHOME to the folder resulting from decompressing the tarball. PATSHOMERELOC should be set to the folder resulting for decompress the tarball for ATS2-contrib. Also the PATH variable should be set accordingly so that system can locate the compiler of ATS. Normally, I put these settings into one script file, say pats.xxx.sh. Then I do source pats.xxx.sh when I open a terminal for the first time. My pats.xxx.sh looks like the following:

# Script for setting environment for ATS-Postiats

PATSHOME=${HOME}/programs/ats2/ATS2-Postiats-0.0.8; export PATSHOME
PATSHOMERELOC=${HOME}/programs/ats2/ATS2-Postiats-contrib-0.0.7; export PATSHOMERELOC 

PATH=${PATSHOME}/bin:${PATH}; export PATH

If you use make install to install ATS at the system level, your script would probably be like the following:

# Script for setting environment for ATS-Postiats

PATSHOME=/usr/local/lib/ATS2-Postiats-0.0.8; export PATSHOME
PATSHOMERELOC=${HOME}/programs/ats2/ATS2-Postiats-contrib-0.0.7; export PATSHOMERELOC 

Note

Since we choose to install ATS at the system level, there’s no need to set PATH.

Usage of staload¶

Some useful information about staload can be found in Wiki and my previous blog.

Standard header files¶

To use the prelude library of ATS, we would include the following code:

#include "share/atspre_define.hats"
#include "share/atspre_staload.hats"

To use the ML library of ATS, we would include the following code:

#include "share/HATS/atspre_staload_libats_ML.hats"

If we want to generate C code used on lower level systems, such as embedded system, we can replace these header files with appropriate ones to fit the targeting platform.

Type conversion¶

Todo

  • $UNSAFE.cast{natLt(n)}
Next Previous

© Copyright 2013, Zhiqiang Ren.

Built with Sphinx using a theme provided by Read the Docs.