www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [Announce] digc 0.0.15

reply Burton Radons <burton-radons shaw.ca> writes:
Okay, I finally finished digc.  For some reason I thought writing a 
parser to handle version statements properly would be a good idea.  Then 
I started thinking that I should store the parsed data as DOM so I 
started writing a DOM implementation.  Then I thought that I don't like 
how my implementation wouldn't be able to interface with other languages 
or use the other features OMG CORBA is built for, so I started looking 
in the CORBA documentation.  Then I realised I forgot about digc.

The digc documentation says it all, so I'll repeat it here.  The big 
changes are that it uses a builder program so that it can work no matter 
where you decided to install DMD (it'll search out the most obvious 
suspects).  The stripper also works with the newer revisions of the 
language.  Finally, it strips version statements.  Here's the archive:

http://www.smocky.com/arc/digc-0.0.15.zip

There is no Linux version yet.

Here's the documentation:

Introduction
---------------------------------------

digc is a compiler manager for the dmd compiler for D.  It simplifies 
all tasks, makes distributing libraries a snap (and if you don't want to 
distribute your source, it protects it), and turns DLL creation in 
Windows from an exercise in obfuscated frustration into a seven-letter 
command-line parameter.

Building
---------------------------------------

To build digc, run make_digc.  It will search for the installation 
directories of DMD itself, but in case you have them installed in 
strange locations you can overload these; use "make_digc -help" for a 
summary.

Compiling Programs
---------------------------------------

Here is an example of compiling two programs:

      code
     digc halhello.d / cartoon.d -then-run -windowed -O -release
      endcode

The first program built is halhello.exe using halhello.d aas source. 
The "/" separates programs; all programs in one command share options 
(such as -windowed, -O, and -release).

