newbie -- how to build module?

Mantis mail.mantis.88 at gmail.com
Mon Feb 13 00:16:15 PST 2012


13.02.2012 9:45, Alf P. Steinbach пишет:
> I first started with a Windows message box program and installing an 
> IDE. I'm now using the VisualD plug-in with the Visual Studio 10 
> Shell, after battling a bit with installation of service pack 1 for 
> Visual Studio. VisualD works, sort of, except the devs forgot that the 
> resource compiler needs an INCLUDE variable so that it finds 
> <windows.h>, so, silly as it is, the VisualD plugin can't be used 
> directly as-is to create a modern look and feel Windows program. I 
> solved it by running Visual Studio from the command line.
>
> Anyway, I haven't yet started delving into the language documentation 
> or any tutorials, just used gut-feeling, so I'd appreciate discussion 
> of how to make this my first D console program less non-idiomatic <g>:
>
>
> <code>
> import std.stdio;
> import std.ascii;
> import std.string; // chop
>
> //import core.sys.windows.unicode_based_api; <-- DOES NOT WORK.
>
> char lastCh( string s )
> {
> return (s.length == 0? '\0' : s[s.length - 1]);
> }
>
> void main()
> {
> char[] buf;
>
> writeln( "module core.sys.windows.unicode_api;" );
> writeln( "import core.sys.windows.windows;" );
> while( stdin.readln( buf ) )
> {
> string identifier;
> bool inIdentifier = false;
>
> foreach( char c; buf )
> {
> if( isAlpha( c ) )
> {
> if( !inIdentifier ) { identifier = ""; }
> identifier ~= c;
> inIdentifier = true;
> }
> else if( c == '_' || isDigit( c ) )
> {
> if( inIdentifier )
> {
> identifier ~= c;
> }
> }
> else
> {
> inIdentifier = false;
> if( isWhite( c ) )
> {
> // Ignore.
> }
> else
> {
> if( c == '(' && lastCh( identifier ) == 'W' )
> {
> immutable string name = chop( identifier ); // removes last char
> writeln( "alias ", identifier, " ", name, ";" );
> }
> identifier = "";
> }
> }
> }
> }
> }
> </code>
>
> The problem is, I can't manage to build the generated module.
>
> The compiler is protesting something about the module being in a 
> source code file that it can't read.
>
> E.g. with "import unicode_based_api;" it exclaims,
>
> <eror>
> Error 1 Error: module unicode_based_api is in file 
> 'unicode_based_api.d' which cannot be read d:\winfolders\alf\my 
> documents\visual studio 
> 2010\Projects\GenWinFuncAliases\GenWinFuncAliases\main.d 5
> </eror>
>
> ?
>
>
> Cheers,
>
> - Alf
>
What is "unicode_based_api" file? I don't see it in core.sys.windows:
http://github.com/D-Programming-Language/druntime/tree/master/src/core/sys/windows


More information about the Digitalmars-d mailing list