Re: D1 code to D2I

2019-08-22 Thread Stefan Koch via Digitalmars-d-learn

On Thursday, 22 August 2019 at 18:10:51 UTC, jicman wrote:

Greetings!

Is there any tool out there, I searched around and didn't find 
any, that would take ton of D1 code and convert it to D2?  
Thanks.


josé


There is:

https://github.com/sociomantic-tsunami/d1to2fix

It might be please ask any question you may have in this thread.


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread jicman via Digitalmars-d-learn

On Thursday, 22 August 2019 at 18:54:50 UTC, jicman wrote:

On Thursday, 22 August 2019 at 18:26:52 UTC, jicman wrote:


OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarCmp@16
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarDecNeg@8

As you can see, there is nothing there...


So, I did a search through all the code and found these lines,

  int opCmp(VARIANT that) {
  return VarCmp(*this, that, GetThreadLocale(), 0) - 1;
  }

and

  int VarDecNeg(DECIMAL* pdecIn, out DECIMAL pdecResult);

Which I think call Kernel32.lib.  I found GetThreadLocale [1], 
but after adding,


pragma(lib, "Kernel32.lib");

to the file, still get the same problem. (I also deleted all 
.obj files and recompiled.  The interesting part is that 1.046 
compiler, compiles and links. Interesting phenomenon.


josé

[1] 
https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getthreadlocale



I think I have figured out what is going on.  I will comeback, if 
I need more help, but I have to rewrite a few more functions.  
But, thanks for pointing out the pragma.  That gave me an idea of 
what was going on.


josé


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread jicman via Digitalmars-d-learn

On Thursday, 22 August 2019 at 17:34:01 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:59:03 UTC, jicman wrote:

These are the options for dmd 1.076:



  -v verbose


Well, this one is definitely verbose. ;-)  But, I don't see 
anything in it that will help. But, here it goes:


The run command...
13:56:23.40>c:\D\bin\build -I..;c:\D\import -v -version=gui 
-version=Phobos PMORpts.res PMORpts.d > c:\temp\build_out.txt


And this is the content of c:\temp\build_out.txt Part 1:

binaryc:\D\dmd1.76\dmd\windows\bin\dmd.exe
version   v1.076
configc:\D\dmd1.76\dmd\windows\bin\sc.ini
parse menu
parse collections
parse listbox
parse messagebox
parse notifyicon
parse richtextbox
parse treeview
parse imagelist
parse tabcontrol
parse listview
parse toolbar
parse MyCGICalls
parse UserGUI
parse VendorGUI
parse QuotingEntries
parse techsupportemail
parse PMTimeEntry
parse FileConverter
parse pleasewait
parse ChangeTranslationPrices
parse ChangeSimplePrices
importall menu
importobject(c:\D\dmd1.76\dmd\src\phobos\object.d)
importdfl.internal.dlib (c:\D\import\dfl\internal\dlib.d)
importdfl.internal.d1   (c:\D\import\dfl\internal\d1.d)
importstd.traits(c:\D\dmd1.76\dmd\src\phobos\std\traits.d)
importstd.gc(c:\D\dmd1.76\dmd\src\phobos\std\gc.d)
importgcstats   (c:\D\dmd1.76\dmd\src\phobos\gcstats.d)
importstd.string(c:\D\dmd1.76\dmd\src\phobos\std\string.d)
importstd.stdio (c:\D\dmd1.76\dmd\src\phobos\std\stdio.d)
importstd.c.stdio   (c:\D\dmd1.76\dmd\src\phobos\std\c\stdio.d)
import
std.c.stddef	(c:\D\dmd1.76\dmd\src\phobos\std\c\stddef.d)
import
std.c.stdarg	(c:\D\dmd1.76\dmd\src\phobos\std\c\stdarg.d)

importstd.format(c:\D\dmd1.76\dmd\src\phobos\std\format.d)
importstd.stdarg(c:\D\dmd1.76\dmd\src\phobos\std\stdarg.d)
importstd.utf   (c:\D\dmd1.76\dmd\src\phobos\std\utf.d)
import
std.c.stdlib	(c:\D\dmd1.76\dmd\src\phobos\std\c\stdlib.d)
import
std.c.string	(c:\D\dmd1.76\dmd\src\phobos\std\c\string.d)

