home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / debug / debug_m.cp next >
Encoding:
Text File  |  1998-04-08  |  1.9 KB  |  70 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #include <errno.h>
  20.  
  21. #include <Errors.h>
  22.  
  23. #include "xp.h"
  24. #include "xp_mem.h"
  25. #include "xpassert.h"
  26. //#include "sys/errno.h"
  27.  
  28. #include "xp_mac.h"
  29. #include "xp_debug.h"
  30.  
  31. #include <LHandleStream.h>
  32. #include <LCaption.h>
  33. #include <UDrawingState.h>
  34.  
  35. /*-----------------------------------------------------------------------------
  36.     xp_MacToUnixErr
  37.     Maps Mac system errors to unix-stype errno errors.
  38. -----------------------------------------------------------------------------*/
  39.  
  40. int xp_MacToUnixErr (OSErr err)
  41. {
  42.     if (!err)
  43.         return 0;
  44.     
  45.     switch (err) {
  46.         case noErr: return 0;
  47.         case memLockedErr: return -1;
  48.         /* some error messages have no standard counterpart; how to deal? */
  49.         case resNotFound:
  50.             XP_Abort ("Macintosh-specific error, should not be mapped to unix.");
  51.         case rfNumErr:
  52.             return EBADF;
  53.     };
  54. #ifdef DEBUG
  55.     XP_Abort ("Can't figure out what to return");
  56. #endif
  57.     return -1; 
  58. }
  59.  
  60. /*-----------------------------------------------------------------------------
  61.     Global Debug Variables
  62. -----------------------------------------------------------------------------*/
  63.  
  64. #ifdef DEBUG
  65.  
  66. int Debug = 1;
  67.  
  68. #endif /* DEBUG */
  69.  
  70.