Re: programming in linux



On Thu, 16 Mar 2006 13:11:13 -0500, J. Clarke staggered into the Black
Sun and said:
stewart_bristol@xxxxxxxxxxxxx wrote:
I used to do a fair amount of C programming on Unix/Linux. Over the
last few years, I have ditched it all for IDL which is a
scientific/matrix/visualisation language (at 2.5k for a license). I
would like to do some spare time programming on linux without the
proprietary software and would like some advice as to what is the
easiest/best thing to get started on.
On the C side, you may find C++ to be a bit more friendly to get
started with without sacrificing any capability.

YMMV on this, but I found C a lot less complicated than its ++ variant.
Objects are not a cure-all, and too many C++ tutorials cram objects down
their readers' throats before making sure they know how to do stuff
without them. Also, stewart_bristol has programmed in C before, so he
isn't flying blind.

stewart_bristol, if you don't have a decent book on C (or C++, or
whatever) then it'd be an excellent idea to get one.

but after looking at a C tutorial, I can see why I find IDL so much
easier (especially input/output). I want to start simple, with
reading/writing files and some number crunching, but eventually move
on and read the ports.

File I/O in C under Unix-like OSes is simple. fopen(), fgets(),
fread(), fprintf(), fwrite(), fseek(), fclose(). The place where C
falls down is that it doesn't have nice regular expression parsing
functions ~= Perl, but there's always libpcre. (If your needs include
parsing a lot of text data, you may find that it's easier and faster to
write in Perl than in C, but you'll probably have to find that out for
yourself.)

EXPN "read the ports"? If you meant "use ioperm() or iopl() to request
access to a port range, then use inb() and outb() to read and write I/O
ports on the x86", that can get tricky rather quickly from userspace.
Especially if you have precise timing requirements. If you meant "read
data from a device file", that's a bit easier, since then the kernel
handles the I/O port reading for you. Of course, then you have to read
up on all the ioctl()s you can do to your specific device file and use
them properly.

Might also want to take a look at APL. Sharp APL is free for personal
use and Dyalog, although they don't say so clearly on their Web site,

The APL that had all the Greek letters in it? I hope they've modernized
it a bit--that old thing was much more unfriendly than a modern C is.
Oh well, HTH,

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / "He is a rhythmic movement of the
-----------------------------/ penguins, is Tux." --MegaHAL
.



Relevant Pages

  • Re: Tiny ARM Development
    ... Merely reading and writing to I/O ports, ... > All I/O is memory mapped, ARM does not have a separate I/O address ... > The instruction set documentation is published by ARM, not Atmel, but a ...
    (comp.arch.embedded)
  • Re: aio_read/write versus O_NONBLOCK
    ... |>|>It has not had any effect on ordinary file streams in Linux in the programs ... The disk is always there, so a read must always complete ... | a blocking read can be unbounded (serial ports, parallel ports, network ... In any case, what you want is asychronous I/O, rather than non-blocking I/O. ...
    (comp.unix.programmer)
  • Re: Free Lisp download
    ... Scheme existed even before Common Lisp. ... libraries, see: ... Port I/O ... The (rnrs io ports (6)) library defines an I/O layer for conventional, ...
    (comp.lang.lisp)
  • Re: I/O Controller
    ... a distinct I/O address is used to refer to ... > the I/O data registers and a distinct address for the control and ... > status registers in an I/O controller for a given device. ... > ports can the 8088 address in each I/O addressing mode??? ...
    (comp.arch)
  • Re: freeBSd for a 486
    ... A modern computer has PCI ... slots where cards autoconfigure. ... limited memory. ... software from ports, or rebuild the kernel. ...
    (comp.unix.bsd.freebsd.misc)