Re: Generate Ddoc without compiling?

2018-05-21 Thread Jonathan M. Wilbur via Digitalmars-d
On Monday, 21 May 2018 at 12:53:47 UTC, Steven Schveighoffer 
wrote:

On 5/21/18 8:37 AM, Jonathan M. Wilbur wrote:
I want to put in a feature request, but I want to gauge 
whether it is even feasible or not, but a little background 
first:


I am trying to create a Makefile to build the HTML 
documentation for a Dlang project. I would like to be able to 
update a single HTML file if the corresponding source changes, 
without having to recompile all of the others. My rule looks 
like this:


$(DCOMPILER) -o- -op -d -Df$@ $<

But that does not work, because some of the compiled modules 
import other modules, and the rule fails because DCOMPILER 
can't intelligently pull in the other source files. I think 
requiring a complete compile of all source to build the HTML 
documentation is a big impediment to making D highly scalable.


Having said that, I don't see why it would be technically 
impossible to make DMD build the HTML (almost) without regard 
to the validity of the source code. Is this possible? And 
moreover: *should* it be done? Is it a bad idea?





1. I don't think it requires compiling all other files.
2. You may want to use -c (not sure what the exact error is you 
are receiving)
3. You may need to specify where the other includes are with -I 
(not sure what the exact error is you are receiving).


I'm fairly certain D can do what you want it to do. But 
difficult to tell without more context/example.


-Steve


So it seems that I still have to include all of the interfaces 
(at least; source would work too), but I got it to work by adding 
the -I operator:


html_documentation : $(htmldocs)
$(htmldocs) : 
$(SRCDIR)/documentation/html/source/$(PACKAGE_SLUG)/%.html : 
$(SRCDIR)/source/$(PACKAGE_SLUG)/%.d
	$(DCOMPILER) -o- -op -d -I$(SRCDIR)/source 
$(SRCDIR)/source/macros.ddoc -Df$@ $<


Since I am not producing binaries (per the "-o-" flag), I don't 
know if it is still doing all the work of compiling and just not 
writing the files to disk, or if it is just doing some basic 
lexing, but this is at least acceptable.


Thanks for getting my noggin joggin'!




Generate Ddoc without compiling?

2018-05-21 Thread Jonathan M. Wilbur via Digitalmars-d
I want to put in a feature request, but I want to gauge whether 
it is even feasible or not, but a little background first:


I am trying to create a Makefile to build the HTML documentation 
for a Dlang project. I would like to be able to update a single 
HTML file if the corresponding source changes, without having to 
recompile all of the others. My rule looks like this:


$(DCOMPILER) -o- -op -d -Df$@ $<

But that does not work, because some of the compiled modules 
import other modules, and the rule fails because DCOMPILER can't 
intelligently pull in the other source files. I think requiring a 
complete compile of all source to build the HTML documentation is 
a big impediment to making D highly scalable.


Having said that, I don't see why it would be technically 
impossible to make DMD build the HTML (almost) without regard to 
the validity of the source code. Is this possible? And moreover: 
*should* it be done? Is it a bad idea?





Re: is the ubuntu sourceforge repository safe?

2018-05-09 Thread Jonathan M. Wilbur via Digitalmars-d

On Tuesday, 1 August 2017 at 10:01:17 UTC, Michael wrote:

On Monday, 24 July 2017 at 11:02:55 UTC, Russel Winder wrote:
On Sun, 2017-07-23 at 18:23 +, Michael via Digitalmars-d 
wrote:


I stopped using it. It kept causing error messages in my 
package manager and I couldn't update it properly so I've 
just stuck to downloading the updates on release.


If we are talking about D-Apt here  
http://d-apt.sourceforge.net/  it seems to be working fine for 
me on Debian Sid.  2.075 just installed this morning.


I stopped using it a while ago as it was constantly causing me 
problems with being unable to check for new package updates. It 
was right when sourceforge was issuing security warnings and I 
couldn't be bothered to try and deal with it.


Just following up on this, because I had the same problem:

1. Use wget or curl to download the .deb right from the archive

wget 
http://downloads.dlang.org/releases/2018/dmd_2.080.0-0_i386.deb


2. Try to install it with dpkg

dpkg -i dmd_2.080.0-0_i386.deb

### If you experience errors, add the following steps. If not, 
skip them.


3. Update your cache

sudo apt-get update

4. Download the dependencies, if you need to. In my case, I 
needed libc6-dev and gcc, which you *would normally* install like 
so:


sudo apt-get install libc6-dev gcc

But I had errors when trying to do that, which were resolved by 
running:


sudo apt --fix-broken install

###

5. Finally, run `dmd --version` to test that it works!


Concatenate strings at compile-time

2018-05-02 Thread Jonathan M. Wilbur via Digitalmars-d-learn
I have a method that cannot be @nogc only because it concatenates 
strings for a long exception message, as seen below.


throw new ASN1ValuePaddingException
(
"This exception was thrown because you attempted 
to decode " ~
"an INTEGER that was encoded on more than the 
minimum " ~

"necessary bytes. " ~
notWhatYouMeantText ~ forMoreInformationText ~
debugInformationText ~ reportBugsText
);

Those variables you see are immutable. Is there a way that I can 
combine these strings together at compile time, rather than 
having a really long string that exceeds the 120 hard line-length 
limit?


Static Analysis / Code Scanning Tool (SAST) for D?

2018-04-28 Thread Jonathan M. Wilbur via Digitalmars-d
Does anybody know of a SAST tool that can scan D code for 
security vulnerabilities? In other words, does anybody know of 
something that will analyze raw D source code for security 
vulnerabilities that the human eye may have missed?


Split Real / Float into Mantissa, Exponent, and Base

2017-03-03 Thread Jonathan M. Wilbur via Digitalmars-d-learn
I have tried to come up with a good way to get the mantissa, 
exponent, and base from a real number, and I just can't come up 
with a good cross-platform way of doing it. I know about 
std.math.frexp(), but that function only gives you another real 
as the mantissa. I need an integral mantissa, exponent, and base.


Is there either (1) a crafty, cross-platform way of doing this or 
(2) a function in a standard library that does this that I 
somehow missed? If there is no such function, what are your 
thoughts on me implementing such a thing and submitting it to 
Phobos, probably similar to how frexp is implemented (elseifs for 
each FP format)?