HDTenEightyP/NetNews huggingface dataset:
From: junrue@isis.cs.du.edu (Jack D. Unrue)
Subject: Re: Please.  (Was Re: I Hope the BC++ IDE Editor Supports OLE Soon)
X-Disclaimer: Nyx is a public access Unix system run by the University
	of Denver for the Denver community.  The University has neither
	control over nor responsibility for the opinions of users.
Organization: Nyx, Public Access Unix at U. of Denver Math/CS dept.
Distribution: usa
Date: Sun, 12 Apr 92 18:49:18 GMT

In article <1992Apr12.020942.13848@mnemosyne.cs.du.edu> ebergman@isis.cs.du.edu (Eric Bergman-Terrell) writes:
>In article <kuede7INN40h@alhena.usc.edu> ajayshah@alhena.usc.edu (Ajay Shah) writes:
>>I sure hope I don't encounter your source code someday when I'm alone
>>in a dark ftp site.
>
>What are you afraid of?  You might find diagrams of my data structures.
>Wouldn't that simplify understanding the code?
>
[a whole bunch deleted]
>
>Using something like OLE, the comment block would be represented by a small
>icon, that when selected would display the text.  Inexperienced readers of
>the code would probably want to select the icon, read the text once, and go
>on.  Experienced readers would already know about the function, and would
>not need to examine the code.  Hence the code would be less cluttered with
>comments that aren't always interesting.
>>If you do so, please have an option to strip the gunk on demand.
>
[more deleted]
>Well the "gunk" is implicitly stripped.  You only get it if you ask for it
>by selecting the icon.
>

I believe the point that Ajay was trying to make (and if you weren't, Ajay,
I'll make it anyway) is that all that "gunk" represents a lot of overhead.
These illustrations are presumably stored along with the source code you would
be annotating, right?

How much longer will it take to download such annotated source?  How much more
disk space will it consume? (Consider that some people are irritated with the
fact that the popular compilers today occupy on the order of 8-10 MB, imagine
if all the supplied example source and other bits of code had your type of
annotation).

You can compress that stuff, but then the source itself is that much less
accessible.

You absolutely do want to make your code understandable by others, but my
philosophy is that properly written comments and proper programming style
should in itself handle most of the job.  If you want to expand upon an
algorithm, draw diagrams to help explain, or whatever, make that a separate
document.  Then all the "gunk" will be implicitly stripped out.

How about making the illustrations, etc., in a separate file but provide hooks
such that if the file is present, then the hypermedia links work, but if it
isn't, then they don't?
--
Jack D. Unrue
junrue@nyx.cs.du.edu
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Re: atexit exit call order
Date: 8 Apr 92 08:27:56 GMT
Organization: University of Helsinki

etxolpn@beppe22.ericsson.se (Ola Persson) writes:
>I'm using Sun ansic compiler and the function atexit. Does anybody know in
>which order the exit handlers are called when i establish more than one. Is
>this behaviour compatible?

Accordning to the ANSI standard, the functions are called in reverse
order.  You should be able to find some information about the order in
which Sun's library call them by reading the manual page (``man
atexit'', perhaps), or other documentation.

--
Lars.Wirzenius@helsinki.fi
From: ts@cup.portal.com (Tim W Smith)
Newsgroups: comp.lang.c
Subject: Re: Returning the highest bit set in a long
Date: 10 Apr 92 11:46:32 GMT
Organization: The Portal System (TM)

Assuming at least one bit is set, how about something like this:

	int HighBit( unsigned long number )
	{
		int bitnumber = 0;

		if ( number > 0x0000FFFF )
		{
			bitnumber += 16;
			number >>= 16;
		}
		if ( number > 0x000000FF )
		{
			bitnumber += 8;
			number >>= 8;
		}
		if ( number > 0x0000000F )
		{
			bitnumber += 4;
			number >>= 4;
		}
		if ( number > 0x00000003 )
		{
			bitnumber += 2;
			number >>= 2;
		}
		if ( number > 0x00000001 )
			bitnumber++;
		return bitnumber;
	}

