Exemplo n.º 1
0
char *opt_usage(const char *argv0, const char *extra)
{
	unsigned int i;
	size_t max, len, width, indent;
	char *ret;

	width = get_columns();
	if (width < MIN_TOTAL_WIDTH)
		width = MIN_TOTAL_WIDTH;

	/* Figure out longest option. */
	indent = 0;
	for (i = 0; i < opt_count; i++) {
		size_t l;
		if (opt_table[i].desc == opt_hidden)
			continue;
		if (opt_table[i].type == OPT_SUBTABLE)
			continue;
		l = strlen(opt_table[i].names);
		if (opt_table[i].type == OPT_HASARG
		    && !strchr(opt_table[i].names, ' ')
		    && !strchr(opt_table[i].names, '='))
			l += strlen(" <arg>");
		if (l + 2 > indent)
			indent = l + 2;
	}

	/* Now we know how much to indent */
	if (indent + MIN_DESC_WIDTH > width)
		indent = width - MIN_DESC_WIDTH;

	len = max = 0;
	ret = NULL;

	ret = add_str(ret, &len, &max, "Usage: ");
	ret = add_str(ret, &len, &max, argv0);

	/* Find usage message from among registered options if necessary. */
	if (!extra) {
		extra = "";
		for (i = 0; i < opt_count; i++) {
			if (opt_table[i].cb == (void *)opt_usage_and_exit
			    && opt_table[i].u.carg) {
				extra = opt_table[i].u.carg;
				break;
			}
		}
	}
	ret = add_str(ret, &len, &max, " ");
	ret = add_str(ret, &len, &max, extra);
	ret = add_str(ret, &len, &max, "\n");

	for (i = 0; i < opt_count; i++) {
		if (opt_table[i].desc == opt_hidden)
			continue;
		if (opt_table[i].type == OPT_SUBTABLE) {
			ret = add_str(ret, &len, &max, opt_table[i].desc);
			ret = add_str(ret, &len, &max, ":\n");
			continue;
		}
		ret = add_desc(ret, &len, &max, indent, width, &opt_table[i]);
	}
	ret[len] = '\0';
	return ret;
}
Exemplo n.º 2
0
static void
clutter_flow_layout_get_preferred_height (ClutterLayoutManager *manager,
                                          ClutterContainer     *container,
                                          gfloat                for_width,
                                          gfloat               *min_height_p,
                                          gfloat               *nat_height_p)
{
  ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
  GList *l, *children = clutter_container_get_children (container);
  gint n_columns, line_item_count, line_count;
  gfloat total_min_height, total_natural_height;
  gfloat line_min_height, line_natural_height;
  gfloat max_min_height, max_natural_height;
  gfloat item_x;

  n_columns = get_columns (CLUTTER_FLOW_LAYOUT (manager), for_width);

  total_min_height = 0;
  total_natural_height = 0;

  line_min_height = 0;
  line_natural_height = 0;

  line_item_count = 0;
  line_count = 0;

  item_x = 0;

  /* clear the line height arrays */
  if (priv->line_min != NULL)
    g_array_free (priv->line_min, TRUE);

  if (priv->line_natural != NULL)
    g_array_free (priv->line_natural, TRUE);

  priv->line_min = g_array_sized_new (FALSE, FALSE,
                                      sizeof (gfloat),
                                      16);
  priv->line_natural = g_array_sized_new (FALSE, FALSE,
                                          sizeof (gfloat),
                                          16);

  if (children)
    line_count = 1;

  max_min_height = max_natural_height = 0;

  for (l = children; l != NULL; l = l->next)
    {
      ClutterActor *child = l->data;
      gfloat child_min, child_natural;
      gfloat new_x, item_width;

      if (!CLUTTER_ACTOR_IS_VISIBLE (child))
        continue;

      if (priv->orientation == CLUTTER_FLOW_HORIZONTAL && for_width > 0)
        {
          if (line_item_count == n_columns)
            {
              total_min_height += line_min_height;
              total_natural_height += line_natural_height;

              g_array_append_val (priv->line_min,
                                  line_min_height);
              g_array_append_val (priv->line_natural,
                                  line_natural_height);

              line_min_height = line_natural_height = 0;

              line_item_count = 0;
              line_count += 1;
              item_x = 0;
            }

          new_x = ((line_item_count + 1) * (for_width + priv->col_spacing))
                / n_columns;
          item_width = new_x - item_x - priv->col_spacing;

          clutter_actor_get_preferred_height (child, item_width,
                                              &child_min,
                                              &child_natural);

          line_min_height = MAX (line_min_height, child_min);
          line_natural_height = MAX (line_natural_height, child_natural);

          item_x = new_x;
          line_item_count += 1;

          max_min_height = MAX (max_min_height, line_min_height);
          max_natural_height = MAX (max_natural_height, line_natural_height);
        }
      else
        {
          clutter_actor_get_preferred_height (child, for_width,
                                              &child_min,
                                              &child_natural);

          max_min_height = MAX (max_min_height, child_min);
          max_natural_height = MAX (max_natural_height, child_natural);

          total_min_height += max_min_height;
          total_natural_height += max_natural_height;

          line_count += 1;
        }
    }

  g_list_free (children);

  priv->row_height = max_natural_height;

  if (priv->max_row_height > 0 && priv->row_height > priv->max_row_height)
    priv->row_height = MAX (priv->max_row_height, max_min_height);

  if (priv->row_height < priv->min_row_height)
    priv->row_height = priv->min_row_height;

  if (priv->orientation == CLUTTER_FLOW_HORIZONTAL && for_width > 0)
    {
      /* if we have a non-full row we need to add it */
      if (line_item_count > 0)
        {
          total_min_height += line_min_height;
          total_natural_height += line_natural_height;

          g_array_append_val (priv->line_min,
                              line_min_height);
          g_array_append_val (priv->line_natural,
                              line_natural_height);
        }

      priv->line_count = line_count;
      if (priv->line_count > 0)
        {
          gfloat total_spacing;

          total_spacing = priv->row_spacing * (priv->line_count - 1);

          total_min_height += total_spacing;
          total_natural_height += total_spacing;
        }
    }
  else
    {
      g_array_append_val (priv->line_min, line_min_height);
      g_array_append_val (priv->line_natural, line_natural_height);

      priv->line_count = line_count;

      if (priv->line_count > 0)
        {
          gfloat total_spacing;

          total_spacing = priv->col_spacing * priv->line_count;

          total_min_height += total_spacing;
          total_natural_height += total_spacing;
        }
    }

  CLUTTER_NOTE (LAYOUT,
                "Flow[h]: %d lines (%d per line): w [ %.2f, %.2f ] for h %.2f",
                n_columns, priv->line_count,
                total_min_height,
                total_natural_height,
                for_width);

  if (min_height_p)
    *min_height_p = total_min_height;

  if (nat_height_p)
    *nat_height_p = total_natural_height;
}
Exemplo n.º 3
0
        int prompt_loop(mutex * lock, CommandHistory & history)
        {
            int fd = STDIN_FILENO;
            size_t plen = prompt.size();
            int history_index = 0;
            raw_buffer.clear();
            raw_cursor = 0;
            /* The latest history entry is always our current buffer, that
             * initially is just an empty string. */
            const std::string empty;
            history.add(empty);
            if (::write(fd,prompt.c_str(),prompt.size()) == -1) return -1;
            while(1)
            {
                unsigned char c;
                int isok;
                unsigned char seq[2], seq2;
                lock->unlock();
                if(!read_char(c))
                {
                    lock->lock();
                    return -2;
                }
                lock->lock();
                /* Only autocomplete when the callback is set. It returns < 0 when
                 * there was an error reading from fd. Otherwise it will return the
                 * character that should be handled next. */
                if (c == 9)
                {
                    /*
                    if( completionCallback != NULL) {
                        c = completeLine(fd,prompt,buf,buflen,&len,&pos,cols);
                        // Return on errors
                        if (c < 0) return len;
                        // Read next character when 0
                        if (c == 0) continue;
                    }
                    else
                    {
                        // ignore tab
                        continue;
                    }
                    */
                    // just ignore tabs
                    continue;
                }

                switch(c)
                {
                case 13:    // enter
                    history.remove();
                    return raw_buffer.size();
                case 3:     // ctrl-c
                    errno = EAGAIN;
                    return -1;
                case 127:   // backspace
                case 8:     // ctrl-h
                    if (raw_cursor > 0 && raw_buffer.size() > 0)
                    {
                        raw_buffer.erase(raw_cursor-1,1);
                        raw_cursor--;
                        prompt_refresh();
                    }
                    break;
                case 27:    // escape sequence
                    lock->unlock();
                    if(!read_char(seq[0]) || !read_char(seq[1]))
                    {
                        lock->lock();
                        return -2;
                    }
                    lock->lock();
                    if(seq[0] == '[')
                    {
                        if (seq[1] == 'D')
                        {
                            left_arrow:
                            if (raw_cursor > 0)
                            {
                                raw_cursor--;
                                prompt_refresh();
                            }
                        }
                        else if ( seq[1] == 'C')
                        {
                            right_arrow:
                            /* right arrow */
                            if (raw_cursor != raw_buffer.size())
                            {
                                raw_cursor++;
                                prompt_refresh();
                            }
                        }
                        else if (seq[1] == 'A' || seq[1] == 'B')
                        {
                            /* up and down arrow: history */
                            if (history.size() > 1)
                            {
                                /* Update the current history entry before to
                                 * overwrite it with tne next one. */
                                history[history_index] = raw_buffer;
                                /* Show the new entry */
                                history_index += (seq[1] == 'A') ? 1 : -1;
                                if (history_index < 0)
                                {
                                    history_index = 0;
                                    break;
                                }
                                else if (history_index >= history.size())
                                {
                                    history_index = history.size()-1;
                                    break;
                                }
                                raw_buffer = history[history_index];
                                raw_cursor = raw_buffer.size();
                                prompt_refresh();
                            }
                        }
                        else if(seq[1] == 'H')
                        {
                            // home
                            raw_cursor = 0;
                            prompt_refresh();
                        }
                        else if(seq[1] == 'F')
                        {
                            // end
                            raw_cursor = raw_buffer.size();
                            prompt_refresh();
                        }
                        else if (seq[1] > '0' && seq[1] < '7')
                        {
                            // extended escape
                            lock->unlock();
                            if(!read_char(seq2))
                            {
                                lock->lock();
                                return -2;
                            }
                            lock->lock();
                            if (seq[1] == '3' && seq2 == '~' )
                            {
                                // delete
                                if (raw_buffer.size() > 0 && raw_cursor < raw_buffer.size())
                                {
                                    raw_buffer.erase(raw_cursor,1);
                                    prompt_refresh();
                                }
                            }
                        }
                    }
                    break;
                default:
                    if (raw_buffer.size() == raw_cursor)
                    {
                        raw_buffer.append(1,c);
                        raw_cursor++;
                        if (plen+raw_buffer.size() < get_columns())
                        {
                            /* Avoid a full update of the line in the
                             * trivial case. */
                            if (::write(fd,&c,1) == -1) return -1;
                        }
                        else
                        {
                            prompt_refresh();
                        }
                    }
                    else
                    {
                        raw_buffer.insert(raw_cursor,1,c);
                        raw_cursor++;
                        prompt_refresh();
                    }
                    break;
                case 21: // Ctrl+u, delete the whole line.
                    raw_buffer.clear();
                    raw_cursor = 0;
                    prompt_refresh();
                    break;
                case 11: // Ctrl+k, delete from current to end of line.
                    raw_buffer.erase(raw_cursor);
                    prompt_refresh();
                    break;
                case 1: // Ctrl+a, go to the start of the line
                    raw_cursor = 0;
                    prompt_refresh();
                    break;
                case 5: // ctrl+e, go to the end of the line
                    raw_cursor = raw_buffer.size();
                    prompt_refresh();
                    break;
                case 12: // ctrl+l, clear screen
                    clear();
                    prompt_refresh();
                }
            }
            return raw_buffer.size();
        }
