[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] bit manipulation ?
From: |
Brian Tiffin |
Subject: |
Re: [open-cobol-list] bit manipulation ? |
Date: |
Tue, 29 Apr 2014 01:49:45 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 SeaMonkey/2.25 |
Patrick wrote:
I should have looked a Brian's site first . It looks like there are a
number of reserved words that are not yet implemented regarding
manipulating bits.
Let's change the focus of this post from how do I do this, to how do I
write this for GNUcobol.
How hard would this be to add and does anyone have some useful links to
reference materials that might help?
Perhaps I could write standalone programs that will do what is needed in
theory and the developers can rework it into the code base later.
Thanks
P.S there does seem to be some workaround material posted here:
http://opencobol.add1tocobol.com/#bitwise
Ok, first you'd probably want to check out cbrain.
http://esolangs.org/wiki/cbrain
Just kidding, do that last. ;-)
Along with Paul's most excellent pure COBOL bitwise.cob,
we also have access to
CBL_AND
CBL_EQ
CBL_IMP
CBL_NIMP
CBL_NOR
CBL_OR
CBL_XOR
taking 3 parameters
And
CBL_NOT
taking two.
CALL "CBL_AND" using
cobol-bitfield-1
cobol-bitfield-2
BY VALUE length
END-CALL
where cobol-bitfield-1 is read only, cobol-bitfield-2 is read and
overwrite-in-place, and length is in bytes.
CALL "CBL_AND" using
8
some-byte
by value 1
END-CALL
will be some-byte = some-byte AND 8 where the AND here is bitwise,
not logical, as in the spec's B-AND.
some-byte is overwritten by the results, and the length can be greater
than 1.
For the now, anyway until we get BIT and PICTURE 1. (Ummm, not that
CBL_AND will go away if we get BIT).
Full details in libcob/common.c cob_sys_... functions.
GNU Cobol 2.0 has cobc --list-system now too, for getting at the list
of stock library features.
Cheers,
Brian
On 28/04/14 09:24 AM, Patrick wrote:
Hi Everyone
I would like to set individual bits for use in calling arguments in C.
Many C libraries use bit masks.
I have found a number of examples on the net but nothing that I have
been able to get working yet.
Here is one error:
bit1.cob:32: Error: 'BIT' reserved word, but not supported yet
I am using 1.1
Is there a way to do this with GNUcobol ?
Thanks-Patrick
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list