📄 porting
字号:
PORTING SPICE3e1 Porting Spice3 to a new operating system usually consists of listing the capabilities of that operating system in a new '.h' file and including this '.h' file in the standard portability sequence. This also needs to be done separately for the numerical capabilities of the system hardware (this consist of only two parameters at present). For each operating system there is a file in the "include/" directory named "os_xxx.h", where xxx identifies the given operating system (ex. "os_bsd.h", "os_aix.h"). These files are selectively #include-d by "include/port.h". For a new operating system, you should add the appropriate "#include" line to "include/port.h". Be sure to guard the new "#include" line with "#ifdef/#endif", as is done with the other operating system capability files. The same may also need to be done for your hardware (for the file "hw_xxx.h"), though there is typically very little difference in hardware. Note that operating system which are a derivative of another supported system can '#include' the "os_xxx.h" file from the other system. For example, "os_aix.h" includes "os_sysv.h", which in turn includes "os_unix.h". The entries that can go into a "os_xxx.h" file are described below; most are simple flags (e.g. HAS_xxxx). To turn on a flag, insert the "#define" line for that flag; to turn off the flag, simply leave the "#define" line out. Other entries are strings, others single-quoted characters or numbers. Be sure to use the same type as the example values shown. There are always exceptions to the rule. Some incompatibilities have not yet been dealt with cleanly; review the other "os_xxx.h" files, the file "capabil.h", and the file "suffix.h" to understand how some problems have been handled (note especially the lines like "#define index strchr"). After trying to compile, you may yet find non-portable code that is not guarded by one of the following options. You are encouraged to alter the source code (".c" or ".h" files) in the style of the current portability scheme. Note: to enable X11 or MFB, the flag AVAIL_X11 or AVAIL_MFB, respectively, must be included in the "os_xxx.h" file; this _was_ to simplify the problems of forgetting to re-edit the "config.h" file, but this is no longer necessary.---------- Machine architecture numerics (hw_xxx.h) parameters: (In the future this will be more complete and will be used for tuning the accuracy or performance of the numerical algorithms)#define HAS_VAX_FPERRORS /* Only for Vax */#define MAXPOSINT 4294967295 /* == 2^32 - 1, maximum positive integer */#define MAX_EXP_ARG 87.0 /* Approximate largest arg to exp() */---------- Operating System (os_xxx.h) parameters:----- Enabling flags#define AVAIL_MFB /* If the MFB package can work on this system */#define AVAIL_X11 /* If the X11 Window System can work */----- String or character constants#define DIR_CWD "." /* Current working directory */#define DIR_PATHSEP "/" /* subdirectory separator */#define DIR_TERM '/' /* Subdirectory component terminator */----- sprintf( ) format strings#define TEMPFORMAT "/tmp/%s%d" /* sprintf format for creating temp files */#define SYSTEM_MAIL "mail -s \"%s (%s) Bug Report\" %s" /* mail command */#define SYSTEM_PLOT5LPR "lpr -P%s -g %s" /* For printing Unix plot(5) files */#define SYSTEM_PSLPR "lpr -P%s %s" /* For printing postscript files */----- System capabilities#define HAS_ACCESS /* access( ) */#define HAS_ASCII /* eighth bit of a character is not used */#define HAS_ATRIGH /* acosh( ), asinh( ), atanh( ) */#define HAS_BCOPY /* bcopy( ), bzero( ) */#define HAS_BSDDIRS /* <sys/dir.h> */#define HAS_BSDRANDOM /* srandom( ) and random( ) */#define HAS_BSDRLIMIT /* getrlimit( ) returns proc limits */#define HAS_BSDRUSAGE /* getrusage( ) returns cpu usage */#define HAS_BSDSOCKETS /* <net/inet.h>, socket( ), etc. */#define HAS_BSDTIME /* gettimeofday( ) return time */#define HAS_BSDTTY /* <sgtty.h> */#define HAS_CHDIR /* for tree filesystems, chdir( ) */#define HAS_CLEARERR /* clearerr( ), should be in stdio */#define HAS_CTYPE /* <ctype.h>, iswhite( ), etc. */#define HAS_DOSDIRS /* Emulate opendir, etc. */#define HAS_DUP2 /* dup2(a, b) for shifting file descrs. */#define HAS_ENVIRON /* getenv( ) */#define HAS_EXIT1 /* If exit status of 1 is normal for procs */#define HAS_FCNTL /* acosh( ), asinh( ), atanh( ) */#define HAS_FTIME /* ftime( ), <times.h> */#define HAS_GETCWD /* getcwd(buf, size) */#define HAS_GETPID /* getpid( ) to identify processes */#define HAS_GETPW /* getpwuid( ), etc. */#define HAS_GETWD /* getwd(buf) */#define HAS_INDEX /* index( ) instead of strchr( ) */#define HAS_NO_IEEE_LOGB /* no logb( ) and scalb( ) functions */#define HAS_NO_IEEE_LOGB_DECL /* logb( ) and scalb( ) not in math.h */#define HAS_ISATTY /* isatty( ) */#define HAS_LONGJUMP /* setjmp( ), longjmp( ) */#define HAS_MINDATA /* Machine has limited data area */#define HAS_NOINLINE /* Machine has limited data area */#define HAS_NOVM /* Machine has limited data area */#define HAS_NO_ATRIGH_DECL /* if asinh( ) is not in math.h */#define HAS_PCTERM /* For MS-DOS, use PC graphics for MFB */#define HAS_POPEN /* popen( ), pipe through shell command */#define HAS_QSORT /* qsort( ) exists */#define HAS_SHORTMACRO /* If the compiler can't handle long macros */#define HAS_STAT /* stat( ) returns info on files */#define HAS_STDLIB /* #include <stdlib.h> for libc defs */#define HAS_STRCHR /* strchr( ) instead of index( ) */#define HAS_STRINGS /* #include <strings.h> (else <string.h>) */#define HAS_SYSTEM /* system( ), execute system command */#define HAS_SYSVDIRS /* <dirent.h> */#define HAS_SYSVRLIMIT /* ulimit( ) reports on proc size limit */#define HAS_SYSVRUSAGE /* utimes( ) reports on cpu usage */#define HAS_SYSVTIME /* time( ) returns seconds from 1970 */#define HAS_SYSVTTY /* <termio.h> */#define HAS_TERMCAP /* tgetxxx( ) */#define HAS_TERMREAD /* Has "read" syscall from terminals */#define HAS_UNIX_SIGS /* signal( ), kill( ) */#define HAS_UNLINK /* unlink( ), for removing files */#define HAS_VFORK /* BSD-ism, should not be necessary */#define HAS_VMSHACK /* Stand on your head for VMS */#define HAS_VPERROR /* perror( ) defined by standard '.h's */#define HAS_WAIT /* wait( ) wait for processes */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -