14887Schin /*********************************************************************** 24887Schin * * 34887Schin * This software is part of the ast package * 4*12068SRoger.Faulkner@Oracle.COM * Copyright (c) 1985-2010 AT&T Intellectual Property * 54887Schin * and is licensed under the * 64887Schin * Common Public License, Version 1.0 * 78462SApril.Chin@Sun.COM * by AT&T Intellectual Property * 84887Schin * * 94887Schin * A copy of the License is available at * 104887Schin * http://www.opensource.org/licenses/cpl1.0.txt * 114887Schin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 124887Schin * * 134887Schin * Information and Software Systems Research * 144887Schin * AT&T Research * 154887Schin * Florham Park NJ * 164887Schin * * 174887Schin * Glenn Fowler <gsf@research.att.com> * 184887Schin * David Korn <dgk@research.att.com> * 194887Schin * Phong Vo <kpv@research.att.com> * 204887Schin * * 214887Schin ***********************************************************************/ 224887Schin #include "FEATURE/uwin" 234887Schin 244887Schin #if !_UWIN || _lib_a64l 254887Schin _STUB_a64l()264887Schinvoid _STUB_a64l(){} 274887Schin 284887Schin #else 294887Schin 304887Schin #define a64l ______a64l 314887Schin #define l64a ______l64a 324887Schin 334887Schin #include <stdlib.h> 344887Schin #include <string.h> 354887Schin 364887Schin #undef a64l 374887Schin #undef l64a 384887Schin 394887Schin #if defined(__EXPORT__) 404887Schin #define extern __EXPORT__ 414887Schin #endif 424887Schin 434887Schin static char letter[65] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 444887Schin a64l(const char * str)454887Schinextern long a64l(const char *str) 464887Schin { 474887Schin register unsigned long ul = 0; 484887Schin register int n = 6; 494887Schin register int c; 504887Schin register char *cp; 514887Schin for(n=0; n <6; n++) 524887Schin { 534887Schin if((c= *str++)==0) 544887Schin break; 554887Schin if(!(cp=strchr(letter,c))) 564887Schin break; 574887Schin ul |= (cp-letter)<< (6*n); 584887Schin } 594887Schin return((long)ul); 604887Schin } 614887Schin l64a(long l)624887Schinextern char *l64a(long l) 634887Schin { 644887Schin static char buff[7]; 654887Schin unsigned ul = ((unsigned long)l & 0xffffffff); 664887Schin register char *cp = buff; 674887Schin while(ul>0) 684887Schin { 694887Schin *cp++ = letter[ul&077]; 704887Schin ul >>= 6; 714887Schin } 724887Schin *cp = 0; 734887Schin return(buff); 744887Schin } 754887Schin 764887Schin #endif 77