importstd.uni   (c:\D\dmd1.76\dmd\src\phobos\std\uni.d)
importstd.array (c:\D\dmd1.76\dmd\src\phobos\std\array.d)
importstd.ctype (c:\D\dmd1.76\dmd\src\phobos\std\ctype.d)
importstd.path  (c:\D\dmd1.76\dmd\src\phobos\std\path.d)
import
std.outofmemory	(c:\D\dmd1.76\dmd\src\phobos\std\outofmemory.d)

importstd.conv  (c:\D\dmd1.76\dmd\src\phobos\std\conv.d)
importstd.math  (c:\D\dmd1.76\dmd\src\phobos\std\math.d)
importstd.c.math(c:\D\dmd1.76\dmd\src\phobos\std\c\math.d)
importstd.stream(c:\D\dmd1.76\dmd\src\phobos\std\stream.d)
importstd.system(c:\D\dmd1.76\dmd\src\phobos\std\system.d)
import
std.intrinsic	(c:\D\dmd1.76\dmd\src\phobos\std\intrinsic.d)

importstd.file  (c:\D\dmd1.76\dmd\src\phobos\std\file.d)
importstd.regexp(c:\D\dmd1.76\dmd\src\phobos\std\regexp.d)
import
std.outbuffer	(c:\D\dmd1.76\dmd\src\phobos\std\outbuffer.d)
import
std.bitarray	(c:\D\dmd1.76\dmd\src\phobos\std\bitarray.d)
import
std.c.windows.windows	(c:\D\dmd1.76\dmd\src\phobos\std\c\windows\windows.d)
import
std.windows.syserror	(c:\D\dmd1.76\dmd\src\phobos\std\windows\syserror.d)
import
std.windows.charset	(c:\D\dmd1.76\dmd\src\phobos\std\windows\charset.d)

importstd.date  (c:\D\dmd1.76\dmd\src\phobos\std\date.d)
import
std.dateparse	(c:\D\dmd1.76\dmd\src\phobos\std\dateparse.d)

importstd.mmfile(c:\D\dmd1.76\dmd\src\phobos\std\mmfile.d)
importdfl.internal.winapi   (c:\D\import\dfl\internal\winapi.d)
importdfl.internal.wincom   (c:\D\import\dfl\internal\wincom.d)
import
std.c.windows.com	(c:\D\dmd1.76\dmd\src\phobos\std\c\windows\com.d)

importdfl.control   (c:\D\import\dfl\control.d)
importdfl.internal.clib (c:\D\import\dfl\internal\clib.d)
importstd.stdint(c:\D\dmd1.76\dmd\src\phobos\std\stdint.d)
importdfl.base  (c:\D\import\dfl\base.d)
importdfl.drawing   (c:\D\import\dfl\drawing.d)
importdfl.internal.utf  (c:\D\import\dfl\internal\utf.d)
importdfl.internal.com  (c:\D\import\dfl\internal\com.d)
importdfl.event (c:\D\import\dfl\event.d)
importdfl.form  (c:\D\import\dfl\form.d)
importdfl.application   (c:\D\import\dfl\application.d)
importdfl.label (c:\D\import\dfl\label.d)
importdfl.button(c:\D\import\dfl\button.d)
importdfl.textbox   (c:\D\import\dfl\textbox.d)
importdfl.environment   (c:\D\import\dfl\environment.d)
importdfl.resources (c:\D\import\dfl\resources.d)
importdfl.data  (c:\D\import\dfl\data.d)
importall collections
importall listbox
importall messagebox
importall notifyicon
importall richtextbox
importall treeview
importall imagelist
importall tabcontrol
importdfl.panel (c:\D\import\dfl\panel.d)
importall listview
importall toolbar
importall 

Re: How to removes an variable topmost const. like remove_const in C++.

2019-08-22 Thread Paul Backus via Digitalmars-d-learn

On Thursday, 22 August 2019 at 18:50:59 UTC, lili wrote:

