eudora-mac/util.c

1 line
110 KiB
C
Raw Permalink Normal View History

2018-05-23 09:59:15 +00:00
/* Copyright (c) 2017, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "util.h" #define FILE_NUM 41 /* Copyright (c) 1990-1992 by the University of Illinois Board of Trustees */ /********************************************************************** * various useful functions **********************************************************************/ typedef struct SoundEntryStruct SoundEntry, *SoundEntryPtr; struct SoundEntryStruct { SoundEntryPtr next; Str255 name; }; #pragma segment Util #ifdef KERBEROS #include <krb.h> #endif char BitTable[] = {0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80}; pascal Boolean PasswordFilter(DialogPtr dgPtr,EventRecord *event,short *item); void CopyPassword(UPtr password); int ResetPassword(void); UHandle PwChars=nil; void NukeMenuItem(MenuHandle mh,short item); void CompactTempZone(void); short FindMenuByName(UPtr name); UPtr GetRStringLo(PStr theString,int theIndex,PersHandle forPers); void *TempNewHandleGlue(long size,OSErr *err); void QueueSound(PStr name); void PlaySystemSound(PStr name); void AddSoundsToMenuFrom(MenuHandle mh, short vRef, long dirID); OSErr FindSystemSound(OSType disk,OSType folder,PStr name,FSSpecPtr spec); // Globals Movie gSoundMovie; SoundEntryPtr gSystemSoundList; GWorldPtr gGWorld; #if 0 /********************************************************************** * NeedYield **********************************************************************/ Boolean NeedYield(void) { short numThreads = GetNumBackgroundThreads(); long elapsedTicks = TickCount() - ThreadYieldTicks; long vicomFactor = (InBG ? 1 : (!VicomIs ? 1 : (GetRLong(VICOM_FACTOR)))); long yieldInterval = (InBG ? GetRLong(BG_YIELD_INTERVAL) : GetRLong(FG_YIELD_INTERVAL)) / ((numThreads ? numThreads : 1) * vicomFactor); // ASSERT(InBG ? (elapsedTicks < 120) : 1); // are we hogging time somewhere? if (EventPending() || (elapsedTicks > yieldInterval)) return true; return false; } #endif /********************************************************************** * write zeroes over an area of memory **********************************************************************/ void WriteZero(void *pointer,long size) { UPtr u = (UPtr)pointer; while (size--) *u++ = 0; } #ifdef DEBUG /********************************************************************** * SetBalloons - help the debugger a bit **********************************************************************/ void SetBalloons(Boolean on) { HMSetBalloons(on); } #endif /********