HDTenEightyP/NetNews huggingface dataset:
From: scotth@felix.filenet.com (Scott Hopson)
Newsgroups: comp.lang.c
Subject: Re: C Routines to print BARCODES on HPLJIII
Date: 3 Oct 92 09:15:55 GMT
Reply-To: scotth@fritz.filenet.com (Scott Hopson)
Organization: FileNet Corp., Costa Mesa, CA

In article <1992Oct2.154907.55888@qut.edu.au> prato@qut.edu.au writes:
>
>Would anybody know where I may obtain a copy of Borland C 
>routines that would print barcodes on a HP Laserjet III?
>
>If anybody has experience/knowledge in this area,
>please let me know.
>
>Your assistance would be greatly appreciated.

Printing BarCodes is very easy on the HP LaserJet, if you have the manual
for the LaserJet which provides the ESCAPE-Codes then you can write your
own routines very easily. HPs provides a very straight forward way to do
this. I wrote a program about 7 years ago in PASCAL which was very easy
to do. Just write out the starting sequence, then your data, then the
ending sequence. The LaserJet sees the starting sequence and says
"Oh, the next bunch of characters needs to be converted to BARCODE"
then when you send the ending sequence the LaserJet says
"Well, I guess that's all he or she wants for now so I'll just return
to NORMAL MODE". Then your BARCODE comes out clean and pretty.


I don't know if you still need a BARCODE Cartridge though.



-- 
Scott Hopson   (scotth@filenet.com)
From: kompels@ucbeh.san.uc.edu
Newsgroups: comp.lang.c
Subject: Copy of FAQ
Date: 29 Sep 92 10:22:46 EST
Distribution: world
Organization: Univ. of Cincinnati

I presume FAQ stands for frequently asked questions. Being a beginner I would
like to have a copy of it myself--  how do I get one?
Newsgroups: comp.lang.c
From: simon@giaec.cc.monash.edu.au (simon shields)
Subject: monitor program
Organization: Monash University, Melb., Australia.
Date: Tue, 6 Oct 1992 14:27:19 GMT


Hi
I'm running on a 
HP-UX giaec A.08.07 A 9000/720 2001133857

I'm trying to write a simple monitor program. Its supposed to keep
some stats on commands a person (myself), enters during a session. It
has to be completely transparent to the user (run in the background).

I was wondering whether anyone here could give me a kick start on how
I should write it. 

Any ideas sincerely appreciated.

thanks from simon
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: Is there is (pascal) WITH equivalent in C?
Date: 2 Oct 92 16:43:50 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <1992Oct2.124350.3244@taumet.com>, mike@taumet (Mike Ball) writes:
>The with expression is evaluated exactly once, which has semantic
>consequences exactly similar to the fact that the lhs of a reflexive
>operator is evaluated once.

Oh, I see -- a WITH expression might have a pointer in it, in which
case you can't entirely evaluate it at compile-time.  In which case,
WITH is in effect, a massive clue to the compiler to do some common
sub-expression elimination.

Now I see why everyone was saying "that's an easy optimization even
without WITH".  :-/

-- 
You're traveling through another dimension -- a dimension not only of sight and
sound but of mind. A journey into a wonderous land whose boundaries are that of
imagination.  That's a signpost up ahead: your next stop: the Twilight Zone!
From: jracine@weber.ucsd.edu (Jeff Racine)
Newsgroups: comp.lang.c
Subject: Numerical recipes, var arg function passing - how to?
Date: 29 Sep 1992 03:59:45 GMT
Organization: University of California, San Diego
Distribution: world
NNTP-Posting-Host: weber.ucsd.edu

Hi.

I am trying to get a multidimensional minimization algorithm running
using the algorithm powell() from Numerical recipes in C.

The algorithm powell() accepts a function declared as (*func)(float *)
(is this an ANSI declaration?). It expects a function of a vector of 
parameters which it will minimize. I have a function which has two
arguments, declared as

float *my_func(float *parameters, float **data)

and I want to pass this to the NR routine powell(). How is this to be
done properly? I have tried a simple 

#define func(parameters) my_func(parameters, data)

and get the compiler error

main.c(406) : Error: cannot implicitly convert
from:<far *><float>
to  :<far *><far C func(<far *><float>) returning><float>

Any hints/solutions would be greatly appreciated.

Thanks in advance.

