Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <oct.h>
00016 #include <stdio.h>
00017 #include <stdlib.h>
00018 #include "grpc.h"
00019 #include "gs_oct.h"
00020
00021
00022 DEFUN_DLD (gs_probe, args, nargout, "Octave client for GridSolve") {
00023 octave_value_list bad_retval;
00024 grpc_error_t status;
00025 grpc_sessionid_t req_id;
00026
00027
00028
00029
00030 for (int i = 0; i < nargout; i++) {
00031 bad_retval(i) = Matrix(0, 0);
00032 }
00033
00034
00035 int nargin = args.length();
00036
00037
00038 if (nargin <= 0) {
00039 fprintf(stderr, "No input service name found. Aborted.\n");
00040 return bad_retval;
00041 }
00042
00043 if (nargin > 1) {
00044 fprintf(stderr, "Exactly one argument (session id) is expected. Aborted.\n");
00045 return bad_retval;
00046 }
00047
00048
00049
00050
00051 status = grpc_initialize(NULL);
00052 if (status != GRPC_NO_ERROR && status != GRPC_ALREADY_INITIALIZED) {
00053 fprintf(stderr, "%s\n", grpc_error_string(status));
00054 return bad_retval;
00055 }
00056
00057
00058 req_id = args(0).int_value();
00059
00060 status = grpc_probe(req_id);
00061
00062 if (status == GRPC_NOT_COMPLETED) {
00063 printf("Job has not completed.\n");
00064 }
00065 else if (status == GRPC_NO_ERROR) {
00066 printf("Job has completed.\n");
00067 } else {
00068 fprintf(stderr, "Error in probing.\n");
00069 return bad_retval;
00070 }
00071
00072 return octave_value(status);
00073 }
00074
00075
00076
00077
00078