Hi:
   I write a template function is below, that need to remove 
const topmost if has.

How to do this?



https://dlang.org/phobos/std_traits.html#Unqual


How to removes an variable topmost const. like remove_const in C++.

2019-08-22 Thread lili via Digitalmars-d-learn

Hi:
   I write a template function is below, that need to remove 
const topmost if has.

How to do this?

   const int i =3;
   println(i);
  void println(A...)(A a)
{
char[20] numStr = void;

foreach(v ; a) {
if (is(v.type == byte)  || is(v.type == ubyte) ||
is(v.type == short) || is(v.type == ushort) ||
is(v.type == int)   || is(v.type == uint) ||
is(v.type == long)  || is(v.type == ulong)) {
//did not wirte const types ... again.

ulong n = cast(ulong)v;
bool isNeg = false;
if (v < 0) {
isNeg = true;
if (n != 1<<63)
n = -v;
}

int i=0;
while(n !=0 ) {
numStr[i++] = (n%10) + '0';
n/=10;
}

if (isNeg)
putc('-');

while (--i >= 0)
putc(numStr[i]);
} else if (is(v.type == char*) || is(v.type == const 
char*)) {

puts(v);
} else if (is(v.type == bool)) {
 puts(v ? "true":"false");
} else if (is(v.type == char)) {
 putc(v);
} else {
static assert(false);
}
}
}


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread jicman via Digitalmars-d-learn

On Thursday, 22 August 2019 at 18:26:52 UTC, jicman wrote:


OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarCmp@16
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarDecNeg@8

As you can see, there is nothing there...


So, I did a search through all the code and found these lines,

  int opCmp(VARIANT that) {
  return VarCmp(*this, that, GetThreadLocale(), 0) - 1;
  }

and

  int VarDecNeg(DECIMAL* pdecIn, out DECIMAL pdecResult);

Which I think call Kernel32.lib.  I found GetThreadLocale [1], 
but after adding,


pragma(lib, "Kernel32.lib");

to the file, still get the same problem. (I also deleted all .obj 
files and recompiled.  The interesting part is that 1.046 
compiler, compiles and links. Interesting phenomenon.


josé

[1] 
https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getthreadlocale


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread jicman via Digitalmars-d-learn

On Thursday, 22 August 2019 at 18:20:09 UTC, jicman wrote:

On Thursday, 22 August 2019 at 17:34:01 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:59:03 UTC, jicman wrote:

These are the options for dmd 1.076:



  -v verbose


Well, this one is definitely verbose. ;-)  But, I don't see 
anything in it that will help. But, here it goes:


The run command...
13:56:23.40>c:\D\bin\build -I..;c:\D\import -v -version=gui 
-version=Phobos PMORpts.res PMORpts.d > c:\temp\build_out.txt


And this is the content of c:\temp\build_out.txt Part 1:


Continuation...