or, if you want to take less space:

	unsigned long lowerHalf = 0x0000FFFF;
	int shift = 16;
	int bitnumber = 0;

	while ( shift )
	{
		if ( number > lowerHalf )
		{
			bitnumber += shift;
			number >>= shift;
		}
		shift >>= 1;
		lowerHalf >>= shift;
	}
	return bitnumber;

						Tim Smith
Newsgroups: comp.lang.c
From: CONSLT24@Zeus.unomaha.edu (Issa El-Hazin)
Subject: Re: a reading from keyboard. Keypress without pressing Enter.
Organization: University of Nebraska at Omaha
Date: Mon, 13 Apr 1992 00:03:17 GMT
X-News-Reader: VMS NEWS 1.11

In <92101.000401ACPS7081@RyeVm.Ryerson.Ca> <ACPS7081@RyeVm.Ryerson.Ca> writes:

> Hi
> I would like to know how can I read from keyboard without using
> return key.
> 
> 
>                                             Thanks for your help!

Here is the function you are looking for. It works like a charm, I've
never had any problems with it. To use it do this:

1) #include "sys$login:vax.i"  /* or where ever this function reside */

2) int chr;
  chr = keypress();    /* you can use arrow, pF? keys or what have you */

I hope this will help.

/-Issa-/

 
/***********************************************************************
*  VMS Keypress();                                                     *
***********************************************************************/
#include iodef
#include descrip
int keypress()
/*****************************************************************************/
/*                                                                           */
/* This routine was written by Ed Bubnis.  I would like to recognize the     */
/* head C programmer here.  Thanks a lot, Ed.                                */
/*                                                                           */
/* If you would like more (obviously) information of the SYS$QIOW ($QIOW)    */
/* function, consult the VAX/VMS SYSTEM SERVICES REFERENCE MANUAL.           */
/*                                                                           */
/*****************************************************************************/
{
struct { long length; char *address; } logical_name;
struct { short status; short length; int remainder; } iosb;
 
static char kb[] = { "sys$input" };
static int chan;
 
static char key = 0;
int new_key;
static int first = 1;
int status;
 
        key = 0;
        logical_name.length = strlen (kb);
        logical_name.address = kb;
        status = sys$assign (&logical_name, &chan, 0, 0);
        if (status != 1)
           {    printf("Error assigning channel to sys$input\n\n");
                exit(1);
           }
        status = SYS$QIOW(0, chan, IO$_READVBLK | IO$M_NOFILTR | IO$M_NOECHO
        | IO$M_TIMED, &iosb, 0, 0, &key, 1,600, 0,0, 0, 0);
        if (!key) return (0);
        else {
           new_key = (int)(unsigned)(key);
           status = sys$dassgn (chan);
           return (new_key);
        }
}
From: bwc@waikato.ac.nz (Ug!)
Newsgroups: comp.lang.c
Subject: Re: Initialisation code in ANSI C.
Date: 15 Apr 92 10:54:31 +1200
Distribution: world
Organization: Vooniersity fo Kaiwato

Arthur Rubin writes:
>Ug! writes:
> 
>>What I am doing at the moment is explicitly calling the initialisation code
>>from the main program but I would like to have it done automagically.
> 
> What is wrong with:
> 
> int module(int arg1,float arg2)
> {
> static int module_INIT= 0;
> 
>     if(!module_INIT) {
>         ...intialize module...
>         module_INIT = 1;
>     }

There's a problem with that.  The module this is for essentially must first
allocate the screen device before any reading/writing to the screen may take
place.  (By reading or writing, I am referring to pixels).

As you can imagine, having the code which draws each pixel having to check each
time whether it is initialised is not a "Good Thing" (tm).

To make matters worse, on top of that I've got a virtual screen manager which
allows you to do various things like draw lines, curves, points, etc, and
zoom them (i.e. magnify the screen to that each point is a square of pixels).

So for a simple call to draw a line, this would involve:

a)	a check to see whether the screen manager is intialised.
b)	for every pixel drawn (length of line * zoom factor squared) a check
	to see whether the pixel drawing module has been initialised.

