diff --git a/SWIG/Doc/Manual/Introduction.html b/SWIG/Doc/Manual/Introduction.html index 8cc8a3acc..403c2486c 100644 --- a/SWIG/Doc/Manual/Introduction.html +++ b/SWIG/Doc/Manual/Introduction.html @@ -67,21 +67,47 @@ in scientific and engineering projects.
-Many of the problems with C are due to the way in which -many programs are organized. For example, a lot of programs -are structured as follows: +From the standpoint of C/C++, a lot of people use SWIG because they want to break +out of the traditional monolithic C programming model which usually results +in programs that resemble this:
-In this case, the main() program may read command line -options or simple commands from stdin. However, modifying or -extending the program to do something new requires changing the C -code, recompiling, and testing. If you make a mistake, you need to -repeat this cycle until things work. Of course, as more and more -features are added, the program usually turns into a horrible mess -that is even more difficult to modify than before (although this -undoubtedly increases the job security of the programmer). +Instead of going down that route, incorporating C/C++ into a higher level language +often results in a more modular design, less code, better flexibility, and increased +programmer productivity.
-A common mistake is to assume that all of the problems with C can somehow be -fixed by using a better C---perhaps an undebuggable -language with unreadable syntax, complicated semantics, and nearly -infinite compilation time. This is an unfortunate. - -
-Perhaps a better approach is to place your application under the control -of a very high-level language such as a common scripting language -interpreter. High level languages excel at turning hard problems into -easy tasks. They also provide a nice framework for managing software components -and gluing different systems together. Not only that, they make it easy -for users to configure the software to their liking and to program it to perform -new tasks without ever having to touch a C/C++ compiler. - -
-SWIG simplifies the task of incorporating C++ code into a high-level -programming environment. Specifically, rather than creating a huge -monolithic package, SWIG allows you to restructure your application as -a collection of functions and variables that can be accessed from the -convenience of a high-level language. With this model, all of the -functionality of your C program is retained. The only difference is -that the high-level program logic and control is now driven by the -high-level language instead of a low level -main() function. - -
-SWIG tries to make the integration between scripting languages and C -as painless as possible. This allows you to focus on the underlying C -program and using the high-level scripting language interface, but not +SWIG tries to make the problem of C/C++ integration as painless as possible. +This allows you to focus on the underlying C +program and using the high-level language interface, but not the tedious and complex chore of making the two languages talk to each -other.
+other. At the same time, SWIG recognizes that all applications are different. Therefore, +it provides a wide variety of customization features that let you change almost +every aspect of the language bindings. This is the main reason why SWIG has such a large +user manual ;-).
- -
-
-In a large system, an interface might be built from a variety of pieces like this :%module foo -%include example.i // Get definitions from example.i - -... Now more declarations ... - -
-
-
- -SWIG comes with a library of existing functions known as the SWIG -library. The library contains a mix of language independent and -language dependent functionality. For example, the file -`array.i' provides access to C arrays while the file -`wish.i' includes specialized code for rebuilding the Tcl -wish interpreter. Using the library, you can use existing modules to -build up your own personalized environment for building interfaces. -If changes are made to any of the components, they will appear -automatically the next time SWIG is run.%module package - -%include network.i -%include file.i -%include graphics.i -%include objects.i -%include simulation.i - -
@@ -364,8 +323,7 @@ stresses the very limits of many C++ compilers.
+Ironically, the freedom that SWIG provides is countered by an +extremely conservative approach to code generation. At it's core, SWIG +tries to distill even the most advanced C++ code down to a small +well-defined set of interface building techniques based on ANSI C +programming. Because of this, you will find that SWIG interfaces can +be easily compiled by virtually every C/C++ compiler and that they can +be used on any platform. Again, this is an important part of staying out +of the programmer's way----the last thing any developer wants to do is +to spend their time debugging the output of a tool that relies on +non-portable or unreliable programming features. +