00001 # This file is Copyright 2003, 2006, 2007, 2009 Dean Hall. 00002 # 00003 # This file is part of the Python-on-a-Chip program. 00004 # Python-on-a-Chip is free software: you can redistribute it and/or modify 00005 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. 00006 # 00007 # Python-on-a-Chip is distributed in the hope that it will be useful, 00008 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00010 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 00011 # is seen in the file COPYING up one directory from this. 00012 00013 # 00014 # Feature Test for Issue #2 00015 # Regression Test for Issue #28 00016 # Separate stdlib from user app 00017 # The test below proves that push42() was called from the usrlib native code 00018 # and assert was called from the stdlib native code. 00019 # 00020 """__NATIVE__ 00021 /* 00022 * This is a regression test for issue #28. 00023 * Having this doc-level native block should not affect 00024 * the index of the native func below. 00025 */ 00026 """ 00027 00028 # 00029 # Pushes the int, 42, onto the stack 00030 # 00031 def push42(): 00032 """__NATIVE__ 00033 pPmObj_t pint = C_NULL; 00034 PmReturn_t retval; 00035 00036 retval = int_new((int32_t)42, &pint); 00037 NATIVE_SET_TOS(pint); 00038 00039 return retval; 00040 """ 00041 pass 00042 00043 foo = push42() 00044 bar = 6 * 7 00045 assert foo == bar