⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chkspc3.c

📁 使用广泛的日本著名的开源嵌入式实时操作系统T-Kernel的源码
💻 C
字号:
/* *---------------------------------------------------------------------- *    T-Kernel * *    Copyright (C) 2004-2006 by Ken Sakamura. All rights reserved. *    T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * *    Version:   1.02.02 *    Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/9. * *---------------------------------------------------------------------- *//* *	@(#)chkspc3.c (libtk) * *	Address check  */#include <basic.h>#include <tk/syslib.h>#include <sys/segment.h>#if VIRTUAL_ADDRESS#include "getsvcenv.h"/* * Check address space (B string) *	Checks to see that the memory area from str through to either *	'\0' or the max byte is valid. *	If max = 0, the number of bytes (max) is ignored. *	If the memory area is valid, the value returned is either the *	number of bytes or the max value (through to the max byte with *	max !=0 and no '\0'). *	If the memory area is not valid, the error code is returned. */EXPORT INT ChkSpaceBstrR( UB *str, INT max ){	return ChkSpaceBstr(str, max, MA_READ, getsvcenv());}EXPORT INT ChkSpaceBstrRW( UB *str, INT max ){	return ChkSpaceBstr(str, max, MA_READ|MA_WRITE, getsvcenv());}#else /* VIRTUAL_ADDRESS */LOCAL INT chklen( UB *p, INT max ){	INT	len = 0;	while ( *p++ != '\0' ) {		len++;		if ( --max == 0 ) {			break;		}	}	return len;}EXPORT INT ChkSpaceBstrR( UB *str, INT max ){	return chklen(str, max);}EXPORT INT ChkSpaceBstrRW( UB *str, INT max ){	return chklen(str, max);}#endif /* VIRTUAL_ADDRESS */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -