Re: dmd download sig file, how do I use it

2018-03-24 Thread Seb via Digitalmars-d-learn

On Sunday, 25 March 2018 at 03:17:51 UTC, Ali wrote:

Hi All,

The DMD download is accompanied with a sig file
How exactly do I use this sig file
I am assuming I can use it in place of checksum to verify the 
download


And to be honest, I have almost zero knowledge for gpg and 
encryption
I googled a little but, didnt exactly find what I was hoping to 
find


I tried the following command
gpg --verify dmd_2.079.0-0_amd64.deb.sig 
dmd_2.079.0-0_amd64.deb


which returns

 gpg: Signature made Fri 02 Mar 2018 01:47:57 PM EST
 gpg:using RSA key B273811612BB1939
 gpg: Can't check signature: No public key


I guess this means, the file is not verified
So how can I do a complete verification?

I also downloaded the keryring file, from link in the download 
page

but also couldnt figure out how to use it

Any explanation of how this gpg sig key works and how to use it 
to verify the download

would be appreciated

thanks


The official install script takes care of this automatically:

https://dlang.org/install.html

If you want to do this manually, you need to grab the D keyring 
from here:


https://dlang.org/gpg_keys.html

And here's how you would verify the signature automatically like 
e.g.


gpg --verify --keyring ~/dlang/d-keyring.gpg --no-default-keyring 
dmd.2.079.0.linux.tar.xz.sig dmd.2.079.0.linux.tar.xz


It's also possible to permanently add this keyring to your 
installation with e.g. gpg --import ~/dlang/d-keyring.gpg


(Note: the individual keys in the keyring are currently expired 
and we are working on rolling out a new keyring, but that doesn't 
affect yverifying the existing signatures.)


dmd download sig file, how do I use it

2018-03-24 Thread Ali via Digitalmars-d-learn

Hi All,

The DMD download is accompanied with a sig file
How exactly do I use this sig file
I am assuming I can use it in place of checksum to verify the 
download


And to be honest, I have almost zero knowledge for gpg and 
encryption
I googled a little but, didnt exactly find what I was hoping to 
find


I tried the following command

gpg --verify dmd_2.079.0-0_amd64.deb.sig dmd_2.079.0-0_amd64.deb


which returns

 gpg: Signature made Fri 02 Mar 2018 01:47:57 PM EST
 gpg:using RSA key B273811612BB1939
 gpg: Can't check signature: No public key


I guess this means, the file is not verified
So how can I do a complete verification?

I also downloaded the keryring file, from link in the download 
page

but also couldnt figure out how to use it

Any explanation of how this gpg sig key works and how to use it 
to verify the download

would be appreciated

thanks


Re: Compile time initialization of AA

2018-03-24 Thread Xavier Bigand via Digitalmars-d-learn

Le 23/03/2018 à 23:43, Xavier Bigand a écrit :

I am trying to initialize an global immutable associative array of structs, but 
it doesn't compile.
I am getting the following error message : "Error: not an associative array 
initializer".

As I really need to store my data for a compile time purpose if we can't do 
that with AA, I'll use arrays instead.

Here is my code :
struct EntryPoint
{
string  moduleName;
string  functionName;
boolbeforeForwarding = false;
}

immutable EntryPoint[string]  entryPoints = [
"wglDescribePixelFormat": {moduleName:"opengl32.forward_initialization", 
functionName:"wglDescribePixelFormat"}
];


I finally found something that works great:
enum  entryPoints = [
"wglChoosePixelFormat": EntryPoint("opengl32.forward_initialization", 
"client_wglChoosePixelFormat"),
"wglDescribePixelFormat": EntryPoint("opengl32.forward_initialization", 
"client_wglDescribePixelFormat")
];

I am able to use this enum like an AA.



Re: Compile time initialization of AA

2018-03-24 Thread Patrick Schluter via Digitalmars-d-learn

On Friday, 23 March 2018 at 22:43:47 UTC, Xavier Bigand wrote:
I am trying to initialize an global immutable associative array 
of structs, but it doesn't compile.
I am getting the following error message : "Error: not an 
associative array initializer".


As I really need to store my data for a compile time purpose if 
we can't do that with AA, I'll use arrays instead.


Here is my code :
struct EntryPoint
{
string  moduleName;
string  functionName;
boolbeforeForwarding = false;
}

immutable EntryPoint[string]  entryPoints = [
"wglDescribePixelFormat": 
{moduleName:"opengl32.forward_initialization", 
functionName:"wglDescribePixelFormat"}

];


Another solution, radically different is to not use an AA but a 
simple array.
Instead of indexing on a string you could simply index on an enum 
type. As your array is compile time constant, the dynamic nature 
of AA is not really used and indexing on a enum value is faster 
and simpler anyway.
The trick here is to generate the enum type at compile time. This 
can be achieved by a string mixin built at compile time.


Here an example that I used to generate an enum from the values 
from another enum. In your case you can look where the 
"wglDescribePixelFormat" are defined and using imports or string 
building code.


mixin({
  string code = "enum LANBIT : ulong { "~
"init = 0,";  /* We set the dummy 
init value to 0 */

  foreach(lanCode; __traits(allMembers, LANIDX)) {
static if(lanCode == "IN")
  code ~= "INVALID = LANIDX2LANID(LANIDX."~lanCode~"),";
else
  code ~= lanCode~"= LANIDX2LANID(LANIDX."~lanCode~"),";
  }
  code ~= "
ALL=  INVALID-1, /**< All bits except 
the LANID_INVALID */
OFFICIAL= 
BG|CS|DA|DE|EL|EN|ES|ET|FI|FR|GA|HR|HU|IT|LT|LV|MT|NL|PL|PT|RO|SK|SL|SV,  /**< Official languages of the EU */
COOFFICIAL=CA|GL|EU|GD|CY /**< Co-official 
languages of the EU */

  ";
  return code ~ "}";
}());


TL/DR
defining constant compile time AA is an oxymoron. AA are by 
nature dynamic runtime creatures. if the indexes are compile 
time, a normal array with fixed indexes is enough.