-- 
Jeff Racine        
jracine@weber.ucsd.edu
racine@nexus.yorku.ca
--Remember when sex used to be safe and parachuting was dangerous?
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Realloc failure when downsizing (was Re: Probably a simple realloc() question)
Date: 3 Oct 92 07:23:54 GMT
Organization: University of Helsinki

In various articles in a long thread various people argue for and
against realloc returning NULL if it can't make a block smaller, from a
quality of implementation point of view (the legalistic point of view is
that it can return NULL if it wants to).  The basic argument against
returning NULL seems to be that it shouldn't fail since it can always
return the original pointer, and that this is somehow preferable to the
user.

If realloc fails, it leaves the originally allocated block intact so you
loose no information.  There is also no loss of convenience, since you
still have to check the return value.  

	if ((temp = realloc(ptr, size)) != NULL)
		ptr = temp;

The only difference, then, is that the NULL return conveys possibly
useful information (getting short of usable memory) and the original
pointer return does not.  Therefore, I see no reason not to return NULL. 

(I don't see any reason for a prolonged heated discussion here.  Send me
hate mail if you violently disagree.)

--
Lars.Wirzenius@helsinki.fi
Organization: Middle East Technical University - Computer Center
Date: Tuesday, 29 Sep 1992 18:12:47 TUR
From: <C51881@TRMETU.BITNET>
Newsgroups: comp.lang.c
Subject: Dynamic Linker for C and C++ ...

Hi,
We have a dynamic linker called dld in our Sun workstations for C.
We need a dynamic linker for C++ in SunOS environment. If there is a
public domain one can you send the FTP adress?
Thank you for help ...
                                      Budak Arpinar
<C51881@TRMETU.BITNET>
Newsgroups: comp.lang.c
From: zxmgn01@mailserv.zdv.uni-tuebingen.de (Philipp Knirsch)
Subject: Re: ++i = i++ ?
Organization: Comp. Center (ZDV) U of Tuebingen, FRG
Date: Mon, 28 Sep 1992 17:59:21 GMT

In <1992Sep28.162405.29567@fzi.de> xiong@fzi.de (Xiong Xun) writes:

>I wanted to use the statement: 
>       
>       for (i = 0; i < Count, ++i)
>       { /*any correct c codes*/}

>Then I made a typo by writting down "i++" instead of "++i" ...

>The result: both of them are functioning (offer the same result)!

>Someone there could enlighten me on this?

Hello.

Well, this is once againe one of the advantages of C :)
Syntactical very much is accepted by the C-Compilers (just look at the
most unreadable C-programm comptest every year :)

Now in your case it is something more or less easy:

There are two ways to increment a variable in C. Either post- or preincrement.
Now what does this mean in your case?
Very easy. In your for-loop you first initialize your variable i with 0, then
increment i AT EVERY END of a loop by one until i reaches Count-1.
Now there is a reason why i wrote AT EVERY END. Just think about this: Is there
a difference if you make pre or post increment on i AT EVERY END?
No. Because there is nothing else going on at the end then counting up i.

Another nice thing is surely the folowing line:

++i = i++;

Hehehe.. Which value has i when it is first 0 after this line of correct 
C-Code??

Normaly first the left part is calculated, so this is in our case 0.
HM????
Yes! There the difference between post and preincrement is taking its
role: The variable i is increased by one AFTER the calculation.
Thats is the right i++.
Now i was at first then increased by one. Because of the preincrement of
the left side.
Now it really gets strange, because now it really depends on the compiler,
if the code is optimized etc.
Because if the preincrement is made first, then i is actually 1 when the
compiler reaches the right i++.
This is in my opinion the "normal" operation.
Now the left side with the ++i is done. Now the right side works. Every
calcualtion is done, and i had the value 1 (after the left side).
Now i is set to i++, that is 2.

So after all, this line should make 2 out of 0 :)

Perhaps i am wrong, but something nice to think about and to test and look
what the compiler is doing :)

Read ya, Phil


--
  ~~~~~~~   "And even if you think you are at the bottom, something else
 (~ O O ~)   happens which makes everything even worse."
  |  >  |   Philipp Knirsch, Peter-Imhoffstr. 57 7402 K-furt, Germany
  \ \_/ /   email: knirsch@mailserv.zdv.uni-tuebingen.de
From: mcgowan@emerald.physics.utoronto.ca (Pat McGowan)
Newsgroups: comp.lang.c
Subject: C hankel transform
Date: 4 Oct 92 19:53:27 GMT
Organization: University of Toronto Physics/Astronomy/CITA

