From 0ed490533e275e7f00837103b65c7ebd09457e00 Mon Sep 17 00:00:00 2001 From: "jk7744.park" Date: Tue, 8 Sep 2015 22:48:16 +0900 Subject: [PATCH] tizen 2.3.1 release --- COPYING | 2 +- ChangeLog | 8 + NEWS | 16 +- README | 2 +- configure.ac | 2 +- debian/changelog | 420 ------------------------------------------ debian/compat | 1 - debian/control | 85 --------- debian/copyright | 78 -------- debian/embryo_cc.1 | 32 ---- debian/libembryo-bin.install | 2 - debian/libembryo-bin.manpages | 1 - debian/libembryo-dev.install | 4 - debian/libembryo-doc.dirs | 1 - debian/libembryo-doc.doc-base | 10 - debian/libembryo0.install | 1 - debian/libembryo0.symbols | 36 ---- debian/rules | 26 --- embryo.manifest | 8 + packaging/embryo.spec | 39 +++- src/bin/Makefile.am | 4 + src/bin/embryo_cc_sc.h | 6 + src/bin/embryo_cc_sc1.c | 37 ++-- src/bin/embryo_cc_sc2.c | 80 ++++---- src/bin/embryo_cc_sc3.c | 6 +- src/bin/embryo_cc_sc5.c | 12 +- src/bin/embryo_cc_sc6.c | 16 +- src/bin/embryo_cc_sc7.c | 6 +- src/lib/Embryo.h | 384 +++++++++++++++++++++----------------- src/lib/embryo_amx.c | 5 +- src/lib/embryo_str.c | 21 ++- 31 files changed, 399 insertions(+), 952 deletions(-) delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/embryo_cc.1 delete mode 100644 debian/libembryo-bin.install delete mode 100644 debian/libembryo-bin.manpages delete mode 100644 debian/libembryo-dev.install delete mode 100644 debian/libembryo-doc.dirs delete mode 100644 debian/libembryo-doc.doc-base delete mode 100644 debian/libembryo0.install delete mode 100644 debian/libembryo0.symbols delete mode 100755 debian/rules create mode 100644 embryo.manifest diff --git a/COPYING b/COPYING index 26d6208..ec444fd 100644 --- a/COPYING +++ b/COPYING @@ -1,6 +1,6 @@ Copyright notice for Embryo: -Copyright (C) 2004-2011 Carsten Haitzler and various contributors (see AUTHORS) +Copyright (C) 2004-2014 Carsten Haitzler and various contributors (see AUTHORS) All rights reserved. diff --git a/ChangeLog b/ChangeLog index 97da875..2611b84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,3 +41,11 @@ * Fix divide by 0 possibilities in the fp support so no FPE is produced (bad). +2012-08-30 Carsten Haitzler (The Rasterman) + + 1.7.0 release + +2012-09-12 Carsten Haitzler (The Rasterman) + + * Fix windows utf/whitespace parsing issue in windows + diff --git a/NEWS b/NEWS index a71cf67..5b0201b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,18 @@ -Embryo 1.2.0 +Embryo 1.8.0 + +Changes since Embryo 1.7.0: +--------------------------- + +Fixes: + + * Fix windows utf8 shitepsace parse issue. + +Changes since Embryo 1.2.0: +--------------------------- + +Fixes: + + * Fix divide by 0 n FP support to avoid FPE. Changes since Embryo 1.1.0: --------------------------- diff --git a/README b/README index b0deab2..a434404 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Embryo 1.7.0 +Embryo 1.7.99 ****************************************************************************** diff --git a/configure.ac b/configure.ac index 2e84edb..a918f3e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## m4_define([v_maj], [1]) -m4_define([v_min], [6]) +m4_define([v_min], [7]) m4_define([v_mic], [99]) m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n'])) m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))]) diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index b59df57..0000000 --- a/debian/changelog +++ /dev/null @@ -1,420 +0,0 @@ -embryo (1.2.0+svn.70375slp2+build02) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.2.0+svn.70375slp2+build02 - - -- Myungjae Lee Wed, 25 Apr 2012 17:28:40 +0900 - -embryo (1.2.0+svn.70375slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.2.0+svn.70375slp2+build01 - - -- Myungjae Lee Wed, 25 Apr 2012 15:14:02 +0900 - -embryo (1.2.0+svn.70344slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.2.0+svn.70344slp2+build01 - - -- Jaehwan Kim Mon, 23 Apr 2012 15:29:05 +0900 - -embryo (1.2.0+svn.70204slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.2.0+svn.70204slp2+build01 - - -- Hyoyoung Chang Wed, 18 Apr 2012 18:08:02 +0900 - -embryo (1.2.0+svn.69899slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.2.0+svn.69899slp2+build01 - - -- Jeonghyun Yun Fri, 06 Apr 2012 18:17:05 +0900 - -embryo (1.1.0+svn.69490slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.1.0+svn.69490slp2+build01 - - -- Jeonghyun Yun Wed, 28 Mar 2012 14:29:30 +0900 - -embryo (1.1.0+svn.68928slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.1.0+svn.68928slp2+build01 - - -- Jeonghyun Yun Sat, 10 Mar 2012 13:51:25 +0900 - -embryo (1.1.0+svn.68718slp2+build02) unstable; urgency=low - - * 68928 - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.1.0+svn.68718slp2+build02 - - -- Jeonghyun Yun Sat, 10 Mar 2012 13:21:01 +0900 - -embryo (1.1.0+svn.68718slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.1.0+svn.68718slp2+build01 - - -- Jeonghyun Yun Wed, 07 Mar 2012 16:44:53 +0900 - -embryo (1.1.0+svn.68421slp2+build01) unstable; urgency=low - - * Package upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.1.0+svn.68421slp2+build01 - - -- Jeonghyun Yun Fri, 02 Mar 2012 06:32:43 -0500 - -embryo (1.1.0+svn.67705slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.1.0+svn.67705slp2+build01 - - -- Jaehwan Kim Wed, 15 Feb 2012 19:01:34 +0900 - -embryo (1.1.0+svn.66150slp2+build01) unstable; urgency=low - - * Package Upload - * Git: slp/pkgs/e/embryo - * Tag: embryo_1.1.0+svn.66150slp2+build01 - - -- Jaehwan Kim Mon, 16 Jan 2012 18:36:25 +0900 - -embryo (1.1.0+svn.65860slp2+build01) unstable; urgency=low - - * Package Upload for migration - * Git: slp-scm.sec.samsung.net:slp/pkgs/e/embryo - * Tag: embryo_1.1.0+svn.65860slp2+build01 - - -- Jaehwan Kim Thu, 08 Dec 2011 13:52:17 +0900 - -embryo (1.1.0+svn.65304slp2+build01) unstable; urgency=low - - * Merge with upstream @65304 - - -- Mike McCormack Thu, 17 Nov 2011 09:10:41 +0900 - -embryo (1.0.0.001+svn.64802slp2+build01) unstable; urgency=low - - * Merge with upstream @64802 - - -- Mike McCormack Thu, 10 Nov 2011 14:10:35 +0900 - -embryo (1.0.0.001+svn.63811slp2+build01) unstable; urgency=low - - * Merge with upstream - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.63811slp2+build01 - - -- Mike McCormack Wed, 05 Oct 2011 16:45:36 +0900 - -embryo (1.0.0.001+svn.62382slp2+build01) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r62382 - * Important Changes - [Migration upstream r62382] - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.62382slp2+build01 - - -- Jaehwan Kim Fri, 02 Sep 2011 18:43:44 +0900 - -embryo (1.0.0.001+svn.60294slp2+build02) unstable; urgency=low - - * Package Upload - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.60294slp2+build02 - - -- Jaehwan Kim Fri, 24 Jun 2011 19:33:14 +0900 - -embryo (1.0.0.001+svn.60294slp2+build01) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r60294 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.60294slp2+build01 - - -- Jaehwan Kim Fri, 24 Jun 2011 18:10:13 +0900 - -embryo (1.0.0.001+svn.58120slp2+build01) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r58120 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.58120slp2+build01 - - -- Jaehwan Kim Tue, 05 Apr 2011 15:55:13 +0900 - -embryo (1.0.0.001+svn.57246slp2+build06) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r57246 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.57246slp2+build06 - - -- Shinwoo Kim Tue, 29 Mar 2011 18:55:38 +0900 - -embryo (1.0.0.001+svn.57246slp2+build05) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r57246 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.57246slp2+build05 - - -- Myungjae Lee Wed, 09 Mar 2011 11:29:49 +0900 - -embryo (1.0.0.001+svn.57246slp2+build04) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r57246 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.57246slp2+build04 - - -- Myungjae Lee Wed, 09 Mar 2011 11:15:04 +0900 - -embryo (1.0.0.001+svn.57246slp2+build03) unstable; urgency=low - - * Package Uplaod : Rollback - * Git: 165.213.180.234:/slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.57246slp2+build03 - - -- WooHyun Jung Tue, 08 Mar 2011 12:41:39 +0900 - -embryo (1.0.0.001+svn.57246slp2+build02) unstable; urgency=low - - * Package Upload : rollback - * Git: 165.213.180.234:/slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.57246slp2+build02 - - -- WooHyun Jung Tue, 08 Mar 2011 11:11:56 +0900 - -embryo (1.0.0.001+svn.57246slp2+build01) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r57246 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.57246slp2+build01 - - -- Myungjae Lee Mon, 07 Mar 2011 17:28:18 +0900 - -embryo (1.0.0.001+svn.56205slp2+build01) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r56205 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.56205slp2+build01 - - -- WooHyun Jung Thu, 27 Jan 2011 12:22:41 +0900 - -embryo (1.0.0.001+svn.55945slp2+build01) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r55945 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.55945slp2+build01 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.55945slp2+build01 - - -- WooHyun Jung Wed, 19 Jan 2011 16:18:16 +0900 - -embryo (1.0.0.001+svn.55682slp2+build01) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r55682 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.55682slp2+build01 - - -- Jaehwan Kim Mon, 03 Jan 2011 21:20:27 +0900 - -embryo (1.0.0.001+svn.55489slp2+build01) unstable; urgency=low - - * [SVN EFL Migration] embryo in SLP is merged with SVN r55489 - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.55489slp2+build01 - - -- Jaehwan Kim Wed, 22 Dec 2010 20:04:36 +0900 - -embryo (1.0.0.001+svn.55238slp2+build01) unstable; urgency=low - - * [SVN's EFL Migration] embryo in SLP is merged with SVN r55238. - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.55238slp2+build01 - - -- Juyung Seo Tue, 14 Dec 2010 17:51:21 +0900 - -embryo (1.0.0.001+svn.51480slp2+build04) unstable; urgency=low - - * [SVN's EFL Migration] embryo in SLP is merged with SVN r55238. - * Git: 165.213.180.234:slp/pkgs/e/embryo - * Tag: embryo_1.0.0.001+svn.51480slp2+build04 - - -- Juyung Seo Tue, 14 Dec 2010 14:58:09 +0900 - -embryo (1.0.0.001+svn.51480slp2+build03) unstable; urgency=low - - * [SVN 54507 Merge] - * Update to SVN Revision 54507. - * Git: 165.213.180.234:/git/slp/pkgs/embryo - * Tag: embryo_1.0.0.001+svn.51480slp2+build03 - - -- Juyung Seo Fri, 26 Nov 2010 15:39:26 +0900 - -embryo (1.0.0.001+svn.51480slp2+build02) unstable; urgency=low - - * add as-needed - * Git: 165.213.180.234:/git/slp/pkgs/embryo - * Tag: embryo_1.0.0.001+svn.51480slp2+build02 - - -- Jaehwan Kim Wed, 15 Sep 2010 10:51:24 +0900 - -embryo (1.0.0.001+svn.51480slp2+build01) unstable; urgency=low - - * efl 1.0 alpha upgrade - * Git: 165.213.180.234:/git/slp/pkgs/embryo - * Tag: embryo_1.0.0.001+svn.51480slp2+build01 - - -- Jaehwan Kim Tue, 31 Aug 2010 22:47:22 +0900 - -embryo (0.9.9.060+svn.49540slp2+3build04) unstable; urgency=low - - * Packaging. - * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo - * Tag: embryo_0.9.9.060+svn.49540slp2+3build04 - - -- Daniel Juyung Seo Thu, 10 Jun 2010 21:09:44 +0900 - -embryo (0.9.9.060+svn.49540slp2+3build03) unstable; urgency=low - - * Packaging. - * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo - * Tag: embryo_0.9.9.060+svn.49540slp2+3build03 - - -- Daniel Juyung Seo Thu, 10 Jun 2010 21:04:28 +0900 - -embryo (0.9.9.060+svn.49540slp2+3build02) unstable; urgency=low - - * Packaging. - * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo - * Tag: embryo_0.9.9.060+svn.49540slp2+3build02 - - -- Daniel Juyung Seo 목, 10 6월 2010 21:00:52 +0900 - -embryo (0.9.9.060+svn.49540slp2+3) unstable; urgency=low - - * Packaging. - * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo - * Tag: embryo_0.9.9.060+svn.49540slp2+3 - - -- Daniel Juyung Seo Thu, 10 Jun 2010 20:46:54 +0900 - -embryo (0.9.9.060+svn.49540slp2+2) unstable; urgency=low - - * Packaging. - * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo - * Tag: embryo_0.9.9.060+svn.49540slp2+2 - - -- Daniel Juyung Seo Thu, 10 Jun 2010 20:46:08 +0900 - -embryo (0.9.9.060+svn.49540slp2+1) unstable; urgency=low - - * Packaging. - * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo - * Tag: embryo_0.9.9.060+svn.49540slp2+1 - - -- Daniel Juyung Seo Thu, 10 Jun 2010 20:22:44 +0900 - -embryo (0.9.9.060+svn.49540slp2+0) unstable; urgency=low - - * Update opensource EFL from SVN - * SVN revision: 49540 (Total EFL revision: 49550) - * Tag: 0.9.9.060+svn.49540slp2+0 - - -- Daniel Juyung Seo Thu, 10 Jun 2010 15:50:43 +0900 - -embryo (0.9.9.060+svn20100304slp2) unstable; urgency=low - - * change package version - - -- Jaehwan Kim Thu, 25 Mar 2010 16:03:48 +0900 - -embryo (0.9.9.060+svn20100304-1) unstable; urgency=low - - * EFL_update_revision_46864 - - -- Jaehwan Kim Wed, 10 Mar 2010 16:06:36 +0900 - -embryo (0.9.9.060+svn20100203-2) unstable; urgency=low - - * repack - - -- Jaehwan Kim Thu, 04 Feb 2010 20:29:08 +0900 - -embryo (0.9.9.060+svn20100203-1) unstable; urgency=low - - * EFL_update_revision_45828 - - -- Jaehwan Kim Wed, 03 Feb 2010 16:39:22 +0900 - -embryo (0.9.9.060+svn20100119-1) unstable; urgency=low - - * EFL_update_revision_45322 - - -- Jihoon Kim Tue, 19 Jan 2010 20:44:48 +0900 - -embryo (0.9.9.060+svn20100111-3) unstable; urgency=low - - * reupload EFL i686 - - -- Jaehwan Kim Tue, 12 Jan 2010 17:35:36 +0900 - -embryo (0.9.9.060+svn20100111-2) unstable; urgency=low - - * reupload EFL - - -- Jaehwan Kim Mon, 11 Jan 2010 22:16:57 +0900 - -embryo (0.9.9.060+svn20100111-1) unstable; urgency=low - - * update EFL revision - - -- Jaehwan Kim Mon, 11 Jan 2010 13:28:05 +0900 - -embryo (0.9.9.060+svn20091229-1) unstable; urgency=low - - * update EFL - - -- Jaehwan Kim Tue, 29 Dec 2009 14:27:04 +0900 - -embryo (0.9.9.060+svn20091112-3) unstable; urgency=low - - * change arch to any - - -- youmin ha Fri, 27 Nov 2009 16:31:01 +0900 - -embryo (0.9.9.060+svn20091112-2) unstable; urgency=low - - * svn stable version - - -- Sangho Park Thu, 19 Nov 2009 19:01:51 +0900 - -embryo (0.9.9.060+svn20091112-1) unstable; urgency=low - - * Clean up changelog - - -- Sangho Park Fri, 13 Nov 2009 08:56:08 +0900 - -embryo (0.9.9.060+svnYYYYMMDD-1) unstable; urgency=low - - * Clean up changelog - - -- quaker Thu, 22 Apr 2009 19:26:08 +0100 - -embryo (0.9.9.050+svnYYYYMMDD-1) unstable; urgency=low - - * Clean up changelog - - -- quaker Tue, 21 Apr 2009 19:15:09 +0100 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index 06cad25..0000000 --- a/debian/control +++ /dev/null @@ -1,85 +0,0 @@ -Source: embryo -Section: libs -Priority: optional -Maintainer: Jaehwan Kim , Juyung Seo , Mike McCormack , Jeonghyun Yun , Hyoyoung Chang -Build-Depends: dpkg-dev , debhelper (>= 6), cdbs, doxygen, pkg-config, libtool, libeina-dev -Standards-Version: 3.8.1 -Homepage: http://www.enlightenment.org - -Package: libembryo-dev -Section: libdevel -Architecture: any -Depends: ${misc:Depends}, libembryo0 (= ${binary:Version}), pkg-config -Description: Development files for libembryo0 - Embryo is primarily a shared library that gives you an API to load - and control interpreted programs compiled into an abstract machine - bytecode that it understands. This abstract (or virtual) machine is - similar to a real machine with a CPU, but it is emulated in - software. - . - This packages contains headers and static libraries for Embryo. - -Package: libembryo0 -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends} -Suggests: libembryo-bin -Description: SMALL-based abstract machine (AMX) bytecode interpreter - Embryo is primarily a shared library that gives you an API to load - and control interpreted programs compiled into an abstract machine - bytecode that it understands. This abstract (or virtual) machine is - similar to a real machine with a CPU, but it is emulated in - software. The architecture is simple and is the same as the - abstract machine (AMX) in the SMALL language as it is based on - exactly the same code. Embryo has modified the code for the AMX - extensively and has made it smaller and more portable. It is VERY - small. The total size of the virtual machine code AND header files - is less than 2500 lines of code. It includes the floating point - library support by default as well. This makes it one of the - smallest interpreters around, and thus makes is very efficient to - use in code. - . - See also http://www.compuphase.com/small.htm for details on SMALL. - -Package: libembryo-doc -Section: doc -Architecture: any -Depends: ${misc:Depends} -Enhances: libembryo-dev -Description: libembryo0 development documentation - Embryo is primarily a shared library that gives you an API to load - and control interpreted programs compiled into an abstract machine - bytecode that it understands. This abstract (or virtual) machine is - similar to a real machine with a CPU, but it is emulated in - software. - . - This packages provides development documentation for Embryo. - -Package: libembryo-dbg -Architecture: any -Section: libdevel -Depends: ${misc:Depends}, libembryo0 (= ${binary:Version}) -Priority: extra -Description: Debugging symbols for libembryo - Embryo is primarily a shared library that gives you an API to load - and control interpreted programs compiled into an abstract machine - bytecode that it understands. This abstract (or virtual) machine is - similar to a real machine with a CPU, but it is emulated in - software - . - This package contains unstripped shared libraries. It is provided primarily - to provide a backtrace with names in a debugger, this makes it somewhat - easier to interpret core dumps. The libraries are installed in - /usr/lib/debug and are automatically used by gdb. - -Package: libembryo-bin -Section: devel -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends} -Description: SMALL compiler creating Embryo bytecode - Embryo is primarily a shared library that gives you an API to load - and control interpreted programs compiled into an abstract machine - bytecode that it understands. This abstract (or virtual) machine is - similar to a real machine with a CPU, but it is emulated in - software - . - This package contains the embryo compiler: embryo_cc. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index cee0fb6..0000000 --- a/debian/copyright +++ /dev/null @@ -1,78 +0,0 @@ -This package was debianized by Victor Koeppel on -Wed, 24 Mar 2004 15:44:55 +0100. - -It was downloaded from http://download.enlightenment.org/ - -Upstream Author: Carsten Haitzler - -Copyright: - - Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS) - -Additional copyrights: - src/bin: embryo_cc_amx.h, embryo_cc_osdefs.h, embryo_cc_scvars.c, - embryo_cc_sc[1-7].c, embryo_cc_scvars.c: Copyright ITB CompuPhase, 1997-2003 - - src/bin/embryo_cc_sc{5,7}.scp: Copyright (c) ITB CompuPhase, 2000-2003 - src/bin/embryo_cc_sclist.c: Copyright (c) ITB CompuPhase, 2001-2003 - src/bin/embryo_cc_scexpand.c: Copyright 1996 Philip Gage - src/bin/embryo_cc_sc.h: Copyright R. Cain, 1980, J.E. Hendrix, 1982, 1983, - T. Riemersma, 1997-2003 - - src/lib/embryo_amx.c: Copyright (c) ITB CompuPhase, 1997-2003 - Portions Copyright (c) Carsten Haitzler, 2004 - src/lib/embryo_float.c: Copyright (c) Artran, Inc. 1999 - Portions Copyright (c) Carsten Haitzler, 2004 - - These files are all licensed under the zLib license: - This software is provided "as-is", without any express or implied warranty. - In no event will the authors be held liable for any damages arising from - the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software in - a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - -License: - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies of the Software and its Copyright notices. In addition publicly - documented acknowledgment must be given that this software has been used if no - source code of this software is made available publicly. This includes - acknowledgments in either Copyright notices, Manuals, Publicity and Marketing - documents or any documentation provided with any product containing this - software. This License does not apply to any software that links to the - libraries provided by this software (statically or dynamically), but only to - the software provided. - - Please see the COPYING.PLAIN for a plain-english explanation of this notice - and it's intent. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - - IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -On Debian systems, the complete text of the BSD License can be found -in `/usr/share/common-licenses/BSD'. - -The Debian packaging is: - (C) 2006 2007,Debian Pkg-e Team -and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. diff --git a/debian/embryo_cc.1 b/debian/embryo_cc.1 deleted file mode 100644 index 171f314..0000000 --- a/debian/embryo_cc.1 +++ /dev/null @@ -1,32 +0,0 @@ -.TH EMBRYO_CC 1 "Jan 30, 2007" "0.9.1.037" "The embryo compiler" -.SH NAME -embryo_cc \- a small compiler -.SH SYNOPSIS -.B embryo_cc -.B filename -.RI [\| OPTIONS \|] -.SH DESCRIPTION -Embryo is an enlightenment adaption of the small PAWN language. -.P -embryo_cc is a compiler for embryo files. -.SH EXAMPLES -embryo_cc filename -.SH OPTIONS -.BI -i " \|name -Path for include files -.P -.BI -o " \|name -Set base name of output file -.P -.BI -S " \|num -Stack/heap size in cells (default=4096, min=65) -.SH FILES -embryo_cc -.SH BUGS -There is a bug with gcc 3.2.x. -.BR -Prefer gcc 3.3.x. -.P -Please reports bugs to the Pkg-E Team -.SH AUTHOR -This man page was written by Ronald Claveau for the Debian GNU/Linux system (but may be used by others). diff --git a/debian/libembryo-bin.install b/debian/libembryo-bin.install deleted file mode 100644 index a484b55..0000000 --- a/debian/libembryo-bin.install +++ /dev/null @@ -1,2 +0,0 @@ -debian/tmp/usr/bin/embryo_cc -debian/tmp/usr/share/embryo/include/*.inc diff --git a/debian/libembryo-bin.manpages b/debian/libembryo-bin.manpages deleted file mode 100644 index 55f9248..0000000 --- a/debian/libembryo-bin.manpages +++ /dev/null @@ -1 +0,0 @@ -debian/embryo_cc.1 diff --git a/debian/libembryo-dev.install b/debian/libembryo-dev.install deleted file mode 100644 index 5f9e41c..0000000 --- a/debian/libembryo-dev.install +++ /dev/null @@ -1,4 +0,0 @@ -debian/tmp/usr/include/* -debian/tmp/usr/lib/pkgconfig/* -debian/tmp/usr/lib/lib*.a -debian/tmp/usr/lib/lib*.so diff --git a/debian/libembryo-doc.dirs b/debian/libembryo-doc.dirs deleted file mode 100644 index cdcf8b2..0000000 --- a/debian/libembryo-doc.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/share/doc/libembryo-doc diff --git a/debian/libembryo-doc.doc-base b/debian/libembryo-doc.doc-base deleted file mode 100644 index 06e8dad..0000000 --- a/debian/libembryo-doc.doc-base +++ /dev/null @@ -1,10 +0,0 @@ -Document: embryo -Title: Embryo Guide -Author: Carsten Haitzler -Abstract: This document describes Embryo API - and provides sample C code. -Section: Programming/C - -Format: HTML -Index: /usr/share/doc/libembryo-doc/html/index.html -Files: /usr/share/doc/libembryo-doc/html/*.html diff --git a/debian/libembryo0.install b/debian/libembryo0.install deleted file mode 100644 index c45ebcf..0000000 --- a/debian/libembryo0.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/lib*.so.* diff --git a/debian/libembryo0.symbols b/debian/libembryo0.symbols deleted file mode 100644 index eb4c0f5..0000000 --- a/debian/libembryo0.symbols +++ /dev/null @@ -1,36 +0,0 @@ -libembryo.so.0 libembryo0 #MINVER# - embryo_data_address_get@Base 0.9.1.042 - embryo_data_heap_pop@Base 0.9.1.042 - embryo_data_heap_push@Base 0.9.1.042 - embryo_data_string_get@Base 0.9.1.042 - embryo_data_string_length_get@Base 0.9.1.042 - embryo_data_string_set@Base 0.9.1.042 - embryo_error_string_get@Base 0.9.1.042 - embryo_init@Base 0.9.1.042 - embryo_parameter_cell_array_push@Base 0.9.1.042 - embryo_parameter_cell_push@Base 0.9.1.042 - embryo_parameter_string_push@Base 0.9.1.042 - embryo_program_const_new@Base 0.9.1.042 - embryo_program_data_get@Base 0.9.1.042 - embryo_program_data_set@Base 0.9.1.042 - embryo_program_error_get@Base 0.9.1.042 - embryo_program_error_set@Base 0.9.1.042 - embryo_program_free@Base 0.9.1.042 - embryo_program_function_find@Base 0.9.1.042 - embryo_program_load@Base 0.9.1.042 - embryo_program_max_cycle_run_get@Base 0.9.1.042 - embryo_program_max_cycle_run_set@Base 0.9.1.042 - embryo_program_native_call_add@Base 0.9.1.042 - embryo_program_new@Base 0.9.1.042 - embryo_program_recursion_get@Base 0.9.1.042 - embryo_program_return_value_get@Base 0.9.1.042 - embryo_program_run@Base 0.9.1.042 - embryo_program_variable_count_get@Base 0.9.1.042 - embryo_program_variable_find@Base 0.9.1.042 - embryo_program_variable_get@Base 0.9.1.042 - embryo_program_vm_pop@Base 0.9.1.042 - embryo_program_vm_push@Base 0.9.1.042 - embryo_program_vm_reset@Base 0.9.1.042 - embryo_shutdown@Base 0.9.1.042 - embryo_swap_16@Base 0.9.1.042 - embryo_swap_32@Base 0.9.1.042 diff --git a/debian/rules b/debian/rules deleted file mode 100755 index ee17a73..0000000 --- a/debian/rules +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/class/autotools.mk -include /usr/share/cdbs/1/rules/debhelper.mk - -DEB_DH_STRIP_ARGS := --dbg-package=libembryo-dbg -DEB_CONFIGURE_EXTRA_FLAGS := -DEB_CONFIGURE_SCRIPT := ./autogen.sh -DEB_MAKE_CLEAN_TARGET := distclean -#DEB_SOURCE_VERSION := $(shell grep AC_INIT $(DEB_SRCDIR)/configure.ac | cut -d, -f2 | tr -d ' []') -DEB_SOURCE_VERSION := 0.9.9.0 -CFLAGS += -fvisibility=hidden -fPIC -LDFLAGS += -fvisibility=hidden -Wl,--hash-style=both -Wl,--as-needed - -#build/libembryo-doc:: -# cd $(DEB_SRCDIR)/doc && make doc - -#install/libembryo-doc:: -# tar jxf embryo-*-doc.tar.bz2 -C $(DEB_SRCDIR) -# cp -R $(DEB_SRCDIR)/doc/html $(DEB_SRCDIR)/debian/libembryo-doc/usr/share/doc/libembryo-doc/ -# cp -R $(DEB_SRCDIR)/embryo-$(DEB_SOURCE_VERSION)-doc/doc/html debian/libembryo-doc/usr/share/doc/libembryo-doc/ -# rm -rf $(DEB_SRCDIR)/doc/ - -clean:: - [ ! -f Makefile ] || make distclean - rm -f embryo-*.tar.* embryo-*.cdbs-config_list diff --git a/embryo.manifest b/embryo.manifest new file mode 100644 index 0000000..f45f071 --- /dev/null +++ b/embryo.manifest @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packaging/embryo.spec b/packaging/embryo.spec index 89ba1b0..d1e1178 100644 --- a/packaging/embryo.spec +++ b/packaging/embryo.spec @@ -1,16 +1,14 @@ -#sbs-git:slp/pkgs/e/embryo embryo 1.1.0+svn.68928slp2+build01 ff312ab0f1dd243c5f94e56b2e55f3c43b0cf40f Name: embryo Summary: A small virtual machine engine (in a library) and bytecode compiler -Version: 1.6.0+svn.73906slp2+build04 +Version: 1.6.0+svn.76491slp2+build07 Release: 1 Group: System/Libraries -License: BSD +License: BSD 2-Clause URL: http://www.enlightenment.org/ Source0: %{name}-%{version}.tar.gz Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: pkgconfig(eina) -Provides: embryo-bin %description @@ -19,33 +17,47 @@ Development files for libembryo0 Embryo is primarily a shared library that gives bytecode that it understands. This abstract (or virtual) machine is similar to a real machine with a CPU, but it is emulated in software. - . This packages contains headers and static libraries for Embryo. - %package devel Summary: A small virtual machine engine and bytecode compile (devel) Group: Development/Libraries Requires: %{name} = %{version}-%{release} + %description devel A small virtual machine engine (in a library) and bytecode compile (devel) + +%package tools +Summary: A small virtual machine engine and bytecode compile (tools) +Group: Development/Tools +Requires: %{name} = %{version}-%{release} +Provides: %{name}-bin +Obsoletes: %{name}-bin + + +%description tools +A small virtual machine engine (in a library) and bytecode compile (tools) + + %prep %setup -q %build -export CFLAGS+=" -fvisibility=hidden -fPIC" +export CFLAGS+=" -fvisibility=hidden -fPIC -Wall" export LDFLAGS+=" -fvisibility=hidden -Wl,--hash-style=both -Wl,--as-needed" %autogen --disable-static -%configure --disable-static make %{?jobs:-j%jobs} %install %make_install +mkdir -p %{buildroot}/%{_datadir}/license +cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/%{_datadir}/license/%{name} +cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/%{_datadir}/license/%{name}-tools %post -p /sbin/ldconfig @@ -54,8 +66,8 @@ make %{?jobs:-j%jobs} %files %defattr(-,root,root,-) %{_libdir}/libembryo.so.* -%{_bindir}/embryo_cc -%{_datadir}/embryo/include/default.inc +%{_datadir}/license/%{name} +%manifest %{name}.manifest %files devel @@ -63,3 +75,10 @@ make %{?jobs:-j%jobs} %{_includedir}/embryo-1/Embryo.h %{_libdir}/libembryo.so %{_libdir}/pkgconfig/*.pc + + +%files tools +%defattr(-,root,root,-) +%{_bindir}/embryo_cc +%{_datadir}/license/%{name}-tools +%{_datadir}/embryo/include/default.inc diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 09f6ffd..f57614e 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -35,6 +35,10 @@ embryo_cc_CFLAGS = @EMBRYO_CFLAGS@ embryo_cc_LDADD = $(top_builddir)/src/lib/libembryo.la @EVIL_LIBS@ @EINA_LIBS@ -lm embryo_cc_LDFLAGS = @lt_enable_auto_import@ +### TIZEN_ONLY(20150410): Apply ASLR to executable files. +embryo_cc_LDFLAGS += -pie +embryo_cc_CFLAGS += -fPIE + EXTRA_DIST = \ embryo_cc_sc5.scp \ embryo_cc_sc7.scp diff --git a/src/bin/embryo_cc_sc.h b/src/bin/embryo_cc_sc.h index bedd59e..9eaf6b8 100644 --- a/src/bin/embryo_cc_sc.h +++ b/src/bin/embryo_cc_sc.h @@ -664,4 +664,10 @@ extern FILE *outf; /* file written to */ extern jmp_buf errbuf; /* target of longjmp() on a fatal error */ +#define sc_isspace(x) isspace ((int)((unsigned char)x)) +#define sc_isalpha(x) isalpha ((int)((unsigned char)x)) +#define sc_isdigit(x) isdigit ((int)((unsigned char)x)) +#define sc_isupper(x) isupper ((int)((unsigned char)x)) +#define sc_isxdigit(x) isxdigit((int)((unsigned char)x)) + #endif diff --git a/src/bin/embryo_cc_sc1.c b/src/bin/embryo_cc_sc1.c index 371a1c9..0437e88 100644 --- a/src/bin/embryo_cc_sc1.c +++ b/src/bin/embryo_cc_sc1.c @@ -489,7 +489,7 @@ sc_addtag(char *name) /* tagname currently unknown, add it */ tag = last + 1; /* guaranteed not to exist already */ - if (isupper(*name)) + if (sc_isupper(*name)) tag |= (int)FIXEDTAG; append_constval(&tagname_tab, name, (cell) tag, 0); return tag; @@ -590,7 +590,8 @@ parseoptions(int argc, char **argv, char *iname, char *oname, { /* include directory */ i++; - strncpy(str, argv[i], sizeof(str)); + strncpy(str, argv[i], sizeof(str) -1); + str[sizeof(str) - 1] = '\0'; len = strlen(str); if (str[len - 1] != DIRSEP_CHAR) @@ -653,6 +654,8 @@ setconfig(char *root) char *ptr; int len; + path[sizeof(path) - 1] = 0; + /* add the default "include" directory */ if (root) { @@ -1547,7 +1550,8 @@ decl_const(int vclass) if (lex(&val, &str) != tSYMBOL) /* read in (new) token */ error(20, str); /* invalid symbol name */ symbolline = fline; /* save line where symbol was found */ - strcpy(constname, str); /* save symbol name */ + strncpy(constname, str, sizeof(constname) - 1); /* save symbol name */ + constname[sizeof(constname) - 1] = 0; needtoken('='); constexpr(&val, &exprtag); /* get value */ needtoken(tTERM); @@ -1597,7 +1601,8 @@ decl_enum(int vclass) * tag was set) */ if (lex(&val, &str) == tSYMBOL) { /* read in (new) token */ - strcpy(enumname, str); /* save enum name (last constant) */ + strncpy(enumname, str, sizeof(enumname) - 1); /* save enum name (last constant) */ + enumname[sizeof(enumname) - 1] = 0; if (!explicittag) tag = sc_addtag(enumname); } @@ -1642,7 +1647,8 @@ decl_enum(int vclass) tok = lex(&val, &str); /* read in (new) token */ if (tok != tSYMBOL && tok != tLABEL) error(20, str); /* invalid symbol name */ - strcpy(constname, str); /* save symbol name */ + strncpy(constname, str, sNAMEMAX); /* save symbol name */ + constname[sNAMEMAX] = 0; size = increment; /* default increment of 'val' */ if (tok == tLABEL || matchtoken(':')) constexpr(&size, NULL); /* get size */ @@ -1947,7 +1953,7 @@ tag2str(char *dest, int tag) tag &= TAGMASK; assert(tag >= 0); sprintf(dest, "0%x", tag); - return isdigit(dest[1]) ? &dest[1] : dest; + return sc_isdigit(dest[1]) ? &dest[1] : dest; } char * @@ -1993,7 +1999,7 @@ parse_funcname(char *fname, int *tag1, int *tag2, char *opname) } /* if */ assert(!unary || *tag1 == 0); assert(*ptr != '\0'); - for (name = opname; !isdigit(*ptr);) + for (name = opname; !sc_isdigit(*ptr);) *name++ = *ptr++; *name = '\0'; *tag2 = (int)strtol(ptr, NULL, 16); @@ -2008,7 +2014,7 @@ funcdisplayname(char *dest, char *funcname) constvalue *tagsym[2]; int unary; - if (isalpha(*funcname) || *funcname == '_' || *funcname == PUBLIC_CHAR + if (sc_isalpha(*funcname) || *funcname == '_' || *funcname == PUBLIC_CHAR || *funcname == '\0') { if (dest != funcname) @@ -2468,7 +2474,8 @@ declargs(symbol * sym) case tSYMBOL: if (argcnt >= sMAXARGS) error(45); /* too many function arguments */ - strcpy(name, ptr); /* save symbol name */ + strncpy(name, ptr, sizeof(name) - 1); /* save symbol name */ + name[sizeof(name) - 1] = 0; if (name[0] == PUBLIC_CHAR) error(56, name); /* function arguments cannot be public */ if (numtags == 0) @@ -2624,7 +2631,8 @@ doarg(char *name, int ident, int offset, int tags[], int numtags, cell size; int idxtag[sDIMEN_MAX]; - strcpy(arg->name, name); + strncpy(arg->name, name, sizeof(arg->name) - 1); + arg->name[sizeof(arg->name) - 1] = 0; arg->hasdefault = FALSE; /* preset (most common case) */ arg->defvalue.val = 0; /* clear */ arg->defvalue_tag = 0; @@ -3017,7 +3025,8 @@ insert_constval(constvalue * prev, constvalue * next, char *name, if (!(cur = (constvalue *)malloc(sizeof(constvalue)))) error(103); /* insufficient memory (fatal error) */ memset(cur, 0, sizeof(constvalue)); - strcpy(cur->name, name); + strncpy(cur->name, name, sizeof(cur->name) - 1); + cur->name[sizeof(cur->name) - 1] = 0; cur->value = val; cur->index = idx; cur->next = next; @@ -3788,12 +3797,14 @@ doswitch(void) if (swdefault == FALSE) { /* store lbl_exit as the "none-matched" label in the switch table */ - strcpy(labelname, itoh(lbl_exit)); + strncpy(labelname, itoh(lbl_exit), sizeof(labelname) - 1); + labelname[sizeof(labelname) - 1] = 0; } else { /* lbl_case holds the label of the "default" clause */ - strcpy(labelname, itoh(lbl_case)); + strncpy(labelname, itoh(lbl_case), sizeof(labelname) - 1); + labelname[sizeof(labelname) - 1] = 0; } /* if */ ffcase(casecount, labelname, TRUE); /* generate the rest of the table */ diff --git a/src/bin/embryo_cc_sc2.c b/src/bin/embryo_cc_sc2.c index 04cb537..9e80df2 100644 --- a/src/bin/embryo_cc_sc2.c +++ b/src/bin/embryo_cc_sc2.c @@ -443,9 +443,9 @@ dtoi(cell * val, char *curptr) *val = 0; ptr = curptr; - if (!isdigit(*ptr)) /* should start with digit */ + if (!sc_isdigit(*ptr)) /* should start with digit */ return 0; - while (isdigit(*ptr) || *ptr == '_') + while (sc_isdigit(*ptr) || *ptr == '_') { if (*ptr != '_') *val = (*val * 10) + (*ptr - '0'); @@ -453,7 +453,7 @@ dtoi(cell * val, char *curptr) } /* while */ if (alphanum(*ptr)) /* number must be delimited by non-alphanumerical */ return 0; - if (*ptr == '.' && isdigit(*(ptr + 1))) + if (*ptr == '.' && sc_isdigit(*(ptr + 1))) return 0; /* but a fractional part must not be present */ return (int)(ptr - curptr); } @@ -471,18 +471,18 @@ htoi(cell * val, char *curptr) *val = 0; ptr = curptr; - if (!isdigit(*ptr)) /* should start with digit */ + if (!sc_isdigit(*ptr)) /* should start with digit */ return 0; if (*ptr == '0' && *(ptr + 1) == 'x') { /* C style hexadecimal notation */ ptr += 2; - while (isxdigit(*ptr) || *ptr == '_') + while (sc_isxdigit(*ptr) || *ptr == '_') { if (*ptr != '_') { - assert(isxdigit(*ptr)); + assert(sc_isxdigit(*ptr)); *val = *val << 4; - if (isdigit(*ptr)) + if (sc_isdigit(*ptr)) *val += (*ptr - '0'); else *val += (tolower(*ptr) - 'a' + 10); @@ -554,9 +554,9 @@ ftoi(cell * val, char *curptr) fnum = 0.0; dnum = 0L; ptr = curptr; - if (!isdigit(*ptr)) /* should start with digit */ + if (!sc_isdigit(*ptr)) /* should start with digit */ return 0; - while (isdigit(*ptr) || *ptr == '_') + while (sc_isdigit(*ptr) || *ptr == '_') { if (*ptr != '_') { @@ -568,12 +568,12 @@ ftoi(cell * val, char *curptr) if (*ptr != '.') return 0; /* there must be a period */ ptr++; - if (!isdigit(*ptr)) /* there must be at least one digit after the dot */ + if (!sc_isdigit(*ptr)) /* there must be at least one digit after the dot */ return 0; ffrac = 0.0; fmult = 1.0; ignore = FALSE; - while (isdigit(*ptr) || *ptr == '_') + while (sc_isdigit(*ptr) || *ptr == '_') { if (*ptr != '_') { @@ -605,10 +605,10 @@ ftoi(cell * val, char *curptr) { sign = 1; } /* if */ - if (!isdigit(*ptr)) /* 'e' should be followed by a digit */ + if (!sc_isdigit(*ptr)) /* 'e' should be followed by a digit */ return 0; exp = 0; - while (isdigit(*ptr)) + while (sc_isdigit(*ptr)) { exp = (exp * 10) + (*ptr - '0'); ptr++; @@ -1044,7 +1044,7 @@ command(void) while ((*lptr <= ' ') && (*lptr != '\0')) lptr++; for (i = 0; - (i < (int)(sizeof(name))) && + (i < (int)(sizeof(name)) - 1) && (alphanum(*lptr)); i++, lptr++) name[i] = *lptr; @@ -1108,8 +1108,8 @@ command(void) while ((*lptr <= ' ') && (*lptr != '\0')) lptr++; for (i = 0; - (i < (int)(sizeof(name))) && - (isalpha(*lptr)); + (i < (int)(sizeof(name)) - 1) && + (sc_isalpha(*lptr)); i++, lptr++) name[i] = *lptr; name[i] = '\0'; @@ -1166,12 +1166,12 @@ command(void) case tpEMIT: { /* write opcode to output file */ - char name[40]; + char name[41]; int i; while (*lptr <= ' ' && *lptr != '\0') lptr++; - for (i = 0; i < 40 && (isalpha(*lptr) || *lptr == '.'); i++, lptr++) + for (i = 0; i < 40 && (sc_isalpha(*lptr) || *lptr == '.'); i++, lptr++) name[i] = (char)tolower(*lptr); name[i] = '\0'; stgwrite("\t"); @@ -1219,7 +1219,10 @@ command(void) if (tok < 256) sprintf(s2, "%c", (char)tok); else - strcpy(s2, sc_tokens[tok - tFIRST]); + { + strncpy(s2, sc_tokens[tok - tFIRST], 19); + s2[19] = 0; + } error(1, sc_tokens[tSYMBOL - tFIRST], s2); break; } /* case */ @@ -1253,7 +1256,7 @@ command(void) } /* while */ end = lptr; /* check pattern to match */ - if (!isalpha(*start) && *start != '_') + if (!sc_isalpha(*start) && *start != '_') { error(74); /* pattern must start with an alphabetic character */ break; @@ -1272,7 +1275,7 @@ command(void) } /* while */ pattern[count] = '\0'; /* special case, erase trailing variable, because it could match anything */ - if (count >= 2 && isdigit(pattern[count - 1]) + if (count >= 2 && sc_isdigit(pattern[count - 1]) && pattern[count - 2] == '%') pattern[count - 2] = '\0'; /* find substitution string */ @@ -1313,7 +1316,7 @@ command(void) substitution[count] = '\0'; /* check whether the definition already exists */ for (prefixlen = 0, start = pattern; - isalpha(*start) || isdigit(*start) || *start == '_'; + sc_isalpha(*start) || sc_isdigit(*start) || *start == '_'; prefixlen++, start++) /* nothing */ ; assert(prefixlen > 0); @@ -1484,7 +1487,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution) memset(args, 0, sizeof args); /* check the length of the prefix */ - for (prefixlen = 0, s = pattern; isalpha(*s) || isdigit(*s) || *s == '_'; + for (prefixlen = 0, s = pattern; sc_isalpha(*s) || sc_isdigit(*s) || *s == '_'; prefixlen++, s++) /* nothing */ ; assert(prefixlen > 0); @@ -1501,7 +1504,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution) if (*p == '%') { p++; /* skip '%' */ - if (isdigit(*p)) + if (sc_isdigit(*p)) { arg = *p - '0'; assert(arg >= 0 && arg <= 9); @@ -1596,7 +1599,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution) /* calculate the length of the substituted string */ for (e = substitution, len = 0; *e != '\0'; e++) { - if (*e == '%' && isdigit(*(e + 1))) + if (*e == '%' && sc_isdigit(*(e + 1))) { arg = *(e + 1) - '0'; assert(arg >= 0 && arg <= 9); @@ -1620,7 +1623,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution) strdel(line, (int)(s - line)); for (e = substitution, s = line; *e != '\0'; e++) { - if (*e == '%' && isdigit(*(e + 1))) + if (*e == '%' && sc_isdigit(*(e + 1))) { arg = *(e + 1) - '0'; assert(arg >= 0 && arg <= 9); @@ -1660,7 +1663,7 @@ substallpatterns(char *line, int buffersize) /* find the start of a prefix (skip all non-alphabetic characters), * also skip strings */ - while (!isalpha(*start) && *start != '_' && *start != '\0') + while (!sc_isalpha(*start) && *start != '_' && *start != '\0') { /* skip strings */ if (is_startstring(start)) @@ -1676,7 +1679,7 @@ substallpatterns(char *line, int buffersize) /* get the prefix (length), look for a matching definition */ prefixlen = 0; end = start; - while (isalpha(*end) || isdigit(*end) || *end == '_') + while (sc_isalpha(*end) || sc_isdigit(*end) || *end == '_') { prefixlen++; end++; @@ -2173,13 +2176,19 @@ needtoken(int token) if (token < 256) sprintf(s1, "%c", (char)token); /* single character token */ else - strcpy(s1, sc_tokens[token - tFIRST]); /* multi-character symbol */ + { + strncpy(s1, sc_tokens[token - tFIRST], 19); /* multi-character symbol */ + s1[19] = 0; + } if (!freading) strcpy(s2, "-end of file-"); else if (_lextok < 256) sprintf(s2, "%c", (char)_lextok); else - strcpy(s2, sc_tokens[_lextok - tFIRST]); + { + strncpy(s2, sc_tokens[_lextok - tFIRST], 19); + s2[19] = 0; + } error(1, s1, s2); /* expected ..., but found ... */ return FALSE; } /* if */ @@ -2318,7 +2327,7 @@ litchar(char **lptr, int rawmode) cptr += 1; break; default: - if (isdigit(*cptr)) + if (sc_isdigit(*cptr)) { /* \ddd */ c = 0; while (*cptr >= '0' && *cptr <= '9') /* decimal! */ @@ -2346,7 +2355,7 @@ litchar(char **lptr, int rawmode) static int alpha(char c) { - return (isalpha(c) || c == '_' || c == PUBLIC_CHAR); + return (sc_isalpha(c) || c == '_' || c == PUBLIC_CHAR); } /* alphanum @@ -2356,7 +2365,7 @@ alpha(char c) int alphanum(char c) { - return (alpha(c) || isdigit(c)); + return (alpha(c) || sc_isdigit(c)); } /* The local variable table must be searched backwards, so that the deepest @@ -2476,7 +2485,7 @@ delete_symbols(symbol * root, int level, int delete_labels, /* for user defined operators, also remove the "prototyped" flag, as * user-defined operators *must* be declared before use */ - if (sym->ident == iFUNCTN && !isalpha(*sym->name) + if (sym->ident == iFUNCTN && !sc_isalpha(*sym->name) && *sym->name != '_' && *sym->name != PUBLIC_CHAR) sym->usage &= ~uPROTOTYPED; root = sym; /* skip the symbol */ @@ -2675,7 +2684,8 @@ addsym(char *name, cell addr, int ident, int vclass, int tag, int usage) *refer = NULL; /* first fill in the entry */ - strcpy(entry.name, name); + strncpy(entry.name, name, sizeof(entry.name) - 1); + entry.name[sizeof(entry.name) - 1] = 0; entry.hash = namehash(name); entry.addr = addr; entry.vclass = (char)vclass; diff --git a/src/bin/embryo_cc_sc3.c b/src/bin/embryo_cc_sc3.c index 1206857..b54e570 100644 --- a/src/bin/embryo_cc_sc3.c +++ b/src/bin/embryo_cc_sc3.c @@ -170,7 +170,8 @@ check_userop(void (*oper) (void), int tag1, int tag2, int numparam, { if (oper == op1[i]) { - strcpy(opername, binoperstr[i]); + strncpy(opername, binoperstr[i], sizeof(opername) - 1); + opername[sizeof(opername) - 1] = 0; savepri = binoper_savepri[i]; break; } /* if */ @@ -190,7 +191,8 @@ check_userop(void (*oper) (void), int tag1, int tag2, int numparam, { if (oper == unopers[i]) { - strcpy(opername, unoperstr[i]); + strncpy(opername, unoperstr[i], sizeof(opername) - 1); + opername[sizeof(opername) - 1] = 0; break; } /* if */ } /* for */ diff --git a/src/bin/embryo_cc_sc5.c b/src/bin/embryo_cc_sc5.c index a8af498..4c650ca 100644 --- a/src/bin/embryo_cc_sc5.c +++ b/src/bin/embryo_cc_sc5.c @@ -74,14 +74,16 @@ error(int number, ...) if (number < 100) { - msg = errmsg[number - 1]; - errflag = TRUE; /* set errflag (skip rest of erroneous expression) */ - errnum++; + if (number > 74) number = 74; + msg = errmsg[number - 1]; + errflag = TRUE; /* set errflag (skip rest of erroneous expression) */ + errnum++; } else if (number < 200) { - msg = fatalmsg[number - 100]; - errnum++; /* a fatal error also counts as an error */ + if (number > 107) number = 107; + msg = fatalmsg[number - 100]; + errnum++; /* a fatal error also counts as an error */ } else { diff --git a/src/bin/embryo_cc_sc6.c b/src/bin/embryo_cc_sc6.c index 417a8a1..3525d27 100644 --- a/src/bin/embryo_cc_sc6.c +++ b/src/bin/embryo_cc_sc6.c @@ -134,7 +134,7 @@ align32(long *v) static char * skipwhitespace(char *str) { - while (isspace(*str)) + while (sc_isspace(*str)) str++; return str; } @@ -272,7 +272,7 @@ do_dump(FILE * fbin, char *params, cell opcode __UNUSED__) if (fbin) write_encoded(fbin, &p, 1); num++; - while (isspace(*params)) + while (sc_isspace(*params)) params++; } /* while */ return num * sizeof(cell); @@ -286,7 +286,7 @@ do_call(FILE * fbin, char *params, cell opcode) symbol *sym; ucell p; - for (i = 0; !isspace(*params); i++, params++) + for (i = 0; !sc_isspace(*params); i++, params++) { assert(*params != '\0'); assert(i < sNAMEMAX); @@ -339,10 +339,10 @@ do_file(FILE * fbin, char *params, cell opcode) p = hex2long(params, ¶ms); /* remove leading and trailing white space from the filename */ - while (isspace(*params)) + while (sc_isspace(*params)) params++; len = strlen(params); - while (len > 0 && isspace(params[len - 1])) + while (len > 0 && sc_isspace(params[len - 1])) len--; params[len++] = '\0'; /* zero-terminate */ while (len % sizeof(cell) != 0) @@ -368,7 +368,7 @@ do_symbol(FILE * fbin, char *params, cell opcode) int len; unsigned char mclass, type; - for (endptr = params; !isspace(*endptr) && endptr != '\0'; endptr++) + for (endptr = params; !sc_isspace(*endptr) && endptr != '\0'; endptr++) /* nothing */ ; assert(*endptr == ' '); @@ -1003,7 +1003,7 @@ assemble(FILE * fout, FILE * fin) /* get to the end of the instruction (make use of the '\n' that fgets() * added at the end of the line; this way we will *always* drop on a * whitespace character) */ - for (params = instr; *params != '\0' && !isspace(*params); + for (params = instr; *params != '\0' && !sc_isspace(*params); params++) /* nothing */ ; assert(params > instr); @@ -1039,7 +1039,7 @@ assemble(FILE * fout, FILE * fin) /* get to the end of the instruction (make use of the '\n' that fgets() * added at the end of the line; this way we will *always* drop on a * whitespace character) */ - for (params = instr; *params != '\0' && !isspace(*params); + for (params = instr; *params != '\0' && !sc_isspace(*params); params++) /* nothing */ ; assert(params > instr); diff --git a/src/bin/embryo_cc_sc7.c b/src/bin/embryo_cc_sc7.c index 910c522..b51f2ea 100644 --- a/src/bin/embryo_cc_sc7.c +++ b/src/bin/embryo_cc_sc7.c @@ -471,7 +471,7 @@ matchsequence(char *start, char *end, char *pattern, { case '%': /* new "symbol" */ pattern++; - assert(isdigit(*pattern)); + assert(sc_isdigit(*pattern)); var = atoi(pattern) - 1; assert(var >= 0 && var < _maxoptvars); assert(alphanum(*start)); @@ -542,7 +542,7 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1], { case '%': lptr++; /* skip '%' */ - assert(isdigit(*lptr)); + assert(sc_isdigit(*lptr)); var = atoi(lptr) - 1; assert(var >= 0 && var < _maxoptvars); assert(symbols[var][0] != '\0'); /* variable should be defined */ @@ -575,7 +575,7 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1], case '%': /* write out the symbol */ pattern++; - assert(isdigit(*pattern)); + assert(sc_isdigit(*pattern)); var = atoi(pattern) - 1; assert(var >= 0 && var < _maxoptvars); assert(symbols[var][0] != '\0'); /* variable should be defined */ diff --git a/src/lib/Embryo.h b/src/lib/Embryo.h index 2cea7fc..62cd10d 100644 --- a/src/lib/Embryo.h +++ b/src/lib/Embryo.h @@ -1,13 +1,14 @@ -/** +/** +@internal @brief Embryo Library - + These routines are used for Embryo. -@mainpage Embryo Library Documentation +@page Embryo Library Documentation @image html e_big.png -@version 1.2.0 +@version 1.7.0 @author Carsten Haitzler @author Compuphase http://www.compuphase.com @date 2004-2012 @@ -30,11 +31,11 @@ For the basics about the Small language, see @ref Small_Page. To use Embryo in your code, you need to do at least the following: -@li Include @ref Embryo.h. +@li Include Embryo.h. @li Load the Embryo program using one of the @ref Embryo_Program_Creation_Group. -@li Set up the native calls with @ref embryo_program_native_call_add. -@li Create a virtual machine with @ref embryo_program_vm_push. +@li Set up the native calls with #embryo_program_native_call_add. +@li Create a virtual machine with #embryo_program_vm_push. @li Then run the program with @ref embryo_program_run. @todo Clean up compiler code. @@ -69,7 +70,7 @@ The scope and usage of a variable depends on its declaration. @li A stock variable is one that may not be compiled into a program if it is not used. It is declared using @c stock. @li A public variable is one that can be read by the host program using - @ref embryo_program_variable_find. It is declared using @c public + #embryo_program_variable_find. It is declared using @c public keyword. Remember that the keywords above are to be used on their own. That is, @@ -341,7 +342,7 @@ extern "C" { #endif #define EMBRYO_VERSION_MAJOR 1 -#define EMBRYO_VERSION_MINOR 6 +#define EMBRYO_VERSION_MINOR 8 typedef struct _Embryo_Version { @@ -424,13 +425,15 @@ extern "C" { # define EMBRYO_CELL_TO_FLOAT(c) ((Embryo_Float_Cell) c).f #endif - /** - * @defgroup Embryo_Library_Group Library Maintenance Functions - * - * Functions that start up and shutdown the Embryo library. - */ - - +/** + * @internal + * @defgroup Embryo_Library_Group Embryo + * @ingroup EFL_Group + * + * Functions that start up and shutdown the Embryo library. + * @{ + */ + /** * Initialises the Embryo library. * @return The number of times the library has been initialised without being @@ -438,79 +441,85 @@ extern "C" { * @ingroup Embryo_Library_Group */ EAPI int embryo_init(void); - + /** - * Shuts down the Embryo library. + * @brief Shuts down the Embryo library. * @return The number of times the library has been initialised without being * shutdown. * @ingroup Embryo_Library_Group */ EAPI int embryo_shutdown(void); - /** - * @defgroup Embryo_Program_Creation_Group Program Creation and Destruction Functions - * - * Functions that set up programs, and destroy them. - */ - /** - * Creates a new Embryo program, with bytecode data that can be freed. - * @param data Pointer to the bytecode of the program. - * @param size Number of bytes of bytecode. + * @internal + * @defgroup Embryo_Program_Creation_Group Program Creation and Destruction Functions + * @ingroup Embryo_Library_Group + * + * Functions that set up programs, and destroy them. + */ + +/** + * @brief Creates a new Embryo program, with bytecode data that can be freed. + * + * @param[in] data Pointer to the bytecode of the program. + * @param[in] size Number of bytes of bytecode. * @return A new Embryo program. * @ingroup Embryo_Program_Creation_Group */ EAPI Embryo_Program *embryo_program_new(void *data, int size); - + /** - * Creates a new Embryo program, with bytecode data that cannot be + * @brief Creates a new Embryo program, with bytecode data that cannot be * freed. - * @param data Pointer to the bytecode of the program. - * @param size Number of bytes of bytecode. + * + * @param[in] data Pointer to the bytecode of the program. + * @param[in] size Number of bytes of bytecode. * @return A new Embryo program. * @ingroup Embryo_Program_Creation_Group */ EAPI Embryo_Program *embryo_program_const_new(void *data, int size); - + /** - * Creates a new Embryo program based on the bytecode data stored in the + * @brief Creates a new Embryo program based on the bytecode data stored in the * given file. - * @param file Filename of the given file. + * + * @param[in] file Filename of the given file. * @return A new Embryo program. * @ingroup Embryo_Program_Creation_Group */ EAPI Embryo_Program *embryo_program_load(const char *file); /** - * Frees the given Embryo program. - * @param ep The given program. + * @brief Frees the given Embryo program. + * + * @param[in] ep The given program. * @ingroup Embryo_Program_Creation_Group */ EAPI void embryo_program_free(Embryo_Program *ep); /** - * Adds a native program call to the given Embryo program. - * @param ep The given Embryo program. - * @param name The name for the call used in the script. - * @param func The function to use when the call is made. - * @ingroup Embryo_Func_Group + * @internal + * @defgroup Embryo_Func_Group Function Functions + * @ingroup Embryo_Library_Group + * + * @brief Functions that deal with Embryo program functions. */ /** - * @defgroup Embryo_Func_Group Function Functions + * @brief Adds a native program call to the given Embryo program. * - * Functions that deal with Embryo program functions. + * @param[in] ep The given Embryo program. + * @param[in] name The name for the call used in the script. + * @param[in] func The function to use when the call is made. + * @ingroup Embryo_Func_Group */ + EAPI void embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell (*func) (Embryo_Program *ep, Embryo_Cell *params)); /** - * Resets the current virtual machine session of the given program. - * @param ep The given program. - * @ingroup Embryo_Program_VM_Group - */ - -/** + * @internal * @defgroup Embryo_Program_VM_Group Virtual Machine Functions + * @ingroup Embryo_Library_Group * * Functions that deal with creating and destroying virtual machine sessions * for a given program. @@ -523,70 +532,91 @@ EAPI void embryo_program_native_call_add(Embryo_Program *ep, const c * to the old session. * * A new virtual machine session is created by pushing a new virtual machine - * onto the session stack of a program using @ref embryo_program_vm_push. + * onto the session stack of a program using #embryo_program_vm_push. * The current virtual machine session can be destroyed by calling * @ref embryo_program_vm_pop. */ + +/** + * @brief Resets the current virtual machine session of the given program. + * @param ep The given program. + * @ingroup Embryo_Program_VM_Group + */ + EAPI void embryo_program_vm_reset(Embryo_Program *ep); /** - * Starts a new virtual machine session for the given program. + * @brief Starts a new virtual machine session for the given program. * * See @ref Embryo_Program_VM_Group for more information about how this works. * - * @param ep The given program. + * @param[in] ep The given program. * @ingroup Embryo_Program_VM_Group */ EAPI void embryo_program_vm_push(Embryo_Program *ep); /** - * Frees the current virtual machine session associated with the given program. + * @brief Frees the current virtual machine session associated with the given program. * * See @ref Embryo_Program_VM_Group for more information about how this works. * Note that you will need to retrieve any return data or data on the stack * before you pop. * - * @param ep The given program. + * @param[in] ep The given program. * @ingroup Embryo_Program_VM_Group */ EAPI void embryo_program_vm_pop(Embryo_Program *ep); - -/** - * Ensures that the given unsigned short integer is in the small - * endian format. - * @param v Pointer to the given integer. - * @ingroup Embryo_Swap_Group - */ /** + * @internal * @defgroup Embryo_Swap_Group Byte Swapping Functions + * @ingroup Embryo_Library_Group * - * Functions that are used to ensure that integers passed to the + * @brief Functions that are used to ensure that integers passed to the * virtual machine are in small endian format. These functions are * used to ensure that the virtual machine operates correctly on big * endian machines. */ + +/** + * @brief Ensures that the given unsigned short integer is in the small + * endian format. + * @param v Pointer to the given integer. + * @ingroup Embryo_Swap_Group + */ EAPI void embryo_swap_16(unsigned short *v); - + /** - * Ensures that the given unsigned integer is in the small endian + * @brief Ensures that the given unsigned integer is in the small endian * format. - * @param v Pointer to the given integer. + * + * @param[in] v Pointer to the given integer. * @ingroup Embryo_Swap_Group */ EAPI void embryo_swap_32(unsigned int *v); /** - * Returns the function in the given program with the given name. - * @param ep The given program. - * @param name The given function name. + * @brief Returns the function in the given program with the given name. + * + * @param[in] ep The given program. + * @param[in] name The given function name. * @return The function if successful. Otherwise, @c EMBRYO_FUNCTION_NONE. * @ingroup Embryo_Func_Group */ EAPI Embryo_Function embryo_program_function_find(Embryo_Program *ep, const char *name); - + +/** + * @internal + * @defgroup Embryo_Public_Variable_Group Public Variable Access Functions + * @ingroup Embryo_Library_Group + * + * @brief In an Embryo program, a global variable can be declared public, as + * described in @ref Small_Scope_Subsection. The functions here allow + * the host program to access these public variables. + */ + /** - * Retrieves the location of the public variable in the given program + * @brief Retrieves the location of the public variable in the given program * with the given name. * @param ep The given program. * @param name The given name. @@ -594,185 +624,198 @@ EAPI Embryo_Function embryo_program_function_find(Embryo_Program *ep, const cha * otherwise. * @ingroup Embryo_Public_Variable_Group */ +EAPI Embryo_Cell embryo_program_variable_find(Embryo_Program *ep, const char *name); /** - * @defgroup Embryo_Public_Variable_Group Public Variable Access Functions + * @brief Retrieves the number of public variables in the given program. * - * In an Embryo program, a global variable can be declared public, as - * described in @ref Small_Scope_Subsection. The functions here allow - * the host program to access these public variables. - */ -EAPI Embryo_Cell embryo_program_variable_find(Embryo_Program *ep, const char *name); - -/** - * Retrieves the number of public variables in the given program. - * @param ep The given program. + * @param[in] ep The given program. * @return The number of public variables. * @ingroup Embryo_Public_Variable_Group */ EAPI int embryo_program_variable_count_get(Embryo_Program *ep); /** - * Retrieves the location of the public variable in the given program + * @brief Retrieves the location of the public variable in the given program * with the given identifier. - * @param ep The given program. - * @param num The identifier of the public variable. + * + * @param[in] ep The given program. + * @param[in] num The identifier of the public variable. * @return The virtual machine address of the variable if found. * @c EMBRYO_CELL_NONE otherwise. * @ingroup Embryo_Public_Variable_Group */ EAPI Embryo_Cell embryo_program_variable_get(Embryo_Program *ep, int num); - -/** - * Sets the error code for the given program to the given code. - * @param ep The given program. - * @param error The given error code. - * @ingroup Embryo_Error_Group - */ /** + * @internal * @defgroup Embryo_Error_Group Error Functions + * @ingroup Embryo_Library_Group * * Functions that set and retrieve error codes in Embryo programs. */ -EAPI void embryo_program_error_set(Embryo_Program *ep, Embryo_Error error); - + /** - * Retrieves the current error code for the given program. + * @brief Sets the error code for the given program to the given code. * @param ep The given program. - * @return The current error code. + * @param error The given error code. * @ingroup Embryo_Error_Group */ -EAPI Embryo_Error embryo_program_error_get(Embryo_Program *ep); +EAPI void embryo_program_error_set(Embryo_Program *ep, Embryo_Error error); /** - * Sets the data associated to the given program. - * @param ep The given program. - * @param data New bytecode data. - * @ingroup Embryo_Program_Data_Group + * @brief Retrieves the current error code for the given program. + * + * @param[in] ep The given program. + * @return The current error code. + * @ingroup Embryo_Error_Group */ +EAPI Embryo_Error embryo_program_error_get(Embryo_Program *ep); /** + * @internal * @defgroup Embryo_Program_Data_Group Program Data Functions + * @ingroup Embryo_Library_Group * * Functions that set and retrieve data associated with the given * program. */ + +/** + * @brief Sets the data associated to the given program. + * @param ep The given program. + * @param data New bytecode data. + * @ingroup Embryo_Program_Data_Group + */ EAPI void embryo_program_data_set(Embryo_Program *ep, void *data); /** - * Retrieves the data associated to the given program. + * @brief Retrieves the data associated to the given program. * @param ep The given program. * @ingroup Embryo_Program_Data_Group */ EAPI void *embryo_program_data_get(Embryo_Program *ep); /** - * Retrieves a string describing the given error code. - * @param error The given error code. + * @brief Retrieves a string describing the given error code. + * + * @param[in] error The given error code. * @return String describing the given error code. If the given code is not * known, the string "(unknown)" is returned. * @ingroup Embryo_Error_Group */ EAPI const char *embryo_error_string_get(Embryo_Error error); - -/** - * Retrieves the length of the string starting at the given cell. - * @param ep The program the cell is part of. - * @param str_cell Pointer to the first cell of the string. - * @return The length of the string. @c 0 is returned if there is an error. - * @ingroup Embryo_Data_String_Group - */ /** + * @internal * @defgroup Embryo_Data_String_Group Embryo Data String Functions + * @ingroup Embryo_Library_Group * * Functions that operate on strings in the memory of a virtual machine. */ -EAPI int embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell); - + /** - * Copies the string starting at the given cell to the given buffer. + * @brief Retrieves the length of the string starting at the given cell. * @param ep The program the cell is part of. * @param str_cell Pointer to the first cell of the string. - * @param dst The given buffer. + * @return The length of the string. @c 0 is returned if there is an error. + * @ingroup Embryo_Data_String_Group + */ +EAPI int embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell); + +/** + * @brief Copies the string starting at the given cell to the given buffer. + * + * @param[in] ep The program the cell is part of. + * @param[in] str_cell Pointer to the first cell of the string. + * @param[out] dst The given buffer. * @ingroup Embryo_Data_String_Group */ EAPI void embryo_data_string_get(Embryo_Program *ep, Embryo_Cell *str_cell, char *dst); - + /** - * Copies string in the given buffer into the virtual machine memory + * @brief Copies string in the given buffer into the virtual machine memory * starting at the given cell. - * @param ep The program the cell is part of. - * @param src The given buffer. - * @param str_cell Pointer to the first cell to copy the string to. + * + * @param[in] ep The program the cell is part of. + * @param[in] src The given buffer. + * @param[in] str_cell Pointer to the first cell to copy the string to. * @ingroup Embryo_Data_String_Group */ EAPI void embryo_data_string_set(Embryo_Program *ep, const char *src, Embryo_Cell *str_cell); /** - * Retreives a pointer to the address in the virtual machine given by the + * @brief Retreives a pointer to the address in the virtual machine given by the * given cell. - * @param ep The program whose virtual machine address is being queried. - * @param addr The given cell. + * + * @param[in] ep The program whose virtual machine address is being queried. + * @param[in] addr The given cell. * @return A pointer to the cell at the given address. * @ingroup Embryo_Data_String_Group */ EAPI Embryo_Cell *embryo_data_address_get(Embryo_Program *ep, Embryo_Cell addr); -/** - * Increases the size of the heap of the given virtual machine by the given - * number of Embryo_Cells. - * @param ep The program with the given virtual machine. - * @param cells The given number of Embryo_Cells. - * @return The address of the new memory region on success. - * @c EMBRYO_CELL_NONE otherwise. - * @ingroup Embryo_Heap_Group - */ /** + * @internal * @defgroup Embryo_Heap_Group Heap Functions + * @ingroup Embryo_Library_Group * * The heap is an area of memory that can be allocated for program * use at runtime. The heap functions here change the amount of heap * memory available. */ + +/** + * @brief Increases the size of the heap of the given virtual machine by the given + * number of Embryo_Cells. + * + * @param[in] ep The program with the given virtual machine. + * @param[in] cells The given number of Embryo_Cells. + * @return The address of the new memory region on success. + * @c EMBRYO_CELL_NONE otherwise. + * @ingroup Embryo_Heap_Group + */ EAPI Embryo_Cell embryo_data_heap_push(Embryo_Program *ep, int cells); - + /** - * Decreases the size of the heap of the given virtual machine down to the + * @brief Decreases the size of the heap of the given virtual machine down to the * given size. - * @param ep The program with the given virtual machine. - * @param down_to The given size. + * + * @param[in] ep The program with the given virtual machine. + * @param[in] down_to The given size. * @ingroup Embryo_Heap_Group */ EAPI void embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_to); -/** - * Returns the number of virtual machines are running for the given program. - * @param ep The given program. - * @return The number of virtual machines running. - * @ingroup Embryo_Run_Group - */ /** + * @internal * @defgroup Embryo_Run_Group Program Run Functions + * @ingroup Embryo_Library_Group * * Functions that are involved in actually running functions in an * Embryo program. */ + +/** + * @brief Returns the number of virtual machines are running for the given program. + * @param ep The given program. + * @return The number of virtual machines running. + * @ingroup Embryo_Run_Group + */ EAPI int embryo_program_recursion_get(Embryo_Program *ep); /** - * Runs the given function of the given Embryo program in the current + * @brief Runs the given function of the given Embryo program in the current * virtual machine. The parameter @p fn can be found using * @ref embryo_program_function_find. * * @note For Embryo to be able to run a function, it must have been * declared @c public in the Small source code. * - * @param ep The given program. - * @param func The given function. Normally "main", in which case the + * @param[in] ep The given program. + * @param[in] func The given function. Normally "main", in which case the * constant @c EMBRYO_FUNCTION_MAIN can be used. * @return @c EMBRYO_PROGRAM_OK on success. @c EMBRYO_PROGRAM_SLEEP if the * program is halted by the Small @c sleep call. @@ -784,9 +827,10 @@ EAPI int embryo_program_recursion_get(Embryo_Program *ep); EAPI Embryo_Status embryo_program_run(Embryo_Program *ep, Embryo_Function func); /** - * Retreives the return value of the last called function of the given + * @brief Retreives the return value of the last called function of the given * program. - * @param ep The given program. + * + * @param[in] ep The given program. * @return An Embryo_Cell representing the return value of the function * that was last called. * @ingroup Embryo_Run_Group @@ -794,11 +838,11 @@ EAPI Embryo_Status embryo_program_run(Embryo_Program *ep, Embryo_Function fun EAPI Embryo_Cell embryo_program_return_value_get(Embryo_Program *ep); /** - * Sets the maximum number of abstract machine cycles any given program run + * @brief Sets the maximum number of abstract machine cycles any given program run * can execute before being put to sleep and returning. * - * @param ep The given program. - * @param max The number of machine cycles as a limit. + * @param[in] ep The given program. + * @param[in] max The number of machine cycles as a limit. * * This sets the maximum number of abstract machine (virtual machine) * instructions that a single run of an embryo function (even if its main) @@ -844,9 +888,10 @@ EAPI Embryo_Cell embryo_program_return_value_get(Embryo_Program *ep); EAPI void embryo_program_max_cycle_run_set(Embryo_Program *ep, int max); /** - * Retreives the maximum number of abstract machine cycles a program is allowed + * @brief Retreives the maximum number of abstract machine cycles a program is allowed * to run. - * @param ep The given program. + * + * @param[in] ep The given program. * @return The number of cycles a run cycle is allowed to run for this * program. * @@ -857,43 +902,52 @@ EAPI void embryo_program_max_cycle_run_set(Embryo_Program *ep, int m */ EAPI int embryo_program_max_cycle_run_get(Embryo_Program *ep); + +/** + * @internal + * @defgroup Embryo_Parameter_Group Function Parameter Functions + * @ingroup Embryo_Library_Group + * + * Functions that set parameters for the next function that is called. + */ + /** - * Pushes an Embryo_Cell onto the function stack to use as a parameter for + * @brief Pushes an Embryo_Cell onto the function stack to use as a parameter for * the next function that is called in the given program. * @param ep The given program. * @param cell The Embryo_Cell to push onto the stack. * @return @c 1 if successful. @c 0 otherwise. * @ingroup Embryo_Parameter_Group */ - -/** - * @defgroup Embryo_Parameter_Group Function Parameter Functions - * - * Functions that set parameters for the next function that is called. - */ EAPI int embryo_parameter_cell_push(Embryo_Program *ep, Embryo_Cell cell); /** - * Pushes a string onto the function stack to use as a parameter for the + * @brief Pushes a string onto the function stack to use as a parameter for the * next function that is called in the given program. - * @param ep The given program. - * @param str The string to push onto the stack. + * + * @param[in] ep The given program. + * @param[in] str The string to push onto the stack. * @return @c 1 if successful. @c 0 otherwise. * @ingroup Embryo_Parameter_Group */ EAPI int embryo_parameter_string_push(Embryo_Program *ep, const char *str); /** - * Pushes an array of Embryo_Cells onto the function stack to be used as + * @brief Pushes an array of Embryo_Cells onto the function stack to be used as * parameters for the next function that is called in the given program. - * @param ep The given program. - * @param cells The array of Embryo_Cells. - * @param num The number of cells in @p cells. + * + * @param[in] ep The given program. + * @param[in] cells The array of Embryo_Cells. + * @param[in] num The number of cells in @p cells. * @return @c 1 if successful. @c 0 otherwise. * @ingroup Embryo_Parameter_Group */ EAPI int embryo_parameter_cell_array_push(Embryo_Program *ep, Embryo_Cell *cells, int num); +/** + * @} + */ + #ifdef __cplusplus } #endif diff --git a/src/lib/embryo_amx.c b/src/lib/embryo_amx.c index 55423b4..192a685 100644 --- a/src/lib/embryo_amx.c +++ b/src/lib/embryo_amx.c @@ -205,6 +205,8 @@ _embryo_program_init(Embryo_Program *ep, void *code) #endif ep->flags = EMBRYO_FLAG_RELOC; +#ifdef WORDS_BIGENDIAN +/* until we do more... this is only used for bigendian */ { Embryo_Cell cip, code_size, cip_end; Embryo_Cell *code; @@ -220,9 +222,10 @@ _embryo_program_init(Embryo_Program *ep, void *code) #ifdef WORDS_BIGENDIAN embryo_swap_32(&(code[cip])); #endif - } } +#endif + /* init native api for handling floating point - default in embryo */ _embryo_args_init(ep); _embryo_fp_init(ep); diff --git a/src/lib/embryo_str.c b/src/lib/embryo_str.c index 0c2faa2..95163ce 100644 --- a/src/lib/embryo_str.c +++ b/src/lib/embryo_str.c @@ -399,15 +399,18 @@ _embryo_str_snprintf(Embryo_Program *ep, Embryo_Cell *params) int l; STRGET(ep, tmp, params[4 + p]); - l = strlen(tmp); - if ((o + l) > (params[2] - 1)) - { - l = params[2] - 1 - o; - if (l < 0) l = 0; - tmp[l] = 0; - } - strcpy(s2 + o, tmp); - o += l; + if (tmp) + { + l = strlen(tmp); + if ((o + l) > (params[2] - 1)) + { + l = params[2] - 1 - o; + if (l < 0) l = 0; + tmp[l] = 0; + } + strcpy(s2 + o, tmp); + o += l; + } p++; } break; -- 2.7.4