comp.lang.ada
 help / color / mirror / Atom feed
* Re: Mixing Ada code with similar licenses
       [not found]   ` <f1f579b9-54b9-4949-941a-9b10821892b5@googlegroups.com>
@ 2017-03-11  9:05     ` Dirk Heinrichs
  0 siblings, 0 replies; 6+ messages in thread
From: Dirk Heinrichs @ 2017-03-11  9:05 UTC (permalink / raw)


Am 10.03.2017 um 21:25 schrieb Jere:

> I don't see where Robert's license explicitly says you have to distribute source code.

It says so in the preamble already:

"For example, if you distribute copies of such a program, whether gratis
or for a fee, you must pass on to the recipients the same freedoms that
you received. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their rights."

Chapter 6 then explains this further.

HTH...

	Dirk


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixing Ada code with similar licenses
       [not found] ` <lyk27wdeku.fsf@pushface.org>
@ 2017-03-26 20:46   ` Jere
  2017-03-26 21:12     ` Simon Wright
  0 siblings, 1 reply; 6+ messages in thread
From: Jere @ 2017-03-26 20:46 UTC (permalink / raw)


On Friday, March 10, 2017 at 4:09:07 PM UTC-5, Simon Wright wrote:
> Jere writes:
> 
> > Later on I found some code from Robert Kleczek which gave me some
> > ideas on how to transform a lot of the assembly in the original into
> > Ada code.
> 
> I don't know if it would help, but there's code under GPL+runtime
> exception here .. I thoroughly enjoyed writing it!
> 
> Files startup*.ad? in:
> 
> Cortex M4F (STM32F407)
> https://sourceforge.net/p/cortex-gnat-rts/code/ci/default/tree/stm32f4/adainclude/
> 
> Cortex M3 (Arduino Due)
> https://sourceforge.net/p/cortex-gnat-rts/code/ci/default/tree/arduino-due/adainclude/

Just a followup.  I started down this path as a parallel option.  It really
wants to use memset to do the assignment.  I didn't yet find an Ada memset
procedure in those libraries (I only browsed some.  Nothing popped up in
the filenames that made me think memset would be in there).  Is that something
you relied on GCC to provide or did you roll your own and I am just missing it?

With my current build setup, I am turning off cstdlib, so I don't have memset
available unless I roll my own.  Not a problem, but just thought I would ask.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixing Ada code with similar licenses
       [not found]     ` <o9ve6p$2pq$1@dont-email.me>
@ 2017-03-26 20:57       ` Jere
  2017-03-26 21:24         ` Jeffrey R. Carter
  0 siblings, 1 reply; 6+ messages in thread
From: Jere @ 2017-03-26 20:57 UTC (permalink / raw)