The setup at the moment I've got is that the first check is made, and then
the initialisation code for the screen manager is called, and it explicitly
initialises the pixel module.

Even that is a pain though, since the whole idea of these things is to time
various line-drawing algorithms, and this sort of checking going on for each
line drawn doesn't help matters.  You can imagine:

"Well the first line I drew used algorithm 1, and it took one second.  The
second algorithm I used took half a second.  So algorithm 2 must be faster."

Of course, the reason algorithm 1 took one second was because it had to run
the initialisation code...

So I guess it takes a variant of the 'explicit initialisation' (i.e.
"initialise you &%&(^(*&!")...

Bruce W. Cassidy
University of Waikato
New Zealand
From: lorvig@gsg.UUCP (Don Lorvig)
Newsgroups: comp.lang.c
Subject: Re: EXPONENT
Date: 15 Apr 92 18:57:00 GMT
Organization: General Systems Group, Inc., Salem, NH

aisma@owlnet.rice.edu (Ahmad Ismail) writes:

>I am new to the C language. Can anybody tell me how to write the following
>FORTRAN code in C:

>       a=b**(1./d)

>Thanks.

exp (log (2) * 3) == 8
exp (log (2.4) *.333) = 1.338
-- 
Don Lorvig  -- Dataman Services            uucp: decvax!gsg!lorvig
From: torek@horse.ee.lbl.gov (Chris Torek)
Newsgroups: comp.lang.c
Subject: Re: CFront
Date: 15 Apr 1992 18:02:29 GMT
Organization: Lawrence Berkeley Laboratory, Berkeley
Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
NNTP-Posting-Host: 128.3.112.15

In article <1992Apr15.023754.7579@wyvern.twuug.com>
alpha@wyvern.twuug.com (Joe Wright) writes:
>I have seen much here (comp.lang.c) advising use of C++ for
>certain things because "you can't do that in C".  Isn't it
>that CFront takes C++ and outputs C?  Could one just code some
>little trick in C++, run it through CFront and see what it looks
>like in C?  Why not?

