On 09/15/2018 03:16 PM, Brad Gilbert wrote:
Anyway I edited the Option Types post.

Hi Brad,

I like it!  That took some thinking.  You kicked it!

     To designate that it must have a defined value assigned to
     it (not be in the null state), use the :D "smiley" designation.

     It is also possible to designate that it must always be a
     null using the :U "smiley".

That `:U` thing comes in handy with NativeCall, where a totally
blank variable is required on the input.

-T


sub GetXDisplay () is export {
#`{
    reference: man XDisplayName
    char *XDisplayName(char *string);
sub display-name(Str:D $name) is native('X11') is symbol("XDisplayName") { * }

reference: https://tronche.com/gui/x/xlib/event-handling/protocol-errors/XDisplayName.html The XDisplayName() function returns the name of the display that XOpenDisplay() would attempt to use. If a NULL string is specified, XDisplayName() looks in the environment for the display and returns the display name that XOpenDisplay() would attempt to use. This makes it easier to report to the user precisely which display the program attempted to open when the initial connection attempt failed.
}

   my $Display;
   my $NullStr; # Do not initialize this guy!

   # char *XDisplayName(char *string);
   sub XDisplayName(Str:D $name) is native('X11') returns Str { * };

   $Display = XDisplayName( $NullStr );
   return $Display;
}

Reply via email to