The second program built is cartoon.exe using cartoon.d as source.  If 
both programs are successfully compiled, then it runs cartoon.exe 
afterwards (that's the meaning of -then-run).  -windowed says to compile 
them as windowed applications rather than DOS applications.  -O and 
-release are DMD commands that are passed through unmolested.

Note that you don't specify any libraries to use.  digc identifies the
necessary libraries automatically from the source.

To build an executable of a certain name, rather than extracting it from 
the first source file, use "-exe=" followed by the name without 
extension; for example, "-exe=halhello".

Compiling Libraries
---------------------------------------

A stripped version of the library source is stored in the library file. 
  All function bodies (except for functions within templates) and 
unnecessary whitespace is removed.  When digc determines that the 
library is being used by a program, it regenerates this ABI transparently.

If providing source is undesirable, you only need to include the library 
binary.

For example, if we have a module like this:

     module x;

     void foo () { }

Then we can compile it into a library with this command:

     digc x.d -lib=x -install

This creates the library file and installs it on this computer.  You can 
now switch to another directory so that x.d is not visible in the 
imports.  If you have another module like this:

     module y;

     import x;

Then compile it with digc, it will regenerate the interface for the "x" 
library and allow it to work properly.

"version" and "debug" statements are collapsed during stripping of a 
library; the version and debug levels and settings will not be alterable 
after compilation.  This collapsing is currently not robust; template 
objects should use version statements at the top scope only.  For 
example, this is okay:

     template x ()
     {
         version (a)
             ...
     }

However, this might cause a problem:

     template y ()
     {
         void foo ()
         {
             version (a)
                 ...
         }
     }

To create a shared library, add the "-shared" option.  In Windows this 
creates a DLL file as well as a LIB file, and it automatically exports 
all variables from the library.  This makes it behave similarly to Linux 
shared libraries.  However, the DLL uses its own independent garbage 
collector, so you must be careful to copy data properly.

Build Files
---------------------------------------

Build files are an optional method of compilation that makes creating 
large, multi-library packages much easier.  To start building a package, 
use -build=path:

     digc -build=net

This searches for a file named "build" under the net directory.  Here's 
a sample build file:

     // comment
     build sub1 sub2

     version ver1
     {
         build sub3
     }

     library lib1
     {
         version ver2
         {
             add file1
             -O
         }

         add file2 file3*
     }

     example exa1
     {
         add file5
     }

TODO.

Options Summary
---------------------------------------

Here is a summary of the command-line options.

     files
         Add files to the compilation.  This can include wildcards, which
         are expanded on Windows.

     -not=wildcard
         Exclude these files from the compilation.  Arguments are
         evaluated in left-to-right order.

     -exe=name
         Build an executable with the given name; do not give an
         extension.  If this argument is not provided, the name of the
         executable is taken from the first source file after removing
         its extension.

     -lib=name
         Build a library with the given name; do not provide an
         extension.

     -shared
         For libraries, make this a shared library.  In Windows this
         means to make a DLL.  You can expect that the shared library
         will have a different GC context, so you must be careful to copy
         data properly.

     -windowed
         Compile under windowed mode.  Under Windows, this means that the
         program will not create a DOS Prompt when executed.

     -then=cmd
         Run the command after successful compilation of all programs.

     -then-run
         Run the program being specified after successful compilation of
         all programs.

     -install
         Copy created executables to the DMD binary directory (DMD_bin),
         created libraries to the DMD library directory (DMD_lib), and
         created shared libraries to the system directory
         (SystemDirectory).

     -build=path
         Compile the build file in the specified path.

     -no-create-assembly-file
         Don't create and compile in an assembly file on Windows.  This
         file tells Windows that it is XP-capable and can be skinned
         using new-style widgets.

     -no-delete-temp-dir
         Don't delete the temporary directory used when expanding library
         files.  This command is here mostly for when you think digc is
         stripping libraries incorrectly.

You can use a set of expansions for various system directories by using
$[XXX], $(XXX), or ${XXX}; for example, ${SystemDirectory}.  These 
directories
are:

     SystemDirectory
         The system library directory; in Windows this is the
         windows\system32 directory.  In Linux this would be
         /usr/local/lib.

     DMD_bin
         The location of DMD's binary files.

     DMD_lib
         The location of DMD's library files.

     DMD_src
         The location of DMD's source files.

     Phobos
         The location of Phobos.
Sep 25 2004
next sibling parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
"Burton Radons" <burton-radons shaw.ca> escribió en el mensaje 
news:cj4j4l$1ucm$1 digitaldaemon.com...
| Okay, I finally finished digc.
|
| ...
|

Line 39 of digc.d should be "import std.c.windows.windows;\n" instead of
"import 
windows;\n"

-----------------------
Carlos Santander Bernal 
Sep 26 2004
parent reply Burton Radons <burton-radons shaw.ca> writes:
Carlos Santander B. wrote:

 "Burton Radons" <burton-radons shaw.ca> escribió en el mensaje 
 news:cj4j4l$1ucm$1 digitaldaemon.com...
 | Okay, I finally finished digc.
 |
 | ...
 |
 
 Line 39 of digc.d should be "import std.c.windows.windows;\n" instead of
"import 
 windows;\n"
Oops, updated zip. I should write a test suite. What do you use DLLs for, if you didn't pick that up while reading? After writing the feature and confirming it worked, I haven't used it once. Hmm, I think I know a way to make DLLs use the main program's garbage collector. I'll look into it once I've kicked this cursed cold.
Sep 26 2004
parent "Carlos Santander B." <carlos8294 msn.com> writes:
"Burton Radons" <burton-radons shaw.ca> escribió en el mensaje 
news:cj7tlq$usp$1 digitaldaemon.com...
| Oops, updated zip.  I should write a test suite.  What do you use DLLs
| for, if you didn't pick that up while reading?  After writing the
| feature and confirming it worked, I haven't used it once.
|

I don't. I just read the source.

| Hmm, I think I know a way to make DLLs use the main program's garbage
| collector.  I'll look into it once I've kicked this cursed cold.

That'd be good, I guess.

-----------------------
Carlos Santander Bernal 
Sep 27 2004
prev sibling next sibling parent reply J C Calvarese <jcc7 cox.net> writes:
Burton Radons wrote:

 Okay, I finally finished digc.  For some reason I thought writing a 
 parser to handle version statements properly would be a good idea.  Then 
 I started thinking that I should store the parsed data as DOM so I 
 started writing a DOM implementation.  Then I thought that I don't like 
 how my implementation wouldn't be able to interface with other languages 
 or use the other features OMG CORBA is built for, so I started looking 
 in the CORBA documentation.  Then I realised I forgot about digc.
 
 The digc documentation says it all, so I'll repeat it here.  The big 
 changes are that it uses a builder program so that it can work no matter 
 where you decided to install DMD (it'll search out the most obvious 
 suspects).  The stripper also works with the newer revisions of the 
 language.  Finally, it strips version statements.  Here's the archive:
 
 http://www.smocky.com/arc/digc-0.0.15.zip
Sounds great! Do you plan on working on the GUI, OpenGL, Scintilla parts of dig? The UnDig project (http://www.dsource.org/projects/undig/) was attempt to keep all of that stuff working with newer versions of the DMD compiler. Unfortunately, we feel behind and although we can get things to compile with recent DMD versions, we have runtime errors aplenty. If you're already reworking these parts of dig, I'm less inclined to spend time trying to fix it myself. :) -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Sep 26 2004
parent reply Burton Radons <burton-radons shaw.ca> writes:
J C Calvarese wrote:

 Do you plan on working on the GUI, OpenGL, Scintilla parts of dig? The 
 UnDig project (http://www.dsource.org/projects/undig/) was attempt to 
 keep all of that stuff working with newer versions of the DMD compiler. 
 Unfortunately, we feel behind and although we can get things to compile 
 with recent DMD versions, we have runtime errors aplenty.
The GUI requires a clearer, more structured design; I don't think it's salvageable. It's really buggy anyway. Spinners (proper spinners, not that Windows junk) and integrated expression evaluators should definitely make it into a newer GUI library. OpenGL/math is worth salvaging, and I have a WIP for it; I don't know when I'll be able to get back to finish it. Scintilla should be trivially portable; all it cares about is the HWND.
Sep 26 2004
next sibling parent J C Calvarese <jcc7 cox.net> writes:
Burton Radons wrote:
 J C Calvarese wrote:
 
 Do you plan on working on the GUI, OpenGL, Scintilla parts of dig? The 
 UnDig project (http://www.dsource.org/projects/undig/) was attempt to 
 keep all of that stuff working with newer versions of the DMD 
 compiler. Unfortunately, we feel behind and although we can get things 
 to compile with recent DMD versions, we have runtime errors aplenty.
The GUI requires a clearer, more structured design; I don't think it's salvageable. It's really buggy anyway. Spinners (proper spinners, not that Windows junk) and integrated expression evaluators should definitely make it into a newer GUI library.
I guess I suspected as much. With the various GUI efforts out there, I'm sure at least one of them will take off.
 
 OpenGL/math is worth salvaging, and I have a WIP for it; I don't know 
 when I'll be able to get back to finish it.
I was mostly curious. I always thought "cartoon" example was pretty cool.
 
 Scintilla should be trivially portable; all it cares about is the HWND.
That's good to know. Whenever I browsed the source of dig everything seemed so interconnected that I didn't even want to try untangling it. Thanks for the info. -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Sep 26 2004
prev sibling parent John Reimer <brk_6502 NOSP_AM.yahoo.com> writes:
Burton Radons wrote:

 OpenGL/math is worth salvaging, and I have a WIP for it; I don't know 
 when I'll be able to get back to finish it.
I think, at the very least, the OpenGL portion of dig should be taken out, maintained, and improved. It's an incredibly nifty piece of work.
Sep 27 2004
prev sibling parent Ant <Ant_member pathlink.com> writes:
In article <cj4j4l$1ucm$1 digitaldaemon.com>, Burton Radons says...
Okay, I finally finished digc.
and it's good, thank you. is there a support group? is it planed? I have a few issues, for instance, for some reason I have to delete my lib before calling digc or it will say "no changes, bypassing compilation" (or something like that). Ant
Oct 06 2004