| 1 | ,,SVN revion 2009-11-02 - !r43404,, |
| 2 | [[TOC]] |
| 3 | |
| 4 | '''Important Note''': the included code should be used only as conceptual idea of how something works. |
| 5 | |
| 6 | |
| 7 | == Eina == |
| 8 | |
| 9 | === Accessor === |
| 10 | Accessors allow a random access of the data of a container. They can access an element at any position. |
| 11 | |
| 12 | === Arrays === |
| 13 | Create and manage arrays, very fast access to data list. |
| 14 | |
| 15 | === Benchmarks === |
| 16 | Allow you to add benchmark framework in a project for timing critical part and detect slow parts of code. |
| 17 | |
| 18 | === Convert === |
| 19 | These functions allow you to convert integer or real numbers to string or conversely. |
| 20 | |
| 21 | === Cpu === |
| 22 | Get the features of a cpu, like mmx, se, altivec, etc |
| 23 | |
| 24 | |
| 25 | === File === |
| 26 | * list the content of a directory, recusrsively or not, and can call a callback function for eachfound file. |
| 27 | * split a path into all the subdirectories that compose it, according to the separator of the file system. |
| 28 | |
| 29 | === Hash === |
| 30 | Hash management |
| 31 | |
| 32 | Hash functions are mostly used to speed up table lookup or data comparison tasks such as finding items in a database, detecting duplicated or similar records in a large file, finding similar stretches in DNA sequences, and so on. |
| 33 | |
| 34 | === Rectangle === |
| 35 | Rectangle coordenades and calculations |
| 36 | |
| 37 | === Stringshare === |
| 38 | These functions allow you to store one copy of a string, and use it throughout your program. |
| 39 | |
| 40 | It sounds like micro-optimizing, but profiling has shown this can have a significant impact as you scale the number of copies up. It improves string creation/destruction speed, reduces memory use and decreases memory fragmentation, so a win all-around. |
| 41 | |
| 42 | === Trash === |
| 43 | Instead to malloc/free pointers, just put them in the trash, you can reuse it later too, you can free the entire trash later. FIXME: is that ok ? |
| 44 | |
| 45 | === List === |
| 46 | Lists management |
| 47 | * for (foreach) |
| 48 | * free lists |
| 49 | * next/prev/last |
| 50 | * append/prepend/*relative |
| 51 | * data get |
| 52 | * counter |
| 53 | * find |
| 54 | * sort |
| 55 | * remove |
| 56 | * promote: move the specified data to the first of the list |
| 57 | * nth: get the nth number of the member in the list |
| 58 | * merge/split |
| 59 | * iterator |
| 60 | |
| 61 | |
| 62 | === Iterator === |
| 63 | This is like a cursor to access the elements sequentially in a container |
| 64 | |
| 65 | === Lalloc === |
| 66 | Lazy Allocator, that is, for lazy developers or ppl that has a cheapo keyboard. FIXME |
| 67 | |
| 68 | === Log === |
| 69 | Functions to add logs in your code with level of verbosity control and the management of specific-code logs |
| 70 | {{{ |
| 71 | #!C |
| 72 | EINA_LOG_ERR("BIG FAT ERROR!"); |
| 73 | EINA_LOG_INFO("Message only visible running app with high log level set"); |
| 74 | EINA_LOG_DBG("Running foo, only with big verbosity"); |
| 75 | }}} |
| 76 | |
| 77 | === Error === |
| 78 | The Eina error module provides a way to manage errors in a simple but powerful way in libraries and modules. |
| 79 | |
| 80 | You can register your own error messages, and so get the last error message ocurred too. |
| 81 | |
| 82 | {{{ |
| 83 | #!C |
| 84 | Eina_Error MY_ERROR_NEGATIVE; |
| 85 | |
| 86 | void *data_new() |
| 87 | { |
| 88 | eina_error_set(MY_ERROR_NEGATIVE); |
| 89 | return; |
| 90 | } |
| 91 | |
| 92 | int main(void) |
| 93 | { |
| 94 | Eina_Error err; |
| 95 | void *data; |
| 96 | |
| 97 | MY_ERROR_NEGATIVE = eina_error_msg_register("Your data is Negative!"); |
| 98 | |
| 99 | if (err) |
| 100 | printf ("Error is: %s\n", eina_error_msg_get(err)); |
| 101 | |
| 102 | data = data_new(); // We set the state of an error |
| 103 | err = eina_error_get(); // We get the message for the ID of the error |
| 104 | |
| 105 | if (err) |
| 106 | printf ("Error is: %s\n", eina_error_msg_get(err)); |
| 107 | } |
| 108 | }}} |
| 109 | |
| 110 | === Magic === |
| 111 | Magic checks (WTF, better description) FIXME. |
| 112 | Add example FIXME |
| 113 | |
| 114 | |
| 115 | === Matrix Sparse === |
| 116 | What's that for, what means the sparse thing there ? FIXME |
| 117 | |
| 118 | === Red & Black Tree === |
| 119 | Self-balancing binary search tree, a data structure, good for use in associative arays, very efficient and fast, removes and insert intelligently the data on the tree, so it is balanced for optimization reasons. FIXME ? |
| 120 | |
| 121 | === Memory Pool === |
| 122 | FIXME: description |
| 123 | FIXME: elements: |
| 124 | * register/unregister ? |
| 125 | * malloc/realloc ? |
| 126 | * add/del/free ? |
| 127 | * statistics |
| 128 | |
| 129 | === Modules === |
| 130 | Which kind of modules ? eina modules so extra libs features ? FIXME |
| 131 | |
| 132 | === Safety Checks === |
| 133 | Set of macros to check for parameters or values that should never happen, doesn't abort the program but it logs instead |
| 134 | |
| 135 | The meant of this is to remove possible segfaults when they will be not so important and continue with the process of program |
| 136 | |
| 137 | FIXME: is this code good ? |
| 138 | {{{ |
| 139 | #!C |
| 140 | EAPI void |
| 141 | my_func(Ethumb *e) |
| 142 | { |
| 143 | EINA_SAFETY_ON_NULL_RETURN(e); // return if our pointer is null |
| 144 | do_something; |
| 145 | }}} |
| 146 | |
| 147 | |
| 148 | === Tiler === |
| 149 | FIXME: description |
| 150 | repetitive fill for rectangles (???) |
| 151 | |
| 152 | === MACROS === |
| 153 | FIXME: Add description of these usages: |
| 154 | * EINA_WARN_UNUSED_RESULT |
| 155 | * EINA_ARG_NONNULL |
| 156 | * EINA_DEPRECATED |
| 157 | * EINA_PURE |
| 158 | * EINA_UNLIKELY/LIKELY |
| 159 | * EINA_FALSE/TRUE: equivalent to FALSE/TRUE macros |