type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;
type group_position = UndefPos | LeftPos | RightPos ;; type cycle_type = UndefCycle | NoneCycle | AliphaticCycle | AromaticCycle | HeteroCycle ;; type group_type = OrgGroup | InorgGroup | NeighbourGroup of int ;; type group = { name : string ; position : group_position ; cycle : cycle_type ; grouptype : group_type ; link : int ; } ;;
let filter_org = List 。 フィルタ ( fun r- > if r。grouptype = OrgGroup then true else false )
let _ =コールバック 「filter_organic」 filter_orgを登録し ます。;;
#include <ベクトル>typedef enum _group_position {UndefPos = 0 、LeftPos、Rightpos} group_position ;typedef enum _cycle_type {UndefCycle = 0 、NoneCycle、AliphaticCycle、AromaticCycle、ヘテロサイクル} cycle_type ;typedef enum _group_pos {OrgGroup = -2 、InorgGroup = -1} group_pos ;typedef struct _group {char * name ;group_position位置;cycle_typeサイクル;int group_type ;intリンク;}グループ;void init_ocaml ( ) ;std :: vector < group > filter_org ( std :: vector < group > g ) ;
#include "cpart.h"#ifdef __cplusplusextern "C"{#endif#include <caml / mlvalues.h>#include <caml / alloc.h>#include <caml / callback.h>#include <caml / fail.h>#include <caml / memory.h>#ifdef __cplusplus}#endif#include <string.h>
void init_ocaml ( ){char * argv [ 1 ] ;argv [ 0 ] = NULL ;caml_main ( argv ) ;}std :: vector < group > filter_org ( std :: vector < group > g ){Camlparam0 ( ) ;静的値* closure_f = NULL ;if ( closure_f == NULL )closure_f = caml_named_value ( "filter_organic" ) ;CAMLlocal3 ( cli、cons、cb_res ) ;cli = Val_emptylist ;for ( std :: vector < group > :: イテレーター i = g。begin ( ) ; i ! = g。end ( ) ; ++ i ){cons = caml_alloc ( 2、0 ) ;Store_field ( cons、 0 、camlgroup_of_group ( & ( * i ) ) ) ;Store_field ( cons、 1 、cli ) ;cli = cons ;}cb_res = caml_callback ( * closure_f、cli ) ;std :: vector < group > result ;while ( cb_res ! = Val_emptylist ){結果。 push_back ( group_of_camlgroup ( Field ( cb_res、 0 ) ) ) ;cb_res =フィールド( cb_res、 1 ) ;}結果を返す ;}
ocamlpart 。 o : ocamlpart 。 mlocamlopt - g-出力-obj $ ^ -o $ @ccamlpart 。 o : ccamlpart 。 ccg ++ - g - c - o $ @ -I "` ocamlc -where` " $ ^libchempart 。 a : ocamlpart 。 o ccamlpart 。 oar rcs $ @ $ ^all : libchempart 。 aきれい:rm - f *。 o *。 *。 cmi *。 cmx
PHP_MINIT_FUNCTION ( chemlib ){init_ocaml ( ) ;zend_class_entry chemlib_ce ;INIT_CLASS_ENTRY ( chemlib_ce、PHP_CHEMLIB_CLASS_NAME、chemlib_class_functions ) ;chemlib_class_entry = zend_register_internal_class ( & chemlib_ce TSRMLS_CC ) ;zend_declare_property_string ( chemlib_class_entry、 ( char * ) "name" 、 4 、 ( char * ) "" 、ZEND_ACC_PUBLIC TSRMLS_CC ) ;zend_declare_property_long ( chemlib_class_entry、 ( char * ) "position" 、8、0、ZEND_ACC_PUBLIC TSRMLS_CC ) ;zend_declare_property_long ( chemlib_class_entry、 ( char * ) "cycle" 、 5、0 、ZEND_ACC_PUBLIC TSRMLS_CC ) ;zend_declare_property_long ( chemlib_class_entry、 ( char * ) "group_type" 、10、0、ZEND_ACC_PUBLIC TSRMLS_CC ) ;zend_declare_property_long ( chemlib_class_entry、 ( char * ) "link" 、4、0、ZEND_ACC_PUBLIC TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "UndefPos" 、8、0 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "LeftPos" 、7、1 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "RightPos" 、8、2 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "UndefCycle" 、10、0 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "NoneCycle" 、9、1 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "AliphaticCycle" 、14、2 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "AromaticCycle" 、13、3 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "HeteroCycle" 、11、4 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "OrgGroup" 、 8 、 -2 TSRMLS_CC ) ;zend_declare_class_constant_long ( chemlib_class_entry、 ( char * ) "InorgGroup" 、 10 、 -1 TSRMLS_CC ) ;} ;
zval * phpgroup_of_group ( group * gr ){zval * res ;ALLOC_INIT_ZVAL (解像度) ;object_init_ex ( res、chemlib_class_entry ) ;zend_update_property_string ( Z_OBJCE_P ( res ) 、res、 ( char * ) "name" 、 4 、gr- > name TSRMLS_CC ) ;zend_update_property_long ( Z_OBJCE_P ( res ) 、res、 ( char * ) "position" 、 8 、gr- > position TSRMLS_CC ) ;zend_update_property_long ( Z_OBJCE_P ( res ) 、res、 ( char * ) "cycle" 、 5 、gr- > cycle TSRMLS_CC ) ;zend_update_property_long ( Z_OBJCE_P ( res ) 、res、 ( char * ) "group_type" 、 10 、gr- > group_type TSRMLS_CC ) ;zend_update_property_long ( Z_OBJCE_P ( res ) 、res、 ( char * ) "link" 、 4 、gr- > link TSRMLS_CC ) ;解像度を返す ;}グループgroup_of_phpgroup ( zval * gr ){グループres、def ;zval * x = zend_read_property ( chemlib_class_entry、gr、 ( char * ) "name" 、4、1 TSRMLS_CC ) ;if ( Z_TYPE_P ( x ) ! = IS_STRING )return def ;解像度 name = estrdup ( Z_STRVAL_P ( x ) ) ;x = zend_read_property ( chemlib_class_entry、gr、 ( char * ) "position" 、8、1 TSRMLS_CC ) ;if ( Z_TYPE_P ( x ) ! = IS_LONG )return def ;解像度 position = ( group_position ) Z_LVAL_P ( x ) ;x = zend_read_property ( chemlib_class_entry、gr、 ( char * ) "cycle" 、5、1 TSRMLS_CC ) ;if ( Z_TYPE_P ( x ) ! = IS_LONG )return def ; li style = "font-weight:n
Source: https://habr.com/ru/post/J98185/More articles:豊富な署名、またはMSコンパイラが隠すものKingmax Hercules DDR3 2200オーバークロックメモリとオーバークロックのバリエーションについて4GB RAM-32ビットまたは64ビットシステム?FireFox for Maemo-最終版ハブロヴォストヴォソーシャルネットワーク-接続型またはタイムスティーラー人生のさまざまな段階でテクノロジーと対話する際の人間の困難Google AppsアカウントはGoogleアカウントになりますAndroid向けmail.ruのモバイルエージェントフリーランサーと一緒に最後の2つのプロジェクトを行う理由All Articles