PageRenderTime 50ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/matlab_tools/Converted/kkdarwin.m

http://github.com/aludnam/MATLAB
Objective C | 525 lines | 522 code | 3 blank | 0 comment | 75 complexity | 87e3e272c5ca3be039af221775c627a5 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. %kkdarwin 'A program to evolve Khoros 1.0 programs to Khoros 2 objects'
  2. % This MatLab function was automatically generated by a converter (KhorosToMatLab) from the Khoros kdarwin.pane file
  3. %
  4. % Parameters:
  5. % String: tb 'Toolbox', default: ' ': 'Toolbox object to hold the new software object'
  6. % String: oname 'Object Name', default: ' ': 'Software object name to use the for the converted vroutine'
  7. % String: lname 'Library Name', default: ' ': 'Library object to put the vroutine l*.c file into'
  8. % String: cat 'Category', default: ' ': 'Category Name used in Cantata'
  9. % String: subcat 'Subcategory', default: ' ': 'Subcategory Name used in Cantata'
  10. % String: description 'Description', default: ' ': 'The short description of the object'
  11. % String: icon 'Icon Name', default: ' ': 'Icon Name used for glyph in Cantata'
  12. % InputFile: prog 'Prog Filename', optional: 'Khoros 1.0 Prog filename to get program code and documentation information from'
  13. % InputFile: pane 'Pane Filename', optional: 'Khoros 1.0 Pane Filename to get program uis information from'
  14. % InputFile: conf 'Conf Filename', optional: 'Khoros 1.0 conf filename to use to get paths for *.pane and *.prog'
  15. %
  16. % Example: kkdarwin({prog, pane, conf}, {'tb',' ';'oname',' ';'lname',' ';'cat',' ';'subcat',' ';'description',' ';'icon',' ';'prog','';'pane','';'conf',''})
  17. %
  18. % Khoros helpfile follows below:
  19. %
  20. % PROGRAM
  21. % kdarwin - A program to evolve Khoros 1.0 programs to Khoros 2 objects
  22. %
  23. % DESCRIPTION
  24. % This program converts a Khoros 1.0 vroutine into a Khoros 2 kroutine object. It does
  25. % about 70%
  26. % of the work required to bring an old Khoros 1.0 vroutine program into the new
  27. % object-based software development system in Khoros 2; some function calls,
  28. % however, you will have to edit and correct yourself.
  29. % This program integrates all of the migration tools plus the Program
  30. % Specification parsing code from 1.0 into a single program. The steps it
  31. % follows while converting a program are:
  32. %
  33. % 1. 4
  34. % Create a new kroutine software object in the specified toolbox under the
  35. % specified object name. Uses the object name for the icon name if [-icon] was
  36. % not specified.
  37. %
  38. % 2. 4
  39. % Parse the *.prog file for the vroutine's code and documentation sections.
  40. %
  41. % 3. 4
  42. % Call "uisupdate" to convert the *.pane file specified to be Khoros 2
  43. % compatible.
  44. %
  45. % 4. 4
  46. % Call "kfixpane" to modify the Khoros 2 UIS file output by
  47. % "uisupdate" so that the pane will
  48. % be compliant with the Khoros 2 GUI conventions. This includes updating the
  49. % short description of the pane (uses the program short description if [-idesc]
  50. % was not specified), modifying the -R line to hold the fullpath to the binary,
  51. % and changing the -H line to point to the new help directory.
  52. %
  53. % 5. 4
  54. % Update the code and documentation files of the new kroutine with the sections
  55. % from Khoros 1.0 *.prog file. This includes updating the use of the CLUI
  56. % Information structure to the new name, "clui_info"
  57. % which is the name used under Khoros 2. It also inserts code in the
  58. % appropriate sections to set a variable called "program" in the main which
  59. % used to be automatically defined in Khoros 1.0.
  60. %
  61. % 6. 4
  62. % Call "kfix" on the l"oname\fP.c, \fIoname\fP.c, and \fIoname\fP.h to
  63. % convert the Khoros 1.0 and non POSIX library calls to Khoros 2 library calls.
  64. %
  65. % 7. 4
  66. % Call "mkproto" to get the ANSI prototype of the l"oname\fP routine,
  67. % and insert it into "loname".h public include file.
  68. %
  69. % 8. 4
  70. % Attempt to run the gnu utility protoize to convert the l"oname".c file
  71. % from K & R C code into ANSI C code. Note, this usually doesn't work the first
  72. % time, and may not ever work if you do not use the GNU gcc compiler for
  73. % your compiles. However, usually changing your code from K & R to ANSI is
  74. % just a matter a changing the declaration.
  75. %
  76. % Though this program does most of the work necessary to convert a 1.0 vroutine
  77. % into a working kroutine under Khoros 2, several steps must be taken by the
  78. % user to finish the conversion. The code, the documentation, and the uis file
  79. % of the new object will have to be checked for problems in formatting and
  80. % checked for sections the migration tools could not handle. The following
  81. % is a list of things that will have to be dealt with by hand after running
  82. % kdarwin.
  83. %
  84. % 1. 4
  85. % The man 3 sections of the Khoros 1.0 program specification will be put into
  86. % their appropriate section of the routine header in the l"oname".c file.
  87. % However, all the roff formatting macros will still be there. So these macros
  88. % must be removed, and the text should be reformatted to look like a proper
  89. % Khoros 2 public routine header.
  90. %
  91. % 2. 4
  92. % All files that were "kfix"'ed need to be checked for any sets of four
  93. % # characters in a row. This sign followed by some text indicates that kfix
  94. % knows the line needs a change, but is not sure how to accomplish the change.
  95. % Since "kfix" uses sed to match sections of code, the more complicated C
  96. % syntax means that it cannot always figure out how to make a change. For
  97. % example, C function calls that span multiple lines can some times result in this
  98. % type of error. Also, if a call to a function is used as a parameter in
  99. % another function call and one or both of those function calls must change,
  100. % .script index kfix
  101. % usually cannot figure which parameters belong with each function call.
  102. % In such a case, you will need to change the code to the correct call, and
  103. % rearrange the parameters according to the man page. Use "kman"
  104. % to find the appropriate format for the call to the Khoros 2 function.
  105. %
  106. % 3. 4
  107. % In Khoros 1.0 many programs declared external routines that they called in side
  108. % the variable declaration section of a routine. This practice is bad under ANSI
  109. % C because the extra declaration is made without the correct prototype causing
  110. % the correct prototype to be overridden. So, all of these declarations should be
  111. % removed.
  112. %
  113. % 4. 4
  114. % Khoros 2 depends on ANSI compliance, so any routines converted
  115. % must use the ANSI declaration format instead of the K & R one. "kdarwin"
  116. % calls the GNU program "protoize", if it exists, to automate this process.
  117. % However, this process usually fails due to syntax errors in the code it is
  118. % trying to convert. If protoize does fail, it will inform you, and give you the
  119. % proper command to run protoize on the library source code file again. You
  120. % will first have to correct the syntax errors in the file before you can
  121. % run protoize again.
  122. %
  123. % 5. 4
  124. % Finally, the Khoros 1.0 calls to manipulate the xvimage (1.0 VIFF) structure
  125. % have been ported to 2 and put in the RETRO toolbox in the "vutils" and
  126. % "verror" library objects. So, in order to get the library calls
  127. % "creatimage", \fIreadimage\fP, and \fIwriteimage\fP, the toolbox that
  128. % holds your converted programs will need to include the RETRO public include
  129. % file, and link against the libraries "vipl, verror", and \fHvutils\fP
  130. % in RETRO. See the Toolbox Programming Manual for instructions on how to
  131. % makeone toolbox dependent on another.
  132. %
  133. % Note that "readimage" has been rewritten
  134. % in 2 to read all data types supported by data services, and forces the
  135. % data and attributes into an xvimage structure. This fact implies that these
  136. % programs can manipulate data as in 1.0. However, it also means that you
  137. % lose the benefits that data services provides, like large data set handling,
  138. % polymorphic data model, and data propagation. Also, you can lose data if
  139. % the original format has extra data that does not map nicely into the
  140. % Khoros 1.0 VIFF structure. The Khoros 2 KDF is such a case, because it
  141. % is capable of hold 5D data and it can contain extra data segments.
  142. % The final limitation is that "writeimage" always outputs the Khoros 1.0
  143. % VIFF or xvimage data format.
  144. %
  145. % We encourage you to use "kdarwin"
  146. % to quickly move your contributed routines into the Khoros 2 environment;
  147. % however, it would be best if you follow this quick conversion with a proper
  148. % re-implementation of the operators using Data Services and one of the
  149. % available Application Services.
  150. %
  151. %
  152. %
  153. % EXAMPLES
  154. % Assume that you want to convert the Khoros 1.0 vroutine vspatial to Khoros 2,
  155. % and place it in the Khoros 2 toolbox MYTB. Also assume you want to convert
  156. % the l*.c file to a library object called my_ipl and that your Khoros 1.0
  157. % source tree is located in /usr/khoros. The following command tells
  158. % "kdarwin"
  159. % to do this. Note that the library "my_ipl" must exist \fBBEFORE\fP you run
  160. % "kdarwin". Use \fHcraftsman\fP to create this library object.
  161. % \s-1
  162. % \f(CW
  163. %
  164. % % kdarwin -tb mytb -oname vspatial -lname my_ipl -cat "Image Proc"
  165. % -subcat "Classification (K1)" -icon "Spatial Analysis"
  166. % -description "Compute Spatial Feature Operators (NxM Window)"
  167. % -prog /usr/khoros/src/vipl/feature/vspatial/vspatial.prog
  168. % -pane /usr/khoros/repos/cantata/subforms/feature/vspatial.pane
  169. %
  170. % "
  171. % \s+1
  172. %
  173. % The output from "kdarwin" will be as follows:
  174. % \s-1
  175. % \f(CW
  176. %
  177. % kdarwin: updating object database [MYTB::my_ipl]
  178. % kdarwin: Generating Imakefile & Makefile in src
  179. % kdarwin: Generating directory Imakefile & Makefile
  180. % kdarwin: updating object database [MYTB::my_ipl]
  181. % kdarwin: Generating Imakefile & Makefile in src
  182. % kdarwin: Generating directory Imakefile & Makefile
  183. % Generating empty ghostwriter files
  184. % kdarwin: done generating vspatial man page
  185. % kdarwin: done generating vspatial.h
  186. % kdarwin: done generating vspatial.c
  187. % kdarwin: done generating usage.c
  188. % kdarwin: done generating lvspatial.c
  189. % kdarwin: done generating vspatial help page
  190. % Get PROG information
  191. % Update UIS file to 2 format
  192. % Update UIS to comply with cantata standard format
  193. % Regenerate command line UIS code
  194. % kdarwin: done generating vspatial man page
  195. % kdarwin: done generating vspatial.h
  196. % kdarwin: done generating vspatial.c
  197. % kdarwin: done generating usage.c
  198. % kdarwin: done generating lvspatial.c
  199. % kdarwin: done generating vspatial help page
  200. % Update sections of object from prog spec
  201. % -- Convert 'vspatial->' to 'clui_info->' in prog sections
  202. % -- Update the program related prog sections
  203. % -- Update the library related prog sections
  204. % Run kfix lvspatial.c
  205. % "Toolbox: MIGRATION
  206. % Program: kdarwin
  207. % Protoize of 'lvspatial.c' failed. This implies that the code still will not
  208. % compile because of some cases that the automatic update routines cannot handle.
  209. % You must fix these problems, and re-run protoize by hand. This can be
  210. % accomplished by cd'ing to the src directory for the library that contains
  211. % \'lvspatial.c\', and typing:
  212. %
  213. % protoize -c "-fstrength-reduce -fpcc-struct-return -fwritable-strings -ansi
  214. % -I/research/devel/mirage/work/mytb/include -I/research/devel/mirage/khoros/include
  215. % -I/research/devel/mirage/retro/include -I/usr/local/motif/include -D__sun
  216. % -D_POSIX_SOURCE" $MYTB/objects/library/my_ipl/src/lvspatial.c
  217. % Keep fixing problems and reprotoizing until it produces a lvspatial.c.sav file.
  218. % Update the man page database for the library
  219. % kdarwin: Finished Generating a man page for the function \'lvspatial\' in
  220. % \'$MYTB/objects/library/my_ipl/man/lvspatial\'"
  221. % kdarwin: done generating my_ipl library headers
  222. % kdarwin: done generating my_ipl man page
  223. % Run kfix vspatial.c
  224. % Run kfix vspatial.h
  225. % kdarwin: done generating vspatial man page
  226. % kdarwin: done generating vspatial.h
  227. % kdarwin: done generating vspatial.c
  228. % kdarwin: done generating usage.c
  229. % kdarwin: done generating lvspatial.c
  230. % kdarwin: done generating vspatial help page
  231. % kdarwin: updating object database [MYTB::vspatial]
  232. % kdarwin: Generating Imakefile & Makefile in src
  233. %
  234. % "
  235. % \s+1
  236. %
  237. % This initially converts the routine. After you have fixed the syntax
  238. % problems and prototypes as indicated above in the above example, you can
  239. % compile this program. Note that in order to compile, you need to make you're
  240. % toolbox dependent on the RETRO toolbox. This only needs to be done once,
  241. % and the resulting mytb.def file should look similar to the following one. The
  242. % path to the retro toolbox will differ as per your specific site's installation.
  243. % Note that the order on the TOOLBOX_LIBRARIES line for the retro libraries
  244. % is important. Also, libraries that exist within mytb should be
  245. % listed \fBBEFORE" the retro libraries.
  246. % \s-1
  247. % \f(CW
  248. %
  249. % % cat `kecho -echo path -tb mytb`/repos/config/imake_conf/mytb.def
  250. % #ifndef _mytb_def_
  251. % #define _mytb_def_
  252. % KCOM toolbox.def
  253. % KCOM toolbox configuration file for toolbox "mytb"
  254. %
  255. % /*
  256. % * #include <TOOLBOX>_INCLUDE - specify toolboxes this toolbox depends on.
  257. % *
  258. % * The following list are the toolboxes that the cplustest toolbox
  259. % * directly depends on. The order of this list is important, because it
  260. % * tells the imake system the order for include and library paths.
  261. % *
  262. % * For example:
  263. % *
  264. % * #include BOOTSTRAP_INCLUDE
  265. % *
  266. % * includes the bootstrap toolbox.
  267. % */
  268. %
  269. % /* -toolbox_include_toolboxes */
  270. % "#include RETRO_INCLUDE" /* add this line */
  271. % #include DESIGN_INCLUDE
  272. % /* -toolbox_include_toolboxes_end */
  273. %
  274. %
  275. % /*
  276. % * TOOLBOX_INCLUDE - extend search path for include files
  277. % *
  278. % * The +<= variable syntax prepends the toolbox include path to the variable
  279. % * TOOLBOX_INCLUDE. If TOOLBOX_INCLUDE was previously undefined, it will
  280. % * just set it to the -I path below. This is necessary so that the toolbox
  281. % * include directory is included in the compile commands.
  282. % */
  283. %
  284. % /* -toolbox_include_path */
  285. % TOOLBOX_INCLUDE +<= -I$(MYTB_PATH)/include
  286. % /* -toolbox_include_path_end */
  287. %
  288. %
  289. % /*
  290. % * TOOLBOX_LIBDIR - extend search path for libraries
  291. % *
  292. % * The +<= variable syntax prepends the toolbox library path to the variable
  293. % * TOOLBOX_LIBDIR. If TOOLBOX_LIBDIR was previously undefined, it will
  294. % * just set it to the -L path below. This is necessary so that the toolbox
  295. % * library directory is included in the link command.
  296. % */
  297. %
  298. % /* -toolbox_library_path */
  299. % TOOLBOX_LIBDIR +<= -L$(MYTB_LIBDIR)
  300. % /* -toolbox_library_path_end */
  301. %
  302. % /*
  303. % * TOOLBOX_DEFINES - optional symbols for additional preprocessor definitions
  304. % *
  305. % * The +<= variable syntax prepends the toolbox defines to the variable
  306. % * TOOLBOX_DEFINES. If TOOLBOX_DEFINES was previously undefined, it will
  307. % * just set it to the value below. This is necessary so that the toolbox
  308. % * defines is included in the compile and link commands.
  309. % */
  310. %
  311. % /* -toolbox_cpp_defines */
  312. % TOOLBOX_DEFINES +<= /**/
  313. % /* -toolbox_cpp_defines_end */
  314. %
  315. %
  316. % /*
  317. % * Addlibrary(lname, type) - macro to add library to load line for toolbox
  318. % *
  319. % * The following list are the libraries that the cplustest toolbox
  320. % * depends on. This list must be in reverse order. The AddLibrary macro
  321. % * takes two parameters. The first is the library archive name, and the
  322. % * second is one of C, FOR, or X. Note, different library types will
  323. % * automatically be ordered correctly.
  324. % *
  325. % * For example, suppose this toolbox has three libraries: two C libraries named
  326. % * libfred.a and libwilma.a and one X library named libxdino.a. If the fred
  327. % * library depends on the wilma library, then you would use following
  328. % * AddLibrary lines:
  329. % *
  330. % * AddLibrary(wilma, C, $(MYTB_LIBDIR))
  331. % * AddLibrary(fred, C, $(MYTB_LIBDIR))
  332. % * AddLibrary(xdino, X, $(MYTB_LIBDIR))
  333. % *
  334. % * Note, the placement of xdino could have been anywhere, because it is
  335. % * of a different type than fred and wilma.
  336. % */
  337. %
  338. % /* -toolbox_libraries */
  339. % /* -toolbox_libraries_end */
  340. %
  341. % /*
  342. % * BINDIR - where to install binaries
  343. % * LIBDIR - where to install libraries
  344. % * KLD_RUN_PATH - used on systems with shared libraries to define the
  345. % * path to the directory where the libraries are.
  346. % *
  347. % * Define the directories where the program binaries will be installed and
  348. % * where the library archive files will be installed.
  349. % */
  350. %
  351. % BINDIR = $(MYTB_BINDIR)
  352. % LIBDIR = $(MYTB_LIBDIR)
  353. % KLD_RUN_PATH +<:= $(MYTB_LIBDIR)
  354. %
  355. % #endif /* _mytb_def_ */
  356. % /* Don't add after this point */
  357. %
  358. % %
  359. %
  360. % "
  361. % \s+1
  362. %
  363. % "SEE ALSO"
  364. % ghostwriter(1), kfix(1), kfixpane(1), mkproto(1), uisupdate(1), protoize(1)
  365. %
  366. % RESTRICTIONS
  367. % This program was specifically designed to convert from vroutines to kroutines,
  368. % so using it on any other program type will produce strange results.
  369. %
  370. % REFERENCES
  371. % Migration Toolbox Manual, Toolbox Programming Manual
  372. %
  373. % COPYRIGHT
  374. % Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.
  375. %
  376. function varargout = kkdarwin(varargin)
  377. if nargin ==0
  378. Inputs={};arglist={'',''};
  379. elseif nargin ==1
  380. Inputs=varargin{1};arglist={'',''};
  381. elseif nargin ==2
  382. Inputs=varargin{1}; arglist=varargin{2};
  383. else error('Usage: [out1,..] = kkdarwin(Inputs,arglist).');
  384. end
  385. if size(arglist,2)~=2
  386. error('arglist must be of form {''ParameterTag1'',value1;''ParameterTag2'',value2}')
  387. end
  388. narglist={'tb', ' ';'oname', ' ';'lname', ' ';'cat', ' ';'subcat', ' ';'description', ' ';'icon', ' ';'prog', '__input';'pane', '__input';'conf', '__input'};
  389. maxval={0,0,0,0,0,0,0,1,1,1};
  390. minval={0,0,0,0,0,0,0,1,1,1};
  391. istoggle=[0,0,1,0,0,0,0,1,1,1];
  392. was_set=istoggle * 0;
  393. paramtype={'String','String','String','String','String','String','String','InputFile','InputFile','InputFile'};
  394. % identify the input arrays and assign them to the arguments as stated by the user
  395. if ~iscell(Inputs)
  396. Inputs = {Inputs};
  397. end
  398. NumReqOutputs=0; nextinput=1; nextoutput=1;
  399. for ii=1:size(arglist,1)
  400. wasmatched=0;
  401. for jj=1:size(narglist,1)
  402. if strcmp(arglist{ii,1},narglist{jj,1}) % a given argument was matched to the possible arguments
  403. wasmatched = 1;
  404. was_set(jj) = 1;
  405. if strcmp(narglist{jj,2}, '__input')
  406. if (nextinput > length(Inputs))
  407. error(['Input ' narglist{jj,1} ' has no corresponding input!']);
  408. end
  409. narglist{jj,2} = 'OK_in';
  410. nextinput = nextinput + 1;
  411. elseif strcmp(narglist{jj,2}, '__output')
  412. if (nextoutput > nargout)
  413. error(['Output nr. ' narglist{jj,1} ' is not present in the assignment list of outputs !']);
  414. end
  415. if (isempty(arglist{ii,2}))
  416. narglist{jj,2} = 'OK_out';
  417. else
  418. narglist{jj,2} = arglist{ii,2};
  419. end
  420. nextoutput = nextoutput + 1;
  421. if (minval{jj} == 0)
  422. NumReqOutputs = NumReqOutputs - 1;
  423. end
  424. elseif isstr(arglist{ii,2})
  425. narglist{jj,2} = arglist{ii,2};
  426. else
  427. if strcmp(paramtype{jj}, 'Integer') & (round(arglist{ii,2}) ~= arglist{ii,2})
  428. error(['Argument ' arglist{ii,1} ' is of integer type but non-integer number ' arglist{ii,2} ' was supplied']);
  429. end
  430. if (minval{jj} ~= 0 | maxval{jj} ~= 0)
  431. if (minval{jj} == 1 & maxval{jj} == 1 & arglist{ii,2} < 0)
  432. error(['Argument ' arglist{ii,1} ' must be bigger or equal to zero!']);
  433. elseif (minval{jj} == -1 & maxval{jj} == -1 & arglist{ii,2} > 0)
  434. error(['Argument ' arglist{ii,1} ' must be smaller or equal to zero!']);
  435. elseif (minval{jj} == 2 & maxval{jj} == 2 & arglist{ii,2} <= 0)
  436. error(['Argument ' arglist{ii,1} ' must be bigger than zero!']);
  437. elseif (minval{jj} == -2 & maxval{jj} == -2 & arglist{ii,2} >= 0)
  438. error(['Argument ' arglist{ii,1} ' must be smaller than zero!']);
  439. elseif (minval{jj} ~= maxval{jj} & arglist{ii,2} < minval{jj})
  440. error(['Argument ' arglist{ii,1} ' must be bigger than ' num2str(minval{jj})]);
  441. elseif (minval{jj} ~= maxval{jj} & arglist{ii,2} > maxval{jj})
  442. error(['Argument ' arglist{ii,1} ' must be smaller than ' num2str(maxval{jj})]);
  443. end
  444. end
  445. end
  446. if ~strcmp(narglist{jj,2},'OK_out') & ~strcmp(narglist{jj,2},'OK_in')
  447. narglist{jj,2} = arglist{ii,2};
  448. end
  449. end
  450. end
  451. if (wasmatched == 0 & ~strcmp(arglist{ii,1},''))
  452. error(['Argument ' arglist{ii,1} ' is not a valid argument for this function']);
  453. end
  454. end
  455. % match the remaining inputs/outputs to the unused arguments and test for missing required inputs
  456. for jj=1:size(narglist,1)
  457. if strcmp(paramtype{jj}, 'Toggle')
  458. if (narglist{jj,2} ==0)
  459. narglist{jj,1} = '';
  460. end;
  461. narglist{jj,2} = '';
  462. end;
  463. if ~strcmp(narglist{jj,2},'__input') && ~strcmp(narglist{jj,2},'__output') && istoggle(jj) && ~ was_set(jj)
  464. narglist{jj,1} = '';
  465. narglist{jj,2} = '';
  466. end;
  467. if strcmp(narglist{jj,2}, '__input')
  468. if (minval{jj} == 0) % meaning this input is required
  469. if (nextinput > size(Inputs))
  470. error(['Required input ' narglist{jj,1} ' has no corresponding input in the list!']);
  471. else
  472. narglist{jj,2} = 'OK_in';
  473. nextinput = nextinput + 1;
  474. end
  475. else % this is an optional input
  476. if (nextinput <= length(Inputs))
  477. narglist{jj,2} = 'OK_in';
  478. nextinput = nextinput + 1;
  479. else
  480. narglist{jj,1} = '';
  481. narglist{jj,2} = '';
  482. end;
  483. end;
  484. else
  485. if strcmp(narglist{jj,2}, '__output')
  486. if (minval{jj} == 0) % this is a required output
  487. if (nextoutput > nargout & nargout > 1)
  488. error(['Required output ' narglist{jj,1} ' is not stated in the assignment list!']);
  489. else
  490. narglist{jj,2} = 'OK_out';
  491. nextoutput = nextoutput + 1;
  492. NumReqOutputs = NumReqOutputs-1;
  493. end
  494. else % this is an optional output
  495. if (nargout - nextoutput >= NumReqOutputs)
  496. narglist{jj,2} = 'OK_out';
  497. nextoutput = nextoutput + 1;
  498. else
  499. narglist{jj,1} = '';
  500. narglist{jj,2} = '';
  501. end;
  502. end
  503. end
  504. end
  505. end
  506. if nargout
  507. varargout = cell(1,nargout);
  508. else
  509. varargout = cell(0);
  510. end
  511. global KhorosRoot
  512. if exist('KhorosRoot') && ~isempty(KhorosRoot)
  513. w=['"' KhorosRoot];
  514. else
  515. if ispc
  516. w='"C:\Program Files\dip\khorosBin\';
  517. else
  518. [s,w] = system('which cantata');
  519. w=['"' w(1:end-8)];
  520. end
  521. end
  522. callKhoros([w 'kdarwin" '],Inputs,narglist);