From 795b5338896d7c4d66378eb94eaa5bebf803364a Mon Sep 17 00:00:00 2001 From: "Thomas \"Cakeisalie5\" Touhey" Date: Fri, 24 Feb 2017 02:18:10 +0100 Subject: [PATCH] Started changing headers, updated license to LGPL3. --- AUTHORS.md | 2 +- LICENSE.md | 435 ++++++++------------------- Makefile.vars | 2 - configure | 9 +- include/libg1m.h | 35 ++- include/libg1m/bcd.h | 63 ++-- include/libg1m/buffer.h | 54 ++-- include/libg1m/color.h | 45 +-- include/libg1m/format.h | 27 +- include/libg1m/format/addin.h | 27 +- include/libg1m/format/eact.h | 27 +- include/libg1m/format/fkey.h | 27 +- include/libg1m/format/lang.h | 27 +- include/libg1m/format/mcs.h | 27 +- include/libg1m/format/mcsfile.h | 27 +- include/libg1m/format/picture.h | 27 +- include/libg1m/format/storage.h | 27 +- include/libg1m/formatutils.h | 35 ++- include/libg1m/internals.h | 31 +- include/libg1m/internals/bcd.h | 27 +- include/libg1m/internals/endian.h | 40 +-- include/libg1m/internals/log.h | 31 +- include/libg1m/internals/stdio_ext.h | 37 ++- src/core/version.c | 6 +- tools/write-header-config | 27 ++ 25 files changed, 580 insertions(+), 542 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index a615eac..6d84a67 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,5 +1,5 @@ # libg1m authors -Thomas "Cakeisalie5" Touhey is the man behind the project. +Copyright (C) 2017 Thomas "Cakeisalie5" Touhey The documentation comes from a lot of places in the CASIO community, but mainly from **Casiopeia** (mainly with Simon Lothar's documentation) and **Cemetech** diff --git a/LICENSE.md b/LICENSE.md index 0daa041..408c98d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,336 +1,157 @@ -GNU General Public License -========================== +### GNU LESSER GENERAL PUBLIC LICENSE -_Version 2, June 1991_ -_Copyright © 1989, 1991 Free Software Foundation, Inc.,_ -_51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA_ +Version 3, 29 June 2007 -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. +Copyright (C) 2007 Free Software Foundation, Inc. + -### Preamble +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. -The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. +This version of the GNU Lesser General Public License incorporates the +terms and conditions of version 3 of the GNU General Public License, +supplemented by the additional permissions listed below. -When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +#### 0. Additional Definitions. -To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. +As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the +GNU General Public License. -For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. +"The Library" refers to a covered work governed by this License, other +than an Application or a Combined Work as defined below. -We protect your rights with two steps: **(1)** copyright the software, and -**(2)** offer you this license which gives you legal permission to copy, -distribute and/or modify the software. +An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. +A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". -Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. -The precise terms and conditions for copying, distribution and -modification follow. +The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. -### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +#### 1. Exception to Section 3 of the GNU GPL. -**0.** This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The “Program”, below, -refers to any such program or work, and a “work based on the Program” -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term “modification”.) Each licensee is addressed as “you”. +You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. +#### 2. Conveying Modified Versions. -**1.** You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. +If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. +- a) under this License, provided that you make a good faith effort + to ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or +- b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. -**2.** You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: +#### 3. Object Code Incorporating Material from Library Header Files. -* **a)** You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. -* **b)** You must cause any work that you distribute or publish, that in -whole or in part contains or is derived from the Program or any -part thereof, to be licensed as a whole at no charge to all third -parties under the terms of this License. -* **c)** If the modified program normally reads commands interactively -when run, you must cause it, when started running for such -interactive use in the most ordinary way, to print or display an -announcement including an appropriate copyright notice and a -notice that there is no warranty (or else, saying that you provide -a warranty) and that users may redistribute the program under -these conditions, and telling the user how to view a copy of this -License. (Exception: if the Program itself is interactive but -does not normally print such an announcement, your work based on -the Program is not required to print an announcement.) +The object code form of an Application may incorporate material from a +header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. +- a) Give prominent notice with each copy of the object code that + the Library is used in it and that the Library and its use are + covered by this License. +- b) Accompany the object code with a copy of the GNU GPL and this + license document. -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. +#### 4. Combined Works. -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. +You may convey a Combined Work under terms of your choice that, taken +together, effectively do not restrict modification of the portions of +the Library contained in the Combined Work and reverse engineering for +debugging such modifications, if you also do each of the following: -**3.** You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: +- a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. +- b) Accompany the Combined Work with a copy of the GNU GPL and this + license document. +- c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. +- d) Do one of the following: + - 0) Convey the Minimal Corresponding Source under the terms of + this License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + - 1) Use a suitable shared library mechanism for linking with + the Library. A suitable mechanism is one that (a) uses at run + time a copy of the Library already present on the user's + computer system, and (b) will operate properly with a modified + version of the Library that is interface-compatible with the + Linked Version. +- e) Provide Installation Information, but only if you would + otherwise be required to provide such information under section 6 + of the GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the Application + with a modified version of the Linked Version. (If you use option + 4d0, the Installation Information must accompany the Minimal + Corresponding Source and Corresponding Application Code. If you + use option 4d1, you must provide the Installation Information in + the manner specified by section 6 of the GNU GPL for conveying + Corresponding Source.) -* **a)** Accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of Sections -1 and 2 above on a medium customarily used for software interchange; or, -* **b)** Accompany it with a written offer, valid for at least three -years, to give any third party, for a charge no more than your -cost of physically performing source distribution, a complete -machine-readable copy of the corresponding source code, to be -distributed under the terms of Sections 1 and 2 above on a medium -customarily used for software interchange; or, -* **c)** Accompany it with the information you received as to the offer -to distribute corresponding source code. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form with such -an offer, in accord with Subsection b above.) +#### 5. Combined Libraries. -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. +You may place library facilities that are a work based on the Library +side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. +- a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities, conveyed under the terms of this License. +- b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. -**4.** You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. +#### 6. Revised Versions of the GNU Lesser General Public License. -**5.** You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. +The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. -**6.** Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. +Each version is given a distinguishing version number. If the Library +as you received it specifies that a certain numbered version of the +GNU Lesser General Public License "or any later version" applies to +it, you have the option of following the terms and conditions either +of that published version or of any later version published by the +Free Software Foundation. If the Library as you received it does not +specify a version number of the GNU Lesser General Public License, you +may choose any version of the GNU Lesser General Public License ever +published by the Free Software Foundation. -**7.** If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - -**8.** If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - -**9.** The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and “any -later version”, you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - -**10.** If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - -### NO WARRANTY - -**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - -**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the “copyright” line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w` and `show c`; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a “copyright disclaimer” for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. +If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/Makefile.vars b/Makefile.vars index fa925d1..2b0afca 100755 --- a/Makefile.vars +++ b/Makefile.vars @@ -85,8 +85,6 @@ endif CFLAGS := -I $(INCDIR) $(CWARN) -std=gnu11 \ $(if $(STATIC),,-fPIC) $(if $(OPTIMIZE_SIZE),-Os,-O2) \ -D LOGLEVEL="ll_$(LOG_LEVEL)" \ - -D MAINTAINER="$(MAINTAINER_NAME) <$(MAINTAINER_MAIL)>" \ - -D LICENSE="$(LICENSE)" -D VERSION="$(VERSION)" \ $(shell $(PKGCONFIG) --cflags $(LIBS) 2>/dev/null) \ $(CMOREFLAGS) diff --git a/configure b/configure index bf795bb..6af703d 100755 --- a/configure +++ b/configure @@ -4,9 +4,11 @@ cd "$(dirname $0)" # Defaults # #******************************************************************************# # Project variables +[ -f Makefile.cfg ] && mv Makefile.cfg Makefile.cfg.tmp name="$(make -s getname)" version="$(make -s getversion)" maintainer="$(make -s getmaintainer)" +[ -f Makefile.cfg.tmp ] && mv Makefile.cfg.tmp Makefile.cfg # Platform platform="$(command -v gcc 1>/dev/null && gcc --print-multiarch)" @@ -216,9 +218,10 @@ fi make mrproper MAKE_FULL_LOG=y 1>/dev/null 2>/dev/null # Create the configuration header -opt="--version=${version}" -[ "$no_file" ] && opt+=" --no-file" -tools/write-header-config $opt >include/libg1m/config.h +tools/write-header-config --version=${version} \ + --maintainer="$(echo ${maintainer} | sed 's/"/\\"/g')" \ + $([ "$no_file" ] && echo --no-file) \ + >include/${name}/config.h # Do it! exec 3>&1 1>Makefile.cfg diff --git a/include/libg1m.h b/include/libg1m.h index d5bc22b..ad58a71 100644 --- a/include/libg1m.h +++ b/include/libg1m.h @@ -1,12 +1,29 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/10/31 00:14:27 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m.h -- libg1m main public header. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * WARNING: Do NOT include this header using ! + * + * Compile using one of these: + * libg1m-config --cflags + * pkg-config libg1m --cflags + * + * and include using . + * ************************************************************************** */ #ifndef LIBG1M_H # define LIBG1M_H # include diff --git a/include/libg1m/bcd.h b/include/libg1m/bcd.h index 0f9839e..e7d4471 100644 --- a/include/libg1m/bcd.h +++ b/include/libg1m/bcd.h @@ -1,37 +1,44 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/bcd.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/11/21 09:23:44 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/bcd.h -- BCD-encoded numbers manipulation. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * BCD are the main number format CASIO uses in its calculators. + * Each semi-byte is a digit going from 0 to 9 (0xA to 0xF aren't used). + * This format has the huge advantage to make 0.1 + 0.2 and 0.3 equal. + * + * The first three digits are the exponent. + * If the exponent is more than 500, then remove 500, and that means the + * number is negative. + * Then you have to remove 100 to have the real exponent. + * + * Before applying these operations, you should check the most significant bit + * of the upper nibble of the first binary-coded digit of the exponent. + * If it is 1, then the number has a complex part. Anyway, always set this + * bit to zero before interpreting the exponent. + * + * The other 15 digits are the mantissa. So the number is: (M ** (E + 1)) + * ************************************************************************** */ #ifndef LIBG1M_BCD_H # define LIBG1M_BCD_H # ifdef __cplusplus extern "C" { # endif -/* ************************************************************************** */ -/* Type definition */ -/* ************************************************************************** */ -/* BCD are the main number format CASIO uses in its calculators. - * Each semi-byte is a digit going from 0 to 9 (0xA to 0xF aren't used). - * This format has the huge advantage to make 0.1 + 0.2 and 0.3 equal. - * - * The first three digits are the exponent. - * If the exponent is more than 500, then remove 500, and that means the - * number is negative. - * Then you have to remove 100 to have the real exponent. - * - * Before applying these operations, you should check the most significant bit - * of the upper nibble of the first binary-coded digit of the exponent. - * If it is 1, then the number has a complex part. Anyway, always set this - * bit to zero before interpreting the exponent. - * - * The other 15 digits are the mantissa. So the number is: (M ** (E + 1)) */ - +/* Type definition */ typedef struct bcd { /* the BCD value itself */ unsigned char BCDval[9]; diff --git a/include/libg1m/buffer.h b/include/libg1m/buffer.h index 495caef..b296a01 100644 --- a/include/libg1m/buffer.h +++ b/include/libg1m/buffer.h @@ -1,34 +1,44 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/buffer.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2017/02/12 16:04:33 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/buffer.h -- the libg1m buffer interface. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * This interface is there so you can use a custom buffer for the library + * to read. There are two use cases: + * - you want to read data: the `size` of the element to read should be set, + * and the `read` callback will be used; + * - you want to receive data: if the `announce` callback is set, it will be + * called with the size of the file to write, in order to prepare space for + * it. If the `announce` callback returns an error, then the file will not + * be written. If the announcement is successful, then the `write` callback + * is used. + * + * In each case, the `cookie` is sent as the first argument to your callbacks. + * ************************************************************************** */ #ifndef LIBG1M_BUFFER_H # define LIBG1M_BUFFER_H # include # include -/* This file is there so it is possible to use a custom buffer for file - * transferring. There are two use cases: - * - if you use a buffer to send data: the size of the element to send should - * be put in `size`, and the `read` function will be used; - * - if you use a buffer to receive data: if the `announce` function is set, - * it will be called with the size of the file to receive, in order to - * prepare space for the file. If the announce function returns an error, - * then the file will not be sent. - * - * Here are the used functions: */ - +/* The callbacks types... */ typedef int (*g1m_buffer_read_t)(void*, unsigned char*, size_t); typedef int (*g1m_buffer_write_t)(void*, const unsigned char*, size_t); typedef int (*g1m_buffer_announce_t)(void*, uint_fast32_t size); -/* And here is the structure of a buffer: */ - +/* ... and the structure of a buffer. */ typedef struct { void *cookie; diff --git a/include/libg1m/color.h b/include/libg1m/color.h index f19c4a4..f6c9bbd 100644 --- a/include/libg1m/color.h +++ b/include/libg1m/color.h @@ -1,23 +1,30 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/color.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/11/21 09:32:56 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/color.h -- the libg1m color constants. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * These colors are mainly for coloring text in e-activities on modern + * graph calculators (with color LCDs). There is one color byte for each + * character, and each byte is 0xMC, where M is the marker color (background + * color) and C is there character color (foreground color). + * ************************************************************************** */ #ifndef LIBG1M_COLOR_H # define LIBG1M_COLOR_H -/* This header is about colors in e-activities for fx-CG calculators. - * - * For each text line, there can be a "color zone" that has the same size as - * the content. Each byte is organized as 0xMC, where 'M' is the marker color - * (background color) whereas 'C' is the character color. - * - * These colors are the following: */ - +/* The colors: */ typedef int g1m_color_t; # define g1m_color_black 0x0 # define g1m_color_blue 0x1 @@ -28,11 +35,9 @@ typedef int g1m_color_t; # define g1m_color_yellow 0x6 # define g1m_color_white 0x7 -/* And here are some macros to help you out: */ - +/* And some macros to help you out: */ # define g1m_marker_color(C) (((C) & 0xf0) >> 4) # define g1m_char_color(C) ((C) & 0xf) - # define g1m_character_color(C) g1m_char_color(C) #endif /* LIBG1M_COLOR_H */ diff --git a/include/libg1m/format.h b/include/libg1m/format.h index 8dfa5a7..105194d 100644 --- a/include/libg1m/format.h +++ b/include/libg1m/format.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/12/01 13:33:58 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format.h -- the G1M format description. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_H # define LIBG1M_FORMAT_H # include diff --git a/include/libg1m/format/addin.h b/include/libg1m/format/addin.h index cf0a0f6..e5244ab 100644 --- a/include/libg1m/format/addin.h +++ b/include/libg1m/format/addin.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format/addin.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/11/02 14:15:46 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format/addin.h -- the G1M add-in format description. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_ADDIN_H # define LIBG1M_FORMAT_ADDIN_H # include diff --git a/include/libg1m/format/eact.h b/include/libg1m/format/eact.h index 1a37765..b10bd32 100644 --- a/include/libg1m/format/eact.h +++ b/include/libg1m/format/eact.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format/eact.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/11/02 14:15:46 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format/eact.h -- the G1M e-activity format description. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_EACT_H # define LIBG1M_FORMAT_EACT_H # include diff --git a/include/libg1m/format/fkey.h b/include/libg1m/format/fkey.h index 16f9dba..527b93c 100644 --- a/include/libg1m/format/fkey.h +++ b/include/libg1m/format/fkey.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format/fkey.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/12/16 16:04:58 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format/fkey.h -- the G1M function keys file format description. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_FKEY_H # define LIBG1M_FORMAT_FKEY_H # include diff --git a/include/libg1m/format/lang.h b/include/libg1m/format/lang.h index 86f8204..fbd4dc6 100644 --- a/include/libg1m/format/lang.h +++ b/include/libg1m/format/lang.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format/lang.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/11/24 17:56:34 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format/lang.h -- the G1M language file format description. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_LANG_H # define LIBG1M_FORMAT_LANG_H # include diff --git a/include/libg1m/format/mcs.h b/include/libg1m/format/mcs.h index df08d99..b391250 100644 --- a/include/libg1m/format/mcs.h +++ b/include/libg1m/format/mcs.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format/mcs.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/11/02 14:15:46 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format/mcs.h -- the G1M MCS file format description. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_MCS_H # define LIBG1M_FORMAT_MCS_H # include diff --git a/include/libg1m/format/mcsfile.h b/include/libg1m/format/mcsfile.h index 9f3e4c1..ba6e1a1 100644 --- a/include/libg1m/format/mcsfile.h +++ b/include/libg1m/format/mcsfile.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format/mcsfile.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/12/16 12:05:51 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format/mcsfile.h -- description of the MCS subfiles formats. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_MCSFILE_H # define LIBG1M_FORMAT_MCSFILE_H # include diff --git a/include/libg1m/format/picture.h b/include/libg1m/format/picture.h index 94f030d..5c2097a 100644 --- a/include/libg1m/format/picture.h +++ b/include/libg1m/format/picture.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format/picture.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/11/02 14:15:46 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format/picture.h -- the G1M picture formats description. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_PICTURE_H # define LIBG1M_FORMAT_PICTURE_H # include diff --git a/include/libg1m/format/storage.h b/include/libg1m/format/storage.h index f06aec0..e1abd6d 100644 --- a/include/libg1m/format/storage.h +++ b/include/libg1m/format/storage.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/format/storage.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/12/25 13:39:13 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/format/storage.h -- the G1M storage file format description. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_FORMAT_STORAGE_H # define LIBG1M_FORMAT_STORAGE_H diff --git a/include/libg1m/formatutils.h b/include/libg1m/formatutils.h index 39f500d..cd774da 100644 --- a/include/libg1m/formatutils.h +++ b/include/libg1m/formatutils.h @@ -1,12 +1,29 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/formatutils.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/12/16 14:49:49 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/formatutils.h -- libg1m format decoder helpers. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * Even though the structures and constants are shared in public headers, some + * things cannot be defined easily in structures and constants, such as + * strings <-> types correspondances. These utilities are there for this. + * + * If you want to implement the format lecture yourself, either link with + * libg1m and use these functions directly, or copy their sources in + * `src/utils/type.c` and/or `src/utils/mcstype.c`. + * ************************************************************************** */ #ifndef LIBG1M_FORMATUTILS_H # define LIBG1M_FORMATUTILS_H # include diff --git a/include/libg1m/internals.h b/include/libg1m/internals.h index a749e11..2434f6e 100644 --- a/include/libg1m/internals.h +++ b/include/libg1m/internals.h @@ -1,12 +1,25 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/internals.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/12/01 13:33:58 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/internals.h -- the libg1m internals. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * This is the root of the libg1m internal headers. All source files shall + * include this one to include all the headers (so they don't have to do + * it themselves). + * ************************************************************************** */ #ifndef LIBG1M_INTERNALS_H # define LIBG1M_INTERNALS_H # include diff --git a/include/libg1m/internals/bcd.h b/include/libg1m/internals/bcd.h index 1b239e5..a98fc66 100644 --- a/include/libg1m/internals/bcd.h +++ b/include/libg1m/internals/bcd.h @@ -1,12 +1,21 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/internals/bcd.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/11/21 16:15:37 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/internals/bcd.h -- the libg1m BCD internal helpers. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * ************************************************************************** */ #ifndef LIBG1M_INTERNALS_BCD_H # define LIBG1M_INTERNALS_BCD_H # include diff --git a/include/libg1m/internals/endian.h b/include/libg1m/internals/endian.h index 28e0c3f..37f76e3 100644 --- a/include/libg1m/internals/endian.h +++ b/include/libg1m/internals/endian.h @@ -1,12 +1,24 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/internals/endian.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/12/20 11:44:12 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/internals/endian.h -- cross-platform endian utilities. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * If the platform is unrecognized, `endian.h` will be used -- if it is + * your platform, you should implement it :) + * ************************************************************************** */ #ifndef LIBG1M_INTERNALS_ENDIAN_H # define LIBG1M_INTERNALS_ENDIAN_H @@ -16,13 +28,7 @@ # define __WINDOWS__ # endif -/* "endian.h" is not a cross-platform header, so I'll be re-using some work - * by Mathias Panzenböck to make this internal header. */ - -# if defined(__linux__) || defined(__CYGWIN__) -# include - -# elif defined(__APPLE__) +# if defined(__APPLE__) # include # define be16toh(x) OSSwapBigToHostInt16(x) @@ -59,7 +65,7 @@ # endif # else -# error Unsupported platform! +# include # endif #endif /* LIBG1M_INTERNALS_ENDIAN_H */ diff --git a/include/libg1m/internals/log.h b/include/libg1m/internals/log.h index ee71e43..0e16eef 100644 --- a/include/libg1m/internals/log.h +++ b/include/libg1m/internals/log.h @@ -1,12 +1,25 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/internals/log.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/10/31 00:14:27 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/internals/log.h -- libg1m's logging system. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * The libg1m logging system is quite simple and defined at compilation time. + * It cannot be tweaked at runtime (I should probably correct that someday). + * Also, as it's an internal header, only the libg1m sources can use it. + * ************************************************************************** */ #ifndef LIBG1M_INTERNALS_LOG_H # define LIBG1M_INTERNALS_LOG_H # include diff --git a/include/libg1m/internals/stdio_ext.h b/include/libg1m/internals/stdio_ext.h index 156f42b..46a1d78 100644 --- a/include/libg1m/internals/stdio_ext.h +++ b/include/libg1m/internals/stdio_ext.h @@ -1,12 +1,25 @@ -/* ************************************************************************** */ -/* _____ _ */ -/* libg1m/internals/stdio_ext.h |_ _|__ _ _| |__ ___ _ _ */ -/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ -/* | | (_) | |_| | | | | __/ |_| | */ -/* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ -/* Last updated: 2016/12/20 12:11:03 |___/ */ -/* */ -/* ************************************************************************** */ +/* ***************************************************************************** + * libg1m/internals/stdio_ext.h -- platform-agnostic advanced FILE helpers. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * This file is there to use the platform's advanced FILE utilities. + * Actually, this feature is quite rare, so I accept that the platform doesn't + * have any. + * ************************************************************************** */ #ifndef LIBG1M_INTERNALS_STDIO_EXT_H # define LIBG1M_INTERNALS_STDIO_EXT_H @@ -17,10 +30,10 @@ # endif /* Ever heard of how annoying it is to make something platform-agnostic? */ -# if defined(__WINDOWS__) -# define __freadable(F) (1) -# else +# ifdef __linux__ # include +# else +# define __freadable(F) (1) # endif #endif /* LIBG1M_INTERNALS_STDIO_EXT_H */ diff --git a/src/core/version.c b/src/core/version.c index 346c1b8..80c48e8 100644 --- a/src/core/version.c +++ b/src/core/version.c @@ -9,8 +9,6 @@ /* ************************************************************************** */ #include #include -#define Q(x) #x -#define QUOTE(x) Q(x) /* get loglevel string */ #if LOGLEVEL == ll_info @@ -33,8 +31,8 @@ */ static const char version_message[] = -"libg1m v" QUOTE(VERSION) " (licensed under GPLv2)\n" -"Maintained by " QUOTE(MAINTAINER) ".\n" +"libg1m v" LIBG1M_VERSION " (licensed under LGPL3)\n" +"Maintained by " LIBG1M_MAINTAINER ".\n" "\n" "Compiled with the '" LLS "' loglevel.\n" "\n" diff --git a/tools/write-header-config b/tools/write-header-config index e3198f6..fb1d712 100755 --- a/tools/write-header-config +++ b/tools/write-header-config @@ -5,11 +5,13 @@ # Initialize the variables no_file= version= +maintainer='anon ' # Read the arguments for arg ; do case "$arg" in --no-file) no_file=y ;; --version=*) version="${arg#*=}" ;; +--maintainer=*) maintainer="${arg#*=}" ;; *) echo "'${arg}': Did not read." ;; esac; done @@ -30,6 +32,29 @@ version_num=$(printf "0x%02X%02X%04X" \ #******************************************************************************# # Beginning cat <<_EOF +/* ***************************************************************************** + * libg1m/config.h -- libg1m configuration header. + * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey + * + * This file is part of libg1m. + * libg1m is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3.0 of the License, + * or (at your option) any later version. + * + * libg1m is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libg1m; if not, see . + * + * This file is generated from the options you pass to the configure script. + * It shall not be modified by the user after its generation, as this could + * lead to unresolved symbols! If you want another configuration, then you + * will have to build the library again, with your different configuration. + * ************************************************************************** */ #ifndef LIBG1M_CONFIG_H # define LIBG1M_CONFIG_H # define LIBG1M_VERSION "${version}" @@ -38,6 +63,8 @@ cat <<_EOF # define LIBG1M_MINOR ${version_minor} # define LIBG1M_REV ${version_rev} # define LIBG1M_INDEV ${version_indev} +# define LIBG1M_MAINTAINER \\ + "${maintainer}" _EOF