CONTENTS Title Page Copyright Page Preface 1 PDP-11 C Standard Libraries 1.1 The <assert.h> Header File 1.2 The <ctype.h> Header File 1.3 The <errno.h> Header File 1.4 The <float.h> and <limits.h> Header Files 1.5 The <locale.h> Header File 1.6 The <math.h> Header File 1.7 The <setjmp.h> Header File 1.8 The <signal.h> Header File 1.9 The <stdarg.h> Header File 1.10 The <stddef.h> Header File 1.11 The <stdio.h> Header File 1.12 The <stdlib.h> Header File 1.13 The <string.h> Header File 1.14 The <time.h> Header File 2 PDP-11 C Standard Input and Output 2.1 Streams and Files 2.1.1 Text and Binary Streams 2.1.2 Compatibility with VAX C 2.2 Streams and Operating Systems 2.2.1 RSX Operating System and Text Files 2.2.2 RSX File Attributes 2.2.3 RSX Operating System and Binary Files 2.2.4 RSTS/E Operating System and Stream Files 2.2.5 RSTS/E Operating System and Text Files 2.2.6 RSTS/E Operating System and Binary Files 2.2.7 RT-11 Operating System and Stream Files 2.2.8 RT-11 Operating System and Text Files 2.2.9 RT-11 Operating System and Binary Files 2.3 The <stdio.h> Header 2.4 Conversion Specifications 2.4.1 Converting Input Information 2.4.2 Converting Output Information 2.5 The /CP Taskbuilder Switch 2.6 Input/Output Support Package 2.7 Reserving LUNs 2.8 Program Examples 3 Character-Handling Functions and Macros 3.1 Character-Testing Macros 3.2 Character Case-Mapping Functions and Macros 4 Localization Functions and Macros 4.1 The lconv Type 4.2 The setlocale Function 4.3 The localeconv Function 4.4 Including Run-time Support for setlocale Function 5 General Utility Functions 5.1 String Conversion Functions 5.2 Pseudorandom Sequence Generation 5.3 Memory Management Functions 5.3.1 The calloc Function 5.3.2 The malloc Function 5.3.3 The realloc Function 5.3.4 The free Function 5.3.5 Program Example 5.4 Environmental Communication Functions 5.4.1 The abort and exit Functions 5.4.2 The getenv Function 5.4.3 The system Function 5.5 Search and Sort Functions 5.6 Integer Arithmetic Functions 5.7 Multibyte Character and String Functions 6 Math Functions 7 Using PDP-11 C with Record Management Services 7.1 RMS Functions 7.2 PDP-11 C and RMS Header Files 7.2.1 The <rms.h> Header 7.2.2 The <rmsops.h> Header 7.2.3 The <fab.h>, <nam.h>, <rab.h>, and <xab.h> Headers 7.2.3.1 Declaring and Initializing Control Blocks at Compile Time 7.2.3.2 Declaring and Initializing Control Blocks at Compile Time with Default Values 7.2.3.3 Setting Control Block Fields 7.2.4 The <rmsdef.h> Header 7.3 Declaring RMS-11 Facilities 7.4 Defining Pool Space 7.5 Calling Operation Macros 7.6 Writing Completion Handlers 7.7 Using Get-Space Routines 7.7.1 The RMS$GETGSA$ Routine 7.7.2 The RMS$SETGSA$ Macro 7.7.3 Receiving Parameters Passed by R0, R1, and R2 During an RMS$GSA$ or RMS$SETGSA$ Macro 7.8 Using PDP-11 C to Write RMS Programs 7.9 RMS Example Program 8 Using PDP-11 C with File Control Services 8.1 Introduction to the FCS Extension Library 8.2 Declaring and Initializing the File Descriptor Block 8.2.1 The <fcs.h> Header File 8.2.2 Compile-Time Initialization of the FDB 8.2.3 Compile-Time Initialization of the Default Filename Block 8.2.4 Run-Time FDB Initialization and the File Storage Region 8.3 File Processing 8.4 FCS Example Program 9 Operating System Services and System Directives 9.1 System Directives 9.2 RSX System Services 9.2.1 RSXDIR Function 9.3 RT-11 SYSLIB Routines 9.4 RSTS/E SYSLIB Routines 9.5 Qualifications on Using the TIME , EXIT , and ABORT Functions 10 Linkages Supported by PDP-11 C 10.1 PDP-11 C Linkage 10.2 FORTRAN Linkage 10.3 Pascal Linkage 10.4 RSX AST And SST Linkages 10.5 The RSX CSM Linkage 10.6 Linkages and Other Languages 10.7 Data Sharing with Fortran and BP2 10.8 Restrictions and Notes Reference Section 1 PDP-11 C Standard Library Macros and Functions abort abs acos _ _alr50 asctime asin _ _asr50 assert atan atan2 atexit atof atoi, atol bsearch cabs calloc ceil clearerr clock cos cosh ctime difftime div exit exp fabs _ _fbuf fclose feof ferror fflush _ _fger fgetc fgetpos fgets _ _fgnm, fgetname floor _ _flun fmod fopen fprintf fputc fputs fread _ _frec free freopen frexp fscanf fseek fsetpos ftell fwrite getc getchar getenv gets gmtime hypot isalnum isalpha isascii _ _ischar iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit labs ldexp ldiv localeconv localtime log, log10 longjmp _ _lr50a malloc mblen mbstowcs mbtowc memchr memcmp memcpy memmove memset mktime modf perror pow printf putc putchar puts qsort raise rand realloc remove rename rewind RSXDIR scanf setbuf setjmp setlocale setvbuf signal sin sinh _ _sleep, sleep sprintf sqrt srand _ _sr50a sscanf strcat strchr strcmp strcoll strcpy strcspn strerror strftime strlen strncat strncmp strncpy strpbrk strrchr strspn strstr strtod strtok strtol strtoul strxfrm system tan tanh time tmpfile tmpnam toascii tolower _tolower toupper _ _tzset ungetc va_arg va_end va_start vfprintf vprintf vsprintf wcstombs wctomb 2 FCS Extension Library Macros FCS$ASCPP FCS$ASLUN FCS$CLOSE$ FCS$CTRL FCS$DELET$ FCS$DLFNB FCS$ENTER FCS$EXPLG FCS$EXTND FCS$FDBDF$ FCS$FIND FCS$FINIT$ FCS$FLUSH FCS$FSRSZ$ FCS$GET$ FCS$GET$R FCS$GET$S FCS$GTDID FCS$GTDIR FCS$MARK FCS$MRKDL FCS$OFID$x FCS$OFNB$x FCS$OPEN$x FCS$OPNS$x FCS$OPNT$D FCS$OPNT$W FCS$PARSE FCS$POINT FCS$POSIT FCS$POSRC FCS$PPASC FCS$PRINT$ FCS$PRSDI FCS$PRSDV FCS$PRSFN FCS$PUT$ FCS$PUT$R FCS$PUT$S FCS$RDFDR FCS$RDFFP FCS$RDFUI FCS$READ$ FCS$REMOV FCS$RENAM FCS$RFOWN FCS$TRNCL FCS$WAIT$ FCS$WDFDR FCS$WDFFP FCS$WDFUI FCS$WFOWN FCS$WRITE$ FCS$XQIO 3 RMS Extension Library Macros RMS$CLOSE RMS$CONNECT RMS$CREATE RMS$DELETE RMS$DISCONNECT RMS$DISPLAY RMS$ENTER RMS$ERASE RMS$EXTEND RMS$FIND RMS$FLUSH RMS$FREE RMS$GET RMS$NXTVOL RMS$OPEN RMS$PARSE RMS$PUT RMS$READ RMS$RELEASE RMS$REMOVE RMS$RENAME RMS$REWIND RMS$SEARCH RMS$SPACE RMS$TRUNCATE RMS$UPDATE RMS$WAIT RMS$WRITE A PDP-11 C and VAX C Compatibility Issues B PDP-11 C Run-Time Modules and Entry Points EXAMPLES 2-1 Output of the Conversion Specifications 2-2 Using the Standard I/O Functions 3-1 Character-testing Macros 3-2 Changing Characters to and from Uppercase Letters 5-1 Allocating and Deallocating Memory for Structures 5-2 Searching the Environment for a String 6-1 Checking the Variable errno 6-2 Calculating and Verifying a Tangent Value 7-1 Receiving Parameters 7-2 External Data Declarations and Definitions 7-3 Main Program Section 7-4 Function to Initialize RMS Data Structures 7-5 Internal Functions 7-6 Utility Function: Adding Records 7-7 Utility Function: Deleting Records 7-8 Utility Function: Typing the File 7-9 Utility Function: Printing the File 7-10 Utility Function: Updating the File 7-11 Reserving a LUNfor Use by RMS 8-1 External Data Declarations and Definitions 8-2 Main Program Section FIGURES 8-1 PDP-11 C Integer Storage 10-1 Stack Usage Using C Linkage 10-2 Register 5 Usage Using FORTRAN Linkage 10-3 Stack Usage Using Pascal Linkage TABLES 1-1 Standard Library Header Files 1-2 Sizes of Integral Types 1-3 Characteristics of Floating Types 1-4 Signal-Handling Conditions 1-5 Variable Argument Macros 1-6 Implementation-Defined Types and Macros 1-7 String Functions 1-8 Date and Time Functions 2-1 I/O Macros and Functions 2-2 File Sizes 2-3 RSX Attributes and Behavior 2-4 Conversion Specifiers for Formatted Input 2-5 Optional Conversion Modifiers 2-6 Conversion Specifiers for Formatted Output 2-7 Optional Conversion Modifiers for Formatted Output 2-8 Optional Conversion Flag Characters 3-1 Character- and List-Handling Functions and Macros 3-2 Character Values 4-1 PDP-11 C Character-Set and Collating Sequence Locales 4-2 PDP-11 C Monetary and Numeric Locales 4-3 PDP-11 C Time Locales 5-1 Summary of General Utility Functions 5-2 Environment List 6-1 Summary of Math Functions 7-1 PDP-11 C RMS Macros 7-2 Common RMS Run-Time Processing Functions 7-3 Control Block Types 7-4 PDP-11 C Symbols for Defining Pool Space 7-5 PDP-11 C Data Structures and Headers 8-1 PDP-11 C FCS Macros 9-1 Directive Identification Codes 9-2 FIRQB and XRB Data Structures 10-1 Register Usage for PDP-11 C-Supported Linkages B-1 PDP-11 C Run-Time Entry Points