PureBasic 6: EnableC like EnableASM

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
IceSoft
Addict
Addict
Posts: 1616
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

PureBasic 6: EnableC like EnableASM

Post by IceSoft »

Code: Select all

Value.l = 10  ; Declare our own variable

EnableC
 #include "myHeaderFile.h"

  Value++;
DisableC

MessageRequester("C Example", "Should be 11: " + Value)
Like the example as ASM:

Code: Select all

Value.l = 10  ; Declare our own variable

EnableASM
  MOV Value, 20 ; Directly use the ASM keywords with PureBasic variable !
  INC Value
DisableASM

MessageRequester("ASM Example", "Should be 21: " + Value)
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: PureBasic 6: EnableC like EnableASM

Post by Keya »

That would be soooo sweet! :) best of both worlds
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: PureBasic 6: EnableC like EnableASM

Post by Saki »

I think in itself that it is aimed to realize this so.
It is the logical conclusion.
Unfortunately, I do not know if this is so easy to implement.
The possibilities of this construction are very wide.
地球上の平和
Aleks_Longard
User
User
Posts: 59
Joined: Mon Dec 24, 2012 9:07 am
Location: Germany, Munich

Re: PureBasic 6: EnableC like EnableASM

Post by Aleks_Longard »

IceSoft
I want this instruction too...
Sory my bad english
juergenkulow
Enthusiast
Enthusiast
Posts: 544
Joined: Wed Sep 25, 2019 10:18 am

Re: PureBasic 6: EnableC like EnableASM

Post by juergenkulow »

Hello IceSoft,
PB_C is a delightful, elaborate task.
But at the moment is on offer:

Code: Select all

F:\PureBasic6Alpha\Compilers>gcc --version
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
F:\PureBasic6Alpha\Compilers>cc1 -version
GNU C17 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)
        compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
F:\PureBasic6Alpha\Compilers>As -v
GNU assembler version 2.30 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.30
What is the value of a multilingual Unicode programming language?
Please ask your questions, because switch on the cognition apparatus decides on the only known life in the universe.Wersten :DDüsseldorf NRW Germany Europe Earth Solar System Flake Bubble Orionarm
Milky Way Local_Group Virgo Supercluster Laniakea Universe
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: PureBasic 6: EnableC like EnableASM

Post by Saki »

Well, the offer of C codes is almost immeasurably large and there are really very clever little codes.
One can therefore also turn the question around :
What would be the disadvantages if it were supported ?

Actually, it would have only advantages.
Assembler is also supported by PB, which is nothing different in itself.
And C is much easier to understand than assembler.
地球上の平和
juergenkulow
Enthusiast
Enthusiast
Posts: 544
Joined: Wed Sep 25, 2019 10:18 am

Re: PureBasic 6: EnableC like EnableASM

Post by juergenkulow »

Code: Select all

; EnableC idea with C Preprocesser #include "file.c"
Value.l = 10  ; Declare our own variable
! #include "H:\C2_21\IncValue.c" 
; In IncValue.c is only one line: v_value++; 
; without exclamation mark every line but With v_, p_, f_, or l_ Prefix for PB things and in lower case.   
; #include is with quotation marks and full file path. 
SetClipboardText("C Example"+#CRLF$+"Should be 11:" + Value +" :D")
MessageRequester("C Example", "Should be 11: " + Value)
; But for the asm-world, you must do: 
! asm volatile ( "xor %r9,%r9"); 
; C Example
; Should be 11:11 :D
;00000001400011B1 | 4D:31C9                  | XOr r9,r9                               | r9:EntryPoint
Delete: CompilerIf #PB_Processor_C<>#PB_Compiler_Processor

H:\C2_21\IncValue.c:

Code: Select all

v_value++; // PB variable with v_ Prefix and in lower case.
Please ask your questions, because switch on the cognition apparatus decides on the only known life in the universe.Wersten :DDüsseldorf NRW Germany Europe Earth Solar System Flake Bubble Orionarm
Milky Way Local_Group Virgo Supercluster Laniakea Universe
Post Reply