HDTenEightyP/NetNews huggingface dataset:
From: scotth@felix.filenet.com (Scott Hopson)
Newsgroups: comp.lang.c
Subject: Re: help REAL TIME CLOCK INTERRUPT
Date: 21 Aug 92 05:58:47 GMT
Reply-To: scotth@fritz.filenet.com (Scott Hopson)
Organization: FileNet Corp., Costa Mesa, CA

In article <1992Aug18.043938.20502@cs.uow.edu.au> u8800914@cs.uow.edu.au (Mohammad Salim Olime) writes:
>For simulation of an ATM link between to IBM-PC/AT I need to generate
>packets(pay load)  in real time using Turbo C under MS-DOS .
>Interrupt 08h ie the clock tick with a frequency of 18.2 Hz is not 
>fast enough. In C User Journal Dec 1991  I found an article
>by Paul A. Cornelius titled "Using 1KHz Interrupts on AT CLones"
>He discusses a method for generating interrupts at a rate of 1KHz
>using the Real Time clock interrupt (70h) which can be enabled 
>through BIOS INT 15h, function 83h.

>> misc deleted <<

To an interrupt on the PC running DOS you need to trap the interrupt,
execute your own code, and resume the trapped interrupt or clean up
like the interrupt would. In the case of the TIMER interrupt you can
execute your own code and let the interrupt continue on. If you don't
let the interrupt finish the processing things will get really messed
up. Below is an example of how to VECTOR the INT 70 Real Time Clock 
interrupt.

--------------------------------CUT HERE----------------------------------

#include <dos.h>

static int counter = 0;

void interrupt (*old_int70)();	    /* save addres of old INT 70 code */

void interrupt int70(void)
{

    /* perform your own code here */

    old_int70();	    /* call the original handler */

/* if you want to by pass the original handler you will need to perform */
/* the following Magic Rituals inorder to satisfy the god of DOS. */
/*
    outport(0x20,0x20);	     send EOI to PIC  
*/
/* this call sends an End Of Interrupt to the Programmable Interrupt
   Controler
*/
}


main()
{

    old_int70 = getvect(0x70);	/* get and save old handlers address */
    setvect(0x70,int70);	/* set new address for int handler routine */

    /* perform work */

    setvect(0x70,old_int70);	/* restore original int handler */
    exit(0);			/* before you exit or you'll crash */
}				/* the system */

--------------------------------CUT HERE----------------------------------


This is basically what you need to do, you need to make sure your code
executes within the 1K time slice or the system may begin to slow or
do other strange things. Note that this is a very simple example. You
will need to experiment on your own with your own code.

-- 
Scott Hopson   (scotth@filenet.com)
Xref: sparky comp.lang.c:12483 gnu.gcc.help:1932
From: quanstro@lars.StOlaf.edu (goon)
Newsgroups: comp.lang.c,gnu.gcc,gnu.gcc.help
Subject: Re: gcc-cpp chokes: bug or feature?
Date: 18 Aug 92 14:39:59 GMT
	<1992Aug15.052021.26476@oracle.us.oracle.com>
Organization: St. Olaf College, Northfield, MN USA