code  treeview
function  dfl.treeview.TreeViewCancelEventArgs.this
function  dfl.treeview.TreeViewCancelEventArgs.action
function  dfl.treeview.TreeViewCancelEventArgs.node
function  dfl.treeview.TreeViewEventArgs.this
function  dfl.treeview.TreeViewEventArgs.this
function  dfl.treeview.TreeViewEventArgs.action
function  dfl.treeview.TreeViewEventArgs.node
function  dfl.treeview.NodeLabelEditEventArgs.this
function  dfl.treeview.NodeLabelEditEventArgs.this
function  dfl.treeview.NodeLabelEditEventArgs.node
function  dfl.treeview.NodeLabelEditEventArgs.label
function  dfl.treeview.NodeLabelEditEventArgs.cancelEdit
function  dfl.treeview.NodeLabelEditEventArgs.cancelEdit
function  dfl.treeview.TreeNode.this
function  dfl.treeview.TreeNode.this
function  dfl.treeview.TreeNode.this
function  dfl.treeview.TreeNode.this
function  dfl.treeview.TreeNode.bounds
function  dfl.treeview.TreeNode.firstNode
function  dfl.treeview.TreeNode.fullPath
function  dfl.treeview.TreeNode.fullPath.__foreachbody357
function  dfl.treeview.TreeNode.handle
function  dfl.treeview.TreeNode.index
function  dfl.treeview.TreeNode.isExpanded
function  dfl.treeview.TreeNode.isSelected
function  dfl.treeview.TreeNode.lastNode
function  dfl.treeview.TreeNode.nextNode
function  dfl.treeview.TreeNode.nodes
function  dfl.treeview.TreeNode.parent
function  dfl.treeview.TreeNode.prevNode
function  dfl.treeview.TreeNode.tag
function  dfl.treeview.TreeNode.tag
function  dfl.treeview.TreeNode.text
function  dfl.treeview.TreeNode.text
function  dfl.treeview.TreeNode.treeView
function  dfl.treeview.TreeNode.beginEdit
function  dfl.treeview.TreeNode.ensureVisible
function  dfl.treeview.TreeNode.collapse
function  dfl.treeview.TreeNode.expand
function  dfl.treeview.TreeNode.expandAll
function  dfl.treeview.TreeNode.fromHandle
function  dfl.treeview.TreeNode.remove
function  dfl.treeview.TreeNode.toggle
function  dfl.treeview.TreeNode.imageIndex
function  dfl.treeview.TreeNode.imageIndex
function  dfl.treeview.TreeNode.toString
function  dfl.treeview.TreeNode.opEquals
function  dfl.treeview.TreeNode.opEquals
function  dfl.treeview.TreeNode.opEquals
function  dfl.treeview.TreeNode.opCmp
function  dfl.treeview.TreeNode.opCmp
function  dfl.treeview.TreeNode.opCmp
function  dfl.treeview.TreeNode.created
function  dfl.treeview.TreeNode.isState
function  dfl.treeview.TreeNode._reset
function  dfl.treeview.TreeNodeCollection.add
function  dfl.treeview.TreeNodeCollection.add
function  dfl.treeview.TreeNodeCollection.add
function  dfl.treeview.TreeNodeCollection.addRange
function  dfl.treeview.TreeNodeCollection.addRange
function  dfl.treeview.TreeNodeCollection.addRange
function  dfl.treeview.TreeNodeCollection._reset
function  dfl.treeview.TreeNodeCollection._resetHandles
function  dfl.treeview.TreeNodeCollection.verifyNoParent
function  dfl.treeview.TreeNodeCollection.this
function  dfl.treeview.TreeNodeCollection.setTreeView
function  dfl.treeview.TreeNodeCollection.created
function  dfl.treeview.TreeNodeCollection.populateInsertChildNode
function  dfl.treeview.TreeNodeCollection.doNodes
function  dfl.treeview.TreeNodeCollection._added
function  dfl.treeview.TreeNodeCollection._removing
function  dfl.treeview.TreeNodeCollection._removed
function  
dfl.treeview.TreeNodeCollection.ListWrapArray!(TreeNode,_nodes,_blankListCallback,_added,_removing,_removed,true,false,false).OpApplyWrapArray!(TreeNode,_nodes).opApply
function  
dfl.treeview.TreeNodeCollection.ListWrapArray!(TreeNode,_nodes,_blankListCallback,_added,_removing,_removed,true,false,false).OpApplyWrapArray!(TreeNode,_nodes).opApply
function  
dfl.treeview.TreeNodeCollection.ListWrapArray!(TreeNode,_nodes,_blankListCallback,_added,_removing,_removed,true,false,false).opIndexAssign
function  
dfl.treeview.TreeNodeCollection.ListWrapArray!(TreeNode,_nodes,_blankListCallback,_added,_removing,_removed,true,false,false).opIndexAssign
function  
dfl.treeview.TreeNodeCollection.ListWrapArray!(TreeNode,_nodes,_blankListCallback,_added,_removing,_removed,true,false,false).opIndex
function  
dfl.treeview.TreeNodeCollection.ListWrapArray!(TreeNode,_nodes,_blankListCallback,_added,_removing,_removed,true,false,false).add_internal
function  
dfl.treeview.TreeNodeCollection.ListWrapArray!(TreeNode,_nodes,_blankListCallback,_added,_removing,_removed,true,false,false).add_internal
function  

Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread jicman via Digitalmars-d-learn

