示例#1
0
文件: sclist.c 项目: Doldol/sourcemod
SC_FUNC stringpair *find_subst(char *name,int length)
{
  stringpair *item;
  assert(name!=NULL);
  assert(length>0);
  assert((*name>='A' && *name<='Z') || (*name>='a' && *name<='z') || *name=='_' || *name==PUBLIC_CHAR);
  item=substindex[(int)*name-PUBLIC_CHAR];
  if (item!=NULL)
    item=find_stringpair(item,name,length);

  if (item && (item->flags & flgDEPRECATED) != 0)
  {
    static char macro[128];
    char *rem, *msg = (item->documentation != NULL) ? item->documentation : "";
    strlcpy(macro, item->first, sizeof(macro));

    /* If macro contains an opening parentheses and a percent sign, then assume that
     * it takes arguments and remove them from the warning message.
     */
    if ((rem = strchr(macro, '(')) != NULL && strchr(macro, '%') > rem)
    {
      *rem = '\0';
    }

    error(234, macro, msg);  /* deprecated (macro/constant) */
  }
  return item;
}
int lookup_alias(char *target, char *name) {
	stringpair *cur = find_stringpair(alias_tab.next, name, strlen(name));
	if (cur) {
		assert(strlen(cur->second) <= sEXPMAX);
		strcpy(target, cur->second);
	} /* if */
	return !!cur;
}
示例#3
0
文件: sclist.c 项目: Doldol/sourcemod
SC_FUNC int lookup_alias(char *target,char *name)
{
  stringpair *cur=find_stringpair(alias_tab.next,name,strlen(name));
  if (cur!=NULL) {
    assert(strlen(cur->second)<=sNAMEMAX);
    strcpy(target,cur->second);
  } /* if */
  return cur!=NULL;
}
示例#4
0
SC_FUNC stringpair *find_subst(char *name,int length)
{
  stringpair *item;
  assert(name!=NULL);
  assert(length>0);
  assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_');
  item=substindex[(int)*name-'A'];
  if (item!=NULL)
    item=find_stringpair(item,name,length);
  return item;
}
示例#5
0
文件: sclist.c 项目: jay1109/pawn
SC_FUNC const stringpair *find_subst(const char *name,int length)
{
  stringpair *item;
  assert(name!=NULL);
  assert(length>0);
  assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_' || *name==PUBLIC_CHAR);
  item=substindex[(int)*name-PUBLIC_CHAR];
  if (item!=NULL)
    item=(stringpair*)find_stringpair(item,name,length);
  return item;
}
示例#6
0
SC_FUNC int delete_subst(char *name,int length)
{
  stringpair *item;
  assert(name!=NULL);
  assert(length>0);
  assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_');
  item=substindex[(int)*name-'A'];
  if (item!=NULL)
    item=find_stringpair(item,name,length);
  if (item==NULL)
    return FALSE;
  delete_stringpair(&substpair,item);
  adjustindex(*name);
  return TRUE;
}
示例#7
0
文件: sclist.c 项目: Doldol/sourcemod
SC_FUNC int delete_subst(char *name,int length)
{
  stringpair *item;
  assert(name!=NULL);
  assert(length>0);
  assert((*name>='A' && *name<='Z') || (*name>='a' && *name<='z') || *name=='_' || *name==PUBLIC_CHAR);
  item=substindex[(int)*name-PUBLIC_CHAR];
  if (item!=NULL)
    item=find_stringpair(item,name,length);
  if (item==NULL)
    return FALSE;
  if (item->documentation)
  {
    free(item->documentation);
    item->documentation=NULL;
  }
  delete_stringpair(&substpair,item);
  adjustindex(*name);
  return TRUE;
}