1N/A/***********************************************************************
1N/A* *
1N/A* This software is part of the ast package *
1N/A* Copyright (c) 1985-2011 AT&T Intellectual Property *
1N/A* and is licensed under the *
1N/A* Common Public License, Version 1.0 *
1N/A* by AT&T Intellectual Property *
1N/A* *
1N/A* A copy of the License is available at *
1N/A* http://www.opensource.org/licenses/cpl1.0.txt *
1N/A* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
1N/A* *
1N/A* Information and Software Systems Research *
1N/A* AT&T Research *
1N/A* Florham Park NJ *
1N/A* *
1N/A* Glenn Fowler <gsf@research.att.com> *
1N/A* David Korn <dgk@research.att.com> *
1N/A* Phong Vo <kpv@research.att.com> *
1N/A* *
1N/A***********************************************************************/
1N/A#pragma prototyped
1N/A
1N/A/*
1N/A * ast dynamic data initialization
1N/A */
1N/A
1N/A#ifdef _UWIN
1N/A
1N/A#define _std_def_cfree 1
1N/A
1N/A#include <sfio_t.h>
1N/A#include <ast.h>
1N/A
1N/A#undef strcoll
1N/A
1N/A#include <ast_windows.h>
1N/A
1N/Aextern Sfio_t _Sfstdin;
1N/Aextern Sfio_t _Sfstdout;
1N/Aextern Sfio_t _Sfstderr;
1N/A
1N/A#include "sfhdr.h"
1N/A
1N/A#undef sfstdin
1N/A#undef sfstdout
1N/A#undef sfstderr
1N/A
1N/A#if defined(__EXPORT__)
1N/A#define extern __EXPORT__
1N/A#endif
1N/A
1N/A/*
1N/A * for backward compatibility with early UNIX
1N/A */
1N/A
1N/Aextern void
1N/Acfree(void* addr)
1N/A{
1N/A free(addr);
1N/A}
1N/A
1N/Aextern void
1N/A_ast_libinit(void* in, void* out, void* err)
1N/A{
1N/A Sfio_t* sp;
1N/A
1N/A sp = (Sfio_t*)in;
1N/A *sp = _Sfstdin;
1N/A sfstdin = sp;
1N/A sp = (Sfio_t*)out;
1N/A *sp = _Sfstdout;
1N/A sfstdout = sp;
1N/A sp = (Sfio_t*)err;
1N/A *sp = _Sfstderr;
1N/A sfstderr = sp;
1N/A}
1N/A
1N/Aextern void
1N/A_ast_init(void)
1N/A{
1N/A struct _astdll* ap = _ast_getdll();
1N/A
1N/A _ast_libinit(ap->_ast_stdin,ap->_ast_stdout,ap->_ast_stderr);
1N/A}
1N/A
1N/Aextern void
1N/A_ast_exit(void)
1N/A{
1N/A if (_Sfcleanup)
1N/A (*_Sfcleanup)();
1N/A}
1N/A
1N/ABOOL WINAPI
1N/ADllMain(HINSTANCE hinst, DWORD reason, VOID* reserved)
1N/A{
1N/A switch (reason)
1N/A {
1N/A case DLL_PROCESS_ATTACH:
1N/A break;
1N/A case DLL_PROCESS_DETACH:
1N/A _ast_exit();
1N/A break;
1N/A }
1N/A return 1;
1N/A}
1N/A
1N/A#else
1N/A
1N/A#include <ast.h>
1N/A
1N/A#if _dll_data_intercept && ( _DLL_BLD || _BLD_DLL )
1N/A
1N/A#undef environ
1N/A
1N/Aextern char** environ;
1N/A
1N/Astruct _astdll _ast_dll = { &environ };
1N/A
1N/Astruct _astdll*
1N/A_ast_getdll(void)
1N/A{
1N/A return &_ast_dll;
1N/A}
1N/A
1N/A#else
1N/A
1N/ANoN(astdynamic)
1N/A
1N/A#endif
1N/A
1N/A#endif