POSIX for OpenVMS Guide to Programming

*HyperReader

CONTENTS

  Title Page

  Copyright Page

  Preface

  1      Introduction to POSIX for OpenVMS
    1.1 POSIX for OpenVMS Adherence to Standards
      1.1.1      The POSIX Standards
      1.1.2      The X/Open Portability Guide
      1.1.3      ISO C
      1.1.4      ``POSIX for OpenVMS only'' Features
    1.2 The POSIX Standards and Application Portability
      1.2.1      Levels of Conformance
      1.2.2      Implementation-Defined, Undefined and Unspecified Behaviours
      1.2.3      Open Systems and Portability
    1.3 The POSIX for OpenVMS Documentation

  Part I   POSIX for OpenVMS Programming

  2      Comparing the POSIX and OpenVMS Environments
    2.1 Introduction
    2.2 The OpenVMS and POSIX Environments
    2.3 Moving from OpenVMS to POSIX
    2.4 Moving from POSIX to OpenVMS
    2.5 Creating a POSIX Session in a DECwindows Environment
    2.6 Case Sensitivity in POSIX for OpenVMS
    2.7 Special Characters in POSIX for OpenVMS
    2.8 Using OpenVMS Features in the POSIX Environment
    2.9 Run-Time Libraries
      2.9.1      Running a POSIX Application with DECwindows
    2.10 Differences in C Language Functions
    2.11 Security:  File Access and Protection
    2.12 Processes in the POSIX Environment
    2.13 Issues for Users Accustomed to the UNIX Environment
      2.13.1     Programming Environment
      2.13.2     Calling the main( ) Function
    2.14 Communication Interfaces

  3      The POSIX for OpenVMS Programming Environment
    3.1 Introduction
    3.2 The POSIX for OpenVMS Development Environment
      3.2.1      Header Files
      3.2.2      Feature Test Macros
      3.2.3      Shareable Images
      3.2.4      Object Libraries
      3.2.5      Option Files
      3.2.6      Other Programming Files
      3.2.7      Tools
    3.3 Developing an Application in the POSIX Environment
      3.3.1      Producing Source Code
      3.3.2      Compiling a Program in the POSIX Environment
      3.3.3      Producing an Object File with c89
      3.3.4      Producing an Executable File from Source Code with c89
      3.3.5      Producing an Executable File from an Object File with c89
      3.3.6      Compiling Source Code and Using Feature Test Macros
      3.3.7      Passing Options to the C Compiler
      3.3.8      Linking a Program using the c89 Utility
      3.3.9      Passing Options to the OpenVMS Linker Using the c89 Utility
      3.3.10     Linking Against Object Libraries
      3.3.11     Running a POSIX Application
      3.3.12     Debugging Applications in the POSIX Environment
    3.4 Developing a Program in the DCL Environment
      3.4.1      Using Header Files in the DCL Environment
      3.4.2      Compiling a Program from the DCL Command Line
        3.4.2.1      Compiling Source Code and Using Feature Test Macros
      3.4.3      Linking a Program using the OpenVMS Linker
      3.4.4      Running a POSIX for OpenVMS Program from DCL Level
      3.4.5      Using the OpenVMS Debugger in the DCL Environment
    3.5 Developing Specific Applications
      3.5.1      Developing Sockets Applications
      3.5.2      Developing Threads Applications
      3.5.3      Developing Curses Applications
    3.6 Major Areas of Difference between OpenVMS and UNIX
    3.7 Optimization Hints for POSIX for OpenVMS
      3.7.1      The fork( ) and ``exec'' Functions
      3.7.2      The ``exec'' Functions
      3.7.3      The fork( ) Function
      3.7.4      The open( ) and creat( ) Functions
      3.7.5      The malloc( ) , calloc( ) , realloc( ) and free( ) Functions
      3.7.6      File System Buffer Cache
      3.7.7      OpenVMS Versus POSIX-Compliant File Systems
      3.7.8      Record File Interpretation
      3.7.9      Terminal Handling
      3.7.10     System Configuration and Tuning
    3.8 POSIX for OpenVMS Inter-Version Compatibility
      3.8.1      Backward Compatibility
      3.8.2      Definition of External Variables

  4      Internationalization in POSIX for OpenVMS
    4.1 The Internationalization Standards
    4.2 The POSIX for OpenVMS Internationalization Environment
    4.3 POSIX for OpenVMS Locales
      4.3.1      Configuration Data
      4.3.2      Collating Sequence Tables
      4.3.3      Character Classification Tables
      4.3.4      Shift Tables
      4.3.5      Language Data
      4.3.6      Selecting an Application Locale
      4.3.7      Locale Naming Conventions
      4.3.8      The POSIX for OpenVMS Default Locale
      4.3.9      The locale Directory
      4.3.10     Creating a Locale Definition File
      4.3.11     Character Maps
      4.3.12     Using the localedef Utility
    4.4 POSIX for OpenVMS Message Catalogs
      4.4.1      Message Catalogs and Program Logic
      4.4.2      The Message Catalog Format
      4.4.3      Message Parameter Substitution
      4.4.4      Generating a Message Catalog
      4.4.5      Accessing a Message Catalog
      4.4.6      Message Catalog Naming and Searching Conventions
    4.5 Environment Variables

  5      Application Portability
    5.1 Portability in the POSIX Environment
      5.1.1      Application Conformance to the Standards
    5.2 Application Design Considerations
      5.2.1      The Key Design Issue:  Knowing the Target Environment
      5.2.2      Other Design Issues
      5.2.3      What Programming Language Should Be Used?
      5.2.4      Software Constraints
      5.2.5      Coding Design Considerations
      5.2.6      Performance Considerations
      5.2.7      Design Consideration Summary
      5.2.8      Programming Considerations
      5.2.9      Programming for Portability in POSIX: General Guidelines
      5.2.10     Programming for Portability in POSIX: Data Types, Structures, and Pointers
    5.3 General Issues Related to Writing Portable Programs
      5.3.1      Defining Portability
      5.3.2      General Principles of Portability
      5.3.3      Portability Issues
      5.3.4      Writing Modular Code
        5.3.4.1      Porting Programs
        5.3.4.2      Example of Porting Code
        5.3.4.3      Using Modules and Abstraction
        5.3.4.4      Procedural Abstraction
        5.3.4.5      Data Abstraction
        5.3.4.6      Object-Oriented Programming
        5.3.4.7      Encapsulating Data and behaviour
        5.3.4.8      Practical Recommendations
      5.3.5      General Coding Guidelines
        5.3.5.1      Coding Modules by Function
        5.3.5.2      Identifying and Isolating System Dependencies
        5.3.5.3      Using the Common Subset of Language and Run-Time Features
        5.3.5.4      Writing Strongly Typed Code
        5.3.5.5      Writing Explicit Code
        5.3.5.6      Leaving Optimization to the Compiler
        5.3.5.7      Understanding and Using Target Platforms
        5.3.5.8      Determining and Understanding Target Audiences
        5.3.5.9      Centralizing Shared Definitions
        5.3.5.10     Following Good Coding Practices

  Part II   POSIX for OpenVMS Functions

  6      A Guide to the Curses Interface
    6.1 Introduction to Curses
    6.2 Curses Programs
    6.3 Curses Function Variants
    6.4 Summary of the Curses Functions
    6.5 The <curses.h> Header File
      6.5.1      Data Types
      6.5.2      General Constants
      6.5.3      Video Attribute Constants
      6.5.4      Keypad Constants
      6.5.5      The Virtual Keypad
    6.6 Return Values
    6.7 Curses and terminfo

  7      Guide to Using POSIX for OpenVMS Sockets
    7.1 The Client-Server Model
    7.2 Ports
    7.3 Sockets and Device-Sockets
      7.3.1      Full-duplex Communication Path
    7.4 Socket Communications
      7.4.1      Connection-orientated Sockets
      7.4.2      Connectionless Sockets
    7.5 Out-of-band
    7.6 Internet Protocols
      7.6.1      TCP Sockets
      7.6.2      UDP Sockets
    7.7 Setting and Querying Sockets Options

  Part III   POSIX for OpenVMS Sample Application

  8      The POSIX for OpenVMS Sample Application
    8.1 Overview of the Sample Application
      8.1.1      Component Files of the Sample Application
      8.1.2      Portability of the Sample Application
    8.2 Files Supplied
    8.3 Building the POSIX for OpenVMS Sample Application
    8.4 Setting Up the Environment for the Sample Application
    8.5 Running the Sample Application
      8.5.1      Ending the Sample Application
    8.6 How to Use the Sample Application
    8.7 Detailed Program Flow
      8.7.1      Setup and Process Creation
      8.7.2      Shutdown and Process Deletion
      8.7.3      Process Synchronization - Data, Request, and Communications Flow
        8.7.3.1      Top Level
        8.7.3.2      Requesting a ``Raw Material Inventory Report''
        8.7.3.3      Requesting ``Data Entry''
    8.8 In Case of Difficulty
      8.8.1      Environment Variable Not Found
        8.8.1.1      Message
        8.8.1.2      Probable Cause
        8.8.1.3      Fix
      8.8.2      Lost Prompt
        8.8.2.1      Probable Cause
        8.8.2.2      Fix 1
        8.8.2.3      Fix 2

  A POSIX Commands

  POSIX/RUN

  POSIX/SHOW

  B Mapping of OpenVMS Exceptions to POSIX Signals

  C Curses Demonstration Program
    C.1 Curses Program

  D C Source Code Example of a Client and Server
    D.1 Source Code for a POSIX for OpenVMS Socket Client
    D.2 Source Code for a POSIX for OpenVMS Socket Server