2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) Scilab Enterprises - 2014 - Calixte DENIZET
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
15 #include "api_scilab.h"
17 #include "sci_malloc.h"
19 extern void autoCompletionInConsoleMode(wchar_t ** commandLine, unsigned int *cursorLocation);
21 /*--------------------------------------------------------------------------*/
22 int sci_completecommandline(char *fname, void *pvApiCtx)
26 wchar_t * wstr = NULL;
27 wchar_t * commandLine = MALLOC(sizeof(wchar_t) * 1024);
31 CheckOutputArgument(pvApiCtx, 2, 2);
32 CheckInputArgument(pvApiCtx, 2, 2);
34 err = getVarAddressFromPosition(pvApiCtx, 1, &addr);
35 getAllocatedSingleWideString(pvApiCtx, addr, &wstr);
36 err = getVarAddressFromPosition(pvApiCtx, 2, &addr);
37 getScalarDouble(pvApiCtx, addr, &c);
39 cursor = (unsigned int)c;
41 wcscpy(commandLine, wstr);
42 freeAllocatedSingleWideString(wstr);
44 autoCompletionInConsoleMode(&commandLine, &cursor);
46 createSingleWideString(pvApiCtx, 3, commandLine);
47 createScalarDouble(pvApiCtx, 4, (double)cursor);
51 AssignOutputVariable(pvApiCtx, 1) = 3;
52 AssignOutputVariable(pvApiCtx, 2) = 4;