summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-05-28 11:55:44 -0300
committerAndrés <andmarti@gmail.com>2021-05-28 11:55:44 -0300
commitd5c21067a8cc766ba1c546fba8118696698ab9d2 (patch)
treecaad4888cd875b33e513db9498e3da68ad1b999a
parentf7f55a29c0a1bfe06d1b0d26145f23d57b6e63f0 (diff)
Comments
-rw-r--r--src/Doxyfile2
-rw-r--r--src/block.c12
-rw-r--r--src/block.h6
-rw-r--r--src/buffer.c52
-rw-r--r--src/buffer.h6
-rw-r--r--src/clipboard.c64
-rw-r--r--src/clipboard.h7
-rw-r--r--src/cmds.c40
-rw-r--r--src/cmds.h8
-rw-r--r--src/cmds_command.c6
-rw-r--r--src/cmds_command.h6
-rw-r--r--src/cmds_edit.c6
-rw-r--r--src/cmds_edit.h6
-rw-r--r--src/cmds_insert.c6
-rw-r--r--src/cmds_insert.h6
-rw-r--r--src/cmds_normal.c6
-rw-r--r--src/cmds_normal.h6
-rw-r--r--src/cmds_visual.c6
-rw-r--r--src/cmds_visual.h6
-rw-r--r--src/color.c6
-rw-r--r--src/color.h6
-rw-r--r--src/conf.c6
-rw-r--r--src/conf.h6
-rw-r--r--src/digraphs.c6
-rw-r--r--src/digraphs.h6
-rw-r--r--src/exec.c21
-rw-r--r--src/exec.h10
-rw-r--r--src/file.c4
-rw-r--r--src/file.h6
-rw-r--r--src/filter.c6
-rw-r--r--src/filter.h6
-rw-r--r--src/format.c6
-rw-r--r--src/format.h6
-rw-r--r--src/freeze.c10
-rw-r--r--src/freeze.h6
-rw-r--r--src/graph.c6
-rw-r--r--src/graph.h6
-rw-r--r--src/help.c8
-rw-r--r--src/help.h6
-rw-r--r--src/hide_show.c6
-rw-r--r--src/hide_show.h6
-rw-r--r--src/history.c6
-rw-r--r--src/history.h6
-rw-r--r--src/input.c6
-rw-r--r--src/input.h6
-rw-r--r--src/interp.h6
-rw-r--r--src/lex.c6
-rw-r--r--src/lex.h6
-rw-r--r--src/lua.c6
-rw-r--r--src/lua.h6
-rw-r--r--src/macros.h6
-rw-r--r--src/main.c36
-rw-r--r--src/main.h6
-rw-r--r--src/maps.c6
-rw-r--r--src/maps.h6
-rw-r--r--src/marks.c6
-rw-r--r--src/marks.h6
-rw-r--r--src/ods.c6
-rw-r--r--src/ods.h6
-rw-r--r--src/pipe.c6
-rw-r--r--src/pipe.h6
-rw-r--r--src/plot.c6
-rw-r--r--src/plot.h6
-rw-r--r--src/range.c6
-rw-r--r--src/range.h6
-rw-r--r--src/sc.h6
-rw-r--r--src/sheet.c4
-rw-r--r--src/shift.c6
-rw-r--r--src/shift.h6
-rw-r--r--src/sort.c6
-rw-r--r--src/sort.h6
-rw-r--r--src/subtotal.c6
-rw-r--r--src/subtotal.h6
-rw-r--r--src/trigger.c6
-rw-r--r--src/trigger.h6
-rw-r--r--src/tui.c8
-rw-r--r--src/tui.h6
-rw-r--r--src/undo.c6
-rw-r--r--src/undo.h6
-rw-r--r--src/version.h8
-rw-r--r--src/vmtbl.c6
-rw-r--r--src/vmtbl.h6
-rw-r--r--src/xls.c8
-rw-r--r--src/xls.h6
-rw-r--r--src/xlsx.c8
-rw-r--r--src/xlsx.h6
-rw-r--r--src/xmalloc.c6
-rw-r--r--src/xmalloc.h6
-rw-r--r--src/yank.c6
-rw-r--r--src/yank.h6
90 files changed, 352 insertions, 390 deletions
diff --git a/src/Doxyfile b/src/Doxyfile
index cb64781..80ce076 100644
--- a/src/Doxyfile
+++ b/src/Doxyfile
@@ -44,7 +44,7 @@ PROJECT_NUMBER = 0.6.4
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF = "SC-IM is a spreadsheet program that is based on SC"
+PROJECT_BRIEF = "SC-IM is a spreadsheet program that is based on sc.
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
diff --git a/src/block.c b/src/block.c
index 805a749..5cd2e66 100644
--- a/src/block.c
+++ b/src/block.c
@@ -2,10 +2,10 @@
* Copyright (c) 2013-2021, Andrés Martinelli <andmarti@gmail.com> *
* All rights reserved. *
* *
- * This file is a part of SC-IM *
+ * This file is a part of sc-im *
* *
- * SC-IM is a spreadsheet program that is based on SC. The original authors *
- * of SC are James Gosling and Mark Weiser, and mods were later added by *
+ * sc-im is a spreadsheet program that is based on sc. The original authors *
+ * of sc are James Gosling and Mark Weiser, and mods were later added by *
* Chuck Martin. *
* *
* Redistribution and use in source and binary forms, with or without *
@@ -34,7 +34,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*******************************************************************************/
-
/**
* \file block.c
* \author Andrés Martinelli <andmarti@gmail.com>
@@ -46,6 +45,7 @@
#include <string.h>
#include "utils/string.h"
+
/**
* \brief Function that tells if 'b' buffer is inside 'o' buffer
* \details Find out if the int elements in the 'b' list are inside the
@@ -99,8 +99,9 @@ int block_in_block (struct block * o, struct block * b) {
return -1;
}
+
/**
- * \brief TODO Document replace_block_in_block()
+ * \brief replace_block_in_block()
*
* Replace the content of the block list "olist". Replace the nodes of the 'in'
* list with the nodes of the 'out' list.
@@ -112,7 +113,6 @@ int block_in_block (struct block * o, struct block * b) {
* \return 0 on success
* \return -1 on error
*/
-
int replace_block_in_block (struct block * olist, struct block * in, struct block * out) {
struct block * ori = olist;
diff --git a/src/block.h b/src/block.h
index 3c51130..fb7d6f3 100644
--- a/src/block.h
+++ b/src/block.h
@@ -2,10 +2,10 @@
* Copyright (c) 2013-2021, Andrés Martinelli <andmarti@gmail.com> *
* All rights reserved. *
* *
- * This file is a part of SC-IM *
+ * This file is a part of sc-im *
* *
- * SC-IM is a spreadsheet program that is based on SC. The original authors *
- * of SC are James Gosling and Mark Weiser, and mods were later added by *
+ * sc-im is a spreadsheet program that is based on sc. The original authors *
+ * of sc are James Gosling and Mark Weiser, and mods were later added by *
* Chuck Martin. *
* *
* Redistribution and use in source and binary forms, with or without *
diff --git a/src/buffer.c b/src/buffer.c
index 7442378..60aa2b4 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2,10 +2,10 @@
* Copyright (c) 2013-2021, Andrés Martinelli <andmarti@gmail.com> *
* All rights reserved. *
* *
- * This file is a part of SC-IM *
+ * This file is a part of sc-im *
* *
- * SC-IM is a spreadsheet program that is based on SC. The original authors *
- * of SC are James Gosling and Mark Weiser, and mods were later added by *
+ * sc-im is a spreadsheet program that is based on sc. The original authors *
+ * of sc are James Gosling and Mark Weiser, and mods were later added by *
* Chuck Martin. *
* *
* Redistribution and use in source and binary forms, with or without *
@@ -39,7 +39,7 @@
* \file buffer.c
* \author Andrés Martinelli <andmarti@gmail.com>
* \date 2017-07-18
- * \brief TODO Write a brief file description.
+ * \brief buffer functions used by stdin andm mappings
*/
#include <stdlib.h>
@@ -49,12 +49,11 @@
#include "macros.h"
#include "utils/string.h"
+
/**
* \brief Create buffer as list of blocks
-*
* \return b
*/
-
struct block * create_buf() {
struct block * b = (struct block *) malloc(sizeof(struct block));
b->value = '\0';
@@ -62,15 +61,13 @@ struct block * create_buf() {
return b;
}
+
/**
* \brief Add a wint_t to a buffer
-*
* \param[in] buf
* \param[in] d
-*
* \return none
*/
-
void addto_buf(struct block * buf, wint_t d) {
struct block * aux = buf;
@@ -88,15 +85,13 @@ void addto_buf(struct block * buf, wint_t d) {
return;
}
+
/**
* \brief Replace the elements of "origen" buffer to "destino" buffer
-*
* \param[in] origen
* \param[in] destino
-*
* \return none
*/
-
void copybuffer(struct block * origen, struct block * destino) {
flush_buf(destino);
int len = get_bufsize(origen);
@@ -109,13 +104,10 @@ void copybuffer(struct block * origen, struct block * destino) {
/**
* \brief Replace the element of a buffer at 'pos' with a '\0'
-*
* \param[in] buf
* \param[in] pos
-*
* \return none
*/
-
// FIXME
void del_buf (struct block * buf, int pos) {
int i;
@@ -138,12 +130,9 @@ void del_buf (struct block * buf, int pos) {
/**
* \brief TODO Document flush_buf()
-*
* \param[in] buf
-*
* \return none
*/
-
void flush_buf (struct block * buf) {
if (buf == NULL) return;
@@ -154,34 +143,28 @@ void flush_buf (struct block * buf) {
}
buf->value = '\0';
buf->pnext = NULL;
-
return;
}
+
/**
* \brief Delete all blocks of a buffer including the initial node
-*
* \details Delete all blocks of a buffer including the initial node
-*
* \param buf
-*
* \return none
*/
-
void erase_buf (struct block * buf) {
flush_buf(buf);
free(buf);
return;
}
+
/**
* \brief Get size of buffer (included special chars)
-*
* \param[in] buf
-*
* \return c size of buffer
*/
-
int get_bufsize(struct block * buf) {
struct block * b_aux = buf;
if (b_aux == NULL || b_aux->value == '\0') return 0;
@@ -193,17 +176,14 @@ int get_bufsize(struct block * buf) {
return c;
}
+
/**
* \brief Get printable buffer length (excluded special chars)
-*
* \details Get printable bufferlength, which excludes special characters
* as they should never be printed to a screen.
-*
* \param[in] buf
-*
* \return c printable buffer length
*/
-
int get_pbuflen(struct block * buf) {
struct block * b_aux = buf;
if (b_aux == NULL || b_aux->value == '\0') return 0;
@@ -215,15 +195,13 @@ int get_pbuflen(struct block * buf) {
return c;
}
+
/**
* \brief Return the int value of n block
-*
* \param[in] buf
* \param[in] d
-*
* \return none
*/
-
int get_bufval(struct block * buf, int d) {
int i;
struct block * b_aux = buf;
@@ -233,14 +211,12 @@ int get_bufval(struct block * buf, int d) {
return b_aux->value;
}
+
/**
* \brief Return an int value if found in a buffer
-*
* \details Search a buffer for a given integer value.
-*
* \return 0 if not found, 1 if found
*/
-
int find_val(struct block * buf, int value) {
struct block * b_aux = buf;
while ( b_aux != NULL && b_aux->value != '\0' ) {
@@ -250,14 +226,12 @@ int find_val(struct block * buf, int value) {
return 0;
}
+
/**
* \brief Delete the first element in a buffer
-*
* \param[in] buf
-*
* \return none
*/
-
struct block * dequeue (struct block * buf) {
if (buf == NULL) return buf;
struct block * sig;
diff --git a/src/buffer.h b/src/buffer.h
index 89f3bd8..f9147b1 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -2,10 +2,10 @@
* Copyright (c) 2013-2021, Andrés Martinelli <andmarti@gmail.com> *
* All rights reserved. *
* *
- * This file is a part of SC-IM *
+ * This file is a part of sc-im *
* *
- * SC-IM is a spreadsheet program that is based on SC. The original authors *
- * of SC are James Gosling and Mark Weiser, and mods were later added by *
+ * sc-im is a spreadsheet program that is based on sc. The original authors *
+ * of sc are James Gosling and Mark Weiser, and mods were later added by *
* Chuck Martin. *
* *
* Redistribution and use in source and binary forms, with or without *
diff --git a/src/clipboard.c b/src/clipboard.c
index 12f6a8f..35ff23c 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -2,10 +2,10 @@
* Copyright (c) 2013-2021, Andrés Martinelli <andmarti@gmail.com> *
* All rights reserved. *
* *
- * This file is a part of SC-IM *
+ * This file is a part of sc-im *
* *
- * SC-IM is a spreadsheet program that is based on SC. The original authors *
- * of SC are James Gosling and Mark Weiser, and mods were later added by *
+ * sc-im is a spreadsheet program that is based on sc. The original authors *
+ * of sc are James Gosling and Mark Weiser, and mods were later added by *
* Chuck Martin. *
* *
* Redistribution and use in source and binary forms, with or without *
@@ -34,7 +34,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*******************************************************************************/
-
/**
* \file clipboard.c
* \author Andrés Martinelli <andmarti@gmail.com>
@@ -60,43 +59,11 @@
extern struct session * session;
-int convert_string_to_number(int r0, int c0, int rn, int cn) {
- struct roman * roman = session->cur_doc;
- int row, col;
- register struct ent ** pp;
- wchar_t out[FBUFLEN] = L"";
- for (row = r0; row <= rn; row++) {
- // ignore hidden rows
- //if (row_hidden[row]) continue;
-
- for (pp = ATBL(roman->cur_sh, roman->cur_sh->tbl, row, col = c0); col <= cn; col++, pp++) {
- // ignore hidden cols
- //if (col_hidden[col]) continue;
-
- if (*pp) {
-
- // If a string exists
- if ((*pp)->label) {
- char * num = str_replace((*pp)->label," ","");
- (*pp)->label[0] = '\0';
- swprintf(out, BUFFERSIZE, L"let %s%d=%s", coltoa(col), row, num);
- send_to_interp(out);
- free(num);
- }
- }
- }
- }
-
- return 0;
-
-}
/**
-* \brief Pastes from clipboard
-*
+* \brief Paste to sc-im content stored on clipboard
* \return 0 on success; -1 on error
*/
-
int paste_from_clipboard() {
struct roman * roman = session->cur_doc;
if (! strlen(get_conf_value("default_paste_from_clipboard_cmd"))) return -1;
@@ -159,12 +126,11 @@ int paste_from_clipboard() {
return 0;
}
-/**
-* @brief Copies to clipboard
-*
-* \return 0 on success; -1 on error
-*/
+/**
+ * @brief Copies a range of cells to clipboard
+ * \return 0 on success; -1 on error
+ */
int copy_to_clipboard(int r0, int c0, int rn, int cn) {
if (! strlen(get_conf_value("default_copy_to_clipboard_cmd"))) return -1;
@@ -200,23 +166,21 @@ int copy_to_clipboard(int r0, int c0, int rn, int cn) {
return 0;
}
+
/**
-* @brief TODO Write a brief function description
-*
-* \details Note: The file must already be open.
-*
+* @brief save_plain()
+* \details copy a range of cell to an open file stream
+* Note: The file must already be open.
* \param[in] fout output file
* \param[in] r0
* \param[in] c0
* \param[in] rn
* \param[in] cn
-*
* \return 0 on success
+* \return -1 on error
*/
-
-// TODO Does this check if the file is already open?
-// TODO What are the returns? Does 0 mean success?
int save_plain(FILE * fout, int r0, int c0, int rn, int cn) {
+ if (fout == NULL) return -1;
struct roman * roman = session->cur_doc;
int row, col;
register struct ent ** pp;
diff --git a/src/clipboard.h b/src/clipboard.h
index d28caba..39c9a2a 100644
--- a/src/clipboard.h
+++ b/src/clipboard.h
@@ -2,10 +2,10 @@
* Copyright (c) 2013-2021, Andrés Martinelli <andmarti@gmail.com> *
* All rights reserved. *
* *
- * This file is a part of SC-IM *
+ * This file is a part of sc-im *
* *
- * SC-IM is a spreadsheet program that is based on SC. The original authors *
- * of SC are James Gosling and Mark Weiser, and mods were later added by *
+ * sc-im is a spreadsheet program that is based on sc. The original authors *
+ * of sc are James Gosling and Mark Weiser, and mods were later added by *
* Chuck Martin.