[comp.lang.ada] special Ada functions

cfranz@wrdis01.af.mil (Claus Franzkowiak) (06/19/91)

I am looking for an Ada package that includes the following
functions/procedures:
   1. Record locking                     
   2. A function that takes a signal (character) from the keyboard without
      the usage of the return key.  For example:  I use only the up arrow key
      to move up the screen.

Also I would be interested if these functions could be written in Ada only
(no assembly).

I use an ATT 3B2 with the Verdix 5.7C Ada compiler under Unix.

Any hints will be appreciated.

1926 CCSG/SCDD
Claus Franzkowiak
Robins AFB
Warner Robins, GA 31098
912-926-7625
cfranz@wrdis01.af.mil

jduarte@liege.ICS.UCI.EDU (J o s e D u a r t e) (06/20/91)

> I am looking for an Ada package that includes the following
> functions/procedures:
>   1. Record locking
>   2. A function that takes a signal (character) from the keyboard without
>      the usage of the return key.  For example:  I use only the up arrow key
>      to move up the screen.
>
> Also I would be interested if these functions could be written in Ada only
> (no assembly).
>
> I use an ATT 3B2 with the Verdix 5.7C Ada compiler under Unix.



For "1." above you can use the C library functions flock(),lockf(), or fcntl()
by making "pragma" interfaces to 'em...Locks set by lockf() aren't compatible
with locks set by flock(); however, they are compatible with locks set by
fcntl().


> Take a look at the man page for lockf(3c), that will tell you how to
> set and test the locks.  The locks will go across NFS just fine.
>
> The biggest thing to remember is that these locks are advisory (lockf),
> meaning that only processes that test for the lock on the file will be aware
> of the lock (so multiple copies of programs you write that use the lock
> won't collide), but other programs can still write to the file without
> even looking at the lock.

> If you want to turn the locks into mandatory locks that will prevent
> other processes from writing to the file, you need to set the file's
> mode bits to a special value.  This should be explained in the man
> page.

I'm pretty sure that "2." was previously discussed, but I didn't save the
solutions proposed by people.



Jose' D.