The AIX Operating System provides many tools to help you develop C language programs. To access these tools, you enter a command on the command line. The tools provide help in the following programming areas:
Subroutines and shell commands are provided for use in a C language program.
The system has a line editor called ed for use in entering a program into a file. The system also has the full-screen editors INed (or e) and vi. These editors display one full screen of data at a time and allow interactive editing of a file.
The following commands allow you to check the format of a program for consistency and accuracy:
|lint||Checks for syntax and data type errors in a C language source program. The lint command checks these areas of a program more carefully than the C language compiler does, and displays many messages that point out possible problems.|
|cb||Reformats a C language source program into a consistent format that uses indentation levels to show the structure of the program.|
|cflow||Generates a diagram of the logic flow of a C language source program.|
|cxref||Generates a list of all external references for each module of a C language source program, including where the reference is resolved (if it is resolved in the program).|
To make source code into a program that the system can run, you need to process the source file with a compiler program and a linkage editor.
A compiler is a program that reads program text from a file and changes the programming language in that file to a form that the system understands. The linkage editor connects program modules together and determines how to put the finished program into memory. To create this final form of the program, the system does the following:
Other programming languages available for use on the operating system include the FORTRAN, Pascal, and Assembler languages. Refer to documentation on these programming languages for information on compiling and linking programs written in them.
You can write parts of a program in different languages and have one main routine call and start the separate routines to execute, or use the cc program to both assemble and link the program.
The following debugging tools are available for use:
When syntax errors or parameter naming inconsistencies are discovered in a program file, a text editor or string-searching and string-editing programs can be used to locate and change strings in the file. String-searching and string-editing programs include the grep, sed, and awk commands. To make many changes in one or more program files, you can include the commands in a shell program and then run the shell program to locate and change the code in the files.
Two facilities are provided to help you control program changes and build a program from many source modules. These commands can be particularly useful in software development environments in which many source modules are produced.
The make command builds a program from source modules. Since the make command compiles only those modules changed since the last build, its use can reduce compilation time when many source modules must be processed.
The Source Code Control System (SCCS) allows you to maintain separate versions of a program without storing separate, complete copies of each version. The use of SCCS can reduce storage requirements and help in tracking the development of a project that requires keeping many versions of large programs.
Subroutines from system libraries handle many complex or repetitive programming situations so that you can concentrate on unique programming situations. See "Subroutines Overview" for information on using subroutines and for lists of many of the subroutines available on the system.
You can include the functions of many of the shell commands in a C language program. Any shell command used in a program must be available on all systems that use the program.
You can then use the fork and exec subroutines in a program to run the command as a process in a part of the system that is separate from the program. The system subroutine also runs a shell command in a program, and the popen subroutine uses shell filters.
Beginning with AIX Version 4.2, the operating system is designed to support the X/Open UNIX95 Specification for portability of UNIX-based operating systems. Many new interfaces, and some current ones, have been added or enhanced to meet this specification. Beginning with Version 4.2, AIX is more open and portable for applications.
The default AIX environment is one that maintains compatibility with previous AIX releases. This is accomplished by the creation of a new environment variable, which can be used to set the system environment on a per-system, per-user, or per-process basis. To obtain an environment designed to conform to the UNIX95 specification, the environment variable XPG_SUS_ENV must be assigned the value ON.
When XPG_SUS_ENV is set, every program in that environment will operate in the UNIX95-specified operating system environment. It is possible that some applications compiled for the AIX environment (perhaps for an earlier version of AIX) will not operate correctly when XPG_SUS_ENV is set. If XPG_SUS_ENV is set to any other value, or is unset, the default AIX behavior will be used.
Beginning with AIX Version 4.3, the operating system is designed to support the X/Open UNIX98 Specification for portability of UNIX-based operating systems. Many new interfaces, and some current ones, have been added or enhanced to meet this specification, making AIX Version 4.3 even more open and portable for applications.
At the same time, compatibility with previous AIX releases is preserved. This is accomplished by the creation of a new environment variable, which can be used to set the system environment on a per-system, per-user, or per-process basis.
Manipulating Strings with sed.
m4 Macro Processor Overview.
Creating an Input Language with the lex and yacc Commands.
Message Facility Overview for Programming.
make Command Overview.