Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion C<stat> opcode and interface
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Leopold Toetsch  
View profile  
 More options Mar 10 2004, 5:49 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Wed, 10 Mar 2004 11:39:49 +0100
Local: Wed, Mar 10 2004 5:39 am
Subject: [PROPOSAL] C<stat> opcode and interface
Proposal C<stat> opcode and interface

1) ops

   stat (out PMC, in STR, in INT)
   stat (out PMC, in PMC, in INT)

Return a new array-like[1] PMC $1 with file stats from file (PIO or
string) $2,
or PerlUndef, if file doesn't exist, $3 are flags:

   .PARROT_STAT_NO_FOLLOW_LINK

The array(-like)  has keyed access with these keys

   .PARROT_STAT_FILE_SIZE
   .PARROT_STAT_FILE_SIZE_LO
   .PARROT_STAT_FILE_SIZE_HI

   .PARROT_STAT_MODE a bitmask with these bits:
      .PARROT_STAT_MODE_ISDIR
      .PARROT_STAT_MODE_ISFILE
      [ more platform-unspecific bits ]

   .PARROT_STAT_PERM a bitmask with these bits
      .PARROT_STAT_PERM_IS_READABLE
      .PARROT_STAT_PERM_IS_WRITABLE
      .PARROT_STAT_PERM_IS_EXECUTABLE

   .PARROT_STAT_MTIME modified time

   .PARROT_STAT_OS_TYPE a constant defining the os-specific
      part that follows
        .PARROT_STAT_stat
        .PARROT_STAT_stat64
        ...

   .PARROT_STAT_OS_SPECIFIC
       A (Un)?ManagedStruct PMC with OS-specific data like a
        struct stat64

2) Interface

    PMC* Parrot_stat_s(Interp*, STRING* file, INTVAL flags);
    PMC* Parrot_stat_p(Interp*, PMC*    pio,  INTVAL flags);

3) Interface to platforms

    INTVAL Parrot_stat_os_s(Interp*, Parrot_stat*, STRING* file, INTVAL
flags);
    INTVAL Parrot_stat_os_p(Interp*, Parrot_stat*, PMC*    pio,  INTVAL
flags);

    typedef struct _parrot_stat {
       size64_t size;
       UINTVAL mode;
       UINTVAL perm;
       FLOATVAL mtime;  // in Parrot units
       UINTVAL os_stat_type;
       union {
         struct stat;
        struct stat64;
        ...
      } u;
    } Parrot_stat;

4) Notes
The information in the first few fields should not be platform
specific. If platforms have more in common then above bits, the
structure should be expanded.

[1] it needs just these vtables implemeted: I0 = P0[i], N0 = P0[i],
i.e. get_{integer,number}_keyed_int

Comments, improvements, and implementations thereafter welcome
leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.