In article <1992Aug15.052021.26476@oracle.us.oracle.com> wkaufman@us.oracle.com (William Kaufman) writes:
       Well, it's got to check for an #endif, right?  The #endif here
   doesn't count, but it does have to look at it,...  This one: "

   #endif

   " doesn't count either, because it's contained in quotes: it's a
   character literal, not a preprocessor directive.  Neither is: /*

False. This is not legal input to cpp. Cpp cannot deal with a multiline quote
because lines are significant and separate preprocessor tokens (not C tokens).
From: warninm@xanth.CS.ORST.EDU (Michael Warning)
Newsgroups: comp.lang.c
Subject: Ragged arrays of type long?
Date: 15 Aug 92 05:26:49 GMT
Article-I.D.: CS.1992Aug15.052649.20308
Organization: Oregon State University

Is it possible to create a ragged array of type long?  My references goes on
for two pages about how neat ragged arrays of strings are, but says nothing
about any other data type.

For example:

	static char   *try1[] = {"abc",
				 "wxyz"};

This works fine, but:

	static long   *try2[] = {{1, 2, 3},
				 {5, 6, 7, 8}};
				
This causes the various flavors of MS-C that i've tried to come up with a 
'Different levels of indirection' error.  This is the only syntax that I 
could come up with that made sense.

So is there any way to do this easily, or am I stuck with manually allocating
memory for each row and setting each element individually?  Please respond
via e-mail as I don't normally read this group.

Thanks,
					-Mike
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: Knight's tour
Date: 13 Aug 92 03:57:53 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <1992Aug12.160827.11332@seas.smu.edu>, pedersen@seas (Ted Pedersen) writes:
>Anyone out there have any nice Knight's Tour code (or know where it can
>be readily obtained)?  

You might try checking out the "8 Queens" solution in _The Icon Programming
Language_, by Griswold & Griswold (lots of other places too; that's just
where I've seen it recently).  It's a similar problem, and its solution
should suggest a solution for the "Knight's Tour" problem.

-- 
Dave Schaumann			dave@cs.arizona.edu
Newsgroups: comp.lang.c
From: werner@getrz.gez.ch (Werner Schweizer)
Subject: c compiler
Organization: Grapha Electronic AG, Zofingen
X-Newsreader: Tin 1.1 PL4
Date: Tue, 18 Aug 1992 09:45:37 GMT

[ Article crossposted from comp.os.coherent ]
[ Author was Christof Frey ]
[ Posted on Fri, 14 Aug 1992 12:25:11 GMT ]

Is ther a ANSI-C compiler available for coherent ?

Thanks
Chris

--

Grapha Electronic AG            Werner Schweizer        +41 62 504 356
Untere Bruehlstrasse 15         werner@gez.ch
CH-4800 Zofingen
Switzerland
From: castello@remus.rutgers.edu (Vicente Castello)
Newsgroups: comp.lang.c
Subject: Question about MS C/C++ Compiler 7.0
Keywords: MS C/C++ Compiler 7.0
Date: 16 Aug 92 19:33:15 GMT
Distribution: inet
Organization: Rutgers Univ., New Brunswick, N.J.


	I have had the opportunity of experimenting with the latest C
compiler from Microsoft. While running a few tutorials, I have
encountered a few problems. The problem that I get most often deals
with memory. 
	When I compile the single-module programs from the tutorial,
the program is compiled, linked, and executed successfully. However,
when I try to compile a multi-module program, I am always getting an
error that complains about the lack of far heap space. This error is
associated with a lack of memory. 
	If you have experienced this same problem with this compiler,
I would appreciate if you can offer solutions. The programs that I
am trying to run are small. I am not dealing with code of 25,000
lines.
	I am running the Programmers Workbench straight from DOS.
Since I am not using Windows, I have installed 386MAX in order to run
my programs from DOS. Before I run PWB, I have 625K available in the
low-DOS area. The machine that I am using is a 386/20 with 4MB of RAM.
	
--Vicente Castello
From: scotth@felix.filenet.com (Scott Hopson)
Newsgroups: comp.lang.c
Subject: Re: Computer terms
Date: 18 Aug 92 13:22:00 GMT
Reply-To: scotth@fritz.filenet.com (Scott Hopson)
Organization: FileNet Corp., Costa Mesa, CA


OK, so let's see if I can get it straight this time.....

*foo[] is an array of pointers.

-- 
Scott Hopson   (scotth@filenet.com)
From: linden@positive.Eng.Sun.COM (Peter van der Linden)
Newsgroups: comp.lang.c
Subject: Re: Pointer/address reluctance
Date: 15 Aug 92 00:19:06 GMT
Organization: Sun Microsystems, Mt. View, Ca.
NNTP-Posting-Host: positive

I take the point that some folks like to distinguish 
between pointers and addresses because of unusual hardware
that may include capability or offset bits.  

However, Joe put his finger on the nub of this by pointing
out (heh!) that we may simply expand our informal concept 
of "address" to include these as desired.

And I find it implausible in the extreme that "an address 
constant is not an address".   Does this mean that a case
would be made that an integer constant is not an integer?

We have an "address-of" operator, rather than a "pointed-to" operator.
It appears that addresses are in the standard however informally.
I suspect that people are distinguishing between "pointer"
and "address" out of a misguided desire to over-generalize.
Some things are best dealt with in concrete terms, and C is
no stranger to this.


--
linden@eng.sun.com|| P. van der Linden and his uncustomary theories.
Go Giants!! Don't || When solving a "panic" you must first ask yourself what you
stop at Florida...|| were doing that could possibly frighten an operating system.
From: tiok_ks@tac.fi
Newsgroups: comp.lang.c
Subject: Re: POWER OF LARGE NUMBERS
Date: 19 Aug 92 11:06:02 GMT
Organization: City of Tampere

In article <thompson.714156001@daphne.socsci.umn.edu>
thompson@atlas.socsci.umn.edu (T. Scott Thompson) writes:

> Alright!  Who volunteers for 7 ^ (7 ^ 7)?
>                                 ...
>                              10 ^ (10 ^ 10) ?
> 
> P.S.  Mathematica 2.1 on a Sparc 2 does 6 ^ (6 ^ 6) in 5.02 CPU seconds.

OK, I can do the latter one - after all, it's greater:

1E+10 000 000 000

It took about 4 seconds of my personal CPU, but my
hands are slow, so it took about 10 secs of I/O time.
But after all, that's an exact number... ;-)

Now, who's going to calculate the smaller ones, like
7 ^ (7 ^ 7) ?
-- 
--------------------------------
Kimmo Surakka     tiok_ks@tac.fi
From: kevin@sherman.pas.rochester.edu (kevin mcfadden)
Newsgroups: comp.lang.c
Subject: Continuous Updating
Date: 18 Aug 92 14:53:25 GMT
Distribution: na
Organization: University of Rochester

First off, thanks to those who replied to my message about monitoring a file.

Secondly,  I have a question (which begets more questions :)

	1) Is there a way to monitor the update file so that when it is changed 
		it is detected almost immediately and then read in?  I have come up
		with three methods:
			a) using some sort of loop that checks when it
				comes to that part of the loop [extremely inefficient],
			 
			b) the program	is being written w/ the help of devGuide
				(openwindow development tool) and the update function
				can be triggered by a mouse moving in or out
				of a window [mouse has to be moved, can't monitor on its own], and
			
			c)  have another program monitor the file and then send an update
				to the gui [ don't know it is possible for an outside program
				to send commands into the openwindows program or be able
				to execute openwin commands from the outside
				that pertain to the other program] 

Any help is greatly appreciated!

Kevin
From: john@bnrmtl.bnr.ca (John Hickin)
Newsgroups: comp.lang.c
Subject: Byte Order Question
Date: 20 Aug 92 13:16:14 GMT
Reply-To: bnrmtl!john@larry.mcrcim.mcgill.edu
Organization: Bell Northern Research Montreal, Canada.

Forgive me if this is a FAQ but here goes.

Suppose int's are 2 bytes.  Then division of a positive number by 256 should
retrieve the most significant byte of the int.  What about a right shift by 8?
My suspicion is that the result of the shift of a positive number could depend
on whether the byte order is big or little endian.  Is my suspicion correct?

-- 
John Hickin      Bell-Northern Research, Montreal, Quebec
(514) 765-8888   bnrmtl!john@larry.mcrcim.mcgill.edu
From: torek@horse.ee.lbl.gov (Chris Torek)
Newsgroups: comp.lang.c
Subject: Re: Memory alignment of struct elements
Date: 17 Aug 1992 18:26:20 GMT
Organization: Lawrence Berkeley Laboratory, Berkeley
Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
NNTP-Posting-Host: 128.3.112.15

In article <adam.714060134@mcrware> adam@microware.com (Adam Goldberg) writes:
>That's all well and good, but what if, say, you are coding an implementation
>of LIM EMS 4.0, which takes as a parameter a structure which, in assembler,
>looks like [radically machine-dependent example omitted].

>Is there any standard way to FORCE the C Struct to be identical to the
>Asm struct?

Well, obviously if you are talking about coding for compatibility with
a specific assembler interface, you are throwing portability off the
top of the Sears Tower (never to be seen again), so you buy the C
compiler that comes with the appropriate compilation directives---as
compile-time options or `__packed' keywords or #pragma's or whatever
---and use those.

To paraphrase a famous statement, ``If you want assembly language, you
know where to find it.''  It is no good asking for C to be portably
nonportable.  Some machines---like the ones I use---are physically
incapable of accessing unaligned data.  (It causes a machine fault.)
-- 
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: mjs@hubcap.clemson.edu (M. J. Saltzman)
Subject: Re: problems with atof() 
Organization: Clemson University, Clemson SC
Date: Thu, 20 Aug 1992 18:06:45 GMT

In article <GANESH.92Aug20121638@karp.albany.edu> ganesh@cs.albany.edu (Ganesh Murugesan) writes:
>In article <1992Aug20.125252.3451@dxcern.cern.ch> nilo@atdigarfield.cern.ch (Operator) writes:
>
>>   Hello!
>>
>>   I have a problem withe the atof() function, you know string to double 
>>  conversion. 
>>   I can not figure out where the error is, so any help will be really really appreciated.
>>
>
>
>Include  <math.h> and it will work. Else C compiler takes atof
          ^^^^^^^^
Umm, isn't that supposed to be <stdlib.h>?

>return value as int by default and hence returns a junk value.
>
>Also may be better to link the math libraary lm while compiling.

I don't think this is necessary.

>It works if U do these.
>
>Ganesh
>


-- 
		Matthew Saltzman
		Clemson University Math Sciences
		mjs@clemson.edu
Newsgroups: comp.lang.c
From: pynq@quads.uchicago.edu (George Jetson)
Subject: Prototypes: Aren't they supposed to catch me when I do this?
Summary: (I know this is a stupid question - Don't waste time flaming me)
Reply-To: pynq@midway.uchicago.edu
Organization: D. J. Dougherty & Associates
Date: Wed, 12 Aug 1992 18:42:22 GMT

I am writing a (very small, but its a prototype for someting bigger)
program in Borland C++ (2.0).

I have <include>d stdio.h, stdlib.h, string.h, and malloc.h.
<malloc.h> includes a prototype for calloc:

	void _FAR *_Cdecl calloc (size_t __nitems, size_t __size);

And size_t is typedef'd to unsigned (16 bits in this environment).

Now, I (stupidly) wrote:

	long n;
	somepointer = calloc(n = atol(somestring),sizeof(struct something));

Which didn't work (but it compiled clean) because the first arg is a
long.  Changing the declaration of n to size_t (& atol to atoi) fixed
the problem.

Now, my question is, shouldn't I have gotten at least a warning from the
compiler about this?

************************************************************************
Please don't drink the battery acid, it tastes bad and will hurt you.
Also, don't bite the tyres, especially when the bike is moving.
(Our lawyers made us put this in this manual.)

	- pynq@quads.uchicago.edu, who is still costing the net
	  hundreds, if not thousands, of dollars, every time he posts -
************************************************************************
From: sbrant@npal.rn.com
Newsgroups: comp.lang.c
Subject: turboc help please.
Date: 18 Aug 92 12:39:08 GMT
Organization: PalNet -- Indianapolis, Indiana

Hello:
	
	When using turbo c, I have been running into a memory problem.

	It stops compiling and says out of memory.

	I am running dos 5.0 on a 386 with 4 megs of memory.  The options in
	turbo c says Available Memory is only 270K.

	Could someone help me with this please?  How do I change the
	memory available setting so I can use more of the 4 meg of memory?



	
-- 

                                                     Steven B. Brant
________________________________________________________________________
       -->> sbrant@npal.rn.com <<--[ or ] -->> nstar!towers!npal!sbrant <<--
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Re: How can a program know where it was invoked?
Date: 13 Aug 92 12:12:13 GMT
Organization: University of Helsinki

ebergman@nyx.cs.du.edu (Eric Bergman-Terrell) writes:
>What about looking at argv[0].  Isn't this a reasonably portable way of
>ascertaining the pathname of the executable? 

No.  It won't work in most systems.  It happens to work with some C
compilers on some versions of MS-DOS.  It most probably doesn't work
under Unix, since the path is almost never stored into argv[0], only the
filename.

--
Lars.Wirzenius@helsinki.fi
From: mikey@ontek.com (euphausia superba)
Newsgroups: comp.lang.c
Subject: Re: Sort help needed
Date: 13 Aug 92 21:45:54 GMT
Organization: Ontek Corporation -- Laguna Hills, California

In comp.lang.c, jos@and.nl (Jos Horsmeier) writes:
| 
| Have a look at the qsort function, it's in your lib somewhere. If you can't
| use that function for some reason (I don't see why,) may I suggest an
| alternative algorithm: heap sort. It's a bit slower than quick sort,
| but it's a very stable algorithm. i.e. quicksort might degenerate to
| O(n^2) behavior in the worst case, but heap sort is stable at O(n*log(n)).

_stable_, as applied to sort algorithms generally has a slightly
different connotation.  Knuth v3p4:

  "The sorting is called stable if we make the further requirement
  that records with equal keys retain their original relative order."

I point this out because it is often not mentioned that heapsort
is an unstable sort algorithm in this sense and some confusion may
result in someone who replaces a stable sort algorithm with heapsort.

Jos's point about worst case time, of course, is correct.

     the krill
From: bevan@cs.man.ac.uk (Stephen J Bevan)
Newsgroups: comp.lang.c
Subject: Re: C language criticism
Date: 15 Aug 92 20:02:31 GMT
Organization: Department of Computer Science, University of Manchester
In-reply-to: throopw@sheol.UUCP's message of 9 Aug 92 21:06:24 GMT

In article <713396388@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes:

	    f(char*a[]){
		char *(*ap)[];
		ap = &a;
	    }

   I submit that nothing could be simpler or more intuitive.

Well besides the fact that it is wrong (as has been pointed out
elsewhere), I think you'd have too have your tongue in your cheek when
describing it as "simple" and "intuitive".  I'm sure some people revel
in writing/decoding declarations like the above, but I'd hope that the
majority of people would use some carefully chosen typedefs instead.

bevan
From: tomw@stephanie.megatek.uucp (Tom Wright)
Newsgroups: comp.lang.c
Subject: need tool to eliminate unused #include's
Date: 14 Aug 92 17:09:26 GMT
Organization: Megatek Corporation, San Diego, California

Over time, programmers tend to add #include's but never remove them,
regardless of if they're still needed. It's just too difficult to see
if they're still needed. Ultimately, in a large system, this causes
'make' or 'Imake' to do many needless recompiles if dependencies are
used. Not using dependencies causes many wasted hours of looking for
bugs that aren't really there.

Does anyone know of a tool that figures out if any of the #include's
in a module are no longer needed?

It has been suggested that one could selectively remove #include's and
try recompiling and looking for no errors, but this is unsatisfactory
in that the use of -D on the compile command line could make an #include
that had appeared unneeded in a previous compile now become needed.

I imagine the tool would have to build a list of each thing that I'll
call a symbol that is defined in a #define, a typedef, or a struct (or
a few other things I haven't thought of yet) and which .h it's defined
in (ignoring #ifdef's and #ifndef's). Then it would have to keep track
of which .h's they're used in and which symbols they're used in. Ultimately,
it would check the module source to see what gets used. To create the 
final answer, it would need to check all the symbols in each .h to see
if any of them were ultimately used in the source or in a .h that had
a symbol that got used.

Creating such a processor would be non-trivial, but the productivity
gain could be very large. Does anyone have such a thing?

Thanks,
Tom
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: Sort help needed
Date: 14 Aug 92 07:51:25 GMT
Organization: AND Software BV Rotterdam

In article <2125@ontek.com> mikey@ontek.com (euphausia superba) writes:
|In comp.lang.c, jos@and.nl (Jos Horsmeier) writes:
|| 
|| Have a look at the qsort function, it's in your lib somewhere. If you can't
|| use that function for some reason (I don't see why,) may I suggest an
|| alternative algorithm: heap sort. It's a bit slower than quick sort,
|| but it's a very stable algorithm. i.e. quicksort might degenerate to
|| O(n^2) behavior in the worst case, but heap sort is stable at O(n*log(n)).
|
|_stable_, as applied to sort algorithms generally has a slightly
|different connotation.  Knuth v3p4:
|
|  "The sorting is called stable if we make the further requirement
|  that records with equal keys retain their original relative order."
|
|I point this out because it is often not mentioned that heapsort
|is an unstable sort algorithm in this sense and some confusion may
|result in someone who replaces a stable sort algorithm with heapsort.
|
|Jos's point about worst case time, of course, is correct.

Yes, you're absolutely right of course (as someone else pointed out to
me too, on private e-mail.) It was a sloppy way of saying it. I just
had to say that the _worst case_ behavior of HS is better than the
_worst case_ behaviour of QS, i.e. the big Oh still is O(n*log(n))
I should have avoided the use of the word `stable'. sorry ...

(because of this O(n*log(n)) behavior, even in the worst case,
 I prefer HS... no religious wars please ;-)

kind regards,

Jos aka jos@and.nl
From: linden@positive.Eng.Sun.COM (Peter van der Linden)
Newsgroups: comp.lang.c
Subject: Re: Pointer/address reluctance
Date: 17 Aug 1992 21:28:50 GMT
Organization: Sun Microsystems, Mt. View, Ca.
NNTP-Posting-Host: positive

From: clennox@vaxeline.ftp.com (Systems Anarchist)
> You are perfectly free to redefine 'address' to mean 'pointer.' 

It's not a redefinition, as it is already used in the ANSI C standard
with this meaning.   

There may well be archaic or unorthogonal hardware that defines "address"
in some special, different, non-intuitive manner.   The rest of computer
science has known for some time that large, flat, byte-addressable address 
spaces are the way to go.

This is not to criticize Steve who has clearly thought deeply about
the matter, and come up with a paradigm that works for him.  To me,
the effort to avoid equating "address" and "pointer" is somewhat like 
trying to be more Catholic than the Pope.  If the ANSI C std doesn't
do it, why should anyone else?

--
linden@eng.sun.com|| P. van der Linden and his uncustomary theories.
Go Giants!! Don't || When solving a "panic" you must first ask yourself what you
stop at Florida...|| were doing that could possibly frighten an operating system