ftp.nice.ch/peanuts/GeneralData/Usenet/news/1989/CSN-89.tar.gz#/comp-sys-next/1989/Nov/hackkit-binaries-posting

This is hackkit-binaries-posting in view mode; [Up]


Date: Sun 07-Nov-1989 17:02:00 From: Unknown Subject: hackkit binaries posting Since I no longer have internet access, I am going to post my friend Bill Spitzak's "hackkit" binaries in here. I am sorry I have to do this, but my mail to Gerrit bounced. Anyway, I have sent the sources to rsalz so expect them to show up in comp.sources.unix at some point. Here is the read.me -------- The HACKKIT A lot of fun programs and source code, specially designed for those who don't think the "AppKit" is the nirvana of programming environments! Written by Bill Spitzak (SPITZAK@MCIMAIL.COM), Summer 1989. THIS SOFTWARE IS FREE. IT MAY NOT BE SOLD. IT MAY BE FREELY REDISTRIBUTED AS LONG AS ALL SUPPLIED SOURCE CODE IS INCLUDED AND AS LONG AS THIS FILE AND THIS MESSAGE ARE NOT DISTURBED. YOU MAY ADD ITEMS TO IT. This code will help you program the NeXT the way computers were meant to be programmed - with low level, tricky and completely unreadable code! Seriously, I am very worried that people are being suckered into believeing a monstrous library of mysterious code with unbelievably intricate interface is considered a great breakthrough in programming. It looks a lot like old mainframe shared libraries that made it such a pain to program VMS or other such systems. Only now everybody has learned that huge "record oriented" I/O libraries are real losers, so the library writers are trying to keep their jobs by claiming that, even though reading and writing files can be done with 5 calls, only through mind-numbing complexity can you be "user friendly". No, this code is not very readable. It was originally, because I had my own library. But MY library is just as bad as Theirs, it does not tell you what you want to know: HOW TO PROGRAM THE DAMN THING! Even if I gave you the source code you would have to search through many files to figure out how it really works. So I took the code out of my library and stuck it right into these programs, so everything you need to know is right there in the listings! If I ever perfect my library, I'll include it too, but I promise it will have EVERY SINGLE SCRAP of source code, because only I will think it is "perfect", you will know better and only be happy when you can rewrite it the way YOU want it! I promise some more exciting programs in future versions of this. But this is what I could throw together for EDUCOM: All programs with source code may be recompiled by typing "make programname". See the makefile for more details. If you compile a program that calls anything in libNeXT, it will include an "objcInit" routine, which even if you don't use any objc code at all, will be called and take 1/2 second and allocate 36K of storage. Since the "dps" routines necessary to talk to the window server are in this library, you may want to avoid this. Deobjc will patch out the call in the program given as an argument. The source code is included, although it's not very exciting. The only thing here that is worth any money, this is the disassembler I wrote to get the deep dark secrets out of the AppKit routines. It can disassemble linked programs, but is really designed for disassembling .o files or .o files in libraries. If you want to disassemble the program "see", type "dis see". If you want to disassemble the "Listener" object type "dis /usr/lib/libNeXT_p.a Listener.o". You probably want to redirect the output to a file with something like "dis /usr/lib/libNeXT_p.a Listener.o >Listener.s" The disassember does a very good job of recognizing data, strings, and code. It also recognizes case statements produced by the GCC compiler, though it probably won't do anything intelligent with other types of case statements. The code is NOT guaranteed to run through the assembler (I didn't have a manual for as), it is mostly designed for human perusal. A 68030 manual will be useful. There are a few switches: -d number : Normally all numbers >127 are printed in hex, those smaller are printed in decimal. This lets you change the cutoff. Try 0 to get them all in hex. -e : Dis tries to produce "correct" assembly code for object files. This means any external references must produce a .globl declaration. Unfortunately it produces them at the points it encounters them in the symbol table, and gcc puts them in in quite unusual places. This switch causes it to not produce any .globl declarations. -g : Dis recognizes code because it is jumped to or called by other code, or if it starts at a symbol with instructions that look like a frame setup. If the code has been compiled with optimizations on so it does not produce stack frames, dis will not see non-called routines. This switch forces it to think all globals in the text segment are code. Notice that any const data will print as code too! So try it without this switch first. -p # : Dis does many passes until it has figured out what all the symbols are and added all the new symbols it needs, then prints during an extra pass. This forces it to print on a certain pass. If you know how many passes the code will take, this can save a few seconds. Also -p 0 will print on the first pass, if you also give -t it will print the symbol table unchanged. -t : Don't print the code, just the symbols (including all the jump labels generated during passes, to not get these use -p 0). -x : Print the address in hex before each line. This is probably necessary if you are disassembling an executable, especially one that is linked with a shared library, to figure out just what is going on. It should not be necessary with .o files. If anybody out there is an 'as' expert, please inform me how to fix my output so it is true assembler. I don't know even the simplest things, such as what character starts a comment. This output was made by examining the assembler output of cc and of otool. This program prints a width table for a font. That itself is not very useful. What it really does is, with 32 lines of code, show you exactly what you need to do to talk to the server using the dps library. This program makes a resizable clock that is drawn in it's own icon. You should put it, AND the file "iconclock.ps" into your ~/Apps directory, and pick "Find Applications" off the browser menu. When you run it, the clock face appears in the icon. You can resize it by grabbing any of the corners and stretching it, if you make it larger a close box will appear so you can stop it. Due to the hack needed to detect the mouse clicking in the corner, the Browser gets a bit confused. If the clock is not in the dock when it is running, you will be unable to put it in. If it is in the dock and you drag it out, the space will still seem "occupied", and if you slide the dock up and down the clock will snap back into place (quite a mess if you made it bigger than 64x64). The Browser/Application interface leaves a bit to be desired. PostScript hackers: If you hate the way the clock looks (and of course everybody except me does) you can change it! EVERY bit of postscript used is in the file "iconclock.ps". Edit it! This program makes a file containing the data for the "__ICON header" segement of a program. This segment must exist or the Browser will not think it is a real program and will not launch it correctly. If your program is named "foo" and it takes files of type "*.bar" and "*.bag" you would type "makeheader foo bar bag". You would then have to supply a .tiff file for your icon and link the rest correctly. Take a look at how qix is linked. Shows the rudiments of talking to the "pasteboard" without using the AppKit. If you just run "pbtest" it will print out the current contents of the pasteboard in all formats. If you type pbtest "THIS GOES INTO THE PASTEBOARD" it will print the current contents, then "cut" the text into it (if you want to put a newline in, type \,^Q,^J to the shell). Preview an EPS file much faster than any of those AppKit programs. Type "psview file.eps&" (or "psview -8 file.eps&" to make it 8 inches tall) and it will create a window and draw the file in it, at full Server speed. This is a really old program, and has the somewhat disingenious UI design that the way you get rid of the window is you click the right mouse button in it (so you MUST enable the right button with the Preferences). The source code shows how to drag and reorder windows, how to dump a file to the server, and how to parse those ever-useful "%%BoundingBox" comments. The classic screen-saver. Unfortunately I don't know how to make it automatically invoke on a timeout, so you have to run it by hand. Moving the mouse or hitting any key will make it exit. Source code included! Use this program like "cat", but it prints all the control characters in ^X notation. Useful for looking at those annoying WriteNow files. A replacement for the Unix strings program, this one I hope is a little smarter. Type "strings filename" to locate all the ASCII strings in a file and print them out. Works best with programs. A really basic Server PostScript tester. You must run this from the terminal, and it will send everything you type to the Server. The main selling point is that, unlike "Yap" or other AppKit programs, this sends NOTHING (almost) before the postscript you type that will modify how the Server responds. Thus you can use it to test very obscure things, and especially to test all the window commands. Since it sends nothing, there is no window to draw in when you start up. Do "x y width height newwindow" to make a window, further PostScript will draw into it. Commands that print such as "=" must be followed by a "flush". Otherwise the output remains buffered in the server. When you do a "flush" any output will be typed to stdout. [When I said "almost" nothing above, that is because when this starts up it does the following: Undefine some unfortunate things the "WindowPackage1.0.ps" code sent by the Workspace did (redefining orderwindow). define "newwindow". Of course, you can always edit the code to make testps do more or less things on startup.] Converts a .tiff file to a MacPaint file. If the input is "foo.tiff" the output is "foo.PNTG" (this is to remind you that on the Mac you must change the file type to PNTG). If the file contains more than 2 colors all the even colors turn to white and all the odd ones turn black. Also, interesting information about the .tiff file is printed on stdout. The source code shows how to read a .tiff file and how to write a MacPaint file. Sorry the comments are lousy. Another program modifier. It searches for "dd-mmm-yy" in a file and puts today's date in there. This lets a program print out when it was compiled. Print everything I can find out about the memory layout of a running Mach program. Notice the huge amount of r/w shared memory before the shared library segments, these are for static variables used by that App Kit library, and I HOPE they are copy on write!!! Type "where foo" to search the path just like the shell does and tell you where the program foo is located. Although it isn't pretty, I hope this program will provide all the information you need to make properly-working programs without using the AppKit. It is all self-contained, calling only the dps routines from the libNeXT library, and the normal C routines in libsys. (Someday I hope to decode the dps routines so you don't need them either). To use, move it into your Apps directory. Also, create a file with anything in it and call it "foo.test". Then do "Find Applications" off the Browser/Utility menu. Then you can run it by either double-clicking it or the file foo.test. It's icon is a gray hypercube. This program demonstrates how to give your program an icon, how to give it a file type, how to make other unrelated files have icons (take a look at your C source files with the Browser Icon view). It shows how to turn off the highlight in the icon when a program is launched, how to receive "unhide" messages when the icon is double-clicked, and exit when the user logs out, and how to set things up so you detect a file being dragged into a window from the Browser. It shows how to make a window, make it drag around and click to the top (above those damn icons, too!), and how to correctly inform other applications to turn their highlighting on and off when the keyboard focus changes. It also reports anything that happens to it, whether it understands it or not. This code, if you clean it up (and probably put it into a library of your own design) should serve as the core of an application. All you have to do is add a useful function to it! I hope you enjoy the HackKit. Please give it to anybody else you think would be interested in it. I will be adding to it, so please tell me what you want, or send me your additions. Files may be sent on 5.5 inch IBM-PC format floppy disks. My address is: Bill Spitzak 113 Everett St. Concord, MA 01742 And I am also at (please don't send large files here): SPITZAK@MCIMAIL.COM HAPPY HACKING!!!!! -------- Or you can send mail to me at uunet!inmet!rich. Flames to /dev/null please. Richard Man >From: woo@pioneer.arc.nasa.gov (Alex Woo)

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.