On Thursday, 22 August 2019 at 18:25:44 UTC, jicman wrote:

On Thursday, 22 August 2019 at 18:20:09 UTC, jicman wrote:

On Thursday, 22 August 2019 at 17:34:01 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:59:03 UTC, jicman wrote:

These are the options for dmd 1.076:



  -v verbose


Well, this one is definitely verbose. ;-)  But, I don't see 
anything in it that will help. But, here it goes:


The run command...
13:56:23.40>c:\D\bin\build -I..;c:\D\import -v -version=gui 
-version=Phobos PMORpts.res PMORpts.d > c:\temp\build_out.txt


And this is the content of c:\temp\build_out.txt Part 1:


Continuation...


final one...

code  listview
function  dfl.listview.getCallText
function  dfl.listview.ListViewSubItem.this
function  dfl.listview.ListViewSubItem.this
function  dfl.listview.ListViewSubItem.this
function  dfl.listview.ListViewSubItem.settextin
function  dfl.listview.ListViewSubItem.toString
function  dfl.listview.ListViewSubItem.opEquals
function  dfl.listview.ListViewSubItem.opEquals
function  dfl.listview.ListViewSubItem.opCmp
function  dfl.listview.ListViewSubItem.opCmp
function  dfl.listview.ListViewSubItem.text
function  dfl.listview.ListViewSubItem.text
function  dfl.listview.ListViewItem.ListViewSubItemCollection.this
function  
dfl.listview.ListViewItem.ListViewSubItemCollection._adding
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).OpApplyWrapArray!(ListViewSubItem,_subs).opApply
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).OpApplyWrapArray!(ListViewSubItem,_subs).opApply
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).opIndexAssign
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).opIndexAssign
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).opIndex
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).add_internal
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).add_internal
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).clear
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).contains
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).contains
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).indexOf
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).indexOf
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false)._insert
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false)._insert
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).insert
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).insert
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).remove
function  
dfl.listview.ListViewItem.ListViewSubItemCollection.ListWrapArray!(ListViewSubItem,_subs,_adding,_blankListCallback,_blankListCallback,_blankListCallback,true,false,false).remove
function  

D1 code to D2

2019-08-22 Thread jicman via Digitalmars-d-learn

Greetings!

Is there any tool out there, I searched around and didn't find 
any, that would take ton of D1 code and convert it to D2?  Thanks.


josé


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread a11e99z via Digitalmars-d-learn

On Thursday, 22 August 2019 at 16:59:03 UTC, jicman wrote:

On Thursday, 22 August 2019 at 16:36:45 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:34:52 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:34:06 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:07:00 UTC, jicman wrote:

On Thursday, 22 August 2019 at 15:58:56 UTC, a11e99z wrote:


case of string doesn't matter for Windows.

I mean for command lines (not in D code)
and again I mean: file names are case insensitive fro Windows 
:)


Thanks. ;-)

Any specific one?  I am trying -debug, and it is giving me the 
same thing.  If I try -w, just gives me too many warnings.


 Error 42: Symbol Undefined _VarDecNeg@8

These are the options for dmd 1.076:



  -v verbose



Re: How to write __traits(isSame, T, int) use another way

2019-08-22 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 22 August 2019 at 17:05:49 UTC, lili wrote:

Thanks alot, How to get a variable's type?


typeof(c)



Re: How to write __traits(isSame, T, int) use another way

2019-08-22 Thread lili via Digitalmars-d-learn

On Thursday, 22 August 2019 at 17:01:09 UTC, Adam D. Ruppe wrote:

On Thursday, 22 August 2019 at 16:54:56 UTC, lili wrote:

   I think the __traits(isSame, T, int) syntax is too uglily,
   Is where an other way rewrite it. like this 
isSameType!(T,int)


For types you can (and often should) just use

is(T == int)


the isSame thing is more about comparing aliases rather than 
types.


Thanks alot, How to get a variable's type?

void println(A...)(A a)
{
//TODO static if type
foreach(c ; a) {
static if (??(c) == int) //How to get c's type???

}
}