Help

Before I convert a yukky FORTRAN hankel transform routine into C, does  
anyone out there have one I can use? Please email me before 5:30pm today!

Luv ya!

Pat
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.lang.c
Subject: Re: Borland C++ 3.0 strncpy - Is there something wrong?
Keywords: strncpy
Date: 29 Sep 92 21:05:38 GMT

In article <jwfourie.717797137@rkw-risc>, jwfourie@rkw-risc.cs.up.ac.za writes:
> After reading some values into buf I wanted to copy the 4 values from
> index 12 i.e. buf[12] to buf[15] into src_ad.
> I used:  strncpy(src_ad,(unsigned char *)(buf+12),4)
> this worked well until a value of 0x03 occurred in buf[15]
> then the value of 0x00 where copied in src_ad[4] instead of 0x03
> the same happened with a vaule of 0x01 in buf[15]

I'd be willing to bet that the problem is not the 0x03 in buf[15] but
rather that there was a 0x00 in buf[14].  strncpy() is designed to copy
*strings* so it stops copying as soon as it hits a NUL (although for
obscure historical reasons it always pads the destination with additional
NULs up to its full length).

> I used memmove(src_ad,buf+12),4) and this worked correctly.

Actually memcpy() would be more appropriate since you know that the source
and destination don't overlap.  That is the correct way to copy binary
data.

----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
Domain: lawrence.jones@sdrc.com               IBMMAIL: USSDR7DR at IBMMAIL
I hope Mom and Dad didn't rent out my room. -- Calvin
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: HELP: Null pointer assignment
Date: 5 Oct 92 16:14:16 GMT
Organization: AND Software BV Rotterdam

In article <1992Oct4.213608.3693@wvnvms.wvnet.edu> un032314@wvnvms.wvnet.edu writes:
|What is the best way to search for the cause of "Null pointer assignmet" error
|on termination of the program.  I am using BC++ and the small memory model.
|
|I believe I can trace through the code, but I don't know where the first
|few bytes of the data segment are, so I can't watch them for a change.
|
|Any ideas.
|
|Please mail responses to me or post answers.

Well, I know next to nothing about BC++ but if their runtime system
can detect a null pointer assignment, so can you: simply look at
the location in memory where a null pointer points to and signal
any change of value there. Something like this:

char NullMemBuf[ANYSIZE];

void NullCheckInit() {

int   i;
char *p= NULL;

for (i= 0; i < ANYSIZE; i++)
   NullMemBuf[i]= p[i];

}

int NullCheck() {

char *p= NULL;

return memcmp(P, NullMemBuf, ANYSIZE);

}

Simply call the function NullCheck just after entering main() and stick
some NullCheck() calls here and there in the suspicious areas of the code.

kind regards,

Jos aka jos@and.nl
From: mcs@goblin.caltech.edu (Martin Shepherd)
Newsgroups: comp.lang.c
Subject: Re: Union-initialization portability
Date: 1 Oct 1992 18:39:53 GMT
Organization: California Institute of Technology
Distribution: world
NNTP-Posting-Host: goblin.caltech.edu

Regarding my query about union initialization via a void* pointer
first member. I now realize that this was a dumb question (written too
late at night), and that the fact that it works on a sparc simply
reflects the fact that all pointers on sparcs have the same size and
bit representation. To make the example that I posted work one would
require an intermediate step to cast the void *init member to the
correct pointer type and assign back to the relevant member.

What I am still unsure about is whether it is legal to *initialize* a
'void *' pointer with the pointer of another type, in the same way that
one can *assign* to a 'void *' pointer without a cast. Is there an implicit
cast that might make this an illegal initializer?

ie is this legal?

float avar, bvar;

void *dumb[NDUM]={ &avar, &bvar,...etc };

Martin Shepherd  (mcs@phobos.caltech.edu)

