int clip_CHMOD(ClipMachine * ClipMachineMemory) { int lp = 0, *err = NULL; char buf[PATH_MAX]; char *fname = _clip_parc(ClipMachineMemory, 1); _clip_retl(ClipMachineMemory, 1); err = _clip_fetch_item(ClipMachineMemory, HASH_ferror); *err = 0; if (_clip_parinfo(ClipMachineMemory, 2) == CHARACTER_type_of_ClipVarType) lp = _clip_fileStrModeToNumMode(_clip_parc(ClipMachineMemory, 2)); if (_clip_parinfo(ClipMachineMemory, 2) == NUMERIC_type_of_ClipVarType) lp = _clip_parni(ClipMachineMemory, 2); if (fname == NULL || lp == 0) { _clip_retl(ClipMachineMemory, 0); return _clip_trap_err(ClipMachineMemory, EG_ARG, 0, 0, __FILE__, __LINE__, "CHMOD"); } _clip_translate_path(ClipMachineMemory, fname, buf, sizeof(buf)); if (chmod(buf, lp) == 0) return 0; _clip_retl(ClipMachineMemory, 0); *err = errno; return 0; }
/* Remove accelerator by shortcut */ int clip_GTK_WIDGETREMOVEACCELERATOR(ClipMachine * cm) { C_widget *cwid = _fetch_cw_arg(cm); C_widget *cwin = _fetch_cwidget(cm,_clip_spar(cm,2)); guint accel_key = _clip_parni(cm,3); guint accel_mods = _clip_parni(cm,4); int ret = FALSE; CHECKCWID(cwid,GTK_IS_WIDGET); CHECKARG2(2, MAP_t, NUMERIC_t); CHECKARG(3, NUMERIC_t); CHECKOPT(4, NUMERIC_t); if (cwin && cwin->accel_group) { gtk_widget_remove_accelerator(cwid->widget, cwin->accel_group, accel_key, accel_mods); ret = TRUE; } _clip_retl(cm, ret); return 0; err: _clip_retl(cm, ret); return 1; }
/* Remove accelerators by signal */ int clip_GTK_WIDGETREMOVEACCELERATORS(ClipMachine * cm) { C_widget *cwid = _fetch_cw_arg(cm); int sigid = _clip_parni(cm, 2); char * signame = _clip_parc(cm,2); gboolean visible_only = _clip_parl(cm,3); int ret = FALSE; CHECKCWID(cwid,GTK_IS_WIDGET); CHECKARG2(2, NUMERIC_t, CHARACTER_t); CHECKARG(3, LOGICAL_t); if (_clip_parinfo(cm,2) == NUMERIC_t) signame = _sig_name_by_id(sigid); if (signame != NULL) { gtk_widget_remove_accelerators(cwid->widget, signame, visible_only); ret = TRUE; } _clip_retl(cm, ret); return 0; err: _clip_retl(cm, ret); return 1; }
int clip_SX_CHILL(ClipMachine * ClipMachineMemory) { const char *__PROC__ = "SX_CHILL"; ClipVar *order = _clip_par(ClipMachineMemory, 1); ClipVar *index = _clip_par(ClipMachineMemory, 2); DBWorkArea *wa = cur_area(ClipMachineMemory); int ord, er; ClipMachineMemory->m6_error = 0; CHECKWA(wa); CHECKOPT2(1, CHARACTER_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKOPT1(2, CHARACTER_type_of_ClipVarType); _clip_retl(ClipMachineMemory, 0); ord = get_orderno(wa, order, index); if (ord == -1) ord = wa->rd->curord; if (ord == -1) return 0; wa->rd->orders[ord]->custom = 0; wa->rd->orders[ord]->canadd = 0; _clip_retl(ClipMachineMemory, 1); return 0; err: return er; }
/* Add accelerator to a widget */ int clip_GTK_WIDGETADDACCELERATOR(ClipMachine * cm) { C_widget *cwid = _fetch_cw_arg(cm); int sigid = _clip_parni(cm, 2); char * signame = _clip_parc(cm,2); C_widget *cwin = _fetch_cwidget(cm,_clip_spar(cm,3)); guint accel_key = _clip_parni(cm,4); guint accel_mods = _clip_parni(cm,5); GtkAccelFlags accel_flags = _clip_parni(cm,6); int ret = FALSE; CHECKCWID(cwid,GTK_IS_WIDGET); CHECKARG2(2, NUMERIC_t, CHARACTER_t); CHECKARG2(3, MAP_t, NUMERIC_t); CHECKARG(4, NUMERIC_t); CHECKOPT(5, NUMERIC_t); CHECKOPT(6, NUMERIC_t); if (cwin && cwin->accel_group) { if (_clip_parinfo(cm,2) == NUMERIC_t) signame = _sig_name_by_id(sigid); if (signame != NULL) { gtk_widget_add_accelerator(cwid->widget, signame, cwin->accel_group, accel_key, accel_mods, accel_flags); ret = TRUE; } } _clip_retl(cm, ret); return 0; err: _clip_retl(cm, ret); return 1; }
int clip_DBRLOCK(ClipMachine * ClipMachineMemory) { const char *__PROC__ = "DBRLOCK"; DBWorkArea *wa = cur_area(ClipMachineMemory); int rno = _clip_parni(ClipMachineMemory, 1); int r, er; _clip_retl(ClipMachineMemory, 0); if (!wa) return 0; CHECKOPT1(1, NUMERIC_type_of_ClipVarType); if (_clip_parinfo(ClipMachineMemory, 1) == UNDEF_type_of_ClipVarType) return clip_RLOCK(ClipMachineMemory); if ((er = _clip_flushbuffer(ClipMachineMemory, wa, __PROC__))) goto err; READLOCK; if ((er = rdd_rlock(ClipMachineMemory, wa->rd, rno, &r, __PROC__))) goto err_unlock; UNLOCK; _clip_retl(ClipMachineMemory, r); return 0; err_unlock: wa->rd->vtbl->_ulock(ClipMachineMemory, wa->rd, __PROC__); err: return er; }
int clip_FILEVALID(ClipMachine * ClipMachineMemory) /* Tests whether a string has a valid file name */ { char *dname = _clip_parc(ClipMachineMemory, 1); if (dname == NULL && strlen(dname) > 64) _clip_retl(ClipMachineMemory, 0); else _clip_retl(ClipMachineMemory, 1); return 0; }
int clip_SETCLIPBOARDDATA(ClipMachine * mp) { int len; char * data = _clip_parcl(mp,1,&len); if ( data == NULL ) _clip_retl(mp,0); else _clip_retl(mp,to_clipboard((const unsigned char *)data,_clip_parni(mp,2),len)); return 0; }
int clip_ISDBRDONLY(ClipMachine * ClipMachineMemory) { const char *__PROC__ = "ISDBRDONLY"; DBWorkArea *wa = cur_area(ClipMachineMemory); CHECKWA(wa); _clip_retl(ClipMachineMemory, wa->rd->readonly); _clip_retl(ClipMachineMemory, wa->rd->memo ? 1 : 0); return 0; }
/* COM_OPEN(nPort|cDevice,[dontused],[dontused],[dontused],l_RTSCTS,l_XONXOFF,lDebug) */ int clip_COM_OPEN(ClipMachine * mp) { int no = _clip_parni(mp, 1); char *dev = _clip_parc(mp, 1); char buf[V24_SZ_PORTNAME+1]; int ctsrts = _clip_parl(mp, 5); int xonxoff = _clip_parl(mp, 6); int dbg = _clip_parl(mp, 7); v24_port_t *gz; int *err, k; if (!_clip_parinfo(mp, 5) && !!_clip_parinfo(mp, 5)) ctsrts = 1; if (!dev && (no < 1 || no > 32)) return EG_ARG; if (!dev) { v24PortName(no - 1, buf); dev = buf; } gz = v24OpenPort(dev, V24_STANDARD | V24_LOCK /*| V24_NO_DELAY*/ | (ctsrts ? V24_RTS_CTS : 0) | (xonxoff ? V24_XON_XOFF : 0) | V24_DROP_DTR | (dbg ? V24_DEBUG_ON : 0) ); if (!gz) { err = _clip_fetch_item(mp, HASH_ferror); *err = errno; _clip_retl(mp, 0); return 0; } k = _clip_store_c_item(mp, gz, _C_ITEM_TYPE_COMPORT, destroy_com_port); keys[no] = k; _clip_retl(mp, 1); return 0; }
int clip_ISCLIPBOARDFORMATAVAILABLE(ClipMachine * mp) { int f=_clip_parni(mp,1); _clip_retl(mp, f > 0 && f < CF_MAX ); return 0; }
/****************************************************************************** * gtk_TreeStoreIsAncestor(tree, ancestor_path_string, descendant_path_string)-->TRUE or FALSE ******************************************************************************/ int clip_GTK_TREESTOREISANCESTOR(ClipMachine * ClipMachineMemory) { C_object *cstree = _fetch_co_arg(ClipMachineMemory); gchar *ancestor = _clip_parc(ClipMachineMemory, 2); gchar *descendant = _clip_parc(ClipMachineMemory, 3); GtkTreeIter aiter; GtkTreeIter diter; gboolean ret; CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCOBJ(cstree, GTK_IS_TREE_STORE(cstree->object)); CHECKARG(2, CHARACTER_type_of_ClipVarType); CHECKARG(3, CHARACTER_type_of_ClipVarType); gtk_tree_model_get_iter(GTK_TREE_MODEL(GTK_TREE_STORE(cstree->object)), &aiter, gtk_tree_path_new_from_string(ancestor)); gtk_tree_model_get_iter(GTK_TREE_MODEL(GTK_TREE_STORE(cstree->object)), &diter, gtk_tree_path_new_from_string(descendant)); ret = gtk_tree_store_is_ancestor(GTK_TREE_STORE(cstree->object), &aiter, &diter); _clip_retl(ClipMachineMemory, ret); return 0; err: return 1; }
int clip_FCGI_ACCEPT(ClipMachine *mp) { int r; if (inited) { flush_bufs(); FCGX_Finish(); } r = FCGX_Accept(&in, &out, &err, &envp); /*r = FCGI_Accept();*/ _clip_retl(mp, (r >= 0) ? 1 : 0); if (!inited) { inited = 1; init_Buf(&obuf); init_Buf(&ebuf); mp->obuf = &obuf; mp->ebuf = &ebuf; } return 0; }
/* Calculates the intersection of two rectangles. */ int clip_GDK_RECTANGLEINTERSECT(ClipMachine * ClipMachineMemory) { ClipVar *creg1 = _clip_spar(ClipMachineMemory, 1); ClipVar *creg2 = _clip_spar(ClipMachineMemory, 2); //ClipVar *cdest = _clip_spar(ClipMachineMemory,3); GdkRectangle reg1, reg2, dest; CHECKARG(1, MAP_type_of_ClipVarType); CHECKARG(2, MAP_type_of_ClipVarType); CHECKOPT(3, MAP_type_of_ClipVarType); _map_get_gdk_rectangle(ClipMachineMemory, creg1, ®1); _map_get_gdk_rectangle(ClipMachineMemory, creg2, ®2); _clip_retl(ClipMachineMemory, gdk_rectangle_intersect(®1, ®2, &dest)); if (_clip_parinfo(ClipMachineMemory, 3) == MAP_type_of_ClipVarType) _map_put_gdk_rectangle(ClipMachineMemory, _clip_spar(ClipMachineMemory, 3), &dest); return 0; err: return 1; }
/* TaskSendMsg( nReceiverID, vMsg [, lWaitProcessed] ) --> lResult send var vMsg to task with id nReceiverID */ int clip_TASKSENDMSG(ClipMachine * mp) { #ifdef USE_TASKS long receiver; ClipVar *vp; int wait = 0, r; TaskMessage *tp; if (mp->argc<2) return EG_ARG; receiver = _clip_parnl(mp, 1); vp = _clip_par(mp, 2); wait = _clip_parl(mp,3); tp = TaskMessage_new(HASH_VarMessage, msg_data_new(mp, vp), msg_data_destroy); if (wait) r = Task_sendMessageWait(receiver, tp); else r = Task_sendMessage(receiver, tp); _clip_retl(mp, r); #endif return 0; }
int clip_COMPLEMENT(ClipMachine * ClipMachineMemory) { int len, dec; long d1, d2; int t = _clip_parinfo(ClipMachineMemory, 1); switch (t) { case LOGICAL_type_of_ClipVarType: _clip_retl(ClipMachineMemory, _clip_parl(ClipMachineMemory, 1)); break; case NUMERIC_type_of_ClipVarType: _clip_parp(ClipMachineMemory, 1, &len, &dec); _clip_retndp(ClipMachineMemory, 0.00 - _clip_parnd(ClipMachineMemory, 1), len, dec); break; case CHARACTER_type_of_ClipVarType: clip_CHARNOT(ClipMachineMemory); break; case DATE_type_of_ClipVarType: d1 = _clip_jdate(1, 1, 3000); d2 = _clip_pardj(ClipMachineMemory, 1); if (d2 == 0) _clip_retdj(ClipMachineMemory, d1); else _clip_retdj(ClipMachineMemory, d1 - d2 + _clip_jdate(7, 1, 0)); break; } return 0; }
int clip_GTK_BUTTONBOXGETCHILDSECONDARY(ClipMachine * ClipMachineMemory) { C_widget *cbbox = _fetch_cw_arg(ClipMachineMemory); ClipVar *cv = _clip_spar(ClipMachineMemory, 2); C_widget *cwid; GtkWidget *wid = 0; CHECKCWID(cbbox, GTK_IS_BUTTON_BOX); _clip_retl(ClipMachineMemory, gtk_button_box_get_child_secondary(GTK_BUTTON_BOX(cbbox->widget), wid)); if (wid) { cwid = _list_get_cwidget(ClipMachineMemory, wid); if (!cwid) cwid = _register_widget(ClipMachineMemory, wid, NULL); if (cwid) _clip_mclone(ClipMachineMemory, cv, &cwid->obj); } return 0; err: return 1; }
int clip_GTK_TREESELECTIONGETSELECTED(ClipMachine * cm) { C_object *ctreesel = _fetch_co_arg(cm); C_object *cmodel = _fetch_cobject(cm, _clip_par(cm, 2)); ClipVar *cviter = _clip_par(cm, 3); C_object *citer; GtkTreeModel *model; gboolean ret; CHECKOPT2(1, MAP_t, NUMERIC_t); CHECKCOBJ(ctreesel,GTK_IS_TREE_SELECTION(ctreesel->object)); memset(Iter, 0, sizeof(Iter)); if (cmodel) { model = GTK_TREE_MODEL(cmodel->object); ret = gtk_tree_selection_get_selected(GTK_TREE_SELECTION(ctreesel->object), &model, Iter); } else ret = gtk_tree_selection_get_selected(GTK_TREE_SELECTION(ctreesel->object), NULL, Iter); if (ret && Iter) { citer = _list_get_cobject(cm,Iter); if (!citer) citer = _register_object(cm,Iter,GTK_TYPE_TREE_ITER, cviter, NULL); if (citer) _clip_mclone(cm, cviter,&citer->obj); } _clip_retl(cm, ret); return 0; err: return 1; }
int clip_COM_RTS(ClipMachine * mp) { v24_port_t *gz; int fd = _clip_parni(mp, 1); int flag = _clip_parl(mp, 2); int oflag; if (fd < 1 || fd > 32) return EG_ARG; fd = keys[fd]; gz = (v24_port_t *) _clip_fetch_c_item(mp, fd, _C_ITEM_TYPE_COMPORT); if (!gz) return (EG_ARG); oflag = 0; if (mp->argc > 1) { oflag = v24SetRTS(gz, flag); } _clip_retl(mp, oflag ? 0 : 1); return 0; }
int clip_FACCESS(ClipMachine * ClipMachineMemory) { int ret = 0, mode = 0; char *uname = _get_unix_name(ClipMachineMemory, _clip_parc(ClipMachineMemory, 1)); char *m = _clip_parc(ClipMachineMemory, 2); if (uname != NULL && m != NULL) { while (*m) { switch (*m++) { case 'r': mode |= R_OK; break; case 'w': mode |= W_OK; break; case 'x': mode |= X_OK; break; case 'f': mode |= F_OK; break; } } ret = access(uname, mode) ? 0 : 1; } _clip_retl(ClipMachineMemory, ret); return 0; }
int clip_GTK_SIGNALEMIT(ClipMachine *cm) { C_widget *cwid = _fetch_cw_arg(cm); SignalTable *sig_table = NULL; int ret=0; CHECKCWID(cwid,GTK_IS_OBJECT); CHECKARG2(2,CHARACTER_t,NUMERIC_t); if (_clip_parinfo(cm,2) == CHARACTER_t) sig_table = _sig_table_by_name(cwid, _clip_parc(cm,2)); else sig_table = _sig_table_by_id(cwid, _clip_parni(cm,2)); if (sig_table && sig_table->emitsigfunction) { if (cwid && cwid->widget && GTK_IS_OBJECT(cwid->widget)) ret = sig_table->emitsigfunction(cwid,sig_table->signame); //int sigfound = gtk_signal_lookup(signame, GTK_WIDGET_TYPE(cwid->widget)); } _clip_retl(cm,sig_table && sig_table->sigfunction); return ret; err: return 1; }
int clip_COM_INIT(ClipMachine * mp) { v24_port_t *gz; int ret = -1, *err; int fd = _clip_parni(mp, 1); int baud = 9600, data = 8, stop = 1; char *parity = "N"; if (fd < 1 || fd > 32) return EG_ARG; fd = keys[fd]; gz = (v24_port_t *) _clip_fetch_c_item(mp, fd, _C_ITEM_TYPE_COMPORT); if (!gz) return EG_ARG; if (_clip_parinfo(mp, 2) == NUMERIC_t) baud = _clip_parni(mp, 2); if (_clip_parinfo(mp, 3) == CHARACTER_t) parity = _clip_parc(mp, 3); if (_clip_parinfo(mp, 4) == NUMERIC_t) data = _clip_parni(mp, 4); if (_clip_parinfo(mp, 5) == NUMERIC_t) stop = _clip_parni(mp, 5); err = _clip_fetch_item(mp, HASH_ferror); ret = v24SetParameters(gz, baud_val(baud), data_val(data), parity_val(parity)); _clip_retl(mp, ret ? 0 : 1); return 0; }
int clip_GLOB(ClipMachine * ClipMachineMemory) { char *str = _clip_parc(ClipMachineMemory, 1); char *pattern = _clip_parc(ClipMachineMemory, 2); int caseflag = _clip_parl(ClipMachineMemory, 3); if (!str || !*pattern) _clip_retl(ClipMachineMemory, 0); else _clip_retl(ClipMachineMemory, _clip_glob_match(str, pattern, caseflag) >= 0); return 0; }
int clip_GTK_COMBOBOXGETACTIVEITER(ClipMachine * ClipMachineMemory) { C_widget *ccmb = _fetch_cw_arg(ClipMachineMemory); ClipVar *cv = _clip_spar(ClipMachineMemory, 2); C_object *citer; CHECKCWID(ccmb, GTK_IS_COMBO_BOX); _clip_retl(ClipMachineMemory, gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ccmb->widget), Iter)); if (Iter) { citer = _list_get_cobject(ClipMachineMemory, Iter); if (!citer) citer = _register_object(ClipMachineMemory, Iter, GTK_TYPE_TREE_ITER, NULL, NULL); if (citer) _clip_mclone(ClipMachineMemory, cv, &citer->obj); } return 0; err: return 1; }
/* COM_HARD(<nComPort>,<lNewHandshake>,[<lDTR/DSR>]) --> lOldHandshake */ int clip_COM_HARD(ClipMachine * mp) { v24_port_t *gz; int fd = _clip_parni(mp, 1); int flag = _clip_parl(mp, 2); int oflag; if (fd < 1 || fd > 32) return EG_ARG; fd = keys[fd]; gz = (v24_port_t *) _clip_fetch_c_item(mp, fd, _C_ITEM_TYPE_COMPORT); if (!gz) return (EG_ARG); oflag = gz->OpenFlags & V24_RTS_CTS; if (mp->argc > 1) { if (flag) gz->OpenFlags |= V24_RTS_CTS; else gz->OpenFlags &= ~V24_RTS_CTS; v24SetParameters(gz, gz->Baudrate, gz->Datasize, gz->Parity); } _clip_retl(mp, oflag ? 1 : 0); return 0; }
int clip_RLOCK(ClipMachine * ClipMachineMemory) { const char *__PROC__ = "RLOCK"; DBWorkArea *wa = cur_area(ClipMachineMemory); int r, er; if (!wa) return 0; if ((er = _clip_flushbuffer(ClipMachineMemory, wa, __PROC__))) goto err; READLOCK; if (!(ClipMachineMemory->flags1 & MULTILOCKS_FLAG)) { if ((er = rdd_ulock(ClipMachineMemory, wa->rd, 0, 0, __PROC__))) goto err_unlock; } if (wa->rd->pending_child_parent) if ((er = rdd_child_duty(ClipMachineMemory, wa->rd, __PROC__))) goto err_unlock; if ((er = rdd_rlock(ClipMachineMemory, wa->rd, wa->rd->recno, &r, __PROC__))) goto err_unlock; UNLOCK; _clip_retl(ClipMachineMemory, r); return 0; err_unlock: wa->rd->vtbl->_ulock(ClipMachineMemory, wa->rd, __PROC__); err: return er; }
int clip_SX_SETTAG(ClipMachine * ClipMachineMemory) { const char *__PROC__ = "SX_SETTAG"; DBWorkArea *wa = cur_area(ClipMachineMemory); ClipVar *order = _clip_par(ClipMachineMemory, 1); ClipVar *index = _clip_par(ClipMachineMemory, 2); int ord, er; ClipMachineMemory->m6_error = 0; if (!wa) return 0; CHECKOPT2(1, CHARACTER_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKOPT1(2, CHARACTER_type_of_ClipVarType); _clip_retl(ClipMachineMemory, 0); if ((order->ClipType_t_of_ClipVar.ClipVartype_type_of_ClipType == NUMERIC_type_of_ClipVarType) && (order->ClipNumVar_n_of_ClipVar.double_of_ClipNumVar == 0)) { ord = -1; } else { ord = get_orderno(wa, order, index); if (ord < 0 || ord >= wa->rd->ords_opened || _clip_parinfo(ClipMachineMemory, 0) == 0) return 0; } if ((er = rdd_flushbuffer(ClipMachineMemory, wa->rd, __PROC__))) goto err; READLOCK; if ((er = rdd_setorder(ClipMachineMemory, wa->rd, ord + 1, __PROC__))) goto err_unlock; UNLOCK; _clip_retl(ClipMachineMemory, 1); return 0; err_unlock: wa->rd->vtbl->_ulock(ClipMachineMemory, wa->rd, __PROC__); err: return er; }
/* Returns TRUE if the given key value is in upper case. */ int clip_GDK_KEYVALISUPPER(ClipMachine * ClipMachineMemory) { guint keyval = INT_OPTION(ClipMachineMemory, 1, 0); _clip_retl(ClipMachineMemory, gdk_keyval_is_upper(keyval)); return 0; }
/* Raise window */ int clip_GTK_WINDOWRAISE(ClipMachine * cm) { C_widget *cwin = _fetch_cw_arg(cm); CHECKCWID(cwin,GTK_IS_WINDOW); if (cwin->widget->window) { gdk_window_raise(cwin->widget->window); _clip_retl(cm, TRUE); } else _clip_retl(cm, FALSE); return 0; err: return 1; }
/* Converts a key value to lower case, if applicable. */ int clip_GDK_KEYVALTOLOWER(ClipMachine * ClipMachineMemory) { guint keyval = INT_OPTION(ClipMachineMemory, 1, 0); _clip_retl(ClipMachineMemory, gdk_keyval_to_lower(keyval)); return 0; }