Re: How to write __traits(isSame, T, int) use another way

2019-08-22 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 22 August 2019 at 16:54:56 UTC, lili wrote:

   I think the __traits(isSame, T, int) syntax is too uglily,
   Is where an other way rewrite it. like this 
isSameType!(T,int)


For types you can (and often should) just use

is(T == int)


the isSame thing is more about comparing aliases rather than 
types.


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread jicman via Digitalmars-d-learn

On Thursday, 22 August 2019 at 16:36:45 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:34:52 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:34:06 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:07:00 UTC, jicman wrote:

On Thursday, 22 August 2019 at 15:58:56 UTC, a11e99z wrote:


case of string doesn't matter for Windows.

I mean for command lines (not in D code)

and again I mean: file names are case insensitive fro Windows :)


Thanks. ;-)

Any specific one?  I am trying -debug, and it is giving me the 
same thing.  If I try -w, just gives me too many warnings.


12:50:23.42>c:\D\bin\build -I..;c:\D\import -debug -version=gui 
-version=Phobos PMORpts.res PMORpts.d

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarCmp@16
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarDecNeg@8

These are the options for dmd 1.076:

12:56:19.43>dmd
DMD32 D Compiler v1.076
Copyright (c) 1999-2012 by Digital Mars written by Walter Bright
Documentation: http://www.digitalmars.com/d/1.0/index.html
Usage:
  dmd files.d ... { -switch }

  files.dD source files
  @cmdfile   read arguments from cmdfile
  -c do not link
  -cov   do code coverage analysis
  -D generate documentation
  -Dddocdir  write documentation file to docdir directory
  -Dffilenamewrite documentation file to filename
  -d allow deprecated features
  -dishow use of deprecated features as warnings
  -debug compile in debug code
  -debug=level   compile in debug code <= level
  -debug=ident   compile in debug code identified by ident
  -debuglib=nameset symbolic debug library to name
  -defaultlib=name  set default library to name
  -deps=filename write module dependencies to filename
  -g add symbolic debug info
  -gcadd symbolic debug info, pretend to be C
  -gsalways emit stack frame
  -H generate 'header' file
  -Hddirectory   write 'header' file to directory
  -Hffilenamewrite 'header' file to filename
  --help print help
  -Ipath where to look for imports
  -ignoreignore unsupported pragmas
  -inlinedo function inlining
  -Jpath where to look for string imports
  -Llinkerflag   pass linkerflag to link
  -lib   generate library rather than object files
  -man   open web browser on manual page
  -map   generate linker .map file
  -nofloat   do not emit reference to floating point
  -O optimize
  -o-do not write object file
  -odobjdir  write object & library files to directory objdir
  -offilenamename output file to filename
  -opdo not strip paths from source file
  -profile   profile runtime performance of generated code
  -quiet suppress unnecessary messages
  -release   compile release version
  -run srcfile args...   run resulting program, passing args
  -unittest  compile in unit tests
  -v verbose
  -v1D language version 1
  -version=level compile in version code >= level
  -version=ident compile in version code identified by ident
  -w warnings as errors (compilation will halt)
  -wiwarnings as messages (compilation will continue)
  -X generate JSON file
  -Xffilenamewrite JSON file to filename




How to write __traits(isSame, T, int) use another way

2019-08-22 Thread lili via Digitalmars-d-learn

Hi:
   I think the __traits(isSame, T, int) syntax is too uglily,
   Is where an other way rewrite it. like this isSameType!(T,int)


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread a11e99z via Digitalmars-d-learn

On Thursday, 22 August 2019 at 16:34:52 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:34:06 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:07:00 UTC, jicman wrote:

On Thursday, 22 August 2019 at 15:58:56 UTC, a11e99z wrote:


case of string doesn't matter for Windows.

I mean for command lines (not in D code)

and again I mean: file names are case insensitive fro Windows :)



Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread a11e99z via Digitalmars-d-learn

On Thursday, 22 August 2019 at 16:34:06 UTC, a11e99z wrote:

