Get module file path from ModuleInfo

2019-06-05 Thread Andre Pany via Digitalmars-d-learn

Hi,

I want to enhance a unittest framework to also report the results 
in SonarQube Generic Execution format. This format lists the file 
paths.


The unittest framework loops through the modules and collects the 
module name and the unittests:


foreach (moduleInfo; ModuleInfo)
{
if (moduleInfo)
{
auto unitTest = moduleInfo.unitTest;

if (unitTest)
{
testClass.name = moduleInfo.name;
testClass.test = (o, test) { unitTest(); };
testClasses ~= testClass;
}
}
}

Is there any way to get the module file path (the value __FILE__ 
would contain in the modules)?



Kind regards
André


Not able to use this C++ library in D

2019-06-05 Thread rnd via Digitalmars-d-learn
I am trying to use C++ DCMTK library ( https://dcmtk.org/ ) 
functions in D.
A relevant reference page is 
https://support.dcmtk.org/docs/classDcmFileFormat.html#details



Following is C++ code modified from 
https://stackoverflow.com/questions/5052148/how-to-use-dcmtk-in-qt


#include "dcmtk/dcmdata/dctk.h"
#include 
using namespace std;

int main() {
   DcmFileFormat fileformat;
   OFCondition status = fileformat.loadFile("test.dcm");
   if (status.good())   {
cout << "File loaded" << endl;
   }else{
  cerr << "Error: cannot read DICOM file (" << status.text() 
<< ")" << endl;

   }
   return 0;
}


I have tried to do the same in D with following code:

import std.stdio;
extern (C++) void loadFile(FILE *infile);
extern (C++) class DcmFileFormat;
extern (C++) class OFCondition;

void main(){
   DcmFileFormat fileformat;
   OFCondition status = fileformat.loadFile("test.dcm");
   if (status.good())   {
writeln("File loaded");
   }else{
  writeln("Error: cannot read DICOM file (", status.text(), 
")");

   }
}

However, I am getting following errors:

$ dmd dcmtk_eg.d
dcmtk_eg.d(5): Error: class `dcmtk_eg.DcmFileFormat` is forward 
referenced when looking for loadFile
dcmtk_eg.d(5): Error: class `dcmtk_eg.DcmFileFormat` is forward 
referenced when looking for loadFile
dcmtk_eg.d(5): Error: class `dcmtk_eg.DcmFileFormat` is forward 
referenced when looking for opDot
dcmtk_eg.d(5): Error: class `dcmtk_eg.DcmFileFormat` is forward 
referenced when looking for opDispatch
dcmtk_eg.d(10): Error: function 
dcmtk_eg.loadFile(shared(_IO_FILE)* infile) is not callable using 
argument types (DcmFileFormat, string)
dcmtk_eg.d(10):cannot pass argument fileformat of type 
dcmtk_eg.DcmFileFormat to parameter shared(_IO_FILE)* infile
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for opDot
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for opDispatch
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for mod
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good
dcmtk_eg.d(6): Error: class `dcmtk_eg.OFCondition` is forward 
referenced when looking for good



Where is the problem and how can it be solved? Thanks for your 
help.





-v lots of junk

2019-06-05 Thread Amex via Digitalmars-d-learn

Using -v I get a whole list(100's) of stuff that is irrelevant:

...
import
core.sys.windows.w32api	(C:\dmd2\windows\bin\..\..\src\druntime\import\core\sys\windows\w32api.d)
import
core.sys.windows.basetyps	(C:\dmd2\windows\bin\..\..\src\druntime\import\core\sys\windows\basetyps.d)
import
core.sys.windows.winver	(C:\dmd2\windows\bin\..\..\src\druntime\import\core\sys\windows\winver.d)

library   kernel32
library   version
...

I'm using -v because it says I have to to see the expanded 
errors... so I do but then I get all the junk above.




Re: What external libraries are available

2019-06-05 Thread 9il via Digitalmars-d-learn

On Wednesday, 5 June 2019 at 01:20:46 UTC, Mike Brockus wrote:

If you never herd about Meson before:
樂. https://mesonbuild.com/

Hay there I was just wondering, what is the D equivalent to C++ 
Boost and or Poco libraries?


Just wondering because I would like to start playing with other 
developers libraries and use them in a collection of examples 
for the library.  The examples will be lunched to a GitHub 
repository as a show case so the library developers can show a 
link to new potential users that seek examples.


What I mean by Boost or Poco equivalent is a grouping of fully 
functional packages/modules.  It’s ok if you recommend a single 
library and it is a plus if Meson build is apart of the library.


I am aware of Mir Libraries being a group of libraries and 
incorporates the use of Meson, however I normally like to see 
what my options are to better plan my applications.


https://github.com/libmir/mir-algorithm
https://github.com/libmir/mir-core
https://github.com/libmir/mir-optim
https://github.com/libmir/mir-rundom
https://github.com/libmir/mir-runtime (exprimental)

All of them comes with Meson and are used in daily production.



Re: What external libraries are available

2019-06-05 Thread Jacob Carlborg via Digitalmars-d-learn

On 2019-06-05 03:20, Mike Brockus wrote:

If you never herd about Meson before:
樂. https://mesonbuild.com/

Hay there I was just wondering, what is the D equivalent to C++ Boost 
and or Poco libraries?


I don't think there are any libraries that are a direct comparison to 
Boost (I'm not familiar with Poco). There are a couple of general 
purpose libraries available here [1]. Like mecca [2] and ocean [3].


Just wondering because I would like to start playing with other 
developers libraries and use them in a collection of examples for the 
library.  The examples will be lunched to a GitHub repository as a show 
case so the library developers can show a link to new potential users 
that seek examples.


What I mean by Boost or Poco equivalent is a grouping of fully 
functional packages/modules.  It’s ok if you recommend a single library 
and it is a plus if Meson build is apart of the library.


I am aware of Mir Libraries being a group of libraries and incorporates 
the use of Meson, however I normally like to see what my options are to 
better plan my applications.


There are 1576 packages available here [1]. It's the list of packages 
for the Dub package manager (and build system). These package range from 
full frameworks to single file packages.


[1] https://code.dlang.org
[2] https://code.dlang.org/packages/mecca
[3] https://code.dlang.org/packages/ocean-d2

--
/Jacob Carlborg


Re: Where can I find a reference for compiler flags?

2019-06-05 Thread Jacob Carlborg via Digitalmars-d-learn

On 2019-06-05 03:19, Mike Brockus wrote:


Where can I find a reference for compiler flags?


Here's the reference [1]. You can also run "dmd --help" to print out the 
available flags. [1] might not be up to date.


[1] https://dlang.org/dmd-windows.html

--
/Jacob Carlborg