Cfront emits unreadable, unmaintainable, and machine-dependent C code.
(When you install cfront on a system, you must tell it things like
`the actual number of bits in an int is 42' or whatever.)  Here is
a piece of cfront output from a bit of real C++ code:

/* C++ code */
void Site::Handle(Event& e)
{
	if (e.eventType != DownEvent || nameMsg == 0)
		return;

	addrOn = !addrOn;
	if (addrOn || nameMsg == 0)
		msg->SetText(addrMsg);
	else
		msg->SetText(nameMsg);
	sitebox->box->Change();
	VBox::Handle(e);
}

/* cfront output, cleaned-up and reformatted */
char 
Handle__4SiteFR5Event(__0this, __0e)
	register struct Site *__0this;
	struct Event *__0e;
{
	if ((((*__0e)).eventType__5Event != 1) ||
	    (__0this->nameMsg__4Site == 0))
		return;

	__0this->addrOn__4Site = (!__0this->addrOn__4Site);
	if (__0this->addrOn__4Site || (__0this->nameMsg__4Site == 0))
		SetText__8SMessageFPCc(__0this->msg__4Site,
		    (char *)__0this->addrMsg__4Site);
	else
		SetText__8SMessageFPCc(__0this->msg__4Site,
		    (char *)__0this->nameMsg__4Site);
	Change__5SceneFP10Interactor((struct Scene *)
	    __0this->sitebox__4Site->box__7SiteBox, (struct Interactor *) 0);
	Handle__10InteractorFR5Event((struct Interactor *)__0this, __0e);

}
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov
Newsgroups: comp.lang.c
From: mcook@mrc.dev.cdx.mot.com (Michael Cook)
Subject: Re: Are 'polymorphic' structs portable?
Organization: Motorola Codex, Canton, Massachusetts
Date: Wed, 15 Apr 1992 18:59:41 GMT

bateman@hamel.epm.ornl.gov (Ken Bateman) writes:

>Can I safely assume that the offset of the 'type' and 'next' elements
>is always constant for all compilers?  i.e.:
>	union {
>		generic_elem g;
>		typeA_elem A;
>		typeB_elem B;
>	} foo;
>	assert(&(foo.g.type) == &(foo.A.type));
>	assert(&(foo.g.type) == &(foo.B.type));
>	assert(&(foo.g.next) == &(foo.A.next));
>	assert(&(foo.g.next) == &(foo.B.next));

ANSI says you can do that.  And I've never heard of a compiler that
didn't support what you're trying to do.

But the answer to your question is "no".  Surely, someone out there
has written a compiler that will break your code.  If I were you, I'd
leave those "assert" statements in the code.
-- 
 ==========================================================
 Michael.Cook@merlin.dev.cdx.mot.com          (617)821-7590
 Motorola/Codex, 20 Cabot Blvd, C2-135, Mansfield, MA 02048
 ==========================================================
Newsgroups: comp.lang.c
From: damurphy@wc.novell.com (Duane A Murphy)
Subject: Re: Do you know of "switch" for "strings" ?
Organization: Novell, Inc. - Walnut Creek
Distribution: comp.lang.c
Date: Mon, 13 Apr 1992 15:26:12 GMT

In article <KIRAN.92Apr9205954@touch.mit.edu> kiran@touch.mit.edu (Kiran Dandekar) writes:
>
>I am looking for macros/functions/tips that will enable me to use a
>"switch" construct for strings. 

For very short lists of possible strings some of the alternatives already
given are pretty good.  However, they amount to a linear string search.
I have solved this problem by using bsearch and an array of data structures.
The data structures all start with the string to be compared.  This makes
it easy to use strcmp in the bsearch function.  When bsearch returns I have
a pointer to the data structure in question.  

For the simple case, another item in the data structure would be a
simple integer type that could be used in a switch construct.  In more
interesting examples, data in question is stored in the other fields.  A 
very interesting example might have a function pointer that was executed
for each possible selection (actually, that is very cool!).  

There is one important rule.  Keep the array of data structures in
alphabetical order.  If you are unsure, use qsort on it first.

One of the disadvantages to this is that all array elements must be the same
length.  That is if the string choices are "a" and "alphabet" a static string
array would require the same storage space for both.  An alternative is to have
a pointer to a string in the array.  The bsearch function would then have to
dereference before calling strcmp.

Just some interesting ideas that I have had some success with.

...Duane

--------------
My opinions are just that _MY_ opinions.


Newsgroups: comp.lang.c
From: yltang@bree.endor.cs.psu.edu (Yuan-Liang Tang)
Subject: goto statement
Organization: Penn State Computer Science
Distribution: usa
Date: Sun, 12 Apr 1992 17:43:33 GMT


Hi netters,

    I know this may be trivial, but I simply couldn't find
an answer in the FAQ list. So, here the question comes ...

    Can I use "goto" statement to transfer control to other
function or other module than the current function?

    Thanks in advance.

/Tang

Newsgroups: comp.lang.c
From: chupchup@ferkel.ucsb.edu (Robert Earl)
Subject: Re: Is the address of a global a constant?
Organization: (EVIL!)
Date: Tue, 7 Apr 1992 14:32:18 GMT

wittig@gmd.de (Georg Wittig) writes:

| In <chupchup.702626670@piggy> chupchup@ferkel.ucsb.edu (Robert Earl) writes:

| >eric@pencom.com writes:
| >
| >| Is the address of a global supposed to be considered a valid constant?
| >
| >No.  The address-of operator (&) is just an operator and does not
| >yield a constant value.

| 	int   x[9];
| 	int * y1 = x+7;	  /* Correct */
| 	int * y2 = &x[7]; /* Wrong?  */

I was going to say that both are correct just because more latitude is
given for constant expressions as initalizers, but when gcc compiled

int g[&x[7] - &x[0]];

with no complaints, I had to think again.  Is this gcc's mistake, or
mine?


-- 
robert earl		rearl@piggy.ucsb.edu

"eenie, meenie, chili beanie, your lucky number is... C!" ---Kelly Bundy
From: jcasey@maths.tcd.ie (James Casey)
Newsgroups: comp.lang.c
Subject: gnudos ftp address
Summary: location of gnudos on a ftp server
Keywords: gnudos,gcc,ftp
Date: 10 Apr 92 16:05:10 GMT
Organization: Dept. of Maths, Trinity College, Dublin, Ireland.

I have a problem... I need to know the location of a FTP server that has gnudos
stuff on it. In particular, I am looking for gcc for a 386 PC.  

I am sorry if this is the wrong group for this post, but it was the only I could
think of that I get.

thanking you in advance,

james

-----------------------------------------------------------------------------
James Casey		|The C programming language:
Dept of Maths		|Combining the power of the assembly language with
Trinity College, Dublin.|the ease of use of assembly language...
			|----------------------------------------------------
<jcasey@maths.tcd.ie>	|God is real....
<jmcasey@unix1.tcd.ie>	|	       	       ...unless declared an integer.
-----------------------------------------------------------------------------
Xref: sparky comp.lang.c:7266 comp.std.c:1756
From: alpha@wyvern.twuug.com (Joe Wright)
Newsgroups: comp.lang.c,comp.std.c
Subject: Re: long long long long long madness
Date: 5 Apr 92 19:07:07 GMT
Organization: Tidewater UNIX Users Group

Obviously we don't really want to add new keywords to the
language just to solve an otherwise machine-related problem.
Why not compiler directives to tell it how wide we want
the standard types to be?  Something like this:

#define sizeof(long int) 8  /* Eight units of sizeof(char) */ 

A 'conforming' compiler will note the keywords and, if it can,
do what we want from then on.  If we write such a compiler, we
can use:

#define sizeof(char) 1  /* The default, of course */
#define sizeof(short int) 2
#define sizeof(int) 4
#define sizeof(long int) 8

Such a compiler could produce code which would provide 32-bit ints
and 64-bit longs on any machine, 8088, PDP-11, VAX, Sparc, R4000 or
whatever.  Let the programmer decide the width of objects.  Let the
compiler figure out how to do it most efficiently on a given machine.
-- 
Joe Wright  alpha@wyvern.twuug.com    
Newsgroups: comp.lang.c
From: spencer@screen.Princeton.EDU (S. Spencer Sun)
Subject: Re: passing structure to a function
Originator: news@ernie.Princeton.EDU
Organization: Princeton Univ. Class of '94
Date: Thu, 9 Apr 1992 21:25:01 GMT

In article <mcook.702843388@mrc.dev.cdx.mot.com> mcook@mrc.dev.cdx.mot.com (Michael Cook) writes:
>volpe@bart.crd.ge.com (Christopher R Volpe) writes:
>
>>C, whether it be ANSI or pre-ANSI, has always required that all parameters,
>>structures or otherwise, be passed by value.
>
>Except arrays.  They're passed by reference.

Actually, if I'm not mistaken, arrays are still considered passed by
value because you aren't actually passing the entire array, you're
passing the address of the first element of the array.
----------
S. Spencer Sun - Princeton Univ. Class of '94 - Dept. of Computer Science
Clockwork Orange - Princeton Ultimate (when I show up for practice)
"I'm nice... He's nice... and we're both f---ing lunatics.  Can I
come in please?"
From: psr@acsu.buffalo.edu (Ben the Crafter)
Newsgroups: comp.lang.c
Subject: Re: How do you access your mouse on using c/c++?
Date: 14 Apr 92 17:19:46 GMT
Organization: UB

matias@ecs.umass.edu writes:


>	If any one out there could answer this, I would greatly apreciate it.

>How do you go abouts accesing your mouse using turbo c or turbo c++.
>I know in Basic, there is a Mouse function, however don't know of any 
>for c.

This bugged me for some time.  The answer is, you can't.
Not with the existing routines.
There is, however, some nice person out there who wrote mouse routines!
All you have to do is link there routines with your program using a project file or just cut and paste the functions you need.
I can send you the file if you want.
E-mail me.
-- 
Strider                     | SUNY @ Buffalo | psr@acsu.buffalo.edu
Lord Mayor, The Hill People | (716) 636 4862 | V127MHSK@ubvms.bitnet

Tomorrow will be canceled due to lack of interest.
Newsgroups: comp.lang.c
From: comptec90132@camins.camosun.bc.ca
Subject: Help...Dynamic pool limit exceeded
Organization: Camosun College
Date: Wed, 15 Apr 1992 22:09:51 GMT


HELP!!!!!!!!!!

  I have this small problem that I don't understand.  I am using TopSpeed's
C compiler and I have this error?

         Dynamic Pool Limit Exceeded Procedure Too Complex

What do I do????!!!!????
The procedure in question is about 280 lines long most of which are case
statements.  (No, I did not write this code or would ever want to)

Any ideas would be welcolme.
Please send e-mail to
                   comptec90132@camins.camosun.ba.ca

mia  
Newsgroups: comp.lang.c
From: joe@proto.com (Joe Huffman)
Subject: Re: Help!Graphics screen print routine needed!
Organization: Prototronics @ Sandpoint, Idaho
Date: Tue, 14 Apr 1992 15:16:38 GMT

rcs76179@zach.fit.edu (Adnan Zejnilovic / ADVISOR M. Schneider) writes:

>I have developed a program that displays different graphs on the screen using
>Turbo C v2.0. I would like to be able to print these graphs on a dot matrix
>printer.

Try the product 'Baby Driver' from Autumn Hill Software.  It supports
hundreds of printers and works with Turbo C...

Autumn Hill Software
1145 Ithaca Drive
Boulder, Colorado 80303

Voice: 303-494-8865
FAX:   303-494-7802
BBS:   303-494-8868


-- 
uunet!proto!joe
joe@proto.com
From: kirkenda@eecs.cs.pdx.edu (Steve Kirkendall)
Newsgroups: comp.lang.c
Subject: Re: Is the address of a global a constant?
Date: 8 Apr 92 17:30:05 GMT
Article-I.D.: pdxgate.5284
Organization: Portland State University, Portland, OR

In article <1992Apr7.140112.16390@pencom.com> eric@pencom.com writes:
>The C compiler treats the address of an external variable as a constant
>sometimes, but not in others.  Why?

Do you want a pragmatic reason?

The most visible context in which a variable's address doesn't work as
a constant is in case labels.  This is because the compiler would like
to construct a branch table using the values in the case statements as
indexes into that table.  But the addresses haven't been assigned yet,
so it can't.  The linker will eventually assign addresses to the global
variables, but by then its too late.
------------------------------------------------------------------------------
Steve Kirkendall     kirkenda@cs.pdx.edu     Grad student at Portland State U.
From: hosseink@sofus.dhhalden.no (HOSSEIN KARUN)
Newsgroups: comp.lang.c
Subject: Down loading some characters
Date: 13 Apr 92 19:35:12 GMT
Organization: Ostfold College

Hello everyone -
Does anybody know if there is a program that can make and change characters
for EGA/VGA screens ? I use Turbo C ++ and I know little about assembly.

THANKS.

Hossein Hayati-Karun E-mail HOSSEINK@SOFUS.DHHALDEN.NO
Newsgroups: comp.lang.c