On Friday, March 10, 2017 at 6:54:44 PM UTC-5, Jeffrey R. Carter wrote:
> On 03/10/2017 10:20 PM, Jere wrote:
> >
> > In ada it would be something like (Rober's Impl)
> > procedure Clear_BSS is
> >       --  Suppress checking pointers from being zero (trust us)
> >       --  results in much better code
> >       pragma Suppress (Access_Check);
> >       type Int_Ptr is access all Integer_Address;
> >       function To_Access is
> >          new Ada.Unchecked_Conversion (Integer_Address, Int_Ptr);
> >       BSS_Start : Integer_Address := To_Integer (LD_BSS_Start'Address);
> >       BSS_End   : constant Integer_Address := To_Integer (LD_BSS_End'Address);
> >       Src : Int_Ptr;
> >    begin
> >       while BSS_Start < BSS_End
> >       loop
> >          Src := To_Access (BSS_Start);
> >          Src.all := 0; --  clear
> >          BSS_Start := BSS_Start + 4;
> >       end loop;
> >    end Clear_BSS;
> >
> > I would ideally just want to use that function with others, but implement my startup sequence that calls it a bit different.  My question is would that ada function (and the other two I mentioned above) fall under the regular GPL (no exception).
> 
> If you copy his code, then his license applies and your code that includes the 
> copied code is pure GPL.
> 
> However, if you can come up with a different (hopefully better) implementation, 
> then you get to choose the license. I might implement Clear_BSS as something like
> 
> procedure Clear_BSS is
>     Start : constant Integer_Address := To_Integer (BSS_Start_Address);
>     Stop  : constant Integer_Address := to_Integer (BSS_Stop_Address);
> 
>     BSS : Integer_Address := Start;
> begin -- Clear_BSS
>     Clear_All : loop
>        exit Clear_All when BSS >= Stop;
> 
>        Clear_One : declare
>           To_Clear : Integer_Address;
>           for To_Clear'Address use To_Address (BSS);
>           pragma Import (Ada, To_Clear); -- Suppress any initialization.
>        begin -- Clear_One
>           To_Clear := 0;
>        end Clear_One;
> 
>        BSS := BSS + 4;
>     end loop Clear_All;
> end Clear_BSS;
> 
> which looks to me like it does the same thing, but seems clearer. (I have no 
> objection to you using this with a license at least as permissive as the GPL + 
> exception.)
> 
> If you can do similar things to the other 2 subprograms, then you don't need to 
> make your code pure GPL.
> 
> -- 
> Jeff Carter
> "Violence is the last refuge of the incompetent."
> Foundation
> 151

Thank you!  I'll mess around with this method as well.  This does raise a
question for me though:  In function, both procedures do the same thing
(Use Integer_Address to loop through the addresses and convert to another
type to do the assignment).  I can see the style differences, but wondered
where the line was.  One could argue they do the same thing (I personally
can see the difference, but was trying to think from a outside perspective).

Also, how much of a method really is licensable?  If someone wrote the
function :

function Add_Numbers(A,B : in Integer) return Integer is
begin
   return A+B;
end Add_Numbers;

And stuck a pure GPL license on it, would any of my code that added two
numbers be under pure GPL from then on.  Common sense tells me "no" but
then legal matters don't always work with common sense.  In the same vein,
the BSS_Clear function of Robert's is simply a "loop through a pointer
and set each element to 0" function, which isn't ground breaking as well.
At what point is the method actually licenseable?

Note that I am not necessarily asking you directly Jeffery.  This is a
general musing.  I'm just musing along with my response to your post.

Again, thank you for the idea above.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixing Ada code with similar licenses
  2017-03-26 20:46   ` Jere
@ 2017-03-26 21:12     ` Simon Wright
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Wright @ 2017-03-26 21:12 UTC (permalink / raw)


Jere <jhb.chat@gmail.com> writes:

> On Friday, March 10, 2017 at 4:09:07 PM UTC-5, Simon Wright wrote:
>> Jere writes:
>> 
>> > Later on I found some code from Robert Kleczek which gave me some
>> > ideas on how to transform a lot of the assembly in the original into
>> > Ada code.
>> 
>> I don't know if it would help, but there's code under GPL+runtime
>> exception here .. I thoroughly enjoyed writing it!
>> 
>> Files startup*.ad? in:
>> 
>> Cortex M4F (STM32F407)
>> https://sourceforge.net/p/cortex-gnat-rts/code/ci/default/tree/stm32f4/adainclude/
>> 
>> Cortex M3 (Arduino Due)
>> https://sourceforge.net/p/cortex-gnat-rts/code/ci/default/tree/arduino-due/adainclude/
>
> Just a followup.  I started down this path as a parallel option.  It
> really wants to use memset to do the assignment.  I didn't yet find an
> Ada memset procedure in those libraries (I only browsed some.  Nothing
> popped up in the filenames that made me think memset would be in
> there).  Is that something you relied on GCC to provide or did you
> roll your own and I am just missing it?
>
> With my current build setup, I am turning off cstdlib, so I don't have
> memset available unless I roll my own.  Not a problem, but just
> thought I would ask.

You're quite right.

The reason it worked for me is that I included newlib as part of the
compiler build, see
https://sourceforge.net/u/simonjwright/buildingarmeabi/code

But it does look neat!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixing Ada code with similar licenses
  2017-03-26 20:57       ` Jere
@ 2017-03-26 21:24         ` Jeffrey R. Carter
  2017-03-27  7:07           ` Simon Wright
  0 siblings, 1 reply; 6+ messages in thread
From: Jeffrey R. Carter @ 2017-03-26 21:24 UTC (permalink / raw)


On 03/26/2017 10:57 PM, Jere wrote:
>
> Also, how much of a method really is licensable?  If someone wrote the
> function :
>
> function Add_Numbers(A,B : in Integer) return Integer is
> begin
>    return A+B;
> end Add_Numbers;
>
> And stuck a pure GPL license on it, would any of my code that added two
> numbers be under pure GPL from then on.  Common sense tells me "no" but
> then legal matters don't always work with common sense.  In the same vein,
> the BSS_Clear function of Robert's is simply a "loop through a pointer
> and set each element to 0" function, which isn't ground breaking as well.
> At what point is the method actually licenseable?

The GPL is mostly about the right to obtain a copy of and reuse source code. You 
can always obtain a copy of and reuse GPL code. It's also about the 
representation of the code. Different implementations of the same algorithm are 
different representations, so the fact that one falls under the GPL doesn't mean 
the others do. So a GPL on function Add_Numbers doesn't mean that all code that 
adds numbers falls under the GPL. However, if you copy and use that exact 
function, then your code would.

The 2 BSS_Clear algorithms might implement the same algorithm, but they do it 
differently, so the GPL on one doesn't affect the other. If you can do

procedure BSS_Clear is
    N : constant Natural := ...; -- Based on start and end addresses

    type List is array (1 .. N) of Integer'Address;

    A : List;
    for A'Address use To_Address (BSS_Start);
    pragma Import (Ada, A);
begin -- BSS_Clear
    A := List'(A'range => 0);
end BSS_Clear;

then that's a 3rd implementation that makes the looping implicit.

-- 
Jeff Carter
"I certainly have not the talent which some people possess, ...
of conversing easily with those I have never seen before."
Pride and Prejudice
121


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixing Ada code with similar licenses
  2017-03-26 21:24         ` Jeffrey R. Carter
@ 2017-03-27  7:07           ` Simon Wright
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Wright @ 2017-03-27  7:07 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> writes:

> The 2 BSS_Clear algorithms might implement the same algorithm, but
> they do it differently, so the GPL on one doesn't affect the other. If
> you can do
>
> procedure BSS_Clear is
>    N : constant Natural := ...; -- Based on start and end addresses
>
>    type List is array (1 .. N) of Integer'Address;
>
>    A : List;
>    for A'Address use To_Address (BSS_Start);
>    pragma Import (Ada, A);
> begin -- BSS_Clear
>    A := List'(A'range => 0);
> end BSS_Clear;
>
> then that's a 3rd implementation that makes the looping implicit.

And (it turns out) probably translates to a call to memset()! a yet
deeper level of implicitness.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-27  7:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <ce508a3d-bd0f-4ecc-953e-5b624c072b3c@googlegroups.com>
     [not found] ` <o9ur48$p6c$1@dont-email.me>
     [not found]   ` <f1f579b9-54b9-4949-941a-9b10821892b5@googlegroups.com>
2017-03-11  9:05     ` Mixing Ada code with similar licenses Dirk Heinrichs
     [not found] ` <lyk27wdeku.fsf@pushface.org>
2017-03-26 20:46   ` Jere
2017-03-26 21:12     ` Simon Wright
     [not found] ` <o9v343$pf5$1@dont-email.me>
     [not found]   ` <86633a07-9a12-4419-ad09-b519e4f279a5@googlegroups.com>
     [not found]     ` <o9ve6p$2pq$1@dont-email.me>
2017-03-26 20:57       ` Jere
2017-03-26 21:24         ` Jeffrey R. Carter
2017-03-27  7:07           ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox