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

📄 utils.c

📁 DM64+系列 interpreter 程序
💻 C
字号:
/*
 *  Copyright 2002 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */

#include "utils.h"

/* Check if all the characters in the string test are positive integers */
int isnum(char * test){
	int i = 0;
	if (test == NULL){
		return 0;
	}
	
	for (i = 0; i < strlen(test); i++){
		if ((test[i] < '0') || (test[i] > '9')){ /* Not a number */
			return 0;
		}
	}
	
	return 1;
}

/* Check if all the characters in the string test are blank spaces */
int is_space(char * test){
	int i = 0;
	if (test == NULL){
		return 1;
	}
	if (strlen(test) == 0){
		return 1;
	}
	for (i = 0; i < strlen(test); i++){
		if ((test[i] == ' ') || (test[i] == '\t'))
			continue;
		else
			return 0;
	}
	return 1;
}

/* Get the array index for a register */
int get_index(char * reg){
	return ((int)reg[0] - 65);
}

⌨️ 快捷键说明

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