Dear Mr. Plauger,Thank you for your many roles in contributing to The C Users Journal, and consequently to all of us who learn from it. I would like to offer a suggestion: make the CUJ-related e-mail addresses more evident.
It was not until the most recent (Dec. '93) issue that I had a desire to send something back (question, letter to editor, etc.). Had I not been able to get my hands on the Nov. '93 issue, I would have been at a loss as to where to send my e-mail. Fortunately your Nov. '93 Editor's Forum listed the three pertinent e-mail addresses and, as importantly, what things are appropriate to send to each. I could not find this information in the Dec. '93 issue, and nervously extrapolated that future issues might not bear this information either thus my suggestion.
I'd also like to take this opportunity to appreciate your participation in the Apr./May C/C++ Conference in New Jersey this year. I recall your pragmatic, realistic perspective during your keynote address on the last day. It helped me leave the conference fairly grounded, since as a C++ newbie I felt quite afloat in the newness and the perceived Awesome Power of this brave new world (C++/OOP). I also have now heard from too many people about the book Peopleware (but from you first then), and I plan to soon devour it as well.
Qapla'
Mike Cepek
Senior Software Design Engineer
Internet: cepek@mgi.com
Management Graphics, Inc.
1401 E. 79th St.
Minneapolis, MN 55425 USA
Front desk: +1 612/854-1220
My desk/Voice mail: 851-6112 Fax: -6159We're trying to institutionalize how we present e-mail addresses, particularly with the sudden upsurge in activity on the internet. Thanks for bearing with us. And thanks for the kind words I appreciate the feedback. pjp
pjp
In December's issue, a reader Mr. Hardy asked about pcx importing in C. First, he should probably get one of the good inexpensive compilers like Turbo, Quick C, etc. But then, I have found that Genus Microprogramming's pcx toolkit is an exceptional value and the tech people are friendly and helpful. In addition, Mr. Hardy could download a handy pcx drawing program (shareware license is only $45). All in all, this would be a good budget way to get into what he wants to do.
Genus Microprogramming's number is 1 800 227 0918. Hope this helps him. :>
uunet!sosc1.sosc.osshe.edu!ferrell
Dear Sir,
This is with regard to the request for information on the PCX format in the Mail column of the December issue of The C Users Journal. I ran into a similar problem a few years ago when I started work on a conversion program to convert less supported formats like Tandy color Computer's Colormax and CoComax formats and PrintShop Master files to more popular formats like GIF & PCX. I've looked all over for information on graphics formats. The only books I've found on the market are Steve Rimmer's Bit-Mapped Graphics, Superhcarged Bitmapped Graphics, and the book Graphics File Formats (I'm not sure of the author). The Supercharged Bitmapped Graphics book has information on the PCX 24-bit format only because the other PCX formats are covered in Rimmer's other book, Bit-Mapped Graphics. I believe the books are still in print. I see them in the bookstores every so often.
While we're on the subject of formats, I could use some help with sound formats like WAV or MIDI. I've been reading a lot of books on sound for multlimedia and have books explaining how to access the data in these formats. I also have a sound command available using my Watocm C++ compiler. I'm jsut not sure how to go from the data to playing it on the PC speaker. I know there are programs around that can play sound files without using Windows calls or accesing a Soundlblaser driver. If any of the readers have any suggestions on how this could be done, I would greatly appreciate it.
I also wanted to let the personnel at The C Users Journal know how much I enjoy their magazine. Encloosed is a check for $29.95 for a one year subscription to the magazine.
Thanks.
Sincerely,
Laura Michaels
5910 Morningstar Cir, #303
Delray Beach, FL 33484Dear Mr. Plauger:
In the Dec. '93 issue, reader Lawrence Hardy asked for information on displaying PCX graphics from within a C program. I dug up these references which may help him, and list the sources I know of:
1) PCX Toolkit from Genus Software (800) 227-0918 ($229) also available at Programmer's Shop (800) 421-8006
2) PCX16 (shareware) a library of Foxpro routines to display a 16-color PCX file (2-color and 256-color routines exist also) This is on the Technotools CDROM from Chestnut Software
3) RSHPCX (shareware) library of Clipper routines (on SIMTEL)
4) CLIPFPCX (shareware) more Clipper library (SIMTEL)
5) PCX_C (shareware) C source to display a PCX file (SIMTEL)
6) TPPCX (shareware) Turbo Pascal source to display a PCX file SIMTEL and the "Source Code" CDROM from Walnut Creek)
No doubt these files and many others can be obtained from any good BBS, but I find it easier to search my own listings than to play long-distance "phone tag" with BBSs. One good place to start might be the Programmer's Corner BBS: (301) 596-7692.
As for anonymous ftp-ing from the net, I would note that although the SIMTEL server at White Sands Missle Range (wsmrsimtel20.army.mil) has shutdown as of Sept. 30, its files should be available thru its "sister" mirror server at wuarchive.wustl.edu. Also. I've seen latest SIMTEL archives on CDROM at local swaps for $20 or so. Not a bad deal for 9,000 files on all subjects.
While I am at it, I'd like to enter my own plea for help/advice in managing the increasing amount of information I need and have. Just to research this letter I referenced several catalogs, six file listings, and my terminal program's phone list. When I see the people in Star Trek get any info they want out of their computer, instantly, I get very jealous. Perhaps one of your readers has a cheap (pd?) solution that works?
If readers (or CUJ) would like a copy of any of the shareware files, they can send me a mailer, disk, and return postage. Alternatively, if the magazine would like a copy for its own library, just let me know by e-mail and I will gladly ship you a disk. Perhaps CUJ would be willing to swap for one of it's CUG library disks?
I have sent a copy of this letter direct to Mr. Hardy.
Regards,
Scott Daniels
9 Joval Street
East Lyme, CT 06333
Compuserve 73201,670PS I am finding now that each new issue of CUJ is becoming more and more pertinent to my work in C. CUJ is quickly becoming my best current reference. But please don't forget us up-and-coming C-newbies. Keep up the good work!
These three letters neatly illustrate one of the answers to the information overload friends helping friends locate pertinent data. Until we get those dedicated agents (gremlins) to scour databases on our behalf, we'll just have to know whom to ask, or when to shout for help. It ain't particularly efficient, but it is very human. pjp
Dear Mr. Plauger,
Just a word from Paris to signal a mistake in Mr. Chuck Allison's article: "Bit handling in C."
He writes:
01010101
^ 11110000 ---------- = 10100000 (== 0Xa0)but it's:01010101
^ 11110000 ---------- = 10100101 (== 0xa5)I hope a good new year for all staff of the C Users Journal.Claude Lessertisseur
Roland Moreno Technology
Groupe Innovatron
137, Bd de Sebastopol
75002 Paris, France
CL94@calvacom.frMerci. pjp
Hi Dr. Plauger,
This is a short note to inform you about a mis-type in one of your articles in you November '93 issue, "Bit Handling in C" by Chuck Allison. On page 89, the Exclusive-OR operation on 01010101 and 11110000 should be 10100101, instead of 10100000. Although this is kind of late, it seems as though nobody has caught on to it yet in your December Issue.
Anyway, your magazine is still one of the best magazines for us C and C++ users. Keep up the great work!
J. Gerald Sta. Ana
NEC Technologies, Philippines
gerald@ntep.tmg.nec.co.jpOne of my jobs is to catch gaffes like that. It got by me. By pointing it out, you both may have resolved a nagging worry on the part of a newer C programmer. pjp
In response to R.W.J. Ford's letter in the January 1994 issue of The C Users Journal:
The reason for the SH_COMPAT flag goes back to the days when DOS didn't have SHARE and didn't understand about networks and file sharing. Two programs could perfectly well open the same file, and it was up to them to deal with coordinating access between themselves.
When SHARE was introduced, a problem cropped up. If a program used SHARE, it wouldn't be able to cooperate with a program that didn't, so permitting all access by default wouldn't be possible. Similarly, programs that did not use SHARE assumed that all access would be possible, so denying any access by default wouldn't be possible either since in that case programs that worked before would simply cease working if SHARE was installed.
So SH_COMPAT, or compatibility mode, was created. If a program opened a file in this mode, SHARE assumes that the program predates SHARE and will only allow similar programs to access the file. Programs that try to open the file in any other sharing mode are denied access. If the file is open in any other sharing mode, any attempt to open it in compatibility mode is denied since the program using compatibility mode won't be able to use SHARE's services to coordinate access.
Summary: files can be opened by programs that pre-date SHARE, or by programs that understand SHARE, but not by both at once. SH_COMPAT tells DOS that the program trying to open the file pre-dates SHARE, while any other sharing mode indicates that the program understands SHARE.
Todd Knarr
tknarr@netcom.comDear CUJ,
In the January 1994 "We Have Mail" column, R. W. J. Ford asks about SHARE. It is SHARE's job to maintain the consistency of the file system on a network server. On every open, close, read, write, lock, or unlock operation referencing a local disk, DOS calls SHARE, which maintains a list of all open files on the local disks, complete with the full path specification, open mode(s), users, and locked regions. SHARE exists (almost) solely to generate DOS errors 20h ("Sharing violation") and 21h ("Lock violation").
A sharing violation occurs when a program attempts to open an already open file in a conflicting mode; attempting to open a file with read/write access in SH_DENYNO (deny none) mode, for instance, when another machine has already opened the file with read/write access in SH_DENYWR (deny write) mode, will yield a sharing violation. A lock violation occurs when a program attempts to read or write a region of a file locked (via INT 21h, function 5Ch) by another program. SHARE also contains code that can be used by servers to close all of the files held open by a particular machine a very important thing to do when a workstation crashes or is rebooted without terminating its network connections in an orderly manner!
SH_COMPATF255D (compatibility mode) is a "trick" mode used to fool non-network-aware programs into thinking they are running on a standalone machine. You would assume that if you're not interested in sharing an open file you would simply open it in SH_DENYRW (exclusive use) mode; the problem is that SH_DENYRW mode will prevent any other opens of the file, including other opens by the same program.
Multiple simultaneous opens of the same file by the same program may sound rather peculiar, but enough applications do it to make SH_COMPAT necessary. SH_COMPAT, which is simply the "old, pre-networking" open mode, is like SH_DENYWR except that it allows multiple opens in the same machine. For full sharing, i.e. to allow multiple users both read and write access to a file, you must use SH_DENYNO.
While on the subject of open modes, it is interesting to note that while you would expect DOS to open COM, EXE, and BAT files with read access in SH_DENYWR mode (so that multiple machines could execute them but no machine could modify them), it actually uses SH_COMPAT. It is possible for the network redirector to detect that a file is being opened by the EXEC system call (INT 21h, function 4Bh) and convert the open mode to something more reasonable, but applications that reopen their own EXE file must be careful not to use SH_COMPAT.
Note that SHARE need be loaded only in servers. Operations on network files are diverted before SHARE ever sees them, so SHARE has no knowledge whatsoever of files that don't live on the local disks. There are, however, a few exceptions to the "SHARE only in servers" rule; namely a few applications (written by programers who didn't really understand SHARE themselves) which won't run properly on a network (use the correct open modes and locking) unless SHARE is loaded on the workstation they use the presence of SHARE as their indication that they are running on a network. Such application should be considered broken, and they should be fixed but they do exist.
Those who are really into the technicalities of DOS may wonder where this stuff about "users" and "machines" comes from, since there are no parameters on a DOS open that carry any such information. But there is another way to call DOS, via the Server Entry Point (INT 21h, function 5D00h). Calls to the Server Entry Point are made with a register pair pointing at a structure that contains all the information that would normally be passed in the registers plus some additional information about the particular network user. DOS stores the extra information internally, then loads the registers from the structure and proceeds as if called via the normal INT 21h function. Note that this is why a number of "special disks," like some CD-ROM jukeboxes, don't work on networks their drivers don't support the Server Entry Point.
As for ensuring that data is immediately written to disk, the COMMIT system call (INT 21h, function 68h) is supposed to do just that. Be aware, however, that some networks simply ignore COMMIT!
John A. Murphy
Senior Software Sorcerer
Performance Technology
800 Lincoln Center
7800 I. H. 10 West
San Antonio, TX 78230Both of these letters offer tidy summaries. Thanks. pjp
P.J. Plauger,
I saw a question in the mail section of the January issue, and had to respond. It was a question from Delbert Bourling concerning the Maximum Entropy method of Spectral Analysis, and FFT Analysis. For the FFT part I would direct you to a book by Louis Baker called C Tools for Scientists and Engineers. There are others.
For the Maximum Entropy I have to give paper references:
"Maximum entropy spectral analysis of multiple sinusoids in noise," E.H. Satorious and J.R. Zeidler, Oct. 1978, vol. 43, pp. 111-118, Geophysics.
"A New Algorithm for Two-Dimensional Maximum Entropy Power Spectrum Estimation," JAE S. Lim and Naveed A. Malik, IEEE Trans. Acoust., Speech, Signal Processing, vol. ASSP29, pp. 401-413, June '81.
Please keep up the good work and I hope this is of use to Mr. Bourling.
Sincerely,
Andy LaCombe
andy.lacombe@sdrc.comThanks. pjp
Dear CUJ,
This is in regard to Mr. Lopez letter of January, 1994.
I purchased a copy of PC/VI in 1987 when it appeared. Unfortunately, Custom Software Systems was sued by AT&T for using AT&T's source code in their products without paying royalties. That is why it seems so much like VI, because it is!
MKS Systems offers a reasonable VI nowadays, and there are all the public-domain versions like stevie and elvis to consider as well. Mr. Lopez could search the CUJ Library for some other versions as well, or maybe he could convince AT&T to sell the VI source on the PC?
Cheers,
Richard Vireday
rvireday@pldote.intel.comDear P.J. Plauger,
I just read the Editor's forum in the December 1993 issue of CUJ. Thanks a lot for it. It makes me realize that all programmers are in the same boat. (Tight schedules, working with more things that we should at the same time.)
I am a new subscriber to CUJ but I've been reading the magazine for a while now. I enjoy the articles a lot and look forward to reading the articles about the latest hapennings for C and C++ and what the ISO C standards committee has to say.
C++ is a great language and there is still a great need to train us (most of the C programmers, and our managers) in the benefits of adopting the language for everyday development. CUJ makes has been a tool in making the transition bearable.
This message only adds to your load of mail and I apologize beforehand for any inconvenience the following request may cause. Could you please tell me how to get the source code for the samples published in the magazine? I got as far as ftp.uu.net but don't know how to download a file (mget?) when the file name is not in a DOS format. Thanks for any help you can give.
Respectfully,
Pedro@wicat.com
Jostens Learning Corp.
1875 So. State St.
Orem, UTMy added workload is small for requests such as yours I forward them to R&D to be answered by people more competent than I on the topic. I hope the staff at R&D have by now answered your download questions. pjp