X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Mailer: exmh version 2.8.0 04/21/2012 (debian 1:2.8.0~rc1-2) with nmh-1.5 X-Exmh-Isig-CompType: repl X-Exmh-Isig-Folder: inbox From: karl AT aspodata DOT se To: geda-user AT delorie DOT com Subject: Re: [geda-user] A lesson from gnet-makefile In-reply-to: <20151016213030.GC2813@localhost.localdomain> References: <1042003D-82E2-40F0-AB60-8186580C46AD AT noqsi DOT com> <201510121905 DOT t9CJ5T9W026297 AT envy DOT delorie DOT com> <88EA58F5-2B23-498A-9E5B-84054976DBED AT noqsi DOT com> <4D3CD563-D8EE-4B2A-975A-AC2B573960FF AT noqsi DOT com> <20151016213030 DOT GC2813 AT localhost DOT localdomain> Comments: In-reply-to "Vladimir Zhbanov (vzhbanov AT gmail DOT com) [via geda-user AT delorie DOT com]" message dated "Sat, 17 Oct 2015 00:30:30 +0300." Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20151017215428.7E79B8104E54@turkos.aspodata.se> Date: Sat, 17 Oct 2015 23:54:28 +0200 (CEST) X-Virus-Scanned: ClamAV using ClamSMTP Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Vladimir > On Tue, Oct 13, 2015 at 02:02:53PM -0400, Evan Foss (evanfoss AT gmail DOT com) > [via geda-user AT delorie DOT com] wrote: ... > > I understand that but I would really like to go back and do more of > > this in C. The final parsing of the net attributes into xyz output > > format should be in scheme. Although I could be wrong. > Do it the way you like it. I hope, if we'll have algorithms we need, > we'll be able to express them in the language we want. > > I can only note that Scheme is a hi-level language wrt C and sometimes > (not always) it's better to express things in it rather than in C. > > For example, the following code from gsymcheck > > ------------------------8<-------------------------- > SCM_DEFINE (...) > { > TOPLEVEL* pr_current = edascm_c_current_toplevel (); > GList *iter; > PAGE *p_current; > SCM page_s; > SCM return_status = scm_from_int (0); > > /* C code to check all symbols */ > > for ( iter = geda_list_get_glist( pr_current->pages ); > iter != NULL; > iter = g_list_next( iter ) ) { > > p_current = (PAGE *)iter->data; > page_s = edascm_from_page (p_current); > > return_status = scm_sum (return_status, check_symbol (page_s)); > } > > return return_status; > } > ------------------------>8-------------------------- > > can be replaced just with > > ------------------------8<-------------------------- > (apply + (map check-symbol (active-pages))) > ------------------------>8-------------------------- > > in guile module (I'm just working on this) I consider that an unfair comparison. The the c code have to convert the data which is in scheme so it has to do a fair amaount of conversions to please the scheme part of geda, hence it looks messy. If you like you could write a map-lookalike in c and possibly the same for apply, but the coder obviously didn't bother. If you want elegance, you can do that to a degree in c also. Regards, /Karl Hammar ----------------------------------------------------------------------- Aspö Data Lilla Aspö 148 S-742 94 Östhammar Sweden +46 173 140 57