Exemplo n.º 4
0
int main(int argc, char **argv) {
  char *filename = "lex";

  int argi;

  for (argi = 1; argi < argc && argv[argi][0] == '-'; argi++) {
    char c = argv[argi][1];

    if (c == 'l') {
      argi++;

      if (argi == argc) {
	fprintf(stderr, "%s: no argument to -l\n", argv[0]);
	exit(1);
      }

      filename = argv[argi];
    } else if (c == '-') {
      break;
    } else {
      exit_usage(argv[0]);
    }
  }

  int fd = open(filename, O_RDONLY);

  if (fd == -1) {
    fprintf(stderr, "could not open file %s\n", filename);
    exit(1);
  }

  struct stat stat;

  if (fstat(fd, &stat) == -1) {
    fprintf(stderr, "could not stat file\n");
    exit(1);
  }

  unsigned char *buf = malloc(sizeof(char[stat.st_size]));

  if (!buf) {
    fprintf(stderr, "could not allocate buffer\n");
    exit(1);
  }

  int bytes = read(fd, buf, stat.st_size);

  close(fd);

  if (bytes != stat.st_size) {
    fprintf(stderr, "could not read full buffer\n");
    exit(1);
  }

  lexicon *lexicon = lexibuf_read(buf);

  free(buf);

  if (!lexicon) {
    fprintf(stderr, "could not read lexicon\n");
    exit(1);
  }

  get_columns();

  for (; argi < argc; argi++) {
    if (isdigit(argv[argi][0])) {
      int number = strtol(argv[argi], NULL, 10);

      if (number < 1 || number > lexicon->root_count) {
	fprintf(stderr, "%s: root index must be between 1 and %d\n", argv[0], lexicon->root_count);
	continue;
      }

      diagram_root(&lexicon->roots[number - 1], number);
    } else {
      int i;
      char *match = argv[argi];

      for (i = 0; i < lexicon->root_count; i++) {
	int j;
	lexicon_root *root = &lexicon->roots[i];

	for (j = 0; j < root->form_count; j++) {
	  if (!strcmp(match, root->forms[j].letters)) {
	    break;
	  }
	}

	if (j < root->form_count) {
	  diagram_root(root, i + 1);
	}
      }
    }
  }
}
Exemplo n.º 5
0
void calInitSubstate2Di(MODEL_DEFINITION2D, CALint value, int i, int j, CALint substateNum) {
	__global CALint * current = calGetCurrentSubstate2Di(MODEL2D,substateNum);
	__global CALint * next = calGetNextSubstate2Di(MODEL2D,substateNum);
	calSetBufferElement2D(current, get_columns(), i, j, value);
	calSetBufferElement2D(next, get_columns(), i, j, value);
}
Exemplo n.º 6
0
static int sql_exec_one_statement(
    sqlite3_stmt *statement, async_sqlite3_command *async_command,
    int *term_count_p, int *term_allocated_p, ErlDrvTermData **dataset_p) {
  int column_count = sqlite3_column_count(statement);
  int row_count = 0, next_row;
  int base_term_count;
  sqlite3_drv_t *drv = async_command->driver_data;
  ptr_list **ptrs_p = &(async_command->ptrs);
  ptr_list **binaries_p = &(async_command->binaries);
  // printf("\nsql_exec_one_statement. SQL:\n%s\n Term count: %d, terms alloc: %d\n", sqlite3_sql(statement), *term_count_p, *term_allocated_p);

  int i;

  if (column_count > 0) {
    *term_count_p += 2;
    if (*term_count_p > *term_allocated_p) {
      *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
      *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
    }
    (*dataset_p)[*term_count_p - 2] = ERL_DRV_ATOM;
    (*dataset_p)[*term_count_p - 1] = drv->atom_columns;
    base_term_count = *term_count_p;
    get_columns(
        drv, statement, column_count, base_term_count, term_count_p, term_allocated_p, dataset_p);
    *term_count_p += 4;
    if (*term_count_p > *term_allocated_p) {
      *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
      *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
    }
    (*dataset_p)[base_term_count + column_count * 3 + 3] = ERL_DRV_TUPLE;
    (*dataset_p)[base_term_count + column_count * 3 + 4] = 2;

    (*dataset_p)[base_term_count + column_count * 3 + 5] = ERL_DRV_ATOM;
    (*dataset_p)[base_term_count + column_count * 3 + 6] = drv->atom_rows;
  }

#ifdef DEBUG
  fprintf(drv->log, "Exec: %s\n", sqlite3_sql(statement));
  fflush(drv->log);
#endif

  while ((next_row = sqlite3_step(statement)) == SQLITE_ROW) {
    for (i = 0; i < column_count; i++) {
#ifdef DEBUG
      fprintf(drv->log, "Column %d type: %d\n", i, sqlite3_column_type(statement, i));
      fflush(drv->log);
#endif
      switch (sqlite3_column_type(statement, i)) {
      case SQLITE_INTEGER: {
        ErlDrvSInt64 *int64_ptr = driver_alloc(sizeof(ErlDrvSInt64));
        *int64_ptr = (ErlDrvSInt64) sqlite3_column_int64(statement, i);
        *ptrs_p = add_to_ptr_list(*ptrs_p, int64_ptr);

        *term_count_p += 2;
        if (*term_count_p > *term_allocated_p) {
          *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
          *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
        }
        (*dataset_p)[*term_count_p - 2] = ERL_DRV_INT64;
        (*dataset_p)[*term_count_p - 1] = (ErlDrvTermData) int64_ptr;
        break;
      }
      case SQLITE_FLOAT: {
        double *float_ptr = driver_alloc(sizeof(double));
        *float_ptr = sqlite3_column_double(statement, i);
        *ptrs_p = add_to_ptr_list(*ptrs_p, float_ptr);

        *term_count_p += 2;
        if (*term_count_p > *term_allocated_p) {
          *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
          *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
        }
        (*dataset_p)[*term_count_p - 2] = ERL_DRV_FLOAT;
        (*dataset_p)[*term_count_p - 1] = (ErlDrvTermData) float_ptr;
        break;
      }
      case SQLITE_BLOB: {
        int bytes = sqlite3_column_bytes(statement, i);
        ErlDrvBinary* binary = driver_alloc_binary(bytes);
        binary->orig_size = bytes;
        memcpy(binary->orig_bytes,
               sqlite3_column_blob(statement, i), bytes);
        *binaries_p = add_to_ptr_list(*binaries_p, binary);

        *term_count_p += 8;
        if (*term_count_p > *term_allocated_p) {
          *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
          *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
        }
        (*dataset_p)[*term_count_p - 8] = ERL_DRV_ATOM;
        (*dataset_p)[*term_count_p - 7] = drv->atom_blob;
        (*dataset_p)[*term_count_p - 6] = ERL_DRV_BINARY;
        (*dataset_p)[*term_count_p - 5] = (ErlDrvTermData) binary;
        (*dataset_p)[*term_count_p - 4] = bytes;
        (*dataset_p)[*term_count_p - 3] = 0;
        (*dataset_p)[*term_count_p - 2] = ERL_DRV_TUPLE;
        (*dataset_p)[*term_count_p - 1] = 2;
        break;
      }
      case SQLITE_TEXT: {
        int bytes = sqlite3_column_bytes(statement, i);
        ErlDrvBinary* binary = driver_alloc_binary(bytes);
        binary->orig_size = bytes;
        memcpy(binary->orig_bytes,
               sqlite3_column_blob(statement, i), bytes);
        *binaries_p = add_to_ptr_list(*binaries_p, binary);

        *term_count_p += 4;
        if (*term_count_p > *term_allocated_p) {
          *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
          *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
        }
        (*dataset_p)[*term_count_p - 4] = ERL_DRV_BINARY;
        (*dataset_p)[*term_count_p - 3] = (ErlDrvTermData) binary;
        (*dataset_p)[*term_count_p - 2] = bytes;
        (*dataset_p)[*term_count_p - 1] = 0;
        break;
      }
      case SQLITE_NULL: {
        *term_count_p += 2;
        if (*term_count_p > *term_allocated_p) {
          *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
          *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
        }
        (*dataset_p)[*term_count_p - 2] = ERL_DRV_ATOM;
        (*dataset_p)[*term_count_p - 1] = drv->atom_null;
        break;
      }
      }
    }
    *term_count_p += 2;
    if (*term_count_p > *term_allocated_p) {
      *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
      *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
    }
    (*dataset_p)[*term_count_p - 2] = ERL_DRV_TUPLE;
    (*dataset_p)[*term_count_p - 1] = column_count;

    row_count++;
  }

  if (next_row == SQLITE_BUSY) {
    return_error(drv, SQLITE_BUSY, "SQLite3 database is busy",
                 dataset_p, term_count_p,
                 term_allocated_p, &async_command->error_code);
    async_command->finalize_statement_on_free = 1;
    return next_row;
  }
  if (next_row != SQLITE_DONE) {
    return_error(drv, next_row, sqlite3_errmsg(drv->db),
                 dataset_p, term_count_p,
                 term_allocated_p, &async_command->error_code);
    async_command->finalize_statement_on_free = 1;
    return next_row;
  }

  if (column_count > 0) {
    *term_count_p += 3+2+3;
    if (*term_count_p > *term_allocated_p) {
      *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
      *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
    }
    (*dataset_p)[*term_count_p - 8] = ERL_DRV_NIL;
    (*dataset_p)[*term_count_p - 7] = ERL_DRV_LIST;
    (*dataset_p)[*term_count_p - 6] = row_count + 1;

    (*dataset_p)[*term_count_p - 5] = ERL_DRV_TUPLE;
    (*dataset_p)[*term_count_p - 4] = 2;

    (*dataset_p)[*term_count_p - 3] = ERL_DRV_NIL;
    (*dataset_p)[*term_count_p - 2] = ERL_DRV_LIST;
    (*dataset_p)[*term_count_p - 1] = 3;
  } else if (sql_is_insert(sqlite3_sql(statement))) {
    ErlDrvSInt64 *rowid_ptr = driver_alloc(sizeof(ErlDrvSInt64));
    *rowid_ptr = (ErlDrvSInt64) sqlite3_last_insert_rowid(drv->db);
    *ptrs_p = add_to_ptr_list(*ptrs_p, rowid_ptr);
    *term_count_p += 6;
    if (*term_count_p > *term_allocated_p) {
      *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
      *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
    }
    (*dataset_p)[*term_count_p - 6] = ERL_DRV_ATOM;
    (*dataset_p)[*term_count_p - 5] = drv->atom_rowid;
    (*dataset_p)[*term_count_p - 4] = ERL_DRV_INT64;
    (*dataset_p)[*term_count_p - 3] = (ErlDrvTermData) rowid_ptr;
    (*dataset_p)[*term_count_p - 2] = ERL_DRV_TUPLE;
    (*dataset_p)[*term_count_p - 1] = 2;
  } else {
    *term_count_p += 2;
    if (*term_count_p > *term_allocated_p) {
      *term_allocated_p = max(*term_count_p, *term_allocated_p*2);
      *dataset_p = driver_realloc(*dataset_p, sizeof(ErlDrvTermData) * *term_allocated_p);
    }
    (*dataset_p)[*term_count_p - 2] = ERL_DRV_ATOM;
    (*dataset_p)[*term_count_p - 1] = drv->atom_ok;
  }

#ifdef DEBUG
  fprintf(drv->log, "Total term count: %p %d, rows count: %dx%d\n", statement, *term_count_p, column_count, row_count);
  fflush(drv->log);
#endif
  async_command->finalize_statement_on_free = 1;

  return 0;
}
Exemplo n.º 7
0
void calSet2Db(MODEL_DEFINITION2D, CALbyte value, int i, int j,CALint substateNum) {
	__global CALbyte * next = calGetNextSubstate2Db(MODEL2D,substateNum);
	calSetBufferElement2D(next, get_columns(), i, j, value);
}
Exemplo n.º 8
0
CALreal calGet2Dr(MODEL_DEFINITION2D, int i, int j,CALint substateNum) {
	__global CALreal * current = calGetCurrentSubstate2Dr(MODEL2D,substateNum);
	return calGetBufferElement2D(current, get_columns(), i, j);
}
Exemplo n.º 9
0
__global CALint * calGetNextSubstate2Di(MODEL_DEFINITION2D, CALint substateNum) {
	return (CALCLnextIntSubstates + get_rows() * get_columns() * substateNum);
}
Exemplo n.º 10
0
__global CALreal * calGetCurrentSubstate2Dr(MODEL_DEFINITION2D, CALint substateNum) {
	return (CALCLcurrentRealSubstates + get_rows() * get_columns() * substateNum);
}
Exemplo n.º 11
0
__global CALbyte * calGetCurrentSubstate2Db(MODEL_DEFINITION2D, CALint substateNum) {
	return (CALCLcurrentByteSubstates + get_rows() * get_columns() * substateNum);
}