Ejemplo n.º 1
0
int gettoks (lua_State *L) {
  int i;
  size_t k;
  strnumber t;
  int cur_cs;
  int texstr;
  char *s;
  i = lua_gettop(L);
  if (lua_type(L,i)==LUA_TSTRING) {
    s = (char *)lua_tolstring(L,i, &k);
    texstr = maketexlstring(s,k);
    cur_cs = string_lookup(texstr);
    flush_str(texstr);
    if (is_undefined_cs(cur_cs)) {
      lua_pushnil(L);
      return 1;
    }
    k = zget_equiv(cur_cs)-get_toks_base();
  } else {
    k = (int)luaL_checkinteger(L,i);
  }

  check_index_range(k);
  t = get_tex_toks_register(k);
  lua_pushstring(L, makecstring(t));
  flush_str(t);
  return 1;
}
Ejemplo n.º 2
0
int settoks (lua_State *L) {
  int i,j;
  size_t k,len;
  int cur_cs;
  int texstr;
  char *s, *st;
  i = lua_gettop(L);
  if (!lua_isstring(L,i)) {
    lua_pushstring(L, "unsupported value type");
    lua_error(L);
  }
  st = (char *)lua_tolstring(L,i,&len);

  if (lua_type(L,i-1)==LUA_TSTRING) {
    s = (char *)lua_tolstring(L,i-1, &k);
    texstr = maketexlstring(s,k);
    cur_cs = string_lookup(texstr);
    flush_str(texstr);
    k = zget_equiv(cur_cs)-get_toks_base();
  } else {
    k = (int)luaL_checkinteger(L,i-1);
  }
  check_index_range(k);
  j = maketexlstring(st,len);

  if(zset_tex_toks_register(k,j)) {
    flush_str(j);
    lua_pushstring(L, "incorrect value");
    lua_error(L);
  }
  return 0;
}
Ejemplo n.º 3
0
int setdimen (lua_State *L) {
  int i,j;
  size_t k;
  int cur_cs;
  int texstr;
  char *s;
  i = lua_gettop(L);
  j = 0;
  /* find the value*/
  if (!lua_isnumber(L,i))
    if (lua_isstring(L,i)) {
	j = dimen_to_number(L,(char *)lua_tostring(L,i));
    } else {
      lua_pushstring(L, "unsupported value type");
      lua_error(L);
    }
  else
    j = (int)lua_tonumber(L,i);
  /* find the index*/
  if (lua_type(L,i-1)==LUA_TSTRING) {
    s = (char *)lua_tolstring(L,i-1, &k);
    texstr = maketexlstring(s,k);
    cur_cs = string_lookup(texstr);
    flush_str(texstr);
    k = zget_equiv(cur_cs)-get_scaled_base();
  } else {
    k = (int)luaL_checkinteger(L,i-1);
  }
  check_index_range(k);
  if(set_tex_dimen_register(k,j)) {
    lua_pushstring(L, "incorrect value");
    lua_error(L);
  }
  return 0;
}
Ejemplo n.º 4
0
int getbox (lua_State *L) {
  int k, t;
  k = get_box_id(L,-1);
  check_index_range(k);
  t = get_tex_box_register(k);
  nodelist_to_lua(L,t);
  return 1;
}
Ejemplo n.º 5
0
void test_diff_iterator__index_handles_icase_range(void)
{
	git_repository *repo;
	git_index *index;
	git_tree *head;

	repo = cl_git_sandbox_init("testrepo");

	/* reset index to match HEAD */
	cl_git_pass(git_repository_head_tree(&head, repo));
	cl_git_pass(git_repository_index(&index, repo));
	cl_git_pass(git_index_read_tree(index, head));
	cl_git_pass(git_index_write(index));
	git_tree_free(head);
	git_index_free(index);

	/* do some ranged iterator checks toggling case sensitivity */
	check_index_range(repo, "B", "C", false, 0);
	check_index_range(repo, "B", "C", true, 1);
	check_index_range(repo, "a", "z", false, 3);
	check_index_range(repo, "a", "z", true, 4);
}
Ejemplo n.º 6
0
int setbox (lua_State *L) {
  int i,j,k;
  k = get_box_id(L,-2);
  check_index_range(k);
  i = get_tex_box_register(k);
  if (lua_isboolean(L,-1)) {
    j = lua_toboolean(L,-1);
    if (j==0)
      j = null;
    else 
      return 0;
  } else {
    j = nodelist_from_lua(L);
  }
  if(set_tex_box_register(k,j)) {
    lua_pushstring(L, "incorrect value");
    lua_error(L);
  }
  return 0;
}
Ejemplo n.º 7
0
int setattribute (lua_State *L) {
  int i,j;
  size_t k;
  int cur_cs;
  int texstr;
  char *s;
  i = lua_gettop(L);
  j = (int)luaL_checkinteger(L,i);
  if (lua_type(L,i-1)==LUA_TSTRING) {
    s = (char *)lua_tolstring(L,i-1, &k);
    texstr = maketexlstring(s,k);
    cur_cs = string_lookup(texstr);
    flush_str(texstr);
    k = zget_equiv(cur_cs)-get_attribute_base();
  } else {
    k = (int)luaL_checkinteger(L,i-1);
  }
  check_index_range(k);
  if (set_tex_attribute_register(k,j)) {
	lua_pushstring(L, "incorrect value");
	lua_error(L);
  }
  return 0;
}