1 /*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2004-2006 - INRIA - Fabrice Leray
4 * Copyright (C) 2006 - INRIA - Allan Cornet
5 * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
6 * Copyright (C) 2010 - DIGITEO - Manuel Juliachs
7 * Copyright (C) 2011 - DIGITEO - Vincent Couvert
8 *
9 * Copyright (C) 2012 - 2016 - Scilab Enterprises
10 *
11 * This file is hereby licensed under the terms of the GNU GPL v2.0,
12 * pursuant to article 5.3.4 of the CeCILL v.2.1.
13 * This file was originally licensed under the terms of the CeCILL v2.1,
14 * and continues to be available under such terms.
15 * For more information, see the COPYING file which you should have received
16 * along with this program.
17 *
18 */
19
20 /*------------------------------------------------------------------------*/
21 /* file: get_log_flags_property.c */
22 /* desc : function to retrieve in Scilab the log_flags field of */
23 /* a handle */
24 /*------------------------------------------------------------------------*/
25
26 #include "getHandleProperty.h"
27 #include "returnProperty.h"
28 #include "Scierror.h"
29 #include "localization.h"
30
31 #include "getGraphicObjectProperty.h"
32 #include "graphicObjectProperties.h"
33
34 /*------------------------------------------------------------------------*/
get_log_flags_property(void * _pvCtx,int iObjUID)35 void* get_log_flags_property(void* _pvCtx, int iObjUID)
36 {
37 int i = 0;
38 int iLogFlag = 0;
39 int* piLogFlag = &iLogFlag;
40 int logFlags[3];
41 char logFlagsString[4];
42
43 getGraphicObjectProperty(iObjUID, __GO_X_AXIS_LOG_FLAG__, jni_bool, (void **)&piLogFlag);
44
45 if (piLogFlag == NULL)
46 {
47 Scierror(999, _("'%s' property does not exist for this handle.\n"), "log_flag");
48 return NULL;
49 }
50
51 logFlags[0] = iLogFlag;
52
53 getGraphicObjectProperty(iObjUID, __GO_Y_AXIS_LOG_FLAG__, jni_bool, (void **)&piLogFlag);
54 if (piLogFlag == NULL)
55 {
56 Scierror(999, _("'%s' property does not exist for this handle.\n"), "log_flag");
57 return NULL;
58 }
59
60 logFlags[1] = iLogFlag;
61
62 getGraphicObjectProperty(iObjUID, __GO_Z_AXIS_LOG_FLAG__, jni_bool, (void **)&piLogFlag);
63 if (piLogFlag == NULL)
64 {
65 Scierror(999, _("'%s' property does not exist for this handle.\n"), "log_flag");
66 return NULL;
67 }
68
69 logFlags[2] = iLogFlag;
70
71 for (i = 0; i < 3; i++)
72 {
73 if (logFlags[i] == 0)
74 {
75 logFlagsString[i] = 'n';
76 }
77 else
78 {
79 logFlagsString[i] = 'l';
80 }
81 }
82
83 /* 0 terminating character */
84 logFlagsString[3] = 0;
85 return sciReturnString(logFlagsString);
86 }
87 /*------------------------------------------------------------------------*/
88