📄 atol.c
字号:
/*************************************************************************** Copyright Mentor Graphics Corporation 2002* All Rights Reserved.** THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS* SUBJECT TO LICENSE TERMS.**************************************************************************//************************************************************************** FILE NAME VERSION** atol.c Nucleus Common Library 1.1** DESCRIPTION** This file contains the implementation of NCL_atol.** DATA STRUCTURES** None.** FUNCTIONS** NCL_atol** DEPENDENCIES** ncl.h* stdlib.h* ctype.h* convert.h* nucleus.h*************************************************************************/#define NU_NCL_SOURCE_FILE#include "ncl\inc\ncl.h"#include "ncl\inc\stdlib.h"#include "ncl\inc\ctype.h"#include "ncl\inc\convert.h"#include "plus\nucleus.h" /* MMU Support *//*************************************************************************** FUNCTION** NCL_atol** DESCRIPTION** Converts string of ASCII chars to a long integer.** INPUTS** nptr Null-terminated string to be converted.** OUTPUTS** long Value the string represented.**************************************************************************/long NCL_atol (const char *nptr){ register const uchar *ptr = (const uchar *)nptr; register ulong num = 0; register int c = *ptr; register int neg = 0; while (NCL_isspace(c)) c = *++ptr; /* skip over whitespace chars */ if (c == '-') /* get an optional sign */ { neg = 1; c = *++ptr; } else if (c == '+') c = *++ptr; while (NCL_isdigit(c)) { num = (10 * num) + (c - '0'); c = *++ptr; } if (neg) { return (SNEGATE(num)); } return ((long) num);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -