19#import <Foundation/Foundation.h>
25#if defined(__x86_64__)
67 memcpy(
x, *buf,
sizeof(
short));
69 *buf +=
sizeof(short);
83 memcpy(
x, *buf,
sizeof(
int));
103 memcpy(
x, *buf,
sizeof(
long long));
105 *buf +=
sizeof(
long long);
114 unsigned int timeLow;
115 unsigned short version, timeMid, timeHiAndVersion;
116 unsigned char clockSeqHiAndReserved, clockSeqLow,
node[6];
126 for (i = 0; i < 6; i++)
130 sprintf(*uuid,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
131 timeLow, timeMid, timeHiAndVersion, clockSeqHiAndReserved,
152 for (i = 0; i < nchars; i++)
154 (*str)[nchars] =
'\0';
164 unsigned int year = datetime>>26;
165 unsigned int month = (datetime<<6)>>28;
166 unsigned int day = (datetime<<10)>>27;
167 unsigned int hour = (datetime<<15)>>27;
168 unsigned int min = (datetime<<20)>>26;
169 unsigned int sec = (datetime<<26)>>26;
171 *time = 10000*hour + 100*min + sec;
177 while ((siz =
read(fd, buffer, len)) < 0 && errno == EINTR)
188 char *header =
malloc(len);
195 if (strncmp(header,
"root", 4)) {
200 char *buffer = header + 4;
210 int seekfree, seekinfo;
233 int nk =
sizeof(
int)+
sizeof(
short)+2*
sizeof(
int)+2*
sizeof(
short)+2*
sizeof(
int);
238 if (nbytes + fh->
begin > 300) {
242 if (
ReadBuffer(fd, header, nbytes) != nbytes) {
252 short dversion, versiondir;
254 versiondir = dversion%1000;
261 if (dversion > 1000) {
274 fh->
uuid = strdup(
"-");
276 buffer = header + nk;
283 NSLog(
@"%s: version = %d, begin = %d, end = %lld, units = %hhd, compress = %d",
287 [titleSet addObject: [NSString stringWithUTF8String: fh->title]];
312 char *header, *buffer;
314 long long idcur = fh->
begin;
317 while (idcur < fh->end) {
321 if (idcur+nread > fh->
end) nread = fh->
end-idcur-1;
346 if (versionkey > 1000) {
355 if (keylen > nread) {
365 classname = strdup(
"FreeSegments");
371 classname = strdup(
"StreamerInfo");
377 classname = strdup(
"KeysList");
382 if (objlen != nbytes-keylen)
383 cx = (float)(objlen+keylen)/(float)nbytes;
388 [nameSet addObject: [NSString stringWithUTF8String: name]];
390 [titleSet addObject: [NSString stringWithUTF8String: title]];
405int ReadFile(NSString *fullPath, NSMutableSet *nameSet, NSMutableSet *titleSet)
411 fh.
name = [fullPath UTF8String];
412 int fd = open(fh.
name, O_RDONLY, 0644);
421 if (
ReadKeys(fd, &fh, nameSet, titleSet) == -1) {
subroutine node(ivo, nuserm, iposp)
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
static void FromBufInt(char **buf, int *x)
static void FromBufChar(char **buf, char *x)
static void FromBufShort(char **buf, short *x)
static void FromBufUUID(char **buf, char **uuid, int versiondir)
static int ReadHeader(int fd, struct FileHeader_t *fh, NSMutableString *html)
static void GetDateAndTime(unsigned int datetime, int *date, int *time)
static void FromBufLL(char **buf, long long *x)
static int ReadBuffer(int fd, char *buffer, int len)
static void FromBufStr(char **buf, char **str)
int ReadFile(NSString *fullPath, NSMutableSet *nameSet, NSMutableSet *titleSet)
static int ReadKeys(int fd, struct FileHeader_t *fh, NSMutableSet *nameSet, NSMutableSet *titleSet)