On Thursday, 22 August 2019 at 16:07:00 UTC, jicman wrote:

On Thursday, 22 August 2019 at 15:58:56 UTC, a11e99z wrote:


case of string doesn't matter for Windows.

I mean for command lines (not in D code)


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread a11e99z via Digitalmars-d-learn

On Thursday, 22 August 2019 at 16:07:00 UTC, jicman wrote:

On Thursday, 22 August 2019 at 15:58:56 UTC, a11e99z wrote:

try to add
pragma( lib, "OleAut32.lib" )


Thanks for the support, a11e99z. :-)

I have,

pragma(lib, "ole32.lib");
pragma(lib, "oleaut32.lib");

on that file. But I did go change it back to your suggestion,

pragma(lib, "ole32.lib");
pragma(lib, "OleAut32.lib");

and still get same error:

Thoughts?  thanks.


case of string doesn't matter for Windows.
so if u had "oleaut32" not working then "OleAut32" also will not 
work.


try to turn on verbose compilation and see all commands that 
generated by dub/compiler





Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread jicman via Digitalmars-d-learn

On Thursday, 22 August 2019 at 15:58:56 UTC, a11e99z wrote:

try to add
pragma( lib, "OleAut32.lib" )


Thanks for the support, a11e99z. :-)

I have,

pragma(lib, "ole32.lib");
pragma(lib, "oleaut32.lib");

on that file. But I did go change it back to your suggestion,

pragma(lib, "ole32.lib");
pragma(lib, "OleAut32.lib");

and still get same error:

12:05:22.11>c:\D\bin\build -I..;c:\D\import -version=gui 
-version=Phobos PMORpts.res PMORpts.d

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarCmp@16
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarDecNeg@8

Thoughts?  thanks.

josé



D1: Trying to update Juno Library to 1.076

2019-08-22 Thread jicman via Digitalmars-d-learn

Greetings!

I have been working on Juno for a long time with D1 version 
1.046, and love it.  But now, I want to update it to 1.076, the 
latest and greatest D1. I have fixed, what I think, were all of 
the problems.  However, when I build the libraries with my 
program, I get this error:


OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarCmp@16
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarDecNeg@8

The D1 version is,

DMD32 D Compiler v1.076
Copyright (c) 1999-2012 by Digital Mars written by Walter Bright
Documentation: http://www.digitalmars.com/d/1.0/index.html

Any thoughts of what to do next?  Thanks.

josé


Re: D1: Trying to update Juno Library to 1.076

2019-08-22 Thread a11e99z via Digitalmars-d-learn

On Thursday, 22 August 2019 at 15:55:48 UTC, jicman wrote:

Greetings!

I have been working on Juno for a long time with D1 version 
1.046, and love it.  But now, I want to update it to 1.076, the 
latest and greatest D1. I have fixed, what I think, were all of 
the problems.  However, when I build the libraries with my 
program, I get this error:


OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarCmp@16
c:\D\import\juno\com\core.obj(core)
 Error 42: Symbol Undefined _VarDecNeg@8

The D1 version is,

DMD32 D Compiler v1.076
Any thoughts of what to do next?  Thanks.


try to add
pragma( lib, "OleAut32.lib" )



Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-22 Thread ijet via Digitalmars-d-learn

On Thursday, 15 August 2019 at 08:08:29 UTC, Daniel Kozak wrote:
On Thu, Aug 15, 2019 at 9:44 AM Daniel Kozak 
 wrote:

[...]


something like this:
C version:

[...]


Thank you!


Re: How do I execute a sql-file inside D code

2019-08-22 Thread XavierAP via Digitalmars-d-learn

On Tuesday, 20 August 2019 at 11:33:33 UTC, Anders S wrote:


Use this code to check
conn.exec("CREATE DATABASE IF NOT EXISTS boxweb;");

however haven't found a way to run the sql file that create the 
tables. The file is in the source folder


I understand you're using some API to some SQL implementation 
which allows you to run SQL commands from strings, but not from 
files which is what you want?


Just read the file into a string with the D std lib:

import std:file;
conn.exec( readText(fileName) );

https://dlang.org/phobos/std_file.html#.readText