Newsgroups: comp.lang.c,comp.lang.pascal,comp.lang.misc
From: ttw@beta.lanl.gov (Tony Warnock)
Subject: Re: SUMMARY: Preferences toward case sensitivity/insensitivity
Organization: Los Alamos National Laboratory
 
 
   Just to pour more oil on the fire: I have found that in practice
   that having case sensitivity is such a pain that I will not use
   a language having case distinctions. As an example, I had to work
   with (another person's) code with the variables: "code" "Code" and
   "CODE" with different meanings. Naturally the code was buggy.
 
   Another advantage of case insensitivity is that one programmer
   can take over a code and change cases without harming the code.
 
                    It's a bug - it's not a feature;
                    Its an ugly little creature.
                    Every time that I improve it,
                    Code-rewriting to remove it;
                    It just metamorphosizes
                    In another of its guises.
                    Yet again disgruntled users
                    Deem me one of their abusers.
                    Loathe to sit around and fidget
                    I create another digit;
                    Tack it on the public version;
                    Then for marketing coercion:
                      I announce another UPGRADE!
Date: Fri, 2 Oct 1992 14:18:17 GMT

Newsgroups: comp.lang.c
From: scs@adam.mit.edu (Steve Summit)
Subject: Re: Passing values and function pointers
Organization: none, at the moment
Date: Mon, 28 Sep 1992 17:22:28 GMT

In article <18553.2ac678ff@ecs.umass.edu>, rrooks@ecs.umass.edu (Raymond Rooks) writes:
>    I am using what I saw in "Turbo C - The Complete Reference" to write
> a main() that calls the rtnewt subroutine.  This reference I am using
> says that to declare this function pointer I have to declare the function,
> declare a character pointer, then cast the function to the pointer...

This is dangerous and quite false.  If Raymond or anyone else
could cite the alleged text embodying this "advice," so that the
rest of us could rip it to shreds, it would probably be a service...

					Steve Summit
					scs@adam.mit.edu
Newsgroups: comp.lang.c
From: bjackson@mentor.cc.purdue.edu (Ben Jackson)
Subject: Re: Probably a simple realloc() question
Keywords: realloc return NULL pointer
Organization: Purdue University Computing Center
Date: Sun, 4 Oct 1992 18:18:46 GMT

In article <1992Oct4.165530.29562@seas.smu.edu> mustafa@seas.smu.edu (Mustafa Kocaturk) writes:
>In article <366@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
>
>>	3. If you cannot allocate new memory do NOT free the old
>
>I agree.
>
>>		and return the original pointer.
>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>This is non-standard. NULL is returned if realloc fails.
                                        ^^^^^^^^^^^^^^^^
Well, what he's saying is that in this case, the realloc wouldn't fail!
(What failed was the internal malloc done BY realloc.  if the user requested
a smaller chunk, it's perfectly legal to give back the original)

--Ben


Newsgroups: comp.lang.c
From: jlnance@eos.ncsu.edu (JAMES LEWIS NANCE)
Subject: Re: Sparse matrix algorithms in C ?
Originator: jlnance@volt.ece.ncsu.edu
Reply-To: jlnance@eos.ncsu.edu (JAMES LEWIS NANCE)
Organization: North Carolina State University, Project Eos
Date: Mon, 28 Sep 1992 13:19:33 GMT


In article <80469@ut-emx.uucp>, olo@ccwf.cc.utexas.edu (Lee Thomas) writes:
|> 
|> Hello,
|> 
|> I am seeking fast dynamic sparse matrix algorithm written in C with memory
|> efficient inversion tools.
|> 
|> Thanks!

I might be able to help you, but I need more information on what you are trying
to do and what your matrix looks like(ie is your matrix band diagonal, or just
randomly sparse).  Are you trying to do load flow analysis? (just a guess from
you signiture)

You might try looking on research.att.com  They have some interesting packages
up there.

Hope I can help,

Jim Nance
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Re: Determining variable type at run-time (followup q.)
Date: 3 Oct 92 09:59:08 GMT
Organization: University of Helsinki

berlin@is.morgan.com (Alexander Berlin) writes:
>In article <359@ulogic.UUCP>, hartman@ulogic.UUCP (Richard M. Hartman) writes:
>
>|> Safer would be:
>|> 	
>|> 		x.type = 2;
>|> 		x.value = malloc(strlen(str));
>|> 		strcpy(x.value, str);
>|> 		OutPut(x);
>|> 
>Doesn't look very safe to me.

In case it isn't already clear, the quoted code contains at least two
problems:

1. It does not check what malloc returns.  In case of emergency, when
   malloc returns NULL, the next line (strcpy) will do awful things.

2. The malloc allocates one byte too little: it should allocate a byte
   for the '\0' that terminates the string.

There may be other problems as well, of course, but those depend more on
the surrounding code (any code excerpt will suffer from this).

--
Lars.Wirzenius@helsinki.fi
Wanted: Heavy weaponry for satisfying use against MS-DOS system disks.
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: files
Keywords: file,c
Date: 30 Sep 92 22:15:33 GMT
Article-I.D.: ulogic.346
Organization: negligable

In article <glenn.717803189@depot.cis.ksu.edu.cis.ksu.edu> glenn@cis.ksu.edu (Glenn S Goldstein) writes:
>
>I am having trouble understanding how to work with files in C.  Specifically, I
>want to read from a file into a structure.  One line of the file has an integer,
>string, and six pointers to the same type of structure, and one pointer to a
>different sturcture.  Any of the pointers can be NULL.
>If this is a FAQ, then I apologize.  However, I had to 'catch up' this topic
>because there were something over 10,000 posts waiting.
>I read K&R's C Book, but I'm still unsure of how to implement this problem.
>Please respond by email...............Thanks

(I have duplicated this via e-mail, but I thought it should still 
 be responded to here).

If this is not a FAQ (sorry, I haven't got a copy of the FAQ list saved yet,
I'm waiting the first of the month) it should be.

The problem is trying to save a pointer value in a file.

A pointer is an address in memory.  The next time you run your
program any such address would be entirely inappropriate.

What you need to do is save all pointed-to values first, and
remember to read them back in the same order, mallocing() as 
you go.

e.g.:

	typedef struct { int a,b; } datastruct;
	typedef struct { datastruct *x,*y; int c; } biggerstruct;

	(and here I go somewhat representational)

	biggerstruct X;
		X.x -------------> { 1, 2 }
		X.y -------------> { 3, 4 }
		X.c = 5;

the file should have in it (ignoring for the moment
details like binary vs. ascii & where newlines are placed):

	1 2 3 4 5

when you read you should have something like

	void readbiggerstruct(biggerstruct *p, FILE *fp)
	{
		p->x = malloc(sizeof datastruct);
		p->y = malloc(sizeof datastruct);
		fscanf(fp, "%d %d %d %d %d", 
			&(p->x->a), &(p->x->b)
			&(p->y->a), &(p->y->b)
			&(p->c));
	}


note; this is a very simple example.  If you are saving
multiple "biggerstructs" and some of them share their
.x or .y pointers you have to do stuff like save the
datastruct w/ some sort of identifying tag, read it
into memory w/ the tag then when reading a biggerstruct
you would have had to have look up the tag & find the
pointer to the (newly malloc()d) memory for it.  

(I hope some of that was comprehensible....)

The main point is what I first said.  Memory pointers
are not constants, and cannot be used between one run
of a program and the next.  You must save the DATA, not
a pointer to it.

		-Richard Hartman
		hartman@uLogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Extensive studies have shown that 93% of all statistics are meaningless.
Newsgroups: comp.lang.c
From: xu@prim.rose.utoronto.ca (Jiefeng Xu)
Subject: lint
Organization: University of Toronto, Department of Industrial Engineering
Date: Tue, 6 Oct 1992 01:45:08 GMT

I am new to lint. I don't understand why lint always print out great amount of 
error or warning messages to some programs which have succeeded in compiler
(gcc) and executed correctly. The message like "syntax error at or near type 
word "void" " is really confusing. Can anybody show me how to use lint   
correctly?
Thanks.

xu@prim.rose.utoronto.ca
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: Is there is (pascal) WITH equivalent in C?
Date: 26 Sep 92 11:49:38 GMT
Organization: AND Software BV Rotterdam

In article <1992Sep26.070303.28411@cronkite.ocis.temple.edu> ray@astro.ocis.temple.edu (Ray Lauff) writes:
|When programming in (sigh) Pascal there is a WITH statement which
|allows all the references to a structure to be referenced without
|repeating the struct variable name.  Is there such a thing in C?
|I don't believe there is, but I may be wrong...

No, you're right: there isn't such a construct in C. But you can always
build something similar if you insist. Have a look at this:

struct {
	int bar;
	int baz;
} foo;

/* ... */

#define BAR foo.bar
#define BAZ foo.baz

/* ... */

BAZ = 21;
BAR = BAZ<<1;  /* the final answer */

May I strongly suggest _not_ to use such macros, they're obfuscating 
the code. Just imagine what would happen if other structs happen to
have elements with the same names (bar and baz.) IMHO the WITH construct
in Pascal is silly, it just saves a couple of keystrokes, its function-
ality is limited (due to the ambiguity when equal names occur in different
RECORD types) and you could have achieved the same keystroke savings
with a nice little editor too ...

kind regards,

Jos aka jos@and.nl