From: Greg_Anderson@afs.com (Gregory H. Anderson) Date: Thu, 2 Sep 1993 15:06:49 GMT Newsgroups: comp.sys.next.programmer Subject: comp.sys.next.programmer Frequently Asked Questions (FAQ) Archive-name: NEXTSTEP-Programming-FAQ Last-modified: 1993/09/02 Version: 1.0 Many FAQs, including this one, are available via FTP on the archive site rtfm.mit.edu in the directory pub/usenet/news.answers. The name under which this FAQ is archived appears in the Archive-name line above. Submissions, corrections, comments, input, etc., should be directed to Gregory H. Anderson . ========================================================================= TABLE OF CONTENTS 1 INTRODUCTION 1.1 Welcome to comp.sys.next.programmer! 1.2 Format of this document 2 RESOURCES 2.1 Books 2.2 NeXTAnswers 2.3 Internet Archives 2.4 ObjectWare Catalog 2.5 Other Newsgroups and Mailing Lists 3 PORTING 3.1 How difficult is it to port an existing application to NEXTSTEP? 3.2 What languages are available? 3.3 Where is ? 3.4 Where is bar(int mumble) ? 3.5 How difficult is it to port a NEXTSTEP application to other operating systems? 4 TOP 10 FREQUENTLY ASKED QUESTIONS To Be Defined in October 1993 5 CSNPanswers INDEX ========================================================================= 1 INTRODUCTION 1.1 Welcome to comp.sys.next.programmer! ---------------------------------------- This is an unmoderated forum where NEXTSTEP programmers can ask their compatriots for advice and assistance on Objective-C programming, AppKit and other NEXTSTEP kits, user interface guidelines, application development strategies, programming tools, porting to and from other operating systems, and sticky code snippets. Many of the finest NEXTSTEP programmers in the world read this group daily and offer invaluable assistance free of charge. To conserve bandwidth, scan the FAQ first when you have a problem. Otherwise ask all the questions you like and don't be shy about offering advice on how things can be improved. In the spirit of USENET, please return the favor to others once you gain facility with the platform. Contributions are encouraged, and attributions will remain attached to all information added to the FAQ. 1.2 Format of this document --------------------------- comp.sys.next.programmer is a very busy place, and many of the articles provide practical tips and source code to solve specific problems. To keep the FAQ at a manageable size without losing useful content, it has been broken into two sections: The main FAQ (this article) -- Contains embedded information about resources and commonly asked questions, with pointers to other sources for extended discussions of specific issues. CSNPanswers -- The collected lore of the NEXTSTEP programming gods is maintained in an email-accessible database at Anderson Financial Systems and an ftp-able package at several Internet archive sites. The index and instructions for accessing CSNPanswers are included at the bottom of this article. ========================================================================= 2 RESOURCES 2.1 Books --------- There are several well-regarded books on the topics of NEXTSTEP programming, Display PostScript programming, Objective-C programming in general, and object oriented design and analysis. The following abbreviated list contains the book generally acknowledged as the best in each category. Send email to CSNPanswers@afs.com with the subject "resources/books" for a full list of publishers and capsule reviews. Introduction to NEXTSTEP Programming Title: NeXTSTEP Programming Step ONE: Object-Oriented Applications Authors: Simson L. Garfinkel, Michael K. Mahoney Publisher: TELOS/Springer-Verlag, 1993 (800)SPR-INGE ISBN#: 0-387-97884-4 Abstract: A superior tutorial for beginning NEXTSTEP programmers. Crisp writing, clean organization, excellent examples. Includes diskette with source code. Display PostScript Title: Programming the Display PostScript System with NEXTSTEP Author: Adobe Systems Inc. Publisher: Addison-Wesley, 1992 ISBN#: 0-201-58135-3 Abstract: The infamous, unbeatable "Purple Book." No NEXTSTEP library is complete without it. Objective-C Title: Object Oriented Programming: An Evolutionary Approach Author: Brad J. Cox (, Andrew J. Novobilski second edition) Publisher: Addison-Wesley, 1991 ISBN#: 0-201-54834-8 Abstract: Brad Cox is the "father" of Objective-C, and this was the seminal work on the subject. In addition, the first five chapters provide an excellent introduction to object concepts, irrespective of language implementation. Object Oriented Analysis & Design Title: Object-Oriented Design With Applications Author: Grady Booch Publisher: Benjamin/Cummings, 1991 ISBN#: 0-805-30091-0 Abstract: A classic. Covers design notation and methodology. 2.2 NeXTAnswers --------------- NeXT Inc. maintains this public list of known bug workarounds and helpful examples for frequently asked questions. Articles are available through anonymous ftp from ftp.next.com (129.18.1.3). Read the help file pub/NeXTanswers/README for the latest contents. There is no package with the entire database, but you can use MGET to pull the whole directory. This location also provides MiniExamples and patches. For email access, send mail to nextanswers@next.com with "index" as the subject. An automated system will mail back a list of all current topics and instructions on how to retrieve them individually. 2.3 Internet Archives --------------------- Public domain materials and demo packages are available through anonymous ftp at several archive sites, including sonata.cc.purdue.edu and cs.orst.edu. There you will find John Glover's UHOOP tutorial and another package called IBTutorial, as well as numerous public domain classes and palettes. See the general FAQ in comp.sys.next.announce for a complete list, including international sites. 2.4 ObjectWare Catalog ---------------------- One of the greatest advantages of object oriented programming is the ability to leverage other programmers' work. NeXT publishes an annual catalog with shipping third party objects. Before undertaking new work, especially in base classes, scan the ObjectWare catalog to see if it already exists. Plus, we really need the money. 8^) 2.5 Other Newsgroups and Mailing Lists -------------------------------------- Many other USENET newsgroups provide forums for topics of interest to NEXTSTEP programmers, and NeXT forums exist on other online services such as CompuServe. There are also several unmoderated mailing lists. Other USENET Newsgroups comp.sys.next.advocacy Flamewars, arguments about whether NeXT will survive until your product ships comp.sys.next.software Help with shrink-wrapped applications comp.sys.next.hardware Black hardware problems and white hardware configuration comp.sys.next.sysadmin System and network administration comp.object Object oriented analysis and design; OO tools and platforms; extensive FAQ comp.databases.object Object oriented databases comp.lang.objective-c Objective-C for all platforms comp.lang.c NOT object oriented comp.lang.c++ For the truly desperate 8^) comp.lang.postscript PostScript and Display PostScript comp.os.mach The Mach kernel underlying NEXTSTEP comp.soft-sys.nextstep Less traffic than comp.sys.next.* gnu.gcc.* and gnu.gdb.* Help with the compiler and debugger gnu.emacs.* When you don't want anything better 8^) Other On-Line Services CompuServe - GO NEXT Mailing Lists To subscribe to any of the following groups, send email to -request@ with the Subject "subscribe". For example, to subscribe to next-prog, send email to next-prog-request@cpac.washington.edu. List Purpose Listserver ------------- ----------------------------- ------------------- next-prog Much of the same material as cpac.washington.edu comp.sys.next.programmer next-l NeXT in general antigone.com next-icon Fun pix, mail/dir tiffs gun.com ixkit IndexingKit issues digifix.com rman Renderman and 3DKit issues aero.org gnu-objc FSF implementation of Obj-C/ prep.ai.mit.edu other tools under development info-cvs CVS interface to RCS, popular prep.ai.mit.edu group project source control ========================================================================= 3 PORTING 3.1 How difficult is it to port an existing application to NEXTSTEP? -------------------------------------------------------------------- As with any move to a new operating system, porting effort depends on whether the program was designed with portability in mind. It also helps if the existing application was implemented in an operating system with an event-driven graphical user interface, because that is the interaction paradigm NeXT users expect. For such programs, you will probably find that the AppKit's maintenance of the event loop removes a significant burden from your existing code. If your core code is written in C or C++, you should have very few problems recompiling. Depending on the source operating system and the age of the code, you might need to use the -bsd, -traditional, and/or -ansi command line flags to compile without complaint. The rest of the effort depends on how well your user interface is segregated from your core implementation. It's usually quick and easy to rebuild the visual portion in InterfaceBuilder (the NEXTSTEP user interface tool). For database access, DBKit provides adapters for all major SQL-driven client/server database engines. DBKit has its own style, but if your program already knows how to generate SQL text, there's a simple method (evaluateString:) to pass it right through. If the source environment is X-Windows, you should be able to recompile without modification under one of several X implementations that has been ported to NEXTSTEP. For commercial applications, consider this a stopgap measure to get up and running, not a final solution. Prior experience in the NEXTSTEP community has shown that users shy away from non-native applications unless a native port is under construction. If the source OS was not event oriented (such as MSDOS), your task will be harder. Since NEXTSTEP users expect to have control of when and why things happen, your code will probably need to be reorganized to remove assumptions about what will always happen in a particular order. In this case, rethink the problem and start from scratch. 3.2 What languages are available? --------------------------------- The favored language for NEXTSTEP programming is Objective-C, a minimal extension of ANSI standard C with a dynamic messaging syntax and runtime system. The native compiler delivered with the Developer package is derived from the Free Software Foundation 'gcc' compiler. It will digest ANSI C, Objective-C, and C++ source code. Objects to be manipulated by InterfaceBuilder MUST have their inter-object messaging methods implemented in Objective-C. Internal implementation can be in other languages, if desired. Other available languages include: Ada, APL/J, BASIC, C++, CraftMan, Eiffel & Sather, Forth, FORTRAN, FP, gawk, ICON, Intercal, Lisps (ACL, AKCL, Elk, Scheme, Xlisp), Logo, ML(CAML, SML), Pascal, PCN, Perl, Prolog, and TCL. For Unix shell programmers: ksh, bash, zsh, rc are available. Send email to CSNPanswers@afs.com with the subject "resources/languages" for a list of publishers and capsule reviews. 3.3 Where is ? ---------------------- NEXTSTEP's genealogy can be traced down the BSD branch of the Unix tree, so /usr/include is a mixture of BSD and ANSI headers. Programs written for SystemV and its variants may contain references to header files that do not exist in the Berkeley Standard Distribution. Known problems include , , and . and may also cause confusion because most configures just check to see if these files exist. Both exist under NeXTSTEP, but NEXTSTEP uses the BSD version, dir.h. In general, the best strategy is to remove the offending header reference and recompile. Often header files are included through force of habit, not absolute need for the symbols they define. If the missing header file leads to undefined symbols in the compiler, research the reference. It may be that the undefined reference goes along with a library function that is not provided in NEXTSTEP (see next section). Otherwise, look up the problematic symbol on the source OS, and define it in your own header file of the same name. 3.4 Where is bar(int mumble)? ----------------------------- Just as some header files are missing, so are some standard functions from other Unix variants. Known culprits are putenv(), mmap(), strdup(), and System V shared memory calls. mmap() is available in the Mach kernel, but it's not documented in any header file. Source code for all missing functions (including an alternate implementation of mmap) is available; see the CSNPanswers index for further information. 3.5 How difficult is it to port a NEXTSTEP application to other operating systems? --------------------------------------------------------------- As with importing, exporting effort depends on whether the program was designed with portability in mind. (You *do* have your NeXT user interface segregated from your core implementation, don't you?) You will probably want to stick with 32-bit event-driven GUIs. Objective-C compilers are available for Solaris and other flavors of Unix (gcc) and Windows (Berkeley Productivity Group's Objective-C Extensions for the Borland C++ compiler). A somewhat crippled compiler is also available for the PenPoint mobile operating system (Novotech). It is recommended that you use native tools for building user interface objects and database access, then layer those pieces against your core Objective-C code. On Windows, for example, you might use Visual C++ to build the UI and Access to connect to the database. This solution is not optimal, but it is the best strategy currently available. ========================================================================= 4 TOP 10 FREQUENTLY ASKED QUESTIONS CSNPanswers is the definitive source of NEXTSTEP programming wisdom, but some questions occur so frequently that they are included here to save you the trouble of looking them up. This section will be defined in the October release of the FAQ, based on the frequency of questions encountered while building the CSNPanswers database. In the meantime, sit tight. ========================================================================= 5 CSNPanswers INDEX Anderson Financial Systems maintains this collection of the "best of c.s.n.programmer" as an extension of the FAQ. Beginning October 1, 1993, this information will be available through anonymous ftp on cs.orst.edu as CSNPanswers.tar.Z, and will be updated monthly. For email access beginning September 1, 1993, send mail to CSNPanswers@afs.com with the indicated keyword as the subject. Since AFS has a dialup connection to the Internet, please do not abuse this service by asking for more than you need at one time. Violators will be cored and dumped. All useful articles posted to the group will be added to the database. If you answer a question privately through email, please consider sending a cc: to CSNPsubmit@afs.com so that all may benefit from your expertise in the future. All articles added to the CSNPanswers database will retain their original attribution, unless anonymity is requested. The following articles are available as of September 1, 1993, and more are being added daily. By the end of September, this list should be about 10 times longer, as archived material is formatted and added to the database. Submissions of useful older articles are welcomed, but please wait until after the October release, to avoid duplication and excess work for me. Special thanks go out to Alex Blakemore (alex@cs.umd.edu) and Tim Bissell (tim@ursidae.demon.co.uk) for contributing their personal c.s.n.programmer archives to the creation of this database. Keyword Description --------------------- ------------------------------------------------- appkit/DrawWithText Using a Text object to draw random strings appkit/FormEditing Telling a Form how to select the next text cell appkit/NXBrowserBasics Building a single-column browser appkit/NXBrowserTags Setting tags in NXBrowserCells appkit/OpenPanelBasics Getting selected file(s) from an OpenPanel appkit/paginateText Text object pagination methods appkit/stringRules Rules for how objects copy strings and frameRects appkit/WindowCapture Capturing a Window image dbkit/DBTableView Using a DBTableView without the rest of DBKit dbkit/storedproc Using Sybase stored procedures misc/disklabels Encapsulated PS for making Avery 5196 labels objc/corefiles Enabling core files when a program dumps objc/ptrtofunc Specifying functions pointer in method definitions postscript/focusing Optimal use of lockFocus/unlockFocus/flushWindow postscript/printBitmap Print bitmap image stored in a View subclass postscript/setmouse Set the mouse location programmatically resources/languages An annotated summary of programming languages sources/dertf.l A lex grammar for stripping rtf to ascii sources/EditListener Access Edit.app from other programs (3.0 & higher) sources/eps2tiff.m Converts .ps and .eps files to tiff format sources/putenv.c putenv(), setenv(), unsetenv(), getenv() sources/rtfascii.c rtf-to-ascii filter tools/fatflags Command-line compile multi-architecture (fat) app tools/IBcategories Parsing categories into InterfaceBuilder tools/IBTestMode Determining when you are running in IB test mode tools/nibConnections Dropped connections after loadNibFile: tools/palette2to3 Converting a 2.1 palette to a 3.x palette tools/paletteLibrary Making a library from the code on a palette unix/getetherid Get Ethernet ID for host =========================================================================