* ada newbie
@ 2001-08-07 15:06 mop
2001-08-07 16:09 ` Marin David Condic
0 siblings, 1 reply; 3+ messages in thread
From: mop @ 2001-08-07 15:06 UTC (permalink / raw)
so my data looks like this. In C I could create a structure and go from
there. I'm new to Ada and need help on how to setup the data. I suspect I
could use some sort of a record once I setup the structure in Ada to pass
the data.
example data
word bit function remarks
1 2-0 command logic 001
3 mode logic 0 - normal
logic 1 -
diagnostic
7-4 spare
etc.etc
8 7-0 checksum sum of above message bytes
i'll be sending data across a serial port and need to change the parity bit
on the fly. from MarkParity to SpaceParity. So I'll send word 1 - default
parity bit MarkParity then change to SpaceParity for the rest of the data.
help. already wrote fully functional GUI is C but now need to do the same
in Ada and have no idea where to start.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ada newbie
2001-08-07 15:06 ada newbie mop
@ 2001-08-07 16:09 ` Marin David Condic
0 siblings, 0 replies; 3+ messages in thread
From: Marin David Condic @ 2001-08-07 16:09 UTC (permalink / raw)
You are delving into things (representation) that can be hardware/compiler
dependent.
From the ARM 13.5.1 - an example of how to create records wherein you
control representation issues. (Read chapter 13 - its really worth it if you
want to do low level programming like this.)
type Program_Status_Word is
record
System_Mask : Byte_Mask;
Protection_Key : Integer range 0 .. 3;
Machine_State : State_Mask;
Interrupt_Cause : Interruption_Code;
Ilc : Integer range 0 .. 3;
Cc : Integer range 0 .. 3;
Program_Mask : Mode_Mask;
Inst_Address : Address;
end record;
for Program_Status_Word use
record
System_Mask at 0*Word range 0 .. 7;
Protection_Key at 0*Word range 10 .. 11; -- bits 8,9 unused
Machine_State at 0*Word range 12 .. 15;
Interrupt_Cause at 0*Word range 16 .. 31;
Ilc at 1*Word range 0 .. 1; -- second word
Cc at 1*Word range 2 .. 3;
Program_Mask at 1*Word range 4 .. 7;
Inst_Address at 1*Word range 8 .. 31;
end record;
for Program_Status_Word'Size use 8*System.Storage_Unit;
for Program_Status_Word'Alignment use 8;
In general, you can see how the representation clause indicates that you
have to specify a byte offset (assuming a byte oriented machine) and a bit
range for each of the record elements. You don't need to create "spares" -
just don't specify anything occupying those bits.
Hope this gets you going - but you *really* should read chapter 13 and look
at your compiler documentation and target processor to make sure that you
get the clauses correct for *your* specific hardware. You'll discover that
in general Ada is very good at letting you control the low level stuff...
MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas www.pacemicro.com
Enabling the digital revolution
e-Mail: marin.condic@pacemicro.com
Web: http://www.mcondic.com/
"mop" <mop65715@pegasus.cc.ucf.edu> wrote in message
news:9kp053$ro0$1@zeus.orl.lmco.com...
> so my data looks like this. In C I could create a structure and go from
> there. I'm new to Ada and need help on how to setup the data. I suspect
I
> could use some sort of a record once I setup the structure in Ada to pass
> the data.
>
>
> example data
> word bit function remarks
> 1 2-0 command logic 001
> 3 mode logic 0 - normal
> logic 1 -
> diagnostic
> 7-4 spare
>
> etc.etc
> 8 7-0 checksum sum of above message bytes
>
>
> i'll be sending data across a serial port and need to change the parity
bit
> on the fly. from MarkParity to SpaceParity. So I'll send word 1 -
default
> parity bit MarkParity then change to SpaceParity for the rest of the data.
>
> help. already wrote fully functional GUI is C but now need to do the same
> in Ada and have no idea where to start.
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Ada Newbie
@ 1993-07-26 18:10 agate!howland.reston.ans.net!usc!cs.utexas.edu!asuvax!ennews!mcdphx!schbb
0 siblings, 0 replies; 3+ messages in thread
From: agate!howland.reston.ans.net!usc!cs.utexas.edu!asuvax!ennews!mcdphx!schbb @ 1993-07-26 18:10 UTC (permalink / raw)
In article 260793115314@ccl-kstar-node.net.yale.edu, heman@minerva.cis.yale.edu
(Edgardo I. Nazario) writes:
> Hi there! I recently read an article in Inforworld written by Bob Metcalf
> (the architect of Ethernet) in which he tries to convince the reader to
> switch from C to Ada. Well, I hate C and since I must believe Metcalfe
> knows what he's talking about, I am willing to try. However, where do I get
> the compiler, tools, etc. Where can I get books on the subject. Do you have
> a FAQ for this newsgroup?
>
> Any info would be greatly appreciated. My E-mail address is
> heman@minerva.cis.yale.edu.
>
> --Gardy--
I would like to recommend the following two books:
Software Engineering with Ada by Grady Booch
[When I was learning the language I used it to learn how to think
as an Ada programmer.]
Programming in Ada by JGP Barnes
[Ultimate reference manual for Ada. The edition I have also
has the Language Reference Manual.]
Here are some Commercial PC compilers:
Alsys Inc. 1-800-995-2579/617-270-0030
AETECH Inc. 1-619-431-7714
Meridian Software Systems 1-800-653-2522 (least expensive of the 3)
---
David Tannen
tannend@source.asset.com
tannen@tigger.geg.mot.com
----------------------------------------------------------------------
-- "Dependance on wizardry to mitigate the fundamental limitations
-- of software is called 'hacking'." Grady Booch.
--
-- Writing a MS-Windows application often requires hacking.
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-08-07 16:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-07 15:06 ada newbie mop
2001-08-07 16:09 ` Marin David Condic
-- strict thread matches above, loose matches on Subject: below --
1993-07-26 18:10 Ada Newbie agate!howland.reston.ans.net!usc!cs.utexas.edu!asuvax!ennews!mcdphx!schbb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox