00001 /* 00002 * This file is part of liberscribble. 00003 * 00004 * liberscribble is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * liberscribble is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00023 #include "scbpoint.h" 00024 #include "scbtype.h" 00025 #include "scblog.h" 00026 #include <stdio.h> 00027 00028 /* 00029 The following two function are used by xml storage, they are replaced by 00030 function in ScbStroke 00031 int scb_point_read(ScbPointPtr p, const char * buf, const int length) 00032 { 00033 if (NULL == p) 00034 { 00035 SCB_ERROR("Invalid pointer!"); 00036 return SCB_RET_ERR; 00037 } 00038 00039 if (NULL == buf || 0 >= length) 00040 { 00041 SCB_ERROR("Invalid buffer pointer or length"); 00042 return SCB_RET_ERR; 00043 } 00044 00045 // in fact, we should check the fields returned 00046 scanf(buf, length, "%d %d %d", &p->x, &p->y, &p->pressure); 00047 return SCB_RET_OK; 00048 } 00049 00050 int scb_point_write(const ScbPointPtr p, char * buf, const int length) 00051 { 00052 if (NULL == p) 00053 { 00054 SCB_ERROR("Invalid point pointer!"); 00055 return SCB_RET_ERR; 00056 } 00057 00058 if (NULL == buf || 0 >= length) 00059 { 00060 SCB_ERROR("Invalid buffer pointer or length"); 00061 return SCB_RET_ERR; 00062 } 00063 00064 snprintf(buf, length, "%d %d %d\n", p->x, p->y, p->pressure); 00065 return SCB_RET_OK; 00066 } 00067 */ 00068 00069 00070 void scb_point_dump(const ScbPointPtr p) 00071 { 00072 SCB_RET_IF(p == NULL, "NULL pointer!"); 00073 SCB_DUMP("(%d, %d)", p->x, p->y); 00074 }
1.5.6